Skip to content

LameLCD

A 128x64 pixel, three-color display driver for the LameStation.

lcd : "LameLCD"

About

Call lcd.Start once at the beginning of your program to use LameLCD, giving the drawing surface returned when LameGFX is started as the argument. Due to this, its recommended to start LameLCD and LameGFX at the same time, like so:

lcd.Start(gfx.Start)

The screen will not update on its own. Call lcd.Draw to send the graphics buffer to the screen.

All colors on the screen can be inverted with the lcd.InvertScreen command, which is a nice visual effect.

lcd.Draw can be called at any time to copy the drawing buffer to the display buffer. This is likely to happen when LameLCD is already updating the physical screen, which will cause the screen to flicker.

To prevent flickering, call lcd.WaitForVerticalSync before calling lcd.Draw to ensure LameLCD is not busy when lcd.Draw is called. Enable lcd.SetFrameLimit to have LameLCD do this automatically, at one of three speeds. Frame rate limiting is disabled by default.

Direct Access

LameLCD is usually started with LameGFX. However, it can also be started with a custom buffer if the size and alignment match (2048 bytes, long-aligned).

Functions

lcd.Draw

Send contents of the drawing buffer to the screen.

lcd.Draw

Even after starting the LCD driver, the screen will not update until it is told to do so.

lcd.Draw can be called at any time to copy the drawing buffer to the display buffer. This is likely to happen when LameLCD is already updating the physical screen, which will cause the screen to flicker.

lcd.InvertScreen

Invert black and white pixels on the entire screen.

lcd.InvertScreen(enabled)
  • enabled - True or false turns color inversion on or off.

All colors on the screen can be inverted with the lcd.InvertScreen command, which is a nice visual effect.

lcd.SetFrameLimit

Set an upper limit to the screen refresh rate.

lcd.SetFrameLimit(frequency)
  • frequency - The desired upper limit. This will be rounded down to 70Hz, 35Hz, or 17Hz.

Enable lcd.SetFrameLimit to have LameLCD automatically limit the frame limit to one of three speeds.

Frame rate limiting is disabled by default.

lcd.Start

Initialize the LameLCD library.

lcd.Start(buffer)
  • buffer - The address of the drawing buffer (word).

Returns the address of the LCD buffer.

Call lcd.Start once at the beginning of your program to use LameLCD, giving the drawing surface returned when LameGFX is started as the argument. Due to this, its recommended to start LameLCD and LameGFX at the same time, like so:

lcd.Start(gfx.Start)

The screen will not update until lcd.Draw is called.

lcd.WaitForVerticalSync

Wait until the start of the next LCD frame before continuing.

lcd.WaitForVerticalSync

To prevent flickering, call lcd.WaitForVerticalSync before calling lcd.Draw to ensure LameLCD is not busy when lcd.Draw is called.

Constants

lcd#FULLSPEED

Highest limited speed (~70Hz).

lcd#HALFSPEED

Half the speed (~35Hz).

lcd#QUARTERSPEED

Quarter the speed (~17Hz).

lcd#SCREEN_H

Height of the screen in pixels.

lcd#SCREEN_W

Width of the screen in pixels.