Last active
February 14, 2019 16:37
-
-
Save jeff-1amstudios/66cee5f3dd4e57c601e188ffc73d702d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.main_loop | |
jsr keyboard_read | |
jsr rs232_try_read_byte | |
cmp #0 | |
bne .got_byte ; if we got a byte from serial conn, goto .got_byte... | |
jmp .main_loop ; ... otherwise, jump back to .main_loop | |
.got_byte | |
ldy flash_screen_on_data | |
beq .skip_screen_flash ; if screen flashing is not enabled, jump over flashing code | |
inc $d020 ; border_color++ | |
.skip_screen_flash | |
cmp #COMMAND_TRAILER_CHAR ; is the byte read from serial conn the end-of-cmd marker? | |
bne .add_byte_to_buffer ; if not, just add it to the buffer | |
ldy #1 | |
sty .end_of_command ; otherise, set end_of_command = 1 | |
lda #0 ; replace end-of-cmd with '\0' | |
.add_byte_to_buffer | |
ldy #0 | |
sta (COMMAND_BUFFER_PTR), y ; use indirect-indexed addressing mode to store the byte in our buffer | |
+inc16 COMMAND_BUFFER_PTR | |
ldy .end_of_command | |
cpy #1 | |
bne .main_loop ; if end_of_command != 1, continue to loop | |
jsr command_handler ; ... otherwise, jump to a function to handle the complete command string | |
jmp .main_loop ; and then, continue to loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment