Difference between revisions of "VICKY II"
Line 31: | Line 31: | ||
The picture below shows how the graphics layers are arranged: | The picture below shows how the graphics layers are arranged: | ||
− | [[File:Graphics layers.jpg]] | + | [[File:Graphics layers.jpg:640px]] |
Vicky Gloabl Memory Map: | Vicky Gloabl Memory Map: |
Revision as of 19:55, 27 June 2021
VICKY II - the graphics engine
"Vicky" is the name of the graphics engine of the C256 Foenix.
"Vicky II" is the upgraded version of the graphic engines that resides in the FMX Version.
The major difference in between VICKY and VICKY II is the external bus @ 32Bits wide. (VICKY is only 16Bits) The access time has been doubled which allow the chipset to have better access time and overall better performance. It also gave enough room to implement larger resolutions with faster GUI block move.
Part Number: CFP9551
It supports:
- 320x240@60FPS Max Resolution @ 256 Colors (1 Byte per pixel)
- 400x300@60FPS Max Resolution @ 256 Colors (1 Byte per pixel)
- 640x480@60FPS Max Resolution @ 256 Colors (1 Byte per pixel)
- 800x600@60FPS Max Resolution @ 256 Colors (1 Byte per pixel) (GUI mode)
- 64 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 64 Sprites (worst case scenario 32 lines of 32 pixels), that are displayed on that line. Then a composition and priority encoding are 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.
The picture below shows how the graphics layers are arranged:
File:Graphics layers.jpg:640px
Vicky Gloabl Memory Map:
Start Address | Stop Address | Register Description | Additional Info |
---|---|---|---|
$AF:0000 | $AF:0000 | MASTER_CTRL_REG_L | Vicky Master Control Registers |
$AF:0001 | $AF:0001 | MASTER_CTRL_REG_H | |
$AF:0002 | $AF:0002 | GAMMA_CTRL_REG | |
$AF:0003 | $AF:0003 | VKY_RESERVED_01 | |
$AF:0004 | $AF:0004 | BORDER_CTRL_REG | Border Control Registers |
$AF:0005 | $AF:0005 | BORDER_COLOR_B | |
$AF:0006 | $AF:0006 | BORDER_COLOR_G | |
$AF:0007 | $AF:0007 | BORDER_COLOR_R | |
$AF:0008 | $AF:0008 | BORDER_X_SIZE[5:0] | |
$AF:0009 | $AF:0009 | BORDER_Y_SIZE[5:0] | |
$AF:000A | $AF:000C | UNDEFINED - RESERVED | |
$AF:000D | $AF:000D | BACKGROUND_COLOR_B | Background Control Registers |
$AF:000E | $AF:000E | BACKGROUND_COLOR_G | |
$AF:000F | $AF:000F | BACKGROUND_COLOR_R | |
$AF:0010 | $AF:0010 | VKY_TXT_CURSOR_CTRL_REG | Cursor Control Registers |
$AF:0011 | $AF:0011 | VKY_TXT_START_ADD_PTR | This is an offset to change the Starting address of the Text Mode Buffer (in x) |
$AF:0012 | $AF:0012 | VKY_TXT_CURSOR_CHAR_REG | Char used as the Cursor |
$AF:0013 | $AF:0013 | VKY_TXT_CURSOR_COLR_REG | Color Choice for the Cursor |
$AF:0014 | $AF:0014 | VKY_TXT_CURSOR_X_REG_L | Cursor Position X |
$AF:0015 | $AF:0015 | VKY_TXT_CURSOR_X_REG_H | |
$AF:0016 | $AF:0016 | VKY_TXT_CURSOR_Y_REG_L | Cursor Position Y |
$AF:0017 | $AF:0017 | VKY_TXT_CURSOR_Y_REG_H | |
$AF:0018 | $AF:001B | VKY_LINE_IRQ_CTRL_REG | Line Interrupt Registers: [0] - Enable Line 0, [1] -Enable Line 1 |
$AF:001C | $AF:001C | VKY_INFO_CHIP_NUM_L | Read: Vicky Chip Part Number (L) - Write: LINE0_CMP_VALUE_LO |
$AF:001D | $AF:001D | VKY_INFO_CHIP_NUM_H | Read: Vicky Chip Part Number (H) - Write: LINE0_CMP_VALUE_HI |
$AF:001E | $AF:001E | VKY_INFO_CHIP_VER_L | Read: Vicky Chip Version (L) - Write: LINE1_CMP_VALUE_LO |
$AF:001F | $AF:001F | VKY_INFO_CHIP_VER_H | Read: Vicky Chip Version (H) - Write: LINE1_CMP_VALUE_HI |
$AF:0020 | $AF:00FF | UNDEFINED - RESERVED | |
$AF:0100 | $AF:0100 | BM0_CONTROL_REG | First BitMap Plane |
$AF:0101 | $AF:0101 | BM0_START_ADDY_L | Start Address Within the Video Memory (offset by $B0:0000) |
$AF:0102 | $AF:0102 | BM0_START_ADDY_M | |
$AF:0103 | $AF:0103 | BM0_START_ADDY_H | |
$AF:0104 | $AF:0104 | BM0_X_OFFSET | Not implemented |
$AF:0105 | $AF:0105 | BM0_Y_OFFSET | Not implemented |
$AF:0106 | $AF:0107 | UNDEFINED - RESERVED | |
$AF:0108 | $AF:0108 | BM1_CONTROL_REG | Second BitMap Plane |
$AF:0109 | $AF:0109 | BM1_START_ADDY_L | Start Address Within the Video Memory (offset by $B0:0000) |
$AF:010A | $AF:010A | BM1_START_ADDY_M | |
$AF:010B | $AF:010B | BM1_START_ADDY_H | |
$AF:010C | $AF:010C | BM1_X_OFFSET | Not implemented |
$AF:010D | $AF:010D | BM1_Y_OFFSET | Not implemented |
$AF:010E | $AF:010F | UNDEFINED - RESERVED | |
$AF:0200 | $AF:02FF | TILES Memory Map | Refer to Tiles |
$AF:0300 | $AF:03FF | Collision Detection Memory Map | Refer to Collision Detection |
$AF:0400 | $AF:04FF | VDMA_CONTROL_REG | Video DMA Block |
$AF:0500 | $AF:05FF | MOUSE_PTR_GRAPH0 | 16x16 Mem Block 0 for Mouse Pointer |
$AF:0600 | $AF:06FF | MOUSE_PTR_GRAPH1 | 16x16 Mem Block 1 for Mouse Pointer |
$AF:0700 | $AF:0700 | MOUSE_PTR_CTRL_REG_L | Mouse Pointer Registers Block |
$AF:0701 | $AF:0701 | MOUSE_PTR_CTRL_REG_H | |
$AF:0702 | $AF:0702 | MOUSE_PTR_X_POS_L | X Absolute Location of the Mouse |
$AF:0703 | $AF:0703 | MOUSE_PTR_X_POS_H | Presently Read Only |
$AF:0704 | $AF:0704 | MOUSE_PTR_Y_POS_L | Y Absolute Location of the Mouse |
$AF:0705 | $AF:0705 | MOUSE_PTR_Y_POS_H | Presently Read Only |
$AF:0706 | $AF:0706 | MOUSE_PTR_BYTE0 | PS2 Mouse Packet Byte 0 |
$AF:0707 | $AF:0707 | MOUSE_PTR_BYTE1 | PS2 Mouse Packet Byte 1 |
$AF:0708 | $AF:0708 | MOUSE_PTR_BYTE2 | PS2 Mouse Packet Byte 2 |
$AF:0709 | $AF:070A | UNDEFINED MOUSE | |
$AF:070B | $AF:070B | C256F_MODEL_MAJOR | |
$AF:070C | $AF:070C | C256F_MODEL_MINOR | |
$AF:070D | $AF:070D | FPGA_DOR (Day of Release) | |
$AF:070E | $AF:070E | FPGA_MOR (Month of Release) | |
$AF:070F | $AF:070F | FPGA_YOR (Year of Release) | |
$AF:0710 | $AF:07FF | UNDEFINED - RESERVED | ------------------------ |
$AF:0800 | $AF:080F | RTC | See the RTC Section for more details |
$AF:0810 | $AF:0BFF | UNDEFINED - RESERVED | ------------------------ |
$AF:0C00 | $AF:0DFF | Sprites Memory Map | Refer to Sprites |
$AF:0E00 | $AF:0FFF | UNDEFINED - RESERVED | ------------------------ |
$AF:1000 | $AF:13FF | SUPERIO | See the Super IO Section for more details |
$AF:1400 | $AF:1F3F | UNDEFINED - RESERVED | ------------------------ |
$AF:1F40 | $AF:1F7F | FG_CHAR_LUT_PTR | Text Foreground Look-Up Table |
$AF:1F80 | $AF:1FFF | BG_CHAR_LUT_PTR | Text Background Look-Up Table |
$AF:2000 | $AF:23FF | GRPH_LUT0_PTR | |
$AF:2400 | $AF:27FF | GRPH_LUT1_PTR | |
$AF:2800 | $AF:2BFF | GRPH_LUT2_PTR | |
$AF:2C00 | $AF:2FFF | GRPH_LUT3_PTR | |
$AF:3000 | $AF:33FF | GRPH_LUT4_PTR | Not Implemented Yet |
$AF:3400 | $AF:37FF | GRPH_LUT5_PTR | Not Implemented Yet |
$AF:3800 | $AF:3BFF | GRPH_LUT6_PTR | Not Implemented Yet |
$AF:3C00 | $AF:3FFF | GRPH_LUT7_PTR | Not Implemented Yet |
$AF:4000 | $AF:40FF | GAMMA_B_LUT_PTR | |
$AF:4100 | $AF:41FF | GAMMA_G_LUT_PTR | |
$AF:4200 | $AF:42FF | GAMMA_R_LUT_PTR | |
$AF:4300 | $AF:7FFF | UNDEFINED - RESERVED | ------------------------ |
$AF:8000 | $AF:87FF | FONT_MEMORY_BANK0 | FONT Character Graphic Mem |
$AF:8800 | $AF:9FFF | UNDEFINED - RESERVED | ------------------------ |
$AF:A000 | $AF:BFFF | CS_TEXT_MEM_PTR | Text Memory Block |
$AF:C000 | $AF:DFFF | CS_COLOR_MEM_PTR | Color Text Memory Block |
Modes
Modes are enabled and disabled via the Vicky Master Control Register at $AF0000 via the control bits:
Mstr_Ctrl_Text_Mode__Lo_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 information in the 4Meg of VideoRAM hence giving 100% bandwidth to the CPU |
The Video mode enables hi-resolution and pixel doubling which yields 4 resolutions: - 320 x 240 (pixel doubling, low res) - 400 x 300 (pixel doubling, hi res) - 640 x 480 (low res) - 800 x 600 (hi res)
Mstr_Ctrl_Video_Mode0 | = $01 | 0 - 640x480 (Clock @ 25.175Mhz), 1 - 800x600 (Clock @ 40Mhz) |
Mstr_Ctrl_Video_Mode1 | = $02 | 0 - No Pixel Doubling, 1- Pixel Doubling (Reduce the Pixel Resolution by 2) |
Bitmap Layer
The bitmaps are stored anywhere in video RAM, which starts at bank $B0. If the bitmap is starts at $B0:0000, the BM_START_ADDY has to be set to $00:0000. There are two bitmap planes.
- BM_CONTROL_REG = $AF:0100 and $AF:0108
- Bit 0 = disable/enable
- Bit 1-3 = Target LUT address located at AF:2000 and up.
- Bit 6 = Bitmap Collision On
- BM_START_ADDY_L = $AF:0101 and $AF0109
- BM_START_ADDY_M = $AF:0102 and $AF:010A
- BM_START_ADDY_H = $AF:0103 and $AF:010B
Text Layer
This layer is enabled by setting the Vicky master control register at $AF0000 to have bit 1 enabled. To overlay text on a bitmap display set bit 2 enabled. This will ignore the background color so this bitmap image can show through.
The text layer text itself starts at address $AF:A000. At the moment this layer has 128 columns and 64 rows, of these 80 columns and 60 rows are visible on screen at any time. Do remember that Vicky is capable of displaying a border. Its up to the developer to account for the overlap of the border with the text screen and adjust the text position accordingly.
The fore and background color can be set by setting the corresponding bytes for each character starting at $AFC000. The upper 4 bits of every byte specify the foreground of the character and the lower 4 bytes specify the background color. This means that only 16 colors are available for the fore and background each. Both index into the text LUT for either fore or background color.
- Start of text screen = $AF:A000
- Start of color screen = $AF:C000
- Foreground LUT start = $AF:1F40 (4-bytes per entry)
- Background LUT start = $AF:1F80 (4-bytes per entry)
LUT
A LUT, namely a Look-Up-Table, stores a selection of colors. 256 colors are supported in the video composition for the bitmap layer. The text overlay LUT is limited to 16 colors for foreground and background colors each. All re 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 | -- Transparent -- | -- Transparent -- |
$AF:2004 | 00 00 00 00 | 0, 0, 0 |
$AF:2008 | FF FF FF 00 | 255, 255, 255 |
$AF:200C | 00 00 88 00 | 0, 0, 136 |
$AF:2010 | EE FF AA 00 | 238, 255, 170 |
$AF:2014 | CC 44 CC 00 | 204, 68, 204 |
$AF:2018 | 55 CC 00 00 | 85, 204, 0 |
$AF:201C | AA 00 00 00 | 170, 0, 0 |
$AF:2020 | 77 EE EE 00 | 119, 238, 238 |
$AF:2024 | 55 88 DD 00 | 85, 136, 221 |
$AF:2028 | 00 44 66 00 | 0, 68, 102 |
$AF:202C | 77 77 FF 00 | 119, 119, 255 |
$AF:2030 | 33 33 33 00 | 51, 51, 51 |
$AF:2034 | 77 77 77 00 | 119, 119, 119 |
$AF:2038 | 66 FF AA 00 | 102, 255, 170 |
$AF:203C | FF 88 00 00 | 255, 136, 0 |
$AF:2040 | BB BB BB 00 | 187, 187, 187 |
Adressing anything in the LUT is achieved by simply dividing the lower 10 bits of target color address by 4.