Need pointers compiling DOOM source for Jaguar

Started by Saturn, August 17, 2016, 03:40:33 AM

Previous topic - Next topic

rush6432

#30
Well what you saw was just the debug yellow text stating the iwad wasnt found which, if you JUST upload doom.abs to $4000 is normal. Its just telling you it cant see the IWAD to load the doom title screen and music and all other assets from the wad to display.

Also should only be one instance listed there in jagonly.c for the wad offset. its about 3/4 of the way down in the jagonly.c file and is before the networking stuff and i think some other misc math functions and maybe texture mapping code.. (im fuzzy on this as i dont have the source around me at the moment)

Formatting i think is someting like   iwad_offset = 0x40000 

Or something like that


Saturn

#31
To clarify, I saw the yellow text when I flashed the IWAD only rom (where the IWAD started at 0) to $40000 and uploaded doom.abs to $4000. That was different than when I used the full original doom.rom with jcp -f doom.rom $40000 and jcp doom.abs $4000 right after. Then I saw Carl's debug info when I pressed 0 on the controller.
By what I'm gathering from what you said, this should not have worked but it was actually the only thing that had worked in all my attempts.
No idea why but I plan to do it again tonight to see if it still 'works'

Saturn

#32
Quote from: rush6432 on August 24, 2016, 16:43:01 PM
Well what you saw was just the debug yellow text stating the iwad wasnt found which, if you JUST upload doom.abs to $4000 is normal. Its just telling you it cant see the IWAD to load the doom title screen and music and all other assets from the wad to display.

Also should only be one instance listed there in jagonly.c for the wad offset. its about 3/4 of the way down in the jagonly.c file and is before the networking stuff and i think some other misc math functions and maybe texture mapping code.. (im fuzzy on this as i dont have the source around me at the moment)

Formatting i think is someting like   iwad_offset = 0x40000 

Or something like that

Would it be this? It's on line 414 though about 1/4 of the way down:
====================
*/

byte *I_WadBase (void)
{
   return (byte *)0x840000;
}


/*
====================


That's the only 40000 I could find in a search. Wad is only in there 3x and altogether where the above is.
I'll keep poking around for the heck of it.



FMI:
Doom interface code starts at line 221
Math code starts at line 476
Texture mapping code starts at line 667
Double buffered drawing starts at line 1053
Eeprom starts at line 1422
Networking starts at line 1533

rush6432

Quote from: Saturn on August 24, 2016, 20:09:54 PM
Quote from: rush6432 on August 24, 2016, 16:43:01 PM
Well what you saw was just the debug yellow text stating the iwad wasnt found which, if you JUST upload doom.abs to $4000 is normal. Its just telling you it cant see the IWAD to load the doom title screen and music and all other assets from the wad to display.

Also should only be one instance listed there in jagonly.c for the wad offset. its about 3/4 of the way down in the jagonly.c file and is before the networking stuff and i think some other misc math functions and maybe texture mapping code.. (im fuzzy on this as i dont have the source around me at the moment)

Formatting i think is someting like   iwad_offset = 0x40000 

Or something like that

Would it be this? It's on line 414 though about 1/4 of the way down:
====================
*/

byte *I_WadBase (void)
{
   return (byte *)0x840000;
}


/*
====================


That's the only 40000 I could find in a search. Wad is only in there 3x and altogether where the above is.
I'll keep poking around for the heck of it.



FMI:
Double buffered drawing sections starts at line 1053
Eeprom section starts at line 1422
Networking section starts at line 1533
Quote from: Saturn on August 24, 2016, 20:09:54 PM
Quote from: rush6432 on August 24, 2016, 16:43:01 PM
Well what you saw was just the debug yellow text stating the iwad wasnt found which, if you JUST upload doom.abs to $4000 is normal. Its just telling you it cant see the IWAD to load the doom title screen and music and all other assets from the wad to display.

Also should only be one instance listed there in jagonly.c for the wad offset. its about 3/4 of the way down in the jagonly.c file and is before the networking stuff and i think some other misc math functions and maybe texture mapping code.. (im fuzzy on this as i dont have the source around me at the moment)

Formatting i think is someting like   iwad_offset = 0x40000 

Or something like that

Would it be this? It's on line 414 though about 1/4 of the way down:
====================
*/

byte *I_WadBase (void)
{
   return (byte *)0x840000;
}


