; ; How to build a .TUN file with a Z80 assembler ; This is designed for z80asm under Linux, but it's all pretty ; standard stuff. ; ; The actual notes for ITHOTMK come from the .MID file on Arsen Torbarina's ; Ultimate JSW Fan Page. ; CROTCHET EQU 10 ; Note durations MINIM EQU 20 SEMIBR EQU 40 ; ; Tune command bytes ; REST EQU 0 ; ; Bytes for the different notes ; CNAT EQU 48 ;Middle C CSHARP EQU 49 ;C# DNAT EQU 50 ;D DSHARP EQU 51 ;D# ENAT EQU 52 ;E FNAT EQU 53 ;F FSHARP EQU 54 ;F# GNAT EQU 55 ;G GSHARP EQU 56 ;G# ANAT EQU 57 ;A ASHARP EQU 58 ;A# BNAT EQU 59 ;B TUNECALL EQU 254 ;Call a sub-tune TUNERET EQU 253 ;Return from a sub-tune TUNEHLT EQU 255 ;End of tune OCTAVE EQU 12 ;Add "OCTAVE" to the notes to move up by 1 octave org 0F700h ;Address for in-game tune DEFW channel1 ;The 3 channels DEFW channel2 DEFW channel3 channel1: ; ; Bars 1-4 repeat as bars 9-12, so they are in a subroutine. ; DEFB TUNECALL DEFW first4 ; ; Bars 5-6 are the same as bars 1-2, so they are also in a subroutine. ; DEFB TUNECALL DEFW first2 ; ; Bars 7-8. ; DEFB DNAT+OCTAVE, CROTCHET DEFB BNAT, CROTCHET DEFB DNAT+OCTAVE, MINIM DEFB CSHARP+OCTAVE, SEMIBR ;Second 4 bars ; ; Bars 9-12 are a repeat of 1-4. ; DEFB TUNECALL DEFW first4 ;Third 4 bars ; ; Bars 13-16. ; DEFB FSHARP, CROTCHET DEFB GSHARP, CROTCHET DEFB ASHARP, CROTCHET DEFB BNAT, CROTCHET DEFB CSHARP+OCTAVE, CROTCHET DEFB ASHARP, CROTCHET DEFB CSHARP+OCTAVE, CROTCHET DEFB FSHARP+OCTAVE, CROTCHET DEFB CSHARP+OCTAVE, CROTCHET DEFB ASHARP, CROTCHET DEFB FSHARP, CROTCHET DEFB ASHARP, CROTCHET DEFB CSHARP+OCTAVE, SEMIBR DEFB TUNEHLT ; ; Subroutine for the first 2 bars ; first4: DEFB TUNECALL DEFW first2 DEFB DNAT+OCTAVE, CROTCHET DEFB BNAT, CROTCHET DEFB DNAT+OCTAVE, MINIM DEFB CSHARP+OCTAVE, CROTCHET DEFB ASHARP, CROTCHET DEFB CSHARP+OCTAVE, MINIM DEFB TUNERET ; first2: DEFB FSHARP, CROTCHET DEFB GSHARP, CROTCHET DEFB ASHARP, CROTCHET DEFB BNAT, CROTCHET DEFB CSHARP+OCTAVE, CROTCHET DEFB ASHARP, CROTCHET DEFB CSHARP+OCTAVE, MINIM DEFB TUNERET channel2: defb TUNEHLT channel3: defb TUNEHLT