Saturn progamming

vbt

Staff member
Hi does someone know how to use the dual CPU ?

I'd like to see some code with a slave cpu init and a slave main.
 
I'd like to see some code with a slave cpu init and a slave main.


I didn't quite got what you mean... Using SGL (that internally uses the M/S CPU architecture), you can register a funcion to run using the slave CPU, but I had no sucess with it. My attempts (ie. a emulator that ran Z80 emulation on the slave CPU) seemed to pont that all ordinary memory locations seen from the slave CPU give 0x00, what's not very helpfull (provably one has to change memory locations so that they fetch from the cache, but i didn't had the patience to try to do so)...

If you're thinking barebones C/ASM code, there's a document explaining how do you set the PC register for the slave somewere...
 
Originally posted by TakaIsSilly@Nov. 11 2002, 5:04 am

My attempts (ie. a emulator that ran Z80 emulation on the slave CPU) seemed to pont that all ordinary memory locations seen from the slave CPU give 0x00, what's not very helpfull (provably one has to change memory locations so that they fetch from the cache, but i didn't had the patience to try to do so)...

The SH2 doesn't have a bus-snooping cache, so any writes from the master will be invisible to the slave (and vice versa) unless told to invalidate the cache or using the cache-through area.

Anyway, for the bare-bones info get the Dual CPU User's Guide. It basically involves setting up the slave CPU's vector table to point at your code and telling the SMPC to wake the slave CPU up.

The SGL and SBL documentation and examples should have info on how to do it with the kits. (IIRC, SGL allows you to register functions that will be executed on the slave during the time the library isn't using it.)
 
Thanks I didn't notice there was a SGL function which can execute a subroutine on slave CPU.
biggrin.gif
 
Another question, I'd like to know if there is a way to display the free memory of the console. I want to load into memory a 512 ko file and I can't load files bigger than 256ko. Maybe I have to change sytem area size or load the file into another memory area.
 
Look for WORKRAM-L on the docs (1Mb of data space). You can't make a malloc() of the data, but you can simply make a pointer to that area. Also, check the file loading routine, in case you're not loading enough file sectors.

As for the free memory, it's hard. AFAIK the Saturn carries no MMU, so there is no way to check for stuff like free heap space. You can figure it out however, there is a graph explaining how mutch data SGL and the code takes, I belive it's on the Appendix of the SGL Tutorial or User's Manual.

(Maybe I should start reading the docs again, I'm starting to get a little vague on the subject)
 
It works again, I declared a pointer using 0x00200000 address and managed to load 512k file on SSF but not on Satourne(seems to be freeze at 409600), also Satourne doesn't manage to run something using slSlaveFunc (Paddle management or screen display), TakaIsSilly did you manage to do something like that on Satourne ? I'm not sure that a prog which runs on a saturn emu will run on a real Saturn.

Thanks

tongue.gif
tongue.gif
 
I'm not sure that a prog which runs on a saturn emu will run on a real Saturn.

This is really important to keep in mind, especially for a console like Saturn. The emulators will likely not correctly emulate things like DMA and access width restrictions in particular...
 
Last time I checked, Saturne couldn't run StarDust. SSF and GiriGiri gave me better results (SSF the best of the lot, GiriGiri has problems with DMA). Then again, that was a year ago... Saturne is mutch more advanced now, i suppose.
 
Well, if that's the original SMS emu, it's not the version I know ^o^;. Nice work, but I wish someone would do a Z80 SH-2 core or use the tile-based system instead of the ordinary RGB mode. We could see some speed increases then
smile.gif
 
I use slBMPut to display screen (and slZoom to have near full screen display), I also tried to use a pointer on VDP ram but display was twice larger and didn't find how to correct this, also I think it was faster.

If you know a faster way to display graphics, I can try to use it.
 
Basicly, Saturn is a machine that support many tile based formats, including a 4-bit format that is quite simmilar to the single BG of the SMS. You can write a "converter" that writes SMS video bytes in the correct postition, and port the bitmap table and emulate register positions directly by hardware. Sprites are more messy, but can also be sprites or in a RGB layer.

I was half way doing something like that when it started to be obvious that the Z80 C cores people were using were just too slow for full speed emulation, no matter what method was used for screen display. A good example is PhoEmu. All the graphics are done in tile based routines, less than 10 lines of C, and yet, it runs at around half the speed of the original.
 
I'm not sure it's such slow, I finished the first level of wonderboy on SSF. I notice that a CD won't run on a real saturn if there is no audio track on. Is there another mandatory thing to do to a prog works. Mine only displays text, the frameskip and the game name but not the game display (NBG1). Also I fill the palette only before putting the picture in memory.

I use that code to init display :

slInitSystem(TV_320x240, NULL, 2);

slScrPosNbg0(toFIXED(0.0), toFIXED(0.0));

slScrPosNbg1(toFIXED(0.0), toFIXED(0.0));

slScrAutoDisp(NBG0ON|NBG1ON);

slColRAMMode(CRM16_1024);

slCharNbg1(COL_TYPE_256,CHAR_SIZE_1x1);

slPlaneNbg1(PL_SIZE_1x1);

slMapNbg1((void*)NBG1_MAP_ADR,(void*) NBG1_MAP_ADR,(void*)NBG1_MAP_ADR,(void*)NBG1_MAP_ADR);

slBMPaletteNbg1(1);

slInitBitMap(bmNBG1, BM_512x256,(void *)NBG1_CEL_ADR);

slZoomNbg1(toFIXED(0.86), toFIXED(0.86));

slPlaneNbg1(PL_SIZE_1x1);

slTVOn();
 
Originally posted by vbt@Dec. 07 2002, 9:45 pm

I notice that a CD won't run on a real saturn if there is no audio track on.

If you're uploading your program with an AR and then try to load data from a CD then this old thread might be useful.
 
Thanks but I don't own an Action Replay, my CD boots but only displays text on NBG0 but not the picture on NBG1.
 
I notice that a CD won't run on a real saturn if there is no audio track on.

I don't think that's what's causing it as I've already gotten games working without any audio tracks at all. I think it was just required to avoid legal issues with potential retards putting their games into their cd player.

Cyber Warrior X
 
Back
Top