From 9ec08f84302279da0809c4a2476ab90e66b8ced0 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Fri, 13 Mar 2020 17:11:59 -0700 Subject: [PATCH] cut some bytes --- src/4cade.a | 4 +++- src/constants.a | 4 ++-- src/parse.games.a | 5 ++--- src/ui.common.a | 43 ++++++------------------------------------- src/ui.offscreen.a | 15 +++++++++++++++ src/ui.search.mode.a | 13 ++----------- 6 files changed, 30 insertions(+), 54 deletions(-) diff --git a/src/4cade.a b/src/4cade.a index 7236f31ed..13dbf5c5c 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -79,7 +79,9 @@ RestoreStackNextTime STACKPTR ldx #$D1 ; SMC, restore stack pointer txs - jmp SwitchToBank1 ; switch to bank 1 and return to caller +SwitchToBank1 + +READ_RAM1_WRITE_RAM1 + rts ResetVector ; 6 bytes, copied to $100 +READ_RAM1_NO_WRITE jmp Reenter diff --git a/src/constants.a b/src/constants.a index 19773758a..cf34e7351 100644 --- a/src/constants.a +++ b/src/constants.a @@ -6,10 +6,10 @@ ; YE OLDE GRAND UNIFIED MEMORY MAP ; ; LC RAM BANK 1 -; D000..E891 - persistent data structures (per-game cheat categories, +; D000..E8A7 - persistent data structures (per-game cheat categories, ; gGlobalPrefsStore, gGamesListStore) ; ...unused... -; EA6F..FFF9 - main program code +; EA96..FFF9 - main program code ; FFFA..FFFF - NMI, reset, IRQ vectors ; ; LC RAM BANK 2 diff --git a/src/parse.games.a b/src/parse.games.a index e0e61e979..f191b7f7d 100644 --- a/src/parse.games.a +++ b/src/parse.games.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018-9 by 4am +;(c) 2018-2020 by 4am ; ; GAMES.CONF parser ; @@ -88,8 +88,7 @@ ParseGamesList pla ; pop cheat category sta gVal,x ; store after game title pla ; pop DHGR title - clc - ror + lsr ror ora gVal,x sta gVal,x ; store in bit 7 of same byte as cheat category diff --git a/src/ui.common.a b/src/ui.common.a index 82d4a1640..522047407 100755 --- a/src/ui.common.a +++ b/src/ui.common.a @@ -4,36 +4,12 @@ ; miscellaneous UI functions ; ; Public functions -; - ClearScreens ; - Home ; - BlankDHGR ; - IsSearchKey ; - IsUpDownOrRightArrow ; -;------------------------------------------------------------------------------ -; ClearScreens -; clear and display text screen and then clear both hires screens -; (in this order so that the erasing isn't visible) -; -; in: none -; out: $0106..$011F clobbered -;------------------------------------------------------------------------------ -ClearScreens - jsr Home - lda #$20 ; clear both hi-res pages - sta @clear+2 ; (in case game loader shows them, we don't want - ldx #$40 ; to flash previous bits of the launcher UI) - ldy #$00 - tya -@clear sta $FD00,y ; SMC - iny - bne @clear - inc @clear+2 - dex - bne @clear - rts - ;------------------------------------------------------------------------------ ; Home ; clear and display text screen (HARDER THAN IT SOUNDS) @@ -58,24 +34,17 @@ Home sta CLOCKCTL ; set twice for VidHD @noSHR sta gMachineInDHGRMode ; A=0 here + ldy #$2C ; BIT + sty PageFrom + ldx #$04 + stx PageTo+2 lda #$A0 ; clear text screen page 1 - ldx #$77 ; but preserve screen holes -- sta $400,x - sta $480,x - sta $500,x - sta $580,x - sta $600,x - sta $680,x - sta $700,x - sta $780,x - dex - bpl - + jsr ClearGR + sta DHIRESOFF ; get out of DHGR mode sta CLR80VID ; /!\ order of operations matters for RGB card lda PAGE1 lda TEXTMODE -SwitchToBank1 ; unnecessary but harmless (and has to be somewhere) - +READ_RAM1_WRITE_RAM1 rts ;------------------------------------------------------------------------------ diff --git a/src/ui.offscreen.a b/src/ui.offscreen.a index 01a05b805..3cac8d46c 100644 --- a/src/ui.offscreen.a +++ b/src/ui.offscreen.a @@ -11,6 +11,7 @@ ; - ResyncPage ; - ShowOtherPage ; - ToggleOffscreenPage +; - ClearScreens ; - ClearOffscreen ; - ClearHGR1 ; - ClearMem @@ -115,6 +116,20 @@ LoadGameTitleOffscreen + !word $FDFD rts +;------------------------------------------------------------------------------ +; ClearScreens +; clear and display text screen and then clear both hires screens +; (in this order so that the erasing isn't visible) +; +; in: none +; out: $400..$7FF and $2000..$5FFF cleared +;------------------------------------------------------------------------------ +ClearScreens + jsr Home + lda #$20 ; clear both hi-res pages + ldx #$40 ; to flash previous bits of the launcher UI) + bne ClearMem ; always + ;------------------------------------------------------------------------------ ; ClearOffscreen ; clear $2000..$3FFF or $4000..$5FFF, depending on which HGR page is not diff --git a/src/ui.search.mode.a b/src/ui.search.mode.a index 5d579dd38..5a1069b77 100644 --- a/src/ui.search.mode.a +++ b/src/ui.search.mode.a @@ -214,24 +214,15 @@ OnError SoftBell ldx #32 - lda #2 - jsr @wait + jsr WaitForKeyWithTimeout bit SPEAKER lda #33 - jsr @wait + jsr WaitForKeyWithTimeout bit SPEAKER dex bne - clc 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 + ldx BestMatchIndex ; check if the new best match is the same