sound.lst
ROM:0000 ; ===========================================================================
ROM:0000
ROM:0000 ; Segment type: Pure code
ROM:0000 segment ROM
ROM:0000 ld sp, 9B00h
ROM:0003 jp compute_checksum
ROM:0003 ; ---------------------------------------------------------------------------
ROM:0006 db [ 2 ], 0FFh
ROM:0008
ROM:0008 ; =============== S U B R O U T I N E =======================================
ROM:0008
ROM:0008 ; HL = HL + 2*A
ROM:0008
ROM:0008 HL_plus_2A: ; CODE XREF: process_interrupt+6E
ROM:0008 ; process_chunk+F
ROM:0008 ; process_chunk+3A
ROM:0008 add a, a
ROM:0009 jr nc, HL_plus_A ; HL = HL + A
ROM:000B inc h
ROM:000C jr HL_plus_A ; HL = HL + A
ROM:000C ; End of function HL_plus_2A
ROM:000C
ROM:000C ; ---------------------------------------------------------------------------
ROM:000E db [ 2 ], 0FFh
ROM:0010
ROM:0010 ; =============== S U B R O U T I N E =======================================
ROM:0010
ROM:0010 ; HL = HL + A
ROM:0010
ROM:0010 HL_plus_A: ; CODE XREF: HL_plus_2A+1
ROM:0010 ; HL_plus_2A+4
ROM:0010 ; process_interrupt+78
ROM:0010 ; play_sound_bis+9 ...
ROM:0010 add a, l
ROM:0011 ld l, a
ROM:0012 ret nc
ROM:0013 inc h
ROM:0014 ret
ROM:0014 ; End of function HL_plus_A
ROM:0014
ROM:0014 ; ---------------------------------------------------------------------------
ROM:0015 db [ 3 ], 0FFh
ROM:0018
ROM:0018 ; =============== S U B R O U T I N E =======================================
ROM:0018
ROM:0018 ; memset(HL, A, B)
ROM:0018
ROM:0018 MEMSET: ; CODE XREF: MEMSET+2j
ROM:0018 ; play_sound_bis+4C
ROM:0018 ; play_sound_bis+57
ROM:0018 ; start_sound+48 ...
ROM:0018 ld (hl), a
ROM:0019 inc hl
ROM:001A djnz MEMSET ; memset(HL, A, B)
ROM:001C ret
ROM:001C ; End of function MEMSET
ROM:001C
ROM:001C ; ---------------------------------------------------------------------------
ROM:001D db [ 49h ], 0FFh
ROM:0066
ROM:0066 ; =============== S U B R O U T I N E =======================================
ROM:0066
ROM:0066
ROM:0066 interrupt:
ROM:0066 ld a, 1
ROM:0068 ld (6822h), a
ROM:006B xor a
ROM:006C ld (6822h), a
ROM:006F call process_interrupt
ROM:0072 ret
ROM:0072 ; End of function interrupt
ROM:0072
ROM:0073
ROM:0073 ; =============== S U B R O U T I N E =======================================
ROM:0073
ROM:0073
ROM:0073 compute_checksum: ; CODE XREF: ROM:0003
ROM:0073 ld a, 1
ROM:0075 ld (6822h), a
ROM:0078 ld de, 9101h
ROM:007B
ROM:007B loc_7B: ; CODE XREF: compute_checksum+A
ROM:007B ld a, (de)
ROM:007C and a
ROM:007D jr nz, loc_7B
ROM:007F ld h, a
ROM:0080 ld l, a
ROM:0081 ld bc, 10h
ROM:0084
ROM:0084 loc_84: ; CODE XREF: compute_checksum+13
ROM:0084 ; compute_checksum+16
ROM:0084 add a, (hl)
ROM:0085 inc hl
ROM:0086 djnz loc_84
ROM:0088 dec c
ROM:0089 jr nz, loc_84
ROM:008B cp 0FFh
ROM:008D jr z, loc_91
ROM:008F ld a, 11h
ROM:0091
ROM:0091 loc_91: ; CODE XREF: compute_checksum+1A
ROM:0091 ld (de), a
ROM:0092
ROM:0092 loc_92: ; CODE XREF: compute_checksum+21
ROM:0092 ld a, (de)
ROM:0093 and a
ROM:0094 jr nz, loc_92
ROM:0096 xor a
ROM:0097 ld (6822h), a
ROM:009A ld hl, 9A00h
ROM:009D ld (hl), 0
ROM:009F ld de, 9A01h
ROM:00A2 ld bc, 0FFh
ROM:00A5 ldir
ROM:00A7
ROM:00A7 loc_A7: ; CODE XREF: compute_checksum:loc_A7
ROM:00A7 jr $
ROM:00A7 ; End of function compute_checksum
ROM:00A7
ROM:00A9
ROM:00A9 ; =============== S U B R O U T I N E =======================================
ROM:00A9
ROM:00A9
ROM:00A9 process_interrupt: ; CODE XREF: interrupt+9p
ROM:00A9 ld a, (all_initialized)
ROM:00AC and a
ROM:00AD jp nz, initialize_all ; if (init != 0) then do_init
ROM:00B0 ld hl, 9A60h ; 9A60 = 16 bytes which are copied to hw
ROM:00B3 ld (hl), 0
ROM:00B5 ld de, 9A61h
ROM:00B8 ld bc, 0Fh
ROM:00BB ldir
ROM:00BD ld a, (tables_initialized)
ROM:00C0 and a
ROM:00C1 jp nz, init_tables ; init tables @ 9AA0 (15h bytes)
ROM:00C1 ; and @ 9AC0 (16h bytes)
ROM:00C4 ld a, (credit)
ROM:00C7 and a
ROM:00C8 jr z, check_sound_00 ; if (credit != 0) then
ROM:00CA ld hl, sound08
ROM:00CD add a, (hl) ; sound08 += credit
ROM:00CE ld (hl), a
ROM:00CF xor a
ROM:00D0 ld (credit), a ; credit = 0
ROM:00D3
ROM:00D3 check_sound_00: ; CODE XREF: process_interrupt+1F
ROM:00D3 ld a, (sound00)
ROM:00D6 and a
ROM:00D7 jr z, check_sound_13
ROM:00D9 ld a, (byte_9211) ; 9211 is "outside" the RAM used by sound routines
ROM:00DC ld hl, sound00_count_0
ROM:00DF cp (hl)
ROM:00E0 jr z, loc_102
ROM:00E2 ld (sound00_count_0), a
ROM:00E5 inc a
ROM:00E6 jr z, select_table2
ROM:00E8 ld hl, TABLE1
ROM:00EB ld (ptr_table), hl
ROM:00EE xor a
ROM:00EF ld (byte_9A00), a
ROM:00F2 jr loc_FD
ROM:00F4 ; ---------------------------------------------------------------------------
ROM:00F4
ROM:00F4 select_table2: ; CODE XREF: process_interrupt+3D
ROM:00F4 ld hl, TABLE2
ROM:00F7 ld (ptr_table), hl
ROM:00FA ld (byte_9A00), a
ROM:00FD
ROM:00FD loc_FD: ; CODE XREF: process_interrupt+49
ROM:00FD ld (sound00_count_1), a
ROM:0100 jr set_freq_ch1
ROM:0102 ; ---------------------------------------------------------------------------
ROM:0102
ROM:0102 loc_102: ; CODE XREF: process_interrupt+37
ROM:0102 ld hl, 9A00h
ROM:0105 inc (hl)
ROM:0106 ld a, (hl)
ROM:0107 cp 22h ; '"'
ROM:0109 jr nz, update_sound00
ROM:010B ld (hl), 0
ROM:010D ld a, (sound00_count_1)
ROM:0110 inc a
ROM:0111 ld (sound00_count_1), a
ROM:0114
ROM:0114 set_freq_ch1: ; CODE XREF: process_interrupt+57
ROM:0114 ld hl, (ptr_table)
ROM:0117 rst 8 ; HL = HL + 2*A
ROM:0118 ld e, (hl)
ROM:0119 inc hl
ROM:011A ld d, (hl)
ROM:011B ld (data_table0), de
ROM:011F ld a, 1Fh ; A = 0x1F
ROM:0121 rst 10h ; HL = HL + A
ROM:0122 ld e, (hl)
ROM:0123 inc hl
ROM:0124 ld d, (hl)
ROM:0125 ld (freq_ch1), de
ROM:0129
ROM:0129 update_sound00: ; CODE XREF: process_interrupt+60
ROM:0129 ld hl, (freq_ch1)
ROM:012C ld de, (data_table0)
ROM:0130 add hl, de
ROM:0131 ld (freq_ch1), hl
ROM:0134 ld a, h
ROM:0135 ld (CH1_FREQ1), a
ROM:0138 rrca
ROM:0139 rrca
ROM:013A rrca
ROM:013B rrca
ROM:013C ld (CH1_FREQ2), a
ROM:013F ld a, 0Ah
ROM:0141 ld (CH1_VOL), a
ROM:0144 xor a ; A = 0
ROM:0145 ld (CH1_WAVESEL), a
ROM:0148
ROM:0148 check_sound_13: ; CODE XREF: process_interrupt+2E
ROM:0148 ld hl, sound_number
ROM:014B ld (hl), 13h ; sound number = 0x13
ROM:014D ld a, (sound13)
ROM:0150 and a
ROM:0151 jr z, check_continue_13
ROM:0153 xor a
ROM:0154 ld (sound13), a
ROM:0157 call start_sound
ROM:015A jr check_sound_0F
ROM:015C ; ---------------------------------------------------------------------------
ROM:015C
ROM:015C check_continue_13: ; CODE XREF: process_interrupt+A8
ROM:015C ld a, (in_sound13)
ROM:015F and a
ROM:0160 jr z, check_sound_0F
ROM:0162 call continue_sound
ROM:0165
ROM:0165 check_sound_0F: ; CODE XREF: process_interrupt+B1
ROM:0165 ; process_interrupt+B7
ROM:0165 ld hl, sound_number
ROM:0168 ld (hl), 0Fh ; sound number = 0xF
ROM:016A ld a, (sound0F)
ROM:016D and a
ROM:016E jr z, check_continue_0F
ROM:0170 xor a
ROM:0171 ld (sound0F), a
ROM:0174 call start_sound
ROM:0177 jr check_sound_03
ROM:0179 ; ---------------------------------------------------------------------------
ROM:0179
ROM:0179 check_continue_0F: ; CODE XREF: process_interrupt+C5
ROM:0179 ld a, (in_sound0F)
ROM:017C and a
ROM:017D jr z, check_sound_03
ROM:017F call continue_sound
ROM:0182
ROM:0182 check_sound_03: ; CODE XREF: process_interrupt+CE
ROM:0182 ; process_interrupt+D4
ROM:0182 ld hl, sound_number
ROM:0185 ld (hl), 3 ; sound number = 0x3
ROM:0187 ld a, (sound03)
ROM:018A and a
ROM:018B jr z, check_continue_03
ROM:018D xor a
ROM:018E ld (sound03), a
ROM:0191 call start_sound
ROM:0194 jr check_sound_02
ROM:0196 ; ---------------------------------------------------------------------------
ROM:0196
ROM:0196 check_continue_03: ; CODE XREF: process_interrupt+E2
ROM:0196 ld a, (in_sound03)
ROM:0199 and a
ROM:019A jr z, check_sound_02
ROM:019C call continue_sound
ROM:019F
ROM:019F check_sound_02: ; CODE XREF: process_interrupt+EB
ROM:019F ; process_interrupt+F1
ROM:019F ld hl, sound_number
ROM:01A2 ld (hl), 2 ; sound number = 0x2
ROM:01A4 ld a, (sound02)
ROM:01A7 and a
ROM:01A8 jr z, check_continue_02
ROM:01AA xor a
ROM:01AB ld (sound02), a
ROM:01AE call start_sound
ROM:01B1 jr check_sound_04
ROM:01B3 ; ---------------------------------------------------------------------------
ROM:01B3
ROM:01B3 check_continue_02: ; CODE XREF: process_interrupt+FF
ROM:01B3 ld a, (in_sound02)
ROM:01B6 and a
ROM:01B7 jr z, check_sound_04
ROM:01B9 call continue_sound
ROM:01BC
ROM:01BC check_sound_04: ; CODE XREF: process_interrupt+108
ROM:01BC ; process_interrupt+10E
ROM:01BC ld hl, sound_number
ROM:01BF ld (hl), 4 ; sound number = 4
ROM:01C1 ld a, (sound04)
ROM:01C4 and a
ROM:01C5 jr z, check_continue_04
ROM:01C7 xor a
ROM:01C8 ld (sound04), a
ROM:01CB call start_sound
ROM:01CE jr check_sound_01
ROM:01D0 ; ---------------------------------------------------------------------------
ROM:01D0
ROM:01D0 check_continue_04: ; CODE XREF: process_interrupt+11C
ROM:01D0 ld a, (in_sound04)
ROM:01D3 and a
ROM:01D4 jr z, check_sound_01
ROM:01D6 call continue_sound
ROM:01D9
ROM:01D9 check_sound_01: ; CODE XREF: process_interrupt+125
ROM:01D9 ; process_interrupt+12B
ROM:01D9 ld hl, sound_number
ROM:01DC ld (hl), 1 ; sound number = 1
ROM:01DE ld a, (sound01)
ROM:01E1 and a
ROM:01E2 jr z, check_continue_01
ROM:01E4 xor a
ROM:01E5 ld (sound01), a
ROM:01E8 call start_sound
ROM:01EB jr check_sound_12
ROM:01ED ; ---------------------------------------------------------------------------
ROM:01ED
ROM:01ED check_continue_01: ; CODE XREF: process_interrupt+139
ROM:01ED ld a, (in_sound01)
ROM:01F0 and a
ROM:01F1 jr z, check_sound_12
ROM:01F3 call continue_sound
ROM:01F6
ROM:01F6 check_sound_12: ; CODE XREF: process_interrupt+142
ROM:01F6 ; process_interrupt+148
ROM:01F6 ld a, (sound12)
ROM:01F9 and a
ROM:01FA jr z, check_sound_05
ROM:01FC ld hl, sound_number
ROM:01FF ld (hl), 12h ; sound number = 0x12
ROM:0201 call play_sound
ROM:0204
ROM:0204 check_sound_05: ; CODE XREF: process_interrupt+151
ROM:0204 ld a, (sound05)
ROM:0207 and a
ROM:0208 jr z, loc_236
ROM:020A ld hl, sound_number
ROM:020D ld (hl), 5 ; sound number = 0x5
ROM:020F call play_sound_bis
ROM:0212 ld hl, sound05_count ; sound 05 post-processing :
ROM:0212 ; decrease the volume
ROM:0215 inc (hl)
ROM:0216 ld a, (sound05_count)
ROM:0219 cp 6
ROM:021B jr c, loc_22E
ROM:021D ld (hl), 0
ROM:021F ld a, (sound05_vol)
ROM:0222 cp 4
ROM:0224 jr c, loc_229
ROM:0226 dec a
ROM:0227 jr loc_22B
ROM:0229 ; ---------------------------------------------------------------------------
ROM:0229
ROM:0229 loc_229: ; CODE XREF: process_interrupt+17B
ROM:0229 ld a, 0Ch
ROM:022B
ROM:022B loc_22B: ; CODE XREF: process_interrupt+17E
ROM:022B ld (sound05_vol), a
ROM:022E
ROM:022E loc_22E: ; CODE XREF: process_interrupt+172
ROM:022E ld a, (sound05_vol)
ROM:0231 ld (CH3_VOL), a
ROM:0234 jr check_sound_06
ROM:0236 ; ---------------------------------------------------------------------------
ROM:0236
ROM:0236 loc_236: ; CODE XREF: process_interrupt+15F
ROM:0236 ld (in_sound05), a
ROM:0239
ROM:0239 check_sound_06: ; CODE XREF: process_interrupt+18B
ROM:0239 ld a, (sound06)
ROM:023C and a
ROM:023D jr z, loc_263
ROM:023F ld hl, sound_number
ROM:0242 ld (hl), 6 ; sound number = 0x6
ROM:0244 call play_sound_bis
ROM:0247 ld hl, sound06_count ; sound 06 post-processing :
ROM:0247 ; toggle wave select
ROM:024A inc (hl)
ROM:024B ld a, (hl)
ROM:024C cp 1Ch
ROM:024E jr nz, loc_25B
ROM:0250 xor a
ROM:0251 ld (sound06_count), a
ROM:0254 ld a, (sound06_wavesel)
ROM:0257 inc a
ROM:0258 ld (sound06_wavesel), a
ROM:025B
ROM:025B loc_25B: ; CODE XREF: process_interrupt+1A5
ROM:025B ld a, (sound06_wavesel)
ROM:025E ld (CH3_WAVESEL), a
ROM:0261 jr check_sound_09
ROM:0263 ; ---------------------------------------------------------------------------
ROM:0263
ROM:0263 loc_263: ; CODE XREF: process_interrupt+194
ROM:0263 ld (in_sound06), a
ROM:0266
ROM:0266 check_sound_09: ; CODE XREF: process_interrupt+1B8
ROM:0266 ld a, (sound09)
ROM:0269 and a
ROM:026A jr z, loc_276
ROM:026C ld hl, sound_number
ROM:026F ld (hl), 9 ; sound number = 9
ROM:0271 call play_sound_bis
ROM:0274 jr check_sound_07
ROM:0276 ; ---------------------------------------------------------------------------
ROM:0276
ROM:0276 loc_276: ; CODE XREF: process_interrupt+1C1
ROM:0276 ld (in_sound09), a
ROM:0279
ROM:0279 check_sound_07: ; CODE XREF: process_interrupt+1CB
ROM:0279 ld a, (sound07)
ROM:027C and a
ROM:027D jr z, check_sound_11
ROM:027F ld hl, sound_number
ROM:0282 ld (hl), 7 ; sound number = 7
ROM:0284 call play_sound
ROM:0287
ROM:0287 check_sound_11: ; CODE XREF: process_interrupt+1D4
ROM:0287 ld a, (sound11)
ROM:028A and a
ROM:028B jr z, loc_297
ROM:028D ld hl, sound_number
ROM:0290 ld (hl), 11h ; sound number = 0x11
ROM:0292 call play_sound_bis
ROM:0295 jr check_sound_0D
ROM:0297 ; ---------------------------------------------------------------------------
ROM:0297
ROM:0297 loc_297: ; CODE XREF: process_interrupt+1E2
ROM:0297 ld (in_sound11), a
ROM:029A
ROM:029A check_sound_0D: ; CODE XREF: process_interrupt+1EC
ROM:029A ld a, (sound0D)
ROM:029D and a
ROM:029E jr z, check_sound_0E
ROM:02A0 ld hl, sound_number
ROM:02A3 ld (hl), 0Dh ; sound number = 0xD
ROM:02A5 call play_sound
ROM:02A8
ROM:02A8 check_sound_0E: ; CODE XREF: process_interrupt+1F5
ROM:02A8 ld a, (sound0E)
ROM:02AB and a
ROM:02AC jr z, check_sound_0E_part2
ROM:02AE ld hl, sound_number
ROM:02B1 ld (hl), 0Eh ; sound number = 0xE
ROM:02B3 call play_sound
ROM:02B6
ROM:02B6 check_sound_0E_part2: ; CODE XREF: process_interrupt+203
ROM:02B6 ld a, (sound0E)
ROM:02B9 and a
ROM:02BA jr z, check_sound_14
ROM:02BC ld a, 9
ROM:02BE ld (CH2_VOL), a
ROM:02C1 ld a, 6
ROM:02C3 ld (CH3_VOL), a
ROM:02C6
ROM:02C6 check_sound_14: ; CODE XREF: process_interrupt+211
ROM:02C6 ld a, (sound14)
ROM:02C9 and a
ROM:02CA jr z, check_sound_15
ROM:02CC ld hl, sound_number
ROM:02CF ld (hl), 14h ; sound number = 0x14
ROM:02D1 call play_sound
ROM:02D4
ROM:02D4 check_sound_15: ; CODE XREF: process_interrupt+221
ROM:02D4 ld a, (sound15)
ROM:02D7 and a
ROM:02D8 jr z, check_sound_0A
ROM:02DA ld hl, sound_number
ROM:02DD ld (hl), 15h ; sound number = 0x15
ROM:02DF call play_sound
ROM:02E2
ROM:02E2 check_sound_0A: ; CODE XREF: process_interrupt+22F
ROM:02E2 ld a, (sound0A)
ROM:02E5 and a
ROM:02E6 jr z, check_sound_0B
ROM:02E8 ld hl, sound_number
ROM:02EB ld (hl), 0Ah ; sound number = 0xA
ROM:02ED call play_sound
ROM:02F0
ROM:02F0 check_sound_0B: ; CODE XREF: process_interrupt+23D
ROM:02F0 ld a, (sound0B)
ROM:02F3 and a
ROM:02F4 jr z, check_sound_10
ROM:02F6 ld hl, sound_number
ROM:02F9 ld (hl), 0Bh ; sound number = 0xB
ROM:02FB call play_sound
ROM:02FE
ROM:02FE check_sound_10: ; CODE XREF: process_interrupt+24B
ROM:02FE ld a, (sound10)
ROM:0301 and a
ROM:0302 jr z, loc_30E
ROM:0304 ld hl, sound_number
ROM:0307 ld (hl), 10h ; sound number = 0x10
ROM:0309 call play_sound_bis
ROM:030C jr check_sound_0C
ROM:030E ; ---------------------------------------------------------------------------
ROM:030E
ROM:030E loc_30E: ; CODE XREF: process_interrupt+259
ROM:030E ld (in_sound10), a
ROM:0311
ROM:0311 check_sound_0C: ; CODE XREF: process_interrupt+263
ROM:0311 ld a, (sound0C)
ROM:0314 and a
ROM:0315 jr z, check_sound_16
ROM:0317 ld hl, sound_number
ROM:031A ld (hl), 0Ch ; sound number = 0xC
ROM:031C call play_sound
ROM:031F
ROM:031F check_sound_16: ; CODE XREF: process_interrupt+26C
ROM:031F ld a, (sound16)
ROM:0322 and a
ROM:0323 jr z, check_sound_8
ROM:0325 ld hl, sound_number
ROM:0328 ld (hl), 16h ; sound number = 0x16
ROM:032A call play_sound
ROM:032D
ROM:032D check_sound_8: ; CODE XREF: process_interrupt+27A
ROM:032D ld a, (sound08)
ROM:0330 and a
ROM:0331 jr z, copy_to_hw2
ROM:0333 ld hl, sound_number
ROM:0336 ld (hl), 8 ; sound number = 0x8
ROM:0338 call play_sound
ROM:033B
ROM:033B copy_to_hw2: ; CODE XREF: process_interrupt+288
ROM:033B jr copy_to_hw
ROM:033D ; ---------------------------------------------------------------------------
ROM:033D
ROM:033D init_tables: ; CODE XREF: process_interrupt+18
ROM:033D ld hl, 9AA0h
ROM:0340 ld (hl), 0
ROM:0342 ld de, 9AA1h
ROM:0345 ld bc, 15h
ROM:0348 ldir ; memset(9AA0, 0, 0x15)
ROM:034A ld hl, 9AC0h
ROM:034D ld (hl), 0
ROM:034F ld de, 9AC1h
ROM:0352 ld bc, 16h
ROM:0355 ldir ; memset(9AC0, 0, 0x16)
ROM:0357
ROM:0357 copy_to_hw: ; CODE XREF: process_interrupt:copy_to_hw2
ROM:0357 ld hl, CH1_FREQ0
ROM:035A ld de, 6810h
ROM:035D ld bc, 10h
ROM:0360 ldir ; copy voices data to hardware
ROM:0362 ld a, (CH1_WAVESEL)
ROM:0365 ld (6805h), a
ROM:0368 ld a, (CH2_WAVESEL)
ROM:036B ld (680Ah), a
ROM:036E ld a, (CH3_WAVESEL)
ROM:0371 ld (680Fh), a
ROM:0374 ret
ROM:0374 ; End of function process_interrupt
ROM:0374
ROM:0375
ROM:0375 ; =============== S U B R O U T I N E =======================================
ROM:0375
ROM:0375
ROM:0375 play_sound_bis: ; CODE XREF: process_interrupt+166p
ROM:0375 ; process_interrupt+19Bp
ROM:0375 ; process_interrupt+1C8p
ROM:0375 ; process_interrupt+1E9p ...
ROM:0375 ld hl, sound_number
ROM:0378 ld a, (hl)
ROM:0379 add a, a
ROM:037A add a, (hl) ; A = 3 * sound_number
ROM:037B ld hl, TABLE3 ; 3 columns : offset, length and voice_number
ROM:037E rst 10h ; HL = HL + A
ROM:037F ld de, offset
ROM:0382 ld bc, 3
ROM:0385 ldir ; read 3 bytes from table to offset,
ROM:0385 ; length and voice_number
ROM:0387 ld a, (sound_number)
ROM:038A cp 0Eh ; if 0xE, continue further
ROM:038C jr nz, loc_3A6
ROM:038E ld a, (b_9A30_plus_1C)
ROM:0391 and a
ROM:0392 jr z, loc_3A1
ROM:0394 dec a
ROM:0395 jr z, loc_39D
ROM:0397 ld a, (b_9A30_plus_1D)
ROM:039A and a
ROM:039B jr nz, loc_3A6
ROM:039D
ROM:039D loc_39D: ; CODE XREF: play_sound_bis+20
ROM:039D ld a, 2 ; length = 2
ROM:039F jr loc_3A3
ROM:03A1 ; ---------------------------------------------------------------------------
ROM:03A1
ROM:03A1 loc_3A1: ; CODE XREF: play_sound_bis+1D
ROM:03A1 ld a, 1 ; length = 1
ROM:03A3
ROM:03A3 loc_3A3: ; CODE XREF: play_sound_bis+2A
ROM:03A3 ld (length), a
ROM:03A6
ROM:03A6 loc_3A6: ; CODE XREF: play_sound_bis+17
ROM:03A6 ; play_sound_bis+26
ROM:03A6 ld hl, 9AC0h ; table in RAM (16h bytes)
ROM:03A9 ld a, (sound_number)
ROM:03AC add a, l
ROM:03AD ld l, a
ROM:03AE ld a, (hl)
ROM:03AF and a ; check in_sound[sound_number]
ROM:03B0 jr nz, process_all_chunks
ROM:03B2 inc (hl) ; in_sound[sound_number] = 1
ROM:03B3 ld hl, length
ROM:03B6 ld b, (hl)
ROM:03B7 ld c, b ; save length in C
ROM:03B8 ld hl, 9A30h ; song offsets table
ROM:03BB ld a, (offset)
ROM:03BE add a, l
ROM:03BF ld l, a
ROM:03C0 xor a ; A = 0
ROM:03C1 rst 18h ; memset(HL, A, B)
ROM:03C2 ld b, c ; restore length in B
ROM:03C3 ld hl, 9A00h
ROM:03C6 ld a, (offset)
ROM:03C9 add a, l
ROM:03CA ld l, a
ROM:03CB xor a ; A = 0
ROM:03CC rst 18h ; memset(HL, A, B)
ROM:03CD
ROM:03CD process_all_chunks: ; CODE XREF: play_sound_bis+3B
ROM:03CD ; play_sound_bis+69
ROM:03CD call process_chunk
ROM:03D0 ld hl, length
ROM:03D3 dec (hl) ; length--
ROM:03D4 jr z, length_is_zero
ROM:03D6 ld hl, offset
ROM:03D9 inc (hl) ; offset++
ROM:03DA ld hl, voice_number
ROM:03DD inc (hl) ; voice_number++
ROM:03DE jr process_all_chunks
ROM:03E0 ; ---------------------------------------------------------------------------
ROM:03E0
ROM:03E0 length_is_zero: ; CODE XREF: play_sound_bis+5F
ROM:03E0 ld a, (chunk_finished)
ROM:03E3 and a
ROM:03E4 ret z
ROM:03E5 xor a
ROM:03E6 ld (chunk_finished), a
ROM:03E9 ld hl, 9AC0h
ROM:03EC ld a, (sound_number)
ROM:03EF add a, l
ROM:03F0 ld l, a
ROM:03F1 ld (hl), 0 ; in_sound[sound_number] = 0
ROM:03F3 ret
ROM:03F3 ; End of function play_sound_bis
ROM:03F3
ROM:03F4
ROM:03F4 ; =============== S U B R O U T I N E =======================================
ROM:03F4
ROM:03F4
ROM:03F4 start_sound: ; CODE XREF: process_interrupt+AEp
ROM:03F4 ; process_interrupt+CBp
ROM:03F4 ; process_interrupt+E8p
ROM:03F4 ; process_interrupt+105p ...
ROM:03F4 ld hl, 9AC0h
ROM:03F7 ld a, (sound_number)
ROM:03FA add a, l
ROM:03FB ld l, a
ROM:03FC inc (hl) ; in_sound[sound_number] = 1
ROM:03FD ld hl, sound_number
ROM:0400 ld a, (hl)
ROM:0401 add a, a
ROM:0402 add a, (hl) ; A = 3 * sound_number
ROM:0403 ld hl, TABLE3 ; 3 columns : offset, length and voice_number
ROM:0406 rst 10h ; HL = HL + A
ROM:0407 ld de, offset
ROM:040A ld bc, 3
ROM:040D ldir ; read 3 bytes from table to offset,
ROM:040D ; length and voice_number
ROM:040F ld a, (sound_number)
ROM:0412 cp 0Eh
ROM:0414 jr nz, start_sound_2
ROM:0416 ld a, (b_9A30_plus_1C) ; special case if sound_number == E
ROM:0419 and a
ROM:041A jr z, loc_429
ROM:041C dec a
ROM:041D jr z, loc_425
ROM:041F ld a, (b_9A30_plus_1D)
ROM:0422 and a
ROM:0423 jr nz, start_sound_2
ROM:0425
ROM:0425 loc_425: ; CODE XREF: start_sound+29
ROM:0425 ld a, 2
ROM:0427 jr loc_42B
ROM:0429 ; ---------------------------------------------------------------------------
ROM:0429
ROM:0429 loc_429: ; CODE XREF: start_sound+26
ROM:0429 ld a, 1
ROM:042B
ROM:042B loc_42B: ; CODE XREF: start_sound+33
ROM:042B ld (length), a
ROM:042E
ROM:042E start_sound_2: ; CODE XREF: start_sound+20
ROM:042E ; start_sound+2F
ROM:042E ld hl, length
ROM:0431 ld b, (hl)
ROM:0432 ld c, b
ROM:0433 ld hl, 9A30h
ROM:0436 ld a, (offset)
ROM:0439 add a, l
ROM:043A ld l, a
ROM:043B xor a
ROM:043C rst 18h ; memset(9A30 + rom_offets, 0, length)
ROM:043D ld b, c
ROM:043E ld hl, 9A00h
ROM:0441 ld a, (offset)
ROM:0444 add a, l
ROM:0445 ld l, a
ROM:0446 xor a
ROM:0447 rst 18h ; memset(9A00 + roms_offsets, 0, length)
ROM:0448 jr continue_sound_2
ROM:0448 ; End of function start_sound
ROM:0448
ROM:044A
ROM:044A ; =============== S U B R O U T I N E =======================================
ROM:044A
ROM:044A
ROM:044A continue_sound: ; CODE XREF: process_interrupt+B9p
ROM:044A ; process_interrupt+D6p
ROM:044A ; process_interrupt+F3p
ROM:044A ; process_interrupt+110p ...
ROM:044A ld hl, sound_number
ROM:044D ld a, (hl)
ROM:044E add a, a
ROM:044F add a, (hl) ; A = 3 * sound_number
ROM:0450 ld hl, TABLE3 ; 3 columns : offset, length and voice_number
ROM:0453 rst 10h ; HL = HL + A
ROM:0454 ld de, offset
ROM:0457 ld bc, 3
ROM:045A ldir ; read 3 bytes from TABLE : offset, length, voice_number
ROM:045C ld a, (sound_number)
ROM:045F cp 0Eh
ROM:0461 jr nz, continue_sound_2
ROM:0463 ld a, (b_9A30_plus_1C)
ROM:0466 and a
ROM:0467 jr z, loc_476
ROM:0469 dec a
ROM:046A jr z, loc_472
ROM:046C ld a, (b_9A30_plus_1D)
ROM:046F and a
ROM:0470 jr nz, continue_sound_2
ROM:0472
ROM:0472 loc_472: ; CODE XREF: continue_sound+20
ROM:0472 ld a, 2
ROM:0474 jr loc_478
ROM:0476 ; ---------------------------------------------------------------------------
ROM:0476
ROM:0476 loc_476: ; CODE XREF: continue_sound+1D
ROM:0476 ld a, 1
ROM:0478
ROM:0478 loc_478: ; CODE XREF: continue_sound+2A
ROM:0478 ld (length), a
ROM:047B
ROM:047B continue_sound_2: ; CODE XREF: start_sound+54
ROM:047B ; continue_sound+17
ROM:047B ; continue_sound+26
ROM:047B ; continue_sound+42
ROM:047B call process_chunk
ROM:047E ld hl, length
ROM:0481 dec (hl)
ROM:0482 jr z, loc_48E
ROM:0484 ld hl, offset
ROM:0487 inc (hl)
ROM:0488 ld hl, voice_number
ROM:048B inc (hl)
ROM:048C jr continue_sound_2
ROM:048E ; ---------------------------------------------------------------------------
ROM:048E
ROM:048E loc_48E: ; CODE XREF: continue_sound+38
ROM:048E ld a, (chunk_finished)
ROM:0491 and a
ROM:0492 ret z
ROM:0493 xor a
ROM:0494 ld (chunk_finished), a
ROM:0497 ld hl, 9AC0h
ROM:049A ld a, (sound_number)
ROM:049D add a, l
ROM:049E ld l, a
ROM:049F ld (hl), 0 ; in_sound[sound_number] = 0
ROM:04A1 ret
ROM:04A1 ; End of function continue_sound
ROM:04A1
ROM:04A2
ROM:04A2 ; =============== S U B R O U T I N E =======================================
ROM:04A2
ROM:04A2
ROM:04A2 play_sound: ; CODE XREF: process_interrupt+158p
ROM:04A2 ; process_interrupt+1DBp
ROM:04A2 ; process_interrupt+1FCp
ROM:04A2 ; process_interrupt+20Ap ...
ROM:04A2 ld hl, sound_number
ROM:04A5 ld a, (hl)
ROM:04A6 add a, a
ROM:04A7 add a, (hl) ; A = 3 * sound_number
ROM:04A8 ld hl, TABLE3 ; 3 columns : offset, length and voice_number
ROM:04AB rst 10h ; HL = HL + A
ROM:04AC ld de, 9A75h
ROM:04AF ld bc, 3
ROM:04B2 ldir ; read 3 bytes from TABLE : offset, length, voice_number
ROM:04B4 ld a, (sound_number)
ROM:04B7 cp 0Eh
ROM:04B9 jr nz, play_sound_2
ROM:04BB ld a, (b_9A30_plus_1C)
ROM:04BE and a
ROM:04BF jr z, loc_4CE
ROM:04C1 dec a
ROM:04C2 jr z, loc_4CA
ROM:04C4 ld a, (b_9A30_plus_1D)
ROM:04C7 and a
ROM:04C8 jr nz, play_sound_2
ROM:04CA
ROM:04CA loc_4CA: ; CODE XREF: play_sound+20
ROM:04CA ld a, 2
ROM:04CC jr loc_4D0
ROM:04CE ; ---------------------------------------------------------------------------
ROM:04CE
ROM:04CE loc_4CE: ; CODE XREF: play_sound+1D
ROM:04CE ld a, 1
ROM:04D0
ROM:04D0 loc_4D0: ; CODE XREF: play_sound+2A
ROM:04D0 ld (length), a
ROM:04D3
ROM:04D3 play_sound_2: ; CODE XREF: play_sound+17
ROM:04D3 ; play_sound+26
ROM:04D3 ld hl, 9AC0h
ROM:04D6 ld a, (sound_number)
ROM:04D9 add a, l
ROM:04DA ld l, a
ROM:04DB ld a, (hl) ; check in_sound[sound_number]
ROM:04DC and a
ROM:04DD jr nz, play_sound_3 ; already initialized, go to play_sound_3 directly
ROM:04DF inc (hl) ; in_sound[sound_number] = 1
ROM:04E0 ld hl, length
ROM:04E3 ld b, (hl)
ROM:04E4 ld c, b
ROM:04E5 ld hl, 9A30h
ROM:04E8 ld a, (offset)
ROM:04EB add a, l
ROM:04EC ld l, a
ROM:04ED xor a
ROM:04EE rst 18h ; memset(HL, A, B)
ROM:04EF ld b, c
ROM:04F0 ld hl, 9A00h
ROM:04F3 ld a, (offset)
ROM:04F6 add a, l
ROM:04F7 ld l, a
ROM:04F8 xor a
ROM:04F9 rst 18h ; memset(HL, A, B)
ROM:04FA
ROM:04FA play_sound_3: ; CODE XREF: play_sound+3B
ROM:04FA ; play_sound+69
ROM:04FA call process_chunk
ROM:04FD ld hl, length
ROM:0500 dec (hl)
ROM:0501 jr z, loc_50D
ROM:0503 ld hl, offset
ROM:0506 inc (hl)
ROM:0507 ld hl, voice_number
ROM:050A inc (hl)
ROM:050B jr play_sound_3
ROM:050D ; ---------------------------------------------------------------------------
ROM:050D
ROM:050D loc_50D: ; CODE XREF: play_sound+5F
ROM:050D ld a, (chunk_finished)
ROM:0510 and a
ROM:0511 ret z
ROM:0512 xor a
ROM:0513 ld (chunk_finished), a
ROM:0516 ld hl, 9AC0h
ROM:0519 ld a, (sound_number)
ROM:051C add a, l
ROM:051D ld l, a
ROM:051E ld (hl), 0 ; in_sound[sound_number] = 0
ROM:0520 ld hl, 9AA0h
ROM:0523 ld a, (sound_number)
ROM:0526 add a, l
ROM:0527 ld l, a ; HL = 9AA0 + sound_number
ROM:0528 ld a, (sound_number)
ROM:052B cp 8
ROM:052D jr z, sound08_done
ROM:052F cp 0Ch
ROM:0531 jr z, sound0C_done
ROM:0533 cp 14h
ROM:0535 jr z, sound14_done
ROM:0537 ld (hl), 0 ; 9AA0[sound_number] = 0
ROM:0539 ret
ROM:053A ; ---------------------------------------------------------------------------
ROM:053A
ROM:053A sound08_done: ; CODE XREF: play_sound+8B
ROM:053A dec (hl)
ROM:053B ret
ROM:053C ; ---------------------------------------------------------------------------
ROM:053C
ROM:053C sound0C_done: ; CODE XREF: play_sound+8F
ROM:053C dec (hl)
ROM:053D jr z, set_sound16
ROM:053F bit 0, (hl)
ROM:0541 ret z
ROM:0542
ROM:0542 set_sound16: ; CODE XREF: play_sound+9B
ROM:0542 ld a, 1
ROM:0544 ld (sound16), a
ROM:0547 ret
ROM:0548 ; ---------------------------------------------------------------------------
ROM:0548
ROM:0548 sound14_done: ; CODE XREF: play_sound+93
ROM:0548 ld (hl), 0
ROM:054A ld hl, sound13
ROM:054D ld (hl), 1
ROM:054F ret
ROM:054F ; End of function play_sound
ROM:054F
ROM:0550
ROM:0550 ; =============== S U B R O U T I N E =======================================
ROM:0550
ROM:0550
ROM:0550 process_chunk: ; CODE XREF: play_sound_bis:process_all_chunksp
ROM:0550 ; continue_sound:continue_sound_2p
ROM:0550 ; play_sound:play_sound_3p
ROM:0550 ld hl, 9A00h
ROM:0553 ld a, (offset)
ROM:0556 add a, l
ROM:0557 ld l, a ; HL = 9A00 + (9A75)
ROM:0558 inc (hl) ; (HL)++
ROM:0559 ld a, (offset)
ROM:055C ld hl, TABLE4
ROM:055F rst 8 ; HL = TABLE + 2*(9A75)
ROM:0560 ld e, (hl)
ROM:0561 inc hl
ROM:0562 ld d, (hl) ; DE = pointer from ROM
ROM:0563 ex de, hl
ROM:0564 ld de, 9A88h
ROM:0567 ld bc, 3
ROM:056A ldir ; copy 3 bytes from ROM to data0, data1 and wavesel
ROM:056C ex de, hl
ROM:056D ld hl, 9A30h ; HL = 9A30 DE = ptr to data in ROM (4th byte)
ROM:056D ; 9A30 = start of array, one entry per "song"
ROM:056D ; where each byte = current position in song
ROM:0570 ld a, (offset)
ROM:0573 add a, l
ROM:0574 ld l, a ; HL = 9A30 + (9A75)
ROM:0575 ld a, (hl) ; A = offset to current data
ROM:0576 ex de, hl ; HL = ptr to data in ROM (4th byte)
ROM:0577 rst 10h ; HL = HL + A
ROM:0578 ld (rom_ptr), hl
ROM:057B ld a, (hl) ; read data from ROM
ROM:057C inc a
ROM:057D jp z, got_ff ; did we read ROM:0580 ld de, TABLE0
ROM:0583 ld hl, (rom_ptr) ; HL = ptr to data in ROM
ROM:0586 ld a, (hl)
ROM:0587 and 0Fh ; A = lower nibble from data in ROM
ROM:0589 ex de, hl ; DE = ptr to data in ROM, HL = TABLE
ROM:058A rst 8 ; HL = HL + 2*A
ROM:058B ld c, (hl) ; HL = TABLE + 2*(DATA & 0xF)
ROM:058C inc hl
ROM:058D ld b, (hl) ; BC = 16 bits from table
ROM:058E ex de, hl
ROM:058F ld a, (hl) ; HL = ptr to data in ROM
ROM:0590 rrca
ROM:0591 rrca
ROM:0592 rrca
ROM:0593 rrca
ROM:0594 and 0Fh ; A = upper nibble from data in ROM
ROM:0596 jr z, upper_nibble_zero
ROM:0598
ROM:0598 upper_nibble_non_zero: ; CODE XREF: process_chunk+4D
ROM:0598 srl b ; Compute BC = BC >> A
ROM:059A rr c
ROM:059C dec a
ROM:059D jr nz, upper_nibble_non_zero
ROM:059F
ROM:059F upper_nibble_zero: ; CODE XREF: process_chunk+46
ROM:059F ld a, (voice_number)
ROM:05A2 and a
ROM:05A3 jr z, voice_1
ROM:05A5 dec a
ROM:05A6 jr z, voice_2
ROM:05A8 ld hl, CH3_FREQ1 ; voice 3 freq
ROM:05AB jr store_freq
ROM:05AD ; ---------------------------------------------------------------------------
ROM:05AD
ROM:05AD voice_2: ; CODE XREF: process_chunk+56
ROM:05AD ld hl, CH2_FREQ1 ; voice 2 freq
ROM:05B0 jr store_freq
ROM:05B2 ; ---------------------------------------------------------------------------
ROM:05B2
ROM:05B2 voice_1: ; CODE XREF: process_chunk+53
ROM:05B2 ld hl, CH1_FREQ1 ; voice 1 freq
ROM:05B5
ROM:05B5 store_freq: ; CODE XREF: process_chunk+5B
ROM:05B5 ; process_chunk+60
ROM:05B5 ld (hl), c ; Store BC (the frequency) as 4 nibbles
ROM:05B5 ; FREQ1 = C
ROM:05B6 ld a, (hl)
ROM:05B7 rrca
ROM:05B8 rrca
ROM:05B9 rrca
ROM:05BA rrca
ROM:05BB inc hl
ROM:05BC ld (hl), a ; FREQ2 = C >> 4
ROM:05BD inc hl
ROM:05BE ld (hl), b ; FREQ2 = B
ROM:05BF ld a, (hl)
ROM:05C0 rrca
ROM:05C1 rrca
ROM:05C2 rrca
ROM:05C3 rrca
ROM:05C4 inc hl
ROM:05C5 ld (hl), a ; FREQ3 = B >> 4
ROM:05C6
ROM:05C6 volume:
ROM:05C6 ld a, (voice_number)
ROM:05C9 and a
ROM:05CA jr z, voice_1_vol
ROM:05CC dec a
ROM:05CD jr z, voice_2_vol
ROM:05CF ld de, CH3_VOL ; DE = voice 3 volume
ROM:05D2 jr adjust_vol
ROM:05D4 ; ---------------------------------------------------------------------------
ROM:05D4
ROM:05D4 voice_2_vol: ; CODE XREF: process_chunk+7D
ROM:05D4 ld de, CH2_VOL ; DE = voice 2 volume
ROM:05D7 jr adjust_vol
ROM:05D9 ; ---------------------------------------------------------------------------
ROM:05D9
ROM:05D9 voice_1_vol: ; CODE XREF: process_chunk+7A
ROM:05D9 ld de, CH1_VOL ; DE = voice 1 volume
ROM:05DC
ROM:05DC adjust_vol: ; CODE XREF: process_chunk+82
ROM:05DC ; process_chunk+87
ROM:05DC ld hl, (rom_ptr)
ROM:05DF ld a, (hl)
ROM:05E0 sub 0Ch ; A = DATA - 0xC
ROM:05E2 jr z, vol_nul
ROM:05E4 ld a, (data0)
ROM:05E7 and a
ROM:05E8 jr z, data0_zero
ROM:05EA dec a
ROM:05EB jr z, data0_one
ROM:05ED
ROM:05ED data0_gt_one:
ROM:05ED ld hl, 9A00h
ROM:05F0 ld a, (offset)
ROM:05F3 add a, l
ROM:05F4 ld l, a ; HL = 9A00 + offset
ROM:05F5 ld a, (hl)
ROM:05F6 cp 6
ROM:05F8 jr nc, data0_zero
ROM:05FA cpl
ROM:05FB jr store_vol
ROM:05FD ; ---------------------------------------------------------------------------
ROM:05FD
ROM:05FD data0_one: ; CODE XREF: process_chunk+9B
ROM:05FD ld hl, 9A00h
ROM:0600 ld a, (offset)
ROM:0603 add a, l
ROM:0604 ld l, a
ROM:0605 ld a, (hl)
ROM:0606 cp 6
ROM:0608 jr nc, data0_zero
ROM:060A add a, a
ROM:060B jr store_vol
ROM:060D ; ---------------------------------------------------------------------------
ROM:060D
ROM:060D data0_zero: ; CODE XREF: process_chunk+98
ROM:060D ; process_chunk+A8
ROM:060D ; process_chunk+B8
ROM:060D ld a, (data1)
ROM:0610 and a
ROM:0611 jr z, data1_zero
ROM:0613 ld b, a ; save data1 in B
ROM:0614 ld hl, 9A00h
ROM:0617 ld a, (offset)
ROM:061A add a, l
ROM:061B ld l, a ; HL = 9A00 + offset
ROM:061C ld a, (hl)
ROM:061D sub b ; subtract B from current value in table
ROM:061E jr c, data1_zero
ROM:0620 sub 0Ah ; subtract 0xA from that
ROM:0622 jr nc, vol_nul
ROM:0624 neg ; if still positive, negate
ROM:0626 jr store_vol
ROM:0628 ; ---------------------------------------------------------------------------
ROM:0628
ROM:0628 vol_nul: ; CODE XREF: process_chunk+92
ROM:0628 ; process_chunk+D2
ROM:0628 xor a ; constant volume 0
ROM:0629 jr store_vol
ROM:062B ; ---------------------------------------------------------------------------
ROM:062B
ROM:062B data1_zero: ; CODE XREF: process_chunk+C1
ROM:062B ; process_chunk+CE
ROM:062B ld a, 0Ah ; constant volume 0xA
ROM:062D
ROM:062D store_vol: ; CODE XREF: process_chunk+AB
ROM:062D ; process_chunk+BB
ROM:062D ; process_chunk+D6
ROM:062D ; process_chunk+D9
ROM:062D ld (de), a ; DE = voice volume
ROM:062E
ROM:062E store_wavesel:
ROM:062E ld hl, 9A70h
ROM:0631 ld a, (voice_number)
ROM:0634 add a, l
ROM:0635 ld l, a ; HL = pointer to CHx_WAVESEL
ROM:0636 ld a, (wavesel)
ROM:0639 ld (hl), a ; store wave select
ROM:063A ld hl, TABLE5
ROM:063D ld a, (sound_number)
ROM:0640 rst 10h ; HL = HL + A
ROM:0641 ld a, (hl) ; A = data from table
ROM:0642 ld hl, (rom_ptr)
ROM:0645 inc hl
ROM:0646 ld e, (hl) ; E = next DATA byte in ROM
ROM:0647 ld d, 0 ; DE = E (on 16bits)
ROM:0649 ld hl, 0
ROM:064C ld b, 8 ; B = 8
ROM:064C ;
ROM:064C ; For each bit set in A, we add DE << 'bit position' to HL
ROM:064E
ROM:064E loc_64E: ; CODE XREF: process_chunk+107
ROM:064E srl a ; A = A >> 1
ROM:0650 jr nc, loc_653
ROM:0652 add hl, de ; HL = HL + DE
ROM:0653
ROM:0653 loc_653: ; CODE XREF: process_chunk+100
ROM:0653 sla e
ROM:0655 rl d ; DE = DE << 1
ROM:0657 djnz loc_64E
ROM:0659 ld b, l ; save low byte of result in B
ROM:065A ld hl, 9A00h
ROM:065D ld a, (offset)
ROM:0660 add a, l
ROM:0661 ld l, a ; HL = 9A00 + offset
ROM:0662 ld a, b ; A = low byte of result (from above)
ROM:0663 cp (hl) ; compare with value in table
ROM:0664 ret nz ; and return if they are different
ROM:0665 ld hl, 9A30h
ROM:0668 ld a, (offset)
ROM:066B add a, l
ROM:066C ld l, a ; HL = 9A30 + offset
ROM:066D inc (hl)
ROM:066E inc (hl) ; (HL) += 2, so we move 2 bytes forward in the song data
ROM:066F ld hl, 9A00h
ROM:0672 ld a, (offset)
ROM:0675 add a, l
ROM:0676 ld l, a
ROM:0677 ld (hl), 0 ; and reset the counter in table 9A00
ROM:0679 ret
ROM:067A ; ---------------------------------------------------------------------------
ROM:067A
ROM:067A initialize_all: ; CODE XREF: process_interrupt+4
ROM:067A ld hl, 9A00h
ROM:067D ld (hl), 0
ROM:067F ld de, 9A01h
ROM:0682 ld bc, 0FFh
ROM:0685 ldir ; memset(9A00, 0, 256)
ROM:0687 ld sp, 9B00h
ROM:068A ret
ROM:068B ; ---------------------------------------------------------------------------
ROM:068B
ROM:068B got_ff: ; CODE XREF: process_chunk+2D
ROM:068B ld a, (voice_number)
ROM:068E and a
ROM:068F jr z, voice1_vol ; HL = voice 1 volume
ROM:0691 dec a
ROM:0692 jr z, voice2_vol
ROM:0694 ld hl, 9A6Fh ; HL = voice 3 volume
ROM:0697 jr set_vol_to_zero
ROM:0699 ; ---------------------------------------------------------------------------
ROM:0699
ROM:0699 voice2_vol: ; CODE XREF: process_chunk+142
ROM:0699 ld hl, 9A6Ah ; HL = voice 2 volume
ROM:069C jr set_vol_to_zero
ROM:069E ; ---------------------------------------------------------------------------
ROM:069E
ROM:069E voice1_vol: ; CODE XREF: process_chunk+13F
ROM:069E ld hl, 9A65h ; HL = voice 1 volume
ROM:06A1
ROM:06A1 set_vol_to_zero: ; CODE XREF: process_chunk+147
ROM:06A1 ; process_chunk+14C
ROM:06A1 ld (hl), 0 ; set volume of selecte voice to 0
ROM:06A3 ld a, 1
ROM:06A5 ld (chunk_finished), a
ROM:06A8 ret
ROM:06A8 ; End of function process_chunk
ROM:06A8
ROM:06A8 ; ---------------------------------------------------------------------------
ROM:06A9 TABLE0: dw 8150h ; DATA XREF: process_chunk+30
ROM:06A9 ; base frequencies before shift
ROM:06AB dw 8900h
ROM:06AD dw 9126h
ROM:06AF dw 99C8h
ROM:06B1 dw 0A2ECh
ROM:06B3 dw 0AC9Dh
ROM:06B5 dw 0B6E0h
ROM:06B7 dw 0C1C0h
ROM:06B9 dw 0CD45h
ROM:06BB dw 0D97Ah
ROM:06BD dw 0E669h
ROM:06BF dw 0F41Ch
ROM:06C1 dw 0
ROM:06C3 TABLE1: dw 130h ; DATA XREF: process_interrupt+3F
ROM:06C5 dw 168h
ROM:06C7 dw 136h
ROM:06C9 dw 1A8h
ROM:06CB dw 168h
ROM:06CD dw 200h
ROM:06CF dw 1ACh
ROM:06D1 dw 208h
ROM:06D3 TABLE2: dw 0FE00h ; DATA XREF: process_interrupt:select_table2
ROM:06D5 dw 0FE58h
ROM:06D7 dw 0FE08h
ROM:06D9 dw 0FE98h
ROM:06DB dw 0FE58h
ROM:06DD dw 0FED0h
ROM:06DF dw 0FE98h
ROM:06E1 dw 0FED6h
ROM:06E3 dw 5B00h
ROM:06E5 dw 6C00h
ROM:06E7 dw 5B00h
ROM:06E9 dw 7E00h
ROM:06EB dw 6C00h
ROM:06ED dw 9700h
ROM:06EF dw 8100h
ROM:06F1 dw 9900h
ROM:06F3 dw 0D900h
ROM:06F5 dw 0B600h
ROM:06F7 dw 0D900h
ROM:06F9 dw 9700h
ROM:06FB dw 0B600h
ROM:06FD dw 7E00h
ROM:06FF dw 9900h
ROM:0701 dw 8100h
ROM:0703 TABLE3: db 0, 1, 0 ; DATA XREF: play_sound_bis+6
ROM:0703 ; start_sound+F
ROM:0703 ; continue_sound+6
ROM:0703 ; play_sound+6
ROM:0703 ; 3 columns : offset, length and voice_number
ROM:0706 db 1, 1, 1
ROM:0709 db 2, 1, 1
ROM:070C db 3, 1, 1
ROM:070F db 4, 1, 1
ROM:0712 db 5, 1, 0
ROM:0715 db 6, 1, 0
ROM:0718 db 20h, 3, 0
ROM:071B db 0Ah, 3, 0
ROM:071E db 0Dh, 3, 0
ROM:0721 db 7, 3, 0
ROM:0724 db 13h, 3, 0
ROM:0727 db 16h, 3, 0
ROM:072A db 19h, 3, 0 ; sound 0D
ROM:072D db 1Ch, 3, 0
ROM:0730 db 1Fh, 1, 2 ; sound 0F
ROM:0733 db 2Ch, 3, 0
ROM:0736 db 10h, 3, 0
ROM:0739 db 23h, 1, 0
ROM:073C db 24h, 1, 0
ROM:073F db 25h, 3, 0
ROM:0742 db 28h, 1, 0
ROM:0745 db 29h, 3, 0
ROM:0748 TABLE4: dw WAVE01 ; DATA XREF: process_chunk+C
ROM:0748 ; pointer to WAVE data. The first 3 bytes are
ROM:0748 ; data0, data1 and wave select. Followed by
ROM:0748 ; pairs of bytes, and ends with 0xFF
ROM:074A dw WAVE02
ROM:074C dw WAVE03
ROM:074E dw WAVE04
ROM:0750 dw WAVE05
ROM:0752 dw WAVE06
ROM:0754 dw WAVE07
ROM:0756 dw WAVE08
ROM:0758 dw WAVE09
ROM:075A dw WAVE10
ROM:075C dw WAvE11
ROM:075E dw WAVE12
ROM:0760 dw WAVE13
ROM:0762 dw WAVE14
ROM:0764 dw WAVE15
ROM:0766 dw WAVE16
ROM:0768 dw WAVE17
ROM:076A dw WAVE18
ROM:076C dw WAVE19
ROM:076E dw WAVE20
ROM:0770 dw WAVE21
ROM:0772 dw WAVE22
ROM:0774 dw WAVE23
ROM:0776 dw WAVE24
ROM:0778 dw WAVE25
ROM:077A dw WAVE26
ROM:077C dw WAVE27
ROM:077E dw wAVE28
ROM:0780 dw WAVE20
ROM:0782 dw WAVE20
ROM:0784 dw WAVE20
ROM:0786 dw WAVE29
ROM:0788 dw WAVE30
ROM:078A dw WAVE31
ROM:078C dw WAVE32
ROM:078E dw WAVE33
ROM:0790 dw WAVE29
ROM:0792 dw WAVE34
ROM:0794 dw WAVE35
ROM:0796 dw WAVE36
ROM:0798 dw WAVE37
ROM:079A dw WAVE38
ROM:079C dw WAVE39
ROM:079E dw WAVE40
ROM:07A0 dw WAVE41
ROM:07A2 dw WAVE42
ROM:07A4 dw WAVE43
ROM:07A6 TABLE5: db 4, 2, 2, 2, 2, 4, 4, 0Ah, 7, 0Ch, 0Bh, 4, 0Ah, 0Dh, 4, 1, 4
ROM:07A6 ; DATA XREF: process_chunk+EA
ROM:07A6 db 0Ch, 2, 6, 5, 2, 0Ah
ROM:07BD WAVE01: db 0FFh ; DATA XREF: ROM:TABLE4
ROM:07BE WAVE04: db 0, 0, 6, 71h, 1, 72h, 1, 73h, 1, 75h, 1, 74h, 1, 73h, 1, 72h
ROM:07BE ; DATA XREF: ROM:074E
ROM:07BE db 1, 71h, 1, 70h, 1, 8Bh, 1, 8Ah, 1, 0Ch, 4, 86h, 1, 87h, 1, 88h
ROM:07BE db 1, 89h, 1, 8Ah, 1, 89h, 1, 88h, 1, 87h, 1, 86h, 1, 85h, 1, 84h
ROM:07BE db 1, 83h, 1, 0FFh
ROM:07F2 WAVE03: db 0, 0, 4, 88h, 1, 8Ah, 1, 70h, 1, 71h, 1, 73h, 1, 75h, 1, 77h
ROM:07F2 ; DATA XREF: ROM:074C
ROM:07F2 db 1, 78h, 1, 0Ch, 6, 74h, 1, 73h, 1, 72h, 1, 71h, 1, 70h, 1, 8Bh
ROM:07F2 db 1, 0FFh
ROM:0814 WAVE02: db 0, 0, 7, 89h, 1, 8Ah, 1, 8Bh, 1, 0Ch, 1, 70h, 1, 71h, 1, 72h
ROM:0814 ; DATA XREF: ROM:074A
ROM:0814 db 1, 0Ch, 1, 73h, 1, 74h, 1, 75h, 1, 0Ch, 3, 8Bh, 1, 70h, 1, 71h
ROM:0814 db 1, 0Ch, 1, 72h, 1, 73h, 1, 74h, 1, 0Ch, 1, 75h, 1, 76h, 1, 77h
ROM:0814 db 1, 0Ch, 3, 71h, 1, 72h, 1, 73h, 1, 0Ch, 1, 74h, 1, 75h, 1, 76h
ROM:0814 db 1, 0Ch, 1, 77h, 1, 78h, 1, 79h, 1, 0FFh
ROM:085E WAVE05: db 0, 0, 5, 71h, 1, 72h, 1, 73h, 1, 0Ch, 1, 74h, 1, 75h, 1, 76h
ROM:085E ; DATA XREF: ROM:0750
ROM:085E db 1, 0Ch, 1, 77h, 1, 78h, 1, 79h, 1, 0FFh
ROM:0878 WAVE06: db 0, 0, 4, 61h, 1, 7Ah, 1, 60h, 1, 78h, 1, 7Ah, 1, 76h, 1, 78h
ROM:0878 ; DATA XREF: ROM:0752
ROM:0878 db 1, 75h, 1, 0FFh
ROM:088C WAVE07: db 0, 0, 0, 76h, 1, 79h, 1, 60h, 1, 63h, 1, 66h, 1, 63h, 1, 60h
ROM:088C ; DATA XREF: ROM:0754
ROM:088C db 1, 79h, 1, 0FFh
ROM:08A0 WAVE20: db 0, 0, 7, 81h, 8, 81h, 1, 86h, 3, 88h, 9, 8Bh, 3, 8Ah, 9, 86h
ROM:08A0 ; DATA XREF: ROM:076E
ROM:08A0 ; ROM:0780 ROM:0782
ROM:08A0 ; ROM:0784
ROM:08A0 db 3, 88h, 9, 73h, 3, 71h, 9, 86h, 3, 88h, 9, 8Bh, 3, 8Ah, 9, 86h
ROM:08A0 db 3, 71h, 9, 75h, 3, 76h, 9, 74h, 3, 72h, 9, 71h, 3, 8Bh, 9, 89h
ROM:08A0 db 3, 88h, 9, 84h, 3, 74h, 9, 76h, 3, 74h, 9, 71h, 3, 73h, 4, 8Bh
ROM:08A0 db 4, 88h, 4, 71h, 4, 8Ah, 4, 88h, 4, 0Ch, 10h, 0FFh
ROM:08EC WAVE21: db 0, 0, 6, 8Ah, 9, 81h, 3, 88h, 9, 83h, 3, 86h, 9, 81h, 3, 83h
ROM:08EC ; DATA XREF: ROM:0770
ROM:08EC db 9, 85h, 3, 8Ah, 9, 81h, 3, 88h, 9, 83h, 3, 86h, 9, 81h, 3, 88h
ROM:08EC db 9, 71h, 3, 72h, 9, 71h, 3, 8Bh, 9, 89h, 3, 88h, 9, 86h, 3, 84h
ROM:08EC db 9, 88h, 3, 89h, 9, 8Bh, 3, 89h, 9, 86h, 3, 8Bh, 4, 88h, 4, 83h
ROM:08EC db 4, 88h, 4, 85h, 4, 83h, 4, 0Ch, 10h, 0FFh
ROM:0936 WAVE22: db 0, 0, 7, 81h, 0Ch, 83h, 9, 86h, 3, 85h, 0Ch, 81h, 0Ch, 86h
ROM:0936 ; DATA XREF: ROM:0772
ROM:0936 db 0Ch, 88h, 9, 8Bh, 3, 8Ah, 0Ch, 88h, 0Ch, 89h, 0Ch, 88h, 9, 86h
ROM:0936 db 3, 84h, 0Ch, 89h, 0Ch, 74h, 0Ch, 71h, 9, 89h, 3, 88h, 0Ch, 71h
ROM:0936 db 9, 8Ah, 3, 0Ch, 10h, 0FFh
ROM:0966 WAVE26: db 2, 0, 3, 78h, 2, 0Ch, 1, 78h, 1, 79h, 1, 7Bh, 1, 61h, 3, 0Ch
ROM:0966 ; DATA XREF: ROM:077A
ROM:0966 db 3, 0FFh
ROM:0978 WAVE27: db 2, 0, 3, 73h, 2, 0Ch, 1, 73h, 1, 74h, 1, 76h, 1, 78h, 3, 0Ch
ROM:0978 ; DATA XREF: ROM:077C
ROM:0978 db 2, 0FFh
ROM:098A wAVE28: db 2, 0, 3, 70h, 2, 0Ch, 1, 70h, 1, 71h, 1, 73h, 1, 75h, 3, 0Ch
ROM:098A ; DATA XREF: ROM:077E
ROM:098A db 2, 0FFh
ROM:099C WAvE11: db 1, 0, 4, 78h, 1, 7Ah, 1, 63h, 1, 78h, 1, 7Ah, 1, 63h, 1, 65h
ROM:099C ; DATA XREF: ROM:075C
ROM:099C db 3, 0FFh
ROM:09AE WAVE12: db 1, 0, 5, 73h, 1, 78h, 1, 7Ah, 1, 73h, 1, 78h, 1, 7Ah, 1, 60h
ROM:09AE ; DATA XREF: ROM:075E
ROM:09AE db 3, 0FFh
ROM:09C0 WAVE13: db 1, 0, 7, 8Ah, 1, 73h, 1, 78h, 1, 8Ah, 1, 73h, 1, 78h, 1, 7Ah
ROM:09C0 ; DATA XREF: ROM:0760
ROM:09C0 db 3, 0FFh
ROM:09D2 WAVE08: db 1, 6, 4, 7Ah, 1, 78h, 1, 7Ah, 1, 61h, 1, 65h, 1, 68h, 3, 0FFh
ROM:09D2 ; DATA XREF: ROM:0756
ROM:09E2 WAVE09: db 1, 6, 4, 78h, 1, 75h, 1, 78h, 1, 7Ah, 1, 61h, 1, 65h, 3, 0FFh
ROM:09E2 ; DATA XREF: ROM:0758
ROM:09F2 WAVE10: db 1, 6, 4, 75h, 1, 71h, 1, 75h, 1, 78h, 1, 7Ah, 1, 60h, 3, 0FFh
ROM:09F2 ; DATA XREF: ROM:075A
ROM:0A02 WAVE14: db 2, 4, 3, 7Ah, 1, 76h, 1, 78h, 1, 75h, 1, 76h, 1, 73h, 1, 75h
ROM:0A02 ; DATA XREF: ROM:0762
ROM:0A02 db 1, 72h, 1, 73h, 1, 8Ah, 1, 8Bh, 1, 88h, 1, 86h, 1, 85h, 1, 83h
ROM:0A02 db 1, 82h, 1, 83h, 1, 86h, 1, 85h, 1, 88h, 1, 86h, 1, 8Ah, 1, 88h
ROM:0A02 db 1, 8Bh, 1, 8Ah, 1, 73h, 1, 72h, 1, 73h, 1, 75h, 1, 8Ah, 1, 70h
ROM:0A02 db 1, 72h, 1, 0FFh
ROM:0A46 WAVE15: db 2, 4, 3, 76h, 1, 73h, 1, 75h, 1, 72h, 1, 73h, 1, 70h, 1, 72h
ROM:0A46 ; DATA XREF: ROM:0764
ROM:0A46 db 1, 8Ah, 1, 8Bh, 1, 86h, 1, 88h, 1, 85h, 1, 83h, 1, 82h, 1, 80h
ROM:0A46 db 1, 9Ah, 1, 9Ah, 1, 83h, 1, 82h, 1, 85h, 1, 83h, 1, 86h, 1, 85h
ROM:0A46 db 1, 88h, 1, 86h, 1, 8Ah, 1, 88h, 1, 8Bh, 1, 8Ah, 1, 88h, 1, 86h
ROM:0A46 db 1, 85h, 1, 0FFh
ROM:0A8A WAVE16: db 2, 10h, 3, 93h, 2, 9Ah, 2, 83h, 3, 9Ah, 1, 98h, 1, 96h, 1, 95h
ROM:0A8A ; DATA XREF: ROM:0766
ROM:0A8A db 1, 93h, 2, 95h, 3, 96h, 2, 98h, 2, 9Ah, 2, 9Bh, 2, 9Ah, 2, 98h
ROM:0A8A db 1, 96h, 1, 95h, 1, 92h, 1, 93h, 1, 95h, 1, 0FFh
ROM:0AB6 WAVE17: db 2, 4, 3, 7Ah, 1, 77h, 1, 78h, 1, 75h, 1, 77h, 1, 73h, 1, 75h
ROM:0AB6 ; DATA XREF: ROM:0768
ROM:0AB6 db 1, 72h, 1, 73h, 1, 8Ah, 1, 80h, 1, 88h, 1, 87h, 1, 85h, 1, 83h
ROM:0AB6 db 1, 82h, 1, 83h, 1, 87h, 1, 85h, 1, 88h, 1, 87h, 1, 8Ah, 1, 88h
ROM:0AB6 db 1, 80h, 1, 8Ah, 1, 73h, 1, 72h, 1, 73h, 1, 75h, 1, 8Ah, 1, 70h
ROM:0AB6 db 1, 72h, 1, 0FFh
ROM:0AFA WAVE18: db 2, 4, 3, 77h, 1, 73h, 1, 75h, 1, 72h, 1, 73h, 1, 70h, 1, 72h
ROM:0AFA ; DATA XREF: ROM:076A
ROM:0AFA db 1, 8Ah, 1, 80h, 1, 87h, 1, 88h, 1, 85h, 1, 83h, 1, 82h, 1, 80h
ROM:0AFA db 1, 9Ah, 1, 9Ah, 1, 83h, 1, 82h, 1, 85h, 1, 83h, 1, 87h, 1, 85h
ROM:0AFA db 1, 88h, 1, 87h, 1, 8Ah, 1, 88h, 1, 80h, 1, 8Ah, 1, 88h, 1, 87h
ROM:0AFA db 1, 85h, 1, 0FFh
ROM:0B3E WAVE19: db 2, 10h, 3, 93h, 2, 9Ah, 2, 83h, 3, 9Ah, 1, 98h, 1, 97h, 1, 95h
ROM:0B3E ; DATA XREF: ROM:076C
ROM:0B3E db 1, 93h, 2, 95h, 3, 97h, 2, 98h, 2, 9Ah, 2, 90h, 2, 9Ah, 2, 98h
ROM:0B3E db 1, 97h, 1, 95h, 1, 92h, 1, 93h, 1, 95h, 1, 0FFh
ROM:0B6A WAVE30: db 2, 4, 3, 7Ah, 1, 76h, 1, 78h, 1, 75h, 1, 76h, 1, 73h, 1, 75h
ROM:0B6A ; DATA XREF: ROM:0788
ROM:0B6A db 1, 72h, 1, 73h, 1, 8Ah, 1, 8Ah, 1, 88h, 1, 86h, 1, 85h, 1, 83h
ROM:0B6A db 1, 82h, 1, 83h, 1, 85h, 1, 86h, 1, 88h, 1, 86h, 1, 8Ah, 1, 70h
ROM:0B6A db 1, 72h, 1, 73h, 4, 0FFh
ROM:0BA0 WAVE31: db 2, 4, 3, 76h, 1, 73h, 1, 75h, 1, 72h, 1, 73h, 1, 70h, 1, 72h
ROM:0BA0 ; DATA XREF: ROM:078A
ROM:0BA0 db 1, 8Ah, 1, 8Ah, 1, 86h, 1, 86h, 1, 85h, 1, 83h, 1, 82h, 1, 80h
ROM:0BA0 db 1, 9Ah, 1, 9Ah, 1, 8Bh, 1, 80h, 1, 82h, 1, 83h, 1, 85h, 1, 86h
ROM:0BA0 db 1, 88h, 1, 8Ah, 4, 0FFh
ROM:0BD6 WAVE32: db 2, 10h, 3, 73h, 2, 75h, 2, 76h, 2, 75h, 2, 73h, 2, 72h, 2, 70h
ROM:0BD6 ; DATA XREF: ROM:078C
ROM:0BD6 db 2, 72h, 2, 73h, 2, 8Bh, 2, 8Ah, 2, 86h, 2, 83h, 4, 0FFh
ROM:0BF4 WAVE33: db 0, 0, 4, 71h, 4, 73h, 4, 71h, 4, 73h, 4, 76h, 4, 78h, 4, 76h
ROM:0BF4 ; DATA XREF: ROM:078E
ROM:0BF4 db 4, 78h, 4, 0FFh
ROM:0C08 WAVE29: db 0, 0, 6, 56h, 1, 55h, 1, 54h, 1, 53h, 1, 52h, 1, 51h, 1, 50h
ROM:0C08 ; DATA XREF: ROM:0786
ROM:0C08 ; ROM:0790
ROM:0C08 db 1, 6Bh, 1, 6Ah, 1, 69h, 1, 68h, 1, 67h, 1, 66h, 1, 65h, 1, 64h
ROM:0C08 db 1, 63h, 1, 62h, 1, 61h, 1, 60h, 1, 7Bh, 1, 7Ah, 1, 79h, 1, 78h
ROM:0C08 db 1, 77h, 1, 76h, 1, 75h, 1, 74h, 1, 73h, 1, 72h, 1, 71h, 1, 70h
ROM:0C08 db 1, 8Bh, 1, 8Ah, 1, 89h, 1, 88h, 1, 87h, 1, 86h, 1, 85h, 1, 84h
ROM:0C08 db 1, 83h, 1, 0FFh
ROM:0C5C WAVE23: db 2, 4, 5, 60h, 1, 78h, 1, 75h, 1, 71h, 1, 60h, 1, 78h, 1, 75h
ROM:0C5C ; DATA XREF: ROM:0774
ROM:0C5C db 1, 71h, 1, 60h, 1, 78h, 1, 75h, 1, 71h, 1, 60h, 1, 78h, 1, 75h
ROM:0C5C db 1, 71h, 1, 60h, 1, 78h, 1, 75h, 1, 71h, 1, 60h, 1, 78h, 1, 75h
ROM:0C5C db 1, 71h, 1, 60h, 1, 0Ch, 1, 78h, 1, 7Ah, 1, 75h, 1, 78h, 1, 73h
ROM:0C5C db 1, 75h, 1, 61h, 1, 7Ah, 1, 76h, 1, 73h, 1, 61h, 1, 7Ah, 1, 76h
ROM:0C5C db 1, 73h, 1, 61h, 1, 7Ah, 1, 76h, 1, 73h, 1, 61h, 1, 7Ah, 1, 76h
ROM:0C5C db 1, 73h, 1, 61h, 1, 79h, 1, 76h, 1, 73h, 1, 61h, 1, 79h, 1, 76h
ROM:0C5C db 1, 73h, 1, 61h, 1, 0Ch, 1, 79h, 1, 61h, 1, 78h, 1, 79h, 1, 75h
ROM:0C5C db 1, 78h, 1, 0FFh
ROM:0CE0 WAVE38: db 2, 2, 5, 60h, 1, 60h, 1, 60h, 1, 0FFh ; DATA XREF: ROM:079A
ROM:0CEA WAVE24: db 2, 4, 5, 61h, 2, 78h, 2, 78h, 2, 61h, 2, 78h, 2, 78h, 2, 61h
ROM:0CEA ; DATA XREF: ROM:0776
ROM:0CEA db 2, 78h, 2, 78h, 2, 61h, 2, 78h, 2, 78h, 2, 61h, 2, 78h, 2, 7Ah
ROM:0CEA db 2, 75h, 2, 63h, 2, 7Ah, 2, 7Ah, 2, 63h, 2, 7Ah, 2, 7Ah, 2, 63h
ROM:0CEA db 2, 7Ah, 2, 79h, 2, 63h, 2, 79h, 2, 79h, 2, 63h, 2, 79h, 2, 76h
ROM:0CEA db 2, 73h, 2, 0FFh
ROM:0D2E WAVE39: db 2, 2, 5, 78h, 1, 78h, 1, 78h, 1, 0FFh ; DATA XREF: ROM:079C
ROM:0D38 WAVE25: db 2, 10h, 5, 85h, 6, 85h, 6, 85h, 6, 85h, 6, 85h, 4, 85h, 4, 86h
ROM:0D38 ; DATA XREF: ROM:0778
ROM:0D38 db 6, 86h, 6, 86h, 6, 86h, 6, 86h, 4, 86h, 4, 0FFh
ROM:0D54 WAVE40: db 2, 4, 5, 81h, 1, 81h, 1, 81h, 1, 0FFh ; DATA XREF: ROM:079E
ROM:0D5E WAVE37: db 2, 0, 7, 65h, 1, 0Ch, 1, 61h, 1, 0Ch, 1, 63h, 1, 0FFh
ROM:0D5E ; DATA XREF: ROM:0798
ROM:0D6C WAVE34: db 2, 0, 5, 7Ah, 5, 0Ch, 1, 7Ah, 1, 0Ch, 1, 7Ah, 3, 0Ch, 1, 78h
ROM:0D6C ; DATA XREF: ROM:0792
ROM:0D6C db 7, 0Ch, 1, 78h, 7, 0Ch, 1, 78h, 3, 0Ch, 1, 7Bh, 5, 0Ch, 1, 7Bh
ROM:0D6C db 1, 0Ch, 1, 7Bh, 3, 0Ch, 1, 7Ah, 7, 0Ch, 1, 7Ah, 7, 0Ch, 1, 7Ah
ROM:0D6C db 3, 0Ch, 1, 7Bh, 1, 0Ch, 1, 7Bh, 1, 0Ch, 3, 7Bh, 1, 0Ch, 1, 7Bh
ROM:0D6C db 3, 0Ch, 1, 61h, 1, 0Ch, 1, 61h, 1, 0Ch, 3, 61h, 1, 0Ch, 1, 61h
ROM:0D6C db 3, 0Ch, 1, 61h, 3, 0Ch, 1, 61h, 3, 0Ch, 1, 63h, 1, 0Ch, 1, 63h
ROM:0D6C db 1, 0Ch, 3, 63h, 1, 0Ch, 1, 63h, 3, 0Ch, 1, 63h, 3, 0Ch, 1, 63h
ROM:0D6C db 3, 0Ch, 1, 0FFh
ROM:0DE0 WAVE35: db 2, 0, 3, 86h, 2, 8Ah, 2, 71h, 2, 76h, 2, 86h, 2, 8Ah, 2, 71h
ROM:0DE0 ; DATA XREF: ROM:0794
ROM:0DE0 db 2, 76h, 2, 86h, 2, 8Ah, 2, 71h, 2, 76h, 2, 86h, 2, 8Ah, 2, 71h
ROM:0DE0 db 2, 76h, 2, 86h, 2, 8Ah, 2, 71h, 2, 76h, 2, 86h, 2, 8Ah, 2, 71h
ROM:0DE0 db 2, 76h, 2, 86h, 2, 8Ah, 2, 71h, 2, 76h, 2, 86h, 2, 8Ah, 2, 71h
ROM:0DE0 db 2, 76h, 2, 77h, 1, 0Ch, 1, 77h, 1, 0Ch, 3, 77h, 1, 0Ch, 1, 77h
ROM:0DE0 db 3, 0Ch, 1, 69h, 1, 0Ch, 1, 69h, 1, 0Ch, 3, 69h, 1, 0Ch, 1, 69h
ROM:0DE0 db 3, 0Ch, 1, 69h, 3, 0Ch, 1, 69h, 3, 0Ch, 1, 8Bh, 2, 73h, 2, 76h
ROM:0DE0 db 2, 7Bh, 2, 7Bh, 2, 76h, 2, 73h, 2, 8Bh, 2, 0FFh
ROM:0E5C WAVE36: db 0, 0, 2, 86h, 8, 81h, 8, 86h, 8, 81h, 8, 86h, 8, 81h, 8, 86h
ROM:0E5C ; DATA XREF: ROM:0796
ROM:0E5C db 8, 81h, 8, 82h, 1, 0Ch, 1, 82h, 1, 0Ch, 3, 82h, 1, 0Ch, 1, 82h
ROM:0E5C db 3, 0Ch, 1, 84h, 1, 0Ch, 1, 84h, 1, 0Ch, 3, 84h, 1, 0Ch, 1, 84h
ROM:0E5C db 3, 0Ch, 1, 84h, 3, 0Ch, 1, 84h, 3, 0Ch, 1, 7Bh, 8, 76h, 4, 8Bh
ROM:0E5C db 4, 0FFh
ROM:0E9E WAVE41: db 0, 0Ch, 5, 75h, 0Ch, 71h, 0Ch, 8Ah, 0Ch, 86h, 0Ch, 0Ch, 9, 75h
ROM:0E9E ; DATA XREF: ROM:07A0
ROM:0E9E db 3, 71h, 9, 8Ah, 3, 86h, 4, 8Ah, 4, 71h, 4, 89h, 4, 70h, 4, 73h
ROM:0E9E db 4, 8Bh, 0Ch, 73h, 0Ch, 76h, 0Ch, 78h, 0Ch, 0Ch, 9, 79h, 3, 76h
ROM:0E9E db 9, 72h, 3, 8Bh, 4, 89h, 4, 86h, 4, 72h, 4, 89h, 4, 76h, 4, 0FFh
ROM:0EDA WAVE42: db 0, 0Ch, 5, 71h, 0Ch, 8Ah, 0Ch, 86h, 0Ch, 85h, 0Ch, 0Ch, 9, 81h
ROM:0EDA ; DATA XREF: ROM:07A2
ROM:0EDA db 3, 8Ah, 9, 86h, 3, 85h, 4, 86h, 4, 8Ah, 4, 86h, 4, 89h, 4, 8Bh
ROM:0EDA db 4, 88h, 0Ch, 8Bh, 0Ch, 73h, 0Ch, 76h, 0Ch, 0Ch, 9, 76h, 3, 72h
ROM:0EDA db 9, 8Bh, 3, 8Ah, 4, 86h, 4, 82h, 4, 8Bh, 4, 89h, 4, 82h, 4, 0FFh
ROM:0F16 WAVE43: db 0, 0, 3, 75h, 18h, 75h, 18h, 75h, 18h, 71h, 0Ch, 75h, 0Ch, 73h
ROM:0F16 ; DATA XREF: ROM:07A4
ROM:0F16 db 18h, 73h, 18h, 72h, 18h, 76h, 0Ch, 78h, 0Ch, 0FFh
ROM:0F2E db 0FAh ; ú
ROM:0F2F db 0FFh
ROM:0F30 db [ 0D0h ], 0FFh
ROM:0F30 ; end of 'ROM'
ROM:0F30
RAM:8800 ; ===========================================================================
RAM:8800
RAM:8800 ; Segment type: Regular
RAM:8800 segment RAM
RAM:8800 org 8800h
RAM:8800 ds 0A11h
RAM:9211 byte_9211: ds 1 ; DATA XREF: process_interrupt+30
RAM:9212 ds 7EEh
RAM:9A00 byte_9A00: ds 1 ; DATA XREF: process_interrupt+46
RAM:9A00 ; process_interrupt+51
RAM:9A01 ds 1
RAM:9A02 ds 1
RAM:9A03 ds 1
RAM:9A04 ds 1
RAM:9A05 ds 1
RAM:9A06 ds 1
RAM:9A07 ds 1
RAM:9A08 ds 1
RAM:9A09 ds 1
RAM:9A0A ds 1
RAM:9A0B ds 1
RAM:9A0C ds 1
RAM:9A0D ds 1
RAM:9A0E ds 1
RAM:9A0F ds 1
RAM:9A10 ds 1
RAM:9A11 ds 1
RAM:9A12 ds 1
RAM:9A13 ds 1
RAM:9A14 ds 1
RAM:9A15 ds 1
RAM:9A16 ds 1
RAM:9A17 ds 1
RAM:9A18 ds 1
RAM:9A19 ds 1
RAM:9A1A ds 1
RAM:9A1B ds 1
RAM:9A1C ds 1
RAM:9A1D ds 1
RAM:9A1E ds 1
RAM:9A1F ds 1
RAM:9A20 ds 1
RAM:9A21 ds 1
RAM:9A22 ds 1
RAM:9A23 ds 1
RAM:9A24 ds 1
RAM:9A25 ds 1
RAM:9A26 ds 1
RAM:9A27 ds 1
RAM:9A28 ds 1
RAM:9A29 ds 1
RAM:9A2A ds 1
RAM:9A2B ds 1
RAM:9A2C ds 1
RAM:9A2D ds 1
RAM:9A2E ds 1
RAM:9A2F ds 1
RAM:9A30 song_offsets_table:ds 1
RAM:9A31 ds 1
RAM:9A32 ds 1
RAM:9A33 ds 1
RAM:9A34 ds 1
RAM:9A35 ds 1
RAM:9A36 ds 1
RAM:9A37 ds 1
RAM:9A38 ds 1
RAM:9A39 ds 1
RAM:9A3A ds 1
RAM:9A3B ds 1
RAM:9A3C ds 1
RAM:9A3D ds 1
RAM:9A3E ds 1
RAM:9A3F ds 1
RAM:9A40 ds 1
RAM:9A41 ds 1
RAM:9A42 ds 1
RAM:9A43 ds 1
RAM:9A44 ds 1
RAM:9A45 ds 1
RAM:9A46 ds 1
RAM:9A47 ds 1
RAM:9A48 ds 1
RAM:9A49 ds 1
RAM:9A4A ds 1
RAM:9A4B ds 1
RAM:9A4C b_9A30_plus_1C: ds 1 ; DATA XREF: play_sound_bis+19
RAM:9A4C ; start_sound+22
RAM:9A4C ; continue_sound+19
RAM:9A4C ; play_sound+19
RAM:9A4D b_9A30_plus_1D: ds 1 ; DATA XREF: play_sound_bis+22
RAM:9A4D ; start_sound+2B
RAM:9A4D ; continue_sound+22
RAM:9A4D ; play_sound+22
RAM:9A4E ds 1
RAM:9A4F ds 1
RAM:9A50 ds 1
RAM:9A51 ds 1
RAM:9A52 ds 1
RAM:9A53 ds 1
RAM:9A54 ds 1
RAM:9A55 ds 1
RAM:9A56 ds 1
RAM:9A57 ds 1
RAM:9A58 ds 1
RAM:9A59 ds 1
RAM:9A5A ds 1
RAM:9A5B ds 1
RAM:9A5C ds 1
RAM:9A5D ds 1
RAM:9A5E ds 1
RAM:9A5F ds 1
RAM:9A60 CH1_FREQ0: ds 1 ; DATA XREF: process_interrupt:copy_to_hw
RAM:9A61 CH1_FREQ1: ds 1 ; DATA XREF: process_interrupt+8C
RAM:9A61 ; process_chunk:voice_1
RAM:9A62 CH1_FREQ2: ds 1 ; DATA XREF: process_interrupt+93
RAM:9A63 CH1_FREQ3: ds 1
RAM:9A64 CH1_FREQ4: ds 1
RAM:9A65 CH1_VOL: ds 1 ; DATA XREF: process_interrupt+98
RAM:9A65 ; process_chunk:voice_1_vol
RAM:9A66 CH2_FREQ1: ds 1 ; DATA XREF: process_chunk:voice_2
RAM:9A67 CH2_FREQ2: ds 1
RAM:9A68 CH2_FREQ3: ds 1
RAM:9A69 CH2_FREQ4: ds 1
RAM:9A6A CH2_VOL: ds 1 ; DATA XREF: process_interrupt+215
RAM:9A6A ; process_chunk:voice_2_vol
RAM:9A6B CH3_FREQ1: ds 1 ; DATA XREF: process_chunk+58
RAM:9A6C CH3_FREQ2: ds 1
RAM:9A6D CH3_FREQ3: ds 1
RAM:9A6E CH3_FREQ4: ds 1
RAM:9A6F CH3_VOL: ds 1 ; DATA XREF: process_interrupt+188
RAM:9A6F ; process_interrupt+21A
RAM:9A6F ; process_chunk+7F
RAM:9A70 CH1_WAVESEL: ds 1 ; DATA XREF: process_interrupt+9C
RAM:9A70 ; process_interrupt+2B9
RAM:9A71 CH2_WAVESEL: ds 1 ; DATA XREF: process_interrupt+2BF
RAM:9A72 CH3_WAVESEL: ds 1 ; DATA XREF: process_interrupt+1B5
RAM:9A72 ; process_interrupt+2C5
RAM:9A73 ds 1
RAM:9A74 sound_number: ds 1 ; DATA XREF: process_interrupt:check_sound_13
RAM:9A74 ; process_interrupt:check_sound_0F
RAM:9A74 ; process_interrupt:check_sound_03
RAM:9A74 ; process_interrupt:check_sound_02 ...
RAM:9A75 offset: ds 1 ; DATA XREF: play_sound_bis+A
RAM:9A75 ; play_sound_bis+46
RAM:9A75 ; play_sound_bis+51
RAM:9A75 ; play_sound_bis+61 ...
RAM:9A76 length: ds 1 ; DATA XREF: play_sound_bis:loc_3A3
RAM:9A76 ; play_sound_bis+3E
RAM:9A76 ; play_sound_bis+5B
RAM:9A76 ; start_sound:loc_42B ...
RAM:9A77 voice_number: ds 1 ; DATA XREF: play_sound_bis+65
RAM:9A77 ; continue_sound+3E
RAM:9A77 ; play_sound+65
RAM:9A77 ; process_chunk:upper_nibble_zero ...
RAM:9A78 chunk_finished: ds 1 ; DATA XREF: play_sound_bis:length_is_zero
RAM:9A78 ; play_sound_bis+71
RAM:9A78 ; continue_sound:loc_48E
RAM:9A78 ; continue_sound+4A ...
RAM:9A79 credit: ds 1 ; DATA XREF: process_interrupt+1B
RAM:9A79 ; process_interrupt+27
RAM:9A7A rom_ptr: ds 2 ; DATA XREF: process_chunk+28
RAM:9A7A ; process_chunk+33
RAM:9A7A ; process_chunk:adjust_vol
RAM:9A7A ; process_chunk+F2
RAM:9A7C sound05_vol: ds 1 ; DATA XREF: process_interrupt+176
RAM:9A7C ; process_interrupt:loc_22B
RAM:9A7C ; process_interrupt:loc_22E
RAM:9A7D sound06_wavesel:ds 1 ; DATA XREF: process_interrupt+1AB
RAM:9A7D ; process_interrupt+1AF
RAM:9A7D ; process_interrupt:loc_25B
RAM:9A7E sound05_count: ds 1 ; DATA XREF: process_interrupt+169
RAM:9A7E ; process_interrupt+16D
RAM:9A7F sound06_count: ds 1 ; DATA XREF: process_interrupt+19E
RAM:9A7F ; process_interrupt+1A8
RAM:9A80 sound00_count_0:ds 1 ; DATA XREF: process_interrupt+33
RAM:9A80 ; process_interrupt+39
RAM:9A81 sound00_count_1:ds 1 ; DATA XREF: process_interrupt:loc_FD
RAM:9A81 ; process_interrupt+64
RAM:9A81 ; process_interrupt+68
RAM:9A82 ptr_table: ds 2 ; DATA XREF: process_interrupt+42
RAM:9A82 ; process_interrupt+4E
RAM:9A82 ; process_interrupt:set_freq_ch1
RAM:9A84 data_table0: ds 2 ; DATA XREF: process_interrupt+72
RAM:9A84 ; process_interrupt+83
RAM:9A86 freq_ch1: ds 2 ; DATA XREF: process_interrupt+7C
RAM:9A86 ; process_interrupt:update_sound00
RAM:9A86 ; process_interrupt+88
RAM:9A88 data0: ds 1 ; DATA XREF: process_chunk+94
RAM:9A89 data1: ds 1 ; DATA XREF: process_chunk:data0_zero
RAM:9A8A wavesel: ds 1 ; DATA XREF: process_chunk+E6
RAM:9A8B ds 1
RAM:9A8C ds 1
RAM:9A8D ds 1
RAM:9A8E ds 1
RAM:9A8F ds 1
RAM:9A90 ds 1
RAM:9A91 ds 1
RAM:9A92 ds 1
RAM:9A93 ds 1
RAM:9A94 ds 1
RAM:9A95 ds 1
RAM:9A96 ds 1
RAM:9A97 ds 1
RAM:9A98 ds 1
RAM:9A99 ds 1
RAM:9A9A ds 1
RAM:9A9B ds 1
RAM:9A9C ds 1
RAM:9A9D ds 1
RAM:9A9E ds 1
RAM:9A9F ds 1
RAM:9AA0 sound00: ds 1 ; DATA XREF: process_interrupt:check_sound_00
RAM:9AA1 sound01: ds 1 ; DATA XREF: process_interrupt+135
RAM:9AA1 ; process_interrupt+13C
RAM:9AA2 sound02: ds 1 ; DATA XREF: process_interrupt+FB
RAM:9AA2 ; process_interrupt+102
RAM:9AA3 sound03: ds 1 ; DATA XREF: process_interrupt+DE
RAM:9AA3 ; process_interrupt+E5
RAM:9AA4 sound04: ds 1 ; DATA XREF: process_interrupt+118
RAM:9AA4 ; process_interrupt+11F
RAM:9AA5 sound05: ds 1 ; DATA XREF: process_interrupt:check_sound_05
RAM:9AA6 sound06: ds 1 ; DATA XREF: process_interrupt:check_sound_06
RAM:9AA7 sound07: ds 1 ; DATA XREF: process_interrupt:check_sound_07
RAM:9AA8 sound08: ds 1 ; DATA XREF: process_interrupt+21
RAM:9AA8 ; process_interrupt:check_sound_8
RAM:9AA9 sound09: ds 1 ; DATA XREF: process_interrupt:check_sound_09
RAM:9AAA sound0A: ds 1 ; DATA XREF: process_interrupt:check_sound_0A
RAM:9AAB sound0B: ds 1 ; DATA XREF: process_interrupt:check_sound_0B
RAM:9AAC sound0C: ds 1 ; DATA XREF: process_interrupt:check_sound_0C
RAM:9AAD sound0D: ds 1 ; DATA XREF: process_interrupt:check_sound_0D
RAM:9AAE sound0E: ds 1 ; DATA XREF: process_interrupt:check_sound_0E
RAM:9AAE ; process_interrupt:check_sound_0E_part2
RAM:9AAF sound0F: ds 1 ; DATA XREF: process_interrupt+C1
RAM:9AAF ; process_interrupt+C8
RAM:9AB0 sound10: ds 1 ; DATA XREF: process_interrupt:check_sound_10
RAM:9AB1 sound11: ds 1 ; DATA XREF: process_interrupt:check_sound_11
RAM:9AB2 sound12: ds 1 ; DATA XREF: process_interrupt:check_sound_12
RAM:9AB3 sound13: ds 1 ; DATA XREF: process_interrupt+A4
RAM:9AB3 ; process_interrupt+AB
RAM:9AB3 ; play_sound+A8
RAM:9AB4 sound14: ds 1 ; DATA XREF: process_interrupt:check_sound_14
RAM:9AB5 sound15: ds 1 ; DATA XREF: process_interrupt:check_sound_15
RAM:9AB6 sound16: ds 1 ; DATA XREF: process_interrupt:check_sound_16
RAM:9AB6 ; play_sound+A2
RAM:9AB7 tables_initialized:ds 1 ; DATA XREF: process_interrupt+14
RAM:9AB8 all_initialized:ds 1 ; DATA XREF: process_interrupt
RAM:9AB9 ds 1
RAM:9ABA ds 1
RAM:9ABB ds 1
RAM:9ABC ds 1
RAM:9ABD ds 1
RAM:9ABE ds 1
RAM:9ABF ds 1
RAM:9AC0 in_sound00: ds 1
RAM:9AC1 in_sound01: ds 1 ; DATA XREF: process_interrupt:check_continue_01
RAM:9AC2 in_sound02: ds 1 ; DATA XREF: process_interrupt:check_continue_02
RAM:9AC3 in_sound03: ds 1 ; DATA XREF: process_interrupt:check_continue_03
RAM:9AC4 in_sound04: ds 1 ; DATA XREF: process_interrupt:check_continue_04
RAM:9AC5 in_sound05: ds 1 ; DATA XREF: process_interrupt:loc_236
RAM:9AC6 in_sound06: ds 1 ; DATA XREF: process_interrupt:loc_263
RAM:9AC7 in_sound07: ds 1
RAM:9AC8 in_sound08: ds 1
RAM:9AC9 in_sound09: ds 1 ; DATA XREF: process_interrupt:loc_276
RAM:9ACA in_sound0A: ds 1
RAM:9ACB in_sound0B: ds 1
RAM:9ACC in_sound0C: ds 1
RAM:9ACD in_sound0D: ds 1
RAM:9ACE in_sound0E: ds 1
RAM:9ACF in_sound0F: ds 1 ; DATA XREF: process_interrupt:check_continue_0F
RAM:9AD0 in_sound10: ds 1 ; DATA XREF: process_interrupt:loc_30E
RAM:9AD1 in_sound11: ds 1 ; DATA XREF: process_interrupt:loc_297
RAM:9AD2 in_sound12: ds 1
RAM:9AD3 in_sound13: ds 1 ; DATA XREF: process_interrupt:check_continue_13
RAM:9AD4 in_sound14: ds 1
RAM:9AD5 in_sound15: ds 1
RAM:9AD6 in_sound16: ds 1
RAM:9AD7 ds 1
RAM:9AD8 ds 1
RAM:9AD9 ds 1
RAM:9ADA ds 1
RAM:9ADB ds 1
RAM:9ADC ds 1
RAM:9ADD ds 1
RAM:9ADE ds 1
RAM:9ADF ds 1
RAM:9AE0 ds 1
RAM:9AE1 ds 1
RAM:9AE2 ds 1
RAM:9AE3 ds 1
RAM:9AE4 ds 1
RAM:9AE5 ds 1
RAM:9AE6 ds 1
RAM:9AE7 ds 1
RAM:9AE8 ds 1
RAM:9AE9 ds 1
RAM:9AEA ds 1
RAM:9AEB ds 1
RAM:9AEC ds 1
RAM:9AED ds 1
RAM:9AEE ds 1
RAM:9AEF ds 1
RAM:9AF0 ds 1
RAM:9AF1 ds 1
RAM:9AF2 ds 1
RAM:9AF3 ds 1
RAM:9AF4 ds 1
RAM:9AF5 ds 1
RAM:9AF6 ds 1
RAM:9AF7 ds 1
RAM:9AF8 ds 1
RAM:9AF9 ds 1
RAM:9AFA ds 1
RAM:9AFB ds 1
RAM:9AFC ds 1
RAM:9AFD ds 1
RAM:9AFE ds 1
RAM:9AFF ds 1
RAM:9B00 STACK: ds 500h
RAM:9B00 ; end of 'RAM'
RAM:9B00
RAM:9B00
RAM:9B00 end