VICKY

From C256 Foenix Wiki
Revision as of 10:45, 11 April 2019 by Boris Dietrich (talk | contribs) (LUT)
Jump to navigation Jump to search

VICKY - the graphics engine

"Vicky" is the name of the graphics engine of the C256 Foenix. It supports:

  • 640x480@60FPS Max Resolution @ 256 Colors (1 Byte per pixel)
  • 32 Sprites with a resolution of 32x32 pixels
  • 4 layers of tiles with a resolution of 16x16 pixels for each tile
  • Text Mode

During the video layer composition, Vicky has to read 1 line of bitmap (640 pixels), 1 line of tiles for each layer (4x 640 pixels) and all the lines that are part of the 32 Sprites (worst case scenario 32 lines of 32 pixels), that are displayed on that line. Then a composition and priority encoding is done. In order to establish a priority, in other words, to know which pixel will be in front, Vicky needs to store 10 lines of 640 pixels then scan the lot and determine which one will be displayed.

640 + 640 + 640 + 640 + 640 + (32 * 32) = 4224 Pixels are to be read during a single line interval. The pixel rate is 200Mbytes/sec, 5ns, so the overall operation takes 21.12us, without calculating the overhead in the FPGA to go from one process to the other.

The pixel index value $00 is always transparent, regardless if it's bitmap, tile or sprite. The respective values of the first 4 bytes represented in the LUT are thus always ignored.

Despite the fact that there is an ALPHA value in the LUT, it is not supported/used at all.

Modes

Modes are enabled and disabled via the Vicky Master Control Register at $AF0000 via the control bits:

Mstr_Ctrl_Text_Mode_En = $01 Enable the Text Mode
Mstr_Ctrl_Text_Overlay = $02 Enable the Overlay of the text mode on top of Graphic Mode (the Background Color is ignored)
Mstr_Ctrl_Graph_Mode_En = $04 Enable the Graphic Mode
Mstr_Ctrl_Bitmap_En = $08 Enable the Bitmap Module In Vicky
Mstr_Ctrl_TileMap_En = $10 Enable the Tile Module in Vicky
Mstr_Ctrl_Sprite_En = $20 Enable the Sprite Module in Vicky
Mstr_Ctrl_GAMMA_En = $40 Enable the GAMMA correction - The Analog and DVI have different color values, the GAMMA is great to correct the difference
Mstr_Ctrl_Disable_Vid = $80 This will disable the Scanning of the Video hence giving 100% bandwith to the CPU


Bitmap Layer

The bitmap is stored anywhere in $B0 bank memory. If the bitmap is supposed to start at $B0:0000, the BM_START_ADDY has to be set to $00:0000.

  • BM_CONTROL_REG = $AF0140
    • Bit 0 = disable/enable
    • Bit 1-3 = Target LUT address located at AF:2000 and up.
  • BM_START_ADDY_L = $AF0141
  • BM_START_ADDY_M = $AF0142
  • BM_START_ADDY_H = $AF0143

LUT

A LUT, namely a Look-Up-Table, stores a selection of colors. 256 colors are supported in the video composition, which are selectable out of 16.777.216 colors in the 24 Bit RGB color scheme. The LUT also contains an 8 Bit alpha channel, though it isn't supported. In summary, the LUT has $400 (1024) bytes - and the order for composing it is B -> G -> R -> A.

As an example, if you would want to compose a LUT of 16 base colors, it would look like this:

Address Hex Values (BGRA) Decimal RGB Value
$AF:2000 00000000 0, 0, 0
$AF:2004 FFFFFF00 255, 255, 255
$AF:2008 00008800 136, 0, 0
$AF:200C EEFFAA00 170, 255, 238
$AF:2010 CC44CC00 204, 68, 204
$AF:2014 55CC0000 0, 204, 85
$AF:2018 AA000000 0, 0, 170
$AF:201C 77EEEE00 238, 238, 119
$AF:2020 5588DD00 221, 136, 85
$AF:2024 00446600 102, 68, 0
$AF:2028 7777FF00 255, 119, 119
$AF:202C 33333300 51, 51, 51
$AF:2030 77777700 119, 119, 119
$AF:2034 66FFAA00 170, 255, 102
$AF:2038 FF880000 0, 136, 255
$AF:203C BBBBBB00 187, 187, 187

Adressing anything in the LUT is achieved by simply dividing the lower 10 bits of target color address by 4.