We're looking for your comments on how to best organize the wiki's content.
(→Font: rewording, grammar)
|Line 133:||Line 133:|
Revision as of 23:13, 11 June 2012
The LEM1802 (LEM stands for "Low Energy Monitor") is a 128x96 pixel color display compatible with the DCPU-16. It was developed and manufactured by Nya Elektriska, and is fully backwards compatible with the LEM1801. The display is made up of 32x12 16 bit cells. Each cell displays one monochrome 4x8 pixel character out of 128 available. Each cell has its own foreground and background color out of a palette of 16 colors. The official specification can be read here: http://dcpu.com/highnerd/rc_1/lem1802.txt
|Colors||4,096 (RGB, 4 bits per channel)|
|Palette size||16 different colors|
|0||MEM_MAP_SCREEN|| Reads the B register, and maps the video RAM to DCPU-16 RAM starting at address B. See below for a description of video RAM. If B is 0, the screen is disconnected.
When the screen goes from 0 to any other value, the the LEM1802 takesabout one second to start up. Other interrupts sent during this time are still processed.
|1||MEM_MAP_FONT|| Reads the B register, and maps the font RAM to DCPU-16 RAM starting at address B. See below for a description of font RAM.
If B is 0, the default font is used instead.
|2||MEM_MAP_PALETTE|| Reads the B register, and maps the color palette RAM to DCPU-16 RAM starting at address B. See below for a description of color palette RAM.
If B is 0, the default color palette is used instead.
|3||SET_BORDER_COLOR||Reads the B register, and sets the border color to palette index B&0xF|
|4||MEM_DUMP_FONT|| Reads the B register, and writes the default font data to DCPU-16 RAM starting at address B.
Halts the DCPU-16 for 256 cycles
|5||MEM_DUMP_PALETTE|| Reads the B register, and writes the default color palette data to DCPU-16 RAM starting at address B.
Halts the DCPU-16 for 16 cycles
The LEM1802 has no internal video RAM, but rather relies on being assigned an area of the DCPU-16 RAM. The size of this area is 386 words, and is made up of 32x12 cells of the following bit format (in LSB-0):
The lowest 7 bits (ccccccc) select define the character to display. ffff and bbbb select which foreground and background color to use. If B (bit 7) is set, the character color will blink slowly.
The display can store 16 different colors in its palette. It has a built in palette but it is also customizable. A 16 word region can be mapped to the display with one word per palette entry. Each palette entry has the following bit format:
where r is red, g is green and b is blue. Higher values mean lighter colors. So for example 0000-1111-1111-1111 would be white.
The LEM1802 also features a built in font, shown above. The font contains 128 characters, all of which can be customized.
As every character bitmap contains two words, mapping all characters requires a 256-word space. In each character bitmap, bits can be set to indicate the foreground color, or cleared to indicate the background. The bits are counted from the bottom-left to the top. For example, a capital E would look like this on the screen:
0000 1110 1000 1000 1100 1000 1000 1110
Note the room left on the top and side for spacing between the characters. In bitmap data for this would be:
word1: 111110 101010 word2: 100010 000000