77
88
99; -----------------------------------------------------------------------------
10- ; b_input -- Scans keyboard for input
10+ ; b_input -- Scans for input
1111; IN: Nothing
1212; OUT: AL = 0 if no key pressed, otherwise ASCII code, other regs preserved
1313; All other registers preserved
1414b_input:
15- mov al , [ key ]
15+ mov al , [ key ] ; Keyboard/Serial interrupt handler sets key
1616 test al , al
1717 jz b_input_no_key
18- mov byte [ key ], 0x00 ; clear the variable as the keystroke is in AL now
18+ mov byte [ key ], 0x00 ; Clear the variable as the keystroke is in AL now
1919b_input_no_key:
2020 ret
2121; -----------------------------------------------------------------------------
@@ -44,6 +44,14 @@ b_output_serial:
4444
4545b_output_serial_next:
4646 lodsb ; Load a byte from the string into AL
47+ cmp al , 3 ; Check for Decrement cursor
48+ je b_output_serial_decrement
49+ cmp al , 10 ; Check for Line Feed
50+ jne b_output_serial_send
51+ mov al , 13 ; Carriage Return
52+ call serial_send
53+ mov al , 10
54+ b_output_serial_send:
4755 call serial_send ; Output it via serial
4856 dec cx ; Decrement the counter
4957 jnz b_output_serial_next ; Loop if counter isn't zero
@@ -52,6 +60,11 @@ b_output_serial_next:
5260 pop rcx
5361 pop rsi
5462 ret
63+
64+ b_output_serial_decrement:
65+ mov al , 8 ; Backspace
66+ jmp b_output_serial_send
67+
5568; -----------------------------------------------------------------------------
5669
5770
0 commit comments