Generic Tile Engine

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Generic Tile Engine
Developer(s) Lucas Scharenbroich
Preview release 1.0b5 / March 21, 2008 (2008-03-21)
Operating system GS/OS
Platform Apple IIGS
Type 2D engine
Website iigs.dreamhost.com

GTE (Generic Tile Engine) is a 2D tile engine developed for the Apple IIGS personal computer and written in 65816 assembly language.

History[edit]

The underlying technology was developed for a recreational port of Super Mario Bros for the Apple IIGS platform. At this point the engine only supported single-layer backgrounds, a single non-standard tile size and limited sprite support. After the release of the unfinished SMB GS, the core graphics engine was modularized and released as a GS/OS Tool Set.

Features[edit]

GTE provides graphical capabilities that lie roughly between the third and fourth generation of video game consoles. The technical capabilities of the engine are contrasted with the NES and SNES consoles, which share the same CPU family as the Apple IIGS

Name GTE Nintendo Entertainment System/Famicom Super Nintendo Entertainment System/Super Famicom
CPU 2.8 MHz 65c816 1.79 MHz 6502 3.58 MHz 65c816
Screen Resolution 320x200 256x240 256x224, 512x224, 256x239, 512x239; Interlaced: 512x448, 512x478
Simultaneous Colors 256 out of 4096 (16 per line) 25 out of 53 256 out of 32768 indexed, 11 bpp direct
Sprites 32, 32 max per line, any size up to 64 KiB per sprite 64, 8 max per line, 8x8 or 16x8 pixels 128, 32 max per line; up to 64x64 pixels
Tile Sizes 4x4, 8x8, 16x16 8x8 8x8, 8x16, 16x8, 16x16
Background Layers 2 planes plus 1 static background 1 plane 4 planes; each up to 1024 x 1024
Memory 8 MiB main RAM
32 KiB video RAM
48 KiB main RAM (+ bank switching)
2 KiB video RAM
128 KiB main RAM
64 KiB video RAM
64 KiB audio RAM
Effects
  • Per-pixel clipping masks for each plane
  • Overlay
  • Per-scanline offsets
  • Per-scanline palette binding
  • Per-scanline sprite enable/disable
  • Color emphasis
  • Pixelization (mosaic) per background
  • Color addition and subtraction
  • Clipping windows (per background, affecting color, math, or both)
  • Scrolling per 8x8 tile
  • Mode 7 matrix operations
Framerate (min/avg/max) 10/15/18
  • Based on a full-screen 320x200 plane
  • Smaller planes are faster
  • May be boosted by 3rd-party accelerators
30/60/60 30/60/60

Implementation[edit]

The memory bandwidth of the Apple IIGS is 1 MiB/s, which is too slow to update the 32 KiB graphics memory at a full 60 frames per second. In fact, the theoretical maximum frame rate for full-screen animation is 31.25 frames per second. Thus, GTE focuses on achieving a reasonable frame rate given the limitations of the hardware.

The tile engine achieves its speed by leveraging hardware-specific feature of the Apple IIGS platform as described in IIgs TN #70: Fast Graphics Hints to map the CPU stack to the RAM address of the graphics buffer and using specialized stack instructions to quickly copy graphics data to the screen. This technique is faster than a RAM-to-RAM copy because the hardware stack is automatically decremented after the data is pushed to memory.

Plane Buffers[edit]

Since the Apple IIGS does not support multiple graphics planes in hardware, this feature must be implemented in software.

Tiles[edit]

Tiles are stored internally as aligned bitmap images. A total of 64 KiB are available for tile storage and the total number of tiles are fixed at 256 regardless of the tile size (4x4, 8x8 or 16x16). Each tile consumes 256 bytes of RAM. 64 bytes are allocated for the tile data, a horizontally mirrored version of the tile and the corresponding masks. the image data are stored in sequential 16 KiB chunks of memory as given in the following memory map:

  • $0X00: Tile Data
  • $4X00: Horizontally Flipped Tile Data
  • $8X00: Tile Data Mask
  • $CX00: Horizontally Flipped Tile Data Mask

Sprites[edit]

External links[edit]