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, ; D000..E5F4 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore) ; gGlobalPrefsStore, gGamesListStore)
; ...unused... ; ...unused...
; EC22..FFF9 - main program code ; EC28..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors ; FFFA..FFFF - NMI, reset, IRQ vectors
; ;
; LC RAM BANK 2 ; LC RAM BANK 2

View File

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

View File

@ -103,17 +103,12 @@ MiniAttractMode
ldx #$FD ; SMC ldx #$FD ; SMC
+LDADDR gAttractModeStore +LDADDR gAttractModeStore
jsr okvs_nth ; get the next module on the list jsr okvs_nth ; get the next module on the list
+STAY @key +STAY SAVE
jsr okvs_get_current ; get module type
jsr okvs_get ; get module type
!word gAttractModeStore
@key !word $FDFD ; SMC
+STAY PTR
ldy #1 ldy #1
lda (PTR),y lda (PTR),y
tax ; X = module type 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 jsr RunAttractModule ; execute the module
inc @MiniAttractIndex inc @MiniAttractIndex

View File

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