We're looking for your comments on how to best organize the wiki's content.

LEM1802 Display

From 0x10c Wiki
(Redirected from LEM1802)
Jump to: navigation, search
Built in font

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.

Contents

[edit] Hardware info

Name LEM1802
ID 0x7349f615
Version 0x1802
Manufacturer 0x1c6c8b36 (NYA_ELEKTRISKA)
Colors 4,096 (RGB, 4 bits per channel)
Palette size 16 different colors

[edit] Interrupts

A Name Behavior
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 takes about 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

[edit] Video RAM

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):

   ffffbbbbBccccccc

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.

[edit] Palette

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:

   0000rrrrggggbbbb

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.

Value Palette entry RGB hex Result
Hex Bin
0 0000 0x0000 #000000   
1 0001 0x000a #0000aa   
2 0010 0x00a0 #00aa00   
3 0011 0x00aa #00aaaa   
4 0100 0x0a00 #aa0000   
5 0101 0x0a0a #aa00aa   
6 0110 0x0a50 #aa5500   
7 0111 0x0aaa #aaaaaa   
Value Palette entry RGB hex Result
Hex Bin
8 1000 0x0555 #555555   
9 1001 0x055f #5555ff   
a 1010 0x05f5 #55ff55   
b 1011 0x05ff #55ffff   
c 1100 0x0f55 #ff55555   
d 1101 0x0f5f #ff55ff   
e 1110 0x0ff5 #ffff55   
f 1111 0x0fff #ffffff   

[edit] Font

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: 11111110 10010010
word2: 10000010 00000000

[edit] External Links and References

Personal tools
Namespaces
Variants
Actions
Navigation
Community
Toolbox