mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-04 04:32:50 +00:00
refactor incptr
This commit is contained in:
parent
35c48d8bf3
commit
003b6ad6f0
@ -9,7 +9,7 @@
|
||||
; D000..E4E9 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
||||
; ...end of data and start of code are approximate, in between is unused...
|
||||
; ...if they ever overlap, things will go boom...
|
||||
; E9F0..FFF9 - main program code
|
||||
; E9FF..FFF9 - main program code
|
||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||
;
|
||||
; LC RAM BANK 2
|
||||
|
24
src/okvs.a
24
src/okvs.a
@ -142,8 +142,8 @@ okvs_append
|
||||
sta SAVE
|
||||
; PTR -> new record
|
||||
; SAVE -> new record
|
||||
jsr incptr
|
||||
jsr incptr ; PTR -> space for new key
|
||||
jsr incptr2
|
||||
; PTR -> space for new key
|
||||
+LDPARAM 3
|
||||
+STAY SRC ; SRC -> new key to copy
|
||||
ldy #0
|
||||
@ -231,10 +231,7 @@ okvs_get
|
||||
lda (PTR),y
|
||||
beq @fail ; no keys, fail immediately
|
||||
sta @maxkeys ; A = number of keys
|
||||
ldx #3
|
||||
- jsr incptr
|
||||
dex
|
||||
bne -
|
||||
jsr incptr3
|
||||
; PTR -> first record
|
||||
ldx #0
|
||||
+LDPARAM 3
|
||||
@ -297,10 +294,7 @@ okvs_get
|
||||
okvs_nth
|
||||
+PARAMS_ON_STACK 3
|
||||
jsr SetPTRFromStackParams
|
||||
ldx #3
|
||||
- jsr incptr
|
||||
dex
|
||||
bne -
|
||||
jsr incptr3
|
||||
; PTR -> first record
|
||||
ldy #3
|
||||
lda (PARAM),y
|
||||
@ -309,8 +303,7 @@ okvs_nth
|
||||
- jsr derefptr
|
||||
dex
|
||||
bne -
|
||||
@found jsr incptr
|
||||
jsr incptr
|
||||
@found jsr incptr2
|
||||
+LDAY PTR
|
||||
rts
|
||||
|
||||
@ -386,10 +379,7 @@ okvs_iter_values
|
||||
sta @max
|
||||
+LDPARAM 3
|
||||
+STAY @callback
|
||||
ldx #3
|
||||
- jsr incptr
|
||||
dex
|
||||
bne -
|
||||
jsr incptr3
|
||||
; PTR -> first record
|
||||
ldx #0
|
||||
@loop
|
||||
@ -431,6 +421,8 @@ okvs_iter_values
|
||||
;------------------------------------------------------------------------------
|
||||
; internal functions
|
||||
|
||||
incptr3 jsr incptr
|
||||
incptr2 jsr incptr
|
||||
incptr
|
||||
; preserves A and X
|
||||
ldy PTR
|
||||
|
Loading…
Reference in New Issue
Block a user