LCD Interface (Atari Lynx II)
The interface from the Lynx to the LCD is fairly straight forward. If you attach a Logic Analyzer to the LCD pins HSYNC, CLK A1/2/3, DL0/1/2/3 and VSYNC you can see the full screen data.
Turning on the console and capturing you can see a few full frames of data here (shown by VSYNC below with 3 pulses for 3 full frames).
If we zoom in to a single full frame (one complete image on screen) we can see there are just over 100 HSYNC pulses (for the 102 lines of a Lynx screen image).
To find the first line (the first HSYNC pulse) listen out for the low side of the VSYNC pulse, and then skip the next high pulse, and the high pulse after is line 1.
Notice there is a HSYNC pulse that rises just before VSYNC falls, and falls right after VSYNC does. If you are counting high pulses from HSYNC this isn't a problem, but if you are counting low pulses you will catch this pulse and possibly miss the last line due to counting one early.
Once we have established finding line 1, all you do now is read the next 102 lines (HSYNC pulses high) to get the 102 lines of information.
The frame rates are variable. Most of the time they run at 60Hz, but some parts of some games run at 75Hz and others run at 50Hz and some run at 52.66Hz. You can see this behaviour if you download the logic captures.
Here is Batman Returns Text screen (where it isn't the bat logo, just all text,, before that title page). Its running at 60Hz.
And here is the Batman Returns Title screen (with the bat logo in background) running at 75Hz.
Zoomed in to a full HSYNC pulse shows a single line.
We know the Lynx has a resolution of 160 x 102 pixels, in 12bit color RGB (so 4 bits of Red, 4 of green, 4 of blue). So red can be from 0 to 15 (or 16 different tones of red). The same applies to the other colors.
NOTE: The VLSI Mikey variant only has 12 bit color (3 bit per channel). DL0 is always ground.
The color information is stored in the DL0, DL1, DL2 and DL3 pins. The least significant bit is DL0 and the most significant bit is DL3.
Representing a full color of red (decimal 15) would be 1111, representing mid-red (12) would be 1100 where DL3 and 2 are high (1) and DL1 and 0 are low (0).
The important part is when to read the DL color information for each pixel. The data outputs left to right, starting at the top left of the screen and outputting pixel 1 at the top left first, then moves along to the right for 160 pixels, which completes a full line.
The next HSYNC pulse starts the next line down and the cycle repeats.
Pixels are clocked out in 3 parts. Red, then Green, then Blue. Once we have RGB data (12 bits) that forms one pixel, and the next clock is for the next pixels red, then green then blue and the cycle continues.
Knowing this, we need 160 pixels times 3 colors (RGB) which is 480 clocks. The clocks A1, A2 and A3 all form a single continuous clock each of 80 pulses, totalling 240 pulses.
Pixel data is clocked out on both the rising and falling edge of the clocks, so that 240 pulses turns to 480 clock outs. Each clock is a red, then green, then blue and then repeating until all 160 pixels are clocked out.
The first pixel starts on the first rising edge of clock A1.
At this time we read out the data on the DL pins to get the first pixel color information for Red.
Next the Green color for the first pixel is read on the next edge of the clock (so the falling edge in this case).
Then the Blue data is clocked out on the rising edge.
This forms the first pixel of RGB which is black.
This is the screen we are currently looking at from Batman Returns.
And the first line top left pixels here.
If we put the knowledge to use we can see the first 12 pixels are black, and the 13th pixel is the light shade of blue.
If we highlight the clocks where the Red Green and Blue pixels are polled, and the pixel position, overlaid with binary data, and the actual pixel it represents it makes it nice and clear.
Using Logic 2 you can view the Batman Returns Title screen, or a few other captures for yourself.