-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathttrackerSCC.asm
260 lines (201 loc) · 5.98 KB
/
ttrackerSCC.asm
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
FREE_REPLAY equ SWAP_REPLAY - SWAP_CHECK ; Free space before SWAP_REPLAY
FREE_MACRO equ $4000 - SWAP_MACRO_END
FREE_TRACK equ $4000 - SWAP_TRACK_END
FREE_SAMPLE equ $4000 - SWAP_SAMPLE_END
FREE_SAMPLEFILE equ $8000 - SWAP_SAMFILE_END
; Trilo-Tracker v0.2
define VERSION "v0.11.4b SCC"
define YEAR "2021"
define CHIPSET_CODE $00
DEFINE TTSCC
defpage 0,0x0100, 0x3f00 ; page 0 contains main code + far call routines
defpage 1,0x4000, 0x8000 ; page 1 contains code (last 5kb should be empty)
; defpage 2,0x8000, 0x4000 ; NPC/titlescreen/gameinit code/swap code blocks
; --- PAGE 0
;
; Global code (will never be swapped)
;
;
; --------------------------------------------------
page 0
org 0x0100
MAIN:
; initialisation
call reset_hook
call get_drives
call init_workdir
call start_init ; this calls function that is overwritten after call
; the space can be used by the songs
; locate available SCC
ld a,1
ld (scc_type_check),a
call find_SCC ;find SCC+
cp 255
jr. nz,99f
xor a
ld (scc_type_check),a
call find_SCC ; find SCC
99:
;--- init correct period tabel from config
ld a,(_CONFIG_PERIOD)
ld (replay_period),a
call set_period_table
; new that we have the memory reserved. Switch to slot of song data
ld a,(mapper_slot) ; get mapper slot
ld h,0x80
call enaslt
call init_hook
xor a
call swap_loadblock
xor a
call new_song
call set_songpage
call cursorstack_init
ld a,(SCC_slot_found)
inc a
jr. nz,99f
ld a,WIN_NOSCC
call window
99:
;--- should we load default instruments?
ld a,(_CONFIG_INS)
and a
call nz,load_instruments
ld a,10
ld (editmode),a
call init_patterneditor
;--- Set the SCC slot according to config
ld a,(_CONFIG_SLOT)
cp 255 ; check if config is set to auto
jr. nz,99f
ld a,(SCC_slot_found)
99:
ld (SCC_slot),a
; --- main loop
;call set_hook
include ".\code\main.asm"
include ".\code\configurationRAM.asm"
END:
; jr. _TERM0
include ".\code\elements\patternbox.asm"
_LABEL_PATTERNHEADER:
;db 32,129,171,172,175,129 ; envelope column
; db 32,32,32
db 136,160,161,164,185,188,189,186,187 ; psg1
db 136,160,161,165,185,188,189,186,187 ; psg2
db 136,160,161,166,185,188,189,186,187 ; psg3
db 137,162,163,164,185,188,189,186,187 ; scc1
db 136,162,163,165,185,188,189,186,187 ; scc2
db 136,162,163,166,185,188,189,186,187 ; scc3
db 136,162,163,167,185,188,189,186,187 ; scc4
db 136,162,163,168,185,188,189,186,187 ; scc5
_LABEL_PATTERNHEADER_END:
db 136,32,32,32
; include ".\code\elements\trackbox.asm"
include ".\code\elements\trackboxRAM.asm"
include ".\code\elements\sequencebox.asm"
include ".\code\elements\songbox.asm"
include ".\code\elements\patterneditor.asm"
include ".\code\elements\filedialogRAM.asm"
include ".\code\elements\sccwavebox.asm"
include ".\code\sound\sccdetect.asm"
include ".\code\elements\keyjazz.asm"
include ".\code\elements\instrumentbox.asm"
include ".\code\elements\vu.asm"
include ".\code\loadinstruments.asm"
include ".\code\cursor.asm"
include ".\code\volumetable.asm"
include ".\code\song.asm"
include ".\code\editlog.asm"
include ".\code\elements\filedialog.asm"
SWAP_ELEMENTSTART:
font_data:
incbin ".\data\fontpatSCC.bin"
include ".\code\startup.asm"
include ".\code\elements\keynotetable.asm"
; --- PAGE 1
;
; Main code (can be swapped)
;
;
; --------------------------------------------------
page 1
include ".\code\bios.asm"
; include ".\code\cursor.asm"
include ".\code\vdp.asm"
include ".\code\screen.asm"
include ".\code\register_debug.asm"
include ".\code\clipboard.asm"
; include ".\code\song.asm"
; include ".\code\volumetable.asm"
include ".\code\keyboard.asm"
include ".\code\musickeyboard.asm"
include ".\code\isr.asm" ; This cannot be before this address!!!!
include ".\code\mapper.asm"
include ".\code\disk.asm"
include ".\code\vram_swapper.asm"
include ".\code\replayerSCCRAM.asm"
include ".\code\window.asm"
SWAP_CHECK:
; --- PAGE 2
;
; Data page (music data)
;
;
; --------------------------------------------------
; page 2
; temporary start up code and data!!! Will be over written after init
SWAP_INIT_START:
org SWAP_RAMSTART
; Replayer swappable code block
; --------------------------------------------------
SWAP_REPLAY:
include ".\code\replayerSCC.asm" ;replayer.asm"
SWAP_REPLAY_END:
; Sample editor
; --------------------------------------------------
org SWAP_ELEMENTSTART
SWAP_SAMPLE:
include ".\code\elements\sampleeditor.asm"
include ".\code\elements\samplebox.asm"
SWAP_SAMPLE_END:
; XM importer swappable code block
; --------------------------------------------------
org SWAP_RAMSTART
SWAP_SAMFILE:
include ".\code\elements\filesamdialog.asm"
SWAP_SAMFILE_END:
; XM importer swappable code block
; --------------------------------------------------
org SWAP_RAMSTART
SWAP_CONFIG:
include ".\code\elements\configeditor.asm"
include ".\code\elements\configbox.asm"
SWAP_CONFIG_END:
; Macro editor swappable code block
; --------------------------------------------------
org SWAP_ELEMENTSTART
SWAP_MACRO:
include ".\code\elements\macroeditor.asm"
include ".\code\elements\macrobox.asm"
SWAP_MACRO_END:
; Instrument file dialog swappable code block
; --------------------------------------------------
org SWAP_RAMSTART
SWAP_INSFILE:
include ".\code\elements\fileinsdialog.asm"
SWAP_INSFILE_END:
; Song file dialog swappable code block
; --------------------------------------------------
org SWAP_ELEMENTSTART
SWAP_TRACK:
SWAP_FILE:
db "trackbox swap"
include ".\code\disk_tmu.asm"
include ".\code\compression2.asm"
include ".\code\elements\trackbox.asm"
SWAP_TRACK_END:
SWAP_FILE_END:
db "End of swap data"
SWAP_INIT_END:
include ".\code\variablesSCC.asm"