Arduino/FPGA/Gameduino
Gameduino Shield
Das Gameduino Shield ist ein Grafik Adapter für den Arduino auf Basis eines Altera FPGA. Es bietet VGA mit Sprites und einen Coprocessor.
Specifications
- video output is 400x300 pixels in 512 colors
- all color processed internally at 15-bit precision
- compatible with any standard VGA monitor (800x600 @ 72Hz)
- background graphics
- 512x512 pixel character background
- 256 characters, each with independent 4 color palette
- pixel-smooth X-Y wraparound scroll
- foreground graphics
- each sprite is 16x16 pixels with per-pixel transparency
- each sprite can use 256, 16 or 4 colors
- four-way rotate and flip
- 96 sprites per scan-line, 1536 texels per line
- pixel-perfect sprite collision detection
- audio output is a stereo 12-bit frequency synthesizer
- 64 independent voices 10-8000 Hz
- per-voice sine wave or white noise
- sample playback channel
Background graphics
The 64x64 character screen RAM, together with the character/palette RAMs define the background image. This image is 512x512 pixels, from which the hardware displays a 400x300 window. The SCROLL_X and SCROLL_Y registers control the location of the top-left corner of this window. The display window wraps around the 512x512 screen area, so an infinite scrolling area is possible, as shown by sample scroll.
Memory at 0000-0FFF (RAM_PIC) is a 64x64 grid of byte character codes. The hardware uses the character code to look up the character image and palette in memory areas 1000-1FFF (RAM_CHR) and 2000-27FF (RAM_PAL). So for each displayed pixel, the hardware:
- looks up the character code in RAM_PIC
- looks up that character's pixel in RAM_CHR
- looks up that character's pixel's color in RAM_PAL
1000-1FFF (RAM_CHR) specifies the 64-pixel 8x8 image for each of the 256 characters. Layout is top-left to bottom-right, pixels are packed four in each byte, with the leftmost pixel in the most significant two bits.
2000-27FF (RAM_PAL) specifies the four colors used by each of the 256 characters. See :ref:`Colors`. If a color value's A bit is set, then the color is taken from register BG_COLOR instead.
Sprite graphics
The hardware always draws sprites in order, from lower-number to higher. So higher-numbered sprites appear in front of lower-numbered sprites. Sprite coordinates are 9-bit numbers 0-511. (0,0) is the top left corner of the screen. Sprites can appear partially offscreen.
Memory at 3000-37FF (RAM_SPR) holds the control data for the 256 sprites. There are two sprite pages to allow double-buffered display. The displayed page is selected by register SPR_PAGE. Each sprite is controlled by a 32-bit value:
- collision class (J or K) membership (bit 31) (see example jkcollision)
- source image 0-63 (bits 25-30)
- Y coordinate 0-511 (bits 24-16)
- palette select 0-15 (bits 12-15) (see example palettes)
- For 256 color sprites (bits 14-15 = 00) bits 12-13 specify the palette, see below
- For 16 color sprites (bits 14-15 = 01) bit 13 specifies the source nibble, and bit 12 specifies the palette A/B
- For 4 color sprites (bit 15 = 1) bits 13-14 specify the source bit pair (00 is lsb, 11 is msb), and bit 12 specifies the palette A/B
- rotation and flip 0-7 (bits 11-9) (see example rotate)
- X coordinate 0-511 (bits 8-0)
Memory at 3800-3FFF (RAM_SPRPAL) holds the four color palettes available for 256-color sprites. Each palette is a block of 256 colors (512 bytes). For sprites, bit 15 (A) of a color value true indicates transparency.
Memory at 4000-7FFF (RAM_SPRIMG) holds the 64 sprite images. Each image is 256 bytes, one byte per pixel for the 16x16 sprite. Using the sprite palettes means that a single 256-byte sprite image can hold 1 256-color image, 2 16-color images or 4 4-color images.