z80:Grey Scale

From Learn @ Cemetech
Jump to navigationJump to search

Basics

The basics of gray scale on the ti 83+ series comes down to the fact that the ti 83+ doesn't support gray scale. The calculator only has white and black, blank and filled, 0 and 1. But if you could take a snapshot of when the pixel turns from black to white, you would notice that it is gray. Why? Because the ink is leaving. So how do we get it to stay? The truth is we don't, but with asm, you can create two images, and have them flashing constantly so that the pixels are constantly changing. This creates 2 levels of gray. Light gray, and dark gray. So in the end, you are left with four shades: white, light gray, dark gray, and black. This can make your games much more visually appealing but much slower.

Flashing the two screens on and off is not just flashing one normal picture with a blank picture though. What you need to do it flash two pictures that are checkered. So to simplify; if you have two pixels right next to each other, and the two pictures you have are one of the right pixel filled and the left pixel empty, and the other picture is of the left pixel filled while the right pixel is empty. That means that when you flash them, each pixel is constantly switching from white to black and THATS what creates the gray scale. There aren't many games made with gray scale but one example is Grayscale Slippy. Here is a screenshot of it:

Slippy grey.gif

Another common way to use greyscale is to use two buffers: one is the dark buffer, and is displayed 2/3 of the time; the other is the light buffer, and is displayed 1/3 of the time. This is called 4-level greyscale.

The "bits" for each black, grey, or white pixel are shown below.

! Dark Buffer Light Buffer !1 Result
0 0 White
0 1 Light-grey
1 0 Dark-grey
1 1 Black

Like 3-level greyscale, it requires two buffers. They must be alternated quickly. This is often done using interrupts.

Advanced Grey Scale Coding

Conclusion