mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-27 08:50:01 +00:00
WIP search mode
This commit is contained in:
parent
1c7d40de87
commit
eaadce7b8a
@ -64,6 +64,7 @@ Main
|
||||
!source "src/parse.common.a"
|
||||
!source "src/parse.prefs.a"
|
||||
!source "src/parse.games.a"
|
||||
!source "src/ui.sound.a"
|
||||
!source "src/ui.font.a"
|
||||
!source "src/ui.font.data.a"
|
||||
gGlobalPrefsStore
|
||||
|
@ -150,3 +150,68 @@ DrawBuffer
|
||||
dex
|
||||
bpl @loop
|
||||
rts
|
||||
|
||||
InvertChar
|
||||
; inverts a character already drawn to the screen
|
||||
; carry bit clear -> draw on page 1
|
||||
; carry bit set -> draw on page 2
|
||||
; $24 contains textpage column (0..39) (this is the standard HTAB address)
|
||||
; $25 contains textpage line (0..23) (this is the standard VTAB address)
|
||||
; HTAB is NOT incremented
|
||||
; VTAB is NOT incremented
|
||||
; clobbers A
|
||||
; preserves X/Y
|
||||
bcs +
|
||||
lda #$00
|
||||
+HIDE_NEXT_2_BYTES
|
||||
+
|
||||
lda #$60
|
||||
sta @pagemask
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
lda VTAB
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
; routine to calculate memory address within HGR page
|
||||
; (routine clobbers A and Y but preserves X)
|
||||
asl
|
||||
tay
|
||||
and #$F0
|
||||
bpl @calc1
|
||||
ora #$05
|
||||
@calc1 bcc @calc2
|
||||
ora #$0A
|
||||
@calc2 asl
|
||||
asl
|
||||
sta @hgrlo+1
|
||||
tya
|
||||
and #$0E
|
||||
adc #$10
|
||||
asl @hgrlo+1
|
||||
rol
|
||||
@pagemask=*+1
|
||||
eor #$FD ; SMC (0=hi-res page 1, #$60=hi-res page 2)
|
||||
sta DEST+1
|
||||
@hgrlo lda #$FD
|
||||
clc
|
||||
adc HTAB
|
||||
sta DEST
|
||||
ldx #8
|
||||
ldy #0
|
||||
- lda (DEST),y
|
||||
eor #$7F
|
||||
sta (DEST),y
|
||||
lda DEST+1
|
||||
clc
|
||||
adc #$04
|
||||
sta DEST+1
|
||||
dex
|
||||
bne -
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
rts
|
||||
|
@ -8,14 +8,14 @@
|
||||
;
|
||||
|
||||
; indices into InputDispatchTable
|
||||
kInputSearchKey= 0
|
||||
kInputBackspace= 1
|
||||
kInputEnter = 2
|
||||
kInputSearchKey= 3
|
||||
|
||||
InputDispatchTable
|
||||
!word 0
|
||||
!word OnSearchKey
|
||||
!word OnBackspace
|
||||
!word OnEnter
|
||||
!word OnKey
|
||||
|
||||
SearchMode
|
||||
jsr Home ; switches to text mode
|
||||
@ -96,9 +96,9 @@ OnBackspace
|
||||
|
||||
OnEnter
|
||||
; TODO
|
||||
jmp $ff59
|
||||
rts
|
||||
|
||||
OnKey
|
||||
OnSearchKey
|
||||
ldx InputLength
|
||||
cpx #MaxInputLength
|
||||
bne +
|
||||
@ -135,9 +135,12 @@ OnInputChanged
|
||||
jmp Draw40Chars
|
||||
|
||||
@findMatchingTitle
|
||||
lda #0 ; reset match count
|
||||
sta MatchCount ; TextRankCallback will increment this if
|
||||
ldx #0 ; reset match count
|
||||
stx MatchCount ; TextRankCallback will increment this if
|
||||
; there are any matches
|
||||
stx BestMatchScore
|
||||
dex
|
||||
stx BestMatchIndex
|
||||
|
||||
jsr okvs_iter_values
|
||||
!word gGamesListStore
|
||||
@ -191,6 +194,24 @@ OnInputChanged
|
||||
sec
|
||||
+LDADDR UILine2
|
||||
jsr Draw40Chars
|
||||
dec VTAB
|
||||
ldx #0 ; highlight matched characters
|
||||
ldy #0
|
||||
- lda (SRC),y
|
||||
+LOW_ASCII_TO_LOWER
|
||||
cmp InputBuffer,x
|
||||
bne +
|
||||
sec ; on page 2
|
||||
jsr InvertChar
|
||||
inx
|
||||
cpx InputLength
|
||||
beq @doneHighlight
|
||||
+ inc HTAB
|
||||
iny
|
||||
cpy #MaxInputLength
|
||||
bne -
|
||||
|
||||
@doneHighlight
|
||||
|
||||
bit $C055 ; show page 2
|
||||
ldx #$20 ; copy back to page 1
|
||||
@ -209,42 +230,6 @@ OnInputChanged
|
||||
bit $C054 ; show page 1
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; 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 -
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
|
||||
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
|
||||
|
43
src/ui.sound.a
Normal file
43
src/ui.sound.a
Normal file
@ -0,0 +1,43 @@
|
||||
;license:MIT
|
||||
;(c) 2019 by 4am
|
||||
;
|
||||
; sound effects
|
||||
;
|
||||
; Public functions
|
||||
; - SoftBell
|
||||
;
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; 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 -
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
plp
|
||||
rts
|
||||
@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
|
Loading…
Reference in New Issue
Block a user