Add beep when escape is sent
This commit is contained in:
parent
2aaae86c8a
commit
1ca2ba1e6b
1 changed files with 28 additions and 0 deletions
28
messages.asm
28
messages.asm
|
@ -37,6 +37,8 @@ int 0x10
|
||||||
je .newline
|
je .newline
|
||||||
cmp al, 0x08 ; delete character
|
cmp al, 0x08 ; delete character
|
||||||
je .change_color_mode
|
je .change_color_mode
|
||||||
|
cmp al, 0x1b ; escape character
|
||||||
|
je .beep
|
||||||
jmp .nonewline
|
jmp .nonewline
|
||||||
|
|
||||||
.change_color_mode:
|
.change_color_mode:
|
||||||
|
@ -80,6 +82,32 @@ int 0x10
|
||||||
|
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
|
.beep:
|
||||||
|
mov al, 182 ; Prepare the speaker for the
|
||||||
|
out 43h, al ; note.
|
||||||
|
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
|
||||||
|
in al, 61h ; Turn on note (get value from
|
||||||
|
; port 61h).
|
||||||
|
or al, 00000011b ; Set bits 1 and 0.
|
||||||
|
out 61h, al ; Send new value.
|
||||||
|
mov bx, 5000 ; Pause for duration of note.
|
||||||
|
.pause1:
|
||||||
|
mov cx, 65535
|
||||||
|
.pause2:
|
||||||
|
dec cx
|
||||||
|
jne .pause2
|
||||||
|
dec bx
|
||||||
|
jne .pause1
|
||||||
|
in al, 61h ; Turn off note (get value from
|
||||||
|
; port 61h).
|
||||||
|
and al, 11111100b ; Reset bits 1 and 0.
|
||||||
|
out 61h, al ; Send new value.
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
|
||||||
.nonewline:
|
.nonewline:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue