|
Post by nathan999 on Mar 30, 2015 5:04:47 GMT -5
Beware if your project is somewhat big! Mine surely is, and Bex doesn't seem to like them (for example, I posted about a nasty compiler problem regarding calling functions with parameters past the first 32K of compiled code here). If you load your xgm files at the end of a big program, music sounds distorted (a sturdy BZZZZ in the background as soon as music starts). To overcome this problem, I had to load the files higher in my code (move from line 3000 to line ~500, so to speak). I don't know what is causing this. Anyways, I think this will be my last BEX project. Just too many problems which seem to have to do with the compiler itself. The bugs are a bit overwhelming, more so when the compiler is not going to be updated and is closed source so we are left hopeless A pitty.
|
|
|
Post by nathan999 on Apr 1, 2015 3:48:16 GMT -5
Oh, and by the way, the system hangs up in real hardware. - When I add the XGM driver to our game, it works in the emulator (Fusion and gens), but in real hardware it just hangs in the driver initialization (when the driver is being transfered to the Z80 RAM and initialized, this is, the first step). This is allegedly the first thing we do in the program (well, before we are defining globals and consts, but I doubt that outputs executable code - the first executable line is a call to the driver loading and initialization). - Using the example provided, but replacing the example song and samples with the songs and samples from our game (~10 songs and ~15 samples), it seems to work (in real hardware) but as soon as a sample is triggered there is a really nasty BUZZZ which stays there until the console is restarted. I'm sure that this is BEX's fault. It has to be doing something nasty in a ISR which the driver doesn't like, at least during initialization. I'll do some tests and try to find a work-around. Meanwhile, does anybody know about an emulator which properly emulates the hardware? Obviously, Fusion and Gens don't
|
|
|
Post by vetea on Apr 1, 2015 5:30:12 GMT -5
Here is the code I use :
'Code Source ASM declare asm sub z80_loadDriver() move.w #$100,($A11100) ; Send the Z80 a bus request. move.w #$100,($A11200) MOVE.L #(Z80drv_end-Z80drv),D0 LEA Z80drv,A0 MOVE.L #$A00000,A1 @loop: MOVE.B (A0)+, (A1)+ DBRA D0, @loop ; load driver move.l #$A01C00,a0 ; point to Z80 sample id table (first entry = silent sample) move.l #NULLpcm,d0 ; d0 = silent sample
lsr.l #8,d0 move.b d0,(a0)+ ; sample address lsr.l #8,d0 move.b d0,(a0)+ move.b #$01,(a0)+ ; sample length move.b #$00,(a0) move.w #$000,($A11200) ; Start Z80 Reset move.w #$000,($A11100) ; release the Z80 bus
move.l #$A00102,a0 ; point to status
@test_ready: move.w #100,d0 ;
@wait: DBRA D0, @wait ; wait a bit move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) ; End Z80 Reset NOP NOP NOP NOP NOP
move.b (a0),d0 move.w #$000,($A11100) ; release the Z80 bus btst #7,d0 ; not yet ready beq @test_ready end sub
declare asm function xgm_isPlayingMusic() move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) NOP NOP NOP NOP NOP
move.b ($A00102),d0 ; get channel playing status andi.l #$40,d0 ; keep play XGM bit only move.w #$000,($A11100) ; release the Z80 bus end function
declare asm sub xgm_startPlayMusic() ; a1 should point on XGM music
move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) move.l a3,a0 ; a0 = reserved $FC array for sample id table moveq #0,d0 @loop: ; prepare sample id table move.w d0,d1 add.w d1,d1 add.w d1,d1 moveq #0,d2 move.w 0(a1,d1.w),d2 ; get sample addr in song bank table rol.w #8,d2 ; revert endianess
cmp.w #$FFFF,d2 ; is null sample ? bne @not_null move.l NULLpcm,d2 jmp @addr_done @not_null: addq.w #1,d2 ; add offset lsl.l #8,d2 ; pass to 24 bits add.l a1,d2 ; transform to absolute address
@addr_done lsr.l #8,d2 ; get high byte move.b d2,0(a0,d1.w) lsr.w #8,d2 ; get low byte move.b d2,1(a0,d1.w) move.w 2(a1,d1.w),2(a0,d1.w) ; copy sample length
addq.w #1,d0 cmp.w #$3F,d0 bne @loop
move.l #$A01C04,a2 ; destination of sample id table lsl.w #2,d0 ; set size in bytes subq.w #1,d0 @sampleIdLoop: move.b (a0)+,(a2)+ dbra d0,@sampleIdLoop ; load sample id table
move.l a1,d0 ; d0 = song address add.l #$100,d0 ; bypass sample id table
moveq #0,d2 move.w $FC(a1),d2 ; get sample data size rol.w #8,d2 ; revert endianess lsl.l #8,d2 ; pass to 24 bits
add.l d2,d0 ; bypass samples data addq.l #4,d0 ; bypass music data size field move.l #$A00104,a2 ; XGM base parameters address
move.b d0,0(a2) ; low byte lsr.l #8,d0 move.b d0,1(a2) ; med low byte lsr.l #8,d0 move.b d0,2(a2) ; med high byte lsr.l #8,d0 move.b d0,3(a2) ; high byte or.b #$40,($A00100) ; send play XGM command
move.w #$000,($A11100) ; release the Z80 bus end sub
declare asm sub xgm_resumePlayMusic() move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) NOP NOP NOP NOP NOP or.b #$20,($A00100) ; send resume play command
move.w #$000,($A11100) ; release the Z80 bus end sub
declare asm sub xgm_stopPlayMusic() move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) NOP NOP NOP NOP NOP or.b #$10,($A00100) ; send stop play command
move.w #$000,($A11100) ; release the Z80 bus end sub
declare asm function xgm_isPlayingPCM(d0.w as integer) move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) NOP NOP NOP NOP NOP
and.b ($A00102),d0 ; get channel playing status move.w #$000,($A11100) ; release the Z80 bus end function
declare asm sub xgm_playPCM() ; a1 should point on PCM sample ; d1 should contains PCM length ; d2 should contains channel and priority informations: (prio << 4) | channel
move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) move.l (__LONG_pcmid),d0 lsl.l #2,d0 lea $A01C00,a0 adda.l d0,a0 ; a0 point on id table entry move.l a1,d0 ; d0 = sample address lsr.l #8,d0 ; get sample address (high byte) move.b d0,(a0)+ lsr.w #8,d0 ; get sample address (low byte) move.b d0,(a0)+ lsr.l #8,d1 ; get sample length (high byte) move.b d1,(a0)+ lsr.w #8,d1 ; get sample length (low byte) move.b d1,(a0)+ move.l d2,d0 and.l #3,d0 ; d0 = channel number lea $A00100,a0 moveq #1,d1 lsl.l d0,d1 ; d1 = channel shift command or.b d1,(a0) ; set PCM play command lea $A00108,a0 add.l d0,d0 adda.l d0,a0 ; a0 point on channel info
move.l d2,d0 lsr.l #4,d0 and.l #$F,d0 ; d0 = priority move.b d0,(a0)+ ; set priority move.l (__LONG_pcmid),d0 ; d0 = PCM id
move.b d0,(a0) ; set PCM id
addq.l #1,d0 and.l #$FF,d0 or.l #$40,d0 ; id < 0x40 are reserved for music move.l d0,(__LONG_pcmid) ; pass to next id
move.w #$000,($A11100) ; release the Z80 bus end sub
declare asm sub xgm_stopPCM() ; d2 should contains channel number move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) move.l d2,d0 and.l #3,d0 ; d0 = channel number lea $A00100,a0 moveq #1,d1 lsl.l d0,d1 ; d1 = channel shift command or.b d1,(a0) ; set PCM play command lea $A00108,a0 add.l d0,d0 adda.l d0,a0 ; a0 point on channel info
moveq #0,d0 move.b d0,(a0)+ ; set priority move.b d0,(a0) ; set PCM id
move.w #$000,($A11100) ; release the Z80 bus end sub
declare sub StopPlay(x as integer) regmove.l x,d2 xgm_stopPCM end sub
'Musiques du jeu - Canal 0 LogoVetea: asm lea LogoVeteaPcm,a1 ; put address of sample in a1 move.l #(LogoVeteaPcm_end-LogoVeteaPcm),d1 ; put length of sample in d1 move.l #((1<<4)|0),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Start: asm lea StartPcm,a1 ; put address of sample in a1 move.l #(StartPcm_end-StartPcm),d1 ; put length of sample in d1 move.l #((1<<4)|0),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Bravo: asm lea BravoPcm,a1 ; put address of sample in a1 move.l #(BravoPcm_end-BravoPcm),d1 ; put length of sample in d1 move.l #((1<<4)|0),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return SegaLogo: asm lea SegaPcm,a1 ; put address of sample in a1 move.l #(SegaPcm_end-SegaPcm),d1 ; put length of sample in d1 move.l #((1<<4)|0),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Music: asm lea PapiPcm,a1 ; put address of sample in a1 move.l #(PapiPcm_end-PapiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|0),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Music1: asm lea PapiPcm1,a1 ; put address of sample in a1 move.l #(PapiPcm1_end-PapiPcm1),d1 ; put length of sample in d1 move.l #((1<<4)|0),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Music2: asm lea PapiPcm2,a1 ; put address of sample in a1 move.l #(PapiPcm2_end-PapiPcm2),d1 ; put length of sample in d1 move.l #((1<<4)|0),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return 'Bruitage Papi - Canal 1 & Mami RirePapi: asm lea RirePapiPcm,a1 ; put address of sample in a1 move.l #(RirePapiPcm_end-RirePapiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return DeadPapi: asm lea DeadPapiPcm,a1 ; put address of sample in a1 move.l #(DeadPapiPcm_end-DeadPapiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return RireMami: asm lea RireMamiPcm,a1 ; put address of sample in a1 move.l #(RireMamiPcm_end-RireMamiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return StartMami: asm lea StartMamiPcm,a1 ; put address of sample in a1 move.l #(StartMamiPcm_end-StartMamiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return MortMami: asm lea MortMamiPcm,a1 ; put address of sample in a1 move.l #(MortMamiPcm_end-MortMamiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Claque: asm lea ClaquePcm,a1 ; put address of sample in a1 move.l #(ClaquePcm_end-ClaquePcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return OuhMami: asm lea OuhMamiPcm,a1 ; put address of sample in a1 move.l #(OuhMamiPcm_end-OuhMamiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return CriMort: asm lea MortPapiPcm,a1 ; put address of sample in a1 move.l #(MortPapiPcm_end-MortPapiPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Magnum: asm lea MagnumPcm,a1 ; put address of sample in a1 move.l #(MagnumPcm_end-MagnumPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Uzi: asm lea UziPcm,a1 ; put address of sample in a1 move.l #(UziPcm_end-UziPcm),d1 ; put length of sample in d1 move.l #((1<<4)|1),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return 'Bruitage Ennemis - Canal 2 Ouh: asm lea ouhpcm,a1 ; put address of sample in a1 move.l #(ouhpcm_end-ouhpcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return
Colt45: asm lea Colt45Pcm,a1 ; put address of sample in a1 move.l #(Colt45Pcm_end-Colt45Pcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return UziUnit: asm lea UziPcm,a1 ; put address of sample in a1 move.l #(UziPcm_end-UziPcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return MagnumUnit: asm lea MagnumPcm,a1 ; put address of sample in a1 move.l #(MagnumPcm_end-MagnumPcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Mort: asm lea MortPcm,a1 ; put address of sample in a1 move.l #(MortPcm_end-MortPcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Mort1: asm lea Mort1Pcm,a1 ; put address of sample in a1 move.l #(Mort1Pcm_end-Mort1Pcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Mort2: asm lea Mort2Pcm,a1 ; put address of sample in a1 move.l #(Mort2Pcm_end-Mort2Pcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Mort3: asm lea Mort3Pcm,a1 ; put address of sample in a1 move.l #(Mort3Pcm_end-Mort3Pcm),d1 ; put length of sample in d1 move.l #((1<<4)|2),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return 'Bruitage en jeu - Canal 3 Bonus: asm lea BonusPcm,a1 ; put address of sample in a1 move.l #(BonusPcm_end-BonusPcm),d1 ; put length of sample in d1 move.l #((1<<4)|3),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return
ExtraLife: asm lea ExtraLifePcm,a1 ; put address of sample in a1 move.l #(ExtraLifePcm_end-ExtraLifePcm),d1 ; put length of sample in d1 move.l #((1<<4)|3),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Truck: asm lea TruckPcm,a1 ; put address of sample in a1 move.l #(TruckPcm_end-TruckPcm),d1 ; put length of sample in d1 move.l #((1<<4)|3),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return Impact: asm lea ImpactPcm,a1 ; put address of sample in a1 move.l #(ImpactPcm_end-ImpactPcm),d1 ; put length of sample in d1 move.l #((1<<4)|3),d2 ; put priority and channel number in d2 end asm 'xgm_startPlayMusic xgm_playPCM return
'Ressources sonores asm Z80drv: ; Z80 XGM driver INCBIN "soundstef\z80_xgm.bin" Z80drv_end: align 256 NULLpcm: INCBIN "soundstef\null.raw" NULLpcm_end:
align 256 ExtraLifePcm: INCBIN "soundstef\ExtraLife.raw" ExtraLifePcm_end:
align 256 LogoVeteaPCM: INCBIN "soundstef\LogoVetea.raw" LogoVeteaPCM_end
align 256 StartPCM: INCBIN "soundstef\Start.raw" StartPCM_end align 256 SegaPcm: INCBIN "soundstef\sega.raw" SegaPcm_end
align 256 BravoPCM: INCBIN "soundstef\Bravo.raw" BravoPCM_end
align 256 BonusPcm: INCBIN "soundstef\Bonus.raw" BonusPcm_end:
align 256 Colt45Pcm: INCBIN "soundstef\colt45.raw" Colt45Pcm_end:
align 256 MortPcm: INCBIN "soundstef\Mort.raw" MortPcm_end:
align 256 Mort1Pcm: INCBIN "soundstef\Mort1.raw" Mort1Pcm_end:
align 256 DeadPapiPcm: INCBIN "soundstef\DeadPapi.raw" DeadPapiPcm_end:
align 256 Mort2Pcm: INCBIN "soundstef\Mort2.raw" Mort2Pcm_end:
align 256 Mort3Pcm: INCBIN "soundstef\Mort3.raw" Mort3Pcm_end:
align 256 MagnumPcm: INCBIN "soundstef\Magnum357.raw" MAgnumPcm_end:
align 256 XGMsong: INCBIN "soundstef\sor2.xgc"
align 256 PapiPcm: incbin "soundstef\papi.raw" PapiPcm_end
align 256 PapiPcm1: incbin "soundstef\papi1.raw" PapiPcm1_end
align 256 ImpactPcm: incbin "soundstef\Impact.raw" ImpactPcm_end
align 256 MortPapiPcm: incbin "soundstef\MortPapi.raw" MortPapiPcm_end
align 256 PapiPcm2: incbin "soundstef\papi2.raw" PapiPcm2_end
align 256 TruckPcm: incbin "soundstef\Truck.raw" TruckPcm_end
align 256 OuhPcm: incbin "soundstef\ouh.raw" OuhPcm_end
align 256 StartMamiPcm: incbin "soundstef\StartMami.raw" StartMamiPcm_end
align 256 OuhMamiPcm: incbin "soundstef\OuhMami.raw" OuhMamiPcm_end
align 256 UziPcm: incbin "soundstef\Uzi.raw" UziPcm_end
align 256 RirePapiPcm: incbin "soundstef\RirePapi.raw" RirePapiPcm_end
align 256 RireMamiPcm: incbin "soundstef\RireMami.raw" RireMamiPcm_end
align 256 ClaquePcm: incbin "soundstef\Claque.raw" ClaquePcm_End
align 256 MortMamiPcm: incbin "soundstef\Crimami.raw" MortMamiPcm_end
end asm code here
|
|
|
Post by leander on May 7, 2015 2:27:58 GMT -5
Hi, this is my own code in pure Assembler with some changes (less displacement in registers) in the xgm_playmusic function and some psg_init and ym2612 reset implementations, please TEST! And sorry poor my english.
startmusic:
bsr z80_loadDriver
move.w #$ffff,d0 @jump nop nop nop nop dbra d0,@jump
lea song,a1 lea RAM,a3 ;64 BYTES!!!! ;<---- memoria temporal para punteros bsr xgm_startPlayMusic rts
z80_loadDriver:
bsr z80_requestbus
MOVE.L #(Z80drv_end-Z80drv),D0 LEA Z80drv,A0 lea $A00000,A1
@loop: MOVE.B (A0)+, (A1)+ DBRA D0, @loop ; load driver
jsr psg_init jsr ym2612_reset
bsr z80_requestbus
lea NULLpcm,a0 ; d0 = silent sample move.l a0,d0
move.l #$A01C00,a0 ; point to Z80 sample id table (first entry = silent sample)
lsr.w #8,d0 move.b d0,(a0)+ ; sample address swap d0 move.b d0,(a0)+ move.b #$01,(a0)+ ; sample length move.b #$00,(a0)
move.w #$000,($A11200) ; Start Z80 Reset move.w #$000,($A11100) ; release the Z80 bus
lea $A00102,a0 ; point to status
@test_ready: move.w #100,d0 ;
@wait: DBRA D0, @wait ; wait a bit
bsr z80_requestbus
move.b (a0),d0 move.w #$000,($A11100) ; release the Z80 bus
btst #7,d0 ; not yet ready beq @test_ready rts
z80_requestbus: ;-----------------BUS REQUEST
move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) ; End Z80 Reset @wait2 move.w ($A11100),D0 ; read Z80 halted state btst #8,D0 ; Z80 halted ? bne @wait2 ; not yet, wait... rts
xgm_startPlayMusic ;------------------------- PLAY >>>>>>> ; a1 should point on XGM music ; a3 PARA MEMORIA TEMPORAL??? 64 bytes for pcmpointers <-- mecaguen su padre.
bsr z80_requestbus
move.l a3,a0 ; a0 = reserved $FC array for sample id table moveq #0,d0
@loop: ; prepare sample id table move.w d0,d1 add.w d1,d1 add.w d1,d1 moveq #0,d2 move.w 0(a1,d1.w),d2 ; get sample addr in song bank table rol.w #8,d2 ; revert endianess
cmp.w #$FFFF,d2 ; is null sample ? bne @not_null
move.l #NULLpcm,d2 jmp @addr_done
@not_null: addq.w #1,d2 ; add offset lsl.l #8,d2 ; pass to 24 bits add.l a1,d2 ; transform to absolute address
@addr_done lsr.w #8,d2 ; get high byte move.b d2,0(a0,d1.w) swap d2 ; get low byte move.b d2,1(a0,d1.w) move.w 2(a1,d1.w),2(a0,d1.w) ; copy sample length
addq.w #1,d0 cmp.w #$3F,d0 bne @loop
lea $A01C04,a2 ; destination of sample id table lsl.w #2,d0 ; set size in bytes subq.w #1,d0
@sampleIdLoop: move.b (a0)+,(a2)+ dbra d0,@sampleIdLoop ; load sample id table
move.l a1,d0 ; d0 = song address add.l #$100,d0 ; bypass sample id table
moveq #0,d2 move.w $FC(a1),d2 ; get sample data size rol.w #8,d2 ; revert endianess lsl.l #8,d2 ; pass to 24 bits
add.l d2,d0 ; bypass samples data addq.l #4,d0 ; bypass music data size field
lea $A00104,a2 ; XGM base parameters address
move.b d0,0(a2) ; low byte lsr.w #8,d0 move.b d0,1(a2) ; med low byte swap d0 move.b d0,2(a2) ; med high byte lsr.w #8,d0 move.b d0,3(a2) ; high byte
or.b #$40,($A00100) ; send play XGM command
move.w #$000,($A11100) ; release the Z80 bus rts
ym2612_Reset: ;-----------------------INITIALIZE YM2612 ----------------------------------------
bsr z80_requestbus
move.w #(@ym2612dataend-@ym2612data)/2,d2 lea @ym2612data,a0 @loopYM2612
move.b (a0)+,d1 move.b (a0)+,d0 bsr @ym2612_write dbra d2,@loopYM2612 @waittaken move.w ($a11100),d0 btst #8,d0 bne @waittaken move.w #0,($A11100) ;release bus rts
@ym2612_write: ;d0.b data ;d1.b PORT lea $a04000,a1 @jump move.b (a1),d3 ;wait ym2612 base port busy btst #7,d3 bne @jump andi.w #$3,d1 move.b d0,(a1,d1.w) nop ;megadrive 2 nop nop nop nop rts even @ym2612data: dc.b 0,$b4,1,$c0,2,$b4,3,$c0 ;ENABLE LEFT AND RIGHT OUPUT FOR ALL CHANNEL dc.b 0,$b5,1,$c0,2,$b5,3,$c0 dc.b 0,$b6,1,$c0,2,$b6,3,$c0
dc.b 0,$22,1,$00 ;DISABLE LFO
dc.b 0,$27,1,$0 ;DISABLE TIMER & SET CHANEL 6 TO NORMAL MODE
dc.b 0,$28 ;ALL KEY OFF dc.b 1,$00,1,$04 dc.b 1,$01,1,$05 dc.b 1,$02,1,$06
dc.b 0,$2b,1,$0 ;DISABLE DAC @ym2612dataend:
psg_init: ;--------------INITIALIZE PSG ----------------------- move.w #@psgdataend-@psgdata,d0 lea $C00011,A1 lea @psgdata,a0 @loopPSG move.b (a0)+,(a1)+ dbra d0,@loopPSG rts
even @psgdata dc.b %10000000,0,%10011111 dc.b %10100000,0,%10111111 dc.b %11000000,0,%11011111 dc.b %11100000,0,%11111111 @psgdataend
|
|