mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-12 14:30:29 +00:00
remove some self-modified values and use zero page instead
This commit is contained in:
parent
241a870eec
commit
c31d91ea60
@ -9,7 +9,7 @@
|
||||
; D000..E5F4 - persistent data structures (per-game cheat categories,
|
||||
; gGlobalPrefsStore, gGamesListStore)
|
||||
; ...unused...
|
||||
; EC28..FFF9 - main program code
|
||||
; EC31..FFF9 - main program code
|
||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||
;
|
||||
; LC RAM BANK 2
|
||||
@ -57,11 +57,14 @@ ROM_IN0 = $FE89 ; SETKBD
|
||||
ROM_PR0 = $FE93 ; SETVID
|
||||
|
||||
; zero page
|
||||
PARAM = $00 ; used by PARAMS_ON_STACK macro, so basically everywhere
|
||||
PTR = $02
|
||||
SRC = $04
|
||||
DEST = $06
|
||||
SAVE = $08
|
||||
PARAM = $00 ; word (used by PARAMS_ON_STACK macro, so basically everywhere)
|
||||
PTR = $02 ; word
|
||||
SRC = $04 ; word
|
||||
DEST = $06 ; word
|
||||
SAVE = $08 ; word
|
||||
KEYLEN = $0A ; byte
|
||||
VALUELEN = $0B ; byte
|
||||
MAX = $0C ; byte
|
||||
HTAB = $24
|
||||
VTAB = $25
|
||||
RNDSEED = $4E ; word
|
||||
|
@ -118,7 +118,7 @@ gGameToLaunch=*+1
|
||||
lda (SAVE), y
|
||||
tay
|
||||
iny
|
||||
sty @runlength+1
|
||||
sty MAX
|
||||
ldy #0
|
||||
lda #'X'
|
||||
sta ProDOS_prefix+1
|
||||
@ -127,8 +127,7 @@ gGameToLaunch=*+1
|
||||
sta ProDOS_prefix, x
|
||||
iny
|
||||
lda (SAVE), y
|
||||
@runlength
|
||||
cpy #$D1 ; SMC
|
||||
cpy MAX
|
||||
bne -
|
||||
txa
|
||||
plp
|
||||
|
35
src/okvs.a
35
src/okvs.a
@ -151,7 +151,7 @@ okvs_append
|
||||
lda (SRC),y
|
||||
clc
|
||||
adc #1
|
||||
sta @keylen
|
||||
sta KEYLEN
|
||||
tay
|
||||
- dey ; copy new key
|
||||
lda (SRC),y
|
||||
@ -161,8 +161,7 @@ okvs_append
|
||||
|
||||
lda PTR ; update PTR to byte after copied key
|
||||
clc
|
||||
@keylen=*+1
|
||||
adc #$FD ; SMC
|
||||
adc KEYLEN
|
||||
sta PTR
|
||||
bcc +
|
||||
inc PTR+1
|
||||
@ -176,7 +175,7 @@ okvs_append
|
||||
lda (SRC),y ; no max, use actual length instead
|
||||
clc
|
||||
adc #1
|
||||
+ sta @valuelen
|
||||
+ sta VALUELEN
|
||||
tay
|
||||
- dey
|
||||
lda (SRC),y
|
||||
@ -186,8 +185,7 @@ okvs_append
|
||||
|
||||
lda PTR
|
||||
clc
|
||||
@valuelen=*+1
|
||||
adc #$FD ; SMC
|
||||
adc VALUELEN
|
||||
sta SRC
|
||||
bcc +
|
||||
inc PTR+1
|
||||
@ -235,7 +233,7 @@ okvs_get
|
||||
; Y = 0
|
||||
lda (PTR),y ; A = number of keys in store
|
||||
beq @fail ; no keys, fail immediately
|
||||
sta @maxkeys
|
||||
sta MAX
|
||||
jsr incptr3
|
||||
; PTR -> first record
|
||||
ldx #0
|
||||
@ -245,7 +243,7 @@ okvs_get
|
||||
lda (SRC),y
|
||||
tay
|
||||
iny
|
||||
sty @matchlen
|
||||
sty KEYLEN
|
||||
@matchRecordLoop
|
||||
lda PTR+1
|
||||
sta DEST+1
|
||||
@ -261,12 +259,11 @@ okvs_get
|
||||
cmp (DEST),y
|
||||
bne @next
|
||||
iny
|
||||
@matchlen=*+1
|
||||
cpy #$FD ; SMC
|
||||
cpy KEYLEN
|
||||
bne @matchKeyLoop
|
||||
+LDAY PTR
|
||||
clc
|
||||
adc @matchlen
|
||||
adc KEYLEN
|
||||
bcc +
|
||||
iny
|
||||
+ clc
|
||||
@ -278,8 +275,7 @@ okvs_get
|
||||
+ rts
|
||||
@next jsr derefptr ; PTR -> next record
|
||||
inx
|
||||
@maxkeys=*+1
|
||||
cpx #$FD ; SMC
|
||||
cpx MAX
|
||||
bne @matchRecordLoop
|
||||
@fail sec
|
||||
rts
|
||||
@ -401,7 +397,8 @@ okvs_update
|
||||
; A/Y = address of key or value (depends on which entry point you call)
|
||||
; all registers are clobbered
|
||||
; all flags clobbered
|
||||
; $00/$01 clobbered
|
||||
; PARAM clobbered
|
||||
; PTR clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
okvs_iter
|
||||
lda #$D0 ; 'BNE' opcode
|
||||
@ -415,7 +412,7 @@ okvs_iter_values
|
||||
; Y = 0
|
||||
lda (PTR),y ; A = number of keys in store
|
||||
beq @exit ; no keys, exit immediately
|
||||
sta @max
|
||||
sta MAX
|
||||
+LDPARAM 3
|
||||
+STAY @callback
|
||||
jsr incptr3
|
||||
@ -429,7 +426,7 @@ okvs_iter_values
|
||||
lda (PTR),y ; A = length of key
|
||||
clc
|
||||
adc #3 ; skip over pointer to next record (2 bytes) + key length (1 byte)
|
||||
+ sta @skiplen
|
||||
+ sta KEYLEN
|
||||
txa
|
||||
pha ; save X on stack
|
||||
lda PTR+1
|
||||
@ -438,8 +435,7 @@ okvs_iter_values
|
||||
lda PTR
|
||||
pha ; save PTR on stack (in case callback clobbers it)
|
||||
clc
|
||||
@skiplen=*+1 ; skip over pointer (and possibly key)
|
||||
adc #$FD ; SMC
|
||||
adc KEYLEN ; skip over pointer (and possibly key)
|
||||
bcc +
|
||||
iny ; A/Y -> value
|
||||
+
|
||||
@ -453,8 +449,7 @@ okvs_iter_values
|
||||
tax ; restore X from stack
|
||||
jsr derefptr ; PTR -> next record
|
||||
inx
|
||||
@max=*+1
|
||||
cpx #$FD ; SMC
|
||||
cpx MAX
|
||||
bne @loop
|
||||
@exit rts
|
||||
|
||||
|
@ -174,7 +174,7 @@ pref_set
|
||||
beq ++
|
||||
clc
|
||||
adc #$01
|
||||
sta @len
|
||||
sta MAX
|
||||
iny
|
||||
- lda ($00),y
|
||||
sta ($FE,x)
|
||||
@ -182,8 +182,7 @@ pref_set
|
||||
inc $FE
|
||||
bne +
|
||||
inc $FF
|
||||
@len=*+1
|
||||
+ cpy #$FD ; SMC
|
||||
+ cpy MAX
|
||||
bne -
|
||||
++ rts
|
||||
|
||||
|
@ -109,6 +109,7 @@ kSFXFizzleFile
|
||||
; Y contains high byte of address of length-prefixed string to append
|
||||
; out: all registers and flags clobbered
|
||||
; $02/$03 (PTR/PTR+1) clobbered
|
||||
; MAX clobbered
|
||||
; gPathname updated with concatenated length-prefixed string
|
||||
;------------------------------------------------------------------------------
|
||||
SetPath
|
||||
@ -124,14 +125,13 @@ AddToPath
|
||||
beq @done
|
||||
tay
|
||||
iny
|
||||
sty @len
|
||||
sty MAX
|
||||
ldy #$01
|
||||
- lda (PTR),y
|
||||
sta gPathname+1,x
|
||||
inx
|
||||
iny
|
||||
@len=*+1
|
||||
cpy #$FD ; SMC
|
||||
cpy MAX
|
||||
bcc -
|
||||
@done
|
||||
stx gPathname
|
||||
|
Loading…
x
Reference in New Issue
Block a user