diff options
Diffstat (limited to 'programs/sub-suite/subeditor.s')
-rw-r--r-- | programs/sub-suite/subeditor.s | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s index 83fe179..e44feb3 100644 --- a/programs/sub-suite/subeditor.s +++ b/programs/sub-suite/subeditor.s @@ -268,12 +268,11 @@ cmd_cpy: sta scr_trow ; Save it for later. lea d, (buffer) ; Get the screen buffer. mov s, y ; Get the cursor index. - lea f, 1 ; Set the decrement offset to the left flag. - jsr find_end ; Find the end of the line. - div #maxcol+1 ; Get the ending line. - ldb scr_str ; Has the screen been scrolled? - beq @start ; No, so don't subtract the screen's starting point from the line number. -@offset: +; jsr find_end ; Find the end of the line. +; mov f, a ; Save the end of the line. +; div #maxcol+1 ; Get the ending line. + jsr get_endrow ; Get the ending line. +; inc step ; sub scr_str ; Offset the row position, back by the screen's starting point. @start: sta scr_row ; Set the row position to the end of the line. @@ -361,24 +360,21 @@ find_end: phb.q ; Preserve B. phx.q ; Preserve X. phy.q ; Preserve Y. - phe.q ; Preserve E. mov a, s ; Set the loop counter. div #maxcol+1 ; Get the row position. tay ; Save the row position. mov b, d ; Preserve the string pointer. mov x, s ; Preserve the cursor position. mov d, a ; - xor s, s ; Reset S. @loop: - inc d ; Increment the line. - mov e, d ; Save the line. - jsr getbit ; Get the linewrap bit. - mov d, e ; Get the line. - cmp #1 ; Is this the end of the line? - beq @loop ; No, so keep looping. -@loop2_1: - mov a, d ; Get the ending row position. - sub a, f ; Decrement the row position by the offset. + xor s, s ; Reset S. + iny ; Increment the line. + mov d, y ; Get the line. + jsr getbit ; Is this the end of the line? + bne @loop ; No, so keep looping. +@loop2_init: + tya ; Get the ending row position. + dec ; Decrement the row position. mul #maxcol+1 ; Get the loop counter. cmp a, x ; Is the new loop counter less than the old loop counter? mcc a, x ; Set the loop counter to the old loop counter if so. @@ -389,7 +385,6 @@ find_end: cmp (d+a-1), #0 ; Did we hit the null terminator? bne @loop2 ; No, so keep looping. @end: - ple.q ; Restore E. ply.q ; Restore Y. plx.q ; Restore X. plb.q ; Restore B. @@ -445,7 +440,6 @@ printc: @update1: lea d, (buffer) ; Get the screen buffer. mov s, y ; Get the cursor index. - lea f, 1 ; Set the decrement offset to one. jsr get_endrow ; Get the ending line. mov d, a ; mov s, scr_trow ; Get the current row position. @@ -635,7 +629,6 @@ back: sta scr_trow ; lea d, (buffer) ; Get the screen buffer. mov s, y ; Get the cursor index. - lea f, 0 ; Set the decrement offset to zero. jsr get_endrow ; Get the ending line. sta scr_row ; Set our row position to the end of the line. @find_st: @@ -664,7 +657,6 @@ back: @find_end: lea d, (buffer) ; Get the screen buffer. mov s, y ; Get the cursor index. - lea f, 1 ; Set the decrement offset to one. jsr get_endrow ; Yes, so Get the ending line. mov d, a ; mov s, scr_trow ; Get the current row position. @@ -890,9 +882,7 @@ shftln: cmp s, f ; No, but is the cursor position greater than, or equal to the shift length? bcc @end ; No, so we're done. @find_end: - lea f, 1 ; Set the decrement offset to the left flag. jsr find_end ; Find the end of the line. - mov f, e ; Get the shift length. sub a, c ; Decrement the old end position, if the left flag is set. tab ; Save the old end position for later. mov a, f ; Get the shift length. @@ -920,9 +910,13 @@ shftln: mov a, bp ; Get the new end position. div #maxcol+1 ; Get the new ending line. mov e, a ; Save the ending line. + mov r11, f ; Get the shift length. xor f, f ; Reset F. and c, c ; Is the left flag set? meq f, b ; Save the remainder of the ending line if not. +; div #maxcol+1 ; Get the line length. +; dec ; Decrement the line length. +; mov bp, a ; Save the line length. tya ; Get the cursor position. div #maxcol+1 ; Get the cursor line. mov bp, a ; Save the cursor line. @@ -933,16 +927,15 @@ shftln: div #maxcol+1 ; Get the old ending line. cmp bp, a ; Is the cursor line greater than, or equal to the old ending line? mcs a, bp ; Get the cursor line if so. - inc ; Increment the line. + cmp r11, #maxcol+1 ; Is the shift length greater than, or equal to the max column count? + adc #0 ; Increment the starting line if so. and c, c ; Is the left flag set? mne a, e ; Set the ending line to the new ending line if so. tab ; Save the ending line. and c, c ; Is the left flag set? bne @inc ; Yes, so increment the starting line. cmp y, b ; No, but is the starting line less than the ending line? - bcs @loop ; No, so don't increment. - iny ; Yes, so increment the starting line. - bra @getbit ; Get the bit. + bcc @inc ; Yes, so increment the starting line. @loop: xor s, s ; Reset S. cmp y, b ; Is the current line greater than the ending line? |