mirror of
https://github.com/digarok/MiniMemoryTester.git
synced 2025-03-12 05:32:54 +00:00
cleanup pre-menu
This commit is contained in:
parent
64992ae08d
commit
0fa69cf098
190
src/mt.s
190
src/mt.s
@ -34,20 +34,23 @@ QuitParm dfb 4 ; number of parameters
|
|||||||
|
|
||||||
Error brk $00 ; shouldn't be here either
|
Error brk $00 ; shouldn't be here either
|
||||||
GetStartBank
|
GetStartBank
|
||||||
lda #13
|
ldx #13
|
||||||
sta $24
|
ldy #10
|
||||||
lda #10
|
jsr GoXY
|
||||||
sta $25
|
lda #2
|
||||||
jsr VTAB
|
ldx #>StartBank
|
||||||
lda #"$"
|
ldy #StartBank
|
||||||
sta $33
|
|
||||||
jsr GetHex
|
jsr GetHex
|
||||||
jsr RDKEY
|
brk $99
|
||||||
jsr PRBYTE
|
lda StartBank
|
||||||
rts
|
rts
|
||||||
|
|
||||||
* Pass desired length in A
|
* Pass desired length in A
|
||||||
GetHex sta _gethex_maxlen
|
GetHex sta _gethex_maxlen
|
||||||
|
stx _gethex_resultptr
|
||||||
|
sty _gethex_resultptr+1
|
||||||
|
stz _gethex_current
|
||||||
|
|
||||||
:input jsr RDKEY
|
:input jsr RDKEY
|
||||||
cmp #"9"+1
|
cmp #"9"+1
|
||||||
bcs :notNum ;bge > 9
|
bcs :notNum ;bge > 9
|
||||||
@ -55,7 +58,7 @@ GetHex sta _gethex_maxlen
|
|||||||
bcc :badChar ;
|
bcc :badChar ;
|
||||||
sec
|
sec
|
||||||
sbc #"0"
|
sbc #"0"
|
||||||
bra :gotHex
|
bra :storeInput
|
||||||
:notNum cmp #"a"
|
:notNum cmp #"a"
|
||||||
bcc :notLower
|
bcc :notLower
|
||||||
sec
|
sec
|
||||||
@ -64,73 +67,147 @@ GetHex sta _gethex_maxlen
|
|||||||
bcc :badChar
|
bcc :badChar
|
||||||
cmp #"F"+1
|
cmp #"F"+1
|
||||||
bcs :badChar
|
bcs :badChar
|
||||||
:gotHex jsr PRHEX
|
:gotHex
|
||||||
|
sec
|
||||||
|
sbc #"A"-10
|
||||||
|
:storeInput
|
||||||
|
jsr PRHEX
|
||||||
|
ldy _gethex_current
|
||||||
|
sta _gethex_buffer,y
|
||||||
|
iny
|
||||||
|
cpy #_gethex_internalmax
|
||||||
|
bge :internalmax
|
||||||
|
cpy _gethex_maxlen
|
||||||
|
bge :passedmax
|
||||||
|
sty _gethex_current
|
||||||
|
bra :input
|
||||||
|
:internalmax
|
||||||
|
:passedmax
|
||||||
|
lda _gethex_resultptr
|
||||||
|
sta $0
|
||||||
|
lda _gethex_resultptr+1
|
||||||
|
sta $1
|
||||||
|
ldx #0
|
||||||
|
ldy #0
|
||||||
|
:copyBuffer lda _gethex_buffer,x
|
||||||
|
asl ; move to upper nibble
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
sta ($0),y ; store
|
||||||
|
inx
|
||||||
|
lda _gethex_buffer,x
|
||||||
|
ora ($0),y
|
||||||
|
sta ($0),y
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
cpx _gethex_maxlen
|
||||||
|
bcc :copyBuffer
|
||||||
rts
|
rts
|
||||||
|
|
||||||
:badChar bra :input
|
:badChar bra :input
|
||||||
|
|
||||||
|
_gethex_internalmax equ 8
|
||||||
|
_gethex_resultptr da 0000
|
||||||
_gethex_maxlen db 1
|
_gethex_maxlen db 1
|
||||||
|
_gethex_current db 0
|
||||||
|
_gethex_buffer ds _gethex_internalmax
|
||||||
|
PrHexChar jsr HexCharForByte
|
||||||
|
|
||||||
GetThing lda #13
|
HexCharForByte
|
||||||
sta $24
|
cmp #9
|
||||||
lda #10
|
bcs :alpha
|
||||||
sta $25
|
:number clc
|
||||||
jsr VTAB
|
adc #"0"
|
||||||
|
rts
|
||||||
|
:alpha clc
|
||||||
|
adc #"A"
|
||||||
|
rts
|
||||||
|
|
||||||
|
GetThing ldx #13
|
||||||
|
ldy #10
|
||||||
|
jsr GoXY
|
||||||
lda #"$"
|
lda #"$"
|
||||||
sta $33
|
sta $33
|
||||||
jsr GETLN
|
jsr GETLN
|
||||||
rts
|
rts
|
||||||
|
|
||||||
DrawMenu jsr HOME
|
DrawMenu jsr HOME
|
||||||
lda #MenuStrs
|
lda #MainMenuStrs
|
||||||
ldy #>MenuStrs
|
ldy #>MainMenuStrs
|
||||||
ldx #05 ; horiz pos
|
ldx #05 ; horiz pos
|
||||||
jsr PrintStringsX
|
jsr PrintStringsX
|
||||||
|
lda #MainMenuDefs
|
||||||
|
ldy #>MainMenuDefs
|
||||||
|
jsr DrawMenuOptions
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; lda #MenuStr1
|
BeginTest brk $ff
|
||||||
; ldy #>MenuStr1
|
|
||||||
; jsr PrintString
|
|
||||||
|
|
||||||
PrintStringsX stx _printstringsx_horiz ; IGNORED! 4 NOW!
|
* x=x y=y a=len
|
||||||
|
MenuHighlight
|
||||||
|
|
||||||
sta $0
|
* DEFAULTS
|
||||||
|
StartBank db #$02
|
||||||
|
EndBank db #$7F
|
||||||
|
StartAddr dw #$0000
|
||||||
|
EndAddr dw #$FFFF
|
||||||
|
TestValue dw #$00
|
||||||
|
|
||||||
|
DrawMenuOptions sta $0
|
||||||
sty $1
|
sty $1
|
||||||
:loop lda $0 ; slower, but allows API reuse
|
stz _menuOptionPtr
|
||||||
ldy $1
|
:drawOption
|
||||||
jsr PrintString ; y is last val
|
ldy _menuOptionPtr
|
||||||
|
lda ($0),y
|
||||||
|
tax
|
||||||
|
lda ($0),y
|
||||||
|
tay
|
||||||
|
jsr GoXY
|
||||||
|
ldy _menuOptionPtr
|
||||||
|
iny
|
||||||
|
iny
|
||||||
iny
|
iny
|
||||||
lda ($0),y
|
lda ($0),y
|
||||||
beq :done
|
beq :charItem
|
||||||
tya ; not done so add strlen to source ptr
|
cmp #1
|
||||||
clc
|
beq :hexItem
|
||||||
adc $0
|
cmp #2
|
||||||
sta $0
|
beq :jsrItem
|
||||||
bcc :nocarry
|
:charItem
|
||||||
inc $1
|
:hexItem
|
||||||
:nocarry bra :loop
|
:jsrItem
|
||||||
|
rts
|
||||||
|
|
||||||
:done rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_printstringsx_horiz db 00
|
_menuOptionPtr dw 00
|
||||||
|
MainMenuDefs
|
||||||
|
Menu_StartBank hex 10,10 ; x,y
|
||||||
|
hex 01,01 ; memory size (bytes), 0=char/1=hex input
|
||||||
|
da StartBank ; variable storage
|
||||||
|
|
||||||
* PrintString (A=Low Byte, Y=High Byte)
|
Menu_EndBank hex 10,11 ; x,y
|
||||||
PrintString sta $0
|
hex 01,01 ; memory size (bytes), 0=char/1=hex input
|
||||||
sty $1
|
da EndBank ; variable storage
|
||||||
|
Menu_StartAddr hex 10,13 ; x,y
|
||||||
|
hex 02,01 ; memory size (bytes), 0=char/1=hex input
|
||||||
|
da StartAddr ; variable storage
|
||||||
|
Menu_EndAddr hex 10,14 ; x,y
|
||||||
|
hex 02,01 ; memory size (bytes), 0=char/1=hex input
|
||||||
|
da EndAddr ; variable storage
|
||||||
|
Menu_BeginTest hex 12,15 ; x,y
|
||||||
|
db MenuStr_BeginTestL ; menu string length
|
||||||
|
db 02 ; memory size (bytes), 2=Menu JSR
|
||||||
|
da MenuStr_BeginTest ; string storage
|
||||||
|
|
||||||
ldy #0
|
|
||||||
:loop lda ($0),y
|
|
||||||
beq :done
|
|
||||||
jsr COUT
|
|
||||||
iny
|
|
||||||
bra :loop
|
|
||||||
:done rts
|
|
||||||
|
|
||||||
MenuStrs
|
|
||||||
|
MenuStr_JSR da BeginTest ; MUST PRECEDE MENU STRING! Yes, it's magicly inferred. (-2)
|
||||||
|
MenuStr_BeginTest asc "BEGIN TEST"
|
||||||
|
MenuStr_BeginTestL equ #*-MenuStr_BeginTest
|
||||||
|
|
||||||
|
MainMenuStrs
|
||||||
asc " *********************** ",$8D,$00
|
asc " *********************** ",$8D,$00
|
||||||
asc " ** **",$8D,$00
|
asc " ** **",$8D,$00
|
||||||
asc " ** Mini Memory Tester **",$8D,$00
|
asc " ** Mini Memory Tester **",$8D,$00
|
||||||
@ -143,8 +220,10 @@ MenuStrs
|
|||||||
asc " End BANK: ",$8D,$8D,$00
|
asc " End BANK: ",$8D,$8D,$00
|
||||||
asc " Start ADDR: ",$8D,$00
|
asc " Start ADDR: ",$8D,$00
|
||||||
asc " End ADDR: ",$8D,$8D,$8D,$00
|
asc " End ADDR: ",$8D,$8D,$8D,$00
|
||||||
asc " Test Byte: (Leave empty = random)",$8D,00
|
asc " Test Byte: (Leave empty = random)",$8D,$8D,$8D,$00
|
||||||
|
asc " USE ARROW KEYS TO MOVE",8D,$00
|
||||||
|
asc " USE ENTER TO SELECT/EDIT",$8D,$00
|
||||||
|
|
||||||
hex 00,00
|
hex 00,00
|
||||||
|
|
||||||
|
|
||||||
@ -156,10 +235,5 @@ WaitKey
|
|||||||
sta STROBE
|
sta STROBE
|
||||||
rts
|
rts
|
||||||
|
|
||||||
* DEFAULTS
|
put strings.s
|
||||||
StartBank db #$02
|
|
||||||
EndBank db #$7F
|
|
||||||
StartAddr dw #$0000
|
|
||||||
EndAddr dw #$FFFF
|
|
||||||
TestValue dw #$00
|
|
||||||
|
|
||||||
|
47
src/strings.s
Normal file
47
src/strings.s
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
* GoXY
|
||||||
|
* PrintStringsX
|
||||||
|
* PrintString
|
||||||
|
|
||||||
|
|
||||||
|
GoXY stx $24
|
||||||
|
sty $25
|
||||||
|
jsr VTAB
|
||||||
|
rts
|
||||||
|
|
||||||
|
PrintStringsX stx _printstringsx_horiz ; IGNORED! 4 NOW!
|
||||||
|
|
||||||
|
sta $0
|
||||||
|
sty $1
|
||||||
|
:loop lda $0 ; slower, but allows API reuse
|
||||||
|
ldy $1
|
||||||
|
jsr PrintString ; y is last val
|
||||||
|
iny
|
||||||
|
lda ($0),y
|
||||||
|
beq :done
|
||||||
|
tya ; not done so add strlen to source ptr
|
||||||
|
clc
|
||||||
|
adc $0
|
||||||
|
sta $0
|
||||||
|
bcc :nocarry
|
||||||
|
inc $1
|
||||||
|
:nocarry bra :loop
|
||||||
|
|
||||||
|
|
||||||
|
:done rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_printstringsx_horiz db 00
|
||||||
|
|
||||||
|
* PrintString (A=Low Byte, Y=High Byte)
|
||||||
|
PrintString sta $0
|
||||||
|
sty $1
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
:loop lda ($0),y
|
||||||
|
beq :done
|
||||||
|
jsr COUT
|
||||||
|
iny
|
||||||
|
bra :loop
|
||||||
|
:done rts
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user