Tetris (NES, Nintendo)/RAM map

From Data Crystal
< Tetris (NES, Nintendo)
Revision as of 20:44, 28 August 2011 by Alchemic (talk | contribs) (Moving contents of Tetris:RAM_map)
Jump to navigation Jump to search

Chip tiny.png The following article is a RAM map for Tetris (NES, Nintendo).

0017 random seed
0019 PieceID of last nextpiece generated by rng
001A number of pieces this poweron
0033 spun on in wait4vbl loop at AA37
0040-005F same as 0060-007F for LAST frame?
0060 cur piece x
0061 cur piece y
0062 cur PieceID
0065 fall timer
0066 left/right autorepeat timer
0067 speed level
006A-006D line numbers being cleared
006E down autorepeat timer
006F down hold timer (cleared to 0 on release)
0070-0071 number of lines (BCD little endian)
0073-0075 score (little endian bcd)
0072 line clear animation counter
0076 number of lines being cleared
0077 spawn delay counter
0078 game over animation (negative: delay; $00: top; $14: finish)
0079 B-type height level
00A8 copyright notice autoadvance time left
00AC same as 0062 for collision?
00AD Playfield base address of current piece for collision?
00AE Y position of current piece in spritespace
00B1-00B2 demo time:

00B2 set to 0 when title screen appears; goes to demo at 00B5 = 5

00BF PieceID of next piece
00C1 game type (marathon = 0, 25lines = 1)
00C2 music type (sugarplum = 0, off = 3)
00C3 copyright notice unskippable time left
00F5 controller 1 newly pressed buttons
00F7 controller 1 state (0x80 = A pressed, 0x40 = B pressed...)
00FC vertical scroll (conjecture based on code at $80C5)
00FD horizontal scroll (conjecture based on code at $80C5)
00FE PPUMASK value
00FF PPUCTRL value
0200 Copy of OAM
03F0-03F1 number of T tetrominoes dealt (little endian BCD)
03F2-03F3 number of J tetrominoes dealt
03F4-03F5 number of Z tetrominoes dealt
03F6-03F7 number of O tetrominoes dealt
03F8-03F9 number of S tetrominoes dealt
03FA-03FB number of L tetrominoes dealt
03FC-03FD number of I tetrominoes dealt
0400-0409 Row $00 (top of playfield)
040A-0413 Row $01
04BE-04C7 Row $13 (bottom)
0680-06CF Music related
06D0-06FF Sound effects related
0700-075x high score tables
0718-071D B-type top name
071E-0723 B-type second name
0724-0729 B-type third name

PieceID

A PieceID is a number representing both a tetromino and an orientation. For instance, $11 is a I up and down, and $12 is an I across. Tetrominoes S, Z, and I have two PieceIDs; O has only one. The others have four. Because the PieceID table is "optimized" in this way, it'll take more extensive asm hacking to get Bombliss or Tetris DS rotation in.

The next piece is stored at $00BF. Poking a value into $00BF that's a valid PieceID but is not the starting orientation for that tetromino results in the next piece being drawn as a solid (not textured) O tetromino, but the next piece is dealt in the proper starting orientation.

Copy of OAM

At $0200 is a copy of OAM, the display list. Usually the falling piece occupies $0200-$020F, and the next piece occupies $0210-$021F.