feat(buzbee): using BSS sections for variables
This commit is contained in:
@@ -5,16 +5,3 @@
|
||||
; vim: ft=asm
|
||||
|
||||
BUZBEE IMPORT
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; BUZBEE Variables
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
BBIN_BASE EQU $0200
|
||||
BBIN_DEPTH EQU $7F
|
||||
BBTOKENS_BASE EQU $0280
|
||||
BBTOKENS_DEPTH EQU $3F
|
||||
BBTOKENS_CCH EQU $02C0
|
||||
|
||||
|
29
src/buzbee.s
29
src/buzbee.s
@@ -7,6 +7,26 @@
|
||||
INCLUDE "hardware.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
|
||||
@@ -39,7 +59,7 @@ CLRIN ; Label to just clear input buffer without newline
|
||||
clra ; Init A and X
|
||||
ldx #$0000
|
||||
NEXT@
|
||||
sta BBIN_BASE,x ; Clear input buffer
|
||||
sta BBVAR.input,x ; Clear input buffer
|
||||
leax 1,x
|
||||
cmpx #BBIN_DEPTH
|
||||
blo NEXT@
|
||||
@@ -64,7 +84,7 @@ INPLOOP
|
||||
beq FULLBUF@ ; Handle the buffer being full
|
||||
ECHO@
|
||||
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
|
||||
NOCHAR@
|
||||
; Check for error condition, work based on The Serial Port release 19
|
||||
@@ -96,7 +116,7 @@ HESC@
|
||||
HBACKSPC@
|
||||
clrb ; Clear last char
|
||||
leay -1,y
|
||||
stb BBIN_BASE
|
||||
stb BBVAR.input
|
||||
bra ECHO@ ; Echo the char in A
|
||||
FULLBUF@
|
||||
lda #$07 ; ASCII BEL
|
||||
@@ -117,7 +137,7 @@ MKCMDSUM
|
||||
ldb #4 ; Loop over four chars
|
||||
clra ; Initialize accumulator
|
||||
NEXTC@
|
||||
suba BBIN_BASE,x ; Subtract current char from accumulator
|
||||
suba BBVAR.input,x ; Subtract current char from accumulator
|
||||
leax 1,x ; Next char
|
||||
decb ; Reduce count
|
||||
cmpb #0 ; Are we at the end?
|
||||
@@ -184,6 +204,7 @@ HELP_MSG
|
||||
fcc "POKE <ADDR> <BYTES> - Overwrite memory with <BYTES> starting at <BASE>."
|
||||
fcb $0D,$0A
|
||||
fcc "SREC - Enter Motorola S-Record entry mode."
|
||||
fcb $0D,$0A
|
||||
fcb $00
|
||||
|
||||
BBCMDPTRTBL
|
||||
|
Reference in New Issue
Block a user