(back to project page)

Battlezone Objects

The object definition table has 44 entries, two of which are empty.

Objects, by Index

Index Img Name Notes
$00 u00 Narrow pyramid
$01 u01 Tall box
$02 u02 Slow Tank
$03 u03 ProjectileCannon shell
$04 u04 Rear tread #0Tank tread on Slow Tank
$05 u05 Rear tread #1
$06 u06 Rear tread #2
$07 u07 Rear tread #3
$08 u08 Front tread #0
$09 u09 Front tread #1
$0a u0a Front tread #2
$0b u0b Front tread #3
$0c u0c Wide pyramid
$0d u0d Radar dishPlaced on Slow Tank; rotates
$0e u0e Projectile explosionSingle vertex; uses special draw command
$0f u0f Short box
$10 u10 Chunk #0 (tank)
$11 u11 Chunk #1 (tank)
$12 u12 Chunk #2 (tank)
$13 u13 Radar (tank chunk)(same as $0d)
Super Tank gets an extra $14 instead
$14 u14 Chunk #1 (tank)(same as $11)
$15 u15 Chunk #0 (tank)(same as $10)
$16 u16 Missile
$17 u17 Logo "Ba"Pre-tilted
$18 u18 Chunk #1 (missile)(same as $11)
$19 u19 Chunk #4 (missile)
$1a u1a Chunk #0 (missile)(same as $10)
$1b u1b Chunk #5 (missile)
$1c u1c Chunk #0 (missile)(same as $10)
$1d u1d Chunk #4 (missile)(same as $19)
$1e u1e Logo "ttle"
$1f u1f Logo "Zone"
$20 u20 Saucer
$21 u21 Super Tank
$22 (empty slot)
$23 (empty slot)
$24 u24 Spatter #0Drops from missiles
$25 u25 Spatter #1
$26 u26 Spatter #2
$27 u27 Spatter #3
$28 u28 Spatter #4
$29 u29 Spatter #5
$2a u2a Spatter #6
$2b u00 Spatter #7

The numbering may seem a bit haphazard at first, but there is some method to the madness. Note in particular that the shapes from $10-1f are the only ones that can appear above ground level. A set of 8 height values is used for objects with types $10-17 and $18-1f. Since we don't show tank chunks and missile chunks at the same time, and explosions have exactly one of each object type, they don't conflict. The only time objects from both sets are on-screen at the same time is for the logo, but the three parts of the logo are drawn from a common center point, and we don't show a missile while we're showing the logo. Note also that we can specify the altitude of the logo chunks by setting only two values, since "Ba" and "Zone" use the same value.

Shapes can only rotate about the Y axis. The tank turret chunk and logo pieces are pre-rotated in the shape definition. (If you rotate the logo 76 degrees about the X axis it will face squarely toward the viewer.)

Data Format

Objects are defined in two parts: a list of vertices, and a list of drawing commands. Drawing commands are used in place of a simple list of edges to optimize the beam movement.

A table of vertex data addresses starts at $388e, followed by the vertex data itself. Note this is in the AVG ROM. Only the vertex data for the logo pieces is in the game ROM address space. The format is straightforward: a data length byte, followed by 16-bit X/Y/Z coordinates. There's a bit of weirdness in terms of how the axes are defined, and the X/Z coordinates are doubled to make the math box calculations come out right, but no special encoding is used for the numbers.

The drawing commands are a little more complicated. The table of shape command addresses starts at $7472, and the drawing code is at $5c5c. Each byte has a 3-bit command and a 5-bit vertex index. (Note this limits objects to 32 vertices; the vertex transform code further limits it to 26.)

The commands are:

  1. draw point at vertex
  2. set intensity with vertex index value (overridden for saucer/logo)
  3. move without drawing
  4. move to center of screen, then move without drawing
  5. draw to vertex with intensity=1 (h/w uses intensity from STAT)
  6. draws scaled AVG commands from $347a (for projectile explosion)
  7. no-op

The drawing code generates screen X/Y coordinates for all vertices. The drawing commands generally start with command 3 (move to center then move to vertex); after that, it's necessary to subtract vertex coordinates to generate the relative motion required for AVG.

Command #5 is used exclusively for the projectile explosion. Shape $0e is an object with a single vertex. The vertex is transformed like any other shape, which provides the center point for the explosion. The explosion particles are rendered with AVG commands, scaled by distance. This approach is less expensive than the similar effect used for the missile splatter.

Visible Object List

Each game frame, the game generates a list of visible objects at $200 and displays them ($5946). The process works like this:


Copyright 2020 by Andy McFadden