Commit a8a7a3d3 authored by j's avatar j

Add duration of note

parent 26f70328
......@@ -70,14 +70,15 @@ mov sp, 0x2000
jmp .loop
.beep:
call .readduration
mov ah, 0
push ax
mov al, 182 ; Prepare the speaker for the
out 43h, al ; note.
call .readbyte
mov ah, 0
sal ax, 5 ; multiply by 32
add ax, 1140
;mov ax, 4560 ; Frequency number (in decimal)
; ; for middle C.
out 42h, al ; Output low byte.
mov al, ah ; Output high byte.
out 42h, al
......@@ -85,7 +86,14 @@ mov sp, 0x2000
; port 61h).
or al, 00000011b ; Set bits 1 and 0.
out 61h, al ; Send new value.
mov bx, 50000 ; Pause for duration of note.
;; mov bx, 50000 ; Pause for duration of note.
pop bx
push ax
mov ax, 3125
mul bx
mov bx, ax
pop ax
.pause1:
mov cx, 65535
.pause2:
......@@ -161,6 +169,14 @@ mov sp, 0x2000
or al, bl
ret
.readduration:
;; Read duration (0-16 supported)
mov ah, 0x00
int 0x16
;; Read character is in al
sub al, 'a'
ret
halt: hlt
color_mode: db 0x02
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment