feat(buzbee): using BSS sections for variables
This commit is contained in:
@@ -5,16 +5,3 @@
|
|||||||
; vim: ft=asm
|
; vim: ft=asm
|
||||||
|
|
||||||
BUZBEE IMPORT
|
BUZBEE IMPORT
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;;
|
|
||||||
;; BUZBEE Variables
|
|
||||||
;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
BBIN_BASE EQU $0200
|
|
||||||
BBIN_DEPTH EQU $7F
|
|
||||||
BBTOKENS_BASE EQU $0280
|
|
||||||
BBTOKENS_DEPTH EQU $3F
|
|
||||||
BBTOKENS_CCH EQU $02C0
|
|
||||||
|
|
||||||
|
41
src/buzbee.s
41
src/buzbee.s
@@ -7,6 +7,26 @@
|
|||||||
INCLUDE "hardware.inc"
|
INCLUDE "hardware.inc"
|
||||||
INCLUDE "serial.inc"
|
INCLUDE "serial.inc"
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;
|
||||||
|
;; BUZBEE Variables
|
||||||
|
;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
BBIN_DEPTH EQU $7F
|
||||||
|
BBTOKENS_DEPTH EQU $3F
|
||||||
|
|
||||||
|
SECTION BBVARS,bss
|
||||||
|
|
||||||
|
tagbbvar STRUCT
|
||||||
|
input rmb BBIN_DEPTH ; Input buffer
|
||||||
|
tokens rmb BBTOKENS_DEPTH ; Token buffer
|
||||||
|
cbtokens rmb 2
|
||||||
|
ENDSTRUCT
|
||||||
|
|
||||||
|
ORG $0200
|
||||||
|
BBVAR tagbbvar
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; BUZBEE Machine Language Monitor for CHIBI PC-09
|
;; BUZBEE Machine Language Monitor for CHIBI PC-09
|
||||||
@@ -39,7 +59,7 @@ CLRIN ; Label to just clear input buffer without newline
|
|||||||
clra ; Init A and X
|
clra ; Init A and X
|
||||||
ldx #$0000
|
ldx #$0000
|
||||||
NEXT@
|
NEXT@
|
||||||
sta BBIN_BASE,x ; Clear input buffer
|
sta BBVAR.input,x ; Clear input buffer
|
||||||
leax 1,x
|
leax 1,x
|
||||||
cmpx #BBIN_DEPTH
|
cmpx #BBIN_DEPTH
|
||||||
blo NEXT@
|
blo NEXT@
|
||||||
@@ -64,7 +84,7 @@ INPLOOP
|
|||||||
beq FULLBUF@ ; Handle the buffer being full
|
beq FULLBUF@ ; Handle the buffer being full
|
||||||
ECHO@
|
ECHO@
|
||||||
jsr POUTCHAR ; Echo char back, this includes BS chars
|
jsr POUTCHAR ; Echo char back, this includes BS chars
|
||||||
sta BBIN_BASE,y ; Add it to the input buffer
|
sta BBVAR.input,y ; Add it to the input buffer
|
||||||
leay 1,y
|
leay 1,y
|
||||||
NOCHAR@
|
NOCHAR@
|
||||||
; Check for error condition, work based on The Serial Port release 19
|
; Check for error condition, work based on The Serial Port release 19
|
||||||
@@ -96,7 +116,7 @@ HESC@
|
|||||||
HBACKSPC@
|
HBACKSPC@
|
||||||
clrb ; Clear last char
|
clrb ; Clear last char
|
||||||
leay -1,y
|
leay -1,y
|
||||||
stb BBIN_BASE
|
stb BBVAR.input
|
||||||
bra ECHO@ ; Echo the char in A
|
bra ECHO@ ; Echo the char in A
|
||||||
FULLBUF@
|
FULLBUF@
|
||||||
lda #$07 ; ASCII BEL
|
lda #$07 ; ASCII BEL
|
||||||
@@ -114,14 +134,14 @@ FULLBUF@
|
|||||||
; @return A: resulting hash
|
; @return A: resulting hash
|
||||||
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 BBIN_BASE,x ; Subtract current char from accumulator
|
suba BBVAR.input,x ; Subtract current char from accumulator
|
||||||
leax 1,x ; Next char
|
leax 1,x ; 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
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Maps a command hash to a command index, and executes it
|
; Maps a command hash to a command index, and executes it
|
||||||
@@ -184,6 +204,7 @@ HELP_MSG
|
|||||||
fcc "POKE <ADDR> <BYTES> - Overwrite memory with <BYTES> starting at <BASE>."
|
fcc "POKE <ADDR> <BYTES> - Overwrite memory with <BYTES> starting at <BASE>."
|
||||||
fcb $0D,$0A
|
fcb $0D,$0A
|
||||||
fcc "SREC - Enter Motorola S-Record entry mode."
|
fcc "SREC - Enter Motorola S-Record entry mode."
|
||||||
|
fcb $0D,$0A
|
||||||
fcb $00
|
fcb $00
|
||||||
|
|
||||||
BBCMDPTRTBL
|
BBCMDPTRTBL
|
||||||
|
Reference in New Issue
Block a user