From a9860417f53216a2f3b0b490afec46ab5db70181 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 12 Aug 2020 12:37:54 -0400 Subject: - Refactored the escape sequence parsing, and handling. It now uses a struct to store the escape sequence. Before it handles the escape sequence, it parses it, which includes things like getting any arguments that are supplied, and getting the mode type. - Moved the code that handles control codes to a separate function. The reason for doing this was because I wanted to make the escape sequence handling faster, but also make the code more readable at the same time. I got the idea to do this from st, a terminal emulator created by the suckless.org project. --- programs/sub-suite/subeditor.s | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'programs/sub-suite') diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s index fb3f3c4..476f1cf 100644 --- a/programs/sub-suite/subeditor.s +++ b/programs/sub-suite/subeditor.s @@ -957,6 +957,8 @@ update_pos: lda #'[' ; Print '[' sta scr ; to the screen, and start the escape sequence. jsr getrow ; Start printing the row number to the screen. + lda #';' ; Print ';' + sta scr ; to the screen. jsr getcol ; Start printing the column number to the screen. lda #'H' ; Print 'H' sta scr ; to the screen. @@ -967,10 +969,9 @@ getrow: lda scr_row ; Get the cursor's y coordinate. bra bcd ; Convert it to BCD. getcol: - lda #';' ; Print ';' - sta scr ; to the screen. lda scr_col ; Get the cursor's x coordinate. bcd: + inc ; Add one to A. div #10 ; Divide A by 10. ora #'0' ; Convert it to ascii, and sta scr ; print to the screen. -- cgit v1.2.3-13-gbd6f