-
Notifications
You must be signed in to change notification settings - Fork 7
/
sram.tex
218 lines (202 loc) · 7.52 KB
/
sram.tex
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
\chapter{SRAM Memory Map}
This chapter is intended for programmers. It contains information about how song data is stored in SRAM. If you use an emulator, SRAM contents are usually stored in a .sav file.
\section{Bank Layouts}
\subsection{Bank 0}
\begin{description}
\item[A000-AFEF] phrase notes
\item[AFF0-AFFF] bookmarks
\item[B000-B08F] empty
\item[B090-B28F] grooves
\item[B290-B58F] song chains
\item[B590-B68F] empty
\item[B690-B88F] table envelopes
\item[B890-BA4F] speech instrument words
\item[BA50-BDCF] empty
\item[BDD0-BDF9] speech instrument wordnames
\item[BDFA-BE77] empty
\item[BE78-BE79] mem initialized flag (set to "rb" on init)
\item[BE7A-BFB9] instrument names
\end{description}
\subsection{Bank 1}
\begin{description}
\item[A000-A03F] empty
\item[A040-A07F] instr alloc table
\item[A080-A87F] chain phrases
\item[A880-B07F] chain transposes
\item[B080-B47F] instrument parameters \label{sram-instr-param}
\item[B480-B67F] table transposes
\item[B680-B87F] table commands, left column
\item[B880-BA7F] table command values, left column
\item[BA80-BC7F] table commands, right column
\item[BC80-BE7F] table command values, right column
\item[BE80-BE81] mem initialized flag (set to "rb" on init)
\item[BE82-BEA1] phrase allocation table
\item[BEA2-BEB1] chain allocation table
\item[BEB2-BFB1] softsynth params
\item[BFB2-BFB2] clock, hours
\item[BFB3-BFB3] clock, minutes
\item[BFB4-BFB4] tempo
\item[BFB5-BFB5] tune setting
\item[BFB6-BFB6] total clock, days
\item[BFB7-BFB7] total clock, hours
\item[BFB8-BFB8] total clock, minutes
\item[BFB9-BFB9] total clock
\item[BFBA-BFBA] key delay
\item[BFBB-BFBB] key repeat
\item[BFBC-BFBC] font (for cgb)
\item[BFBD-BFBD] sync mode (off/lsdj/midi/...)
\item[BFBE-BFBE] colorset
\item[BFBF-BFBF] sync parameter (e.g. analog in ticks/step)
\item[BFC0-BFC0] clone (0=deep, 1=slim)
\item[BFC1-BFC1] file changed?
\item[BFC2-BFC2] unused
\item[BFC3-BFC3] prelisten
\item[BFC4-BFC5] synths locked?
\item[BFC6-BFC9] last used instrument/channel
\item[BFCA-BFCA] clock of last save, hours
\item[BFCB-BFCB] clock of last save, minutes
\item[BFCC-BFCC] tempo lcd sync (0=off, 1=2x, 2=3x, 3=6x)
\end{description}
\subsection{Bank 2}
\begin{description}
\item[A000-AFEF] phrase commands
\item[AFF0-BFDF] phrase command values
\end{description}
\subsection{Bank 3}
\begin{description}
\item[A000-AFFF] waves
\item[B000-BFEF] phrase instruments
\item[BFF0-BFF1] mem initialized flag (set to "rb" on init)
\item[BFF2-BFFE] empty
\item[BFFF-BFFF] version byte (0=old, 1=3.6.0, 2=3.6.1, 3=4.4.0, 4=5.7.0, 5=6.3.0, 6=6.7.0, 7=6.8.0, 8=7.1.0, 9=7.5.0, 10=7.9.8, 11=8.1.0, 12=8.6.0, 13=8.8.0, 14=8.8.1, 15=8.8.6, 16=8.8.8, 17=8.9.3, 18=9.0.0, 19=9.1.0, 20=9.1.5, 21=9.2.0, 22=9.2.4)
\end{description}
\section{Instrument Layouts}
Tables \ref{tab:sram-pulse} to \ref{tab:sram-noise} show the SRAM layout of the different instrument types. Each instrument takes up 16 bytes of the instrument parameter area in \nameref{sram-instr-param}.
\begin{table}
\begin{center}
\caption{Pulse Instrument SRAM Layout.}
\label{tab:sram-pulse}
\begin{tabular}{r|r|l|l}
\toprule
Byte & Bits & Content & Value \\
\midrule
0 & 7-0 & 0 & \\
1 & 7-0 & \textsc{Env. 1} & \\
2 & 7-0 & \textsc{Pu2 Tsp.} & \\
3 & 6 & \textsc{Length=Unlim} & 0=yes, 1=no \\
& 5-0 & \textsc{Length} & \\
4 & 6-0 & \textsc{Sweep} & \\
5 & 7 & \textsc{Pitch=Step} & 0=no, 1=yes \\
& 6 & \textsc{Pitch=Drum} & 0=no, 1=yes \\
& 5 & \textsc{Transpose} & 0=on, 1=off \\
& 4 & \textsc{Pitch} speed & 0=fast, 1=tick \\
& 3 & \textsc{Table} speed & 0=tick, 1=step \\
& 2-1 & Vibrato shape & 0=sin, 1=saw, 2=sqr \\
& 0 & Vibrato direction & 0=down, 1=up \\
6 & 5 & Table off/on & 0=off, 1=on \\
& 4-0 & Table & \\
7 & 7-6 & \textsc{Wave} & \\
& 1-0 & \textsc{Output} & \\
8 & 3-0 & \textsc{Cmd/Rate} & \\
9 & 7-0 & \textsc{Env. 2} & \\
10 & 7-0 & \textsc{Env. 3} & \\
11 & 7-0 & \textsc{Finetune} & \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\begin{table}
\begin{center}
\caption{Wave Instrument SRAM Layout.}
\begin{tabular}{r|r|l|l}
\toprule
Byte & Bits & Content & Value \\
\midrule
0 & 7-0 & 1 & \\
1 & 6-5 & \textsc{Volume} & \\
2 & 3-0 & \textsc{Loop Pos} & \\
3 & 7-0 & \textsc{Wave} & \\
& 7-4 & \textsc{Synth} & \\
4 & - & - & \\
5 & 7 & \textsc{Pitch=Step} & 0=no, 1=yes \\
& 6 & \textsc{Pitch=Drum} & 0=no, 1=yes \\
& 5 & \textsc{Transpose} & 0=on, 1=off \\
& 4 & \textsc{Pitch} speed & 0=fast, 1=tick \\
& 3 & \textsc{Table} speed & 0=tick, 1=step \\
& 2-1 & Vibrato shape & 0=sin, 1=saw, 2=sqr \\
& 0 & Vibrato direction & 0=down, 1=up \\
6 & 5 & Table off/on & 0=off, 1=on \\
& 4-0 & Table & \\
7 & 1-0 & \textsc{Output} & \\
8 & 3-0 & \textsc{Cmd/Rate} & \\
9 & 1-0 & \textsc{Playtype} & 0=off, 1=once, 2=loop, 3=pingpong \\
10 & 3-0 & \textsc{Length} & \\
11 & 7-0 & \textsc{Speed} & \\
12 & 7-0 & \textsc{Finetune} & \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\begin{table}
\begin{center}
\caption{Kit Instrument SRAM Layout.}
\begin{tabular}{r|r|l|l}
\toprule
Byte & Bits & Content & Value \\
\midrule
0 & 7-0 & 2 & \\
1 & 6-5 & \textsc{Volume} & \\
2 & 7 & \textsc{Loop 1=Atk} & 0=no, 1=yes \\
& 6 & \textsc{Speed=0.5x} & 0=no, 1=yes \\
& 5-0 & \textsc{Kit} & \\
3 & 7-0 & \textsc{Length 1} & 0=\textsc{Auto} \\
4 & - & - & \\
5 & 7 & \textsc{Pitch=Step} & 0=no, 1=yes \\
& 6 & \textsc{Loop 1} & 0=off, 1=on \\
& 5 & \textsc{Loop 2} & 0=off, 1=on \\
& 4 & \textsc{Pitch} speed & 0=fast, 1=tick \\
& 3 & \textsc{Table} speed & 0=tick, 1=step \\
& 2-1 & Vibrato shape & 0=sin, 1=saw, 2=sqr \\
& 0 & Vibrato direction & 0=down, 1=up \\
6 & 5 & Table off/on & 0=off, 1=on \\
& 4-0 & Table & \\
7 & 1-0 & \textsc{Output} & \\
8 & 7-0 & \textsc{Finetune} & \\
9 & 7 & \textsc{Loop 2=Atk} & 0=no, 1=yes \\
& 5-0 & \textsc{Kit} & \\
10 & 7-0 & \textsc{Dist} & d0-d3=\textsc{clip, shape, shap2, wrap} \\
11 & 7-0 & \textsc{Length 2} & 0=\textsc{Auto} \\
12 & 7-0 & \textsc{Offset 1} & \\
13 & 7-0 & \textsc{Offset 2} & \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\begin{table}
\begin{center}
\caption{Noise Instrument SRAM Layout.}
\label{tab:sram-noise}
\begin{tabular}{r|r|l|l}
\toprule
Byte & Bits & Content & Value \\
\midrule
0 & 7-0 & 3 & \\
1 & 7-0 & \textsc{Env. 1} & \\
2 & 0 & \textsc{Pitch} & 0=free, 1=safe \\
3 & 6 & \textsc{Length=Unlim} & 0=yes, 1=no \\
& 5-0 & \textsc{Length} & \\
4 & 7-0 & Last entered note & \\
5 & 5 & \textsc{Transpose} & 0=on, 1=off \\
& 3 & \textsc{Table} speed & 0=tick, 1=step \\
& 2-1 & Vibrato shape & 0=sin, 1=saw, 2=sqr \\
& 0 & Vibrato direction & 0=down, 1=up \\
6 & 5 & Table off/on & 0=off, 1=on \\
& 4-0 & Table & \\
7 & 1-0 & \textsc{Output} & \\
8 & 3-0 & \textsc{Cmd/Rate} & \\
9 & 7-0 & \textsc{Env. 2} & \\
10 & 7-0 & \textsc{Env. 3} & \\
\bottomrule
\end{tabular}
\end{center}
\end{table}