Text, different color, one pal

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
KanedaFr
Administrateur
Posts: 1128
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Text, different color, one pal

Post by KanedaFr » Wed Feb 18, 2015 11:11 pm

Hi,

On my ongoing project, I had to write text on different colors according events.

Each (tile) text use one color, from the last of the 4 pal

My question is does I really need to
1/ load one charmap per color
2/ have one charmap on rom per color

For 1. I assume I have no choice, I had to consume VRAM (1 color = 96 tiles used)

For 2., is it possible to have
0x00000000
0x01111110
0x01000010
0x01000010
0x01111110
0x01000010
0x01000010
0x00000000

on ROM and load it has

0x00000000
0x02222220
0x02000020
0x02000020
0x02222220
0x02000020
0x02000020
0x00000000

I think I could use bitshifting in this case so what about this one ?
0x00000000
0x07777770
0x07000070
0x07000070
0x07777770
0x07000070
0x07000070
0x00000000

?
perhaps the answer is to use color ID I could bitshift only (so 4 colors only), I don't know

I use SGDK but if I had to write a load function on C or raw ASM, I'll do it

tryphon
Very interested
Posts: 303
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Post by tryphon » Thu Feb 19, 2015 10:20 am

1) If your texts are shorter than the complete font, you could consider to load in VRAM only the characters needed.

2) You can consider coding the whole font in ROM witth 1 bit per pixel (black and white) and using it to generate 4 bpp chars in VRAM when needed.

For example, when I implemented Variable Width Font for Psy-O-Blade (and before that for Phantasy Star III), I simply coded my chars with 1 bpp, then computed the 4 bpp simply doing 1 bit shift on the source, writing the corresponding nibble, then 4 bits shifts on it.

It's a little more difficult than what you want to do because 1 char is only part of a pattern, and can overlap on the next.

I coded it in asm and tried it on real hardware, it doesn't seem to slow down the game (it must be said that both games are quite simple and don't involve lots of computation while displaying text).

KanedaFr
Administrateur
Posts: 1128
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Wed Feb 25, 2015 9:11 pm

ooops! :oops:
I forgot to thanks you ;)

Very interesting way to do, I have to test it !

Post Reply