update music macros

This commit is contained in:
scawful
2024-06-24 09:00:09 -04:00
parent 1acdb8f09d
commit bd0aad0f85
2 changed files with 160 additions and 50 deletions

View File

@@ -1,3 +1,131 @@
; ==============================================
; 1/4 = $48
; 1/4 double = $6C
; 1/4 triplet = $30
; 1/8 = $24
; 1/8 double = $36
; 1/8 triplet = $18
; 1/16 = $12
; 1/16 double = $1B
; 1/32 = $09
; db C4, !Tie, !Tie, !Tie : whole note (1/1)
; db C4, !Tie : half note (1/2)
!4th = $48
!4thD = $6C
!4thT = $30
!8th = $24
!8thD = $36
!8thT = $18
!16th = $12
!16thD = $1B
!32nd = $09
macro SetDuration(v)
db <v>
endmacro
; n default is $7F
macro SetDurationN(v, n)
db <v>, <n>
endmacro
; ==============================================
; N-SPC Instruments
; 00 Noise
; 01 Rain
; 02 Tympani
; 03 Square wave
; 04 Saw wave
; 05 Sine wave (clink)
; 06 Wobbly lead
; 07 Compound saw wave
; 08 Tweet
; 09 Strings A
; 0A Strings B
; 0B Trombone
; 0C Cymbal
; 0D Ocarina
; 0E Chime
; 0F Harp
; 10 Splash
; 11 Trumpet
; 12 Horn
; 13 Snare A
; 14 Snare B
; 15 Choir
; 16 Flute
; 17 Oof
; 18 Piano
macro SetInstrument(v)
db $E0, <v>
endmacro
macro Tympani()
%SetInstrument($02)
endmacro
macro Trombone()
%SetInstrument($0B)
endmacro
macro Ocarina()
%SetInstrument($0D)
endmacro
macro Harp()
%SetInstrument($0F)
endmacro
macro Splash()
%SetInstrument($10)
endmacro
macro Trumpet()
%SetInstrument($11)
endmacro
macro Horn()
%SetInstrument($12)
endmacro
macro Snare()
%SetInstrument($13)
endmacro
macro Choir()
%SetInstrument($15)
endmacro
macro Flute()
%SetInstrument($16)
endmacro
macro Piano()
%SetInstrument($18)
endmacro
macro Cymbal()
%SetInstrument($0C)
endmacro
macro Strings()
%SetInstrument($09)
endmacro
macro Sawtooth()
%SetInstrument($04)
endmacro
macro Sine()
%SetInstrument($05)
endmacro
; ==============================================
macro SetChannelVolume(v)
db $ED, <v>
endmacro
@@ -10,36 +138,6 @@ macro SetTempo(v)
db $E7, <v>
endmacro
; 00 Unknown
; 01 Rain
; 02 Tympani
; 03 Square wave
; 04 Saw wave
; 05 Sine wave
; 06 Double saw wave 1
; 07 Double save wave 2
; 08 Tweet
; 09 Strings
; 0A Same as 9
; 0B Trombone
; 0C Cymbal
; 0D Ocarina
; 0E Chime
; 0F harp
; 10 Splash
; 11 Trumpet
; 12 Horn
; 13 Snare
; 14 Same as 13
; 15 Choir
; 16 Flute
; 17 Oof
; 18 Guitar
macro SetInstrument(v)
db $E0, <v>
endmacro
macro CallSubroutine(addr, repeat)
db $EF
dw <addr>
@@ -134,26 +232,39 @@ macro PercussionPatchBass(instrument)
db $FA, <instrument>
endmacro
;1/4 = $48
;1/4 double = $6C
;1/4 triplet = $30
;1/8 = $24
;1/8 double = $36
;1/8 triplet = $18
;1/16 = $12
;1/16 double = $1B
;1/32 = $09
; To make a whole note you tie 4 1/4 so something like
;%SetDuration(48)
;db !C4, !Tie, !Tie, !Tie ; will play a whole note (1/1)
;db !C4, !Tie ; will play a half note (1/2)
; ==============================================
macro SetDuration(v) ; $48 = 1/4, $24 = 1/8, $12 = 1/16, $09 = 1/32
db <v>
macro PlayQuarterNotes(...)
if sizeof(...) > 0
db !4th, <...>
else
db !4th
endif
endmacro
macro SetDurationN(v, n) ; n default is $7F
db <v>, <n>
macro PlayEighthNotes(...)
if sizeof(...) > 0
db !8th, <...>
else
db !8th
endif
endmacro
macro PlayHalfNotes(...)
if sizeof(...) > 0
db !4th, <...>
else
db !4th
endif
; db !4th, <note>, $C8
endmacro
macro SustainNoteN(note, num)
db note
if num > 1
db $C8
%SustainNoteN(note, num - 1)
endif
endmacro
End = $00
@@ -173,7 +284,6 @@ A1 = $89
A1s = $8A
B1 = $8B
C2 = $8C
C2s = $8D
D2 = $8E
@@ -187,7 +297,6 @@ A2 = $95
A2s = $96
B2 = $97
C3 = $98
C3s = $99
D3 = $9A

View File

@@ -43,7 +43,8 @@ namespace Oracle
incsrc "Util/ram.asm"
incsrc "Util/functions.asm"
incsrc "Util/music_macros.asm"
incsrc "Core/music_macros.asm"
; -------------------------------------------------------
; Overworld