diff --git a/res/text/suspended.txt b/res/text/suspended.txt index 33f58a1..3d8fa6a 100644 --- a/res/text/suspended.txt +++ b/res/text/suspended.txt @@ -26,7 +26,7 @@ [versions] R8B.840521.Z3=Release 8 / Serial number 840521 R8A.830521.Z3=Release 8 / Serial number 830521 -R7.830419.Z3=Release 7 / Seial number 830419 +R7.830419.Z3=Release 7 / Serial number 830419 R5.830222.Z3=Release 5 / Serial number 830222 [options] diff --git a/src/okvs.a b/src/okvs.a index c40e7f8..4b50ba5 100644 --- a/src/okvs.a +++ b/src/okvs.a @@ -10,6 +10,7 @@ ; - okvs_update(address, key, value) update key/value pair ; - okvs_get(address, key) get value by key lookup ; - okvs_nth(address, n) get key by numeric index +; - okvs_iter_values(address, callback) iterate through records ; - okvs_as_boolean(value) set Z flag based on value ; ; Used for global preferences, per-game options, and per-game version lists @@ -124,12 +125,8 @@ okvs_append +STAY SAVE ; save PTR jsr incptr jsr incptr ; PTR -> space for new key - ldy #3 - lda (PARAM),y ; get source address of new key to copy - sta SRC - iny - lda (PARAM),y - sta SRC+1 + +LDPARAM 3 + +STAY SRC ; SRC -> new key to copy lda (SRC) inc sta .keylen @@ -148,13 +145,9 @@ okvs_append bcc + inc PTR+1 + ; PTR -> space for new value - ldy #5 - lda (PARAM),y ; get source address of new value - sta SRC - iny - lda (PARAM),y - sta SRC+1 - iny + +LDPARAM 5 + +STAY SRC ; SRC -> new value to copy + ldy #7 lda (PARAM),y ; get max length of value bne + lda (SRC) ; no max, use actual length instead @@ -210,18 +203,11 @@ okvs_get stx .maxKeys ldx #0 jsr incptr ; PTR -> first record - - ldy #3 - lda (PARAM),y - sta SRC - iny - lda (PARAM),y - sta SRC+1 ; SRC -> key we want to find - + +LDPARAM 3 + +STAY SRC ; SRC -> key we want to find lda (SRC) inc sta .matchlen - .matchRecordLoop lda PTR+1 sta DEST+1 @@ -277,7 +263,6 @@ okvs_nth +PARAMS_ON_STACK 3 jsr SetPTRFromStackParams jsr incptr ; PTR -> first record - ldy #3 lda (PARAM),y tax ; X = numeric index of key to get @@ -335,6 +320,25 @@ okvs_update clc .exit rts +;------------------------------------------------------------------------------ +; okvs_iter_values +; +; in: stack contains 4 bytes of parameters: +; +1 [word] handle to storage space +; +3 [word] address of callback +; out: will be called for each record in the store with +; X = numeric index of record +; A/Y = address of value +; all registers are clobbered +; all flags clobbered +; $00/$01 clobbered +;------------------------------------------------------------------------------ +okvs_iter_values + +PARAMS_ON_STACK 4 + jsr SetPTRFromStackParams + ; TODO + rts + ;------------------------------------------------------------------------------ ; okvs_as_boolean ;