mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-27 08:50:01 +00:00
save some bytes
This commit is contained in:
parent
933af60510
commit
f4b1c35e6e
@ -9,7 +9,7 @@
|
||||
; D000..E891 - persistent data structures (per-game cheat categories,
|
||||
; gGlobalPrefsStore, gGamesListStore)
|
||||
; ...unused...
|
||||
; E9E6..FFF9 - main program code
|
||||
; EA6F..FFF9 - main program code
|
||||
; FFFA..FFFF - NMI, reset, IRQ vectors
|
||||
;
|
||||
; LC RAM BANK 2
|
||||
@ -123,7 +123,7 @@ MOCKINGBOARD_SLOT = %00001111
|
||||
HAS_SPEECH = %10000000
|
||||
|
||||
; AND masks for game info bitfield (after game title in gGamesList)
|
||||
HAS_DHGR_TITLE = %10000000
|
||||
HAS_DHGR_TITLE = %10000000 ; this one is hard-coded via BMI instead of AND/BNE
|
||||
CHEAT_CATEGORY = %00001111
|
||||
|
||||
; AND masks for MachineStatus
|
||||
|
12
src/macros.a
12
src/macros.a
@ -11,16 +11,12 @@
|
||||
!macro PARAMS_ON_STACK .bytes {
|
||||
pla
|
||||
sta PARAM
|
||||
pla
|
||||
tax
|
||||
stx PARAM+1
|
||||
lda #.bytes
|
||||
clc
|
||||
adc PARAM
|
||||
adc #.bytes
|
||||
tay
|
||||
bcc +
|
||||
inx
|
||||
+ txa
|
||||
pla
|
||||
sta PARAM+1
|
||||
adc #0
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
|
12
src/okvs.a
12
src/okvs.a
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;(c) 2018-2020 by 4am
|
||||
;
|
||||
; Ordered key/value store (6502 compatible)
|
||||
;
|
||||
@ -127,7 +127,7 @@ okvs_append
|
||||
; PTR -> store
|
||||
; Y = 0
|
||||
lda (PTR),y ; A = number of keys in store
|
||||
clc
|
||||
;;clc
|
||||
adc #1
|
||||
pha ; will return this later
|
||||
sta (PTR),y ; increment number of keys
|
||||
@ -155,7 +155,7 @@ okvs_append
|
||||
cpy #$FF
|
||||
bne -
|
||||
|
||||
sec
|
||||
;;sec
|
||||
txa
|
||||
adc PTR ; update PTR to byte after copied key
|
||||
sta PTR
|
||||
@ -163,7 +163,7 @@ okvs_append
|
||||
inc PTR+1
|
||||
+ ; PTR -> space for new value
|
||||
+LDPARAMPTR 5, SRC ; SRC -> new value to copy
|
||||
ldy #7
|
||||
iny ;;ldy #7
|
||||
lda (PARAM),y ; get max length of value
|
||||
tax
|
||||
bne +
|
||||
@ -260,8 +260,8 @@ KEYLEN = *+1
|
||||
adc KEYLEN
|
||||
bcc +
|
||||
iny
|
||||
+ clc
|
||||
adc #2
|
||||
clc
|
||||
+ adc #2
|
||||
sta PTR
|
||||
bcc +
|
||||
iny
|
||||
|
@ -1,5 +1,5 @@
|
||||
;License:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;(c) 2018-2020 by 4am
|
||||
;
|
||||
; functions for animated title screens
|
||||
;
|
||||
@ -28,9 +28,9 @@ MaybeAnimateTitle
|
||||
eor #$60
|
||||
+ sta SAVE+1
|
||||
and #$60
|
||||
sta @a+2
|
||||
sta PageFrom+2
|
||||
eor #$60
|
||||
sta @b+2
|
||||
tax
|
||||
lda #$FD
|
||||
sta SAVE
|
||||
ldy #0
|
||||
@ -41,17 +41,8 @@ MaybeAnimateTitle
|
||||
; file -- this area part of a 'screen
|
||||
; hole' and is not displayed on screen)
|
||||
bne @exit ; if not, we're done here
|
||||
|
||||
; copy one HGR screen to the other
|
||||
ldx #$20
|
||||
@a lda $FD00,y ; SMC
|
||||
@b sta $FD00,y ; SMC
|
||||
iny
|
||||
bne @a
|
||||
inc @a+2
|
||||
inc @b+2
|
||||
dex
|
||||
bne @a
|
||||
txa
|
||||
jsr CopyHGR
|
||||
|
||||
; load the animation routine, which is stored in a subdirectory by filename
|
||||
jsr GetGameToLaunch
|
||||
|
@ -318,32 +318,13 @@ RedrawForDHGR
|
||||
; $0200..$02CB clobbered by decompressor
|
||||
;------------------------------------------------------------------------------
|
||||
DecompressDHGR
|
||||
jsr SwitchToBank2
|
||||
jsr EnableAccelerator
|
||||
clc
|
||||
lda sizelo2
|
||||
adc #$F8
|
||||
sta _byte_lo
|
||||
lda sizehi2
|
||||
adc #$3F
|
||||
sta _byte_hi
|
||||
sta $C003
|
||||
sta $C005
|
||||
jsr decrunch
|
||||
jsr DecompressHGR
|
||||
sta $C004
|
||||
lda #$60
|
||||
sta @copyaux+2
|
||||
sta PageFrom+2
|
||||
lda #$40
|
||||
sta @copyaux+5
|
||||
ldy #0
|
||||
@copyaux
|
||||
lda $D100, y ; SMC
|
||||
sta $D100, y ; SMC
|
||||
iny
|
||||
bne @copyaux
|
||||
inc @copyaux+5
|
||||
inc @copyaux+2
|
||||
bpl @copyaux
|
||||
jsr CopyHGR
|
||||
sta $C002
|
||||
jsr DisableAccelerator
|
||||
jmp SwitchToBank1
|
||||
rts
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;(c) 2018-2020 by 4am
|
||||
;
|
||||
; GR action slideshows
|
||||
;
|
||||
@ -52,16 +52,12 @@ GRSingle
|
||||
; graphics mode set to display lo-res screen
|
||||
;------------------------------------------------------------------------------
|
||||
BlankGR
|
||||
ldy #$2C ; BIT
|
||||
sty PageFrom
|
||||
ldx #$04
|
||||
stx @loop+2
|
||||
stx PageTo+2
|
||||
lda #0
|
||||
tay
|
||||
@loop sta $FD00,y
|
||||
iny
|
||||
bne @loop
|
||||
inc @loop+2
|
||||
dex
|
||||
bne @loop
|
||||
jsr ClearGR
|
||||
bit PAGE1
|
||||
bit $C056 ; set GR mode
|
||||
jmp GRMode
|
||||
|
@ -173,15 +173,18 @@ HGRActionCallback
|
||||
; $0200..$02CB clobbered by decompressor
|
||||
;------------------------------------------------------------------------------
|
||||
DecompressHGR
|
||||
lda #$3F
|
||||
|
||||
DecompressCommon
|
||||
pha
|
||||
jsr SwitchToBank2
|
||||
jsr EnableAccelerator
|
||||
clc
|
||||
lda sizelo2
|
||||
adc #$F8
|
||||
sta _byte_lo
|
||||
lda sizehi2
|
||||
adc #$3F
|
||||
pla
|
||||
adc sizehi2
|
||||
sta _byte_hi
|
||||
jsr decrunch
|
||||
jsr DisableAccelerator
|
||||
jmp SwitchToBank1
|
||||
jmp DisableAcceleratorAndSwitchToBank1
|
||||
|
@ -121,13 +121,13 @@ BlankSHR
|
||||
jsr Home
|
||||
|
||||
lda NEWVIDEO ; set GS NEWVIDEO mode to turn on linearize
|
||||
ora #%01000000
|
||||
ora #%01000000 ; can't use TSB here - might not be 65816
|
||||
sta NEWVIDEO
|
||||
|
||||
sta WRITEAUXMEM ; writes go to auxmem
|
||||
|
||||
lda SHADOW ; enable auxmem-to-bank-E1 shadowing on IIgs
|
||||
and #$F7
|
||||
and #$F7 ; can't use TRB here - might not be 65816
|
||||
sta SHADOW
|
||||
|
||||
lda #$20 ; clear $2000..$9FFF in auxmem
|
||||
@ -137,7 +137,7 @@ BlankSHR
|
||||
sta WRITEMAINMEM ; writes go to main memory
|
||||
|
||||
lda NEWVIDEO ; set GS NEWVIDEO mode to turn on SHR mode
|
||||
ora #%10000001
|
||||
ora #%10000001 ; can't use TSB here - might not be 65816
|
||||
sta NEWVIDEO
|
||||
|
||||
rts
|
||||
@ -154,15 +154,6 @@ BlankSHR
|
||||
; $0200..$02CB clobbered by decompressor
|
||||
;------------------------------------------------------------------------------
|
||||
DecompressSHR
|
||||
jsr SwitchToBank2
|
||||
jsr EnableAccelerator
|
||||
clc
|
||||
lda sizelo2
|
||||
adc #$F8
|
||||
sta _byte_lo
|
||||
lda sizehi2
|
||||
adc #$1F
|
||||
sta _byte_hi
|
||||
jsr decrunch
|
||||
jsr DisableAccelerator
|
||||
jmp SwitchToBank1
|
||||
lda #$1F
|
||||
jmp DecompressCommon
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;(c) 2018-2020 by 4am
|
||||
;
|
||||
; credits page
|
||||
;
|
||||
@ -26,7 +26,7 @@ Credits
|
||||
lda OffscreenPage
|
||||
ror ; draw on offscreen page
|
||||
+LDADDR $8000
|
||||
ldx #0
|
||||
tax
|
||||
jsr DrawPage ; draw credits
|
||||
jsr ShowOtherPage ; show credits
|
||||
jsr WaitForKeyFor30Seconds; wait
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;(c) 2018-2020 by 4am
|
||||
;
|
||||
; hi-res font drawing routines
|
||||
;
|
||||
@ -18,24 +18,26 @@
|
||||
DrawString
|
||||
jsr SwitchToBank2
|
||||
jsr DrawStringInternal
|
||||
jmp SwitchToBank1
|
||||
bmi JmpSwitch ; always
|
||||
|
||||
DrawPage
|
||||
jsr SwitchToBank2
|
||||
jsr DrawPageInternal
|
||||
|
||||
JmpSwitch
|
||||
jmp SwitchToBank1
|
||||
|
||||
Draw40Chars
|
||||
jsr SwitchToBank2
|
||||
jsr Draw40CharsInternal
|
||||
jmp SwitchToBank1
|
||||
beq JmpSwitch ; always
|
||||
|
||||
DrawCenteredString
|
||||
jsr SwitchToBank2
|
||||
jsr DrawCenteredStringInternal
|
||||
jmp SwitchToBank1
|
||||
bmi JmpSwitch ; always
|
||||
|
||||
DrawBuffer
|
||||
jsr SwitchToBank2
|
||||
jsr DrawBufferInternal
|
||||
jmp SwitchToBank1
|
||||
bmi JmpSwitch ; always
|
||||
|
@ -1,5 +1,5 @@
|
||||
;License:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;(c) 2018-2020 by 4am
|
||||
;
|
||||
; functions for managing which HGR page is showing, and doing things on the other one
|
||||
;
|
||||
@ -94,8 +94,8 @@ LoadGameTitleOffscreen
|
||||
sta SAVE
|
||||
tay
|
||||
lda (PTR),y ; A = game info bitfield
|
||||
and #HAS_DHGR_TITLE
|
||||
bne @dhgr
|
||||
;;and #HAS_DHGR_TITLE
|
||||
bmi @dhgr
|
||||
@hgr
|
||||
jsr ForceHGRMode
|
||||
jsr GetOffscreenAddress
|
||||
@ -135,17 +135,35 @@ ClearHGR1
|
||||
lda #$20 ; note to self: LDX #$20 can't move here
|
||||
ldx #$20
|
||||
ClearMem
|
||||
sta @a+2
|
||||
ldy #$2C ; BIT
|
||||
bne + ; always
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; CopyHGR
|
||||
;
|
||||
; in: source and destination page pointers set
|
||||
; out: all registers clobbered
|
||||
; 8kb memory region duplicated
|
||||
;------------------------------------------------------------------------------
|
||||
CopyHGR
|
||||
ldx #$20
|
||||
ldy #$B9 ; LDY
|
||||
+ sty PageFrom
|
||||
sta PageTo+2
|
||||
lda #$80
|
||||
ClearGR
|
||||
ldy #0
|
||||
@a sta $2000,y
|
||||
PageFrom lda $FD00,y ; SMC
|
||||
PageTo sta $FD00,y ; SMC
|
||||
iny
|
||||
bne @a
|
||||
inc @a+2
|
||||
bne PageFrom
|
||||
inc PageFrom+2
|
||||
inc PageTo+2
|
||||
dex
|
||||
bne @a
|
||||
bne PageFrom
|
||||
rts
|
||||
|
||||
|
||||
ResyncPage
|
||||
jsr ToggleOffscreenPage
|
||||
; /!\ execution falls through here to ShowOtherPage
|
||||
|
Loading…
Reference in New Issue
Block a user