summaryrefslogtreecommitdiff
path: root/programs/subeditor.s
diff options
context:
space:
mode:
Diffstat (limited to 'programs/subeditor.s')
-rw-r--r--programs/subeditor.s431
1 files changed, 217 insertions, 214 deletions
diff --git a/programs/subeditor.s b/programs/subeditor.s
index 0a42c32..26c6f7d 100644
--- a/programs/subeditor.s
+++ b/programs/subeditor.s
@@ -151,9 +151,9 @@ clr_arr:
jsr set_ptr ;
deb ; Set B back to zero.
tba ;
-clr_arr_st:
+@loop:
cpy.w scr_ptr ; Did we clear all of the array?
- bcs clr_arr_end ; Yes, so we're done.
+ bcs @end ; Yes, so we're done.
sta.q (ptr), y ; No, so clear eight bytes.
sta.q (ptr2), y ; Clear eight more bytes.
tya ; Copy the array index.
@@ -166,8 +166,8 @@ clr_arr_st:
adc #$10 ;
tay ;
tba ;
- jmp clr_arr_st ; Keep looping.
-clr_arr_end:
+ jmp @loop ; Keep looping.
+@end:
ldy.w zero ; Set the index back to zero.
plb #1 ; Get whatever was in the B register, back.
rts ; End of clr_arr.
@@ -219,27 +219,27 @@ read:
print_str:
ldx #0 ; Reset X.
sta.q end ; Save the parameter.
-print_str2:
+@reset:
lda.q end ; Get the parameter.
ldb #0 ; Clear the B register.
jsr set_ptr ; Set the first pointer to the parameter.
tba ; Clear the Accumulator.
-pntstr_lp:
+@loop:
ldb #1 ; Enable replace mode.
stb b ;
lda.q ptr ; Get the first pointer.
cmp.q end ; Did the pointer change?
- bne print_str2 ; Yes, so set it back.
+ bne @reset ; Yes, so set it back.
and #0 ; No, reset the accumulator.
phy #2 ; Save the cursor index.
txy ; Copy the string index into Y.
lda (ptr), y ; Are we at the end of the string?
ply #2 ; Get the cursor index back.
- beq pntstr_end ; Yes, so we're done.
+ beq @end ; Yes, so we're done.
inx ; No, so increment the string index.
jsr print_char ; Print the character.
- jmp pntstr_lp ; Keep looping.
-pntstr_end:
+ jmp @loop ; Keep looping.
+@end:
ldb #0 ; Enable insert mode.
stb b ;
rts ; End of print_str.
@@ -334,37 +334,37 @@ getchar:
pha #1 ; Save the character.
phy #2 ; Save the cursor index.
cmp #'\n' ; Was the character that was typed, a newline?
- bne getchar_pnt ; No, so just print the character.
+ bne @print ; No, so just print the character.
jsr cmd_cpy ; Yes, so start copying the line to the command buffer.
-getchar_pnt:
+@print:
ply #2 ; Get back the cursor index.
pla #1 ; Get back the character.
ldb e ; Is the temporary row position non zero?
- bne reset_row ; Yes, so reset the row positon.
-getchar_pt1:
+ bne @row ; Yes, so reset the row positon.
+@print1:
jsr print_char ; No, so print the character.
lda a ; Get the return value.
cmp #'\n' ; Is the return value, a newline?
- beq getchar_ln ; Yes, so return 0.
- jmp getchar_chr ; No, so return 1.
-reset_row:
+ beq @true ; Yes, so return true.
+ jmp @false ; No, so return false.
+@row:
ldb e ; Get the temporary row position.
cpb #maxrow ; Is temporary row position, at, or above the bottom of the screen?
- beq reset_row2 ; Yes, so leave it as is.
- bcs reset_row1 ; No, so set it to the bottom of the screen.
- jmp reset_row2 ; Yes, so leave it as is.
-reset_row1:
+ beq @row2 ; Yes, so leave it as is.
+ bcs @row1 ; No, so set it to the bottom of the screen.
+ jmp @row2 ; Yes, so leave it as is.
+@row1:
ldb #maxrow ; Set the row position to the bottom of the screen.
-reset_row2:
+@row2:
stb scr_row ; Set the row position.
- jmp getchar_pt1 ; Print the character.
-getchar_ln:
- lda #0 ; Return zero.
- jmp getchar_end ; We are done.
-getchar_chr:
- lda #1 ; Return one.
-getchar_end:
- rts ; End of get char.
+ jmp @print1 ; Print the character.
+@true:
+ lda #0 ; Return true.
+ jmp @end ; We are done.
+@false:
+ lda #1 ; Return false.
+@end:
+ rts ; End of getchar.
cmd_cpy:
@@ -372,12 +372,12 @@ cmd_cpy:
sta scr_trow ; Save it for later.
jsr findend ; Find the end of the line.
ldb scr_str ; Has the screen been scrolled?
- beq cmd_cpy3 ; No, so don't subtract the screen's starting point from the line number.
-cmd_cpy2:
+ beq @start ; No, so don't subtract the screen's starting point from the line number.
+@offset:
sec ; Yes, so make sure that we don't subtract by the starting point, plus one.
sbc scr_str ; Offset the row position, back by the screen's starting point.
clc ; Clear the carry flag, so that nothing odd occurs.
-cmd_cpy3:
+@start:
sta scr_row ; Set the row position to the end of the line.
sta e ; Save it into the temporary row posiition.
jsr findst ; Find the start of the line.
@@ -395,53 +395,53 @@ cmd_cpy3:
jsr set_ptr ;
deb ; Set B back to zero.
tba ; Set the accumulator to zero.
-cmd_cpy_lp:
+@loop:
ldb #0 ; Reset the B register.
lda.q (ptr), y ; Get eight bytes from the current line.
-cmd_cpy_lp1:
+@loop1:
phy #2 ; Save the screen index.
txy ; Get the command buffer index.
sta (ptr2), y ; Copy one byte from the screen buffer, to the command buffer.
inx ; Increment the command buffer index.
ply #2 ; Get back the screen index.
cpx.w #$3FF ; Are we at the end of the command buffer?
- bcs cmd_cpy_nd0 ; Yes, so we're done.
+ bcs @end ; Yes, so we're done.
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.
tab ; Save the string buffer.
and #$FF ; Is this byte of the buffer, a null terminator?
- beq cmd_cpy_nd ; Yes, so we're done.
+ beq @end1 ; Yes, so we're done.
tba ; No so get back the string buffer.
ldb g ; Get back the byte count.
cpb #7 ; Did we shift in eight bytes?
- beq cmd_cpy_lp ; Yes, so get eight more bytes.
- jmp cmd_cpy_lp1 ; No, so keep shifting in more bytes.
-cmd_cpy_nd0:
+ beq @loop ; Yes, so get eight more bytes.
+ jmp @loop1 ; No, so keep shifting in more bytes.
+@end:
ldb #0 ; Reset B.
phy #2 ; Save the screen index.
txy ; Get the command buffer index.
stb (ptr2), y ; Terminate the command buffer.
ply #2 ; Get back the screen index.
-cmd_cpy_nd:
+@end1:
tab ; The B register is zero, so clear the Accumulator.
rts ; End of cmd_cpy.
findst:
lda #0 ; Reset A.
-findst_lp:
+@loop:
pha #1 ; Save the current line number.
jsr getbit ; Is this the start of the line?
pla #1 ; Get the current line number back.
- bcc findst_done ; Yes, so we're done.
+ bcc @end ; Yes, so we're done.
inc ; No, so check the next physical line.
dec scr_row ; Are we at the top of the screen?
- bpo findst_lp ; No, so keep looping.
+ bpo @loop ; No, so keep looping.
dec ; Yes, so move back one line.
inc scr_row ; Put the row postiion back to zero.
-findst_done:
+@end:
cmp #0 ; Update all the flags.
rts ; End of findst.
@@ -454,12 +454,12 @@ fndend:
tba ; Set the Accumulator to zero.
plb #1 ; Restore the contents of the B register.
phy #2 ;
-fndend_lp:
+@loop:
lda (ptr), y ; Are we at the end of the string?
- beq fndend_done ; Yes, so we're done.
+ beq @end ; Yes, so we're done.
iny ; No, so increment the cursor index.
- jmp fndend_lp ; Keep looping.
-fndend_done:
+ jmp @loop ; Keep looping.
+@end:
sty.w scr_ptr3 ;
ply #2 ;
rts ; End of fndend.
@@ -502,22 +502,22 @@ printc:
lda #0 ; No, so start trying to print a character.
sta d ;
lda (ptr3), y ; Are we at the end of the string?
- beq printc_save ; Yes, so just print the character.
+ beq @save ; Yes, so just print the character.
lda b ; No, but was the flag set?
- bne printc_save ; Yes, so don't shift the line.
+ 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.
- jmp prntc_movln ; Start shifting the line right.
-prntc_updt:
+ jmp @shift ; Start shifting the line right.
+@update:
lda scr_col ; Save the current column position for later.
sta scr_tcol ;
-prntc_updt2:
+@update1:
jsr findend ; Find the end of the line.
sta e ; 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.
-prntc_updt3:
+@update2:
sta f ; 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.
@@ -526,8 +526,8 @@ prntc_updt3:
sta scr_col ;
jsr update_pos ; Update the cursor's position.
dec d ;
- jmp printc_sav1 ;
-prntc_movln:
+ jmp @save1 ;
+@shift:
ldy.w scr_ptr3 ;
inc scr_ptr3 ;
tyx ;
@@ -541,51 +541,50 @@ prntc_movln:
sta (ptr3), y ; store typed character into the input buffer.
lda scr_row ;
sta scr_trow ;
- jmp prntc_updt ;
-printc_save:
+ jmp @update ;
+@save:
ldb d ;
- bne prntc_updt ;
-printc_sav1:
+ bne @update ;
+@save1:
lda a ;
sta (ptr3), y ; store typed character into the input buffer.
-printc_inc:
+@incr:
inc scr_col ; Increment the cursor's x coordinate.
iny ;
-printc_2:
+@wrapped:
ldb #1 ;
stb f ;
ldb scr_col ;
cpb #maxcol+1 ;
- bcs printc_4 ;
-printc_3:
+ bcs @scrolled ;
+@print:
sta scr ; Echo typed character.
ldb f ;
- beq printc_wrap ;
+ beq @wrap ;
jmp printc_end ;
-printc_4:
+@scrolled:
ldb scr_row ;
cpb #maxrow ;
- bcs printc_scrl ;
-printc_5:
+ bcs @scroll ;
+@wrapped2:
ldb #0 ;
stb f ;
- jmp printc_3 ;
-printc_scrl:
+ jmp @print ;
+@scroll:
sta scr ; Echo typed character.
clc ;
lda #1 ;
sta wrapped ;
jsr scrl_down ;
- jmp printc_wrap ;
-printc_wrap:
+@wrap:
ldb #0
stb scr_col ;
ldb scr_row ;
cpb #maxrow ;
- bcs printc_wrp2 ;
-printc_wrap1:
+ bcs @wrap2 ;
+@wrap1:
inc scr_row ;
-printc_wrp2:
+@wrap2:
phx #2 ;
clc ;
lda scr_row ;
@@ -600,19 +599,19 @@ printc_end:
nl:
lda #0 ; Reset A.
ldb (ptr3), y ; Is this character not a null terminator?
- bne nl1 ; Yes, so don't overwrite it.
+ bne @scroll ; Yes, so don't overwrite it.
sta (ptr3), y ; No, so overwrite it.
-nl1:
+@scroll:
sta scr_col ; Move the cursor to the start of the next line.
lda scr_row ; Get the row position.
cmp #maxrow ; Are we at the bottom of the screen?
- bcc nl_inc ; No, so move down one line.
+ bcc @incr ; No, so move down one line.
jsr scrl_down ; Yes, so scroll down one line.
- jmp nl_end ; We are done.
-nl_inc:
+ jmp @end ; We are done.
+@incr:
inc scr_row ; Move the cursor down by one line.
jsr update_pos ; Update the cursor's position.
-nl_end:
+@end:
lda #'\n' ; Print the newline.
sta a ;
jmp printc_end ;
@@ -667,13 +666,13 @@ back:
sta scr_trow ;
jsr findend ; Find the end of the line.
sta scr_row ; Set our row position to the end of the line.
-back0:
+@find_st:
jsr findst ; Does this line take up more than one real line?
- beq back1 ; No, so skip updating any other lines.
- bcs back_updt ; Yes, so update the other lines.
+ beq @shift ; No, so skip updating any other lines.
+ bcs @update ; Yes, so update the other lines.
lda scr_trow ; Get the real row position back.
sta scr_row ;
-back1:
+@shift:
dey ; Decrement the buffer's offset.
lda #0 ; Place a null terminator
sta (ptr3), y ; into the buffer.
@@ -685,8 +684,8 @@ back1:
lda #$7F ; Print a backspace to the screen.
sta scr ;
lda e ; Are we updating more than one line?
- beq back3 ; No, so skip to the next step.
-back2:
+ 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.
lda scr_col ; Save the current column position for now.
@@ -694,44 +693,44 @@ back2:
jsr rdrw_ln ; Start redrawing the line.
lda scr_tcol ; Get the real column position back.
sta scr_col ;
-back3:
- lda scr_trow ; Get the real row position bac.
+@load:
+ lda scr_trow ; Get the real row position back.
sta scr_row ;
dec scr_col ; Move the cursor back by one column,
jsr update_pos ; and update it's position.
jmp printc_end ; We are done.
-back_updt:
+@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.
- jmp back1 ; Start shifting the line back.
+ jmp @shift ; Start shifting the line back.
bs:
lda scr_col ; Are we at the far left of the screen?
- beq back_wrap ; Yes, so check for a wrapped line.
+ beq @wrap ; Yes, so check for a wrapped line.
jmp back ; No, so add the backspace to the buffer.
-back_wrap:
+@wrap:
jsr getbit ; Is this line, a wrapped line?
- bcs back_wrap1 ; Yes, so check if the cursor is at the top.
+ bcs @wrap1 ; Yes, so check if the cursor is at the top.
jmp printc_end ; No, so we're done.
-back_wrap1:
+@wrap1:
lda scr_row ; Are we at the top of the screen?
- beq back_wrap2 ; Yes, so check if the screen is at the top of the buffer.
- jmp backwrp ; No, so start clearing the wrap bit.
-back_wrap2:
+ beq @wrap2 ; Yes, so check if the screen is at the top of the buffer.
+ jmp @wrap3 ; No, so start clearing the wrap bit.
+@wrap2:
lda scr_str ; Are we at the top of the buffer?
- bne back_scrl ; Yes, so scroll up.
+ bne @scroll ; Yes, so scroll up.
jmp printc_end ; No, so we're done.
-back_scrl:
+@scroll:
clc ; Clear the carry flag, so that we don't get odd behaviour.
jsr scrl_up ; Scroll up.
inc scr_row ; Move down by one row.
-backwrp:
+@wrap3:
clc ; Clear the carry flag.
lda scr_row ; Add the cursor's row position,
adc scr_str ; and the screen's starting row.
tax ; Transfer that into X.
-backwrp2:
+@wrap4:
dec scr_row ; Move up by one row.
ldb #maxcol+1 ; Move the cursor to the absolute right of the screen.
stb scr_col ;
@@ -740,20 +739,20 @@ backwrp2:
shftln:
ldb d ; Is the flag not set?
- beq shftln_lp1 ; Yes, so shift, and decrement.
+ beq @dec_loop ; Yes, so shift, and decrement.
ldb #0 ; Clear the B register.
- jmp shftln_lp0 ; No, so shift, and increment.
-shftln_neg:
+ jmp @inc_loop ; No, so shift, and increment.
+@neg:
ldy.w zero ; Set the source poition to 0.
stb (ptr3), y ; Clear the character that is in the source.
- jmp shftln_end ; We are done.
-shftln_lp0:
+ jmp @end ; We are done.
+@inc_loop:
sty.w scr_ptr2 ; Save the source position for later.
ldy.w scr_ptr ; Get the previous cursor index.
cpy.w scr_ptr2 ; Is the source position, at, or below the cursor index?
- beq shftln_lp01 ; Yes, so keep looping.
- bcs shftln_end ; No, so we're done.
-shftln_lp01:
+ beq @inc_loop1 ; Yes, so keep looping.
+ bcs @end ; No, so we're done.
+@inc_loop1:
ldy.w scr_ptr2 ; Get the source position.
lda (ptr3), y ; Get the character from the source position.
phy #2 ; Save the source position for later.
@@ -761,14 +760,14 @@ shftln_lp01:
sta (ptr3), y ; Place the character from the source position, to the destination position.
ply #2 ; Set our position back to the source.
stb (ptr3), y ; Clear the character that is in the source.
- bng shftln_neg ; The source underflowed, so set it back to zero,
+ bng @neg ; The source underflowed, so set it back to zero,
dey ; Decrement the source position.
dex ; Decrement the destination position.
- jmp shftln_lp0 ; Keep looping.
-shftln_lp1:
+ jmp @inc_loop ; Keep looping.
+@dec_loop:
stx.w scr_ptr2 ; Save the destination position for later.
lda (ptr3), y ; Is the character at the source position, a null terminator?
- beq shftln_end1 ; Yes, so we're done.
+ beq @end3 ; Yes, so we're done.
phy #2 ; No, so save the source position for later.
txy ; Set our position to the destination.
sta (ptr3), y ; Place the character from the source position, to the destination position.
@@ -776,44 +775,44 @@ shftln_lp1:
ply #2 ; Set our position back to the source.
stb (ptr3), y ; Clear the character that is in the source.
iny ; Increment the source position.
- jmp shftln_lp1 ; Keep looping.
-shftln_wrap:
+ jmp @dec_loop ; Keep looping.
+@wrap:
tax ; Use the ending line as a parameter for setbit.
jsr setbit ; Set the wrap bit of the ending line.
- jmp shftln_end2 ; We are done.
-shftln_wrp1:
+ jmp @end5 ; We are done.
+@wrap1:
tax ; Use the ending line as a parameter for clrbit.
jsr clrbit ; Clear the wrap bit of the ending line.
- jmp shftln_end2 ; We are done.
-shftln_end:
+ jmp @end5 ; We are done.
+@end:
lda (ptr3), y ; Is this character a null terminator?
- bne shftln_nd0 ; No, so just find the end of the line.
+ bne @end1 ; No, so just find the end of the line.
lda #$20 ; Yes, so convert it to a space for now.
sta (ptr3), y ;
-shftln_nd0:
+@end1:
jsr findend ; Find the ending line.
sta d ; Save ending line for later.
lda (ptr3), y ; Is this character a space?
cmp #$20 ;
- bne shftln_nd1 ; No, so skip the conversion.
+ bne @end5 ; No, so skip the conversion.
lda #0 ; Yes, so convert it back to zero.
sta (ptr3), y ;
-shftln_nd1:
+@end2:
lda d ; Get the ending line.
cmp scr_row ; Is the ending line greater than the starting line?
- beq shftln_end2 ; No, so we're done.
- bcs shftln_wrap ; Yes, so set the wrap bit.
- jmp shftln_end2 ; No, so we're done.
-shftln_end1:
+ beq @end5 ; No, so we're done.
+ bcs @wrap ; Yes, so set the wrap bit.
+ jmp @end5 ; No, so we're done.
+@end3:
jsr findend ; Find the ending line.
cpb #0 ; Is the remainder zero?
- beq shftln_nd2 ; Yes, so check if the ending line is greater than the starting line.
- jmp shftln_end2 ; No, so we're done.
-shftln_nd2:
+ beq @end4 ; Yes, so check if the ending line is greater than the starting line.
+ jmp @end5 ; No, so we're done.
+@end4:
cmp scr_row ; Is the ending line greater than the starting line?
- beq shftln_end2 ; No, so we're done.
- bcs shftln_wrp1 ; Yes, so clear the wrap bit.
-shftln_end2:
+ beq @end5 ; No, so we're done.
+ bcs @wrap1 ; Yes, so clear the wrap bit.
+@end5:
rts ; End of shftln.
esc:
@@ -864,35 +863,36 @@ shftesc_end:
isup:
lda c ; Load the escape code into the accumulator.
cmp #'A' ; Did the user press the up arrow key?
- bne isup_done ; No, so we're done.
+ bne @end ; No, so we're done.
lda scr_row ; Yes, but is the cursor at the top of the screen?
- beq isup_scrl ; Yes, so check if we need to scroll.
-isup_2:
+ beq @scroll ; Yes, so check if we need to scroll.
+@check2:
lda c ; 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.
- jmp isup_done ; No, so we're done
-isup_scrl:
+ jmp @end ; No, so we're done.
+@scroll:
lda scr_str ; Are we at the top of the screen buffer?
- beq isup_done ; Yes, so we're done.
+ 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 ;
+@end:
isup_done:
rts ; End of isup.
isdown:
lda c ; Load the escape code into the accumulator.
cmp #'B' ; Did the user press the down arrow key?
- bne isdown_done ; No, so we're done.
+ 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 isdown_scrl ; Yes, so scroll down.
+ beq @scroll ; Yes, so scroll down.
lda c ; 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.
- jmp isdown_done
-isdown_scrl:
+ jmp @end ; No, so we're done.
+@scroll:
lda scr_row ; Save the cursor's row number.
sta scr_trow ;
lda scr_col ; Save the cursor's column number.
@@ -904,42 +904,44 @@ isdown_scrl:
sta scr_col ;
lda #1 ; Tell the escape routine that we were successful.
sta d ;
+@end:
isdown_done:
rts ; End of isdown.
isright:
lda c ; Load the escape code into the accumulator.
cmp #'C' ; Did the user press the right arrow key?
- bne isright_dne ; No, so we're done.
+ bne @end2 ; No, so we're done.
lda scr_col ; Yes, so start checking the x coordinate of the cursor.
cmp #maxcol ; Is the cursor at the far right of the screen?
- beq isright_wrp ; Yes, so check if this is a wrapped line.
+ beq @wrap ; Yes, so check if this is a wrapped line.
jmp right ; No, so move the cursor right, like normal.
-isright_wrp:
+@wrap:
inc scr_row ; Move down a row.
jsr getbit ; Is the current line, a wrapped line?
- bcs wrap_inc ; Yes, so leave the cursor where it is.
+ bcs @incr ; Yes, so leave the cursor where it is.
dec scr_row ; No, so move the cursor back up a row.
- jmp isright_dne ; We are done.
-isright_scr:
+ jmp @end2 ; We are done.
+@scroll:
lda scr_str ; Are we at the top of the screen buffer?
- beq isright_end ; Yes, so we're done.
+ beq @end ; Yes, so we're done.
lda #1 ; No, so scroll down.
sta wrapped ; Set the wrapped flag.
jsr scrl_down ; Scroll down.
- jmp isright_end ; We are done.
-wrap_inc:
+ jmp @end ; We are done.
+@incr:
lda #0 ; Set the cursor to the far left of the screen.
sta scr_col ;
lda scr_row ; Get the current row number.
cmp #maxrow ; Are we at the bottom of the screen?
- beq isright_nd2 ; No, so we're done.
- bcs isright_scr ; Yes, so check if we are scrolling down.
- jmp isright_nd2 ; No, so we're done.
-isright_end:
+ beq @end1 ; No, so we're done.
+ bcs @scroll ; Yes, so check if we are scrolling down.
+ jmp @end1 ; No, so we're done.
+@end:
dec scr_row ; Move back up a row.
-isright_nd2:
+@end1:
jsr update_pos ; Update the cursor position.
+@end2:
isright_dne:
lda #0 ; Unset the wrapped flag.
sta wrapped ;
@@ -948,40 +950,41 @@ isright_dne:
isleft:
lda c ; Load the escape code into the accumulator.
cmp #'C' ; Did the user press right?
- beq isleft_done ; Yes, so we're done
+ beq @end1 ; Yes, so we're done
lda scr_col ; No, but is the cursor at the far left of the screen?
- beq isleft_wrp ; Yes, so start checking if this is a wrapped line.
+ beq @wrap ; Yes, so start checking if this is a wrapped line.
lda c ; 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.
- jmp isleft_done ; No, so we're done.
-isleft_wrp:
+ jmp @end1 ; No, so we're done.
+@wrap:
jsr getbit ; Is the current line, a wrapped line?
- bcs wrap_dec ; Yes, so wrap back up a line.
- jmp isleft_done ; No, so we're done.
-wrap_dec:
+ bcs @decr ; Yes, so wrap back up a line.
+ jmp @end1 ; No, so we're done.
+@decr:
lda scr_row ; Is the cursor at the top of the screen?
- beq wrap_dec1 ; Yes, so don't move up a line.
+ beq @decr1 ; Yes, so don't move up a line.
lda #1 ; No, so set the wrapped flag.
sta wrapped ;
dec scr_row ; Move the cursor up one line.
-wrap_dec1:
+@decr1:
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 ;
lda scr_row ; Are we at the top of the screen?
- beq isleft_scrl ; Yes, so check if we need to scroll.
- jmp isleft_end ; No, so we're done.
-isleft_scrl:
+ beq @scroll ; Yes, so check if we need to scroll.
+ jmp @end ; No, so we're done.
+@scroll:
lda wrapped ; Was the wrapped flag set somewhere else?
- bne isleft_end ; Yes so we're done.
+ bne @end ; Yes so we're done.
lda scr_str ; No, but are we actually at the top of the screen buffer?
- beq isleft_done ; Yes, so we're done.
+ beq @end1 ; Yes, so we're done.
jsr scrl_up ; No, so scroll up.
- jmp isleft_done ; We are done.
-isleft_end:
+ jmp @end1 ; We are done.
+@end:
jsr update_pos ; Update the cursor position.
+@end1:
isleft_done:
lda #0 ; Unset the wrapped flag.
sta wrapped ;
@@ -1082,7 +1085,7 @@ getcol:
sta scr ; to the screen.
lda scr_col ; Get the cursor's x coordinate.
div #10 ; Divide A by 10.
- clc
+ clc ;
adc #'0' ; Convert it to ascii, and
sta scr ; print to the screen.
tba ; Get the remainder.
@@ -1103,26 +1106,26 @@ scrl_down:
lda scr_row ; Get the cursor's line number.
pha #1 ; Save it in the stack.
lda wrapped ; Was the wrapped flag set?
- beq scrldn_save ; Yes, so save the cursor position.
-scrldn1:
- jsr rdrw_row ; Redraw this row.
+ beq @save ; Yes, so save the cursor position.
+@redraw:
+ jsr rdrw_row ; No, so redraw this row.
lda wrapped ; Was the wrapped flag set?
- beq scrldn_load ; Yes, so load the previous cursor position back.
- jmp scrldn_end ; No, so we're done.
-scrldn_save:
+ beq @load ; Yes, so load the previous cursor position back.
+ jmp @end ; No, so we're done.
+@save:
lda scr_col ; Get the cursor's column number.
pha #1 ; Save it in the stack.
- jmp scrldn1 ; Start redrawing the current row.
-scrldn_load:
+ jmp @redraw ; Start redrawing the current row.
+@load:
pla #1 ; Get the cursor's previous column number back.
sta scr_col ;
-scrldn_end:
+@end:
pla #1 ; Get the cursor's previous line number back.
sta scr_row ;
jsr update_pos ; Update the cursor's position.
lda #0 ; Clear the wrapped flag.
sta wrapped ;
-scrldn_done:
+@end1:
rts ; End of scrl_down.
scrl_up:
@@ -1146,37 +1149,37 @@ scrl_up:
pla #1 ;
sta scr_row ;
jsr update_pos ;
-scrlup_done:
+@end:
rts ;
rdrw_row:
lda #0 ;
sta scr_col ;
jsr update_pos ;
-rdrow_st:
+@loop:
lda (ptr3), y ;
- beq rdrow_inc ;
+ beq @incr ;
sta scr ;
-rdrow_inc:
+@incr:
inc scr_col ;
lda (ptr3), y ;
- beq rdrow_skip ;
-rdrow_inc1:
+ beq @skip ;
+@incr1:
iny ;
-rdrow_inc2:
+@incr2:
lda scr_col ;
cmp #maxcol+1 ;
- bcs rdrow_end ;
- jmp rdrow_st ;
-rdrow_skip:
+ bcs @end ;
+ jmp @loop ;
+@skip:
lda #' ' ;
sta scr ; to the screen.
- jmp rdrow_inc1 ;
-rdrow_end:
+ jmp @incr1 ;
+@end:
lda #0 ;
sta scr_col ;
jsr update_pos ;
-rdrow_done:
+@end1:
rts ;
rdrw_ln:
@@ -1187,17 +1190,17 @@ rdrw_ln:
lda scr_col ;
pha #1 ;
jsr update_pos ;
-rdrwln_lp:
+@loop:
lda scr_row ;
cmp e ;
- beq rdrwln_lp1 ;
- bcs rdrwln_done ;
-rdrwln_lp1:
+ beq @loop1 ;
+ bcs @end ;
+@loop1:
jsr rdrw_row ;
-rdrwln_inc:
+@incr:
inc scr_row ;
- jmp rdrwln_lp ;
-rdrwln_done:
+ jmp @loop ;
+@end:
pla #1 ;
sta scr_col ;
pla #1 ;
@@ -1210,21 +1213,21 @@ rdrwln_done:
set_ptr:
cpb #1 ; Are we setting the second pointer?
- beq set_ptr2 ; Yes, so start setting it.
+ beq @ptr2 ; Yes, so start setting it.
cpb #2 ; No, but are we setting the third pointer?
- beq set_ptr3 ; Yes, so start setting it.
-set_ptr1:
+ beq @ptr3 ; Yes, so start setting it.
+@ptr1:
stb.q ptr ; Reset the first pointer.
sta.q ptr ; No, so set the first pointer.
- jmp setptr_end ; We are done.
-set_ptr2:
+ jmp @end ; We are done.
+@ptr2:
stb.q ptr2 ; Reset the second pointer.
sta.q ptr2 ; Set the second pointer.
- jmp setptr_end ; We are done.
-set_ptr3:
+ jmp @end ; We are done.
+@ptr3:
stb.q ptr3 ; Reset the third pointer.
sta.q ptr3 ; Set the third pointer.
-setptr_end:
+@end:
rts ; End of set_ptr.
; Entry point for SuBAsm.