DisplayThe TI-89 monochrome LCD is a memory mapped video, meaning that changing any bit in the RAM associated with video will change a pixel on the screen. Each byte of video memory corresponds to eight LCD pixels. This video memory begins at the address $4c00 and continues to $5aff (3840 bytes). The memory map is configured such that writing %11111111 to $4c00 will turn on (turn black) the first eight horizontal pixels of the screen (top left); similarly, writing %11111111 to $4c01 will turn on the second eight pixels, and so on, until incrementing the video memory address wraps around to represent the pixels of the next row. There are 240 pixels (30 bytes) in each row of video memory, andIn order to make the TI-92+ compatible with the 89, TI decided to use the same memory map on both calculators, despite the differences in screen sizes between the two. For this reason, there are 10 bytes of unused video memory for each row … only the first 20 of the 30 bytes in any row will be mapped to the TI-89 LCD. Also, the last 28 rows of video memory are completely unemployed by the 89. So, this unused RAM can be used to store a program's temporary data. Address ErrorIt's a common mistake when using video memory to write a 16-bit or 32-bit value to an odd memory address, thus triggering an ADDRESS ERROR exception. It is important when accessing video memory to only use odd address pointers when writing a byte, and to use only even address pointers when writing a word or longword.LCD PortThe default RAM address of memory mapped video is $4c00, but this can be changed to any address divisible by eight by writing to the LCD port located at $600010. The value in this port is a word, corresponding to the video memory start address shifted three bits right: $4c00>>3, for example, designates $4c00 as video memory. To use something other than $4c00 however, it would be wise to allocate a memory heap.FindpixelA findpixel routine can be implemented by multiplying the x coordinate by 30, then adding the y coordinate divided by eight to that result. Here is an example (d0.w, d1.w; x, y input respectively):FindPixel: lea #$4c00,a0 ;point a0 to video memory mulu.w #30,d1 ;multiply x coordinate by 30 add.w d1,a0 ;add it to video mem lsr.b #3,d0 ;divide by 8 (8 pixels in a byte) add.w d0,a0 ;add it to video mem and.b #7,d1 ;bottom 3 bits -> bit offset rts This findpixel will return a video memory address in a0, and the offset of the correct bit in d0.b. To turn on the pixel at screen coordinate 18,19 (0,0 is the top left pixel), then we would do this: move.w #18,d0 move.w #19,d1 bsr FindPixel bset.b d0,(a0) A similar method would be used to turn off or to invert a pixel color. To find out how grayscale is accomplished on the 89, read the 89 Central grayscale tutorial.
|