Skip to content

Commit

Permalink
Importing bank-managing macros from skdisasm
Browse files Browse the repository at this point in the history
Currently used for banks where data is aligned to start of bank
(MusicPoint1, MusicPoint2).
  • Loading branch information
Clownacy committed Apr 18, 2015
1 parent 9ed6b1f commit 551aba4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
17 changes: 5 additions & 12 deletions s2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -88027,15 +88027,15 @@ SndDAC_End
; ---------------------------------------------------------------------------
; Music pointers
; ---------------------------------------------------------------------------
align $8000

; loc_F0000:
MusicPoint1:
MusicPoint1: startBank
MusPtr_Continue: rom_ptr_z80 Mus_Continue


Mus_Continue: BINCLUDE "sound/music/Continue.bin"

finishBank

; --------------------------------------------------------------------
; Nemesis compressed art (20 blocks)
; Buzzer's fireball
Expand Down Expand Up @@ -88166,11 +88166,8 @@ Snd_Sega_End:
; ------------------------------------------------------------------------------
; Music pointers
; ------------------------------------------------------------------------------
align $8000
soundBankStart := *

; loc_F8000:
MusicPoint2:
MusicPoint2: startBank
MusPtr_CNZ_2P: rom_ptr_z80 Mus_CNZ_2P
MusPtr_EHZ: rom_ptr_z80 Mus_EHZ
MusPtr_MTZ: rom_ptr_z80 Mus_MTZ
Expand Down Expand Up @@ -90136,11 +90133,7 @@ Sound70: dc.w $0000,$0101
dc.b $F2


if * > soundBankStart + $8000
fatal "soundBank must fit in $8000 bytes but was $\{*-soundBankStart}. Try moving something to the other bank."
else
;message "soundBank has $\{$8000+soundBankStart-*} bytes free at end."
endif
finishBank

; end of 'ROM'
if padToPowerOfTwo && (*)&(*-1)
Expand Down
19 changes: 19 additions & 0 deletions s2.macros.asm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,25 @@ rom_ptr_z80 macro addr
dc.w z80_ptr(addr)
endm

; aligns the start of a bank, and detects when the bank's contents is too large
; can also print the amount of free space in a bank with DebugSoundbanks set
startBank macro {INTLABEL}
align $8000
__LABEL__ label *
soundBankStart := __LABEL__
soundBankName := "__LABEL__"
endm

DebugSoundbanks := 0

finishBank macro
if * > soundBankStart + $8000
fatal "soundBank \{soundBankName} must fit in $8000 bytes but was $\{*-soundBankStart}. Try moving something to the other bank."
elseif (DebugSoundbanks<>0)&&(MOMPASS=1)
message "soundBank \{soundBankName} has $\{$8000+soundBankStart-*} bytes free at end."
endif
endm

; macro to replace the destination with its absolute value
abs macro destination
tst.ATTRIBUTE destination
Expand Down

0 comments on commit 551aba4

Please sign in to comment.