Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include "pgsdz80_support.asm"
- ; LoadPGSD [TODO add a0/a1 as DAC tables ptrs]
- LoadPGSD:
- movem.l d0/a0/a1,-(sp)
- move.w #$100,($A11100).l ; bus req on
- move.w #$100,($A11200).l ; reset off
- lea __PGSDZ80,a0
- move.l #$A00000,a1
- move.w #__PGSDZ80End-__PGSDZ80,d0 ; TODO -1?
- -
- move.b (a0)+,(a1)+
- dbf d0,-
- move.b ($A10001).l,d0 ; get flag state for NTSC/PAL
- move.b d0,(__PGSD_NewPlaying).l
- move.b #0,(__PGSD_PointerFrom68000).l ; keep this unset for the handshake
- move.w #0,($A11200).l ; START THE Z80: reset on
- move.w #0,($A11100).l ; bus req off
- move.w #$100,($A11200).l ; reset off - Z80 STARTS
- ; now to actually handshake
- $$handshake:
- move.w #$100,($A11100).l ; bus req on
- $$handshake_waitbusreq:
- btst.b #0,($A11100).l
- bne.s $$handshake_waitbusreq
- tst.b (__PGSD_PointerFrom68000).l ; is it zero?
- beq.s $$handshake_keeptrying ; yep; keep handshaking
- move.b #0,(__PGSD_PointerFrom68000).l ; NOPE! WE'RE READY TO GO
- move.w #0,($A11100).l ; bus req off
- movem.l (sp)+,d0/a0/a1 ; and return.
- rts
- $$handshake_keeptrying:
- move.w #0,($A11100).l ; bus req off
- bra.s $$handshake
- ; PlaySong (a0 -- ) - play song at address a0
- PlaySong:
- movem.l d0/a0/a1,-(sp)
- move.w #$100,($A11100).l ; bus req on
- -
- btst.b #0,($A11100).l
- bne.s -
- move.l a0,d0
- move.l #__PGSD_PointerFrom68000,a1 ; write pointer
- move.b d0,(a1)
- REPT 3
- sub.l #1,a1
- lsr.l #4,d0
- move.b d0,(a1)
- ENDM
- move.b #1,(__PGSD_NewPlaying).l ; mark to play music!
- move.w #0,($A11100).l ; bus req off
- movem.l (sp)+,d0/a0/a1
- rts
- ; PlaySFX (a0 -- ) - play SFX at address a0
- PlaySFX:
- ; TODO
- rts
- __PGSDZ80:
- binclude "pgsdz80.bin"
- __PGSDZ80End:
- ; and the handshake code Z80 side is simple:
- ld hl,PointerFrom68000
- ld (hl),$FF ; set it to $FF
- xor a
- -
- cp (hl) ; the 68000 sees the $FF and sets it to 0
- jr nz,-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement