From 241a870eec1268678ab9de849527c2adc8acaa4e Mon Sep 17 00:00:00 2001 From: 4am Date: Sat, 21 Sep 2019 20:03:46 -0400 Subject: [PATCH] add okvs_get_current [needs docs] --- src/constants.a | 2 +- src/okvs.a | 11 +++++++++++ src/ui.attract.mode.a | 11 +++-------- src/ui.common.a | 15 +++++---------- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/constants.a b/src/constants.a index 05bce6b4e..d6ac8da7a 100644 --- a/src/constants.a +++ b/src/constants.a @@ -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 diff --git a/src/okvs.a b/src/okvs.a index f009c0d81..9c78a06d1 100644 --- a/src/okvs.a +++ b/src/okvs.a @@ -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 diff --git a/src/ui.attract.mode.a b/src/ui.attract.mode.a index 02c54a7e7..36c4cc95f 100644 --- a/src/ui.attract.mode.a +++ b/src/ui.attract.mode.a @@ -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 diff --git a/src/ui.common.a b/src/ui.common.a index 97ded5277..101bb5274 100644 --- a/src/ui.common.a +++ b/src/ui.common.a @@ -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 +