diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-08-08 18:11:35 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-08-08 18:11:35 -0400 |
commit | f16af793a58a9f398fc598a0c129e3bb90eb61f6 (patch) | |
tree | 2f674574f2955a1bc52ee3a6818516226833ea9b /programs | |
parent | 1ec19679b3db209429b0897f6ccda6d09d018a70 (diff) |
- Refactored the opcode table, in order to make the
instruction formatting simpler.
- Refactored the instruction table of the emulator's
assembler, it now has two parts, the addressing mode
bits, and the base value.
The base value is what's used to generate the actual
opcode, with the addressing mode bits telling the
assembler what addressing modes this instruction
supports.
The reason for doing this was to use less space. For
comparison, the previous version used 870 bytes for
the instruction table, while the new version uses
only 222 bytes. The new version is nearly 4 times
smaller than the pervious version.
- The B register based ALU instructions now use their
own addressing mode, and are specified by using 'b'
as the operand for those instructions.
For example, to add the Accumulator with the B
register, you now use "ADC B" instead of "AAB".
Diffstat (limited to 'programs')
-rw-r--r-- | programs/sub-suite/declare.s | 14 | ||||
-rw-r--r-- | programs/sub-suite/lexer.s | 26 | ||||
-rw-r--r-- | programs/sub-suite/libc.s | 4 | ||||
-rw-r--r-- | programs/sub-suite/subasm.s | 8 | ||||
-rw-r--r-- | programs/sub-suite/subeditor.s | 146 | ||||
-rw-r--r-- | programs/sub-suite/subsuite.s | 2 | ||||
-rw-r--r-- | programs/sub-suite/utils.s | 12 |
7 files changed, 107 insertions, 105 deletions
diff --git a/programs/sub-suite/declare.s b/programs/sub-suite/declare.s index 745445b..2991e66 100644 --- a/programs/sub-suite/declare.s +++ b/programs/sub-suite/declare.s @@ -108,19 +108,19 @@ scr_ptr3: .res 2 ; Pseudo registers. -a: +rega: .res 1 -b: +regb: .res 1 -c: +regc: .res 1 -d: +regd: .res 1 -e: +rege: .res 1 -f: +regf: .res 1 -g: +regg: .res 1 ; This pseudo register is always zero. zero: diff --git a/programs/sub-suite/lexer.s b/programs/sub-suite/lexer.s index c144f9a..dc5a3b0 100644 --- a/programs/sub-suite/lexer.s +++ b/programs/sub-suite/lexer.s @@ -8,7 +8,7 @@ lex: sty.q idx0 ; Clear the first index. sty.q idx1 ; Clear the second index. sty.q idx2 ; Clear the third index. - sty b ; Clear the isop flag. + sty regb ; Clear the isop flag. ; lda (ptr), y ; Get a character from the line. ; pha ; Preserve the character. ; jsr isdigit ; Is this character a digit? @@ -99,7 +99,7 @@ ptok_dot: ldb #$11 ; Set the delimiter comparison value to whitespace. jsr delmcpy ; Copy the string, to the lexeme buffer, until delimiter. @isop: - lda b ; Has the isop flag been set? + lda regb ; Has the isop flag been set? beq @dir ; No, so check for a directive. @rs: lda #TOK_RS ; Yes, so set the lexeme type to TOK_RS. @@ -248,7 +248,7 @@ ptok_alph: tba ; Use isdelm2 for the comparison. jsr delmcpy ; Copy the string, to the lexeme buffer, until delimiter. lda #0 ; Reset A. - sta b ; Clear the isop flag. + sta regb ; Clear the isop flag. @isop: ldb #0 ; Make the lexeme buffer, the first pointer. stb.q idx1 ; Reset the second index. @@ -272,7 +272,7 @@ ptok_alph: @found: lda #TOK_MNE ; Set the lexeme type to TOK_MNE. sta lex_type ; - inc b ; Set the isop flag. + inc regb ; Set the isop flag. @end: jsr make_tok ; Create the token. jsr set_cmdbuf ; Set the first pointer to the command buffer. @@ -325,23 +325,23 @@ init_lex: delmcpy: - sta a ; Save the delimiter check flag. - stb c ; Save the delimiter comparison value. + sta rega ; Save the delimiter check flag. + stb regc ; Save the delimiter comparison value. @loop: ldb #0 ; Reset the B register. - stb g ; Reset the byte count. + stb regg ; Reset the byte count. ldy.w idx0 ; Get the string index. lda.q (ptr), y ; Get eight bytes from the current line. @loop1: pha.q ; Save the string buffer. and #$FF ; Get the current byte. pha ; Preserve the character. - lda a ; Are we calling isdelm2? + lda rega ; Are we calling isdelm2? pla ; Get the character back. bne @isdelm2 ; Yes, so use isdelm2. jsr isdelm ; No, so get the delimiter value from isdelm. @delmchk: - and c ; Are both delimiter values, the same? + and regc ; Are both delimiter values, the same? pla.q ; Get back the string buffer. bne @end ; Yes, so we're done. bra @copy ; No, so start copying the character. @@ -354,8 +354,8 @@ delmcpy: inc.w idx0 ; Increment the string index. inc.w idx1 ; Increment the lexeme index. lsr #8 ; Shift in the next byte. - inc g ; Increment the byte count. - ldb g ; Get back the byte count. + inc regg ; Increment the byte count. + ldb regg ; Get back the byte count. cpb #7 ; Did we shift in eight bytes? beq @loop ; Yes, so get eight more bytes. bra @loop1 ; No, so keep shifting in more bytes. @@ -372,12 +372,12 @@ delmcpy: ; ldy.w idx0 ; Get the string index. ; lda (ptr), y ; Get a character from the line. ; pha ; Preserve the character. -; lda a ; Are we calling isdelm2? +; lda rega ; Are we calling isdelm2? ; pla ; Get the character back. ; bne @isdelm2 ; Yes, so use isdelm2. ; jsr isdelm ; No, so get the delimiter value from isdelm. ;@delmchk: -; and c ; Are both delimiter values, the same? +; and regc ; Are both delimiter values, the same? ; bne @end ; Yes, so we're done. ; bra @copy ; No, so start copying the character. ;@isdelm2: diff --git a/programs/sub-suite/libc.s b/programs/sub-suite/libc.s index bd55f9c..d13d983 100644 --- a/programs/sub-suite/libc.s +++ b/programs/sub-suite/libc.s @@ -31,7 +31,7 @@ strtoull: lda.q sp+1 ; Get the value from the value buffer. mul sp+19 ; Multiply the value by the base. clc ; Prepare for a non carrying add. - aab ; Add the digit value to the total value. + adc b ; Add the digit value to the total value. sta.q sp+1 ; Place the value in the value buffer. iny ; Increment the string index. and #0 ; Reset A. @@ -96,7 +96,7 @@ strcasecmp: jsr tolower ; Convert the character of string 2 to lowercase. tab ; Place it in B. pla ; Get the character of string 1 back. - cab ; Is the character of both strings, the same? + cmp b ; Is the character of both strings, the same? plb ; Get the islong flag back. bne cmpr ; No, so check if we're too short, or too long. iny ; Yes, so increment the index. diff --git a/programs/sub-suite/subasm.s b/programs/sub-suite/subasm.s index 0a7640d..ec58a40 100644 --- a/programs/sub-suite/subasm.s +++ b/programs/sub-suite/subasm.s @@ -21,7 +21,7 @@ subasm: jsr set_ptr ; deb ; Reset B. tba ; Reset A. - lda f ; Get the command ID. + 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. @@ -55,12 +55,12 @@ chk_shcmd: @loop: ldb (ptr2), y ; Are we at the end of the table? beq @false ; Yes, so return that we failed. - cab ; No, so did the character match? + 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. bra @loop ; Keep looping. @found: - sty f ; Save the command ID. + 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. @@ -105,7 +105,7 @@ chk_cmd: bra @loop ; Keep looping. @true: ldb idx1 ; Get the command ID. - stb f ; Return the command ID. + stb regf ; Return the command ID. ldb #1 ; Return true. bra @end ; We are done. @false: diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s index 2282a72..fb3f3c4 100644 --- a/programs/sub-suite/subeditor.s +++ b/programs/sub-suite/subeditor.s @@ -117,7 +117,7 @@ print_str: tba ; Clear the Accumulator. @loop: ldb #1 ; Enable replace mode. - stb b ; + stb regb ; lda.q ptr ; Get the first pointer. cmp.q end ; Did the pointer change? bne @reset ; Yes, so set it back. @@ -133,7 +133,7 @@ print_str: bra @loop ; Keep looping. @end: ldb #0 ; Enable insert mode. - stb b ; + stb regb ; tba ; Reset A. rts ; End of print_str. @@ -159,7 +159,7 @@ getbt1: txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. ply.w ; Get the screen index back. - aba ; Mask out the bit of the current line number. + and b ; Mask out the bit of the current line number. cmp #1 ; Set the carry flag, if true. bra bitout ; We are done. @@ -175,7 +175,7 @@ clrbit: phy.w ; Save the screen index. txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. - aba ; Clear the bit of the current line number. + and b ; Clear the bit of the current line number. bitsav: sta (ptr2), y ; Update the wrap table. ply.w ; Get the screen index back. @@ -194,7 +194,7 @@ setbit: phy.w ; Save the screen index. txy ; Get the byte position. ldb (ptr2), y ; Get one byte of the wrap table. - oab ; Set the bit of the current line number. + ora b ; Set the bit of the current line number. bra bitsav ; Save the bit. bitpos: @@ -222,8 +222,8 @@ bitpos: handle_char: ldb #0 ; Reset the B register. - stb e ; Set the temporary row position to zero, in case we get a newline. - stb b ; Enable insert mode. + stb rege ; Set the temporary row position to zero, in case we get a newline. + stb regb ; Enable insert mode. pha ; Save the character. phy.w ; Save the cursor index. cmp #'\n' ; Was the character that was typed, a newline? @@ -232,16 +232,16 @@ handle_char: @print: ply.w ; Get back the cursor index. pla ; Get back the character. - ldb e ; Is the temporary row position non zero? + ldb rege ; Is the temporary row position non zero? bne @row ; Yes, so reset the row positon. @print1: jsr print_char ; No, so print the character. - lda a ; Get the return value. + lda rega ; Get the return value. cmp #'\n' ; Is the return value, a newline? beq @true ; Yes, so return true. bra @false ; No, so return false. @row: - ldb e ; Get the temporary row position. + ldb rege ; Get the temporary row position. cpb #maxrow ; Is temporary row position, at, or above the bottom of the screen? beq @row2 ; Yes, so leave it as is. bcs @row1 ; No, so set it to the bottom of the screen. @@ -272,7 +272,7 @@ cmd_cpy: clc ; Clear the carry flag, so that nothing odd occurs. @start: sta scr_row ; Set the row position to the end of the line. - sta e ; Save it into the temporary row posiition. + sta rege ; Save it into the temporary row posiition. jsr findst ; Find the start of the line. clc ; Clear the carry flag. lda scr_row ; Get the row position. @@ -302,12 +302,12 @@ cmd_cpy: 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. + stb regg ; Save the byte count. tab ; Save the string buffer. and #$FF ; Is this byte of the buffer, a null terminator? beq @end1 ; Yes, so we're done. tba ; No so get back the string buffer. - ldb g ; Get back the byte count. + ldb regg ; Get back the byte count. cpb #7 ; Did we shift in eight bytes? beq @loop ; Yes, so get eight more bytes. bra @loop1 ; No, so keep shifting in more bytes. @@ -365,13 +365,13 @@ findend: print_char: - sta a ; Save the typed character for now. + sta rega ; 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. jsr set_ptr ; ldb #0 ; Set B to zero. tba ; Set the Accumulator to zero. - lda a ; Get back the character. + lda rega ; Get back the character. cmp #$1B ; Did the user type an escape character? beq esc ; Yes, so go check the escape code. cmp #'\n' ; No, but did the user type a newline? @@ -388,10 +388,10 @@ print_char: beq bs ; Yes, so treat it as a backspace. printc: lda #0 ; No, so start trying to print a character. - sta d ; + sta regd ; lda (ptr3), y ; Are we at the end of the string? beq @save ; Yes, so just print the character. - lda b ; No, but was the flag set? + lda regb ; No, but was the flag set? 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. @@ -401,19 +401,19 @@ printc: sta scr_tcol ; @update1: jsr findend ; Find the end of the line. - sta e ; Use it for redrawing the line. + sta rege ; 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. @update2: - sta f ; Set the starting line, to the start of the line. + sta regf ; 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. sta scr_row ; lda scr_tcol ; Get the real column position back. sta scr_col ; jsr update_pos ; Update the cursor's position. - dec d ; + dec regd ; bra @save1 ; @shift: ldy.w scr_ptr3 ; @@ -421,33 +421,33 @@ printc: tyx ; dey ; ldb #1 ; - stb d ; + stb regd ; jsr shftln ; ldb #1 ; - stb d ; - lda a ; + stb regd ; + lda rega ; sta (ptr3), y ; store typed character into the input buffer. lda scr_row ; sta scr_trow ; bra @update ; @save: - ldb d ; + ldb regd ; bne @update ; @save1: - lda a ; + lda rega ; sta (ptr3), y ; store typed character into the input buffer. @incr: inc scr_col ; Increment the cursor's x coordinate. iny ; @wrapped: ldb #1 ; - stb f ; + stb regf ; ldb scr_col ; cpb #maxcol+1 ; bcs @scrolled ; @print: sta scr ; Echo typed character. - ldb f ; + ldb regf ; beq @wrap ; bra printc_end ; @scrolled: @@ -456,7 +456,7 @@ printc: bcs @scroll ; @wrapped2: ldb #0 ; - stb f ; + stb regf ; bra @print ; @scroll: sta scr ; Echo typed character. @@ -501,7 +501,7 @@ nl: jsr update_pos ; Update the cursor's position. @end: lda #'\n' ; Print the newline. - sta a ; + sta rega ; rts ; @@ -580,8 +580,8 @@ bs: jsr update_pos ; Update the cursor's position. back: ldb #0 ; Reset B, and some flags. - stb e ; - stb f ; + stb rege ; + stb regf ; lda scr_row ; Save the current row position for later. sta scr_trow ; jsr findend ; Find the end of the line. @@ -599,15 +599,15 @@ back: tyx ; Copy the current cursor index to X. iny ; Increment cursor index. ldb #0 ; Set shifting direction to left. - stb d ; + stb regd ; 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? + lda rege ; Are we updating more than one line? 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. + sta rege ; Set the end parameter to it. lda scr_col ; Save the current column position for now. sta scr_tcol ; jsr rdrw_ln ; Start redrawing the line. @@ -621,13 +621,13 @@ back: rts ; We are done. @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. + sta regf ; + inc rege ; Set the redraw flag to true. bra @shift ; Start shifting the line back. shftln: - ldb d ; Is the flag not set? + ldb regd ; Is the flag not set? beq @dec_loop ; Yes, so shift, and decrement. ldb #0 ; Clear the B register. bra @inc_loop ; No, so shift, and increment. @@ -680,14 +680,14 @@ shftln: sta (ptr3), y ; @end1: jsr findend ; Find the ending line. - sta d ; Save ending line for later. + sta regd ; Save ending line for later. lda (ptr3), y ; Is this character a space? cmp #$20 ; bne @end5 ; No, so skip the conversion. lda #0 ; Yes, so convert it back to zero. sta (ptr3), y ; @end2: - lda d ; Get the ending line. + lda regd ; Get the ending line. cmp scr_row ; Is the ending line greater than the starting line? beq @end5 ; No, so we're done. bcs @wrap ; Yes, so set the wrap bit. @@ -712,23 +712,23 @@ esc: lda status ; No, so wait for the next character. beq @end ; We have an error, so discard it, and go back to getting user input. lda kbd ; Get the escape code. - sta c ; Store the escape code, until we need it. + sta regc ; Store the escape code, until we need it. lda #0 ; Set the D pseudo register to zero. - sta d ; + sta regd ; jsr isup ; Check if the user pressed up. - lda d ; Did the user press up? + lda regd ; Did the user press up? bne @end ; Yes, so we're done. jsr isdown ; No, so check if the user pressed down. - lda d ; Did the user press down? + lda regd ; Did the user press down? bne @end ; Yes, so we're done. lda #0 ; No, so check if the user pressed left. jsr isleft ; - lda d ; Did the user press left? + lda regd ; Did the user press left? bne @end ; Yes, so we're done. jsr isright ; No, so check if the user pressed right. @end: lda #0 ; Clear the D pseudo register. - sta d ; + sta regd ; rts ; We are done. shftesc: @@ -737,27 +737,27 @@ shftesc: lda status ; Wait for the next character. beq @end ; We have an error, so discard it, and go back to getting user input. lda kbd ; Get the escape code. - sta c ; Store the escape code, until we need it. + sta regc ; Store the escape code, until we need it. lda #0 ; Use the D pseudo register as a skip flag. - sta d ; + sta regd ; jsr isshftup ; Check if the user pressed shift+up. - lda d ; Was it successful? + lda regd ; Was it successful? bne @end ; Yes, so we're done. jsr isshftdown ; No, so check if the user pressed shift+down. @end: lda #0 ; Clear the D pseudo register. - sta d ; + sta regd ; rts ; We are done. isup: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'A' ; Did the user press the up arrow key? bne @end ; No, so we're done. lda scr_row ; Yes, but is the cursor at the top of the screen? beq @scroll ; Yes, so check if we need to scroll. @check2: - lda c ; No, so load the escape code back into the accumulator. + lda regc ; 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. bra @end ; No, so we're done. @@ -765,26 +765,26 @@ isup: dec scr_row ; Move the cursor up a line. jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. - sta d ; + sta regd ; rts ; We are done. @scroll: lda scr_str ; Are we at the top of the screen buffer? 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 ; + sta regd ; @end: rts ; End of isup. isdown: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'B' ; Did the user press the down arrow key? 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 @scroll ; Yes, so scroll down. - lda c ; No, so load the escape code back into the accumulator. + lda regc ; 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. bra @end ; No, so we're done. @@ -792,7 +792,7 @@ isdown: inc scr_row ; Move the cursor down a line. jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. - sta d ; + sta regd ; rts ; We are done. @scroll: lda scr_row ; Save the cursor's row number. @@ -805,13 +805,13 @@ isdown: lda scr_tcol ; Load the cursor's column number. sta scr_col ; lda #1 ; Tell the escape routine that we were successful. - sta d ; + sta regd ; @end: rts ; End of isdown. isright: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'C' ; Did the user press the right arrow key? bne @end2 ; No, so we're done. lda scr_col ; Yes, so start checking the x coordinate of the cursor. @@ -854,12 +854,12 @@ isright: isleft: - lda c ; Load the escape code into the accumulator. + lda regc ; Load the escape code into the accumulator. cmp #'C' ; Did the user press right? beq @end1 ; Yes, so we're done lda scr_col ; No, but is the cursor at the far left of the screen? beq @wrap ; Yes, so start checking if this is a wrapped line. - lda c ; No, so load the escape code back into the accumulator. + lda regc ; 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. bra @end1 ; No, so we're done. @@ -877,7 +877,7 @@ isleft: 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 ; + sta regd ; lda scr_row ; Are we at the top of the screen? beq @scroll ; Yes, so check if we need to scroll. bra @end ; No, so we're done. @@ -892,7 +892,7 @@ isleft: dec scr_col ; Move the cursor left a character. jsr update_pos ; Update it's position. lda #1 ; Tell the escape routine that we succeded. - sta d ; + sta regd ; rts ; We are done @end: jsr update_pos ; Update the cursor position. @@ -903,34 +903,34 @@ isleft: isshftup: - lda c ; Load the escape code back into the accumulator. + lda regc ; Load the escape code back into the accumulator. cmp #'A' ; Did the user press the up arrow key? bne @end ; lda #1 ; - sta d ; + sta regd ; lda scr_str ; beq @end ; @shftup: jsr scrl_up ; lda #1 ; - sta d ; + sta regd ; @end: rts ; isshftdown: - lda c ; Load the escape code back into the accumulator. + lda regc ; Load the escape code back into the accumulator. cmp #'B' ; Did the user press the down arrow key? bne @end ; lda #1 ; - sta d ; + sta regd ; lda scr_end ; cmp #71 ; bcs @end ; @shftdown: jsr scrl_down ; lda #1 ; - sta d ; + sta regd ; @end: rts ; @@ -948,7 +948,7 @@ update_ptr: update_pos: ldb #1 ; Set the F pseudo register to one, to fix some bugs. - stb f ; + stb regf ; jsr update_ptr ; Update the screen buffer index. tay ; Place the index into the Y register. tba ; Reset A. @@ -1070,14 +1070,14 @@ rdrw_row: rdrw_ln: lda scr_row ; pha ; - lda f ; + lda regf ; sta scr_row ; lda scr_col ; pha ; jsr update_pos ; @loop: lda scr_row ; - cmp e ; + cmp rege ; beq @loop1 ; bcs @end ; @loop1: @@ -1092,8 +1092,8 @@ rdrw_ln: sta scr_row ; jsr update_pos ; lda #0 ; - sta e ; - sta f ; + sta rege ; + sta regf ; rts ; diff --git a/programs/sub-suite/subsuite.s b/programs/sub-suite/subsuite.s index 36ac541..d425550 100644 --- a/programs/sub-suite/subsuite.s +++ b/programs/sub-suite/subsuite.s @@ -18,5 +18,7 @@ .qword reset a ;l a +;.org reset +;v ;q d diff --git a/programs/sub-suite/utils.s b/programs/sub-suite/utils.s index 046164a..3ab948b 100644 --- a/programs/sub-suite/utils.s +++ b/programs/sub-suite/utils.s @@ -176,7 +176,7 @@ isdelm2: @loop: ldb dtab2, x ; Get the compare value. beq @other ; We hit the end of the table, so check for the others. - cab ; Are they the same? + cmp b ; Are they the same? beq @r1 ; Yes, so return 1. inx ; No, so increment the table index. bra @loop ; Keep looping. @@ -202,11 +202,11 @@ isdelm2: isdelm: ldx #0 ; Reset X. - stx a ; Reset the shift value. + stx rega ; Reset the shift value. @loop: ldb dtab, x ; Get the compare value. beq @other ; We hit the end of the table, so check for the others. - cab ; Are they the same? + cmp b ; Are they the same? beq @rshft ; Yes, so return 1 << index. inx ; No, so increment the table index. bra @loop ; Keep looping. @@ -222,10 +222,10 @@ isdelm: lda #0 ; Return 0. rts ; End of isdelm. @rshft: - stx a ; Save the shift value. + stx rega ; Save the shift value. ldx #0 ; Reset X. lda #1 ; Set up the bitshift. - lsl a ; Return 1 << X. + lsl rega ; Return 1 << X. rts ; End of isdelm. @@ -235,7 +235,7 @@ get_ptok: @loop: ldb ptok_tab, x ; Get the compare value. beq @other ; We hit the end of the table, so check for the others. - cab ; Are they the same? + cmp b ; Are they the same? beq @rtab ; Yes, so return X. inx ; No, so increment the table index. bra @loop ; Keep looping. |