mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-27 12:30:30 +00:00
search cache
This commit is contained in:
parent
0eca8b99e6
commit
011948651a
4
Makefile
4
Makefile
@ -58,6 +58,10 @@ dsk: asm index
|
||||
build/SEARCH01.IDX \
|
||||
build/SEARCH10.IDX \
|
||||
build/SEARCH11.IDX \
|
||||
res/CACHE00.IDX \
|
||||
res/CACHE01.IDX \
|
||||
res/CACHE10.IDX \
|
||||
res/CACHE11.IDX \
|
||||
build/FX.IDX \
|
||||
build/DFX.IDX \
|
||||
build/GAMEHELP.IDX \
|
||||
|
BIN
res/CACHE01.IDX
BIN
res/CACHE01.IDX
Binary file not shown.
BIN
res/CACHE11.IDX
BIN
res/CACHE11.IDX
Binary file not shown.
@ -400,12 +400,14 @@ CopyDevs
|
||||
beq + ; SEARCH00.IDX, SEARCH01.IDX, SEARCH10.IDX, SEARCH11.IDX,
|
||||
inx ; which correspond to <games-requiring-a-joystick> X
|
||||
+ stx gSearchHasJoystick ; <games-requiring-128K>.
|
||||
stx gCacheHasJoystick
|
||||
ldx #$30 ; Once we construct the filename, we'll forever after
|
||||
lda MachineStatus ; load and reload the correct list of games that
|
||||
and #HAS_128K ; this machine can play.
|
||||
beq +
|
||||
inx
|
||||
+ stx gSearchHas128K
|
||||
stx gCacheHas128K
|
||||
|
||||
lda #0 ; Read just the first 2 bytes of the search index
|
||||
sta sizelo ; to get the size, which is the number of games.
|
||||
|
@ -116,6 +116,9 @@ UI_ToPlay = $1FF7
|
||||
gValLen = $1F80
|
||||
gVal = $1F81
|
||||
|
||||
gSearchIndex = $8200
|
||||
gSearchCache = $B000
|
||||
|
||||
; LC RAM 1
|
||||
iLoadFileDirect = $FFEF
|
||||
WaitForVBL = $FFF2
|
||||
@ -153,7 +156,7 @@ PRELAUNCH_STANDARD_SIZE = 61 ; LoadStandardPrelaunch, eventually to be d
|
||||
iCurBlockLo = $D401 ; constant
|
||||
iCurBlockHi = $D403 ; constant
|
||||
launchpatch = $D662 ; glue.launch.a
|
||||
iAddToPath = $FE8F ; Roger Rabbit, avoid, use Infiltrator 2 style instead
|
||||
iAddToPath = $FE83 ; Roger Rabbit, avoid, use Infiltrator 2 style instead
|
||||
itraverse = $D964 ; Roger Rabbit, avoid, use Infiltrator 2 style instead
|
||||
ldrlo = $55 ; constant
|
||||
ldrhi = $56 ; constant
|
||||
|
@ -205,3 +205,12 @@ gSearchHasJoystick
|
||||
gSearchHas128K
|
||||
!raw "_"
|
||||
!raw ".IDX"
|
||||
|
||||
kSearchCacheFile
|
||||
!byte 11
|
||||
!raw "CACHE"
|
||||
gCacheHasJoystick
|
||||
!raw "_"
|
||||
gCacheHas128K
|
||||
!raw "_"
|
||||
!raw ".IDX"
|
||||
|
@ -6,6 +6,7 @@
|
||||
; Public functions
|
||||
; - ReloadSearchIndex
|
||||
; - ResetTextRank
|
||||
; - FindTitleInCache
|
||||
; - TextRankCallback (as okvs_iter_values callback)
|
||||
;
|
||||
; Public variables
|
||||
@ -36,7 +37,52 @@ ReloadSearchIndex
|
||||
jsr LoadFile ; load appropriate search index into $8200
|
||||
!word kRootDirectory
|
||||
!word kSearchIndexFile
|
||||
!word $8200
|
||||
!word gSearchIndex
|
||||
jsr LoadFile ; load appropriate search cache into $B000
|
||||
!word kRootDirectory
|
||||
!word kSearchCacheFile
|
||||
!word gSearchCache
|
||||
rts
|
||||
|
||||
FindTitleInCache
|
||||
ldx InputLength
|
||||
cpx #5
|
||||
bcs @nomatch
|
||||
lda #$20
|
||||
sta InputBuffer, x
|
||||
+LDADDR gSearchCache
|
||||
+ST16 PTR
|
||||
ldx #$FF
|
||||
-- inx
|
||||
ldy #0
|
||||
- lda (PTR), y
|
||||
beq @nomatch
|
||||
cmp InputBuffer, x
|
||||
beq @matchchar
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
bne - ; always branches
|
||||
@matchchar
|
||||
iny
|
||||
lda (PTR), y
|
||||
pha
|
||||
iny
|
||||
lda (PTR), y
|
||||
bpl @foundindex
|
||||
sta PTR+1
|
||||
pla
|
||||
sta PTR
|
||||
cpx InputLength
|
||||
bcc --
|
||||
@nomatch
|
||||
sec
|
||||
rts
|
||||
@foundindex
|
||||
sta BestMatchIndex+1
|
||||
pla
|
||||
sta BestMatchIndex
|
||||
clc
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -199,8 +199,10 @@ FindMatchingTitle
|
||||
jsr SwitchToBank2
|
||||
jsr EnableAcceleratorAndSwitchToBank1
|
||||
|
||||
jsr ResetTextRank
|
||||
jsr FindTitleInCache
|
||||
bcc + ; sets BestMatchIndex on success
|
||||
|
||||
jsr ResetTextRank
|
||||
jsr okvs_iter_values ; iterate through all game display names
|
||||
!word gSearchStore ; and rank them for the best match
|
||||
!word TextRankCallback ; to the current input buffer
|
||||
|
Loading…
Reference in New Issue
Block a user