using SGL/SBL with SNASMSH2


Extra Hard Mid Boss
IIRC SNASMSH2 can output COFF objects so it should be possible. You have to learn whatever syntax SNASM uses to specify external symbols and of course adhere to the SuperH ABI.


Mid Boss
wow, SBL functions? are they for C too? and what are they? are they extra SGL functions? info please!
From SBL6/SBL601.TXT :


The Sega Basic Library (SBL) is a low-level library which can be applied to many uses. This library enabled developers the flexibility they needed to create their own customized applications. However, past versions of SBL were not helpful for the development of 3D graphics-based software.

The Sega Game Library (SGL) is a high-level library which can be used mainly for 3D graphics applications. However, depending on the application, the developers are forced to deal with many of its restrictions.

The objective of SBL6.0 is to integrate the positive aspects of both libraries. SBL6.0 provides developers the flexibility of customizing their applications as with the old SBL, along with taking advantage of the benefits provided by the expanded features ported from SGL.

It is possible to combine the features from SBL and SGL.* By skillfully utilizing SBL and SGL according to the needs of the application, the developer can develop software quickly and efficiently. For example, although basic hardware-level control functions were provided by previous versions of SBL, the user had to bear the overhead of coming up with a efficient polygon rendering engine. In contrast, while SGL has a powerful polygon 3D engine, there are weaknesses in its support for the Saturn's scroll functions due to the its original design implementation.

SBL6.0 provides a development environment with high efficiency and flexibility in order to compensate for the deficiencies found in both SBL and SGL.

* Keep in mind that limitations will inevitably appear when SBL and SGL are combined.
well, I was only interested in loading files actually so that's not a problem


Staff member
do you think SBL functions would be faster than SGL function to display a background picture ? Even if I win only 5% of speed it would be interesting

Previously I used slBMPut, is there something equivalent on SBL ?
right, so IF I could make a COFF file out of my asm code, with the correct declarations, how would I link it to the SGL? What tools would I need for that?
aight, thanks for your assistance but as I really don't know jack about C, libraries, linking and whatever I still have some questions: where do I get LD? Do I need a specific SH2 one or can I just look for a win32 console port of GCC and find it in there? Moreover, how do I pass arguments to the SGL functions?

Thanks in advance!


Extra Hard Mid Boss
ld is part of the GNU binutils, and if you have the Sega toolchain it's included. Otherwise, you can get it from the KPIT toolchain (which is useful to have anyway). As for passing arguments, that's where the ABI comes into play. It's described in one of the Hitachi tool manuals on my site, but IIRC the first four arguments are passed in r4-r7 and the return value is passed in r0. The called function can overwrite r0-r3, the other registers (r8-r15, mach, macl) should be preserved. There's some more rules (regarding structs and some other details), but they should be described in the manual in question.