SEGA Saturn 3d Racing Game Project Atlas Atlas Creator Atlas Game Packs Benchmark RAM Emulators Mine Sweeper Patching: Enemy Zero Patching: PlanetWeb RB library Rockin'-VR Saturn Game Tutorial Save Game eXchange Save Game Manager Saturn High Level Interpreter Saturn Tools SCU indirect DMA SGL replacement Sound Player Terrain Renderer Texture Coordinates The Rockin'-B All Stars Tic Tac Toe WinterSports Eins Game Park 32 Mac OS X SEGA VMU Windows
a homebrew Saturn library in the making
This project attempts to recreate parts of the SGL library. The main focus is not to make it an exact 1:1 reimplementation nor is it going to cover all parts of the SGL.
It is created in the intention to allow certain Saturn homebrew applications to work just as if they were using the original SGL. The more Saturn homebrew is requested to work with the SGL replacement, the better it's compatibility will get.
I'm trying to use (or start from) existing homebrew Saturn libs (from Charles MacDonald maybe Bart Tryznadlowski and Mic) or to implement it myself (actually most stuff is self written), although I'm far from being an expert in this category. This project is in a very early stage and everyone willing to help coding or debugging is welcome (and will get the source).
You know the SGL links a lot of object code even though you've only used a few functions of it. Furthermore it requires a lot of variable storage and it wastes CPU time while waiting for the v-blank. The usage of the slave CPU is simple, but underlies some restrictions. Also the SGL has been compiled with rather old compilers. And not to forget: it's always better if a Saturn homebrew game is 100 percent hombrew.
While in an overall view, this SGL replacement may never be better than the original, for special cases it can give an advantage, as one gets more control over master CPU, slave CPU and RAM usage.
Current focus is on support of all easy to implement VDP2 scroll functions. But it also already allows limited control pad and sprite handling.
fast debug printing (slPrint...) with very small font
supports bitmap library (completely)
supports slave cpu
lots of compile flags for customization
buffered VDP2 registers, allows reading of write only regs, allows writing to VDP2 immediately or later
comes with working SGL demos (from others and special test demos)
functions already implemented are:
sl16MapRA, sl16MapRB, sl1MapRA, sl1MapRB, slBack1ColSet, slBackColTable, slBitMapBase, slBitMapNbg0, slBitMapNbg1, slBitMapRbg0, slBMBox, slBMBoxFill, slBMCircle, slBMGet, slBMLine, slBMPalette (slBMPaletteNbg0, slBMPaletteNbg1, slBMPaletteRbg0), slBMPoint, slBMPset, slBMPut, slBMSprPut, slCharNbg0, slCharNbg1, slCharNbg2, slCharNbg3, slCharRbg0, slClearBitMap, slColOffsetA, slColOffsetAUse, slColOffsetB, slColOffsetBUse, slColOffsetOn, slColOffsetOff, slColorCalc, slColorCalcOn, slColRAMMode, slDispHex, slDispSprite, slDMACopy, slExtSignal, slGetHCount, slGetVCount, slInitBitMap (slInitBitMapNbg0, slInitBitMapNbg1, slInitBitMapRbg0), slInitSystem, slLineColDisp, slLine1ColSet, slLineColTable, slLocate, slLocateBitMap, slLocateNbg (slLocateNbg0, slLocateNbg1, slLocateNbg2, slLocateNbg3), slLocatePage, slMapNbg0, slMapNbg1, slMapNbg2, slMapNbg3, slPageNbg0, slPageNbg1, slPageNbg2, slPageNbg3, slPageRbg0, slPlaneNbg0, slPlaneNbg1, slPlaneNbg2, slPlaneNbg3, slPlaneRA, slPlaneRB, slPrint, slPrintFX, slPrintHex, slPrintMatrix, slPriority (slPriorityNbg0, slPriorityNbg1, slPriorityNbg2, slPriorityNbg3, slPriorityRbg0, slPrioritySpr0, slPrioritySpr1, slPrioritySpr2, slPrioritySpr3, slPrioritySpr4, slPrioritySpr5, slPrioritySpr6, slPrioritySpr7), slRequestCommand, slScrAutoDisp, slScrCycleSet, slScrDisp, slScrLineWindow0, slScrLineWindow1, slScrPosNbg0, slScrPosNbg1, slScrPosNbg2, slScrPosNbg3, slScrTransparent, slScrWindow0, slScrWindow1, slScrWindowMode, slSetScrTVMode, slSetTVMode, slSlaveFunc, slSpriteCCalcCond, slSpriteCCalcNum, slSpriteColMode, slSpriteType, slSynch, slTVOff, slTVOn, slVRAMMode, slZoomMode (slZoomModeNbg0, slZoomModeNbg1), slZoomNbg0, slZoomNbg1
improve font for better readability
improve slScrAutoDisp even more(hires, bank spanning, zoom)
implement fixed math, matrix stack
get interrupts running
increase VDP1 sprite support
faster controler access (SH2 direct currently)
fixed slPrint on real hardware
improve slScrAutoDisp (most difficult function of all) to be good enough to use it on real hardware
move debug text (slPrint, ...) implementation from Charles MacDonald's one (bitmap, no hardware acceleration, slow) to a more exact and faster one
Only tested games are listed, it's not complete.
GameBoy emu, SNES emu (Rockin'-B), 12 player pong, 12 player snake(slinga), bm15bpp (CyberWarriorX), satdemo, bitmdemo, chaos89 (Charles Doty), morpion (Reinhart)
working, but incomplete
Compatibility mode to comply with the SGL declarations that shipped with SBL
first attempt, outdated, slow, low compatibility
top choice, fast, compatible
compressed font and 2 element palette
set RGB flag for custom font palette, except first entry
draw circle even if some pixels are outside the scroll, more like SGL
no vsynch, fast option for CPU demanding emus
Disables the use of VDP1 sprite gpu, makes slSynch() faster and makes all VDP1 RAM available for you!
Set the number of request being held in a master-to-slave command buffer.
What to do if master->slave command buffer is full, specify only one of these flags, else priority selects a single flag. Default(no flag defined) is wait.
Just returns immediately without processing the function with slave or master. This can be applicable if the computation is not crucial to the program flow and if you give speed priority over the computation of this function. Example: liny-by-line rendering in emulators
Instead of waiting for a free entry in the command buffer (the slave has to finish it's current task), don't waste time and do it on the master. !! BEWARE global variables, executing the same function on both CPUs causes problems, if it uses global variables
This seems to be the SGL behaviour I experienced with GNUBoy
When changing from idle to busy, let slave do a cache-purge to have it's content up-to-date. Disabled because redundant when SLAVE_CACHE_PURGE_ON_BUSY is set.
In the slave busy state, let slave do a cache-purge everytime a new task is started to have it's content up-to-date.
To monitor master and slave behaviour, their state is recorded:
SlvDbgDump masterDump[SLAVE_DUMP_LENGTH], slaveDump[SLAVE_DUMP_LENGTH];
Uint32 masterDumpCount, slaveDumpCount;
Collects some statistic in variables: Uint32 slvDbg_nSlv, slvDbg_nSlvIdle, slvDbg_nMas;
Is used by