|
Post by gaffa2002 on Sept 20, 2011 9:21:23 GMT -5
Maybe the problem is when compiling the driver. Are you using the correct version of jasm to compile the sound driver? I`ve attached my driver in case you need it. Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 9:39:39 GMT -5
Here's the error log:
Output File: basic.bin Pass 1 Pass 2 basic.s:5: *** Error: Illegal opcode 'BINCLUDE' *** binclude "z80drv.bin" basic.s:7: *** Error: Illegal opcode 'ASM' *** asm end basic.s:9: *** Error: Illegal opcode 'ASM' *** asm basic.s:11: *** Error: Illegal opcode 'BINCLUDE' *** binclude "music.tfc" basic.s:12: *** Error: Illegal opcode 'GAMEBGM_END' *** GameBgm_end: basic.s:13: *** Error: Illegal opcode 'ASM' *** asm end basic.s:15: *** Error: Illegal opcode 'ASM' *** asm basic.s:25: *** Error: Symbol 'Z80_BUSREQ' undefined *** 0030C6 33FC 0100 0000 move.w #$100,Z80_BUSREQ ;busreq on basic.s:26: *** Error: Symbol 'Z80_RESET' undefined *** 0030CE 33FC 0100 0000 move.w #$100,Z80_RESET ;reset off basic.s:48: *** Error: Symbol 'Z80_RESET' undefined *** 003108 33FC 0000 0000 move.w #$0,Z80_RESET ;reset on basic.s:49: *** Error: Symbol 'Z80_BUSREQ' undefined *** 003110 33FC 0000 0000 move.w #$0,Z80_BUSREQ ;busreq off basic.s:50: *** Error: Symbol 'Z80_RESET' undefined *** 003118 33FC 0100 0000 move.w #$100,Z80_RESET ;reset off basic.s:75: *** Error: Illegal opcode 'MOVE1.' *** move1. #0, D0
00013 Total Error(s)
UnSuccessfully Compiled :( ! 13 Asmx errors Have a nice day
Press ESC to close the log window
Here's the source:
asm DriverZ80: binclude "z80drv.bin" DriverZ80end: asm end asm GameBgm: binclude "music.tfc" GameBgm_end: asm end
asm ;=============================== ; PlayMusic ; Loads z80 Driver into memory and plays a music ; original created by SHIRU ; Parameters: ; 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 j = joypad.0 if j.6 then asm move1. #0, D0 end asm end if wend
The errors came with using your z80drv.bin, and the one I compiled as well, so I don't believe that's the issue. Do you have an example you can post/attach?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 10:00:26 GMT -5
Pretty sure ASMX doesn't have a BINCLUDE command ( hence the "Illegal opcode" errors ) .. use INCBIN instead.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 10:20:46 GMT -5
That fixed those errors, thanks moon! Here's the current errors:
Output File: basic.bin Pass 1 Pass 2 basic.s:20: *** Error: Symbol 'Z80_BUSREQ' undefined *** basic.s:20: *** Error: Code at non-word-aligned address *** 003DA3 33FC 0100 0000 move.w #$100,Z80_BUSREQ ;busreq on basic.s:21: *** Error: Symbol 'Z80_RESET' undefined *** 003DAC 33FC 0100 0000 move.w #$100,Z80_RESET ;reset off basic.s:43: *** Error: Symbol 'Z80_RESET' undefined *** 003DE6 33FC 0000 0000 move.w #$0,Z80_RESET ;reset on basic.s:45: *** Error: Symbol 'Z80_BUSREQ' undefined *** 003DEE 33FC 0000 0000 move.w #$0,Z80_BUSREQ ;busreq off basic.s:46: *** Error: Symbol 'Z80_RESET' undefined *** 003DF6 33FC 0100 0000 move.w #$100,Z80_RESET ;reset off basic.s:70: *** Error: Illegal opcode 'MOVE.1' *** move.1 #0, D0
00007 Total Error(s)
UnSuccessfully Compiled :( ! 7 Asmx errors Have a nice day
Press ESC to close the log window
Do I need to dim those variables first?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 10:28:52 GMT -5
Those aren't variables, they are labels .. and somehow ASMX says they aren't defined. Try pasting the driver in BEX as plain-text / asm instead of using a external BIN.
Edit - Should have read the entire thread. Once you compile the driver, ASMX won't be able to get the address of any data labels that existed in the driver source anymore. So the errors make sense.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 11:02:23 GMT -5
Hmm... I think I'm missing something...
move.w #$100,Z80_RESET
Isn't that moving whatever Z80_RESET's value is into memory? I looked through the z80drv.asm and didn't see any labels (or anything even called Z80_RESET or Z80_BUSREQ).
Edit: I'll try to copy/paste the driver into ASM code blocks, and hopefully I can make some progress with that.
Edit2: Yeah, I think I'll have to give up on the pasting the driver into BEX since it seems to require a lot of modifications that are far beyond my skill.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 11:17:44 GMT -5
Oops .. they're constants, not labels So you should be able to simply swap them out with their actual values.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 11:20:30 GMT -5
Haha nice! Thanks moon Would it go in like this: move.w #$100,$a11200? I suppose I can just try it and see if it compiles, though I won't be able to tell if it's working since I can't hear sounds remotely Edit: I tried above, also with #$, but still no go. Also tried adding in the variables like was shown in that code you took a screen shot of, and there is 1 error now: basic.s:22: *** Error: Code at non-word-aligned address *** 003DA3 33FC 0100 00A1 move.w #$100,Z80_BUSREQ ;busreq on Would it be better to poke the values, or try to figure this out in the ASM code?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 11:32:31 GMT -5
basic.s:22: *** Error: Code at non-word-aligned address *** 003DA3 33FC 0100 00A1 move.w #$100,Z80_BUSREQ ;busreq on Looks like you forgot to swap one Z80_BUSREQ out
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 11:55:22 GMT -5
Not sure... here's the code:
asm Z80_BUSREQ equ $a11100 Z80_RESET equ $a11200 DriverZ80: incbin "z80drv.bin" DriverZ80end: end asm asm GameBgm: incbin "music.tfc" GameBgm_end: end asm
asm ;=============================== ; PlayMusic ; Loads z80 Driver into memory and plays a music ; original created by SHIRU ; Parameters: ; 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 wend
I don't think I've missed anything...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 12:04:18 GMT -5
Ah, you defined the constants using EQU instead of swapping them out In that case the line mentioned in the error is simply the first line of the Playmusic "block" which is assembled at non-word-aligned address. Not exactly sure what is causing that ( BEX probably ).
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 12:18:35 GMT -5
Hmm, even if I use the value instead of defining the constant, it still gives the error. If I comment that line out, it goes to the next line, comment that out, it errors at the following line... so I really have no clue at this point.
Maybe it could be the version of ASMX? I don't know really know what to do next as I'm insanely lost with ASM to begin with. Why can't playing music be simple! lol
|
|
|
Post by gaffa2002 on Sept 20, 2011 14:15:31 GMT -5
First of all sorry for forgetting to post the definitions of Z80_BUSREQ and Z80_RESET, this was defined in a separated file in my code and I ended up forgetting it . Pasting the assembly code for the z80 driver will not work because the assembly code in the file is specific for the z80. That`s why you must compile it and load the binary file directly into z80 memory through the 68k (this is what the playmusic subroutine does) Regarding the problem you are having now, maybe the data in the binary file and the music file is messing with the memory positions of your code. Try doing the following: move the code asm DriverZ80: ;TLabel for beginning of driver binclude "z80drv.bin" DriverZ80end: ;Label to end of driver asm end asm GameBgm: binclude "mymusic.tfc" GameBgm_end: asm end To the very end of your program, after ALL coding. I usually put all my includes that are not coding (string, sound effects, graphics, etc) at the end of the "cartridge", but for some weird reason I didn`t do it in the example I gave you (my bad again, sorry). Hope this helps
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 20, 2011 14:43:16 GMT -5
You can use Z80 ASM inline as well, as shown in this example.
|
|
|
Post by gaffa2002 on Sept 20, 2011 14:49:21 GMT -5
Cool! I didn`t know that bex supported that.
|
|