/*
====================


That's the only 40000 I could find in a search. Wad is only in there 3x and altogether where the above is.
I'll keep poking around for the heck of it.



FMI:
Doom interface code starts at line 221
Math code starts at line 476
Texture mapping code starts at line 667
Double buffered drawing starts at line 1053
Eeprom starts at line 1422
Networking starts at line 1533

Yep thats the one.

0x840000

Basically its $802000+iwad offset


Saturn

#34
Cool, so using the hacked 'wad only' rom as a base (where IWAD starts at 0x00000)

Could I compile a new Doom source with an updated jagonly.c with the return (byte *)0x840000; line changed to return (byte *)0x83D8A0; , compile the source, paste the new doom.abs into the 'wad only' rom and save.

Would it work as a whole rom that can be flashed to a Skunkboard and work as is without uploading a doom.abs to RAM?


Edit:
Nah, guess that wouldn't work either.

rush6432

#35
Quote from: Saturn on August 24, 2016, 20:38:51 PM
Cool, so using the hacked 'wad only' rom as a base (where IWAD starts at 0x00000)

Could I compile a new Doom source with an updated jagonly.c with the return (byte *)0x840000; line changed to return (byte *)0x83D8A0; , compile the source, paste the new doom.abs into the 'wad only' rom and save.

Would it work as a whole rom that can be flashed to a Skunkboard and work as is without uploading a doom.abs to RAM?


Edit:
Nah, guess that wouldn't work either.

You're right about the editing of the iwad_base address (assuming that address is correctly pointing to the wad file in the overall rom image which is calculated by what i said earlier)

The part you are missing though is that the wad file itself and doom have to be "zipped up" per say into a single file (compiled) and then you find the offset of IWAD text in that rom. Like i said though in making that rom you are making a loader program.


doom.abs is a program just like this loader program but compiled to run at a different address.

SO basiaclly once you have a .bin file from compiling your example program with the wad and doom.abs  you can then finx the hex offset for the IWAD text in this rom file. then you can RECOMPILE doom.abs again and then edit that iwad base address  and then do the compile process all over again to get a rom that will run


Here is the kicker though. notice that the DOOM label in the example program is above the WAD label for including the files.

the larger your doom.abs gets, the offset for the wad changes...

zapiy

I don't want to destroy the flow of this thread but this has to be THREAD of the year.. awesome.

Own: Jaguar, Lynx, Dreamcast, Saturn, MegaDrive, MegaCD, 32X, GameGear, PS3, PS, PSP, Wii, GameCube, N64, DS, GBA, GBC, GBP, GB,  Xbox, 3DO, CDi,  WonderSwan, WonderSwan Colour NGPC

Saturn

Quote from: rush6432 on August 24, 2016, 21:53:45 PM
Quote from: Saturn on August 24, 2016, 20:38:51 PM
Cool, so using the hacked 'wad only' rom as a base (where IWAD starts at 0x00000)

Could I compile a new Doom source with an updated jagonly.c with the return (byte *)0x840000; line changed to return (byte *)0x83D8A0; , compile the source, paste the new doom.abs into the 'wad only' rom and save.

Would it work as a whole rom that can be flashed to a Skunkboard and work as is without uploading a doom.abs to RAM?


Edit:
Nah, guess that wouldn't work either.

You're right about the editing of the iwad_base address (assuming that address is correctly pointing to the wad file in the overall rom image which is calculated by what i said earlier)
Yeah, this is exactly what changed my mind for my edit

Quote from: rush6432 on August 24, 2016, 21:53:45 PM
The part you are missing though is that the wad file itself and doom have to be "zipped up" per say into a single file (compiled) and then you find the offset of IWAD text in that rom. Like i said though in making that rom you are making a loader program.

Goes something like this

.68000
.text

LOADER:
             move doom.abs file to ram
.loading_done:
             jmp   $4000

---------------------------------------------------

DOOM:     incbin:  "doom.abs"
WAD:       incbin:  "doom.wad"

      .end

This shell of an example of an asm program has to be compiled at $802000 and includes the wad file and doom.abs

doom.abs is a program just like this loader program but compiled to run at a different address.

SO basiaclly once you have a .bin file from compiling your example program with the wad and doom.abs  you can then finx the hex offset for the IWAD text in this rom file. then you can RECOMPILE doom.abs again and then edit that iwad base address  and then do the compile process all over again to get a rom that will run
Right, I'm trying to wrap my brain around how some of this works. I'll go back through this thread and make a list of rules I need to look at before asking a question. Seems like you're having to repeat stuff but it's appreciated.

Quote from: rush6432 on August 24, 2016, 21:53:45 PM
Here is the kicker though. notice that the DOOM label in the example program is above the WAD label for including the files.

the larger your doom.abs gets, the offset for the wad changes...

I thought of this a little while ago and was like, damn I'll have to keep re-compiling until I get to a point where it stops expanding ???

Way beyond my level, but thanks for taking a stab at getting me up to speed.
Guess I'll stick with the sh*tty way of doing it lol.

But, if there was a way to automate 'zipping' these together, which I suppose there is via the ASM code you showed, this part could be done easily enough. It may not be universal but small edits would make it happen. However, that's where it ends for me as I don't know how to code this. I'm wondering if there's example code in the Atari docs that could be used as a working solution. That's just me thinking out loud, I'm sure it's a piece of cake to people who do this for a living... or used to in 1994 :D

Saturn

#38
Quote from: zapiy on August 24, 2016, 22:02:32 PM
I don't want to destroy the flow of this thread but this has to be THREAD of the year.. awesome.
Yeah, this has been epic!
Big props to rush6432 for taking the time to post all this valuable info 8)


Rules:
1) Doom.abs is a loader program to start DOOM and find the wad at $40000. This can be altered in the jagonly.c file but must have the 'correct' address of the start of the wad file upon compiling the new/updated & separate source code.

2) You can't just open doom.abs with a hex editor and copy/paste the contents in front of offset 40000 and expect it to work. doom.abs and the wad have to be compiled together.

3) Proper cmd.exe commands to flash the Skunkboard with entire Doom game:
jcp -n Doom.rom $802000
jcp doom.abs $4000
(0x840000: Basically its $802000+iwad offset)

rush6432

#39
Quote from: Saturn on August 24, 2016, 22:27:15 PM
Quote from: zapiy on August 24, 2016, 22:02:32 PM
I don't want to destroy the flow of this thread but this has to be THREAD of the year.. awesome.
Yeah, this has been epic!
Big props to rush6432 for taking the time to post all this valuable info 8)


Rules:
1) Doom.abs is a loader program to start DOOM and find the wad at $40000. This can be altered in the jagonly.c file but must have the 'correct' address of the start of the wad file upon compiling the new/updated & separate source code.

2) You can't just open doom.abs with a hex editor and copy/paste the contents in front of offset 40000 and expect it to work. doom.abs and the wad have to be compiled together.

3) Proper cmd.exe commands to flash the Skunkboard with entire Doom game:
jcp -n Doom.rom $802000
jcp doom.abs $4000
(0x840000: Basically its $802000+iwad offset)

SmalL correction, doom.abs is all the doom code basically. the loader or wrapper program is somewhere in that doom.rom but no point in decyphering that. Writing a new one is easy.

If you've installed doom on a dos or windows system, you know that doom.exe is the program and doom1.wad or doom.wad is the obvious. Doom.abs on the jaguar is like doom.exe on the pc.


Saturn

Ah, thanks for that. Sounds like doom.abs is a custom loader to override the one that was hardcoded into the rom to begin with. Also, finding and changing the original (as bytes,words or whatever) within the existing rom is way too much trouble so the custom one makes it a cinch.

rush6432

#41
Attached some goodies ;)

Enjoy. Atleast you're interested enough to work on the source, most aren't. However my only request is that if you mass distribute any roms built with this is that you ask prior if you are using my code (modified or not).

Just drop your doom.abs in the same folder with all these files and run link.bat which should compile doom for you into a single file called doom.bin which runs when flashed to skunk at $802000. It basically makes a rom for you more or less without any header or encryption. I also included the jaguar wad file (original one stripped from jaguar doom rom)

Saturn

Wow, now that's really something! I'm going to mess with this and see what I can do figuring out how to use it. Would like to read/study CART.S and Link.BAT first.

Yes, and guaranteed this never gets used for anything beyond what I'm attempting to do/learn here. You have my word.
Thanks a million for doing this and letting me have access to it. I intend to use it to the fullest!

Saturn

Quote from: rush6432 on August 26, 2016, 03:30:35 AM
Just drop your doom.abs in the same folder with all these files and run link.bat which should compile doom for you into a single file called doom.bin which runs when flashed to skunk at $802000. It basically makes a rom for you more or less without any header or encryption. I also included the jaguar wad file (original one stripped from jaguar doom rom)
I did this exactly and ended up with a 3.99MB DOOM.BIN file. I assumed the size was bc of not having a header.
Flashed it to a Skunkboard using:
jcp -f doom.bin $802000

When it booted I got the yellow text screen that says it doesn't have IWAD.
Do you know what I did wrong?

rush6432

Quote from: Saturn on August 26, 2016, 12:27:22 PM
Quote from: rush6432 on August 26, 2016, 03:30:35 AM
Just drop your doom.abs in the same folder with all these files and run link.bat which should compile doom for you into a single file called doom.bin which runs when flashed to skunk at $802000. It basically makes a rom for you more or less without any header or encryption. I also included the jaguar wad file (original one stripped from jaguar doom rom)
I did this exactly and ended up with a 3.99MB DOOM.BIN file. I assumed the size was bc of not having a header.
Flashed it to a Skunkboard using:
jcp -f doom.bin $802000

When it booted I got the yellow text screen that says it doesn't have IWAD.
Do you know what I did wrong?

So what i would do is compile so you have a doom.bin file then HEX edit this and find the 3rd iwad string of text in the rom.

Once you find this open up windows calculator (if doing this on windows) and then switch it to programmer mode and use HEX. Then add 802000 + IWAD offset together and you should get a new address you can plop into jagonly.c which when you recompile doom.abs again, then recompile and make a doom.bin file it should run.  address you end up putting in jagonly.c might be close to something like 0x83E....