'============================================================================== ' DVI/VGA/TV VIDEO DRIVER COG DOCUMENTATION (Release 0.9b) '============================================================================== ' This single cog driver outputs graphics and text based video content over P2 ' pins. It can send either digital video on 8 pins (as DVI), or analog video ' signals (including TV and VGA) out P2 DACs with configurable VSYNC options. ' ' The driver supports custom video resolutions and timing, graphics bitmap and ' text modes, multiple display regions on screen, a graphics mouse/sprite, all ' P2 colour modes, pixel and line doubling, cursors, palettes, variable height ' fonts, scrolling / wrapping options, 16 foreground and background colour text ' configurable per character, a flashing text option, and support for graphics ' buffers to be read from external memory using an external memory interface. ' It also supports top/bottom/side borders with a programmable border colour ' and dynamic (per field) colour space adjustment in analog output modes. ' Interlaced output/page flipping is also supported in graphics & text modes. ' ' The driver is initialized with a display parameter structure containing ' startup data and it updates this with the display status once operational. ' It continues to read portions of this block identifying which region list to ' display, the optional screen borders and colour, a global mouse position, ' and colour space parameters during the vertical blanking period, before ' the next field or frame begins. ' ' The driver's parameter structure consists of the following 32 bit entries and ' the address of this structure in hub RAM is provided in PTRA during COGINIT. ' ' DISPLAY PARAMETER STRUCTURE: ' ' Offset Register Name ' ------ ------------- ' +$00 STATUS ' +$04 INITIALIZATION ' +$08 RESERVED_1 ' +$0C EXT_MEMORY_MAILBOX ' +$10 LINE_BUFFER_1 ' +$14 LINE_BUFFER_2 ' +$18 RESERVED_2 ' +$1C GLOBAL_MOUSE ' +$20 BORDER_SIZE ' +$24 BORDER_COLOUR ' +$28 FIRST_REGION ' +$2C Y_PARAMETER ' +$30 I_PARAMETER ' +$34 Q_PARAMETER ' ' Each displayed region is a separate structure in hub memory that can be ' linked together into a list of display regions to be rendered per frame, ' and is defined by the following group of 32 bit longs in this sequence: ' ' REGION STRUCTURE: ' ' Offset Register Name ' ------ ------------- ' +$00 NEXT_REGION ' +$04 REGION_CONFIG ' +$08 SCREEN_BUFFER_1 ' +$0C SCREEN_BUFFER_2 ' +$10 FONT_BUFFER ' +$14 PALETTE_BUFFER ' +$18 TEXT_CURSOR_1 / SCREEN_BUFFER_3 ' +$1C TEXT_CURSOR_2 / SCREEN_BUFFER_4 ' +$20 REGION_MOUSE ' +$24 MOUSE_SPRITE ' +$28 SOURCE_WRAP ' +$2C SOURCE_SKEW ' ' Descriptions of each of these entries follow. '.............................................................................. ' ' STATUS - status of driver written back to HUB RAM ' ====== ' ' Once running, this 32 bit long in hub memory is updated by the driver to ' advertise the current frame/sync status to other COGs. The data the driver ' writes back into its hub address is shown below and is updated once per ' scanline in most cases: ' ' bit bit ' 31 30 29 28:24 23 16 15 0 ' ----------------------------------------------------------- ' | V | F | B |00000| Field Count |Active Scanlines Displayed | ' ----------------------------------------------------------- ' ' Frame/field status updated by DVI cog (final release format is still TBD) ' ' Bit 31 (V) - if set indicates driver is generating vertical sync lines. ' Bit 30 (F) - if set indicates driver is generating a vertical front porch. ' Bit 29 (B) - if set indicates driver is generating a vertical back porch. ' ' Bits 28:24 - Currently zero (could become COGID?) ' ' Bits 23:16 - An 8 bit counter that increments at the field frequency rate ' at vertical synchronization time. ' ' Bits 15:0 - Number of active scanlines already displayed in this field or ' or frame. It resets during the vertical blanking interval. ' '.............................................................................. ' ' INITIALIZATION - initializes the video driver ' ============== ' ' On COG startup the initialization long is used for setup purposes. ' ' bit bit ' 31 30 29 24 23 20 19 0 ' ----------------------------------------------------------- ' | D | V |SyncOutputs|PinGroup| Custom Video Timing Address | ' ----------------------------------------------------------- ' ' Display Mode (D) ' ---------------- ' Selects Analog or Digital display output mode. ' ' If D=0 the display driver outputs analog video over its DACS (e.g. VGA) ' If D=1 the display driver outputs digital video (DVI) on 8 P2 pins. ' ' Video Output Type (V) ' --------------------- ' In analog display mode: ' 0 = RGB/RGBS/RGBHV output ' 1 = HD/SD TV, Composite and/or Y+C (S-video), or component output ' ' In digital display mode: ' Set as zero. Reserved for possible future HDMI/TTL options. ' ' SyncOutputs ' ----------- ' In Analog mode this controls how the sync signal will be generated and ' in which manner the video signals will be sent over the DACs outputs. ' ' Use of this field when outputting RGB: ' -------------------------------------- ' If a separate VSYNC signal is desired, then this field indicates which ' P2 pin will output the VSYNC signal, the video output will be RGBHV. ' ' If RGBHV is not required then this field's value can be used to select ' other sync options. To do this map this VSYNC output to one of the DAC ' channel pins already assigned to the group setup in the PinGroup field. ' ' VSYNC mapped to DAC0 - send RGBS, S = VSYNC XOR HSYNC on DAC0 (75 ohms) ' VSYNC mapped to DAC1 - send RGB/Component with sync on DAC1 pin ' VSYNC mapped to DAC2 - send RGB/Component with sync on DAC2 pin (SoG) ' VSYNC mapped to DAC3 - send RGB/Component with sync on DAC3 pin ' (Mapping is subject to change if monochrome output modes is added.) ' ' Use of this field when outputting HDTV/SDTV: ' -------------------------------------------- ' bit5 = selects HDTV tri-level (1) or standard SDTV sync (0) pulses ' bit4 = selects Interlaced (1) or Progressive(0) video frame output ' bit3 = selects SDTV colour system, reserved for HDTV (set to 0) ' 0 = NTSC colour burst generated 1 = PAL colour burst generated (alternating per line) ' bit2:0 = video output format/sync pins ' In SDTV sync pulse mode: ' Selects video output type and DAC(s) used in the pin group: ' 000 = Composite video output on DAC0 pin ' 001 = Composite video output on DAC1 pin ' 010 = Composite video output on DAC2 pin ' 011 = Composite video output on DAC3 pin ' 100 = Y+C output on DAC0(Y) & DAC1(C) (S-Video) ' 101 = Y+C output on DAC0(Y) & DAC1(C) + Composite on DAC2 pin ' 110 = Component video on DAC3(Y), DAC2(Pr), DAC1(Pb) pins ' 111 = Component video on DAC3(Pr), DAC2(Y), DAC1(Pb) pins ' In HDTV sync pulse mode: ' Selects sync pulse output(s) on DAC3, DAC2, DAC1 pins in the ' three pin YPrPb group, depending on the 3 bit pattern. ' 100 - DAC3 pin enables sync pulse ' 010 - DAC2 pin enables sync pulse ' 001 - DAC1 pin enables sync pulse ' 111 - All 3 DACs enable sync pulses, etc. ' ' In Digital mode the SyncOutputs field is currently reserved for future ' TTL/LCD/HDMI output options and should be configured with 0 for now. ' ' PinGroup ' -------- ' This 4 bit field controls which P2 pins will output the DVI or analog ' signal and the order the signals are output on the pins in DVI mode. ' ' In Digital display mode: ' ' The least significant 3 bits control which group of 8 P2 pins will ' be used to output the DVI signal, with %000=P0-P7, %001=P8-15, etc. ' ' The top bit indicates which way the TMDS signals are ordered in the ' group of 8 allocated DVI pins, in increasing pin order below. ' ' Bit 23 = 0 : CLK-, CLK+, BLUE-, BLUE+, GREEN-, GREEN+, RED-, RED+ ' Bit 23 = 1 : RED+, RED-, GREEN+, GREEN-, BLUE+, BLUE-, CLK+, CLK- ' ' In Analog display mode: ' ' This four bit field indicates the four pin group that the video DACs ' will use. Use 0000=P0-P3, 0001=P4-P7,..., 1110=P56-P59, etc. ' ' Potentially the pins could be allocated in the following way to the ' colour channels to help keep the cable/connector colours consistent ' between component or RGB output types, but the actual colour mapping ' between them is also configurable using the colour space registers. ' ' DAC3 - Red / Pr ' DAC2 - Green / Y ' DAC1 - Blue / Pb ' DAC0 - only use as a horizontal or composite sync output with RGB ' ' Custom Video Timing Address ' --------------------------- ' When non-zero, this value represents the address of a multi-long structure ' containing parameters which can override the standard 640x480 VGA timing ' that will otherwise be attempted by default if this field is zero. ' ' An example of the structure it could point to for an EGA resolution is: ' ' ega_timing 'EGA resolution 640x350 @ 70Hz with 25.2MHz pixel clock ' ' long CLK252MHz ' Optional stored P2 PLL+clock settings required for ' ' this mode. The high level code controlling the ' ' driver can make use of this information when ' ' spawning the driver COG to change PLL settings ' ' when new resolutions are selected etc. ' long 252000000 ' CPU clock frequency value when PLL setting applied ' ' '_HSyncPolarity___FrontPorch__SyncWidth___BackPorch__Columns ' ' 1 bit 7 bits 8 bits 8 bits 8 bits ' long (SYNC_POS<<31) | ( 16<<24) | ( 96<<16) | ( 48<<8 ) | (640/8) ' ' '_VSyncPolarity___FrontPorch__SyncWidth___BackPorch__Visible ' ' 1 bit 8 bits 3 bits 9 bits 11 bits ' long (SYNC_NEG<<31) | ( 37<<23) | ( 2<<20) | ( 60<<11) | 350 ' ' long 10<<8 ' This behaves either as the P2 clock divider word or ' ' as a custom XFRQ value. If the most significant word ' ' is zero the lower word is used as 16 bit divider, ' ' otherwise the entire 32 bits becomes the XFRQ value. ' ' The 16 bit divider is comprised of an integer portion ' ' in the upper byte, and fractional portion in the LSB. ' ' long 0 ' Optional timing extension/mode dependent parameters. ' ' For any modes: ' ' bits 15:0 replace horizontal front porch timing when ' ' this is zeroed in its original field. This allows ' ' for the very wide front porches in 720p50 modes etc. ' ' Additionally, for PAL/NTSC output: ' ' bits 23:16 hold colour burst size (pixels) ' ' bits 31:24 hold colour burst breezeway size (pixels) ' ' long 0 ' Custom CFRQ setting for PAL/NTSC modulator output. ' ' ' NOTE: The PASM code does NOT modify the P2 PLL / system clock options or ' know what they are. Accordingly it requires that the timing data it ' is passed to be applicable to the current P2 system clock in effect. ' ' NOTE: The vertical sync timing gets overridden in SDTV interlaced modes, ' to comply with the PAL/NTSC vertical sync format. ' ' NOTE: The divider field is ignored and locked to 10 for DVI, as the TMDS ' output requires a 10x pixel clock for clocking its output data. ' This also (generally) implies that P2 clocks > ~250 MHz are required. ' ' For analog modes, the pixel clock and CPU clock can have different ' relationships, however operating the P2 CLK lower than about 5 times ' the VGA pixel clock may start to cause problems running out of time ' in the code to complete the text mode scanlines before they display ' and visible artefacts or even full loss of output could then result. ' Simpler graphics modes which only use the CPU lightly such as non-LUT ' based non-pixel doubled modes with low bit depths may operate at much ' lower clock ratios as low as 2x, but performance is not guaranteed. ' The low power 1x clock ratios are possible only in transparent mode. ' '.............................................................................. ' ' RESERVED_1 - future expansion of mode dependent configuration parameters ' ========== ' ' bit bit ' 31 0 ' ----------------------------------------------------------- ' | Reserved | ' ----------------------------------------------------------- ' ' This long is reserved and could hold data or a pointer to additional ' mode dependent parameters that do not fit in the existing structure. ' ' For example, it could point to some audio or video configuration data ' needed in an HDMI mode or it could directly contain additional information ' such as pins allocated to LCD DE/CLK signals, or CGA/EGA TTL monitors, etc. ' '.............................................................................. ' ' EXT_MEMORY_MAILBOX - configures the external memory access interface ' ================== ' ' bit bit ' 31 24 23 20 19 0 ' ----------------------------------------------------------- ' | E | Spacing |Offset| External Memory Mailbox Address | ' ----------------------------------------------------------- ' ' External Memory Mailbox Address ' ------------------------------- ' Configures the base mailbox address for accessing external memory by ' the video driver. The driver will use this mailbox address with its ' COG ID to determine the two addresses used. The first address is ' the mailbox address plus the COG ID multiplied the spacing parameter. ' The second address is the first address plus an offset in longs. ' ' Spacing ' ------- ' Number of bytes between consecutive COGs mailboxes. ' ' Offset ' ------ ' Number of longs between first and second mailbox addresses. ' ' Enable (E) ' ---------- ' If the enable flag (E) is zero, any external access will be ignored. ' It should be set to 1 to validate the mailbox exists and enable access ' to external memory. This supports mailboxes being placed at address 0 ' in hub memory if desired. ' ' In cases without external memory the entire field can be left as zero. ' '.............................................................................. ' ' LINE_BUFFER_1 & LINEBUFFER_2 - specifies odd/even scanline buffers ' ============================ ' ' bit bit ' 31 24 23 0 ' ----------------------------------------------------------- ' | Reserved(0) | Line Buffer Start Address | ' ----------------------------------------------------------- ' ' Line Buffer Start Address ' ------------------------- ' Base address in HUB memory of a buffer that is sized to hold at least ' a scanline worth of graphics data at the maximum bit depth configured. ' ' If this value is ever non-zero, care needs to be taken to ensure the value ' selected will be sufficient for all the region list's configured modes. ' '.............................................................................. ' ' RESERVED_2 - future expansion of mode dependent frame parameters ' ========== ' ' bit bit ' 31 0 ' ----------------------------------------------------------- ' | Reserved | ' ----------------------------------------------------------- ' ' This long is reserved and could hold either a pointer to additional ' parameters or the parameters themselves, which can be read in and updated ' per field/frame at VSYNC time by the driver COG. ' ' Examples of its use could be for updating an LCD backlight brightness via ' PWM intensity in an LCD output mode, or for varying the audio volume ' pan/mixer levels and audio sampling rates in some future HDMI extension. ' '.............................................................................. ' ' GLOBAL_MOUSE - indicates where the global mouse is on the screen ' ============ ' ' bit bit ' 31 16 15 0 ' ----------------------------------------------------------- ' | Mouse Y position | Mouse X position | ' ----------------------------------------------------------- ' ' Mouse X, Mouse Y position ' ------------------------- ' In all modes these words are interpreted as the mouse's X,Y positions ' ' The X,Y values are 0 based with (0,0) being top left on screen. To hide ' the mouse, set this long to -1 or other values outside the display range. ' ' Note: when pixel or line doubling is enabled, the sprite will not change ' in size and the co-ordinates still refer to normal sized pixel positions. ' To compensate for this (if desired), a client of this driver could use even ' values for X,Y and a pixel doubled 8x8 sprite image. ' '.............................................................................. ' ' BORDER_SIZE - selects optional top/bottom border sizes ' =========== ' ' bit bit ' 31 16 15 0 ' ----------------------------------------------------------- ' | Bottom Border Size | Top Border Size | ' ----------------------------------------------------------- ' ' Top Border Size ' --------------- ' Number of optional border colour scan lines inserted at the top of the ' frame before the first region begins. Can be useful for some effects. ' Use zero for no top border colour scanlines. ' ' Bottom Border Size ' ------------------ ' Number of optional border colour scan lines inserted at the bottom of ' the frame. It will override all region sizes. Useful for transitions. ' Use zero for no bottom border colour scanlines. ' '.............................................................................. ' ' BORDER_COLOUR - selects scanline colour for borders and side border widths ' ============= ' ' bit bit ' 31 24 23 16 15 8 7 0 ' ----------------------------------------------------------- ' | Red | Green | Blue | Border Width | ' ----------------------------------------------------------- ' ' Red/Green/Blue ' -------------- ' These 8 bit values change the RGB colour of any scanlines displayed ' before the first region begins and after the last region ends, forming ' an optional top and bottom border. ' ' Border Width ' ------------ ' When non-zero this sets the size of the borders drawn on each side of ' the screen in pixels. Each side will be this same width. ' ' Note that when the P2 clock to pixel clock ratio is 1:1 there may not be ' sufficient CPU cycles for the streamer to generate a single pixel wide ' border at each side of the screen. If borders are desired at this ratio ' it is best to keep BorderWidths at least 2-3 pixels wide to avoid issues. ' '.............................................................................. ' ' FIRST_REGION - link to first screen region to be displayed on the screen ' ============ ' ' bit bit ' 31 0 ' ----------------------------------------------------------- ' | First Region Pointer | ' ----------------------------------------------------------- ' ' First Region Pointer ' -------------------- ' Link to the first display region. This pointer is the hub address of ' the first region's parameter block. If zero, the border colour will ' continue all the way to the end of the screen and this is a quick way ' to blank out the screen with a single colour. ' '.............................................................................. ' ' Y/I/Q_PARAMETERS - colour space converter parameters for analog modes ' ================ ' ' bit bit ' 31 0 ' ----------------------------------------------------------- ' | Y Parameter Value | ' ----------------------------------------------------------- ' | I Parameter Value | ' ----------------------------------------------------------- ' | Q Parameter Value | ' ----------------------------------------------------------- ' ' Parameter Value ' --------------- ' Contains the 3 values used for in SETCY, SETCI, SETCQ operations which ' configure the colour space converter, and only affect the analog output ' modes. These values are read and the registers updated once per field. ' ' These values can be varied to affect the brightness and colour mixing, ' saturation, etc. Care must be taken to avoid affecting the sync level ' in the least significant byte of each long. Modify at your own risk. ' '.............................................................................. ' ' NEXT_REGION - link to further region(s) after this one ' =========== ' ' bit bit ' 31 0 ' ----------------------------------------------------------- ' | Next Region Pointer | ' ----------------------------------------------------------- ' ' Next Region Pointer ' ------------------- ' Contains the hub address of the next region's configuration data. ' ' Regions can be chained together in a linked list structure and the driver ' COG will display them all in the list sequence. ' ' If this pointer address is 0, empty lines will continue to the end of ' the screen using the border colour, once this region's size has ended. ' '.............................................................................. ' ' REGION_CONFIG - size and video mode configuration of this screen region ' ============= ' ' bit bit ' 31 16 15 8 7 0 ' ----------------------------------------------------------- ' | Region Size | Region Flags | Colour mode | ' ----------------------------------------------------------- ' ' Region Size ' ----------- ' Number of scanlines in this region. ' ' If zero it indicates this is the final screen region and the next ' region pointer value is ignored and this region will continue to the ' end of the displayed frame (or beginning of the bottom border). ' ' Region flags ' ------------ ' Bit ' [15] Mouse Enabled ' 0 the mouse sprite is hidden in this region ' 1 the mouse sprite is displayed in this region ' ' Bit ' [14] Mouse source ' 0 the global mouse co-ordinates are used in this region ' 1 the region mouse co-ordinates are used in this region ' ' Bit ' [13] Transparent / Sprite / pass through graphics mode (low power) ' 0 graphics are copied to line buffer and optionally doubled ' 1 graphics are streamed out directly from the source buffer ' ' [12] Interlaced source ' 0 the same source is displayed on all field(s) in the frame ' 1 a different (interlaced) source is shown for each field of the frame ' ' In text mode regions, this affect how fonts are displayed and when the ' bit is enabled, the font's scanlines will be interleaved across the ' odd/even fields, increasing the vertical resolution of the text. ' ' In graphics regions, when this bit is enabled it activates an alternate ' source of data between odd/even fields. ' ' In this case the unused CURSOR_1 and CURSOR_2 registers are reclaimed ' as SCREEN_BUFFER_3 and SCREEN_BUFFER_4 which are then selected instead ' of SCREEN_BUFFER_1 and SCREEN_BUFFER_2 respectively in alternating ' fields, or alternating frames in progressive scan modes (enabling ' automatic double buffering of graphics without regular intervention). ' ' Bit ' [11] Line doubling ' 0 scan line doubling is disabled ' 1 scan line doubling is enabled ' ' Bit ' [10] Pixel doubling ' 0 pixel doubler is disabled (eg. for 80 column text / 640 pixel graphics) ' 1 pixel doubler is enabled (eg. for 40 column text / 320 pixel graphics) ' ' Bit ' [9] Graphics mode enable ' 0 selects text output and 16 colour mode ' 1 selects graphics colour mode(s) listed below ' ' Bit ' [8] Flashing text ' 0 bit7 of text attribute byte selects background colour indexes from 8-15 ' 1 bit7 of text attribute byte selects flashing text & BG colour range 0-7 ' In graphics regions this flag is unused (reserved). ' ' ' Colour Mode ' ----------- ' This 4 bit value indicates the colour mode to be applied in graphics mode. ' ' Dec Hex Binary Colour mode Bpp Colours Pixels/Long ' --- --- ------ ----------- --- ------- ----------- ' 0 $0 %0000 - LUT palette 1 2/16M 32 ' 1 $1 %0001 - LUT palette 2 4/16M 16 ' 2 $2 %0010 - LUT palette 4 16/16M 8 ' 3 $3 %0011 - LUT palette 8 256/16M 4 ' 4 $4 %0100 - RGBI 3rgb+5I 8 8 colours x 32 levels 4 ' 5 $5 %0101 - RGB (3:3:2) 8 256 colours 4 ' 6 $6 %0110 - RGB (5:6:5) 16 64k "Hi-color" 2 ' 7 $7 %0111 - RGB (8:8:8:0) 32 16M "Truecolor" 1 ' 8 $8 %1000 - LUMA orange 8 256 levels 4 ' 9 $9 %1001 - LUMA blue 8 256 levels 4 ' 10 $A %1010 - LUMA green 8 256 levels 4 ' 11 $B %1011 - LUMA cyan 8 256 levels 4 ' 12 $C %1100 - LUMA red 8 256 levels 4 ' 13 $D %1101 - LUMA magenta 8 256 levels 4 ' 14 $E %1110 - LUMA yellow 8 256 levels 4 ' 15 $F %1111 - LUMA white 8 256 levels (greyscale) 4 ' ' Note: Text mode uses 4-bit LUT palettes, overriding the colour mode nibble. ' The upper 4 bits of this field are reserved and should be zeroed. ' '.............................................................................. ' ' SCREEN_BUFFER_1 - defines the text or graphics mode screen's start address ' =============== ' ' bit bit ' 31 30-28 27 24 23 0 ' ----------------------------------------------------------- ' | E |Rsvd| Bank | Screen Buffer Base Address | ' ----------------------------------------------------------- ' ' External Memory (E) ' ------------------- ' When in graphics mode, the buffer base address can be used for external ' memory such as HyperRAM. ' ' The E flag's value should be set to 0 for HUB RAM, 1 for external RAM. ' ' Bank ' ---- ' Selects the bank for external memory accesses, ignored for hub access. ' Addresses will wrap within the same 16MB external memory bank. ' ' Screen Buffer Base Address ' -------------------------- ' The Hub or External memory address to begin reading from at the start ' of the region being displayed. ' ' NOTE: In the text mode, all character data is always loaded from hub RAM. ' When external memory is being used, any pixel doubling applied is ' ignored and the graphics buffers in external RAM are assumed to ' contain standard width pixels. Scanline doubling does still work ' with external memory graphics buffers however. ' '.............................................................................. ' ' SCREEN_BUFFER_2 - defines the address to use if the region content wraps ' =============== ' ' bit bit ' 31 30-28 27 24 23 0 ' ----------------------------------------------------------- ' | E |Rsvd| Bank | Screen Buffer Wrap Address | ' ----------------------------------------------------------- ' ' External Memory (E) ' ------------------- ' Refer to description for Screen Buffer 1. ' ' Bank ' ---- ' Selects the bank for external memory accesses. ' Addresses will wrap within the same 16MB external memory bank. ' ' Screen Buffer Wrap Address ' -------------------------- ' Hub or External memory address to use if the screen data has wrapped ' in the region according to the settings in the SOURCE WRAP long. ' Source data wrapping can only optionally occur once per region. ' ' NOTE: Both the E values can be set independently, enabling some of the ' displayed graphics to be sourced from HUB and some from external RAM. ' '.............................................................................. ' ' FONT_BUFFER - controls which font is used in text mode ' =========== ' ' bit bit ' 31 24 23 0 ' ----------------------------------------------------------- ' | Last Font Line| Font Table Base Hub Address | ' ----------------------------------------------------------- ' ' Font Table Base Hub Address ' --------------------------- ' The address of the font data in HUB memory. ' ' Last Font Line ' -------------- ' The font's height in pixels minus 1. ' ' A font is required in text mode, but this field is ignored for graphics. ' ' Font data format: ' ' Fonts are required to be formatted as 256 byte blocks for each scanline in ' the font (requiring 8 pixel wide data per character). These 256 byte ' blocks are then repeated by the height of the font in pixels. ' ' The least significant bits of the font data are displayed first. ' ' Bits set in the font data represent foreground coloured pixels for each ' character while cleared bits are used for background coloured pixels. ' '.............................................................................. ' ' PALETTE_BUFFER - configures the palette for text & LUT based graphics modes ' ============== ' ' bit bit ' 31 24 23 0 ' ----------------------------------------------------------- ' | Reserved(0) | Palette Base Hub Address | ' ----------------------------------------------------------- ' ' Palette Base Hub Address ' ------------------------ ' The address of the palette's base address in HUB RAM. ' ' The palette is only required in text and LUT based graphics modes. ' ' Palette format: ' ' 2/4/16/256 sequential longs containing 24 bit RGB data (8:8:8:0) to be ' be indexed by the source data bits/nits/nibbles/bytes in LUT modes. ' ' The colour sequence in each long is RED(8):GREEN(8):BLUE(8):%00000000 ' ' NOTE: Some care should be taken to ensure bit 1 of each palette entry is 0 ' or a TMDS control symbol could be sent instead of RGB pixels. Bit 0 ' should also be zeroed in order to allow the analog output from this ' driver to operate correctly without affecting the HSYNC state. ' '.............................................................................. ' ' CURSOR_1 & CURSOR_2 - sets row, column, type and colour of two text cursors ' =================== ' ' bit bit ' 31 24 23 16 15 8 7 0 ' ----------------------------------------------------------- ' | Cursor Row | Column | Attributes | Colour Indexes| ' ----------------------------------------------------------- ' ' Cursor Row/Column ' ----------------- ' In the text mode this data represents the cursor's co-ordinates. ' ' Rows and columns values are 0 based, with (0,0) being top left in the ' region. Cursor 2 is rendered last and can overwrite cursor 1. ' ' Attributes ' ---------- ' bit bit ' 15 14 13 12 11 10 9 8 ' ----------------------------------------------- ' | E | F | T | B | Cursor Scanlines | ' ----------------------------------------------- ' | | | | | ' | | | | | ' | | | | 0 = Full cell block cursor displayed ' | | | | 1-15 = Underscore cursor height ' | | | | ' | | | (0) selects blink phase 1 ' | | | (1) selects blink phase 2 ' | | | ' | | (0) underline cursor drawn upwards from end scanline ' | | (1) underline cursor drawn downwards from start scanline ' | | ' | (0) selects a flashing cursor ' | (1) selects a non-flashing (fixed) cursor ' | ' (0) disables this cursor ' (1) enables this cursor ' ' ' Colour Indexes ' -------------- ' The two nibbles define the cursors colour(s). Each forms a 16 colour ' palette index value used to lookup the colour. The two colours are ' alternating per pixel in the cursor displayed. When both values are ' the same, the cursor will be rendered in a single colour, but they can ' also be set differently for different effects, useful for indicating ' states such as insert/overwrite or to show CAPS lock is on etc. ' '.............................................................................. ' ' SCREEN_BUFFER_3/4 - used in interlaced graphics output modes ' ================= ' ' Replaces CURSOR_1 and CURSOR_2 registers when interlaced graphics regions ' are used, and SCREEN_BUFFER_3 and SCREEN_BUFFER_4 have the same format ' as SCREEN_BUFFER_1 and SCREEN_BUFFER_2 respectively. ' ' See the description of how this is used in the REGION_CONFIG information. ' '.............................................................................. ' ' REGION_MOUSE - indicates position of the region specific mouse ' ============ ' ' bit bit ' 31 16 15 0 ' ----------------------------------------------------------- ' | Mouse Y position | Mouse X position | ' ----------------------------------------------------------- ' ' Mouse X, Mouse Y position ' ------------------------- ' In all modes these words are interpreted as the mouse's X,Y positions ' ' The X,Y values are 0 based with (0,0) being top left in the region. To ' hide the mouse, set this long to -1 or other values outside the display ' or disable it in the region configuration flags. ' ' Note: these mouse co-ordinates will only be used if the region specific ' mouse select bit is enabled in the region configuration flags. ' ' This setting allows each region to control it's own independent mouse ' position, or use the global mouse position, or have no mouse displayed. ' ' The same mouse sprite image (below) is used in either case. ' '.............................................................................. ' ' MOUSE_SPRITE - points to mouse sprite image data and indicates its hotspots ' ============ ' ' bit bit ' 31 28 27 24 23 0 ' ----------------------------------------------------------- ' | Y hot | X hot | Mouse Sprite Hub Address | ' ----------------------------------------------------------- ' ' Y hot spot ' ---------- ' The offset in the 16x16 sprite to locate at the mouse's Y position. ' ' X hot spot ' ---------- ' The offset in the 16x16 sprite to locate at the mouse's X position. ' ' Mouse Sprite Hub Address ' ------------------------ ' The address of the mouse mask and sprite image data in scanline order. ' ' BitDepth Mouse sprite data layout ' 1bpp - 1 mask long then 1 long of pixel source data x 16 scanlines ' 2bpp - 1 mask long then 1 long of pixel source data x 16 scanlines ' 4bpp - 1 mask long then 2 longs of pixel source data x 16 scanlines ' 8bpp - 1 mask long then 4 longs of pixel source data x 16 scanlines ' 16bpp - 1 mask long then 8 longs of pixel source data x 16 scanlines ' 24bpp - 1 mask long then 16 longs of pixel source data x 16 scanlines ' ' The 16 bit mask (right aligned) indicates whether the corresponding mouse ' pixel in the source data long(s) will be drawn over the screen pixels. ' The bits in the mask are 1 for an active mouse pixel, 0 for transparent. ' '.............................................................................. ' ' SOURCE_WRAP - allows screen buffers to wrap to new data during the region ' =========== ' ' bit bit ' 31 16 15 0 ' ----------------------------------------------------------- ' | Scanline Offset/Rewrap | Source Wrap Scanlines | ' ----------------------------------------------------------- ' ' Scanline Offset/Rewrap ' ---------------------- ' This field has two uses, one for text regions, the other for graphics. ' ' In text regions this value is the initial scanline offset in the first ' row of text displayed in the region, enabling very fine (single pixel) ' vertical scrolling of text. ' ' Set to 0 if not used, or up to the font's height minus 1. ' ' In graphics regions it is used after the first wrap occurs, and is ' the value reloaded into the wrap counter. Set it to zero for only one ' wrap, or to the number of scanlines until the second and future wrap ' occurs. This is used in external sprite modes where you might have ' (say) 3 COGs rendering into 3 different scanline buffers, and you ' need to continuously repeat the display of these 3 scanline buffers ' throughout the entire region or some later part of the region. ' ' ' Source Wrap Scanlines ' --------------------- ' Number of scanlines to display after which the region's screen buffer ' source pointer will change to the second value in SCREEN BUFFER 2. ' ' This allows infinite vertical scrolling effects with finite graphics ' frame buffers, or to be used with text modes to support a screen buffer ' that does not require its text data to be memory copied between rows ' to scroll it vertically. ' ' Use a value of zero to prevent any buffer wrap occurring. ' ' Wrapping could also be conveniently used when the number of scanlines ' in a region is not perfectly divisible by the font height. By setting ' the source wrap scanline position after the last completed row ends in ' the region, a second single row screen buffer could be used to display ' some extra blanks in the desired background colour to hide this until ' the region ends. ' '.............................................................................. ' ' SOURCE_SKEW - controls applied skew per source scanline or row ' =========== ' ' bit bit ' 31 0 ' ----------------------------------------------------------- ' | Scanline Skew (or Pitch) | ' ----------------------------------------------------------- ' ' Scanline Skew ' ------------- ' Optional extra bytes added between the end of the source graphics ' scanline or text row data in memory and the beginning of the next. ' ' A typical value of zero keeps the source data fully packed, while non-zero ' values will allow some amount of horizontal offset or skew in memory. ' ' By changing the screen buffer address and using non-zero skew values you ' can create some useful horizontal window panning/scrolling effects in ' addition to basic vertical scrolling. ' ' Skew works well in text modes too and is row based. In text mode cases it ' should be kept a multiple of two to account for the 16 bit screen content. ' ' Negative skew values can be used to reverse bitmaps, or replicate a single ' scanline in a region (solid colour/stripe fill) when the negative skew ' applied equals the scanline's source data width in bytes. ' ' Scanline Pitch ' -------------- ' Bytes between a scanline's data and the next scanline's data. ' ' In transparent pass through mode, the scanline skew works differently and ' becomes the exact byte spacing (pitch) between source scanlines instead of ' indicating the bytes between the end of one scanline's data and the ' beginning of the next (skew). In normal pass through cases it should be ' set to a non-zero value, because a zero value would simple repeat the same ' source data on every line otherwise (which may possibly be desirable for ' some simple fill effect perhaps). ' '============================================================================== ' ' Control Parameter Format Summary ' -------------------------------- ' ' ' 31 30 29 28:24 23 16 15 0 ' ----------------------------------------------------------- ' | V | F | B |00000|Field Count| Active Scanlines Displayed | STATUS ' ----------------------------------------------------------- ' ' bit bit ' 31 30 29 24 23 20 19 0 ' ----------------------------------------------------------- ' | D | V |SyncOutputs|PinGroup| Custom Video Timing Address | INITIALIZATION ' ----------------------------------------------------------- ' ' 31 0 ' ----------------------------------------------------------- ' | Reserved | RESERVED_1 ' ----------------------------------------------------------- ' ' 31 30 24 23 20 19 0 ' ----------------------------------------------------------- ' | E | Offset | Rsvd | External Memory Mailbox Address | EXT_MEM_MAILBOX ' ----------------------------------------------------------- ' ' 31 24 23 0 ' ----------------------------------------------------------- LINE_BUFFER_1 ' | Reserved(0) | Line Buffer Start Address | ' ----------------------------------------------------------- LINE_BUFFER_2 ' ' 31 0 ' ----------------------------------------------------------- ' | Reserved | RESERVED_2 ' ----------------------------------------------------------- ' ' 31 16 15 0 ' ----------------------------------------------------------- ' | Mouse Y position | Mouse X position | GLOBAL_MOUSE ' ----------------------------------------------------------- ' ' 31 16 15 0 ' ----------------------------------------------------------- ' | Bottom Border Size | Top Border Size | BORDER_SIZE ' ----------------------------------------------------------- ' ' 31 24 23 16 15 8 7 0 ' ----------------------------------------------------------- ' | Red | Green | Blue | Border Width | BORDER_COLOUR ' ----------------------------------------------------------- ' ' 31 0 ' ----------------------------------------------------------- ' | First Region Pointer | FIRST_REGION ' ----------------------------------------------------------- ' ' 31 0 ' ----------------------------------------------------------- ' | Y Parameter Value | Y_PARAMETER ' ----------------------------------------------------------- ' ' 31 0 ' ----------------------------------------------------------- ' | I Parameter Value | I_PARAMETER ' ----------------------------------------------------------- ' ' 31 0 ' ----------------------------------------------------------- ' | Q Parameter Value | Q_PARAMETER ' ----------------------------------------------------------- ' '.............................................................................. ' 31 0 ' ----------------------------------------------------------- ' | Next Region Pointer | NEXT_REGION ' ----------------------------------------------------------- ' ' 31 16 15 8 7 0 ' ----------------------------------------------------------- ' | Region Size | Region Flags | Colour mode | REGION_CONFIG ' ----------------------------------------------------------- ' ' 31 30-28 27 24 23 0 ' ----------------------------------------------------------- SCREEN_BUFFER_1 ' | E |Rsvd| Bank | Screen Buffer Base Address | ' ----------------------------------------------------------- SCREEN_BUFFER_3 ' ' 31 30-28 27 24 23 0 ' ----------------------------------------------------------- SCREEN_BUFFER_2 ' | E |Rsvd| Bank | Screen Buffer Wrap Address | ' ----------------------------------------------------------- SCREEN_BUFFER_4 ' ' 31 24 23 0 ' ----------------------------------------------------------- ' | Last Font Line| Font Table Base Hub Address | FONT_BUFFER ' ----------------------------------------------------------- ' ' 31 24 23 0 ' ----------------------------------------------------------- ' | Reserved(0) | Palette Base Hub Address | PALETTE_BUFFER ' ----------------------------------------------------------- ' ' 31 24 23 16 15 8 7 0 ' ----------------------------------------------------------- CURSOR_1 ' | Cursor Row | Column | Attributes | Colour Indexes| ' ----------------------------------------------------------- CURSOR_2 ' ' 31 16 15 0 ' ----------------------------------------------------------- ' | Mouse Y position | Mouse X position | REGION_MOUSE ' ----------------------------------------------------------- ' ' 31 28 27 24 23 0 ' ----------------------------------------------------------- ' | Y hot | X hot | Mouse Sprite Hub Address | MOUSE_SPRITE ' ----------------------------------------------------------- ' ' 31 16 15 0 ' ----------------------------------------------------------- ' | Scanline Offset/Rewrap | Source Wrap Scanlines | SOURCE_WRAP ' ----------------------------------------------------------- ' ' 31 0 ' ----------------------------------------------------------- ' | Scanline Skew (or Pitch) | SOURCE_SKEW ' ----------------------------------------------------------- ' '==============================================================================