-
Notifications
You must be signed in to change notification settings - Fork 2
/
musicseq.h
108 lines (102 loc) · 2.5 KB
/
musicseq.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
; Copyright 2010 Damian Yerrick
;
; Copying and distribution of this file, with or without
; modification, are permitted in any medium without royalty provided
; the copyright notice and this notice are preserved in all source
; code copies. This file is offered as-is, without any warranty.
.global drumSFX, psg_sound_table
.global musicPatternTable, instrumentTable, songTable
N_C = 0*8
N_CS = 1*8
N_D = 2*8
N_DS = 3*8
N_E = 4*8
N_F = 5*8
N_FS = 6*8
N_G = 7*8
N_GS = 8*8
N_A = 9*8
N_AS = 10*8
N_B = 11*8
N_DB = N_CS
N_EB = N_DS
N_GB = N_FS
N_AB = N_GS
N_BB = N_AS
N_CH = N_C + 12*8
N_CSH = N_CS + 12*8
N_DBH = N_DB + 12*8
N_DH = N_D + 12*8
N_DSH = N_DS + 12*8
N_EBH = N_EB + 12*8
N_EH = N_E + 12*8
N_FH = N_F + 12*8
N_FSH = N_FS + 12*8
N_GBH = N_GB + 12*8
N_GH = N_G + 12*8
N_GSH = N_GS + 12*8
N_ABH = N_AB + 12*8
N_AH = N_A + 12*8
N_ASH = N_AS + 12*8
N_BBH = N_BB + 12*8
N_BH = N_B + 12*8
N_CHH = N_CH + 12*8
N_TIE = 25*8
REST = 26*8
INSTRUMENT = $D8
; The default duration is one row (a sixteenth note in the tracker).
; OR the pitch with one of these constants.
D_8 = 1
D_D8 = 2
D_4 = 3
D_D4 = 4
D_2 = 5
D_D2 = 6
D_1 = 7
CON_PLAYPAT = $00 ; next: pattern, transpose (if not drums), instrument (if not drums)
CON_LOOPPAT = $10 ; as CON_PLAYPAT
CON_WAITROWS = $20 ; next: number of rows to wait minus 1
CON_FINE = $21 ; stop music now
CON_SEGNO = $22 ; set loop point
CON_DALSEGNO = $23 ; jump to loop point. if no point was set, jump to start of song.
CON_SETTEMPO = $30 ; low bits: bits 8-9 of tempo in rows/min; next: bits 0-7 of tempo
; Conductor macros
.macro playPatSq1 patid, transpose, instrument
.byt CON_PLAYPAT|0, patid, transpose, instrument
.endmacro
.macro playPatSq2 patid, transpose, instrument
.byt CON_PLAYPAT|1, patid, transpose, instrument
.endmacro
.macro playPatTri patid, transpose, instrument
.byt CON_PLAYPAT|2, patid, transpose, instrument
.endmacro
.macro playPatNoise patid, transpose, instrument
.byt CON_PLAYPAT|3, patid, transpose, instrument
.endmacro
.macro stopPatSq1
.byt CON_PLAYPAT|0, 255, 0, 0
.endmacro
.macro stopPatSq2
.byt CON_PLAYPAT|1, 255, 0, 0
.endmacro
.macro stopPatTri
.byt CON_PLAYPAT|2, 255, 0, 0
.endmacro
.macro stopPatNoise
.byt CON_PLAYPAT|3, 255, 0, 0
.endmacro
.macro waitRows n
.byt CON_WAITROWS, n-1
.endmacro
.macro fine
.byt CON_FINE
.endmacro
.macro segno
.byt CON_SEGNO
.endmacro
.macro dalSegno
.byt CON_DALSEGNO
.endmacro
.macro setTempo rowsPerMin
.byt CON_SETTEMPO|>rowsPerMin, <rowsPerMin
.endmacro