Karoshi MSX Community

Desarrollo MSX => Development (English/Ingles) => Mensaje iniciado por: ARTRAG en 24 de Diciembre de 2006, 10:39:14 am

Título: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: ARTRAG en 24 de Diciembre de 2006, 10:39:14 am
No miracles, the idea is the same of dvik's BMP2105, but on MSX2.

do this:

Store in VRAM two alternate tilesets and swap them at each frame setting R3, R4 and R10 (no CPU load)

The blending of the two tilesets leads to

1) 4 colors on each line of 8 pixels
2) the mix of 16 colors leads to 120 unique mixed colors
3) the mix of 512 potential colors leads to 130.816 unique mixed colors

The main advantage is that the tiles swapping costs no CPU time,
so the trick can be used during the game and not only in the title screen.

Moreover this override the scr4 limit on the number of colors per line!

Someone willing to develop a tool ?  ;)

Does anyone less lazy than me know the settings for R3,R4,R10 to point to all the valid tile banks in VRAM ?

AFAIK in scr4 the PGT is ruled by R4 that means
 0 |0 |A16|A15|A14|A13| 1| 1

that implies the following addresses :

00000h
02000h
04000h
06000h
08000h
0A000h
...
while the PCT is ruled by R3 and R10 where
R3   = A13| 1| 1| 1| 1| 1| 1 | 1|
R10 = 0|...| 0|A16|A15|A14|

that implies the following addresses :

00000h
02000h
04000h
06000h
08000h
0A000h
...

The idea could be implemnted in the interrupt routine :

at ints odd set:
R4 = 3;
R3 = 255;
R10 = 0;
i.e.
PGT =0;
PCT = 2000h;

at ints even set:
R4 = 11;
R3 = 255;
R10 =1;
i.e.
PGT = 4000;
PCT = 6000h;

Easy, anyone willng to test this?
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: MsxKun en 24 de Diciembre de 2006, 11:44:11 am
Store in VRAM two alternate tilesets and swap them at each frame setting R3, R4 and R10 (no CPU load)

Yes, it's interesting. I wanted to test it a time ago, but never did  :P I wonder how can it look on screen. Maybe someday.
Merry Xmas!
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no
Publicado por: jltursan en 24 de Diciembre de 2006, 12:21:22 pm
...but I'm afraid it will flicker too much for a game... :(
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no
Publicado por: ARTRAG en 24 de Diciembre de 2006, 06:16:10 pm
a small rom of example

http://ragozini.googlepages.com/test.rom

Here you have only the 15 MSX1  colors + 15 halftones (that anyway gives 30 colors and 3 colors per line).

In a real application this trick should go on interrupts
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no
Publicado por: GuyveR800 en 18 de Diciembre de 2009, 01:58:27 pm
...but I'm afraid it will flicker too much for a game... :(
See Menace for an example game that does a similar thing on MSX1. Obviously on MSX1 you can't take advantage of the VDP doing this for you.

In my opinion it flickers a lot :P
But too much? I don't know...

The flickering in Menace could be reduced by using smarter patterns with a dither raster, in stead of alternate lines... but I would probably prefer non-flickering graphics either way.
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: ARTRAG en 19 de Diciembre de 2009, 09:44:43 am
Maybe having an PC tool for tileset design (4 color per line etc etc) able to extract the vram data would boost msx2 applications using the trick.
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: GuyveR800 en 20 de Diciembre de 2009, 11:39:36 pm
You can use PaintShop Pro or Photoshop.
Just have 2 layers at 50% brightness and maintain the normal 2 colors per 8 pixels PER LAYER.
You can then use normal convertors for each layer and you're done.
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: Jon_Cortazar en 21 de Diciembre de 2009, 09:19:03 am
Clever trick, G  ;)
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: ARTRAG en 21 de Diciembre de 2009, 02:22:26 pm
good one! I'll try and I'll let you know how it goes!
On msx 2 you can also swap on two palettes ...
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: mohai en 23 de Diciembre de 2009, 03:08:20 pm
Just one idea:

For one frame, define a palette with some base colours (such as digital ones)  and for the other frame just grey tones, so you can control luma and chroma.
I think this way it is easyer to calculate color and make conversion.

Could it be a way to avoid flickering?
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: ARTRAG en 23 de Diciembre de 2009, 11:13:54 pm
For sure some combinations of colors will give less flickering than others, not sure anyway that your proposal is the best.
For sure the limit is when the picture or the object is moving.
In that case you have a blur effect on the borders of the picture.
Título: Re: scr 4 with 4 colors in 8 pixels, 120 colors on the screen among 130.816, no CPU
Publicado por: GuyveR800 en 05 de Enero de 2010, 12:45:29 pm
Only when you move at a higher rate than half your flicker rate. So, flicker at 60Hz, move stuff at 30Hz.

The amount of perceived flicker between colors depends on their brightness ratio. It's easy to see on a MSX2 that COLOR15,1,1 interlaced gives a very flickery image, while COLOR15,12,12 is very calm.