mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-29 22:49:26 +00:00
move okvs_init to init-only section
This commit is contained in:
parent
7482420c8d
commit
da8498e330
@ -11,7 +11,7 @@
|
||||
; ...unused...
|
||||
; E000..E3FF - HGR font data
|
||||
; ...unused...
|
||||
; E893..FFEE - main program code
|
||||
; E8CB..FFEE - main program code
|
||||
; FFEF..FFF9 - API functions and global constants available for main program
|
||||
; code, prelaunchers, transition effects, &c.
|
||||
; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
|
||||
|
31
src/okvs.a
31
src/okvs.a
@ -4,7 +4,6 @@
|
||||
; Ordered key/value store (6502 compatible)(256+ records compatible)
|
||||
;
|
||||
; Public functions
|
||||
; - okvs_init(address) reset (required)
|
||||
; - okvs_len(address) get number of keys
|
||||
; - okvs_update(address, key, value) update key/value pair
|
||||
; - okvs_get(address, key) get value by key lookup
|
||||
@ -67,36 +66,6 @@
|
||||
; +K+3 value
|
||||
; ... filler bytes up to value max length (set at append() time)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; okvs_init
|
||||
;
|
||||
; in: A/Y = handle to storage space
|
||||
; out: $00/$01 clobbered
|
||||
; $02/$03 clobbered
|
||||
; all registers clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
okvs_init
|
||||
jsr GetStoreAddressFromAY
|
||||
; PTR -> store
|
||||
; Y = 0
|
||||
tya
|
||||
sta (PTR),y ; set number of keys in store to 0 (word)
|
||||
iny
|
||||
sta (PTR),y
|
||||
|
||||
iny ; set next-free-space pointer to store + 4
|
||||
ldx PTR+1
|
||||
lda PTR
|
||||
clc
|
||||
adc #$04
|
||||
bcc +
|
||||
inx
|
||||
+ sta (PTR),y
|
||||
iny
|
||||
txa
|
||||
sta (PTR),y
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; okvs_len
|
||||
; okvs_len_imm
|
||||
|
@ -238,3 +238,33 @@ okvs_append
|
||||
ldy #0
|
||||
sta (SAVE),y ; set record length
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; okvs_init
|
||||
;
|
||||
; in: A/Y = handle to storage space
|
||||
; out: $00/$01 clobbered
|
||||
; $02/$03 clobbered
|
||||
; all registers clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
okvs_init
|
||||
jsr GetStoreAddressFromAY
|
||||
; PTR -> store
|
||||
; Y = 0
|
||||
tya
|
||||
sta (PTR),y ; set number of keys in store to 0 (word)
|
||||
iny
|
||||
sta (PTR),y
|
||||
|
||||
iny ; set next-free-space pointer to store + 4
|
||||
ldx PTR+1
|
||||
lda PTR
|
||||
clc
|
||||
adc #$04
|
||||
bcc +
|
||||
inx
|
||||
+ sta (PTR),y
|
||||
iny
|
||||
txa
|
||||
sta (PTR),y
|
||||
rts
|
||||
|
Loading…
Reference in New Issue
Block a user