Hatris (NES):RAM map

From Data Crystal
Jump to: navigation, search

RAM Map

Address Size    Description
------- ----    -----------
0055       1    Number of falling hats: 02=1 hat, 03=2 hats
0080       2    Temporary subroutine return values; e.g. the 2 randomly generated hat results
0300       2    Frame counter, little-endian, involved in RNG
0304       1    RNG hat1, seeded to 3F
0305       1    RNG hat2, seeded to 85
030F       1    00=playing, FF=cut scene
0320       1    Current buttons pressed (standard controller)
0322       1    Flag that indicates current button press changed
03A0       1    Number of hats in hex up to 1D
03A8       2    SHOP, each byte a decimal digit, big-endian
03AA       1    Remaining hats, BCD
03C0       1    00=playing, FF=cash out screen
03D0       1    Falling hat1 type (0=none, 1=top, 2=wizard, 3=crown, 4=cap, 5=derby, 6=cowboy)
03D1       1    Next hat1 type (0=none, 1=top, 2=wizard, 3=crown, 4=cap, 5=derby, 6=cowboy)
03D2       1    Falling hat1 column (0--5)
03D3       1    Falling hat1 Y, counts down from 80 to 0
03D4       1    Falling hat1 sprite X (left=38, right=B0, increments by 18 pixels)
03D5       1    Hat1 is falling when 00, landed when FF
03D8       1    Falling hat2 type (0=none, 1=top, 2=wizard, 3=crown, 4=cap, 5=derby, 6=cowboy)
03D9       1    Next hat2 type (0=none, 1=top, 2=wizard, 3=crown, 4=cap, 5=derby, 6=cowboy)
03DA       1    Falling hat2 column (0--5)
03DB       1    Falling hat2 Y, counts down from 80 to 0
03DC       1    Falling hat2 sprite X (left=38, right=B0, increments by 18 pixels)
03DD       1    Hat2 is falling when 00, landed when FF
03E0       1    Fall speed (0=not falling, the higher the faster)
03E2       1    Incremented by 03E0 once per frame; when exceeds FF, drop happens
03E8       8    CASH (score), each byte a decimal digit, reverse order, top digit hidden (rolls over)
0510       1    Toggles from 1 to 0 durng spawn
0501       1    Alexey X-coordinate (column spaces 18 apart: 34, 4C, 64, 7C, 94; starts at 34)
0504       1    Alexey between columns space index (0--5; starts at 0)
0505       1    Alexey facing direction (0=right, 1=left; starts at 0) 
050E       1    Alexey number of hats removed (0--5)
0521       1    Vladimir X-coordinate (column spaces 18 apart: 34, 4C, 64, 7C, 94; starts at 34)  
0524       1    Vladimir between columns space index (0--5; starts at 0)
0525       1    Vladimir facing direction (0=right, 1=left; starts at 0)
052B       1    Vladimir carrying column index
052E       1    Vladimir carrying state (0=nothing, 1=holding stack, 2=dropped stack)
0540       8    Helpers stack (00=empty, 01=Alexey, FF=Vladimir; grows from 0540 to 0547)
0548       1    Size of helpers stack (number of helpers)
0551       1    Alexey counter (0--5), each represents 1/5th of an Alexey helper
0561       1    Vladimir counter (0--5), each represents 1/5th of a Vladimir helper
05A0       1    00=title screen / menus, 0F=paused, 3B=playing
07E8       1    00=cash out screen, FF=playing
7000      80    Playfield column 0 
7080      80    Playfield column 1 
7100      80    Playfield column 2 
7180      80    Playfield column 3 
7200      80    Playfield column 4 
7280      80    Playfield column 5
7C60      10    High score 0
7C70      10    High score 1
7C80      10    High score 2
7C90      10    High score 3
7CA0      10    High score 4
7CB0      10    High score 5
7CC0      10    High score 6
7CD0      10    High score 7
7CE0      10    High score 8
7CF0      10    High score 9

Hat Types

0 = none
1 = top
2 = wizard
3 = crown
4 = cap
5 = derby
6 = cowboy

Playfield in WRAM

The playfield is located in WRAM between $7000 and $72FF partitioned into six 128 byte stacks. Each stack has a capacity for 64 hats. Each stack entry is 2 bytes: (1) the height in pixels of the hat above the floor and (2) the hat type. Empty entries are denoted by 2 zeros, providing a means of measure stack size.

Although the playfield columns are primary treated as stacks, Alexey can pull hats from the bottom of a column. When this occurs, all entries shift down and all the height bytes are adjusted accordingly. As mentioned, the deleted top entry is marked as empty with 2 zeros. In other words, it's a stack that can potentially be dequeued from the bottom.


High Score Table in WRAM

The High Scores table is located in WRAM between $7C60 and $7CFF. Records are ordered by descending score values. Each of them has the following 16 byte structure:

00 00 00 II II II NN SH SL SS SS SS SS SS SS SS

NN - 00=Normal, FF=Turbo-speed mode
II - Letter of initials from left-to-right (01=A, 02=B, 03=C, ...)
SH - Shop high decimal digit
SL - Shop low decimal digit
SS - Decimal digit of score, big-endian

WRAM is volatile; scores are lost on power cycle.



Internal Data for Hatris (NES)

ROM MapRAM MapText TableNotesTutorials