_________.________________. __.___ ____________________ \______ \ \__ ___/ \ / \ |/ _____/\_ _____/ | | _/ | | | \ \/\/ / |\_____ \ | __)_ | | \ | | | \ /| |/ \ | \ |______ /___| |____| \__/\ / |___/_______ //_______ / \/ \/ \/ \/ (c) BITWISE SCIENCES 1984 - 2108 BITWISE COMMON VIDEO PROTOCOL Presented here is a Video Protocol designed to be backwards compatible with the ever popular NE LEM1802. LEM functions should not collide with this specification, and a compatible device could identify itself as a LEM1802 device. The device will report additional capabilities using interrupt 0x0004. Compatible devices should conform to the [INSERT REFERENCE TO HARDWARE ID SPEC], using API class "Display Device" and sub class "CVP Compatible". This interface supports any device of a resolution up to 1024*1024 pixels at up to 32 bits per pixel in multiple modes. In pixel mode, each pixel on the screen can be set individually. In cell mode, the device operates under the same principles as a LEM1802 device and can use the same font glyph system. However, a device may support far higher resolutions and number of possible glyphs. A display mode descriptor describes a supported display mode and is used both to detect supported modes and to set the desired mode. A descriptor is 3 words long. The first two words of a descriptor encode the width, height, type, and element size of the display mode. .- 10 bits - Width of the screen in pixels or cells. | .- 10 bits - Height of the screen in pixels or cells. | | .- 3 bits - Display Mode Type | | | .- 5 bits - Size of elements in bits | | | | .- 3 bits - If cell-glyph mode, | | | | | indicates glyph bpp. [00000000 00][000000 00000][000] [00000][000] Display Mode Types: 0x0000: Two-color cell-glyph mode (LEM mode) 0x0001: Cell-glyph mode. In this mode, each element in display memory is an index into a table of glyphs. 0x0002: Palette-index mode. In this mode, each element is an index into a table of colors. Usually the index uses a relatively small number of bits (4 for 16 total colors, for example) and the color table uses a large number (as high as 24). 0x0003: Direct pixel mode. Each element is a color directly encoded. 0x0004: Reserved for future expansion. The interprettation of the second set of words depends on the display mode type specified in the first. For Two-Color cell-glyph mode (LEM mode): Two-Color Cell-glyph mode is included for compatibility with software designed for the ever popular LEM1802 display. The LEM uses a restricted two color glyph system, where the color can be changed per glyph. In this mode, the bit depth and dimensions of the glyph are set to those of the LEM1802 specification. However, the color depth of the palette can be changed. .- 3 bits - Number of bits for blue component | .- 3 bits - Number of bits for green component | | .- 3 bits - Number of bits for red component | | | .- Unused. | | | | | | | | [000][000][00 0][0000000] The palette is restricted to 16 colors, and screen elements are encoded as on the LEM1802. For Cell-Glyph Mode: In Cell-glyph mode, the final 3 bits of the first portion of the descriptor contains the bits per pixel of each glyph. .- 3 bits - Number of bits for blue component | .- 3 bits - Number of bits for green component | | .- 3 bits - Number of bits for red component | | | .- Width in pixels of glyphs | | | | .- Height in pixels of glyphs | | | | | [000][000][00 0][000][0000] * Glyphs behave like the frame buffer in palette-index mode. * Color bits describe the values in the palette. * The bits per pixel of glyph determines the size of the palette. * The bits per element determines the number of glyphs needed. For Palette-index mode: .- 3 bits - Number of bits for blue component | .- 3 bits - Number of bits for green component | | .- 3 bits - Number of bits for red component | | | .- Unused. | | | | | | | | [000][000][00 0][0000000] * Color bit describes the values in the palette. * The total of the color bits will describe the overall color depth, eg 16 or 24 bit color. * The element size specified in the first portion of the descriptor determines the number of elements in the palette. eg, if the element size is 8, the palette must contain 256 colors. For Direct pixel mode: .- 3 bits - Number of bits for blue component | .- 3 bits - Number of bits for green component | | .- 3 bits - Number of bits for red component | | | .- Unused | | | | | | | | [000][000][00 0][0000000] * Number of bits per color should total to the size of elements specified in the first portion of the descriptor. * Palette entries are left-padded to whole words. * Compatible displays may support non-aligned screen elements, though performance may be degraded in these cases. * Display memory is packed. For example, if using palette-index mode with a 256 color palette, 4 pixels will be packed into one word. A perfectly LEM compatible descriptor would be as follows. [00001000 00][000000 01100][000] [10000][000] [100][100][10 0][0000000] Or, in hex, 0x0800 0x6100 0x9200 0x0000: Memory Map Screen Map screen memory begining at the address in B. If B is zero, screen is disabled. 0x0001: Memory Map Glyphs Map glyph memory begining at the address in B. If B is 0, use built in glyphs. 0x0002: Memory Map Palette Map palette memory begining at the address in B. If B is 0, use built in palette. 0x0003: Reserved for LEM compatibility. 0x0004: Report Capabilities B should contain the address in DCPU memory to begin writing display mode descriptors. C should contain the maximum number of descriptors to write. If the program does not provide enough memory to record all modes the display is capable of, some modes may not be detected. Up to 3 * C words will be written to memory begining at B. 0x0005: Set display mode CXY should contain the complete display mode descriptor to be set. B will be set to an error code. Note that 0x0000 is never used. 0x0001: Mode set. 0x0002: Mode not supported. 0x0006 through 0x001F: Reserved for future expansion.