diff --git a/Makefile b/Makefile index 23024c2e3..908ff1762 100644 --- a/Makefile +++ b/Makefile @@ -101,9 +101,9 @@ dsk: md asm rsync -aP res/fx/* build/FX >>build/log $(CADIUS) ADDFOLDER build/"$(DISK)" "/${VOLUME}/FX" "build/FX" >>build/log $(CADIUS) CREATEFOLDER build/"$(DISK)" "/${VOLUME}/X/" >>build/log - bin/do2po.py res/dsk/ build/po/ - rsync -a res/dsk/*.po build/po/ - bin/extract.py build/po/ | sh >>build/log +# bin/do2po.py res/dsk/ build/po/ +# rsync -a res/dsk/*.po build/po/ +# bin/extract.py build/po/ | sh >>build/log rm -f build/X/**/.DS_Store rm -f build/X/**/PRODOS rm -f build/X/**/LOADER.SYSTEM diff --git a/bin/V2Make.scpt b/bin/V2Make.scpt index 99aaee858..955b91c34 100644 Binary files a/bin/V2Make.scpt and b/bin/V2Make.scpt differ diff --git a/res/notes/agent-usa.txt b/res/notes/demos/agent-usa.txt similarity index 100% rename from res/notes/agent-usa.txt rename to res/notes/demos/agent-usa.txt diff --git a/res/notes/alien-ambush.txt b/res/notes/demos/alien-ambush.txt similarity index 100% rename from res/notes/alien-ambush.txt rename to res/notes/demos/alien-ambush.txt diff --git a/res/notes/alien-downpour.txt b/res/notes/demos/alien-downpour.txt similarity index 100% rename from res/notes/alien-downpour.txt rename to res/notes/demos/alien-downpour.txt diff --git a/res/notes/alien-rain.txt b/res/notes/demos/alien-rain.txt similarity index 100% rename from res/notes/alien-rain.txt rename to res/notes/demos/alien-rain.txt diff --git a/res/notes/apple-cider-spider.txt b/res/notes/demos/apple-cider-spider.txt similarity index 100% rename from res/notes/apple-cider-spider.txt rename to res/notes/demos/apple-cider-spider.txt diff --git a/res/notes/aquatron.txt b/res/notes/demos/aquatron.txt similarity index 100% rename from res/notes/aquatron.txt rename to res/notes/demos/aquatron.txt diff --git a/res/notes/bolo.txt b/res/notes/demos/bolo.txt similarity index 100% rename from res/notes/bolo.txt rename to res/notes/demos/bolo.txt diff --git a/res/notes/bouncing-kamungas.txt b/res/notes/demos/bouncing-kamungas.txt similarity index 100% rename from res/notes/bouncing-kamungas.txt rename to res/notes/demos/bouncing-kamungas.txt diff --git a/res/notes/burgertime.txt b/res/notes/demos/burgertime.txt similarity index 100% rename from res/notes/burgertime.txt rename to res/notes/demos/burgertime.txt diff --git a/res/notes/buzzard-bait.txt b/res/notes/demos/buzzard-bait.txt similarity index 100% rename from res/notes/buzzard-bait.txt rename to res/notes/demos/buzzard-bait.txt diff --git a/res/notes/ceiling-zero.txt b/res/notes/demos/ceiling-zero.txt similarity index 100% rename from res/notes/ceiling-zero.txt rename to res/notes/demos/ceiling-zero.txt diff --git a/res/notes/championship-lode-runner.txt b/res/notes/demos/championship-lode-runner.txt similarity index 100% rename from res/notes/championship-lode-runner.txt rename to res/notes/demos/championship-lode-runner.txt diff --git a/res/notes/choplifter.txt b/res/notes/demos/choplifter.txt similarity index 100% rename from res/notes/choplifter.txt rename to res/notes/demos/choplifter.txt diff --git a/res/notes/conan.txt b/res/notes/demos/conan.txt similarity index 100% rename from res/notes/conan.txt rename to res/notes/demos/conan.txt diff --git a/res/notes/dino-eggs.txt b/res/notes/demos/dino-eggs.txt similarity index 100% rename from res/notes/dino-eggs.txt rename to res/notes/demos/dino-eggs.txt diff --git a/res/notes/dung-beetles.txt b/res/notes/demos/dung-beetles.txt similarity index 100% rename from res/notes/dung-beetles.txt rename to res/notes/demos/dung-beetles.txt diff --git a/res/notes/firebird.txt b/res/notes/demos/firebird.txt similarity index 100% rename from res/notes/firebird.txt rename to res/notes/demos/firebird.txt diff --git a/res/notes/flipout.txt b/res/notes/demos/flipout.txt similarity index 100% rename from res/notes/flipout.txt rename to res/notes/demos/flipout.txt diff --git a/res/notes/formula-1.txt b/res/notes/demos/formula-1.txt similarity index 100% rename from res/notes/formula-1.txt rename to res/notes/demos/formula-1.txt diff --git a/res/notes/gamma-goblins.txt b/res/notes/demos/gamma-goblins.txt similarity index 100% rename from res/notes/gamma-goblins.txt rename to res/notes/demos/gamma-goblins.txt diff --git a/res/notes/goonies.txt b/res/notes/demos/goonies.txt similarity index 100% rename from res/notes/goonies.txt rename to res/notes/demos/goonies.txt diff --git a/res/notes/gumball.txt b/res/notes/demos/gumball.txt similarity index 100% rename from res/notes/gumball.txt rename to res/notes/demos/gumball.txt diff --git a/res/notes/hard-hat-mack.txt b/res/notes/demos/hard-hat-mack.txt similarity index 100% rename from res/notes/hard-hat-mack.txt rename to res/notes/demos/hard-hat-mack.txt diff --git a/res/notes/high-rise.txt b/res/notes/demos/high-rise.txt similarity index 100% rename from res/notes/high-rise.txt rename to res/notes/demos/high-rise.txt diff --git a/res/notes/jungle-hunt.txt b/res/notes/demos/jungle-hunt.txt similarity index 100% rename from res/notes/jungle-hunt.txt rename to res/notes/demos/jungle-hunt.txt diff --git a/res/notes/karateka.txt b/res/notes/demos/karateka.txt similarity index 100% rename from res/notes/karateka.txt rename to res/notes/demos/karateka.txt diff --git a/res/notes/lady-tut.txt b/res/notes/demos/lady-tut.txt similarity index 100% rename from res/notes/lady-tut.txt rename to res/notes/demos/lady-tut.txt diff --git a/res/notes/lode-runner.txt b/res/notes/demos/lode-runner.txt similarity index 100% rename from res/notes/lode-runner.txt rename to res/notes/demos/lode-runner.txt diff --git a/res/notes/lost-tomb.txt b/res/notes/demos/lost-tomb.txt similarity index 100% rename from res/notes/lost-tomb.txt rename to res/notes/demos/lost-tomb.txt diff --git a/res/notes/mr-cool.txt b/res/notes/demos/mr-cool.txt similarity index 100% rename from res/notes/mr-cool.txt rename to res/notes/demos/mr-cool.txt diff --git a/res/notes/nibbler.txt b/res/notes/demos/nibbler.txt similarity index 100% rename from res/notes/nibbler.txt rename to res/notes/demos/nibbler.txt diff --git a/res/notes/orileys-mine.txt b/res/notes/demos/orileys-mine.txt similarity index 100% rename from res/notes/orileys-mine.txt rename to res/notes/demos/orileys-mine.txt diff --git a/res/notes/pacman.txt b/res/notes/demos/pacman.txt similarity index 100% rename from res/notes/pacman.txt rename to res/notes/demos/pacman.txt diff --git a/res/notes/pest-patrol.txt b/res/notes/demos/pest-patrol.txt similarity index 100% rename from res/notes/pest-patrol.txt rename to res/notes/demos/pest-patrol.txt diff --git a/res/notes/pieman.txt b/res/notes/demos/pieman.txt similarity index 100% rename from res/notes/pieman.txt rename to res/notes/demos/pieman.txt diff --git a/res/notes/pitfall-ii.txt b/res/notes/demos/pitfall-ii.txt similarity index 100% rename from res/notes/pitfall-ii.txt rename to res/notes/demos/pitfall-ii.txt diff --git a/res/notes/plasmania.txt b/res/notes/demos/plasmania.txt similarity index 100% rename from res/notes/plasmania.txt rename to res/notes/demos/plasmania.txt diff --git a/res/notes/pooyan.txt b/res/notes/demos/pooyan.txt similarity index 100% rename from res/notes/pooyan.txt rename to res/notes/demos/pooyan.txt diff --git a/res/notes/repton.txt b/res/notes/demos/repton.txt similarity index 100% rename from res/notes/repton.txt rename to res/notes/demos/repton.txt diff --git a/res/notes/robotron.txt b/res/notes/demos/robotron.txt similarity index 100% rename from res/notes/robotron.txt rename to res/notes/demos/robotron.txt diff --git a/res/notes/sammy-lightfoot.txt b/res/notes/demos/sammy-lightfoot.txt similarity index 100% rename from res/notes/sammy-lightfoot.txt rename to res/notes/demos/sammy-lightfoot.txt diff --git a/res/notes/serpentine.txt b/res/notes/demos/serpentine.txt similarity index 100% rename from res/notes/serpentine.txt rename to res/notes/demos/serpentine.txt diff --git a/res/notes/snake-byte.txt b/res/notes/demos/snake-byte.txt similarity index 100% rename from res/notes/snake-byte.txt rename to res/notes/demos/snake-byte.txt diff --git a/res/notes/sneakers.txt b/res/notes/demos/sneakers.txt similarity index 100% rename from res/notes/sneakers.txt rename to res/notes/demos/sneakers.txt diff --git a/res/notes/spare-change.txt b/res/notes/demos/spare-change.txt similarity index 100% rename from res/notes/spare-change.txt rename to res/notes/demos/spare-change.txt diff --git a/res/notes/spider-raid.txt b/res/notes/demos/spider-raid.txt similarity index 100% rename from res/notes/spider-raid.txt rename to res/notes/demos/spider-raid.txt diff --git a/res/notes/spy-hunter.txt b/res/notes/demos/spy-hunter.txt similarity index 100% rename from res/notes/spy-hunter.txt rename to res/notes/demos/spy-hunter.txt diff --git a/res/notes/spys-demise.txt b/res/notes/demos/spys-demise.txt similarity index 100% rename from res/notes/spys-demise.txt rename to res/notes/demos/spys-demise.txt diff --git a/res/notes/stargate.txt b/res/notes/demos/stargate.txt similarity index 100% rename from res/notes/stargate.txt rename to res/notes/demos/stargate.txt diff --git a/res/notes/stellar-7.txt b/res/notes/demos/stellar-7.txt similarity index 100% rename from res/notes/stellar-7.txt rename to res/notes/demos/stellar-7.txt diff --git a/res/notes/thunderbombs.txt b/res/notes/demos/thunderbombs.txt similarity index 100% rename from res/notes/thunderbombs.txt rename to res/notes/demos/thunderbombs.txt diff --git a/res/notes/track-and-field.txt b/res/notes/demos/track-and-field.txt similarity index 100% rename from res/notes/track-and-field.txt rename to res/notes/demos/track-and-field.txt diff --git a/res/notes/tubeway.txt b/res/notes/demos/tubeway.txt similarity index 100% rename from res/notes/tubeway.txt rename to res/notes/demos/tubeway.txt diff --git a/res/notes/vindicator.txt b/res/notes/demos/vindicator.txt similarity index 100% rename from res/notes/vindicator.txt rename to res/notes/demos/vindicator.txt diff --git a/res/notes/warp-destroyer.txt b/res/notes/demos/warp-destroyer.txt similarity index 100% rename from res/notes/warp-destroyer.txt rename to res/notes/demos/warp-destroyer.txt diff --git a/res/notes/wavy-navy.txt b/res/notes/demos/wavy-navy.txt similarity index 100% rename from res/notes/wavy-navy.txt rename to res/notes/demos/wavy-navy.txt diff --git a/res/notes/checkerboard.py b/res/notes/transitions/checkerboard.py similarity index 100% rename from res/notes/checkerboard.py rename to res/notes/transitions/checkerboard.py diff --git a/res/notes/checkerboard.txt b/res/notes/transitions/checkerboard.txt similarity index 100% rename from res/notes/checkerboard.txt rename to res/notes/transitions/checkerboard.txt diff --git a/res/notes/corner.py b/res/notes/transitions/corner.py similarity index 100% rename from res/notes/corner.py rename to res/notes/transitions/corner.py diff --git a/res/notes/crystal.py b/res/notes/transitions/crystal.py similarity index 100% rename from res/notes/crystal.py rename to res/notes/transitions/crystal.py diff --git a/res/notes/crystal1.txt b/res/notes/transitions/crystal1.txt similarity index 100% rename from res/notes/crystal1.txt rename to res/notes/transitions/crystal1.txt diff --git a/res/notes/crystal2.txt b/res/notes/transitions/crystal2.txt similarity index 100% rename from res/notes/crystal2.txt rename to res/notes/transitions/crystal2.txt diff --git a/res/notes/crystal3.txt b/res/notes/transitions/crystal3.txt similarity index 100% rename from res/notes/crystal3.txt rename to res/notes/transitions/crystal3.txt diff --git a/res/notes/crystal4.txt b/res/notes/transitions/crystal4.txt similarity index 100% rename from res/notes/crystal4.txt rename to res/notes/transitions/crystal4.txt diff --git a/res/notes/diamond.py b/res/notes/transitions/diamond.py similarity index 100% rename from res/notes/diamond.py rename to res/notes/transitions/diamond.py diff --git a/res/notes/diamond.txt b/res/notes/transitions/diamond.txt similarity index 100% rename from res/notes/diamond.txt rename to res/notes/transitions/diamond.txt diff --git a/res/notes/dradial.py b/res/notes/transitions/dradial.py similarity index 100% rename from res/notes/dradial.py rename to res/notes/transitions/dradial.py diff --git a/res/notes/dripple.py b/res/notes/transitions/dripple.py similarity index 100% rename from res/notes/dripple.py rename to res/notes/transitions/dripple.py diff --git a/res/notes/dstar.py b/res/notes/transitions/dstar.py similarity index 100% rename from res/notes/dstar.py rename to res/notes/transitions/dstar.py diff --git a/res/notes/foursquare.py b/res/notes/transitions/foursquare.py similarity index 100% rename from res/notes/foursquare.py rename to res/notes/transitions/foursquare.py diff --git a/res/notes/foursquare.txt b/res/notes/transitions/foursquare.txt similarity index 100% rename from res/notes/foursquare.txt rename to res/notes/transitions/foursquare.txt diff --git a/res/notes/halfblock.txt b/res/notes/transitions/halfblock.txt similarity index 100% rename from res/notes/halfblock.txt rename to res/notes/transitions/halfblock.txt diff --git a/res/notes/iris.py b/res/notes/transitions/iris.py similarity index 100% rename from res/notes/iris.py rename to res/notes/transitions/iris.py diff --git a/res/notes/iris.txt b/res/notes/transitions/iris.txt similarity index 100% rename from res/notes/iris.txt rename to res/notes/transitions/iris.txt diff --git a/res/notes/onesquare.py b/res/notes/transitions/onesquare.py similarity index 100% rename from res/notes/onesquare.py rename to res/notes/transitions/onesquare.py diff --git a/res/notes/onesquare.txt b/res/notes/transitions/onesquare.txt similarity index 100% rename from res/notes/onesquare.txt rename to res/notes/transitions/onesquare.txt diff --git a/res/notes/radial.py b/res/notes/transitions/radial.py similarity index 100% rename from res/notes/radial.py rename to res/notes/transitions/radial.py diff --git a/res/notes/ripple.py b/res/notes/transitions/ripple.py similarity index 100% rename from res/notes/ripple.py rename to res/notes/transitions/ripple.py diff --git a/res/notes/ripple2.py b/res/notes/transitions/ripple2.py similarity index 100% rename from res/notes/ripple2.py rename to res/notes/transitions/ripple2.py diff --git a/res/notes/star.py b/res/notes/transitions/star.py similarity index 100% rename from res/notes/star.py rename to res/notes/transitions/star.py diff --git a/res/notes/sunrise.py b/res/notes/transitions/sunrise.py similarity index 100% rename from res/notes/sunrise.py rename to res/notes/transitions/sunrise.py diff --git a/src/4cade.a b/src/4cade.a index f05f6099e..c30011d26 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -45,7 +45,8 @@ Main jsr Play + bit $C010 - jsr AttractMode +; jsr AttractMode + jsr SearchMode jmp @loop ; these routines will only be called after relocating to language card @@ -59,6 +60,7 @@ Main !source "src/glue.prorwts2.a" !source "src/okvs.a" !source "src/wait.a" + !source "src/textrank.a" !source "src/parse.common.a" !source "src/parse.prefs.a" !source "src/parse.games.a" diff --git a/src/macros.a b/src/macros.a index f867cf88f..f3a3bdb5c 100644 --- a/src/macros.a +++ b/src/macros.a @@ -108,3 +108,12 @@ jsr LoadFile !word gPathname } + +!macro LOW_ASCII_TO_LOWER { + cmp #$41 + bcc + + cmp #$5B + bcs + + ora #$20 ++ +} diff --git a/src/textrank.a b/src/textrank.a new file mode 100644 index 000000000..78ad3d089 --- /dev/null +++ b/src/textrank.a @@ -0,0 +1,181 @@ +;license:MIT +;(c) 2018 by 4am +; +; text rank - an implementation of the Quicksilver search rank algorithm +; +; Public functions +; - TextRankCallback (as okvs_iter_values callback) +; +; Public variables +; - InputLength +; - InputBuffer +; - SelectedIndex +; - MatchCount +; - BestMatchScore +; - BestMatchIndex + +zpword = $F0 ; word +zpstring = $F2 ; word +runningscore= $F4 ; word +startat = $F6 ; byte +i = $F7 ; byte +tmp = $F8 ; byte +gamelength= $F9 ; byte +firstletter= $FA ; byte + +MaxInputLength = 24 +InputLength + !byte 0 +InputBuffer + !text " " +SelectedIndex + !byte $FF +MatchCount + !byte 0 +BestMatchScore + !byte 0 +BestMatchIndex + !byte 0 + +;------------------------------------------------------------------------------ +; TextRankCallback +; callback called by okvs_iter_values on gGamesListStore +; to calculate a ranking score for a single game title +; against the current InputBuffer + +; in: A/Y contains address of game title +; X contains 0-based index of the current record in gGamesListStore +; out: all registers and flags clobbered +; MatchCount possibly incremented (if this title was a match at all) +; BestMatchScore and BestMatchIndex possibly updated (if this title +; was the best match so far) +;------------------------------------------------------------------------------ +TextRankCallback + stx @tmpx ; X = OKVS index of this title + +STAY zpstring ; A/Y = address of this title + +LDADDR InputLength + +STAY zpword +; ldy #0 ; first we'll check for an exact match +; lda (zpstring),y ; check length of this title against the input buffer +; sta gamelength +; cmp InputLength +; bne + ; not equal, so can't be an exact match +; tay ; check for exact match +;- lda (zpword),y +; cmp (zpstring),y +; bne + ; nope, not an exact match +; dey +; bne - +; inc MatchCount +; lda #100 ; maximum possible score +; sta BestMatchScore +; ldx @tmpx ; save this game as the best match +; stx BestMatchIndex +; rts +;+ + lda #0 + sta runningscore + sta runningscore+1 + ldy #1 + sty startat +- sty i + lda (zpword),y + +LOW_ASCII_TO_LOWER + sta tmp + ldy startat +-- lda (zpstring),y + +LOW_ASCII_TO_LOWER + cmp tmp + beq + + cpy gamelength + iny + bcc -- + rts ; no match :( ++ + ldx #80 + cpy startat + beq + + ldx #10 + cpy #1 + beq + + dey + lda (zpstring),y + iny + cmp #' ' + bne + + ldx #90 ++ txa + clc + adc runningscore + sta runningscore + bcc + + inc runningscore+1 ++ iny + sty startat + ldy i + cpy InputLength + iny + bcc - + + lda runningscore + ldx runningscore+1 + ldy gamelength + jsr @div + sta tmp + lda runningscore + ldx runningscore+1 + ldy InputLength + jsr @div + clc + adc tmp + lsr + pha + ldy #1 + lda (zpstring),y + sta firstletter + pla + ldx InputBuffer + cpx firstletter + bne + + cmp #85 + bcs + + adc #15 ++ + cmp BestMatchScore + bcc + + sta BestMatchScore + ldx @tmpx + stx BestMatchIndex + inc MatchCount ++ + rts + +@div + sta @num1 + stx @num1+1 + sty @num2 + + lda #0 + sta @rem + sta @rem+1 + ldx #16 +- asl @num1 + rol @num1+1 + rol @rem + rol @rem+1 + lda @rem + sec + sbc @num2 + bcc + + sta @rem + dec @rem+1 + inc @num1 ++ dex + bne - + lda @num1 + rts + +@rem !word 0 +@num1 !word 0 +@num2 !byte 0 +@tmpx !byte $FD diff --git a/src/ui.search.mode.a b/src/ui.search.mode.a index 9e25784d4..2a2921687 100644 --- a/src/ui.search.mode.a +++ b/src/ui.search.mode.a @@ -7,61 +7,157 @@ ; - SearchMode ; -MaxInputLength = 24 +; indices into InputDispatchTable +kInputBackspace= 1 +kInputEnter = 2 +kInputSearchKey= 3 +InputDispatchTable + !word 0 + !word OnBackspace + !word OnEnter + !word OnKey SearchMode jsr Home ; switches to text mode - jsr LoadFile ; load initial background at $2000 + lda #0 + sta InputLength + + jsr OnInputChanged + + bit $C054 ; show it + bit $C052 + bit $C057 + bit $C050 + + bit $C010 +InputLoop +- lda $C000 + bpl - + bit $C010 + and #$7F + + cmp #$7F ; delete key + bne + +- ldx #kInputBackspace + bne InputDispatch ; always branches + ++ cmp #$08 ; left arrow = delete + beq - + + cmp #$0D ; ENTER launches the current game (if any) + bne + + ldx #kInputEnter + bne InputDispatch ; always branches ++ + cmp #$30 ; control keys and punctuation ignored + bcc @badkey + cmp #$3A ; numbers are good input + bcc @goodkey + cmp #$41 ; more punctuation (also ignored) + bcc @badkey + cmp #$5B ; uppercase letters are good input + bcs + + ora #$20 ; convert uppercase letters to lowercase + bne @goodkey ; always branches + ++ cmp #$61 ; more punctuation (also ignored) + bcc @badkey + cmp #$7B ; lowercase letters are good input + bcc @goodkey + ; execution falls through here +@badkey + jsr SoftBell ; beep on invalid input + jmp InputLoop ; and start over + +@goodkey + ldx #kInputSearchKey + ; execution falls through here +InputDispatch + pha ; save key pressed + txa + asl + tax + lda InputDispatchTable,x + sta @j+1 + lda InputDispatchTable+1,x + sta @j+2 + pla ; restore key pressed +@j jsr $FDFD ; SMC + jmp InputLoop + +OnBackspace + ldx InputLength + bne + + jsr SoftBell + rts ++ dec InputLength + jmp OnInputChanged + +OnEnter + ; TODO + jmp $ff59 + +OnKey + ldx InputLength + cpx #MaxInputLength + bne + + jsr SoftBell + rts ++ sta InputBuffer,x + inc InputLength + ; execution falls through here + +OnInputChanged + lda InputLength + bne @findMatchingTitle + ; no input, reset params and UI + lda #$FF + sta SelectedIndex ; reset selected index + ldy #MaxInputLength ; clear visible search bar + lda #" " +- sta UILine2+1,y + dey + bne - + lda #$7F + sta UILine2+1 + + jsr LoadFile ; load default background at $2000 !word Cover - lda #22 ; draw search UI on top of background + lda #22 ; draw visible search bar sta VTAB - clc ; draw on page 1 + clc ; on page 1 +LDADDR UILine1 jsr Draw40Chars clc +LDADDR UILine2 - jsr Draw40Chars + jmp Draw40Chars - bit $c054 ; show it - bit $c052 - bit $c057 - bit $c050 - -@loop - bit $c010 -- lda $c000 - bpl - - - ldx InputLength - cpx MaxInputLength - beq @loop - - sta InputBuffer,x - inc InputLength - jsr OnInputChanged - - jmp @loop - -OnInputChanged - lda #0 - sta MatchCount +@findMatchingTitle + lda #0 ; reset match count + sta MatchCount ; TextRankCallback will increment this if + ; there are any matches jsr okvs_iter_values !word gGamesListStore - !word RankSearchResult - - lda MatchCount - beq @nomatches + !word TextRankCallback + lda MatchCount ; check match count + bne @yeschange + jsr SoftBell ; no matches for this input buffer, beep + dec InputLength ; and ignore the last key typed +@nochange + rts +@yeschange lda BestMatchIndex - cmp SelectedIndex - beq @nochange + cmp SelectedIndex ; we found a 'new' best match but it's the + beq @nochange ; same as the current match, so we're done + ; TODO re-highlight here - sta SelectedIndex - sta @index - jsr okvs_nth + sta SelectedIndex ; we have a new best match, so load the + sta @index ; new title screenshot and display the + jsr okvs_nth ; new game title in the search bar !word gGamesListStore @index !byte $FD +STAY @key @@ -72,58 +168,88 @@ OnInputChanged jsr okvs_get !word gGamesListStore @key !word $FDFD - ; TODO A/Y points to visible title string now + +STAY SRC ; A/Y points to game title (in OKVS) + ldy #0 ; copy game title into search bar buffer + lda (SRC),y + sta SAVE ; game title length + inc SAVE +- iny + cpy SAVE + bcc + + lda #" " + +HIDE_NEXT_2_BYTES ++ lda (SRC),y + sta UILine2,y + cpy #MaxInputLength+1 + bcc - -@nochange - ; TODO - clc - rts -@nomatches - ; TODO + lda #22 ; draw search bar + sta VTAB + sec ; on page 2, not currently visible + +LDADDR UILine1 + jsr Draw40Chars sec + +LDADDR UILine2 + jsr Draw40Chars + + bit $C055 ; show page 2 + ldx #$20 ; copy back to page 1 + stx @b+2 ; TODO delete this and use LoadFileAt + lda #$40 ; to load title screenshots on different + sta @a+2 ; pages + ldy #0 +@a lda $4000,y +@b sta $2000,y + iny + bne @a + inc @a+2 + inc @b+2 + dex + bne @a + bit $C054 ; show page 1 rts -RankSearchResult -zpword = $0 -zpstring = $2 -runningscore = $4 -startat = $6 -i = $7 -tmp = $8 - stx @tmpx - +STAY zpstring - +LDADDR InputLength - +STAY zpword - ldy #0 - lda (zpstring),y - cmp InputLength - bne + -- lda (zpword),y - cmp (zpstring),y - bne + - dey +;------------------------------------------------------------------------------ +; SoftBell +; +; in: none +; out: all registers and flags preserved +;------------------------------------------------------------------------------ +SoftBell + php + pha + txa + pha + ldx #32 +- lda #2 + jsr Wait + bit $C030 + lda #33 + jsr Wait + bit $C030 + dex bne - - lda #100 + pla + tax + pla + plp rts -+ -@tmpx !byte $FD + +Wait ; identical to $FCA8 ROM routine, but ROM is switched out when we need it + sec +-- pha +- sbc #1 + bne - + pla + sbc #1 + bne -- + rts + +;------------------------------------------------------------------------------ Cover !byte 5 !text "COVER" -InputLength - !byte 0 -InputBuffer - !text " " -SelectedIndex ; only valid if InputLength > 0 - !byte $FF -MatchCount ; only valid during OnInputChanged - !byte 0 -BestMatchScore ; only valid during OnInputChanged - !byte 0 -BestMatchIndex ; only valid during OnInputChanged, and only if MatchCount > 0 - !byte 0 - UILine1 !byte 0,0,0,0,0,0,0,0,0,0 !byte 0,0,0,0,0,0,0,0,0,0 @@ -131,9 +257,7 @@ UILine1 !byte 0,0,0,0,0,0,0,0,0,0 UILine2 -; !text "0123456789012345678901234567890123456789" !text "[" !byte $7F -; !text "Championship Lode Runner_" !text " " !text "] 000 games"