mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2025-01-04 03:31:51 +00:00
.
This commit is contained in:
parent
b123b4ebcf
commit
9eda7ac043
@ -26,7 +26,7 @@
|
|||||||
[versions]
|
[versions]
|
||||||
R8B.840521.Z3=Release 8 / Serial number 840521
|
R8B.840521.Z3=Release 8 / Serial number 840521
|
||||||
R8A.830521.Z3=Release 8 / Serial number 830521
|
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
|
R5.830222.Z3=Release 5 / Serial number 830222
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
|
50
src/okvs.a
50
src/okvs.a
@ -10,6 +10,7 @@
|
|||||||
; - okvs_update(address, key, value) update key/value pair
|
; - okvs_update(address, key, value) update key/value pair
|
||||||
; - okvs_get(address, key) get value by key lookup
|
; - okvs_get(address, key) get value by key lookup
|
||||||
; - okvs_nth(address, n) get key by numeric index
|
; - 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
|
; - okvs_as_boolean(value) set Z flag based on value
|
||||||
;
|
;
|
||||||
; Used for global preferences, per-game options, and per-game version lists
|
; Used for global preferences, per-game options, and per-game version lists
|
||||||
@ -124,12 +125,8 @@ okvs_append
|
|||||||
+STAY SAVE ; save PTR
|
+STAY SAVE ; save PTR
|
||||||
jsr incptr
|
jsr incptr
|
||||||
jsr incptr ; PTR -> space for new key
|
jsr incptr ; PTR -> space for new key
|
||||||
ldy #3
|
+LDPARAM 3
|
||||||
lda (PARAM),y ; get source address of new key to copy
|
+STAY SRC ; SRC -> new key to copy
|
||||||
sta SRC
|
|
||||||
iny
|
|
||||||
lda (PARAM),y
|
|
||||||
sta SRC+1
|
|
||||||
lda (SRC)
|
lda (SRC)
|
||||||
inc
|
inc
|
||||||
sta .keylen
|
sta .keylen
|
||||||
@ -148,13 +145,9 @@ okvs_append
|
|||||||
bcc +
|
bcc +
|
||||||
inc PTR+1
|
inc PTR+1
|
||||||
+ ; PTR -> space for new value
|
+ ; PTR -> space for new value
|
||||||
ldy #5
|
+LDPARAM 5
|
||||||
lda (PARAM),y ; get source address of new value
|
+STAY SRC ; SRC -> new value to copy
|
||||||
sta SRC
|
ldy #7
|
||||||
iny
|
|
||||||
lda (PARAM),y
|
|
||||||
sta SRC+1
|
|
||||||
iny
|
|
||||||
lda (PARAM),y ; get max length of value
|
lda (PARAM),y ; get max length of value
|
||||||
bne +
|
bne +
|
||||||
lda (SRC) ; no max, use actual length instead
|
lda (SRC) ; no max, use actual length instead
|
||||||
@ -210,18 +203,11 @@ okvs_get
|
|||||||
stx .maxKeys
|
stx .maxKeys
|
||||||
ldx #0
|
ldx #0
|
||||||
jsr incptr ; PTR -> first record
|
jsr incptr ; PTR -> first record
|
||||||
|
+LDPARAM 3
|
||||||
ldy #3
|
+STAY SRC ; SRC -> key we want to find
|
||||||
lda (PARAM),y
|
|
||||||
sta SRC
|
|
||||||
iny
|
|
||||||
lda (PARAM),y
|
|
||||||
sta SRC+1 ; SRC -> key we want to find
|
|
||||||
|
|
||||||
lda (SRC)
|
lda (SRC)
|
||||||
inc
|
inc
|
||||||
sta .matchlen
|
sta .matchlen
|
||||||
|
|
||||||
.matchRecordLoop
|
.matchRecordLoop
|
||||||
lda PTR+1
|
lda PTR+1
|
||||||
sta DEST+1
|
sta DEST+1
|
||||||
@ -277,7 +263,6 @@ okvs_nth
|
|||||||
+PARAMS_ON_STACK 3
|
+PARAMS_ON_STACK 3
|
||||||
jsr SetPTRFromStackParams
|
jsr SetPTRFromStackParams
|
||||||
jsr incptr ; PTR -> first record
|
jsr incptr ; PTR -> first record
|
||||||
|
|
||||||
ldy #3
|
ldy #3
|
||||||
lda (PARAM),y
|
lda (PARAM),y
|
||||||
tax ; X = numeric index of key to get
|
tax ; X = numeric index of key to get
|
||||||
@ -335,6 +320,25 @@ okvs_update
|
|||||||
clc
|
clc
|
||||||
.exit rts
|
.exit rts
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; okvs_iter_values
|
||||||
|
;
|
||||||
|
; in: stack contains 4 bytes of parameters:
|
||||||
|
; +1 [word] handle to storage space
|
||||||
|
; +3 [word] address of callback
|
||||||
|
; out: <callback> 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
|
; okvs_as_boolean
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user