diff options
Diffstat (limited to 'programs/subasm.s')
-rw-r--r-- | programs/subasm.s | 76 |
1 files changed, 37 insertions, 39 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. |