Need Help With xgmplayer

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Need Help With xgmplayer

Post by Sik » Mon Jul 10, 2017 3:31 am

Chilly Willy wrote:When you're coding, do you want a half-dozen people standing behind you looking over your shoulder telling you conflicting instructions of where to go (in the program) and what to do? THAT is what real-time chatting does.
When you're asking help to troubleshoot something together, yes >_> (especially if you need to test on equipment they have but you don't, and need to test several times) Not any different from bringing in a coworker to help troubleshoot a bug on the spot. Especially important if you need things to move fast (e.g. it's a blocker bug that halts all further progress).

When you're programming new stuff you should isolate yourself from everything else instead :v
Sik is pronounced as "seek", not as "sick".

Scorpion Illuminati
Interested
Posts: 28
Joined: Fri Oct 02, 2015 4:58 pm

Re: Need Help With xgmplayer

Post by Scorpion Illuminati » Mon Jul 10, 2017 4:10 am

Sik wrote:
Chilly Willy wrote:When you're coding, do you want a half-dozen people standing behind you looking over your shoulder telling you conflicting instructions of where to go (in the program) and what to do? THAT is what real-time chatting does.
When you're asking help to troubleshoot something together, yes >_> (especially if you need to test on equipment they have but you don't, and need to test several times) Not any different from bringing in a coworker to help troubleshoot a bug on the spot. Especially important if you need things to move fast (e.g. it's a blocker bug that halts all further progress).
Thank You, this is exactly the situation I am in. I need help troubleshooting as my xgm player code is exactly the same as the working code, yet it still doesn't work. I was helping Sik test his OS app on real hardware and came upon a bug that cause it to crash on load up. I took a video of it, uploaded it and showed what I was doing in real time. If it wasn't for real-time chat I wouldn't of been able to explain what I was doing, plus he would of had to wait for my response every time he wanted to test a possible solution.

~Scorpion Illuminati~
Scorpion Illuminati - An open source rhythm game for the Sega Genesis
http://www.scorpionilluminati.tk

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Need Help With xgmplayer

Post by Stef » Mon Jul 10, 2017 1:06 pm

Sik wrote:Yeah the wrapper is based around the old BEX code (which itself was mostly asm anyway), doing it from the lastest version would require rewriting the whole lot from scratch =/ Would have been much easier if the game was written for SGDK from the beginning (avoiding the need for this whole thing).
I compared your z80_xgm.s80 file and it's exactly identical to the last SGDK one, still the generated code is different... only 1 difference but not normal anyway !
Thank You, this is exactly the situation I am in. I need help troubleshooting as my xgm player code is exactly the same as the working code, yet it still doesn't work.
As i pointed the generated code is not "exactly" the same, look into a Z80 memory viewer at the address i specified... You should have the same code byte to byte as we use the same Z80 source code.

The last link you provided here :
https://www.dropbox.com/s/bnvvhy0j0y3bl ... 7.rar?dl=0

Appear to point on a corrupted archive :-/

Scorpion Illuminati
Interested
Posts: 28
Joined: Fri Oct 02, 2015 4:58 pm

Re: Need Help With xgmplayer

Post by Scorpion Illuminati » Mon Jul 10, 2017 7:48 pm

Stef wrote:
Sik wrote:Yeah the wrapper is based around the old BEX code (which itself was mostly asm anyway), doing it from the lastest version would require rewriting the whole lot from scratch =/ Would have been much easier if the game was written for SGDK from the beginning (avoiding the need for this whole thing).
I compared your z80_xgm.s80 file and it's exactly identical to the last SGDK one, still the generated code is different... only 1 difference but not normal anyway !
Thank You, this is exactly the situation I am in. I need help troubleshooting as my xgm player code is exactly the same as the working code, yet it still doesn't work.

As i pointed the generated code is not "exactly" the same, look into a Z80 memory viewer at the address i specified... You should have the same code byte to byte as we use the same Z80 source code.
Well the source code for the z80 module is there too, in framewk/z80 so if it's exactly the same source code then it should generate the same binary as you. Not sure why it's generating a different binary. Either way it still doesn't work.

The last link you provided here :
https://www.dropbox.com/s/bnvvhy0j0y3bl ... 7.rar?dl=0

Appear to point on a corrupted archive :-/
Can't be it's must be that i am using WinRar to compress my source code, the archive is fine for me: https://www.dropbox.com/s/c0u6je41ohcn0 ... e.png?dl=0
Anyways heres a zipped up version of the same code: https://www.dropbox.com/s/jtawr5vhbp22y ... 7.zip?dl=0 Hope it helps.

~Scorpion Illuminati~
Scorpion Illuminati - An open source rhythm game for the Sega Genesis
http://www.scorpionilluminati.tk

Scorpion Illuminati
Interested
Posts: 28
Joined: Fri Oct 02, 2015 4:58 pm

Re: Need Help With xgmplayer

Post by Scorpion Illuminati » Fri Jul 21, 2017 3:24 am

Just wanted to give an update as to progress. I have tried to convert start over in c using SGDK per another members suggestion, Unfortunately I am having trouble trying to code even the most basic task(loading a palette). So with that in mind I have decided to stick to assembly language, and try to figure out why the xgm player isn't working. Here are links to the source code:
RAR: https://www.dropbox.com/s/bnvvhy0j0y3bl ... 7.rar?dl=0
Zip: https://www.dropbox.com/s/jtawr5vhbp22y ... 7.zip?dl=0

So far we have the following clues:
I compared your z80_xgm.s80 file and it's exactly identical to the last SGDK one, still the generated code is different... only 1 difference but not normal anyway !

As i pointed the generated code is not "exactly" the same, look into a Z80 memory viewer at the address i specified... You should have the same code byte to byte as we use the same Z80 source code.

So then now the problem is from the driver wrapper probably... Looking at the source (which are in full assembly :| ) i don't see immediate issue but of course there is many possible mistakes. Also i tried to look what is doing the Z80 and it seems that it's not even starting to play the music as the XGC music data buffer (located at $1700-$17FF) stay empty...
Something weird is that the XGM Z80 driver doesn't look exactly the same as mine, if you compare with the SGDK sprite example (using last XGM driver as you) the XGM driver code start at $200 and end at $15EC while it ends 1 byte sooner on your ROM ($200-$15EB).
The difference is at position $1224:
mine = AF12C33C
your = 23C33C0A

I don't have time to investigate more but definitely that can make a difference !
I have fixed this in my latest build the the problem still persists. Any assistance in this matter would be greatly appreciated.

Sincerely,

Scorpion Illuminati
Scorpion Illuminati - An open source rhythm game for the Sega Genesis
http://www.scorpionilluminati.tk

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Need Help With xgmplayer

Post by Stef » Fri Jul 21, 2017 8:15 am

I made XGM driver to be SGDK ready, i already did a BEX wrapper in assembly which can be used for assembly project as well, and i guess Sik already spent a lot of time in rewriting the ASM wrapper for you. The thing is that debugging Z80 code (or at least trying to understand why the XGM driver doesn't produce any sound) is really difficult, i don't know what your program is doing aside... Checking the wrapper is 100% correct is also really painful and time consuming. The XGM driver is actually working with SGDK so that's not the XGM driver fault, there is something wrong with the wrapper or something else in your project and to be honest i just can't spent too much time in inspecting your project and fix the problem for you...

Given your project i would definitely recommend you to use SGDK as well. It will be far easier than using assembly and XGM will work out of the box. Event if i'm not a fast coder i can replicate what your game is currently doing in a couple of hours with SGDK...

Still I checked again your rom and here's what i can see that in the Z80 RAM :
$104 = $A4820000

$104 should contains the XGC (compiled XGM) music address (bypassing the header and sample data).
Normally XGC data should be aligned to 256 bytes address so normally the value in $104 should always be $04xxxxxx after sample/header bypass.
That is the case in my demo 'sprite' rom but in your case the value is $A4820000 so the XGC location and something else is wrong.

Also I think there is something wrong about the XGM tempo calculation :
I saw internal XGM address moved to $A5820000 so it parsed only 1 byte of XGM music (probably a '0' so it tried to parse the next frame) then it died here probably because it never receive new frame to process...
Normally SGDK set the xgmTempo variable just after loading the XGM driver (50 or 60 depending the system), in the wrapper i never see the xgmTempo set (except in explicit XGM_setTempo(..) call which never happen) so it stay 0 and because of that the music doesn't play.

Scorpion Illuminati
Interested
Posts: 28
Joined: Fri Oct 02, 2015 4:58 pm

Re: Need Help With xgmplayer

Post by Scorpion Illuminati » Sat Oct 07, 2017 1:41 am

Given your project i would definitely recommend you to use SGDK as well. It will be far easier than using assembly and XGM will work out of the box. Event if i'm not a fast coder i can replicate what your game is currently doing in a couple of hours with SGDK...
Problem is it has taken me longer to draw a single tile(a.k.a Tutorial 3) working then it has to get the game in the current state in assembly land.

Sincerely,

Scorpion Illuminati
Scorpion Illuminati - An open source rhythm game for the Sega Genesis
http://www.scorpionilluminati.tk

Post Reply