Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Feb 25, 2013 3:07 pm

Hi Stef!

When running on Everdrive, the firmware already initializes RAM. That means that any unintentionally uninitialised variables in rom might be initialized by accident and subtle bugs not found until run as a real cart.

Would it be possible to have the SGDK set all the memory to a known debug value at start up before any code is run? Like a series of 0xdedbeef0xdeadbeef. That way it would be much easier to find variables with bad values.

Thanks!
DJCC

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Feb 25, 2013 3:09 pm

Also!

How do I build with SGDK so that I can get the watch variable window working in Gens? I lost the instructions to do this.

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

Post by Stef » Mon Feb 25, 2013 7:03 pm

You can easily modify SGDK so it resets memory with a specific pattern, just replace line 83 of sega.s file :

Code: Select all

        moveq   #0,%d0
by

Code: Select all

        move.l  #0xDEADBEEF,%d0
sega.s is recompiled every time in your own project so you don't even need to recompile the whole library :)
Also i prefer to avoid doing that modification in the official version as it can lead to undesirable effect for people expecting SGDK to reset memory to 0.

For the watch variables, you have the 'debug' and 'debugall' target in the makefile but honestly support is not good enough yet in GensKMod++
You have also some watch support in GensKMod but i thing it's all manual (don't need any specific debug option in GCC).

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Feb 25, 2013 7:09 pm

Thanks!
Stef wrote: For the watch variables, you have the 'debug' and 'debugall' target in the makefile but honestly support is not good enough yet in GensKMod++
You have also some watch support in GensKMod but i thing it's all manual (don't need any specific debug option in GCC).
I remember seeing a thing where GensKMod would show the correct variable names in the watch window. You had to compile your project in a certain way to get a file out with the names and locations. And GensKMod would load it.

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

Post by Stef » Mon Feb 25, 2013 9:15 pm

Using the "debug" target you will obtain a rom.wch file, i guess KMod use it for variable watch but i think you specify which variable you want to watch directly for GensKMod then you can save watchs so it restore them automatically on next session. Honestly i never used this feature in KMod so i'm not sure about how use it but i guess Kaneda could help you there :)

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Feb 25, 2013 10:05 pm

Stef wrote:Using the "debug" target you will obtain a rom.wch file
Yes, it's a noob question: How do you compile the debug target?

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

Post by Stef » Tue Feb 26, 2013 9:33 am

SGDK use makefile to build project.
Are you using command line compilation or Code::blocks IDE ?
For command line compilation just use :

Code: Select all

make -f makefile.gen debug
So it will choose the "debug" target instead of the default one.
In Code::Blocks you can define severals project build target, just create a debug one and modify the makefile "Build project/target" command by appending "debug" to the command line :

Image

In the CB tutorial i just created a "default" project configuration which the default makefile setting (optimized) but usually we have "release" and "debug" configurations.

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Tue Feb 26, 2013 8:51 pm

Stef wrote:Using the "debug" target you will obtain a rom.wch file, i guess KMod use it for variable watch but i think you specify which variable you want to watch directly for GensKMod then you can save watchs so it restore them automatically on next session. Honestly i never used this feature in KMod so i'm not sure about how use it but i guess Kaneda could help you there :)
err... nobody read the help file, no ? ;)

So...on GensKMod > Option > Debug, be sure to check "Auto load watchers & structures"
if you open a rom, it will search for <romname>.wch and will load it
Then, you'll be able to play with Cpu>Debug>Watcher

note that you could also include kdebug.h and get some trace output in Cpu>Debug > Messages

I found some times ago a better version of watchers and messages windows that my own (GensSomethingElse) if you're interested

EDIT : it's called Gens11svn304, google for it ;)
Menu Tools > RAM Watch
Last edited by KanedaFr on Wed Feb 27, 2013 9:46 am, edited 2 times in total.

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

Post by Stef » Tue Feb 26, 2013 10:11 pm

I tried to load the wch file generated from NM file which has been converted by NM2WCH but i guess this is something totally different as it end up with some invalid variables in GensKMod :p

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

Post by Stef » Wed Feb 27, 2013 7:48 pm

Version 0.94 released :)
Checkout the first page !

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Feb 27, 2013 9:23 pm

Stef wrote:Version 0.94 released :)
New bitmap support works great! Works fine on real hardware and is faster than ever, even if just 1 FPS. 8)

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

Post by Stef » Wed Feb 27, 2013 11:57 pm

Thanks :)
1 FPS ? Ah yeah it's what you gain from the previous version... not that much but still better than nothing :)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Thu Feb 28, 2013 12:18 am

Stef wrote:Thanks :)
1 FPS ? Ah yeah it's what you gain from the previous version... not that much but still better than nothing :)
It's not as much on the top end, 10 goes to 11 FPS, but it's much more on the low end where 5 goes to 6.

peekpoke
Interested
Posts: 37
Joined: Fri Feb 01, 2013 1:11 am

Post by peekpoke » Sat Mar 02, 2013 8:39 pm

There was some not important question about genres sprites support :) Just figured everything by myself - and was impressed by great possibilities that SGDK offers! Thank you very much for your work!

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Post by POLYGAMe » Sun Apr 14, 2013 1:36 am

Is it possible to use SGDK with XCode? My main dev system is my Mac...

Post Reply