Add beep with ESC with frequencies
This commit is contained in:
parent
1ca2ba1e6b
commit
26f7032808
1 changed files with 28 additions and 21 deletions
47
messages.asm
47
messages.asm
|
@ -27,6 +27,7 @@ mov dl, 0x00
|
|||
mov bh, 0x00
|
||||
mov ah, 0x02
|
||||
int 0x10
|
||||
mov sp, 0x2000
|
||||
|
||||
.loop:
|
||||
;; Read character
|
||||
|
@ -42,21 +43,7 @@ int 0x10
|
|||
jmp .nonewline
|
||||
|
||||
.change_color_mode:
|
||||
;; Read character
|
||||
mov ah, 0x00
|
||||
int 0x16
|
||||
;; Read character is in al
|
||||
sub al, 'a'
|
||||
mov bl, al
|
||||
shl bl, 0x4
|
||||
|
||||
;; Read character
|
||||
mov ah, 0x00
|
||||
int 0x16
|
||||
;; Read character is in al
|
||||
sub al, 'a'
|
||||
or al, bl
|
||||
|
||||
call .readbyte
|
||||
mov [color_mode], al
|
||||
jmp .loop
|
||||
|
||||
|
@ -85,8 +72,12 @@ int 0x10
|
|||
.beep:
|
||||
mov al, 182 ; Prepare the speaker for the
|
||||
out 43h, al ; note.
|
||||
mov ax, 4560 ; Frequency number (in decimal)
|
||||
; for middle C.
|
||||
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
|
||||
|
@ -94,7 +85,7 @@ int 0x10
|
|||
; port 61h).
|
||||
or al, 00000011b ; Set bits 1 and 0.
|
||||
out 61h, al ; Send new value.
|
||||
mov bx, 5000 ; Pause for duration of note.
|
||||
mov bx, 50000 ; Pause for duration of note.
|
||||
.pause1:
|
||||
mov cx, 65535
|
||||
.pause2:
|
||||
|
@ -142,7 +133,6 @@ int 0x10
|
|||
mov dl, 0x00
|
||||
mov ah, 0x02
|
||||
int 0x10
|
||||
|
||||
jmp .loop
|
||||
|
||||
.noeol:
|
||||
|
@ -151,9 +141,26 @@ int 0x10
|
|||
inc dl
|
||||
mov ah, 0x02
|
||||
int 0x10
|
||||
|
||||
jmp .loop
|
||||
|
||||
|
||||
.readbyte:
|
||||
;; Read character
|
||||
mov ah, 0x00
|
||||
int 0x16
|
||||
;; Read character is in al
|
||||
sub al, 'a'
|
||||
mov bl, al
|
||||
shl bl, 0x4
|
||||
|
||||
;; Read character
|
||||
mov ah, 0x00
|
||||
int 0x16
|
||||
;; Read character is in al
|
||||
sub al, 'a'
|
||||
or al, bl
|
||||
ret
|
||||
|
||||
halt: hlt
|
||||
|
||||
color_mode: db 0x02
|
||||
|
|
Loading…
Reference in a new issue