make hex number formats consistent

This commit is contained in:
Tibo 2021-10-07 18:13:09 +02:00
parent a97e70ee99
commit 03be68cfb7

View file

@ -43,7 +43,7 @@ int 0x14
;; Use color mode
mov ax, VIDEO_MODE
int 10h
int 0x10
;; Clear screen
mov ah, 0x06 ; scroll screen up
@ -63,25 +63,25 @@ int 0x10
.loop:
;; read a character, ASCII in al
mov ah, 0x0 ; Read character
mov ah, 0x00 ; Read character
int 0x16
;; a null character will be sent before every command from the virtual keyboard
;; so if a null is detected go to the virtual_kbd_loop instead
cmp al, 0x0 ; null
cmp al, 0x00 ; null
je .virtual_kbd_loop_init
mov ah, 0x1
mov dx, 0x0
mov ah, 0x01
mov dx, 0x00
int 0x14
cmp al, 0x08 ; backspace
je change_color_mode
cmp al, 0x1b ; esc
cmp al, 0x1B ; esc
je beep
cmp al, 0x0d ; enter
cmp al, 0x0D ; enter
je .nl
jmp nonewline ; all other characters
@ -96,19 +96,19 @@ int 0x10
mov byte[is_from_virtual_kbd], 0x1 ; update state variable
.virtual_kbd_loop:
;; read a character, ASCII in al
mov ah, 0x0
mov ah, 0x00
int 0x16
cmp al, 0x08 ; backspace
je change_color_mode
cmp al, 0x1b ; esc
cmp al, 0x1B ; esc
je beep
;; an enter character signifies the end of a command
;; so a newline should get printed and then the program should resume
;; from the main .loop again
cmp al, 0xD ; enter
cmp al, 0x0D ; enter
je .nl_reset_state
jmp nonewline ; all other characters
@ -143,7 +143,7 @@ newline:
;; Move cursor to beginning of screen
mov ah, 0x02 ; set cursors position
mov bh, 0x0 ; page number
mov bh, 0x00 ; page number
mov dh, HEIGHT ; row
mov dl, 0x00 ; col
int 0x10
@ -181,9 +181,9 @@ beep:
;; Port 0x61 does a whole lot but only the bottom 2 bits are relevant here
;; (speaker enable and speaker input select)
in al, 61h ; Preserve previous value
in al, 0x61 ; Preserve previous value
or al, 00000011b ; Set bits 1 and 0 (enable speaker, input = channel 2)
out 61h, al ; Send new value
out 0x61, al ; Send new value
;; mov bx, 50000 ; Pause for duration of note.
@ -205,9 +205,9 @@ beep:
dec bx ; decrement duration counter
jne .pause1 ; keep doing that until it is 0
in al, 61h ; Preserve previous value
in al, 0x61 ; Preserve previous value
and al, 11111100b ; Clear bits 1 and 0 (disable speaker, clear channel select)
out 61h, al ; Send new value
out 0x61, al ; Send new value
jmp compare_virtual_and_jump
@ -255,7 +255,7 @@ nonewline:
;; if it did, jump to the virtual keyboard loop
;; if it didn't, jump to the main loop
compare_virtual_and_jump:
cmp byte[is_from_virtual_kbd], 0x1
cmp byte[is_from_virtual_kbd], 0x01
je start.virtual_kbd_loop
jmp start.loop
@ -277,9 +277,9 @@ readbyte:
int 0x16
;; Read character is in al
sub al, 'a' ; Normalise
sub al, 'a' ; Normalise
mov bl, al
shl bl, 0x4 ; First character is upper 4 bits
shl bl, 0x04 ; First character is upper 4 bits
mov ah, 0x00 ; Read character
int 0x16
@ -311,7 +311,7 @@ read_duration:
;; Variable to store color mode information for writing to the screen
color_mode: db 0x02
;; State variable for detecting whether keystrokes are virtual or real
is_from_virtual_kbd: db 0x0
is_from_virtual_kbd: db 0x00
;; Magic number must be in the last 2 bytes of the sector so
;; fill the binary with zeroes until it is 510 bytes in size