Listing 1—These lines
of code demonstrate the way I combined the three video RAM areas into one. The
three areas are used for graphics that don’t change, graphics that do change,
and text. By ORing these three video areas, I don’t have to update unchanging
graphics and I can overlay text with graphics.
spi_xfer_command(disp_page_address); //Select 0 of 8 pages (X)
spi_xfer_command(disp_column_msn); //Select First Column of screen (Y) spi_xfer_command(disp_column_lsn);
for (i=0; i<lcd_rows;) //1 of lcd_rows
{
for(p=0; p<lcd_columns; p++) //1 of lcd_columns
{
c = video_ram0[(i*lcd_columns) +p] |video_ram1[(i*lcd_columns) +p] | video_ram2[(i*lcd_columns +p];
spi_xfer_data(c); //Write ORed byte to screen
}
i++;
LCD_Cursor(i, 0); //Move cursor to next Row
}