slPrint() Question

slinga

Established Member
Hey guys,

Is there a way to print colored ASCII characters on the saturn? Like a function similar to slPrint(), but that will take a parameter for color? Thanks in advance.
 
If you plot using tiled backgrounds, you could use multiple tile definitions (one for each color) or you could use one set of tiles with multiple palettes. Bitmapped solutions are obvious (you can mix bitmaps and tiles by plotting into a tile buffer, good for variable-width fonts etc). If you use sprites you can use indexed sprites with many palettes, multiple sets of RGB sprites or VDP2-indexed sprites with many palettes. VDP2-indexed palettes with Gouraud-shading would be a pretty sneaky trick (use the same value for each vertex and you can control the palette index) but only really usable for single-colored tiles.

Those are the ones that come to mind immediately, I'm sure there are more ways.
 
from SGL302J\DOC\210A_US\packs.txt

Code:
***************************

void slCurColor((Uint16)Palette)

***************************

************************** Changes

Function:

Specifies the palette number for the text displayed by "slPrint???()" and

"slDisp???()".

Specify a number from 1 to 15 for the palette.

****************** End of Changes

But I've never been successful in its use.
 
You guys rule :cheers

I'm going to update my pong game to have different color paddles for each player. Since all I'm doing are slPrint()'s, this should be pretty easy.
 
antime :

I'm not sure I understand what you mean by "tile" ? Is it a bitmap defining the chars ?

by the way, do you know where the default font (used for slprint) is stored ?

piratero :

I'd like to read your code: it could be interesting. You could make it public, too.

V
 
Yes, a tile is the 8*8 pixel basic building block of backgrounds in non-bitmap modes. On the C64 they were called "characters". I don't know where the charset used in SGL is stored, but you could try loading both the BIOS ROM and SGL library into some graphics-ripping tool.
 
Thanks.

Yes, a tile is the 8*8 pixel basic building block of backgrounds in non-bitmap modes


But... Isn't this 8x8 pixel block a bitmap ? So what do you call a non-bitmap mode ? Has it something to do with the block size and the screen size ?
 
In tiled modes you use tilemaps to get one (or more, in the case of the Saturn) level of indirections. The tiles are quite correctly bitmapped images, but the screen is constructed by going through the tilemap which directs which tile is displayed at what location. In bitmapped modes the whole screen is represented as one big bitmap which is directly transferred to the video output.

EDIT: In case I didn't make myself clear, in tiled modes you generally manipulate the tilemaps while in bitmapped modes you draw individual pixels.
 
you copy the tiles in DMA, the map is where you would place a tile... why not just create a font and use that? :) i'll release my source code too *soon*
 
Perfectly clear now, thanks. That was something I didn't knew.

For info, i think the tilemap is called "pattern data" and character "character data".

(chap 8-7 in sgl tut.).
 
*bump*

Can anybody get slCurColor to work? I tried with a number of values between 1-15, but I always get white text. One of the samples has it, but I can't compile it for some reason (something with my makefile, I'll check it again when I get back to school).
 
Looking through the akira3 sample you may have to load a palette to the start of VDP2 color-RAM.
 
Yeah I saw that too, why can't Sega make anything simple for us :D

I could compile that sample, but I couldn't get it to run on Satourne. Could you get it to work?
 
The sample works, it has the same Akira model walking in a circle as the other sample, but it has a fake "environment mapping" surface applied.
 
Hey guys,

I almost got it. From what I understand you need to define this before your main:

Code:
static	Uint16	palette[32] = {

	0x0000, // background color slCurColor(1);

	0x1111, // text color slCurcolor(1);

	0x0000,

	0x2222,

	0x0000,

	0x3333,

	0x0000,

	0x4444,

	0x0000,

	0x5555,

	0x0000,

	0x6666,

	0x0000,

	0x7777,

	0x0000,

	0x8888,

	0x0000,

	0x9999,

	0x0000,

	0xAAAA,

	0x0000,

	0xBBBB,

	0x0000,

	0xCCCC,

	0x0000,

	0xDDDD,

	0x0000,

	0xEEEE,

	0x0000, // background color slCurColor(15);

	0xFFFF, // background color slCurColor(15);

	0x0000, // Not sure yet??

	0x0000, // Not sure yet??

};

Then in your main do this:

Code:
	slDMACopy( (void*)palette, (void*)0x25f00000, sizeof(palette) );

	slCurColor(5);

Where slCurColor(some number) selects which color combination you want to use. Unfortunately, slPrint displays only the first color combination, no matter what number you use for slCurColor. In the above configuration I was always getting orange text with a black background no matter what number I used for slCurColor and even if I ommited slCurColor completely. I'll keep working on this, just thought I'd update anybody else who was interested.
 
Nope I'm stuck again. It seems that even in the demos (chrome and akira3), changing slCurColor to a different value does nothing. Doh!
 
Searching in dev central threads, I found a one year old Piratero code calling slCurColor this way :

Code:
slCurColor(C_RGB(25,0,0));

No palette. Still don't know if that works.
 
:damn: ok, what you can do is change 1 from the palette and change it to whatever color you want, god forbid me do this but:

Code:
#include <sgl.h> // get the vram/palette defines.

int replace1color(Uin16 *color){

Uint32 *palette1=COL_RAM;

 palette+location_of_color_white=color;

 // i'm guessing 1 color is 2 bits? 

return(0);

}

Wild guess, horrible code, but i hope it at least gives you an idea....
 
Do you meaning changing the first entry in the palette? That changes all text on the screen at the next slSynch, so it's pretty worthless to me. I'm trying to display multiple colors at once.
 
Back
Top