Add beep when escape is sent

This commit is contained in:
redfast00 2019-09-19 00:37:09 +02:00
parent 2aaae86c8a
commit 1ca2ba1e6b
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C

View file

@ -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: