Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 16:38:11 GMT -5
Odd error now:
basic.s:64: *** Error: Code at non-word-aligned address *** 003E17 60FE 00 bra forever
can't find bra in the BEX source, or the driver source...
edit: Seems to be in the .TFC file. I tried using .TFD (the exported), but I guess that doesn't work. I'll try another music file...
|
|
|
Post by gaffa2002 on Sept 20, 2011 16:54:48 GMT -5
The error seems to be the same, but this time happening on the end of your game loop.
Did you put the music and driver includes before or after the end of your main loop? Please note it must be AFTER. Actually it must be the last thing on your code.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 16:57:07 GMT -5
I put them after. Driver, then music file.
Here's the code:
asm Z80_BUSREQ equ $a11100 Z80_RESET equ $a11200 end asm
asm
; D0: Music source address (0 to stop music)
Playmusic: move.w #$100,Z80_BUSREQ ;busreq on move.w #$100,Z80_RESET ;reset off
lea $a01ffc,a0 ;#1ffc in Z80 RAM move.b d0,(a0)+ ;write 4-byte addr in Z80 RAM lsr.l #8,d0 move.b d0,(a0)+ lsr.l #8,d0 move.b d0,(a0)+ lsr.l #8,d0 move.b d0,(a0)+
lea DriverZ80,a0 ;copy Z80 driver to Z80 RAM lea $a00000,a1 move.l #DriverZ80end,d0 move.l #DriverZ80,d1 sub.l d1,d0 copyLoop: move.b (a0)+,(a1)+ subq.w #1,d0 bne copyLoop
move.w #$0,Z80_RESET ;reset on move.w #$0,Z80_BUSREQ ;busreq off move.w #$100,Z80_RESET ;reset off
rts ;=============================== end asm asm move.l #GameBgm, D0 ;Move the music start address to D0 bsr Playmusic end asm while 1 sleep 1 wend asm DriverZ80: incbin "z80drv.bin" DriverZ80end: GameBgm: incbin "music.tfc" GameBgm_end: end asm
If I use music.tfd, it'll compile, so that's where the issue is. I'm not sure if there is a fix for this one though. If I load the rom with the .tfd music file (not converted to tfc), I get an m68k illegal error.
Edit: Nope, if I comment out the driver, it compiles...
|
|
|
Post by sega16 on Sept 20, 2011 19:51:31 GMT -5
You need to make the file even aligned for it to work right.
DriverZ80: incbin "z80drv.bin" even DriverZ80end:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 20:23:18 GMT -5
Thanks Sega16... now a different issue.. I get a stack underun error, 68K Line 1111 Emulator in Fusion...also doesn't work on the Everdrive. Any thoughts? Edit: Nevermind. I moved all the ASM code to under my main program loop, and it works great Thanks for everyones help!
|
|
|
Post by sega16 on Sept 20, 2011 20:50:52 GMT -5
I GOT IT TO WORK!!!!!! asm Z80_BUSREQ equ $a11100 Z80_RESET equ $a11200 end asm
asm move.l #GameBgm, D0 ;Move the music start address to D0 bsr Playmusic end asm while 1 sleep 1 wend asm
; D0: Music source address (0 to stop music)
Playmusic: move.w #$100,Z80_BUSREQ ;busreq on move.w #$100,Z80_RESET ;reset off
lea $a01ffc,a0 ;#1ffc in Z80 RAM move.b d0,(a0)+ ;write 4-byte addr in Z80 RAM lsr.l #8,d0 move.b d0,(a0)+ lsr.l #8,d0 move.b d0,(a0)+ lsr.l #8,d0 move.b d0,(a0)+
lea DriverZ80,a0 ;copy Z80 driver to Z80 RAM lea $a00000,a1 move.l #DriverZ80end,d0 move.l #DriverZ80,d1 sub.l d1,d0 copyLoop: move.b (a0)+,(a1)+ subq.w #1,d0 bne copyLoop
move.w #$0,Z80_RESET ;reset on move.w #$0,Z80_BUSREQ ;busreq off move.w #$100,Z80_RESET ;reset off
rts ;=============================== end asm asm DriverZ80: incbin "z80drv.bin" even DriverZ80end: GameBgm: incbin "sonic2.tfc" GameBgm_end: end asm Also I used this see atachment to convert a tfd for smd to tfc and it worked perfect.The z80 was not even aligned and caused a proublum and the playmusic was ran twice becuase it was placed at the beginning.
Attachments:
|
|
|
Post by sega16 on Sept 20, 2011 21:01:22 GMT -5
Here is a quick example I made using the tfm player Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 21:21:10 GMT -5
Awesome! Nice stuff.
I added in the replayer for the m68k side to play a 2nd TFD for sound effects, and as long as I can get it to stop playing (after 1 second I stop it), it works great. I may increase it later on if other sfx require longer than 1 second, but everything seems to work pretty flawless now.
Thanks for all the help moon, sega16, and gaffa2002!
|
|
|
Post by sega16 on Sept 20, 2011 21:25:28 GMT -5
Or you could just use the 68k player and use a z80 pcm player.You can not do pcm on vblank because there would be breaks in audio.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 22:38:48 GMT -5
Is there a z80 pcm player floating around?
|
|
|
Post by gaffa2002 on Sept 20, 2011 22:41:37 GMT -5
Now I`m curious... How can my program work if I did not put the z80 driver to be in the even addresses? I`m using AS to compile the code.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 21, 2011 6:46:26 GMT -5
It's possible that it's because of the ASM compiler. BEX uses the ASMX compiler. Or maybe the emulator you're using doesn't follow the hardware as strict as others? Well, maybe that's not the case because I tested your rom out in Fusion, so I'm not sure.
|
|
|
Post by gaffa2002 on Sept 21, 2011 8:48:53 GMT -5
Weird thing is, it works perfectly on Gens, Fusion and also on the real hardware.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 21, 2011 9:15:32 GMT -5
I'll be willing to bet its just the different types of ASM compilers, though I'm sure moon, sega16, or oompa may have a more accurate answer than I can provide.
|
|
|
Post by sega16 on Sept 21, 2011 15:37:37 GMT -5
Now I`m curious... How can my program work if I did not put the z80 driver to be in the even addresses? I`m using AS to compile the code. It is extremly importan to add an even or align 2 after any incbin. I have had some programs not work and spent hours debuging only to find out that a part of the code was not even aligned.
|
|