diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-12-04 15:20:28 -0500 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-12-04 15:20:28 -0500 |
commit | 96393257a43ac52f2b911594d106741245dec5f0 (patch) | |
tree | 6b9d11c50ed3cd1920444c4dd0ee4027814ef4bd /programs/sub-suite/subasm.s | |
parent | 83ce1151ee1f06ae6b1c5c1018cc2489494e5ea4 (diff) |
- Started work on writing the new version of the
assembler.
- Did alot of stuff in the emulator.
- Did alot of stuff in the SuB Suite.
Diffstat (limited to 'programs/sub-suite/subasm.s')
-rw-r--r-- | programs/sub-suite/subasm.s | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/programs/sub-suite/subasm.s b/programs/sub-suite/subasm.s index 0a3ee80..7b2b8b9 100644 --- a/programs/sub-suite/subasm.s +++ b/programs/sub-suite/subasm.s @@ -16,21 +16,17 @@ subasm: jsr lex ; No, so start lexing this line. bra @end ; We are done. @cmd: - ldb #1 ; Set the second pointer - lda.d #cmd_srt ; to the command subroutine table. - jsr set_ptr ; - deb ; Reset B. - tba ; Reset A. lda regf ; Get the command ID. cmp #8 ; Is the command ID greater than the command count? bcs @end ; Yes, so we're done. lsl #1 ; No, so multiply the command ID by two. - tay ; Set the index to the offset that we just calculated. - lda.w (ptr2), y ; Get the command subroutine, from the command subroutine table. - ldb #2 ; Save it in the third pointer. - jsr set_ptr ; - ldb #0 ; Reset B. - jsr (ptr3) ; Run the command's subroutine. + phx.q ; Preserve X. + tax ; Set the index to the offset that we just calculated. + lea.w (cmd_srt, x); Get the pointer, from the command subroutine table. + plx.q ; Restore X. + and #0 ; Reset A. + tab ; Reset B. + jsr (e) ; Run the command's subroutine. @end: and #0 ; Reset A. jsr update_ptr ; Get the screen buffer index. @@ -39,12 +35,14 @@ subasm: rts ; End of subasm. chk_shcmd: - tba ; Reset A. - inb ; Set the second pointer - lda.w #sh_cmds ; to the shortend command table. - jsr set_ptr ; - deb ; Reset B. - tba ; Reset A. + and #0 ; Reset A. + tab ; Reset B. +; inb ; Set the second pointer +; lda.w #sh_cmds ; to the shortend command table. +; jsr set_ptr ; +; deb ; Reset B. +; tba ; Reset A. + lea sh_cmds ; Get the address of the short command table. phy.w ; Preserve the screen buffer position. txy ; Set our index to zero. lda (ptr), y ; Is there nothing in the command buffer? @@ -53,27 +51,31 @@ chk_shcmd: beq @false ; Yes, so return that we failed. jsr tolower ; No, so convert it to lowercase. @loop: - ldb (ptr2), y ; Are we at the end of the table? +; ldb (ptr2), y ; Are we at the end of the table? + ldb (e) ; Are we at the end of the table? beq @false ; Yes, so return that we failed. cmp b ; No, so did the character match? beq @found ; Yes, so check if there are any arguments. - iny ; No, so check the next command. + ine ; No, so check the next command. + iny ; bra @loop ; Keep looping. @found: sty regf ; Save the command ID. - ldy #1 ; Check the next character in the command buffer. - lda (ptr), y ; Is this the end of the buffer? - beq @true ; Yes, so return that we succeded. + lea (ptr) ; Get the address of the next character. + ine ; +; ldy #1 ; Check the next character in the command buffer. +; lda (ptr), y ; Is this the end of the buffer? + lda (e) ; Is this the end of the buffer? + beq @true ; Yes, so return true. cmp #' ' ; No, but is this a space? - beq @true ; Yes, so return that we succeded. - bra @false ; No, so return that we failed. -@true: - lda #1 ; Return true. - bra @end ; We are done. + beq @true ; Yes, so return true. @false: ldb #0 ; Reset B. tba ; Return false. tax ; Reset X. + bra @end ; We are done. +@true: + lda #1 ; Return true. @end: ply.w ; Get back the screen buffer position. rts ; End of chk_shcmd. @@ -130,8 +132,9 @@ viewmem: 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. - jsr print_str ; + lea strbuf ; Print the string buffer. +; jsr print_str ; + jsr print_sfast ; inc idx1 ; Increment the chunk count. ldb idx1 ; Get the chunk count. cpb #$10 ; Did we print 16 chunks? |