Is 3210 the meaning of life or does it have something to do with 8 bit color?
cbmeeks
Posts: 634
LOL, sorry...funny title.
Anyway, I read something about the "%%3210" trick (http://forums.parallax.com/showthread.php/119301-Video-squashed-sprite?p=874874&viewfull=1#post874874) causing the WAITVID to work in reverse?
Would anyone mind explaining to me what that is used for? I also found it in the TMS9928 driver I am studying.
Also, I "sorta" get the %% Base4 system. But, I'm having a hard time translating that in my head. How does that convert from Base4 to Base10?
Thanks.
Anyway, I read something about the "%%3210" trick (http://forums.parallax.com/showthread.php/119301-Video-squashed-sprite?p=874874&viewfull=1#post874874) causing the WAITVID to work in reverse?
Would anyone mind explaining to me what that is used for? I also found it in the TMS9928 driver I am studying.
Also, I "sorta" get the %% Base4 system. But, I'm having a hard time translating that in my head. How does that convert from Base4 to Base10?
Thanks.
Comments
To represent a color on the Prop, instead of having to write binary %11_10_01_00, it's easier to give red, green, blue, and luminosity their own digits. So %11100100 = %3210.
For the pixels field of the video generator, each pair of bits represents one pixel. Using quaternary lets you use one digit per pixel. %%3210 means that pixel 3 should be color 3, pixel 2 should be color 2, pixel 1 should be color 1, and pixel 0 should be color 0. What you said about making waitvid work in reverse makes me suspect that it's actually the opposite of that. This technique is useful because, instead of being stuck with a palette of only 4 colors for each group of 16 pixels, you can use 4 colors for each group of 4 pixels, meaning you can use whatever colors you want.
With base 10, you have 1000's, 100's, 10's, 1's etc. places: 10^3, 10^2, 10^1, 10^0, etc.
With base 4, you have 64's, 16's, 4's, 1's etc. places: 2^3, 2^2, 2^1, 2^0, etc.
%%3210 = 3*64 + 2*16 + 1*4 + 0*1 = 228
It's also easy to convert quaternary to hexadecimal. A hex digit is 4 bits, a quaternary digit is 2. So one hex digit corresponds to 2 quaternary digits.
%%3210 = (3*4 + 2)*16 + (1*4 + 0)*1 = $E * $10 + $4 = $E0 + $04 = $E4
The waitvid in reverse means always doing the same pixels, and just adjusting their colors each time. If there are 4 pixels, and 4 colors, doing the four pixels each assigned one of the colors permits any pixel to be any color.
Normally, waitvid gets told a set of pixels and their colors. A 4 color screen would require only changing the pixels each time.
When it is always the same pixels, the colors to be shown get changed each time.
Colors become pixels, and that is running waitvid in reverse.
This does limit a waitvid to a 4 pixel frame, and that short frame is why full color drivers rarely exceed 320 pixels horizontal resolution.