mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-27 08:50:01 +00:00
Merge branch 'master' of https://github.com/a2-4am/4cade
This commit is contained in:
commit
699185d678
@ -206,8 +206,8 @@ OneTimeSetup
|
|||||||
!word gGamesListStore
|
!word gGamesListStore
|
||||||
!word -
|
!word -
|
||||||
|
|
||||||
|
+LDADDR gGamesListStore
|
||||||
jsr okvs_len
|
jsr okvs_len
|
||||||
!word gGamesListStore
|
|
||||||
sta GameCount
|
sta GameCount
|
||||||
sta SAVE
|
sta SAVE
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
; D000..E5F4 - persistent data structures (per-game cheat categories,
|
; D000..E5F4 - persistent data structures (per-game cheat categories,
|
||||||
; gGlobalPrefsStore, gGamesListStore)
|
; gGlobalPrefsStore, gGamesListStore)
|
||||||
; ...unused...
|
; ...unused...
|
||||||
; EA5C..FFF9 - main program code
|
; EABB..FFF9 - main program code
|
||||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||||
;
|
;
|
||||||
; LC RAM BANK 2
|
; LC RAM BANK 2
|
||||||
|
@ -74,21 +74,19 @@ GetGameDisplayName
|
|||||||
PlayGameFromSearch
|
PlayGameFromSearch
|
||||||
PlayGameFromBrowse
|
PlayGameFromBrowse
|
||||||
; in: X = game index
|
; in: X = game index
|
||||||
stx +
|
+LDADDR gGamesListStore
|
||||||
jsr okvs_nth
|
jsr okvs_nth
|
||||||
!word gGamesListStore
|
|
||||||
+ !byte $FD ; SMC
|
|
||||||
; A/Y = address of game filename
|
; A/Y = address of game filename
|
||||||
jmp .Go
|
bne .Go ; always branches
|
||||||
|
|
||||||
PlayGameFromAttract
|
PlayGameFromAttract
|
||||||
; in: none
|
; in: none
|
||||||
jsr LoadAndParseAttractModeConf
|
jsr LoadAndParseAttractModeConf
|
||||||
|
|
||||||
|
+LDADDR gAttractModeStore
|
||||||
|
gCurrentAttractIndex=*+1
|
||||||
|
ldx #$FD ; set in MegaAttractMode
|
||||||
jsr okvs_nth ; get filename of current attract-mode module
|
jsr okvs_nth ; get filename of current attract-mode module
|
||||||
!word gAttractModeStore
|
|
||||||
gCurrentAttractIndex
|
|
||||||
!byte $FD ; set in MegaAttractMode
|
|
||||||
+STAY @key
|
+STAY @key
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
!word gAttractModeStore
|
!word gAttractModeStore
|
||||||
@ -109,10 +107,11 @@ gCurrentAttractIndex
|
|||||||
; we reached here by pressing <RETURN> during a slideshow
|
; we reached here by pressing <RETURN> during a slideshow
|
||||||
; gSlideshowStore is still in memory, and gCurrentlyVisibleSlideshowIndex
|
; gSlideshowStore is still in memory, and gCurrentlyVisibleSlideshowIndex
|
||||||
; is the index into gSlideshowStore of the picture that is being displayed
|
; is the index into gSlideshowStore of the picture that is being displayed
|
||||||
|
+LDADDR gSlideshowStore
|
||||||
|
gCurrentlyVisibleSlideshowIndex=*+1
|
||||||
|
ldx #$FD ; set in HGRTitleCallback, HGRActionCallback, DHGRTitleCallback
|
||||||
jsr okvs_nth
|
jsr okvs_nth
|
||||||
!word gSlideshowStore
|
!word gSlideshowStore
|
||||||
gCurrentlyVisibleSlideshowIndex
|
|
||||||
!byte $FD ; set in HGRTitleCallback, HGRActionCallback, DHGRTitleCallback
|
|
||||||
+STAY @sskey
|
+STAY @sskey
|
||||||
+STAY @sskey2
|
+STAY @sskey2
|
||||||
jsr okvs_get
|
jsr okvs_get
|
||||||
|
101
src/okvs.a
101
src/okvs.a
@ -64,15 +64,13 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; okvs_init
|
; okvs_init
|
||||||
;
|
;
|
||||||
; in: stack contains 2 bytes of parameters:
|
; in: A/Y = handle to storage space
|
||||||
; +1 [word] handle to storage space
|
|
||||||
; out: $00/$01 clobbered
|
; out: $00/$01 clobbered
|
||||||
; $02/$03 clobbered
|
; $02/$03 clobbered
|
||||||
; all registers clobbered
|
; all registers clobbered
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
okvs_init
|
okvs_init
|
||||||
+PARAMS_ON_STACK 2
|
jsr GetStoreAddressFromAY
|
||||||
jsr GetStoreAddress
|
|
||||||
; PTR -> store
|
; PTR -> store
|
||||||
; Y = 0
|
; Y = 0
|
||||||
tya
|
tya
|
||||||
@ -94,16 +92,15 @@ okvs_init
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; okvs_len
|
; okvs_len
|
||||||
;
|
;
|
||||||
; in: stack contains 2 bytes of parameters:
|
; in: A/Y = handle to storage space
|
||||||
; +1 [word] handle to storage space
|
|
||||||
; out: A contains number of keys in this store
|
; out: A contains number of keys in this store
|
||||||
; X, Y clobbered
|
; X preserved
|
||||||
|
; Y clobbered
|
||||||
; $00/$01 clobbered
|
; $00/$01 clobbered
|
||||||
; $02/$03 clobbered
|
; $02/$03 clobbered
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
okvs_len
|
okvs_len
|
||||||
+PARAMS_ON_STACK 2
|
jsr GetStoreAddressFromAY
|
||||||
jsr GetStoreAddress
|
|
||||||
; PTR -> store
|
; PTR -> store
|
||||||
; Y = 0
|
; Y = 0
|
||||||
lda (PTR),y ; A = number of keys in store
|
lda (PTR),y ; A = number of keys in store
|
||||||
@ -287,36 +284,6 @@ okvs_get
|
|||||||
@fail sec
|
@fail sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; okvs_nth
|
|
||||||
; get (N)th key
|
|
||||||
;
|
|
||||||
; in: stack contains 3 bytes of parameters:
|
|
||||||
; +1 [word] handle to storage space
|
|
||||||
; +3 [byte] numeric index
|
|
||||||
; out: A/Y = lo/hi address of nth key
|
|
||||||
; all other registers and flags clobbered
|
|
||||||
; $00/$01 clobbered
|
|
||||||
; $02/$03 clobbered
|
|
||||||
; $04/$05 clobbered
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
okvs_nth
|
|
||||||
+PARAMS_ON_STACK 3
|
|
||||||
jsr GetStoreAddress
|
|
||||||
; PTR -> store
|
|
||||||
jsr incptr3
|
|
||||||
; PTR -> first record
|
|
||||||
ldy #3
|
|
||||||
lda (PARAM),y
|
|
||||||
tax ; X = numeric index of key to get
|
|
||||||
beq @found
|
|
||||||
- jsr derefptr
|
|
||||||
dex
|
|
||||||
bne -
|
|
||||||
@found jsr incptr2
|
|
||||||
+LDAY PTR
|
|
||||||
rts
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; okvs_next
|
; okvs_next
|
||||||
; get (N+1)th key, with wraparound
|
; get (N+1)th key, with wraparound
|
||||||
@ -324,28 +291,46 @@ okvs_nth
|
|||||||
; in: A/Y = handle to storage space
|
; in: A/Y = handle to storage space
|
||||||
; X = record index
|
; X = record index
|
||||||
; out: A/Y = lo/hi address of (X+1)th key, or first key if X was the last record
|
; out: A/Y = lo/hi address of (X+1)th key, or first key if X was the last record
|
||||||
; all other registers and flags clobbered
|
; X = next record index
|
||||||
; PARAM clobbered
|
|
||||||
; PTR clobbered
|
|
||||||
; SRC clobbered
|
|
||||||
; SAVE clobbered
|
; SAVE clobbered
|
||||||
|
; see okvs_nth for other exit conditions
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
okvs_next
|
okvs_next
|
||||||
+STAY @store1
|
+STAY PARAM
|
||||||
+STAY @store2
|
|
||||||
inx
|
|
||||||
stx SAVE
|
|
||||||
jsr okvs_len
|
jsr okvs_len
|
||||||
@store1 !word $FDFD ; SMC
|
|
||||||
cmp SAVE
|
cmp SAVE
|
||||||
beq +
|
bne +
|
||||||
lda SAVE
|
ldx #$FF
|
||||||
+HIDE_NEXT_2_BYTES
|
+ inx
|
||||||
+ lda #0
|
+LDAY PARAM
|
||||||
sta @n
|
; execution falls through here
|
||||||
jsr okvs_nth
|
;------------------------------------------------------------------------------
|
||||||
@store2 !word $FDFD ; SMC
|
; okvs_nth
|
||||||
@n !byte $FD ; SMC
|
; get (N)th key
|
||||||
|
;
|
||||||
|
; in: A/Y = handle to storage space
|
||||||
|
; X = record index
|
||||||
|
; out: A/Y = lo/hi address of nth key
|
||||||
|
; X preserved
|
||||||
|
; Z = 0
|
||||||
|
; all other flags clobbered
|
||||||
|
; PTR clobbered
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
okvs_nth
|
||||||
|
jsr GetStoreAddressFromAY
|
||||||
|
; PTR -> store
|
||||||
|
jsr incptr3
|
||||||
|
; PTR -> first record
|
||||||
|
txa
|
||||||
|
pha
|
||||||
|
beq @found
|
||||||
|
- jsr derefptr
|
||||||
|
dex
|
||||||
|
bne -
|
||||||
|
@found jsr incptr2
|
||||||
|
pla
|
||||||
|
tax
|
||||||
|
+LDAY PTR
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
@ -475,6 +460,10 @@ incptr
|
|||||||
inc PTR+1
|
inc PTR+1
|
||||||
+ rts
|
+ rts
|
||||||
|
|
||||||
|
GetStoreAddressFromAY
|
||||||
|
+STAY PTR
|
||||||
|
jmp derefptr
|
||||||
|
|
||||||
GetStoreAddress
|
GetStoreAddress
|
||||||
; in: PARAM = address of stack params (any PARAMS_ON_STACK macro will do this)
|
; in: PARAM = address of stack params (any PARAMS_ON_STACK macro will do this)
|
||||||
; out: PTR = address of store (always the first parameter on stack)
|
; out: PTR = address of store (always the first parameter on stack)
|
||||||
|
@ -32,8 +32,8 @@ ParseKeyValueList
|
|||||||
+PARAMS_ON_STACK 5
|
+PARAMS_ON_STACK 5
|
||||||
|
|
||||||
+LDPARAM 1
|
+LDPARAM 1
|
||||||
+STAY @store1
|
|
||||||
+STAY @store2
|
+STAY @store2
|
||||||
|
jsr okvs_init ; reset key/value store
|
||||||
|
|
||||||
+LDPARAM 3
|
+LDPARAM 3
|
||||||
+STAY $FE
|
+STAY $FE
|
||||||
@ -55,8 +55,6 @@ ParseKeyValueList
|
|||||||
bcs +
|
bcs +
|
||||||
dey
|
dey
|
||||||
+ sty $FF
|
+ sty $FF
|
||||||
jsr okvs_init ; reset key/value store
|
|
||||||
@store1 !word $FDFD ; SMC
|
|
||||||
|
|
||||||
ldy #$00 ; index into ($FE) pointing to current character
|
ldy #$00 ; index into ($FE) pointing to current character
|
||||||
@newkey ldx #$00 ; X = index into current key
|
@newkey ldx #$00 ; X = index into current key
|
||||||
|
@ -28,8 +28,8 @@ ParseGamesList
|
|||||||
+PARAMS_ON_STACK 4
|
+PARAMS_ON_STACK 4
|
||||||
|
|
||||||
+LDPARAM 1
|
+LDPARAM 1
|
||||||
+STAY @store1
|
|
||||||
+STAY @store2
|
+STAY @store2
|
||||||
|
jsr okvs_init ; reset key/value store
|
||||||
|
|
||||||
+LDPARAM 3
|
+LDPARAM 3
|
||||||
+STAY $FE
|
+STAY $FE
|
||||||
@ -47,8 +47,6 @@ ParseGamesList
|
|||||||
bcs +
|
bcs +
|
||||||
dey
|
dey
|
||||||
+ sty $FF
|
+ sty $FF
|
||||||
jsr okvs_init ; reset key/value store
|
|
||||||
@store1 !word $FDFD ; SMC
|
|
||||||
|
|
||||||
ldy #$00 ; index into ($FE) pointing to current character
|
ldy #$00 ; index into ($FE) pointing to current character
|
||||||
@newkey ldx #$00 ; X = index into current key
|
@newkey ldx #$00 ; X = index into current key
|
||||||
|
@ -67,14 +67,13 @@ pref_get
|
|||||||
+STAY @prefkey
|
+STAY @prefkey
|
||||||
+LDPARAM 3
|
+LDPARAM 3
|
||||||
+STAY @store1
|
+STAY @store1
|
||||||
+STAY @store2
|
|
||||||
|
|
||||||
jsr okvs_get ; look up pref key in prefs store
|
jsr okvs_get ; look up pref key in prefs store
|
||||||
!word gGlobalPrefsStore
|
!word gGlobalPrefsStore
|
||||||
@prefkey !word $FDFD ; SMC
|
@prefkey !word $FDFD ; SMC
|
||||||
bcs .useDefaultValue ; if pref key is not found, use default value
|
bcs .useDefaultValue ; if pref key is not found, use default value
|
||||||
ldx @store2+1
|
ldx @store1+1
|
||||||
beq @done
|
beq @done ; if no OKVS to validate against, we're done
|
||||||
+STAY +
|
+STAY +
|
||||||
+STAY PTR
|
+STAY PTR
|
||||||
ldy #0
|
ldy #0
|
||||||
@ -83,14 +82,12 @@ pref_get
|
|||||||
jsr okvs_get ; check whether the pref value exists as a key in the passed-in store
|
jsr okvs_get ; check whether the pref value exists as a key in the passed-in store
|
||||||
@store1 !word $FDFD ; SMC
|
@store1 !word $FDFD ; SMC
|
||||||
+ !word $FDFD ; SMC
|
+ !word $FDFD ; SMC
|
||||||
bcc +
|
bcc + ; found key, continue
|
||||||
.useDefaultValue ; find first key in passed store and use that as a default value
|
.useDefaultValue ; did not find key, use first key in passed store as a default value
|
||||||
ldx #0
|
ldx #0
|
||||||
+ stx @n
|
+
|
||||||
|
+LDAY @store1
|
||||||
jsr okvs_nth
|
jsr okvs_nth
|
||||||
@store2 !word $FDFD ; SMC
|
|
||||||
@n !byte $FD ; SMC
|
|
||||||
ldx @n
|
|
||||||
@done rts
|
@done rts
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
@ -73,7 +73,6 @@ DHGRSingle
|
|||||||
!word gDFXStore
|
!word gDFXStore
|
||||||
+STAY @filename ; A/Y = filename (don't load file yet)
|
+STAY @filename ; A/Y = filename (don't load file yet)
|
||||||
; X = index of the transition in DFX store
|
; X = index of the transition in DFX store
|
||||||
|
|
||||||
+LDADDR gDFXStore
|
+LDADDR gDFXStore
|
||||||
jsr okvs_next ; get transition after this one
|
jsr okvs_next ; get transition after this one
|
||||||
+STAY +
|
+STAY +
|
||||||
|
@ -177,7 +177,6 @@ HGRSingle
|
|||||||
!word gFXStore
|
!word gFXStore
|
||||||
+STAY @filename ; A/Y = filename (don't load file yet)
|
+STAY @filename ; A/Y = filename (don't load file yet)
|
||||||
; X = index of the transition in FX store
|
; X = index of the transition in FX store
|
||||||
|
|
||||||
+LDADDR gFXStore
|
+LDADDR gFXStore
|
||||||
jsr okvs_next ; get transition after this one
|
jsr okvs_next ; get transition after this one
|
||||||
+STAY +
|
+STAY +
|
||||||
|
@ -68,15 +68,12 @@ MegaAttractMode
|
|||||||
; assume all of main memory has been clobbered
|
; assume all of main memory has been clobbered
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
MiniAttractMode
|
MiniAttractMode
|
||||||
stx +
|
+LDADDR gGamesListStore
|
||||||
|
jsr okvs_nth
|
||||||
|
+STAY @fname
|
||||||
|
|
||||||
jsr BlankHGR
|
jsr BlankHGR
|
||||||
|
|
||||||
jsr okvs_nth
|
|
||||||
!word gGamesListStore
|
|
||||||
+ !byte $FD ; SMC
|
|
||||||
+STAY @fname
|
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta @MiniAttractIndex
|
sta @MiniAttractIndex
|
||||||
@loop
|
@loop
|
||||||
@ -90,16 +87,15 @@ MiniAttractMode
|
|||||||
!word -
|
!word -
|
||||||
!byte 0
|
!byte 0
|
||||||
|
|
||||||
|
+LDADDR gAttractModeStore
|
||||||
jsr okvs_len
|
jsr okvs_len
|
||||||
!word gAttractModeStore
|
|
||||||
cmp @MiniAttractIndex
|
cmp @MiniAttractIndex
|
||||||
beq @exit ; we've run through all modules, so exit to caller
|
beq @exit ; we've run through all modules, so exit to caller
|
||||||
|
|
||||||
lda @MiniAttractIndex
|
@MiniAttractIndex=*+1
|
||||||
sta +
|
ldx #$FD ; SMC
|
||||||
|
+LDADDR gAttractModeStore
|
||||||
jsr okvs_nth ; get the next module on the list
|
jsr okvs_nth ; get the next module on the list
|
||||||
!word gAttractModeStore
|
|
||||||
+ !byte $FD ; SMC
|
|
||||||
+STAY @key
|
+STAY @key
|
||||||
|
|
||||||
jsr okvs_get ; get module type
|
jsr okvs_get ; get module type
|
||||||
@ -117,8 +113,6 @@ MiniAttractMode
|
|||||||
lda KBD
|
lda KBD
|
||||||
bpl @loop
|
bpl @loop
|
||||||
@exit rts
|
@exit rts
|
||||||
@MiniAttractIndex
|
|
||||||
!byte $FD
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; RunAttractModule
|
; RunAttractModule
|
||||||
|
@ -97,10 +97,8 @@ GameCount = *+1
|
|||||||
ldx BrowseSelectedIndex
|
ldx BrowseSelectedIndex
|
||||||
; execution falls through here
|
; execution falls through here
|
||||||
.OnBrowseChanged
|
.OnBrowseChanged
|
||||||
stx @index
|
+LDADDR gGamesListStore
|
||||||
jsr okvs_nth ; get the name of the new game
|
jsr okvs_nth ; get the name of the new game
|
||||||
!word gGamesListStore
|
|
||||||
@index !byte $FD
|
|
||||||
+STAY @key
|
+STAY @key
|
||||||
+STAY @key2
|
+STAY @key2
|
||||||
jsr GetOffscreenAddress ; load new title screenshot offscreen
|
jsr GetOffscreenAddress ; load new title screenshot offscreen
|
||||||
@ -134,11 +132,11 @@ GameCount = *+1
|
|||||||
sta UI_ToPlay,x
|
sta UI_ToPlay,x
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
ldx @index
|
ldx BrowseSelectedIndex
|
||||||
jsr BuildUILine1WithNoDots ; build UI line 1 with bars and other shapes
|
jsr BuildUILine1WithNoDots; build UI line 1 with bars and other shapes
|
||||||
ldx @index
|
ldx BrowseSelectedIndex
|
||||||
jsr DrawSearchBarOffscreen ; actually draw the UI (offscreen)
|
jsr DrawSearchBarOffscreen; actually draw the UI (offscreen)
|
||||||
jmp ShowOtherPage ; now show everything at once
|
jmp ShowOtherPage ; now show everything at once
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -152,14 +152,12 @@ SearchMode
|
|||||||
dec InputLength ; ignore the last key typed
|
dec InputLength ; ignore the last key typed
|
||||||
jmp .OnError ; beep and return
|
jmp .OnError ; beep and return
|
||||||
+
|
+
|
||||||
lda BestMatchIndex ; check if the new best match is the same
|
ldx BestMatchIndex ; check if the new best match is the same
|
||||||
cmp SelectedIndex ; as the current best match
|
cpx SelectedIndex ; as the current best match
|
||||||
php ; (we'll use this later to skip reloading)
|
php ; (we'll use this later to skip reloading)
|
||||||
sta SelectedIndex
|
stx SelectedIndex
|
||||||
sta @index
|
+LDADDR gGamesListStore
|
||||||
jsr okvs_nth ; get the name of the new best match
|
jsr okvs_nth ; get the name of the new best match
|
||||||
!word gGamesListStore
|
|
||||||
@index !byte $FD
|
|
||||||
+STAY @key
|
+STAY @key
|
||||||
+STAY @key2
|
+STAY @key2
|
||||||
plp
|
plp
|
||||||
|
Loading…
Reference in New Issue
Block a user