Building the developer examples
Ok, to build and run the Development examples make sure you have the following programs installed on your computer:
- Hyper Terminal
- Katana R9 devkit
- A text editor (notepad will do, though I recommend UltraEdit)
Start a command prompt using the icon that was installed with the Katana devkit, called “Start a new compilation environment”.
Change directory to a developer sample, I suggest “C:\KATANA\Sample\Ninja3D\TeaPot” for now.
Get hold of this file Katana_R9_Build_files-R2.zip and then extract the files “makefile” and “ldscript.txt” to that directory.
The “makefile” file is already configured for the source code files that this example uses, you’ll need to edit it for other examples by adding the names of the object files and the C source code files.
Now load up "test.c" in a text editor and find the following section in main()
#ifdef __GNUC__
shinobi_workaround();
#endif
Now either delete, or better, just comment out the shinobi_workaround() function like this:
#ifdef __GNUC__
/* shinobi_workaround(); */
#endif
Now save the file again: You should have the following files in your directory:
Directory of C:\KATANA\Sample\Ninja3d\teapot
01/08/2000 00:10 <DIR> cw_proj
09/11/1999 12:25 127 global32.S
09/11/1999 12:25 173 global32.src
04/08/2000 04:24 1,962 ldscript.txt
11/08/2000 04:23 1,274 makefile
09/11/1999 12:25 70 model.c
09/11/1999 12:25 169 mssccprj.scc
07/08/2000 02:17 403 njloop.c
09/11/1999 12:25 4,984 SBINIT.C
09/11/1999 12:25 135,451 t009.c
09/11/1999 12:25 223,923 tea_teapot1.nja
09/11/1999 12:25 607 teapot.mak
07/08/2000 06:06 2,242 test.c
The "rotate.mak" file and the "cw_proj" directories are not used.
Now type in “make” at the command prompt and press return. You should see the following output:
as -little -o global32.o global32.s
gcc -mhitachi -m4-single-only -ml -DNINJA -D__SET4__ -D__SET5__ -D__KATANA__ -D_CLX_ -D_CLX2_ -D_STRICT_UNION_ -IC:\\KATANA\\include -I. -O2 -fno-delayed-branch -g -c model.c -o model.o
gcc -mhitachi -m4-single-only -ml -DNINJA -D__SET4__ -D__SET5__ -D__KATANA__ -D_CLX_ -D_CLX2_ -D_STRICT_UNION_ -IC:\\KATANA\\include -I. -O2 -fno-delayed-branch -g -c njloop.c -o njloop.o
njloop.c: In function `main':
njloop.c:10: warning: return type of `main' is not `int'
gcc -mhitachi -m4-single-only -ml -DNINJA -D__SET4__ -D__SET5__ -D__KATANA__ -D_CLX_ -D_CLX2_ -D_STRICT_UNION_ -IC:\\KATANA\\include -I. -O2 -fno-delayed-branch -g -c sbinit.c -o sbinit.o
gcc -mhitachi -m4-single-only -ml -DNINJA -D__SET4__ -D__SET5__ -D__KATANA__ -D_CLX_ -D_CLX2_ -D_STRICT_UNION_ -IC:\\KATANA\\include -I. -O2 -fno-delayed-branch -g -c t009.c -o t009.o
gcc -mhitachi -m4-single-only -ml -DNINJA -D__SET4__ -D__SET5__ -D__KATANA__ -D_CLX_ -D_CLX2_ -D_STRICT_UNION_ -IC:\\KATANA\\include -I. -O2 -fno-delayed-branch -g -c test.c -o test.o
gcc -mhitachi -m4-single-only -ml -DNINJA -D__SET4__ -D__SET5__ -D__KATANA__ -D_CLX_ -D_CLX2_ -D_STRICT_UNION_ -IC:\\KATANA\\include -I. -O2 -fno-delayed-branch -g -o test.srec -Wl,--oformat,srec,-Tldscript.txt,-LC:\\KATANA\\lib\\gnu\\ -nostartfiles\ C:\\KATANA\\lib\\gnu\\strt1.obj C:\\KATANA\\lib\\gnu\\strt2.obj global32.o model.o njloop.o sbinit.o t009.o test.o\ -lNINJA -lnindows -lshinobi -lsh4nlfzz -lNINJA
You can always ignore the "return of `main` is not `int`" warning, other warnings should be checked.
If you now type in “dir” and press return your directory should look like this:
Directory of C:\KATANA\Sample\Ninja3d\teapot
11/08/2000 04:28 499 global32.o
09/11/1999 12:25 127 global32.S
09/11/1999 12:25 173 global32.src
04/08/2000 04:24 1,962 ldscript.txt
11/08/2000 04:23 1,274 makefile
09/11/1999 12:25 70 model.c
11/08/2000 04:28 138,180 model.o
09/11/1999 12:25 169 mssccprj.scc
07/08/2000 02:17 403 njloop.c
11/08/2000 04:28 77,512 njloop.o
09/11/1999 12:25 4,984 SBINIT.C
11/08/2000 04:28 79,420 sbinit.o
09/11/1999 12:25 135,451 t009.c
11/08/2000 04:28 109,820 t009.o
09/11/1999 12:25 223,923 tea_teapot1.nja
09/11/1999 12:25 607 teapot.mak
07/08/2000 06:06 2,242 test.c
11/08/2000 04:28 93,040 test.o
11/08/2000 04:28 1,577,134 test.srec
The file “test.srec” is the executable file, in Motorola SREC format, ready to be uploaded via the serial link.
Ok, so lets do that now then!
Make sure your Serial Interface is connected to a COM port and that it’s firmly plugged into the back of your Dreamcast.
Boot your Dreamcast with the Serial Slave CD (A Sega logo should be displayed, and the border should now be Blue).
Start up HyperTerminal, and open up my HyperTerminal config (set for COM1)
Adjust the COM port if required.
If you now press return a couple of times you’ll see that you get a ”>” prompt.
If you press ”?” the protocol version of the Serial Slave boot CD will be returned. (V103)
Here’s a picture of what you should see:

Ok, now you’ve got that far we can upload the “test.srec” file that we just compiled.
Open up a text editor (notepad) and load the file into that (srec files are ASCII plain text files)
Select the whole document (You can press Ctrl+A in most text editors to do this) then do “Edit/Copy” from the menus to copy it to the clipboard.
Now switch back into HyperTerminal and select “Edit/Paste to Host”.
The ASCII program code will now be uploaded to your Dreamcast, at 57,600k/sec this can take a few mins, so go get a cup of tea or something! (Note: if you minimize HyperTerminal to the task bar it will upload quicker as it then it won’t be drawing or scrolling the screen)
When it’s uploaded you’ll see something like this in your HyperTerminal window:

Ok, now if you look at the dreamcast screen, you should see a nice teapot, like this:

If you press the “B” button of a controller in the leftmost port (A0) you’ll see a pop-up menu from which you can access debug windows, performance monitors, texture viewers etc. Very nice..
Tada! Right, there you go, now it’s up to you to do some coding!
If these instructions were useful to you then please let me know, and drop me some Greetz in your next Demo and let me have a copy of it!
Written by Hydra of www.Hydras-World.com