add okvs_get_current [needs docs]

This commit is contained in:
4am 2019-09-21 20:03:46 -04:00
parent bf940d29d7
commit 241a870eec
4 changed files with 20 additions and 19 deletions

View File

@ -9,7 +9,7 @@
; D000..E5F4 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore)
; ...unused...
; EC22..FFF9 - main program code
; EC28..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors
;
; LC RAM BANK 2

View File

@ -284,6 +284,17 @@ okvs_get
@fail sec
rts
okvs_get_current
+STAY PTR
ldy #0
lda (PTR),y
clc
adc PTR
sta PTR
bcc +
inc PTR+1
+ jmp incptr
;------------------------------------------------------------------------------
; okvs_next
; get (N+1)th key, with wraparound

View File

@ -103,17 +103,12 @@ MiniAttractMode
ldx #$FD ; SMC
+LDADDR gAttractModeStore
jsr okvs_nth ; get the next module on the list
+STAY @key
jsr okvs_get ; get module type
!word gAttractModeStore
@key !word $FDFD ; SMC
+STAY PTR
+STAY SAVE
jsr okvs_get_current ; get module type
ldy #1
lda (PTR),y
tax ; X = module type
+LDAY @key ; A/Y = address of module name
+LDAY SAVE ; A/Y = address of module name
jsr RunAttractModule ; execute the module
inc @MiniAttractIndex

View File

@ -184,15 +184,10 @@ DrawUI
+LDADDR gGamesListStore
jsr okvs_nth
+STAY + ; (A/Y) -> game filename
jsr okvs_get
!word gGamesListStore
+ !word $FDFD
+STAY SRC ; (SRC) -> game title
jsr okvs_get_current
; (PTR) -> game title
ldy #0 ; copy game title into UI line 2
lda (SRC),y
lda (PTR),y
sta SAVE ; title length
inc SAVE
- iny
@ -205,7 +200,7 @@ DrawUI
lda #$FD ; SMC
+HIDE_NEXT_2_BYTES
@printTitleChar
lda (SRC),y
lda (PTR),y
sta UILine2,y
cpy #MaxInputLength+1
bcc -
@ -263,7 +258,7 @@ DrawUI
ldy #0
@dotloop
iny
lda (SRC),y ; (SRC) still points to game title
lda (PTR),y ; (PTR) still points to game title
+LOW_ASCII_TO_LOWER
cmp InputBuffer,x
bne +