mirror of
https://github.com/a2-4am/4cade.git
synced 2024-09-13 14:56:27 +00:00
shave some bytes
This commit is contained in:
parent
c35a799f5b
commit
a57d086810
@ -132,6 +132,8 @@ gGlobalPrefsStore
|
||||
; which is apparently one of the acceptable values)
|
||||
gGamesListStore
|
||||
!word $FDFD ; SMC
|
||||
StoreAYAndSwitchToBank2
|
||||
+ST16 PTR
|
||||
SwitchToBank2
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
rts
|
||||
|
@ -7,7 +7,7 @@
|
||||
;
|
||||
; LC RAM BANK 1
|
||||
; D000..E789 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
||||
; E97B..FFF1 - main program code
|
||||
; E979..FFF1 - main program code
|
||||
; FFF2..FFF9 - API functions and global constants available for main program
|
||||
; code, prelaunchers, transition effects, &c.
|
||||
; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
|
||||
@ -17,7 +17,7 @@
|
||||
; D000..D3FF - ProRWTS data
|
||||
; D400..D66F - ProRWTS code
|
||||
; D670..DB91 - HGR font code & ProRWTS glue code
|
||||
; DB5C..DB6B - backup of stack (during gameplay and self-running demos)
|
||||
; DB4D..DB5C - backup of stack (during gameplay and self-running demos)
|
||||
; ...unused...
|
||||
; DBB4..DBFF - (de)acceleration function
|
||||
; DC00..DFFF - HGR font data
|
||||
|
@ -14,12 +14,12 @@
|
||||
;
|
||||
|
||||
DrawString
|
||||
jsr SwitchToBank2
|
||||
jsr StoreAYAndSwitchToBank2
|
||||
jsr DrawStringInternal
|
||||
bmi JmpSwitch ; always
|
||||
bne JmpSwitch ; always
|
||||
|
||||
DrawPage
|
||||
jsr SwitchToBank2
|
||||
jsr StoreAYAndSwitchToBank2
|
||||
jsr DrawPageInternal
|
||||
|
||||
JmpSwitch
|
||||
@ -31,6 +31,6 @@ Draw40Chars
|
||||
beq JmpSwitch ; always
|
||||
|
||||
DrawCenteredString
|
||||
jsr SwitchToBank2
|
||||
jsr StoreAYAndSwitchToBank2
|
||||
jsr DrawCenteredStringInternal
|
||||
bmi JmpSwitch ; always
|
||||
bne JmpSwitch ; always
|
||||
|
@ -9,7 +9,7 @@
|
||||
;
|
||||
|
||||
DrawPageInternal
|
||||
; A/Y contains address of array of length-prefixed strings
|
||||
; PTR contains address of array of length-prefixed strings
|
||||
; length #$FF terminates
|
||||
; X contains 0-indexed left margin (HTAB)
|
||||
; carry bit clear -> draw on page 1
|
||||
@ -17,18 +17,17 @@ DrawPageInternal
|
||||
; drawing starts at VTAB 0
|
||||
; each line starts at column X which was passed in (0-indexed)
|
||||
; clobbers PTR
|
||||
; clobbers $FE/$FF
|
||||
; clobbers $FF
|
||||
; clobbers A/X/Y
|
||||
; preserves C, other flags clobbered
|
||||
stx $FF
|
||||
ldx #0
|
||||
stx VTAB
|
||||
+ST16 PTR
|
||||
php ; save C, but Z=1 because of ldx #0
|
||||
@drawLine
|
||||
lda $FF
|
||||
sta HTAB
|
||||
jsr DrawStringInternal_PTR_is_already_set
|
||||
jsr DrawStringInternal
|
||||
bmi @donePage
|
||||
clc
|
||||
adc PTR
|
||||
@ -50,6 +49,7 @@ Draw40CharsInternal
|
||||
; drawing starts at HTAB 0
|
||||
; increments VTAB on exit
|
||||
; sets HTAB to 0 on exit
|
||||
; Z=1 on exit
|
||||
; clobbers A/X/Y
|
||||
jsr +
|
||||
ldx #40
|
||||
@ -59,36 +59,30 @@ Draw40CharsInternal
|
||||
rts
|
||||
|
||||
DrawCenteredStringInternal
|
||||
; A/Y contains address of length-prefixed string
|
||||
; PTR contains address of length-prefixed string
|
||||
; carry bit clear -> draw on page 1
|
||||
; carry bit set -> draw on page 2
|
||||
; $25 contains textpage line (0..23) (this is the standard VTAB address)
|
||||
; clobbers A/X/Y
|
||||
; clobbers PTR/PTR+1
|
||||
+ST16 PTR
|
||||
ldy #0
|
||||
php
|
||||
ldy #0
|
||||
lda #40
|
||||
sec
|
||||
sbc (PTR),y
|
||||
lsr
|
||||
sta HTAB
|
||||
plp
|
||||
beq DrawStringInternal_PTR_and_Y_are_already_set
|
||||
; /!\ execution falls through here to DrawStringInternal
|
||||
|
||||
DrawStringInternal
|
||||
; A/Y contains address of length-prefixed string
|
||||
; PTR contains address of length-prefixed string
|
||||
; length can be 0
|
||||
; carry bit clear -> draw on page 1
|
||||
; carry bit set -> draw on page 2
|
||||
; $24 contains starting column (0..39) (this is the standard HTAB address)
|
||||
; $25 contains textpage line (0..23) (this is the standard VTAB address)
|
||||
; clobbers A/X/Y
|
||||
; clobbers PTR/PTR+1
|
||||
+ST16 PTR
|
||||
DrawStringInternal_PTR_is_already_set
|
||||
ldy #0
|
||||
DrawStringInternal_PTR_and_Y_are_already_set
|
||||
lda (PTR),y
|
||||
inc PTR
|
||||
bne +
|
||||
@ -114,7 +108,7 @@ DrawBufferInternal
|
||||
; clobbers X,Y
|
||||
; increments VTAB on exit
|
||||
; A=buffer length on exit
|
||||
; N=0 on exit
|
||||
; N=0,Z=0 on exit
|
||||
+ST16 DBISrc+1
|
||||
php
|
||||
lda VTAB
|
||||
|
Loading…
Reference in New Issue
Block a user