mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-14 12:34:07 +00:00
shave some bytes, fix VIDHD speaker behaviour
This commit is contained in:
parent
1b90260631
commit
532ce58a16
@ -7,7 +7,7 @@
|
||||
;
|
||||
; LC RAM BANK 1
|
||||
; D000..E908 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
|
||||
; E909..FFF1 - main program code
|
||||
; E912..FFF1 - main program code
|
||||
; FFF2..FFF9 - API functions and global constants available for main program
|
||||
; code, prelaunchers, transition effects, &c.
|
||||
; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
|
||||
@ -15,10 +15,10 @@
|
||||
;
|
||||
; LC RAM BANK 2
|
||||
; D000..D3FF - ProRWTS data
|
||||
; D400..D66D - ProRWTS code
|
||||
; D66E..DBA2 - HGR font code & ProRWTS glue code
|
||||
; DBA3..DBB2 - backup of stack (during gameplay and self-running demos)
|
||||
; ...unused... yes, just one byte to spare
|
||||
; D400..D677 - ProRWTS code
|
||||
; D678..DB9D - HGR font code & ProRWTS glue code
|
||||
; DB9E..DBAD - backup of stack (during gameplay and self-running demos)
|
||||
; ...unused...
|
||||
; DBB4..DBFF - (de)acceleration function
|
||||
; DC00..DFFF - HGR font data
|
||||
;------------------------------------------------------------------------------
|
||||
|
46
src/macros.a
46
src/macros.a
@ -60,12 +60,24 @@
|
||||
ldy .ptr+1
|
||||
}
|
||||
|
||||
; load a 16-bit value into X (low) and Y (high)
|
||||
!macro LDX16 .ptr {
|
||||
ldx .ptr
|
||||
ldy .ptr+1
|
||||
}
|
||||
|
||||
; store a 16-bit value from A (low) and Y (high)
|
||||
!macro ST16 .ptr {
|
||||
sta .ptr
|
||||
sty .ptr+1
|
||||
}
|
||||
|
||||
; store a 16-bit value from X (low) and Y (high)
|
||||
!macro STX16 .ptr {
|
||||
stx .ptr
|
||||
sty .ptr+1
|
||||
}
|
||||
|
||||
; decrement a 16-bit value in A (low) and Y (high)
|
||||
!macro DEC16 {
|
||||
sec
|
||||
@ -75,6 +87,15 @@
|
||||
+
|
||||
}
|
||||
|
||||
; decrement a 16-bit value in X (low) and Y (high)
|
||||
; destroys A!
|
||||
!macro DEX16 {
|
||||
txa
|
||||
bne +
|
||||
dey
|
||||
+ dex
|
||||
}
|
||||
|
||||
; increment a 16-bit value in A (low) and Y (high)
|
||||
!macro INC16 {
|
||||
clc
|
||||
@ -84,6 +105,14 @@
|
||||
+
|
||||
}
|
||||
|
||||
; increment a 16-bit value in X (low) and Y (high)
|
||||
!macro INX16 {
|
||||
inx
|
||||
bne +
|
||||
iny
|
||||
+
|
||||
}
|
||||
|
||||
; compare a 16-bit value in A (low) and Y (high) to an absolute address
|
||||
!macro CMP16ADDR .addr {
|
||||
cmp .addr
|
||||
@ -92,6 +121,14 @@
|
||||
+
|
||||
}
|
||||
|
||||
; compare a 16-bit value in X (low) and Y (high) to an absolute address
|
||||
!macro CPX16ADDR .addr {
|
||||
cpx .addr
|
||||
bne +
|
||||
cpy .addr+1
|
||||
+
|
||||
}
|
||||
|
||||
; compare a 16-bit value in A (low) and Y (high) to an immediate value
|
||||
!macro CMP16 .val {
|
||||
cmp #<.val
|
||||
@ -100,6 +137,15 @@
|
||||
+
|
||||
}
|
||||
|
||||
; compare a 16-bit value in X (low) and Y (high) against zero
|
||||
; requires LDX16 immediately prior, since Y comparison is implicit!
|
||||
; destroys A!
|
||||
!macro CPX16_0 {
|
||||
bne +
|
||||
txa
|
||||
+
|
||||
}
|
||||
|
||||
!macro LBPL .target {
|
||||
bmi +
|
||||
jmp .target
|
||||
|
@ -128,10 +128,20 @@ BlankSHR
|
||||
|
||||
sta WRITEAUXMEM ; writes go to auxmem
|
||||
|
||||
lda #$00 ; enable auxmem-to-bank-E1 shadowing on IIgs
|
||||
sta SHADOW
|
||||
ldx #$00 ; enable auxmem-to-bank-E1 shadowing on IIgs
|
||||
stx SHADOW
|
||||
|
||||
lda #$20 ; clear $2000..$9FFF in auxmem
|
||||
; VIDHD-SPECIFIC HACK HERE!
|
||||
; On the II/II+/IIe, all $C03x are aliases for $C030, i.e. the speaker.
|
||||
; Any single access of the speaker register requires a second access within a short
|
||||
; time to balance the level if we want to avoid an audible click, which we do here.
|
||||
; Since we can't read from SHADOW before writing to it (VidHD will crash the machine
|
||||
; if we do that - ask us how we know), we have to balance the speaker access by
|
||||
; accessing a speaker address explicitly because let's not make VIDHD angry.
|
||||
; Hence the write to SPEAKER. Do not remove.
|
||||
stx SPEAKER
|
||||
|
||||
lsr ; clear $2000..$9FFF in auxmem
|
||||
ldx #$80
|
||||
jsr ClearMem
|
||||
|
||||
|
@ -66,24 +66,23 @@ OnBrowseSearch
|
||||
jmp SearchMode
|
||||
|
||||
OnBrowsePrevious
|
||||
+LD16 gGameToLaunch
|
||||
+CMP16 0
|
||||
+LDX16 gGameToLaunch
|
||||
+CPX16_0
|
||||
bne @notFirstGame
|
||||
+LD16 GameCount
|
||||
+LDX16 GameCount
|
||||
@notFirstGame
|
||||
+DEC16
|
||||
+ST16 gGameToLaunch
|
||||
jmp OnBrowseChanged
|
||||
+DEX16
|
||||
jmp notLastGame
|
||||
|
||||
OnBrowseNext
|
||||
+LD16 gGameToLaunch
|
||||
+INC16
|
||||
+CMP16ADDR GameCount
|
||||
bne @notLastGame
|
||||
lda #0
|
||||
tay
|
||||
@notLastGame
|
||||
+ST16 gGameToLaunch
|
||||
+LDX16 gGameToLaunch
|
||||
+INX16
|
||||
+CPX16ADDR GameCount
|
||||
bne notLastGame
|
||||
ldx #0
|
||||
ldy #0
|
||||
notLastGame
|
||||
+STX16 gGameToLaunch
|
||||
jmp OnBrowseChanged
|
||||
|
||||
OnBrowseLaunch
|
||||
|
Loading…
x
Reference in New Issue
Block a user