Home | Forums | What's new | Resources | |
could someone post some working hello world code? |
mirakus - Oct 20, 2010 |
Amon | Oct 20, 2010 | ||||
Welcome Mirakus. The easiest way to start Saturn Dev is to use the two sega libraries SGL and SBL. http://www.rockin-b.de/saturn/saturngametutorial/S... is the best way to learn how to use the SGL. If you wish to avoid the libraries http://vberthelot.free.fr/SX/satdev/Programs.html... download some of Charles M. stuff. He is no longer part of the Saturn Dev community as are a lot of these people. So if you have any questions please ask here on the forums and do not contact the authors availible. I have included some example code.. please note this hacked together from Rockin'Bs tutorial and may not compile.
Code:
|
mic | Oct 21, 2010 | |||
I've got some (non-SGL) code examples here.... I use KPIT's toolchain for building, but using a home-built SH2 version of GCC will work just as well. |
mirakus | Aug 16, 2011 | |||
Well, it's taken me a while since I first started, but I finally got my toolchain built. I built some code successfully, but I'm not sure how to get into into the proper format to run on an emulator or system. What else is involved once the code is built? The samples I'm using have some .S files in there as well as some linker scripts, but I'm not sure what they are or how to use them. Thanks. |
Chilly Willy | Aug 17, 2011 | |||
.S files have assembly language code and data. Linker scripts tell the object loader (ld) what addresses to use for different sections; for example, it will set the code and data and bss sections to high ram. That allows a binary file to be created with everything having proper pointers. |
antime | Aug 17, 2011 | |||
Slightly off-topic but ld is just a linker. The object loader (ld.so on many systems) is not part of binutils. |
mirakus | Aug 17, 2011 | |||
Okay. Bear with me here. All of this is pretty new to me (targeting a machine other than PC), so I'm still kind of confused. Really all I'm trying to do at this moment is to create a small program similar to what antorino did in the post above, just so that I can verify that I have everything working and I'm ready to take the next step. Let's say I write the example above, what would I do after linking my built object code with the SGL static lib (assuming that's all I would have to do)? How should binary files be named? I'm clueless as to how the linker script is supposed to work, or how to make use of the instructions in the .S file. Do I need to assemble the S file link that in with everything else? Additionally, I just don't understand what the Saturn/emulator is going to look for when I load an iso. I have the part of making the iso covered - I just don't know how to make sure all of my other files are built/set up correctly. I've done a fair scouring through the forums, but haven't found a lot of this specific setup information. I've seen a lot of good examples out there on writing code for Saturn, but still not really much on setting up that code once it's compiled and preparing it to run. |