fix(buzbee): formatting, typos, unrolling, and stack fixes
This commit is contained in:
49
src/buzbee.s
49
src/buzbee.s
@@ -143,24 +143,22 @@ PBYTE
|
|||||||
asra
|
asra
|
||||||
asra
|
asra
|
||||||
asra
|
asra
|
||||||
bsr NYB2HEX ; Print A
|
|
||||||
jsr POUTCHAR
|
|
||||||
tfr b,a ; Print B next
|
|
||||||
bsr NYB2HEX ; Print B
|
|
||||||
jsr POUTCHAR
|
|
||||||
puls b
|
|
||||||
rts
|
|
||||||
|
|
||||||
; Converts a nybble into a valid hex digit
|
|
||||||
; @param A: nybble to convert to a char
|
|
||||||
; @return A: resulting char
|
|
||||||
NYB2HEX
|
|
||||||
anda #$0F
|
anda #$0F
|
||||||
ora #'0 ; Add "0"
|
ora #'0 ; Add '0' to offset to digits
|
||||||
cmpa #$3A ; ":" "9"+1
|
cmpa #$3A ; Hex? ':' '9'+1
|
||||||
blo SKIP@
|
blo SKIPA@
|
||||||
adca #6 ; Add offset to "A" in ascii
|
adca #6 ; Hex offset
|
||||||
SKIP@
|
SKIPA@
|
||||||
|
jsr POUTCHAR ; Print char in A
|
||||||
|
andb #$0F
|
||||||
|
orb #'0 ; Add '0' to offset to digits
|
||||||
|
cmpb #$3A ; Hex? ':' '9'+1
|
||||||
|
blo SKIPB@
|
||||||
|
adcb #6 ; Hex offset
|
||||||
|
SKIPB@
|
||||||
|
tfr b,a ; Print char in B
|
||||||
|
jsr POUTCHAR
|
||||||
|
puls b ; Restore B
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Converts a hexadecimal sequence into a byte value
|
; Converts a hexadecimal sequence into a byte value
|
||||||
@@ -204,18 +202,20 @@ BADHEX@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
; Makes a hash of four chars in BBIN starting at offset X
|
; Makes a hash of four chars in BBIN starting at offset X
|
||||||
; @param X: offset in BBIN to read the four chars from
|
; @param Y: offset in BBIN to read the four chars from
|
||||||
; @return A: resulting hash
|
; @return A: resulting hash
|
||||||
|
; @return Y: offset after hash processing
|
||||||
MKCMDSUM
|
MKCMDSUM
|
||||||
pshs b
|
pshs b
|
||||||
ldb #4 ; Loop over four chars
|
ldb #4 ; Loop over four chars
|
||||||
clra ; Initialize accumulator
|
clra ; Initialize accumulator
|
||||||
NEXTC@
|
NEXTC@
|
||||||
suba BBVAR.input,x ; Subtract current char from accumulator
|
suba BBVAR.input,y ; Subtract current char from accumulator
|
||||||
leax 1,x ; Next char
|
leax 1,y ; Next char
|
||||||
decb ; Reduce count
|
decb ; Reduce count
|
||||||
cmpb #0 ; Are we at the end?
|
cmpb #0 ; Are we at the end?
|
||||||
bne NEXTC@ ; No? loop
|
bne NEXTC@ ; No? loop
|
||||||
|
puls b
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Skips "whitespace" to the next semantic char
|
; Skips "whitespace" to the next semantic char
|
||||||
@@ -257,12 +257,12 @@ CALCPTR@
|
|||||||
tfr x,d ; Swap into d to do a cheap multiply
|
tfr x,d ; Swap into d to do a cheap multiply
|
||||||
asld ; Cheaply << to get *2, pointer size
|
asld ; Cheaply << to get *2, pointer size
|
||||||
tfr d,x ; Restore x from d and jump to function at index
|
tfr d,x ; Restore x from d and jump to function at index
|
||||||
jmp [BBCMDPTRTBL,x]
|
jmp [IFPTRTBL,x]
|
||||||
NOTOK@
|
NOTOK@
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; IF pointer table
|
; IF pointer table
|
||||||
BBCMDPTRTBL
|
IFPTRTBL
|
||||||
fdb IFCALL
|
fdb IFCALL
|
||||||
fdb IFHELP
|
fdb IFHELP
|
||||||
fdb IFPEEK
|
fdb IFPEEK
|
||||||
@@ -388,5 +388,8 @@ EM_TOKFAIL
|
|||||||
fcc "!!! Tokenization Failure !!!"
|
fcc "!!! Tokenization Failure !!!"
|
||||||
fcb $0D,$0A,$00
|
fcb $0D,$0A,$00
|
||||||
EM_BADHEX
|
EM_BADHEX
|
||||||
fcc "!!! Maleformed Hex Value !!!"
|
fcc "!!! Malformed Hex Value !!!"
|
||||||
|
fcb $0D,$0A,$00
|
||||||
|
EM_FULLTOKBUF
|
||||||
|
fcc "!!! Token Buffer Overrun !!!"
|
||||||
fcb $0D,$0A,$00
|
fcb $0D,$0A,$00
|
||||||
|
Reference in New Issue
Block a user