Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Tetris (NES, Nintendo)/RAM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(Created page with '{| border="1" cellpadding="1" |'''RAM''' || '''Function''' || '''Details''' |- | 03F0 || Statistics Tile I - Ones || Decimal encoding of the 'ones' statistics for tile I |- | 03…')
 
(Moving contents of Tetris:RAM_map)
Line 1: Line 1:
{| border="1" cellpadding="1"
{{rammap|game=Tetris (NES)}}
|'''RAM'''  || '''Function''' || '''Details'''
 
{|
|0017||random seed
|-
|-
| 03F0 || Statistics Tile I - Ones || Decimal encoding of the 'ones' statistics for tile I
|0019||PieceID of last nextpiece generated by rng
|-
|-
| 03F1 || Statistics Tile I - Tens || Decimal encoding of the 'tens' statistics for tile I
|001A||number of pieces this poweron
|-
|-
| 03F2 || Statistics Tile II - Ones || Decimal encoding of the 'ones' statistics for tile II
|0033||spun on in wait4vbl loop at AA37
|-
|-
| 03F3 || Statistics Tile II - Tens || Decimal encoding of the 'tens' statistics for tile II
|0040-005F||same as 0060-007F for LAST frame?
|-
|-
| 03F4 || Statistics Tile III - Ones || Decimal encoding of the 'ones' statistics for tile III
|0060||cur piece x
|-
|-
| 03F5 || Statistics Tile III - Tens || Decimal encoding of the 'tens' statistics for tile III
|0061||cur piece y
|-
|-
| 03F6 || Statistics Tile IV - Ones || Decimal encoding of the 'ones' statistics for tile IV
|0062||cur PieceID
|-
|-
| 03F7 || Statistics Tile IV - Tens || Decimal encoding of the 'tens' statistics for tile IV
|0065||fall timer
|-
|-
| 03F8 || Statistics Tile V - Ones || Decimal encoding of the 'ones' statistics for tile V
|0066||left/right autorepeat timer
|-
|-
| 03F9 || Statistics Tile V - Tens || Decimal encoding of the 'tens' statistics for tile V
|0067||speed level
|-
|-
| 03FA || Statistics Tile VI - Ones || Decimal encoding of the 'ones' statistics for tile VI
|006A-006D||line numbers being cleared
|-
|-
| 03FB || Statistics Tile VI - Tens || Decimal encoding of the 'tens' statistics for tile VI
|006E||down autorepeat timer
|-
|-
| 03FC || Statistics Tile VII - Ones || Decimal encoding of the 'ones' statistics for tile VII
|006F||down hold timer (cleared to 0 on release)
|-
|-
| 03FD || Statistics Tile VII - Tens || Decimal encoding of the 'tens' statistics for tile VII
|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:<br>
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 [[Wikipedia:Tetromino|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.

Revision as of 20:44, 28 August 2011

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.