From 2e8687da73482e586560a873b89ca660086aee26 Mon Sep 17 00:00:00 2001 From: 4am Date: Sat, 21 Sep 2019 23:00:05 -0400 Subject: [PATCH] fix regression in okvs_iter --- src/constants.a | 2 +- src/okvs.a | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/constants.a b/src/constants.a index a0fa5226b..841d6ada3 100644 --- a/src/constants.a +++ b/src/constants.a @@ -9,7 +9,7 @@ ; D000..E5F4 - persistent data structures (per-game cheat categories, ; gGlobalPrefsStore, gGamesListStore) ; ...unused... -; EC79..FFF9 - main program code +; EC77..FFF9 - main program code ; FFFA..FFFF - NMI, reset, IRQ vectors ; ; LC RAM BANK 2 diff --git a/src/okvs.a b/src/okvs.a index 81aef412a..6c319ad4e 100644 --- a/src/okvs.a +++ b/src/okvs.a @@ -412,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 @@ -426,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 KEYLEN ++ sta @skiplen txa pha ; save X on stack lda PTR+1 @@ -435,7 +435,8 @@ okvs_iter_values lda PTR pha ; save PTR on stack (in case callback clobbers it) clc - adc KEYLEN ; skip over pointer (and possibly key) +@skiplen=*+1 + adc #$FD ; SMC skip over pointer (and possibly key) bcc + iny ; A/Y -> value + @@ -449,7 +450,8 @@ okvs_iter_values tax ; restore X from stack jsr derefptr ; PTR -> next record inx - cpx MAX +@max=*+1 + cpx #$FD ; SMC bne @loop @exit rts