shithub: pokered

Download patch

ref: 157b593561382c77a6435a8f1fae64df6d7169e8
parent: f68af5c6e95a11daa3bc8daaf28c4e9a779615b9
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat Nov 6 09:24:19 EDT 2021

Use `dn` for wave instrument samples, like pokecrystal

--- a/audio/wave_instruments.asm
+++ b/audio/wave_instruments.asm
@@ -15,19 +15,19 @@
 ; the graph of the wave
 ; the current instrument is copied to rWave_0--rWave_f
 .wave0
-	db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
+	dn  0,  2,  4,  6,  8, 10, 12, 14, 15, 15, 15, 14, 14, 13, 13, 12, 12, 11, 10,  9,  8,  7,  6,  5,  4,  4,  3,  3,  2,  2,  1,  1
 
 .wave1
-	db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
+	dn  0,  2,  4,  6,  8, 10, 12, 14, 14, 15, 15, 15, 15, 14, 14, 14, 13, 13, 12, 11, 10,  9,  8,  7,  6,  5,  4,  3,  2,  2,  1,  1
 
 .wave2
-	db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
+	dn  1,  3,  6,  9, 11, 13, 14, 14, 14, 14, 15, 15, 15, 15, 14, 13, 13, 14, 15, 15, 15, 15, 14, 14, 14, 14, 13, 11,  9,  6,  3,  1
 
 .wave3
-	db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
+	dn  0,  2,  4,  6,  8, 10, 12, 13, 14, 15, 15, 14, 13, 14, 15, 15, 14, 14, 13, 12, 11, 10,  9,  8,  7,  6,  5,  4,  3,  2,  1,  0
 
 .wave4
-	db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
+	dn  0,  1,  2,  3,  4,  5,  6,  7,  8, 10, 12, 13, 14, 14, 15,  7,  7, 15, 14, 14, 13, 12, 10,  8,  7,  6,  5,  4,  3,  2,  1,  0
 
 ; duty 5 reads from sfx data
 .wave5
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -39,24 +39,33 @@
 
 ; Constant data (db, dw, dl) macros
 
-dn: MACRO ; nybbles
-	db (\1 << 4 | \2)
-ENDM
-
 dbw: MACRO
 	db \1
 	dw \2
 ENDM
 
-dba: MACRO
-	dbw BANK(\1), \1
-ENDM
-
 dwb: MACRO
 	dw \1
 	db \2
 ENDM
 
-dab: MACRO
+dn: MACRO ; nybbles
+REPT _NARG / 2
+	db ((\1) << 4) | (\2)
+	SHIFT 2
+ENDR
+ENDM
+
+dba: MACRO ; dbw bank, address
+REPT _NARG
+	dbw BANK(\1), \1
+	SHIFT
+ENDR
+ENDM
+
+dab: MACRO ; dwb address, bank
+REPT _NARG
 	dwb \1, BANK(\1)
+	SHIFT
+ENDR
 ENDM