Thursday, September 29, 2005

LCD Accessed

I figured out how to access the LCD today. I read the disassembly for some code that accessed CS1 (where the LCD is hooked up) and found patterns that matched up with those in the LCD user manual. Basically heres how it works:

GPIO1 Bit #3 (8 / -9 when or'd or and'd) corresponds to A0 on the LCD.
The memory address range set in the initialization (which is set simply through MBAR+$8c -> MBAR+%94 if i remember correctly -- look through the original firmware to find it) is used for the data byte.

So it seems for most commands you set A0 to off, set the data byte to the command name, set A0 to on and then set the data bytes to the data you want used by the command).

Since I am familiar with how it works, I should now be able to write an LCD driver and graphics API - though I only need text output so i can write the kernel. I will play around with it a bit first before I write the API though. I'm not really sure how I will design the API yet, as I may want to include bitmap scaling and other things and also may want to have separate application display contexts. I will try to find out quickly if there is a built in mechanism to the LCD for writing characters, as that would make debugging much easier.

Well, here are the lovely pixels I drew: