@@ -301,42 +301,43 @@ def print_asset(name, module, bank):
301301
302302 print ("# dependencies for generated sound assets" , file = f )
303303 print ("# generated by soundtool.py (ngdevkit)" , file = f )
304- print ('' , file = f )
305-
306- print ('GENERATED_MUSIC?=.' , file = f )
307- print ('' , file = f )
308304
309305 grouped_musics , _ = group_assets (desc )
310306
311307 # Jump table macros
312- for group in sorted (iter (grouped_musics )):
308+ groups = sorted (iter (grouped_musics ))
309+ use_bank = any ([g >= 0 for g in groups ])
310+
311+ for group in groups :
313312 atype = "Z80 bank %d" % group if group >= 0 else "fixed Z80 ROM"
314- print ("#\n # assets for %s\n #\n " % atype , file = f )
313+ print ("\n #\n # assets for %s\n #\n " % atype , file = f )
314+
315+ drv = "SOUND_DRIVER"
316+ bank = "SOUND_DRIVER_BANK%d" % group
315317
316318 # fixed ROM: group == -1
317319 if group >= 0 :
318- print ("Z80_LDFLAGS+=-b BANK%d=0x8000\n " % group , file = f )
320+ print ("Z80_BANK_LDFLAGS+=-b BANK%d=0x8000\n " % group , file = f )
321+ print ("%s?=$(SOUND_DRIVER:%%.ihx=%%_%d.bank.bin)" % (bank , group ), file = f )
322+ print ("$(%s): Z80_BANK_LDFLAGS=-b BANK%d=0x8000" % (bank , group ), file = f )
323+ print ("$(MROM1): $(SOUND_DRIVER_BANK%d)" % (group ), file = f )
324+ elif use_bank :
325+ print ("$(MROM1): MROMPADSIZE=32768" , file = f )
319326
320327 for mod in grouped_musics [group ]:
321328 mtype = "BANK%d" % group if group >= 0 else "FIXED"
322329 gtype = "BANK%d_MUSIC" % group if group >= 0 else "MUSIC"
323330 uri = mod ['furnace' ]['uri' ]
324331 path = uri .split ("://" )[1 ]
325332 filename = os .path .splitext (os .path .basename (path ))[0 ]
326- print ("$(GENERATED_MUSIC)/instruments-%s.s: %s" % (filename , path ), file = f )
327- print ("$(GENERATED_MUSIC)/nss-%s.s: %s" % (filename , path ), file = f )
328- print ("Z80_%s_MUSIC+=$(GENERATED_MUSIC)/instruments-%s.s" % (mtype , filename ), file = f )
329- print ("Z80_%s_MUSIC+=$(GENERATED_MUSIC)/nss-%s.s" % (mtype , filename ), file = f )
330- print ("Z80_%s_OBJS=$(Z80_%s_MUSIC:%%.s=%%.rel)" % (gtype , mtype ), file = f )
331- print ("Z80_SOUND_SRCS+=$(Z80_%s_MUSIC)" % mtype , file = f )
332- if group >= 0 :
333- print ("Z80_MUSIC_OBJS+=$(Z80_BANK_PREFIX)%d.lib" % group , file = f )
334- print ("$(Z80_BANK%d_MUSIC): Z80_FLAGS=-b %d" % (group , group ), file = f )
335- print ("$(Z80_BANK%d_MUSIC_OBJS): $(SAMPLES_INC)" % group , file = f )
336- print ("$(Z80_BANK_PREFIX)%d.lib: $(Z80_BANK%d_MUSIC_OBJS)" % (group , group ), file = f )
337- print ("Z80_MUSIC_BANKS+=$(Z80_BANK_PREFIX)%d.bin" % group , file = f )
338-
339- print ('' , file = f )
333+ for ntype in ("instruments" , "nss" ):
334+ print ("" )
335+ if group >= 0 :
336+ print ("$(BUILDDIR_NSS)/%s-%s.s: NSS_FLAGS=-b %d" % (ntype , filename , group ), file = f )
337+ print ("$(BUILDDIR_NSS)/%s-%s.s: %s" % (ntype , filename , path ), file = f )
338+ print ("$(%s): $(BUILDDIR_NSS)/%s-%s.rel" % (drv , ntype , filename ), file = f )
339+ if group >= 0 :
340+ print ("$(%s): $(BUILDDIR_NSS)/%s-%s.rel" % (bank , ntype , filename ), file = f )
340341
341342
342343
0 commit comments