diff options
Diffstat (limited to 'programs/sub-suite/subeditor.s')
-rw-r--r-- | programs/sub-suite/subeditor.s | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s index 2282a72..fb3f3c4 100644 --- a/programs/sub-suite/subeditor.s +++ b/programs/sub-suite/subeditor.s @@ -117,7 +117,7 @@ print_str: tba ; Clear the Accumulator. @loop: ldb #1 ; Enable replace mode. - stb b ; + stb regb ; lda.q ptr ; Get the first pointer. cmp.q end ; Did the pointer change? bne @reset ; Yes, so set it back. @@ -133,7 +133,7 @@ print_str: bra @loop ; Keep looping. @end: ldb #0 ; Enable insert mode. - stb b ; + stb regb ; tba ; Reset A. rts ; End of print_str. @@ -159,7 +159,7 @@ getbt1: txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. ply.w ; Get the screen index back. - aba ; Mask out the bit of the current line number. + and b ; Mask out the bit of the current line number. cmp #1 ; Set the carry flag, if true. bra bitout ; We are done. @@ -175,7 +175,7 @@ clrbit: phy.w ; Save the screen index. txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. - aba ; Clear the bit of the current line number. + and b ; Clear the bit of the current line number. bitsav: sta (ptr2), y ; Update the wrap table. ply.w ; Get the screen index back. @@ -194,7 +194,7 @@ setbit: phy.w ; Save the screen index. txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. - oab ; Set the bit of the current line number. + ora b ; Set the bit of the current line number. bra bitsav ; Save the bit. bitpos: @@ -222,8 +222,8 @@ bitpos: handle_char: ldb #0 ; Reset the B register. - stb e ; Set the temporary row position to zero, in case we get a newline. - stb b ; Enable insert mode. + stb rege ; Set the temporary row position to zero, in case we get a newline. + stb regb ; Enable insert mode. pha ; Save the character. phy.w ; Save the cursor index. cmp #'\n' ; Was the character that was typed, a newline? @@ -232,16 +232,16 @@ handle_char: @print: ply.w ; Get back the cursor index. pla ; Get back the character. - ldb e ; Is the temporary row position non zero? + ldb rege ; Is the temporary row position non zero? bne @row ; Yes, so reset the row positon. @print1: jsr print_char ; No, so print the character. - lda a ; Get the return value. + lda rega ; Get the return value. cmp #'\n' ; Is the return value, a newline? beq @true ; Yes, so return true. bra @false ; No, so return false. @row: - ldb e ; Get the temporary row position. + ldb rege ; Get the temporary row position. cpb #maxrow ; Is temporary row position, at, or above the bottom of the screen? beq @row2 ; Yes, so leave it as is. bcs @row1 ; No, so set it to the bottom of the screen. @@ -272,7 +272,7 @@ cmd_cpy: clc ; Clear the carry flag, so that nothing odd occurs. @start: sta scr_row ; Set the row position to the end of the line. - sta e ; Save it into the temporary row posiition. + sta rege ; Save it into the temporary row posiition. jsr findst ; Find the start of the line. clc ; Clear the carry flag. lda scr_row ; Get the row position. @@ -302,12 +302,12 @@ cmd_cpy: iny ; No, so increment the screen index. inb ; Increment the byte count. lsr #8 ; Shift in the next byte. - stb g ; Save the byte count. + stb regg ; Save the byte count. tab ; Save the string buffer. and #$FF ; Is this byte of the buffer, a null terminator? beq @end1 ; Yes, so we're done. tba ; No so get back the string buffer. - ldb g ; Get back the byte count. + ldb regg ; Get back the byte count. cpb #7 ; Did we shift in eight bytes? beq @loop ; Yes, so get eight more bytes. bra @loop1 ; No, so keep shifting in more bytes. @@ -365,13 +365,13 @@ findend: print_char: - sta a ; Save the typed character for now. + sta rega ; Save the typed character for now. ldb #2 ; Make sure that set_ptr sets the third pointer. lda.d #buffer ; Set the third pointer to the start of the screen buffer. jsr set_ptr ; ldb #0 ; Set B to zero. tba ; Set the Accumulator to zero. - lda a ; Get back the character. + lda rega ; Get back the character. cmp #$1B ; Did the user type an escape character? beq esc ; Yes, so go check the escape code. cmp #'\n' ; No, but did the user type a newline? @@ -388,10 +388,10 @@ print_char: beq bs ; Yes, so treat it as a backspace. printc: lda #0 ; No, so start trying to print a character. - sta d ; + sta regd ; lda (ptr3), y ; Are we at the end of the string? beq @save ; Yes, so just print the character. - lda b ; No, but was the flag set? + lda regb ; No, but was the flag set? bne @save ; Yes, so don't shift the line. sty.w scr_ptr ; No, so save the cursor index for later. jsr fndend ; Find the end of the line. @@ -401,19 +401,19 @@ printc: sta scr_tcol ; @update1: jsr findend ; Find the end of the line. - sta e ; Use it for redrawing the line. + sta rege ; Use it for redrawing the line. sta scr_row ; Set the row position to to the end of the line. jsr findst ; Find the start of the line. lda scr_row ; Get the start of the line. @update2: - sta f ; Set the starting line, to the start of the line. + sta regf ; Set the starting line, to the start of the line. jsr rdrw_ln ; Redraw the line. lda scr_trow ; Get the real row position back. sta scr_row ; lda scr_tcol ; Get the real column position back. sta scr_col ; jsr update_pos ; Update the cursor's position. - dec d ; + dec regd ; bra @save1 ; @shift: ldy.w scr_ptr3 ; @@ -421,33 +421,33 @@ printc: tyx ; dey ; ldb #1 ; - stb d ; + stb regd ; jsr shftln ; ldb #1 ; - stb d ; - lda a ; + stb regd ; + lda rega ; sta (ptr3), y ; store typed character into the input buffer. lda scr_row ; sta scr_trow ; bra @update ; @save: - ldb d ; + ldb regd ; bne @update ; @save1: - lda a ; + lda rega ; sta (ptr3), y ; store typed character into the input buffer. @incr: inc scr_col ; Increment the cursor's x coordinate. iny ; @wrapped: ldb #1 ; - stb f ; + stb regf ; ldb scr_col ; cpb #maxcol+1 ; bcs @scrolled ; @print: sta scr ; Echo typed character. - ldb f ; + ldb regf ; beq @wrap ; bra printc_end ; @scrolled: @@ -456,7 +456,7 @@ printc: bcs @scroll ; @wrapped2: ldb #0 ; - stb f ; + stb regf ; bra @print ; @scroll: sta scr ; Echo typed character. @@ -501,7 +501,7 @@ nl: jsr update_pos ; Update the cursor's position. @end: lda #'\n' ; Print the newline. - sta a ; + sta rega ; rts ; @@ -580,8 +580,8 @@ bs: jsr update_pos ; Update the cursor's position. back: ldb #0 ; Reset B, and some flags. - stb e ; - stb f ; + stb rege ; + stb regf ; lda scr_row ; Save the current row position for later. sta scr_trow ; jsr findend ; Find the end of the line. @@ -599,15 +599,15 @@ back: tyx ; Copy the current cursor index to X. iny ; Increment cursor index. ldb #0 ; Set shifting direction to left. - stb d ; + stb regd ; jsr shftln ; Shift line back by one character. lda #$7F ; Print a backspace to the screen. sta scr ; - lda e ; Are we updating more than one line? + lda rege ; Are we updating more than one line? beq @load ; No, so skip to the next step. @find_end: jsr findend ; Yes, so find the end of the line. - sta e ; Set the end parameter to it. + sta rege ; Set the end parameter to it. lda scr_col ; Save the current column position for now. sta scr_tcol ; jsr rdrw_ln ; Start redrawing the line. @@ -621,13 +621,13 @@ back: rts ; We are done. @update: lda scr_row ; Set the line to start redrawing, to the start of the line. - sta f ; - inc e ; Set the redraw flag to true. + sta regf ; + inc rege ; Set the redraw flag to true. bra @shift ; Start shifting the line back. shftln: - ldb d ; Is the flag not set? + ldb regd ; Is the flag not set? beq @dec_loop ; Yes, so shift, and decrement. ldb #0 ; Clear the B register. bra @inc_loop ; No, so shift, and increment. @@ -680,14 +680,14 @@ shftln: sta (ptr3), y ; @end1: jsr findend ; Find the ending line. - sta d ; Save ending line for later. + sta regd ; Save ending line for later. lda (ptr3), y ; Is this character a space? cmp #$20 ; bne @end5 ; No, so skip the conversion. lda #0 ; Yes, so convert it back to zero. sta (ptr3), y ; @end2: - lda d ; Get the ending line. + lda regd ; Get the ending line. cmp scr_row ; Is the ending line greater than the starting line? beq @end5 ; No, so we're done. bcs @wrap ; Yes, so set the wrap bit. @@ -712,23 +712,23 @@ esc: lda status ; No, so wait for the next character. beq @end ; We have an error, so discard it, and go back to getting user input. lda kbd ; Get the escape code. - sta c ; Store the escape code, until we need it. + sta regc ; Store the escape code, until we need it. lda #0 ; Set the D pseudo register to zero. - sta d ; + sta regd ; jsr isup ; Check if the user pressed up. - lda d ; Did the user press up? + lda regd ; Did the user press up? bne @end ; Yes, so we're done. jsr isdown ; No, so check if the user pressed down. - lda d ; Did the user press down? + lda regd ; Did the user press down? bne @end ; Yes, so we're done. lda #0 ; No, so check if the user pressed left. jsr isleft ; - lda d ; Did the user press left? + lda regd ; Did the user press left? bne @end ; Yes, so we're done. jsr isright ; No, so check if the user pressed right. @end: lda #0 ; Clear the D pseudo register. - sta d ; + sta regd ; rts ; We are done. shftesc: @@ -737,27 +737,27 @@ shftesc: lda status ; Wait for the next character. beq @end ; We have an error, so discard it, and go back to getting user input. lda kbd ; Get the escape code. - sta c ; Store the escape code, until we need it. + sta regc ; Store the escape code, until we need it. lda #0 ; Use the D pseudo register as a skip flag. - sta d ; + sta regd ; jsr isshftup ; Check if the user pressed shift+up. - lda d ; Was it successful? + lda regd ; Was it successful? bne @end ; Yes, so we're done. jsr isshftdown ; No, so check if the user pressed shift+down. @end: lda #0 ; Clear the D pseudo register. - sta d ; + sta regd ; rts ; We are done. isup: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'A' ; Did the user press the up arrow key? bne @end ; No, so we're done. lda scr_row ; Yes, but is the cursor at the top of the screen? beq @scroll ; Yes, so check if we need to scroll. @check2: - lda c ; No, so load the escape code back into the accumulator. + lda regc ; No, so load the escape code back into the accumulator. cmp #'A' ; Did the user press the up arrow key? beq @up ; Yes, so move the cursor up. bra @end ; No, so we're done. @@ -765,26 +765,26 @@ isup: dec scr_row ; Move the cursor up a line. jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. - sta d ; + sta regd ; rts ; We are done. @scroll: lda scr_str ; Are we at the top of the screen buffer? beq @end ; Yes, so we're done. jsr scrl_up ; No, so scroll up. lda #1 ; Tell the escape routine that we were successful. - sta d ; + sta regd ; @end: rts ; End of isup. isdown: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'B' ; Did the user press the down arrow key? bne @end ; No, so we're done. lda scr_row ; Yes, so start checking the y coordinate of the cursor. cmp #maxrow ; Is the cursor at the bottom of the screen? beq @scroll ; Yes, so scroll down. - lda c ; No, so load the escape code back into the accumulator. + lda regc ; No, so load the escape code back into the accumulator. cmp #'B' ; Did the user press the down arrow key? beq @down ; Yes, so move the cursor down. bra @end ; No, so we're done. @@ -792,7 +792,7 @@ isdown: inc scr_row ; Move the cursor down a line. jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. - sta d ; + sta regd ; rts ; We are done. @scroll: lda scr_row ; Save the cursor's row number. @@ -805,13 +805,13 @@ isdown: lda scr_tcol ; Load the cursor's column number. sta scr_col ; lda #1 ; Tell the escape routine that we were successful. - sta d ; + sta regd ; @end: rts ; End of isdown. isright: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'C' ; Did the user press the right arrow key? bne @end2 ; No, so we're done. lda scr_col ; Yes, so start checking the x coordinate of the cursor. @@ -854,12 +854,12 @@ isright: isleft: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'C' ; Did the user press right? beq @end1 ; Yes, so we're done lda scr_col ; No, but is the cursor at the far left of the screen? beq @wrap ; Yes, so start checking if this is a wrapped line. - lda c ; No, so load the escape code back into the accumulator. + lda regc ; No, so load the escape code back into the accumulator. cmp #'D' ; Did the user press the left arrow key? beq @left ; Yes, so move the cursor left. bra @end1 ; No, so we're done. @@ -877,7 +877,7 @@ isleft: lda #maxcol ; Move the Cursor to the far right of the screen. sta scr_col ; lda #1 ; Tell the escape routine that we were successful. - sta d ; + sta regd ; lda scr_row ; Are we at the top of the screen? beq @scroll ; Yes, so check if we need to scroll. bra @end ; No, so we're done. @@ -892,7 +892,7 @@ isleft: dec scr_col ; Move the cursor left a character. jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. - sta d ; + sta regd ; rts ; We are done @end: jsr update_pos ; Update the cursor position. @@ -903,34 +903,34 @@ isleft: isshftup: - lda c ; Load the escape code back into the accumulator. + lda regc ; Load the escape code back into the accumulator. cmp #'A' ; Did the user press the up arrow key? bne @end ; lda #1 ; - sta d ; + sta regd ; lda scr_str ; beq @end ; @shftup: jsr scrl_up ; lda #1 ; - sta d ; + sta regd ; @end: rts ; isshftdown: - lda c ; Load the escape code back into the accumulator. + lda regc ; Load the escape code back into the accumulator. cmp #'B' ; Did the user press the down arrow key? bne @end ; lda #1 ; - sta d ; + sta regd ; lda scr_end ; cmp #71 ; bcs @end ; @shftdown: jsr scrl_down ; lda #1 ; - sta d ; + sta regd ; @end: rts ; @@ -948,7 +948,7 @@ update_ptr: update_pos: ldb #1 ; Set the F pseudo register to one, to fix some bugs. - stb f ; + stb regf ; jsr update_ptr ; Update the screen buffer index. tay ; Place the index into the Y register. tba ; Reset A. @@ -1070,14 +1070,14 @@ rdrw_row: rdrw_ln: lda scr_row ; pha ; - lda f ; + lda regf ; sta scr_row ; lda scr_col ; pha ; jsr update_pos ; @loop: lda scr_row ; - cmp e ; + cmp rege ; beq @loop1 ; bcs @end ; @loop1: @@ -1092,8 +1092,8 @@ rdrw_ln: sta scr_row ; jsr update_pos ; lda #0 ; - sta e ; - sta f ; + sta rege ; + sta regf ; rts ; |