diff options
Diffstat (limited to 'programs')
-rw-r--r-- | programs/subasm.s | 76 | ||||
-rw-r--r-- | programs/subeditor.s | 241 |
2 files changed, 155 insertions, 162 deletions
diff --git a/programs/subasm.s b/programs/subasm.s index 350e105..e5d620f 100644 --- a/programs/subasm.s +++ b/programs/subasm.s @@ -65,8 +65,7 @@ mne: .byte "CPY", $19, $3D, $FF, $FF, $85, $FF, $FF, $4C, $FF .byte "PLB", $1A, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF .byte "INC", $FF, $1D, $FF, $FF, $FF, $FF, $FF, $1C, $F5 - .byte "JSR", $FF, $1E, $FF, $FF, $BE, $FF, $FF, $FF, $FF - .byte "JSL", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $20, $FF + .byte "JSR", $FF, $1E, $FF, $FF, $BE, $FF, $FF, $20, $FF .byte "AND", $21, $26, $FF, $FF, $FF, $FF, $FF, $24, $FF .byte "ABA", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $22 .byte "PLP", $28, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF @@ -113,7 +112,6 @@ mne: .byte "INY", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $A8 .byte "TAX", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $AA .byte "RTS", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $AE - .byte "RTL", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $B0 .byte "CMP", $B1, $B6, $FF, $FF, $25, $7D, $7C, $B4, $FF .byte "CAB", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $B2 .byte "SEI", $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $B8 @@ -214,22 +212,22 @@ fix_val: subasm: ldb #0 ; Set the first pointer lda.d #cmd_buf ; to the command buffer. - jsl set_ptr ; + jsr set_ptr ; tba ; Reset A. tax ; Reset X. - jsl chk_shcmd ; Did we get a shortend command? + jsr chk_shcmd ; Did we get a shortend command? bne parse_cmd ; Yes, so skip everything else. jmp subasm_end ; - jsl chk_cmd ; No, but did we get a full command? + jsr chk_cmd ; No, but did we get a full command? bne parse_cmd ; Yes, so skip everything else. - jsl lexer ; No, so start lexing this line. + jsr lexer ; No, so start lexing this line. subasm_end: - rtl ; End of subasm. + rts ; End of subasm. parse_cmd: ldb #1 ; Set the second pointer lda.d #cmd_srt ; to the command subroutine table. - jsl set_ptr ; + jsr set_ptr ; deb ; Reset B. tba ; Reset A. lda f ; Get the command ID. @@ -241,7 +239,7 @@ parse_cmd: lda.w (ptr2), y ; Get the command subroutine, from the command subroutine table. ply #2 ; Get back the screen buffer position. ldb #2 ; Save it in the third pointer. - jsl set_ptr ; + jsr set_ptr ; ldb #0 ; Reset B. jsr (ptr3) ; Run the command's subroutine. jmp subasm_end ; We are done. @@ -250,7 +248,7 @@ chk_shcmd: tba ; Reset A. inb ; Set the second pointer lda.w #sh_cmds ; to the shortend command table. - jsl set_ptr ; + jsr set_ptr ; deb ; Reset B. tba ; Reset A. phy #2 ; Preserve the screen buffer position. @@ -283,19 +281,19 @@ shcmd_fail: tax ; Reset X. shcmd_end: ply #2 ; Get back the screen buffer position. - rtl ; End of chk_shcmd. + rts ; End of chk_shcmd. print_hex: pha #8 ; Preserve the hex value. and #0 ; Reset A. ldb #1 ; Set the second pointer lda.w #hex_char ; to the start of hex character table. - jsl set_ptr ; + jsr set_ptr ; inb ; Set the third pointer lda.d #hex_str ; to the end of hex string buffer. clc ; Do a non carrying add. adc #$10 ; - jsl set_ptr ; + jsr set_ptr ; ldb #0 ; Reset B. pla #8 ; Get the hex value back. pnthex_lp: @@ -325,22 +323,22 @@ pnthex_lp4: beq pnthex_end ; Yes, so we're done. jmp pnthex_lp ; No, so keep printing more digits. pnthex_end: - rtl ; End of print_hex. + rts ; End of print_hex. charcpy: ldx idx3 ; Get the string index. sta strbuf, x ; Save it in the string buffer. inc idx3 ; Increment the string index. - rtl ; End of charcpy. + rts ; End of charcpy. print_hi: and #0 ; Reset A. sta idx3 ; Clear the string index. lda #'$' ; Print the hex delimiter. - jsl charcpy ; + jsr charcpy ; lda.q idx0 ; Get the masked address. ldx #$10 ; Set digit count to 16. - jsl print_hex ; Print the address. + jsr print_hex ; Print the address. lda.q hex_str ; Get the lower half of the string. sta.q strbuf+1 ; Save it in the string buffer. lda.q hex_str+8 ; Get the upper half of the string. @@ -348,10 +346,10 @@ print_hi: ldx #$11 ; Add 16 to the index. stx idx3 ; lda #':' ; Print a colon. - jsl charcpy ; + jsr charcpy ; lda # ' ' ; Print a space. - jsl charcpy ; - rtl ; End of print_hi. + jsr charcpy ; + rts ; End of print_hi. print_lo: lda #0 ; Reset A. @@ -359,11 +357,11 @@ print_lo: pntlo_lp: ldx #2 ; Set digit count to 2. pha #1 ; Preserve the nibble offset. - jsl print_hex ; Print the low nibble offset. + jsr print_hex ; Print the low nibble offset. lda.w (ptr3) ; Get the two digits. - jsl charcpy ; Copy the first digit. + jsr charcpy ; Copy the first digit. lsr #8 ; Copy the next digit. - jsl charcpy ; + jsr charcpy ; pla #1 ; Get the nibble offset back. inc ; Increment the offset. cmp #$10 ; Are we at the last offset? @@ -371,7 +369,7 @@ pntlo_lp: pntlo_lp1: pha #1 ; No, so preserve the nibble offset. lda #' ' ; Add a space to the string buffer. - jsl charcpy ; + jsr charcpy ; pla #1 ; Get the nibble offset back. jmp pntlo_lp ; Keep looping. pntlo_end: @@ -380,8 +378,8 @@ pntlo_end: sta strbuf, x ; tax ; Reset X. lda.d #strbuf ; Print the string buffer. - jsl print_str ; - rtl ; End of print_lo. + jsr print_str ; + rts ; End of print_lo. print_chunk: ldx #0 ; Reset X. @@ -391,16 +389,16 @@ pntchnk_lp: and #0 ; Reset A. ldx #2 ; Set the digit count to 2. lda (idx0), y ; Get the byte at that address. - jsl print_hex ; Print the byte. + jsr print_hex ; Print the byte. lda.w (ptr3) ; Get the two digits. - jsl charcpy ; Copy the first digit. + jsr charcpy ; Copy the first digit. lsr #8 ; Copy the next digit. - jsl charcpy ; + jsr charcpy ; iny ; Increment the byte index. cpy #$10 ; Have we read 16 bytes? beq pntchnk_end ; Yes, so we're done. lda #' ' ; No, so add a soace to the string buffer. - jsl charcpy ; + jsr charcpy ; jmp pntchnk_lp ; Keep looping. pntchnk_end: ply #2 ; Get the screen buffer index back. @@ -409,7 +407,7 @@ pntchnk_end: sta strbuf, x ; tax ; Reset X. sta idx3 ; Clear the string index. - rtl ; End of print_chunk. + rts ; End of print_chunk. viewmem: lda.q prg_cnt ; Get the program counter. @@ -418,18 +416,18 @@ viewmem: sta idx0 ; Overwrite the first byte, with the masked byte. lda #19 ; Move the cursor to the right, by 19 columns. sta scr_col ; - jsl update_pos ; - jsl print_lo ; Print the low nibble offsets. + jsr update_pos ; + jsr print_lo ; Print the low nibble offsets. ldx #0 ; Reset X. ldb #0 ; Reset B. stb idx1 ; Reset the byte count. vmem_lp0: lda #'\n' ; Print a newline. - jsl print_char ; - jsl print_hi ; Place the address in the string buffer. - jsl print_chunk ; Place the next 16 bytes in the string buffer. + jsr print_char ; + jsr print_hi ; Place the address in the string buffer. + jsr print_chunk ; Place the next 16 bytes in the string buffer. lda.d #strbuf ; Print the string buffer. - jsl print_str ; + jsr print_str ; inc idx1 ; Increment the chunk count. ldb idx1 ; Get the chunk count. cpb #$10 ; Did we print 16 chunks? @@ -442,7 +440,7 @@ vmem_lp0: jmp vmem_lp0 ; Keep looping. vmem_end: lda #'\n' ; Print a newline. - jsl print_char ; + jsr print_char ; and #0 ; Reset A. rts ; End of viewmem. diff --git a/programs/subeditor.s b/programs/subeditor.s index e344588..0a42c32 100644 --- a/programs/subeditor.s +++ b/programs/subeditor.s @@ -38,11 +38,6 @@ made: author: .byte "mr b0nk 500" -;sub_name: -; .byte "SuB Suite" -;sub_ver: -; .byte "0.9" - string2: .byte "You typed, " @@ -143,17 +138,17 @@ reset: lda.w #$1FFF ; Set the clear count to $1FFF. sta.w scr_ptr ; lda.d #buffer ; Set the array to be cleared to the screen buffer. - jsl clr_arr ; Clear the screen buffer. - jsl pnt_strt ; Print the starting message. + jsr clr_arr ; Clear the screen buffer. + jsr pnt_strt ; Print the starting message. jmp start ; Goto the start of the main program. clr_arr: phb #1 ; Preserve whatever was in B. ldb #0 ; Clear B. - jsl set_ptr ; Set the first pointer to the parameter. + jsr set_ptr ; Set the first pointer to the parameter. adc #8 ; Set the second pointer to the parameter, plus eight. inb ; Tell set_ptr to set the second pointer. - jsl set_ptr ; + jsr set_ptr ; deb ; Set B back to zero. tba ; clr_arr_st: @@ -175,26 +170,26 @@ clr_arr_st: clr_arr_end: ldy.w zero ; Set the index back to zero. plb #1 ; Get whatever was in the B register, back. - rtl ; End of clr_arr. + rts ; End of clr_arr. pnt_strt: lda.w #ed_name ; Print the name of the editor. - jsl print_str ; + jsr print_str ; lda.w #ver_str ; Print the version text. - jsl print_str ; + jsr print_str ; lda.w #ed_ver ; Print the version number. - jsl print_str ; + jsr print_str ; lda.w #ed_sver ; Print the sub version number. - jsl print_str ; + jsr print_str ; lda #'\n' ; Print a newline. - jsl print_char ; + jsr print_char ; lda.w #made ; Print the "Created by" text. - jsl print_str ; + jsr print_str ; lda.w #author ; Print the name of the author. - jsl print_str ; + jsr print_str ; lda #'\n' ; Print a newline. - jsl print_char ; - rtl ; End of pnt_strt. + jsr print_char ; + rts ; End of pnt_strt. start: lda #0 ; TODO: Update this for the Super VIA. @@ -205,7 +200,7 @@ start: lda.w #$3FF ; Set the clear count to $3FF. sta.w scr_ptr ; lda.d #cmd_buf ; Set the array to be cleared to the command buffer. - jsl clr_arr ; Clear the command buffer. + jsr clr_arr ; Clear the command buffer. ply #2 ; Get back the cursor index. and #0 ; Reset the Accumulator. sta end ; @@ -217,7 +212,7 @@ read: inc end ; Enable the dummy flag. lda status ; Did we get a key? beq read ; No, so try again. - jsl getchar ; Yes, and was it a newline? + jsr getchar ; Yes, and was it a newline? beq parse ; Yes, so start parsing the line. jmp read ; No, so keep looping. @@ -227,7 +222,7 @@ print_str: print_str2: lda.q end ; Get the parameter. ldb #0 ; Clear the B register. - jsl set_ptr ; Set the first pointer to the parameter. + jsr set_ptr ; Set the first pointer to the parameter. tba ; Clear the Accumulator. pntstr_lp: ldb #1 ; Enable replace mode. @@ -242,12 +237,12 @@ pntstr_lp: ply #2 ; Get the cursor index back. beq pntstr_end ; Yes, so we're done. inx ; No, so increment the string index. - jsl print_char ; Print the character. + jsr print_char ; Print the character. jmp pntstr_lp ; Keep looping. pntstr_end: ldb #0 ; Enable insert mode. stb b ; - rtl ; End of print_str. + rts ; End of print_str. getbit: clc ; Clear the carry flag. @@ -263,10 +258,10 @@ getbt1: pha #1 ; Save the parameter. ldb #1 ; Make sure that set_ptr sets the second pointer. lda.d #bitabl ; Set the second pointer to the linewrap table. - jsl set_ptr ; + jsr set_ptr ; lsr #$10 ; Clear the Accumulator. pla #1 ; Get the return byte back. - jsl bitpos ; Get the bit, and byte position. + jsr bitpos ; Get the bit, and byte position. phy #2 ; Save the screen index. txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. @@ -279,10 +274,10 @@ clrbit: pha #1 ; Save the parameter. ldb #1 ; Make sure that set_ptr sets the second pointer. lda.d #bitabl ; Set the second pointer to the linewrap table. - jsl set_ptr ; + jsr set_ptr ; and #0 ; Clear the Accumulator. pla #1 ; Get the return byte back. - jsl bitpos ; Get the bit, and byte position. + jsr bitpos ; Get the bit, and byte position. xor #$FF ; Invert the bitmask. phy #2 ; Save the screen index. txy ; Get the byte position. @@ -293,16 +288,16 @@ bitsav: ply #2 ; Get the screen index back. bitout: ldx bitmask ; Return the bitmask. - rtl ; We are done. + rts ; We are done. setbit: pha #1 ; Save the parameter. ldb #1 ; Make sure that set_ptr sets the second pointer. lda.d #bitabl ; Set the second pointer to the linewrap table. - jsl set_ptr ; + jsr set_ptr ; and #0 ; Clear the Accumulator. pla #1 ; Get the return byte back. - jsl bitpos ; Get the bit, and byte position. + jsr bitpos ; Get the bit, and byte position. phy #2 ; Save the screen index. txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. @@ -313,7 +308,7 @@ bitpos: pha #1 ; Save the parameter. ldb #0 ; Make sure that set_ptr sets the first pointer. lda.w #bits ; Set the first pointer to the bitmask table. - jsl set_ptr ; + jsr set_ptr ; and #0 ; Clear the Accumulator. pla #1 ; Get the parameter back. stx bitmask ; Make the line number the bitmask. @@ -329,7 +324,7 @@ bitpos: lsr #3 ; Get the byte position. tax ; Copy it into X. pla #1 ; Get back the bitmask. - rtl ; End of bitpos. + rts ; End of bitpos. getchar: lda kbd ; Get the character that was typed from the keyboard. @@ -340,14 +335,14 @@ getchar: 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. - jsl cmd_cpy ; Yes, so start copying the line to the command buffer. + jsr cmd_cpy ; Yes, so start copying the line to the command buffer. getchar_pnt: 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: - jsl print_char ; No, so print the character. + 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. @@ -369,13 +364,13 @@ getchar_ln: getchar_chr: lda #1 ; Return one. getchar_end: - rtl ; End of get char. + rts ; End of get char. cmd_cpy: lda scr_row ; Get the row position. sta scr_trow ; Save it for later. - jsl findend ; Find the end of the line. + 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: @@ -385,7 +380,7 @@ cmd_cpy2: cmd_cpy3: sta scr_row ; Set the row position to the end of the line. sta e ; Save it into the temporary row posiition. - jsl findst ; Find the start of the line. + jsr findst ; Find the start of the line. clc ; Clear the carry flag. lda scr_row ; Get the row position. adc scr_str ; Add it with the screen's starting row. @@ -394,10 +389,10 @@ cmd_cpy3: ldx.w #0 ; Reset the X register. ldb #0 ; Make sure that set_ptr sets the first pointer. lda.d #buffer ; Set the first pointer to the start of the screen buffer. - jsl set_ptr ; + jsr set_ptr ; inb ; Make sure that set_ptr sets the second pointer. lda.d #cmd_buf ; Set the second pointer to the start of the command buffer. - jsl set_ptr ; + jsr set_ptr ; deb ; Set B back to zero. tba ; Set the accumulator to zero. cmd_cpy_lp: @@ -431,14 +426,14 @@ cmd_cpy_nd0: ply #2 ; Get back the screen index. cmd_cpy_nd: tab ; The B register is zero, so clear the Accumulator. - rtl ; End of cmd_cpy. + rts ; End of cmd_cpy. findst: lda #0 ; Reset A. findst_lp: pha #1 ; Save the current line number. - jsl getbit ; Is this the start of the line? + 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. inc ; No, so check the next physical line. @@ -448,14 +443,14 @@ findst_lp: inc scr_row ; Put the row postiion back to zero. findst_done: cmp #0 ; Update all the flags. - rtl ; End of findst. + rts ; End of findst. fndend: phb #1 ; Save the contents of the B register. ldb #0 ; Make sure that set_ptr sets the first pointer. lda.d #buffer ; Set the first pointer to the start of the screen buffer. - jsl set_ptr ; + jsr set_ptr ; tba ; Set the Accumulator to zero. plb #1 ; Restore the contents of the B register. phy #2 ; @@ -467,25 +462,25 @@ fndend_lp: fndend_done: sty.w scr_ptr3 ; ply #2 ; - rtl ; End of fndend. + rts ; End of fndend. findend: - jsl fndend ; + jsr fndend ; lda.w scr_ptr3 ; div #maxcol+1 ; - rtl ; + rts ; parse: lda #0 ; tax ; - jsl subasm ; + jsr subasm ; jmp start ; print_char: sta a ; 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. - jsl set_ptr ; + jsr set_ptr ; ldb #0 ; Set B to zero. tba ; Set the Accumulator to zero. lda a ; Get back the character. @@ -511,25 +506,25 @@ printc: lda b ; No, but was the flag set? bne printc_save ; Yes, so don't shift the line. sty.w scr_ptr ; No, so save the cursor index for later. - jsl fndend ; Find the end of the line. + jsr fndend ; Find the end of the line. jmp prntc_movln ; Start shifting the line right. prntc_updt: lda scr_col ; Save the current column position for later. sta scr_tcol ; prntc_updt2: - jsl findend ; Find the end of the line. + 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. - jsl findst ; Find the start of the line. + jsr findst ; Find the start of the line. lda scr_row ; Get the start of the line. prntc_updt3: sta f ; Set the starting line, to the start of the line. - jsl rdrw_ln ; Redraw 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 ; - jsl update_pos ; Update the cursor's position. + jsr update_pos ; Update the cursor's position. dec d ; jmp printc_sav1 ; prntc_movln: @@ -539,7 +534,7 @@ prntc_movln: dey ; ldb #1 ; stb d ; - jsl shftln ; + jsr shftln ; ldb #1 ; stb d ; lda a ; @@ -580,7 +575,7 @@ printc_scrl: clc ; lda #1 ; sta wrapped ; - jsl scrl_down ; + jsr scrl_down ; jmp printc_wrap ; printc_wrap: ldb #0 @@ -596,11 +591,11 @@ printc_wrp2: lda scr_row ; adc scr_str ; tax ; - jsl setbit ; + jsr setbit ; plx #2 ; - jsl update_pos ; + jsr update_pos ; printc_end: - rtl ; + rts ; nl: lda #0 ; Reset A. @@ -612,11 +607,11 @@ nl1: 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. - jsl scrl_down ; Yes, so scroll down one line. + jsr scrl_down ; Yes, so scroll down one line. jmp nl_end ; We are done. nl_inc: inc scr_row ; Move the cursor down by one line. - jsl update_pos ; Update the cursor's position. + jsr update_pos ; Update the cursor's position. nl_end: lda #'\n' ; Print the newline. sta a ; @@ -633,15 +628,15 @@ clr_scr: lda.w #$1FFF ; Set the clear count to $1FFF. sta.w scr_ptr ; lda.d #buffer ; Set the array to be cleared to the screen buffer. - jsl clr_arr ; Clear the screen buffer. + jsr clr_arr ; Clear the screen buffer. tay ; lda.w #$3FF ; Set the clear count to $3FF. sta.w scr_ptr ; lda.d #cmd_buf ; Set the array to be cleared to the command buffer. - jsl clr_arr ; Clear the screen buffer. + jsr clr_arr ; Clear the screen buffer. sta scr_col ; sta scr_row ; - jsl update_pos ; + jsr update_pos ; lda #$C ; sta scr ; jmp printc_end ; @@ -670,10 +665,10 @@ back: stb f ; lda scr_row ; Save the current row position for later. sta scr_trow ; - jsl findend ; Find the end of the line. + jsr findend ; Find the end of the line. sta scr_row ; Set our row position to the end of the line. back0: - jsl findst ; Does this line take up more than one real line? + 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. lda scr_trow ; Get the real row position back. @@ -686,24 +681,24 @@ back1: iny ; Increment cursor index. ldb #0 ; Set shifting direction to left. stb d ; - jsl shftln ; Shift line back by one character. + 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? beq back3 ; No, so skip to the next step. back2: - jsl findend ; Yes, so find the end of the line. + 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. sta scr_tcol ; - jsl rdrw_ln ; Start redrawing the line. + 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. sta scr_row ; dec scr_col ; Move the cursor back by one column, - jsl update_pos ; and update it's position. + jsr update_pos ; and update it's position. jmp printc_end ; We are done. back_updt: lda scr_row ; Set the line to start redrawing, to the start of the line. @@ -716,7 +711,7 @@ bs: beq back_wrap ; Yes, so check for a wrapped line. jmp back ; No, so add the backspace to the buffer. back_wrap: - jsl getbit ; Is this line, a wrapped line? + jsr getbit ; Is this line, a wrapped line? bcs back_wrap1 ; Yes, so check if the cursor is at the top. jmp printc_end ; No, so we're done. back_wrap1: @@ -729,7 +724,7 @@ back_wrap2: jmp printc_end ; No, so we're done. back_scrl: clc ; Clear the carry flag, so that we don't get odd behaviour. - jsl scrl_up ; Scroll up. + jsr scrl_up ; Scroll up. inc scr_row ; Move down by one row. backwrp: clc ; Clear the carry flag. @@ -740,7 +735,7 @@ backwrp2: dec scr_row ; Move up by one row. ldb #maxcol+1 ; Move the cursor to the absolute right of the screen. stb scr_col ; - jsl update_pos ; Update the cursor's position. + jsr update_pos ; Update the cursor's position. jmp back ; Delete the previous character. shftln: @@ -784,11 +779,11 @@ shftln_lp1: jmp shftln_lp1 ; Keep looping. shftln_wrap: tax ; Use the ending line as a parameter for setbit. - jsl setbit ; Set the wrap bit of the ending line. + jsr setbit ; Set the wrap bit of the ending line. jmp shftln_end2 ; We are done. shftln_wrp1: tax ; Use the ending line as a parameter for clrbit. - jsl clrbit ; Clear the wrap bit of the ending line. + jsr clrbit ; Clear the wrap bit of the ending line. jmp shftln_end2 ; We are done. shftln_end: lda (ptr3), y ; Is this character a null terminator? @@ -796,7 +791,7 @@ shftln_end: lda #$20 ; Yes, so convert it to a space for now. sta (ptr3), y ; shftln_nd0: - jsl findend ; Find the ending line. + jsr findend ; Find the ending line. sta d ; Save ending line for later. lda (ptr3), y ; Is this character a space? cmp #$20 ; @@ -810,7 +805,7 @@ shftln_nd1: bcs shftln_wrap ; Yes, so set the wrap bit. jmp shftln_end2 ; No, so we're done. shftln_end1: - jsl findend ; Find the ending line. + 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. @@ -819,7 +814,7 @@ shftln_nd2: beq shftln_end2 ; No, so we're done. bcs shftln_wrp1 ; Yes, so clear the wrap bit. shftln_end2: - rtl ; End of shftln. + rts ; End of shftln. esc: lda status ; Get the next character. @@ -832,17 +827,17 @@ esc: sta c ; Store the escape code, until we need it. lda #0 ; Set the D pseudo register to zero. sta d ; - jsl isup ; Check if the user pressed up. + jsr isup ; Check if the user pressed up. lda d ; Did the user press up? bne esc_end ; Yes, so we're done. - jsl isdown ; No, so check if the user pressed down. + jsr isdown ; No, so check if the user pressed down. lda d ; Did the user press down? bne esc_end ; Yes, so we're done. lda #0 ; No, so check if the user pressed left. - jsl isleft ; + jsr isleft ; lda d ; Did the user press left? bne esc_end ; Yes, so we're done. - jsl isright ; No, so check if the user pressed right. + jsr isright ; No, so check if the user pressed right. esc_end: lda #0 ; Clear the D pseudo register. sta d ; @@ -857,10 +852,10 @@ shftesc: sta c ; Store the escape code, until we need it. lda #0 ; Use the D pseudo register as a skip flag. sta d ; - jsl isshftup ; Check if the user pressed shift+up. + jsr isshftup ; Check if the user pressed shift+up. lda d ; Was it successful? bne shftesc_end ; Yes, so we're done. - jsl isshftdown ; No, so check if the user pressed shift+down. + jsr isshftdown ; No, so check if the user pressed shift+down. shftesc_end: lda #0 ; Clear the D pseudo register. sta d ; @@ -880,11 +875,11 @@ isup_2: isup_scrl: lda scr_str ; Are we at the top of the screen buffer? beq isup_done ; Yes, so we're done. - jsl scrl_up ; No, so scroll up. + jsr scrl_up ; No, so scroll up. lda #1 ; Tell the escape routine that we were successful. sta d ; isup_done: - rtl ; End of isup. + rts ; End of isup. isdown: lda c ; Load the escape code into the accumulator. @@ -902,7 +897,7 @@ isdown_scrl: sta scr_trow ; lda scr_col ; Save the cursor's column number. sta scr_tcol ; - jsl scrl_down ; Scroll down. + jsr scrl_down ; Scroll down. lda scr_trow ; Load the cursor's row number. sta scr_row ; lda scr_tcol ; Load the cursor's column number. @@ -910,7 +905,7 @@ isdown_scrl: lda #1 ; Tell the escape routine that we were successful. sta d ; isdown_done: - rtl ; End of isdown. + rts ; End of isdown. isright: lda c ; Load the escape code into the accumulator. @@ -922,7 +917,7 @@ isright: jmp right ; No, so move the cursor right, like normal. isright_wrp: inc scr_row ; Move down a row. - jsl getbit ; Is the current line, a wrapped line? + jsr getbit ; Is the current line, a wrapped line? bcs wrap_inc ; 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. @@ -931,7 +926,7 @@ isright_scr: beq isright_end ; Yes, so we're done. lda #1 ; No, so scroll down. sta wrapped ; Set the wrapped flag. - jsl scrl_down ; Scroll down. + jsr scrl_down ; Scroll down. jmp isright_end ; We are done. wrap_inc: lda #0 ; Set the cursor to the far left of the screen. @@ -944,11 +939,11 @@ wrap_inc: isright_end: dec scr_row ; Move back up a row. isright_nd2: - jsl update_pos ; Update the cursor position. + jsr update_pos ; Update the cursor position. isright_dne: lda #0 ; Unset the wrapped flag. sta wrapped ; - rtl ; End of isright. + rts ; End of isright. isleft: lda c ; Load the escape code into the accumulator. @@ -961,7 +956,7 @@ isleft: beq left ; Yes, so move the cursor left. jmp isleft_done ; No, so we're done. isleft_wrp: - jsl getbit ; Is the current line, a wrapped line? + 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: @@ -983,34 +978,34 @@ isleft_scrl: bne isleft_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. - jsl scrl_up ; No, so scroll up. + jsr scrl_up ; No, so scroll up. jmp isleft_done ; We are done. isleft_end: - jsl update_pos ; Update the cursor position. + jsr update_pos ; Update the cursor position. isleft_done: lda #0 ; Unset the wrapped flag. sta wrapped ; - rtl ; End of isleft. + rts ; End of isleft. up: dec scr_row ; Move the cursor up a line. - jsl update_pos ; Update it's position. + jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. sta d ; jmp isup_done ; We are done. down: inc scr_row ; Move the cursor down a line. - jsl update_pos ; Update it's position. + jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. sta d ; jmp isdown_done ; We are done. right: inc scr_col ; Move the cursor right by one character. - jsl update_pos ; Update it's position. + jsr update_pos ; Update it's position. jmp isright_dne ; We are done. left: dec scr_col ; Move the cursor left a character. - jsl update_pos ; Update it's position. + jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. sta d ; jmp isleft_done ; We are done @@ -1025,7 +1020,7 @@ isshftup: beq shftup_done ; jmp shftup ; shftup_done: - rtl ; + rts ; isshftdown: lda c ; Load the escape code back into the accumulator. @@ -1038,16 +1033,16 @@ isshftdown: bcs shftdn_done ; jmp shftdown ; shftdn_done: - rtl ; + rts ; shftup: - jsl scrl_up ; + jsr scrl_up ; lda #1 ; sta d ; jmp shftup_done ; shftdown: - jsl scrl_down ; + jsr scrl_down ; lda #1 ; sta d ; jmp shftdn_done ; @@ -1066,11 +1061,11 @@ update_pos: sta scr ; to the screen. lda #'[' ; Print '[' sta scr ; to the screen, and start the escape sequence. - jsl getrow ; Start printing the row number to the screen. - jsl getcol ; Start printing the column number to the screen. + jsr getrow ; Start printing the row number to the screen. + jsr getcol ; Start printing the column number to the screen. lda #'H' ; Print 'H' sta scr ; to the screen. - rtl ; End of update_pos. + rts ; End of update_pos. getrow: lda scr_row ; Get the cursor's y coordinate. @@ -1080,7 +1075,7 @@ getrow: tba ; Get the remainder. adc #'0' ; Convert it to ascii, and sta scr ; print to the screen. - rtl ; End of getrow. + rts ; End of getrow. getcol: lda #';' ; Print ';' @@ -1094,7 +1089,7 @@ getcol: clc adc #'0' ; Convert it to ascii, and sta scr ; print to the screen. - rtl ; End of getrow. + rts ; End of getrow. scrl_down: inc scr_str ; Increment the starting line of the screen. @@ -1110,7 +1105,7 @@ scrl_down: lda wrapped ; Was the wrapped flag set? beq scrldn_save ; Yes, so save the cursor position. scrldn1: - jsl rdrw_row ; Redraw this row. + jsr rdrw_row ; 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. @@ -1124,11 +1119,11 @@ scrldn_load: scrldn_end: pla #1 ; Get the cursor's previous line number back. sta scr_row ; - jsl update_pos ; Update the cursor's position. + jsr update_pos ; Update the cursor's position. lda #0 ; Clear the wrapped flag. sta wrapped ; scrldn_done: - rtl ; End of scrl_down. + rts ; End of scrl_down. scrl_up: dec scr_str ; @@ -1145,19 +1140,19 @@ scrl_up: pha #1 ; lda #0 ; sta scr_row ; - jsl rdrw_row ; + jsr rdrw_row ; pla #1 ; sta scr_col ; pla #1 ; sta scr_row ; - jsl update_pos ; + jsr update_pos ; scrlup_done: - rtl ; + rts ; rdrw_row: lda #0 ; sta scr_col ; - jsl update_pos ; + jsr update_pos ; rdrow_st: lda (ptr3), y ; beq rdrow_inc ; @@ -1180,9 +1175,9 @@ rdrow_skip: rdrow_end: lda #0 ; sta scr_col ; - jsl update_pos ; + jsr update_pos ; rdrow_done: - rtl ; + rts ; rdrw_ln: lda scr_row ; @@ -1191,14 +1186,14 @@ rdrw_ln: sta scr_row ; lda scr_col ; pha #1 ; - jsl update_pos ; + jsr update_pos ; rdrwln_lp: lda scr_row ; cmp e ; beq rdrwln_lp1 ; bcs rdrwln_done ; rdrwln_lp1: - jsl rdrw_row ; + jsr rdrw_row ; rdrwln_inc: inc scr_row ; jmp rdrwln_lp ; @@ -1207,11 +1202,11 @@ rdrwln_done: sta scr_col ; pla #1 ; sta scr_row ; - jsl update_pos ; + jsr update_pos ; lda #0 ; sta e ; sta f ; - rtl ; + rts ; set_ptr: cpb #1 ; Are we setting the second pointer? @@ -1230,7 +1225,7 @@ set_ptr3: stb.q ptr3 ; Reset the third pointer. sta.q ptr3 ; Set the third pointer. setptr_end: - rtl ; End of set_ptr. + rts ; End of set_ptr. ; Entry point for SuBAsm. parser: |