Internal XGM specs ?

SGDK only sub forum

Moderator: Stef

Post Reply
tryphon
Very interested
Posts: 299
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Internal XGM specs ?

Post by tryphon » Wed Jul 10, 2019 12:58 pm

Bilingual post :P

Je veux générer moi-même mon code XGM. Je me suis donc orienté vers la spécification du format qu'on trouve ici : https://github.com/Stephane-D/SGDK/blob ... in/xgm.txt

Et j'ai voulu m'assurer de deux-trois trucs en regardant un XGM directement dans la ROM de sample/xgmplayer. Normalement, le code XGM devait démarrer par :

Code: Select all

58 47 4D 20 ("XGM ")
Mais en fait non, rien ne démarre ainsi dans la ROM.

Dois-je comprendre que dans la ROM, le XGM est converti dans un autre format ? Si oui, quelles sont ses specs ?

======================================================================

I want to generate myself my own XGM code. So I looked into the format specifications, here: https://github.com/Stephane-D/SGDK/blob ... in/xgm.txt

I wanted to check some things by looking directly into an XGM sample in a compiled ROM. I opened sample/xgmplayer ROM. Normally, the XGM sample should start with :

Code: Select all

58 47 4D 20 ("XGM ")
But I couldn't find this sequence in the ROM.

Does it mean that XGM is converted, during compilation, in another simpler format ? If yes, which are their specs ?

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

Re: Internal XGM specs ?

Post by Stef » Thu Jul 11, 2019 10:28 am

Salut Tryphon :)

Yes, internally the XGM is compiled to XGC format (a bit different but not much).
But what do you want to generate XGC format directly ? XGM is simpler to generate and you can always use the xgmtools (available in SGDK) to convert from XGM to XGC.

tryphon
Very interested
Posts: 299
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Internal XGM specs ?

Post by tryphon » Fri Jul 12, 2019 6:24 am

Salut Stef, j'espère que tout va bien, je te croise plus trop sur le forum des malades (qui porte de "mieux en mieux" ce titre).

The first reason is that I don't want to rely on any external tool (besides the ones I wrote myself).

The second reason is that, at some point, I may want to modify the XGM driver (add some features).

Of course if I do that, I'll ask you before and submit all modifications here :)

Is the XGC described somewhere or do I have to decipher xgmtools source code ?

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

Re: Internal XGM specs ?

Post by Stef » Fri Jul 12, 2019 8:30 am

To be honest i don't think you can modify the current XGM driver to add new feature. It already fills up all the Z80 RAM so it becomes almost impossible to push new features into it. I'm myself thinking about rewriting a new XGM driver (derived from current but still rewrite from scratch) to add new features.
There is no XGC format description, indeed you need to sort it from the xgmtool sources code.
Basically it shifts any command one bit right for faster parsing from Z80. Then it also automatically split block >= 256 bytes, in which case it uses a special command for that. I think i also added a specific command to mark the end of a block. In general XGC data are a bit fatter than base XGM (not much though).

tryphon
Very interested
Posts: 299
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Internal XGM specs ?

Post by tryphon » Fri Jul 12, 2019 9:31 am

Do you think it'd be feasible to add a kind of JSR feature (jump to another part of the xgc code, and a return code) ?

It'd allow to store separately instruments settings, or isolate repeating patterns of music ?

I guess it's not so easy, because you must have thought about it.

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

Re: Internal XGM specs ?

Post by Stef » Fri Jul 12, 2019 7:44 pm

No way to add that really, at least good luck trying to fit that in.. One of the reason I want to rewrite the driver is to reduce file size ;-)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests