Language…
19 users online: 1337doom, AbuseFreakHacker,  Ahrion,  AmperSam, Beed28, ben15420, Doopu, Gorry, Green, Mecke1990, OrangeBronzeDaisy, Pink Gold Peach, playagmes169, rafaelfutbal, signature_steve, Skewer, TrashCity, wye,  YouFailMe - Guests: 279 - Bots: 343
Users: 64,795 (2,370 active)
Latest user: mathew

SM64 Memory Map

Displaying 85 out of 85 addresses.

View: moderated | waiting (9)

Filter

Link
  • Pages:
  • 1
RAM Address Length Type Context Description Details
$80064F80 Unknown Misc. Global Segment 0x02 constant location - Contains image data for the hud symbols and other textures. The segment is allocated by a hardcoded routine on startup.
$8006C680 Unknown Misc. Global Table with segment-offset pointers to the HUD symbol textures. Since some of the HUD symbols were removed in the USA release, some of the slots are left empty:

8006C6CC 00000000 - J
8006C6E8 00000000 - Q
8006C6FC 00000000 - V
8006C704 00000000 - X
8006C70C 00000000 - Z

You can restore the old symbols by patching in the images from the Japanese ROM, and modifying the pointers in this table.
$8007E200 Unknown Misc. Global Segment 0x15
$8007EC20 Unknown Misc. Global Segment 0x04 - Contains the data for Mario's model
$800EB180 Unknown Misc. Global Segment 0x13 - Behavior script segment
$800EC5F8 52 bytes Behaviour Global Behavior script - Purple switch
$800ED3FC 32 bytes Behaviour Global Behavior script - Spinning exclamation point
$800EDBC8 12 bytes Behaviour Global Behavior script - Misc level architecture (eg the castle tower)
$800EDC24 44 bytes Behaviour Global Tree's behavior script
$800EE040 56 bytes Behaviour Global Mario's behavior script

00000000
10050000
11010100
11030001
23000000 002500A0
08000000
0C000000 802CB1C0
0C000000 8029CA58
0C000000 802CB264
09000000
$800EE2F4 56 bytes Behaviour Global Bob-omb's behavior script
$800F0860 Unknown Geometry Layout Global Mario's decompressed geo-layout script
$800F8C4C Unknown Geometry Layout Global Decompressed geo-layout script for signs
$8018D47C 554 bytes Geometry Layout Global Bob-omb's decompressed geo-layout
$80195C54 Unknown Geometry Layout Overworld Decompressed geo-layout script for the castle tower
$801C1000 Unknown Misc. Global Segment 0x09 constant location. All level mesh textures are loaded here by the 0x1A level script command.
$80207700 512 bytes Misc. Global Start of EEPROM and goes up to 0x80207900
$80277EE0 Unknown Routine Global Function that assigns ram segments

Arguments: A0 = segment number, A1 = ram address
Returns: V0 = 0x80-prefix-less ram address

Essentially just: *(uint32*)(0x8033B400 + segment_number << 2) = ram_address & 0x00FFFFFF;
$80277F50 Unknown Routine Global Segment-offset to true ram address converter
Arguments: A0 = segmented address
Returns: V0 = true ram address
$80278120 118 bytes Routine Global Function that seems to be a memory allocator. Basically finds a desired amount of free space in the heap and returns a pointer to the area.

Arguments: A0 = block size
Returns: V0 = ram address
$80278504 264 bytes Routine Global DmaCopy(u32 dst, u32 bottom, u32 top);
dst being the RAM offset! bottom is the beginning ROM offset to copy the bytes and top is the end.
Takes three arguments.

Example:
ADDIU SP, SP, $FFE8 ; -24 to stack. Aka, make space.
SW RA, $0014 (SP) ; Push return address to stack.
LUI A0, $8034 ; Upper half address.
ORI A0, A0, $269D ; Lower half address. A0 = $8034269D
LUI A1, $001C ; ROM offset start (bottom)
ORI A1, $0D60 ; Lower part, A1 = $001C0D60
LUI A2, $0020 ; ROM offset end (top)
JAL $80278504 ; Jump to subroutine DmaCopy
ORI A2, $00D1 ; Is executed before JAL. Lower half.
LW RA, $0014 (SP) ; Load back our lost return address.
JR RA ; Jump to return address.
ADDIU SP, SP, $0018 ; Restores stack. (+24)

DmaCopy basically copies data from ROM to RAM. dst is the destination (as RAM offset), bottom is the start (as ROM offset) which is copied to RAM and top is the end. So, in our above example bytes from $001C0D60 (ROM) to $002000D1 (ROM) into $8034269D (RAM).
$80278610 124 bytes Routine Global Function that loads data from rom into the heap and returns a ram pointer to the data.

Arguments: A0 = rom start address, A1 = rom end address, A2 = allocation size (seems mostly unused?)
Returns: V0 = pointer to data after being loaded into ram
$802787D8 216 bytes Routine Global Function that loads MIO0 files into ram segments.
Arguments: A0 = ram segment number, A1 = rom address start, A2 = rom address end
$802792C0 84 bytes Routine Global EEPROM Save file checksum calculation routine
Arguments: A0 = address of buffer, A1 = buffer size, A2 = ? 00004441
Returns: 2 byte checksum to V0
$8027F4E0 164 bytes Routine Global MIO0 decoder
Arguments: A0 = pointer to mio0 file (in RAM), A1 = destination address for the decompressed file
$8029E27C Unknown Routine Global Distance From Object: Calculates the distance of 2 objects

Arguments: A0 = object 1 ptr, A1 = object 2 ptr
Returns: F0 = distance between objects (float)

This function only checks the X and Z positions of the two objects. The Y position is not taken into account.
$8029EDCC 88 bytes Routine Global Function that spawns an object at another object's location

Arguments: A0 = pointer to relative object, A1 = graphics id, A2 = behavior segment offset
Returns: V0 = pointer to the newly spawned object
$802A3754 68 bytes Routine Global IsMarioGroundPounding function

Detects if Mario is ground-pounding the current object.

No parameters. Returns V0 = 1 if true, and V0 = 0 if false.
$802A3CFC 56 bytes Routine Global IsMarioStepping function

This function detects if Mario is on-top of the current object. This function is used in many places like in the cap switches.

Takes no parameters.

Returns V0 = 1 if Mario is stepping on the object, otherwise V0 will return 0.
$802D62D8 Unknown Routine Global Hud number printing function

Arguments: A0 = x, A1 = y, A2 = pointer to ascii format string, A3 = number value

The format string argument is very similar to the one used in C's 'printf' function.
http://www.cplusplus.com/reference/cstdio/printf/
$802D6554 Unknown Routine Global HUD Symbol printing function - Prints an ascii string to the screen.
Arguments: A0 = int x, A1 = int y, A2 = pointer to ascii string
$802D6858 56 bytes Routine Global Function that converts ascii chars to sm64 chars.

Arguments: A0 = ascii byte
Returns: V0 = sm64 byte
$802DB498 584 bytes Routine Global Function that prints animated red coins to the screen

Arguments: A0 = x, A1 = y
$802E2CF0 160 bytes Routine Global Function that prints the camera images in the bottom right corner of the screen. (The lakitu, camera, mario, and X symbols)

Arguments: A0 = int x, A1 = int y, A2 = segment-offset to raw image data
$802E2E58 258 bytes Routine Global Function that prints the little yellow C button symbols when zooming in and out
Arguments: A0 = int left, A1 = int bottom, A2 = segment offset pointer to raw image
$802E6AF8 Unknown Routine Global Object behavior function - explode! (and spawn a coin)
Args: none
Returns: none
$802F3C9F 1 byte Misc. Global 1UP Modifier, change 0x01 to value of lives you want Mario to get when collecting a 1UP.
$803223B0 220 bytes Routine Global OSTime osGetTime(void);
void osSetTime(OSTime time);

Calling the osGetTime function returns the time since the last cold reset, expressed in units of CPU count register cycles. Regardless of whether the system is NTSC or PAL, this counter increments at 46.875 MHz, with 1 cycle equal to approximately 21.33 nanoseconds. When the counter reaches its maximum value, it returns to zero and continues to increment. (Since the real time counter has a length of 64 bits, unless the counter value is changed by calling osSetTime it will take more than 10,000 years for the counter to reach its maximum value and return to zero.)

The osSetTime function is used to set the value of the real time counter.

Note that the OSTime type is defined as u64 (unsigned long long), so you should specify "%llu" for the conversion format if you are going to output this type of numerical value with a printf function.

**Note**:
Since the VI Manager performs timer management, you must activate the VI Manager with osCreateViManager before using this function.
$80322640 100 bytes Routine Global void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);

Arguments

mq
Message queue address (0x8033AF78)
msg
Message announced when vertical retrace occurs
retraceCount
Retrace count

This function registers the specified message queue and message in the VI manager. The program can thus receive the message (msg) announced by the message queue (mq)) from the VI manager when a vertical retrace occurs. The send cycle for the message is changed according to the value set in the retrace count (retraceCount). For instance, while the cycle is 60Hz when this is set to 1, it becomes a low speed 30Hz when it is set to 2, decreasing the frequency at which the application receives the vertical retrace announcement (message send cycle = 60Hz/retrace count).

Return Values
None.

##Precautions##
Execute this function after setting the display mode (see osViSetMode).
$80322F70 380 bytes Routine Global void osCreateViManager(OSPri pri);

The VI manager is a system thread that must be created and invoked at the beginning of the application. To do this, call osCreateViManager() for the VI manager to allow vertical retrace interrupt to occur at an early stage. Usually, this priority should be set to OS_PRIORITY_VIMGR. The VI manager is designed to service both the VI interrupt (OS_EVENT_VI) and CPU counter interrupt(OS_EVENT_COUNTER) in the most efficient manner. Each interrupting event can be performed using osViSetEvent or osSetTimer.

Return Values:
None.
$803232D0 96 bytes Routine Global void osViSetMode(OSViMode *mode);

Arguments

mode
VI mode

This function lets you set the current VI Mode. It supports a total of 56 modes, those break down in 14 NTSC modes, 14 PAL modes, 14 MPAL modes and 14 full-screen display PAL (FPAL) modes. The attributes of each mode, such as interlace and non-interlace, 16-bit color pixels and 32-bit color pixels, low-resolution and high-resolution, etc., can be set. In addition, the resolution can be dropped or images can be rescaled in order to increase rendering speed.
The last 4 characters of the symbol name (LPN1, etc.) comprise the following codes.

1st character:
H = High resolution
L = Low resolution

2nd Character:
A = Anti-aliasing
P = Point sampling

3rd Character
Low resolution N = Non-interlaced
F = Interlaced

High resolution N = Normal interlaced
F = Deflickered interlaced

4th Character 1 = 16-bit pixel size
2 = 32-bit pixel size

(Modes have yet to be found in the ROM)
$803233B0 432 bytes Routine Global void osViSetSpecialFeatures(u32 func);

Sets special VI functions.

Argument

func
Turn special VI function ON/OFF:

OS_VI_GAMMA_ON 0x0001 (Default: ON)
OS_VI_GAMMA_OFF 0x0002
OS_VI_GAMMA_DITHER_ON 0x0004 (Default: ON)
OS_VI_GAMMA_DITHER_OFF 0x0008
OS_VI_DIVOT_ON 0x0010 (Default: ON)
OS_VI_DIVOT_OFF 0x0020
OS_VI_DITHER_FILTER_ON 0x0040 (16bit-default): ON
OS_VI_DITHER_FILTER_OFF 0x0080 (32bit-default): OFF

##Precautions##
osViSetMode returns all of the function settings set with osViSetSpecialFeatures to their default values according to the display mode specified in the argument.
$80325310 Unknown Misc. Global Cosine function

Arguments: F12 = input angle (in radians)
Returns: F0 = resulting value
$80325480 Unknown Routine Global Sine function

Arguments: F12 = input angle (in radians)
Returns: F0 = resulting value
$803273F0 40 bytes Routine Global memcpy(u32 dst, u32 src, u32 num);

Copies bytes in the RAM from one location to another.

Arguments:
A0 = Pointer to RAM destination to copy to.
A1 = Pointer to RAM source to copy from.
A2 = Number of bytes to copy.

Returns:
V0 = Pointer to RAM desitination
$8032741C 36 bytes Routine Global strlen (char * str)

Gets the length of an ascii string.

A0 = pointer to string
V0 = length of string

Example: "Hello World!" would return 12.
$80327444 60 bytes Routine Global strchr (char * str, u8 character);

returns a pointer to the first instance of 'character'

A0 = pointer to string
A1 = ASCII character to be located.
V0 = pointer to the first occurrence. If no matching character was found, then V0 will return 0.

Example:
A0 = "Hello World!"
A1 = 0x57 ('W')

will return "World!"
$803284B0 224 bytes Routine Global Function used to load sounds and Mario's animation sequences into ram on the fly.

Args:A0 = (always 0?), A1 = rom address, A2 = destination ram address, A3 = block size
Returns: V0 = 0 (success); V0 = -1 (fail)
$8032D5E4 4 bytes Pointer Global Pointer that contains the pointer to the first controller structure.
$8032DDCC 4 bytes Pointer Global Pointer to the current area struct pointer.
$8032DF00 4 bytes Misc. Global Pointer to current object as used by the geo-layout script rendering system. An ASM routine reads the object pointer at this address, and then writes the pointer into a geo-layout's object pointer slot.
$80331620 1 byte Misc. Global Current level's act number
$80338388 2 bytes Misc. Global Format string for number of lives in the HUD - "%d"
$803383A0 2 bytes Misc. Global Format string for the number of stars in the HUD
$803383A4 1 byte Misc. Global Format string for HUD beta keys; "/" or 0x2F
$8033B079 1 byte Misc. Global Result of function osEepromProbe(). Read this byte to check if the eeprom has been loaded properly. This value should be 0x01.

0x00 = No eeprom loaded
0x01 = 4K-EEPROM loaded
0x02 = 16K-EEPROM loaded
$8033B176 2 bytes Misc. Global Mario hat flags
$8033B17C 4 bytes Misc. Global Mario's current action
$8033B17C 4 bytes Misc. Global Mario's previous action
$8033B188 2 bytes Misc. Global Mario's animation phase (unsigned short int)
$8033B18A 2 bytes Misc. Global Mario's animation cycle counter. Game also uses this to determine how sleepy Mario is.
$8033B218 2 bytes Misc. Global Mario's current coins.
$8033B21C 1 byte Misc. Global Number of beta keys
$8033B21D 1 byte Misc. Global Number of lives
$8033B21E 2 bytes Misc. Global Mario's power - upper byte is the value and the lower byte works like a decimal.
$8033B220 1 byte Misc. Global Mario Y offset from the ground (signed char)
$8033B222 1 byte Misc. Global Amount of time to apply 'hurting' effect to Mario's power
$8033B223 1 byte Misc. Global Amount of time to apply 'healing' effect to Mario's power (unsigned char)
$8033B226 2 bytes Misc. Global Displayed power number (signed short int)
$8033B264 2 bytes Misc. Global Number for displayed stars (signed short int aka Halfword).
$8033B400 128 bytes Misc. Global The segments table - Segment descriptions:
0x00 Miscellaneous, Constant 0

Graphics segments:
0x01 Master display lists?
0x02 Textures which are always available
0x03 ?
0x04 Mario graphics (geo+textures)
0x05
0x06
0x07
0x08 Object textures
0x09 Level mesh textures
0x0A
0x0B
0x0D
0x0E
0x0F

General purpose segments:
0x10
0x11
0x12
0x13 Behavior script bank
0x14 Level scripts
0x15 Level scripts
0x16 Geo layouts (pre-decompression)
0x17 Geo layouts (pre-decompression)
0x18 ? (points to nothing)
0x19 Unused
0x1A Unused
0x1B Unused
0x1C Unused
0x1D Unused
0x1E Unused
0x1F Unused
$8033C600 4 bytes Misc. Global Pointer to current collision triangle that mario is standing on/above
$8033D488 145920 bytes Misc. Global Level object linked list - 240 slots for level object structs, each of which are 0x260 bytes. (Goombas, Toads, Signs, Mario, etc)

Struct offsets: (Not completely accurate)
003 Camera relativity
004 Pointer to previous object
008 Pointer to next object
00C Pointer to ?? (some type of schema? Data has a pointer to mario's object in it)
014 Pointer to model layout script
020 X position (copy)
024 Y position (copy)
028 Z position (copy)
03C Pointer to animation data
054 X rotation
058 Y rotation
05C Z rotation
060 Pointer to an object (?)
064 Pointer to list of objects (?)
068 Pointer to ?? (self when mario's object)
070 Interaction from colliding object
074 ?
075 Object link status?
076 Collision with object status
078 Pointer to an object (?) (usually Mario's)
07C Pointer to an object (?)
0A0 X position
0A4 Y position
0A8 Z position
0AC X momentum
0B0 Y momentum
0B4 Z momentum
0F0 Model layout script case parameter
120 Segmented pointer to animation data (?)
130 Interaction
144 Interaction index (dialogue and spawn table indexes)
154 Frame counter
164 X position anchor
168 Y position anchor
16C Z position anchor
17C Model transparency
180 Interaction parameter (number of coins, damage dealt)
188 Interaction parameter ? (door warps)
19C Render distance
1C0 Pointer to level collision data that the object is standing on
1CC Pointer to behavior script (active)
1D0 Pointer to behavior script (active)
1F8 Collision sphere width
1FC Collision sphere height
20C Pointer to behavior script (initial)
21C Pointer to collision polygon
25C Pointer to model script table?
$80361150 4 bytes Pointer Global Pointer to next empty object for the game to use (behavior script engine variable)
$80361158 4 bytes Pointer Global Another pointer to the current Mario object (behavior script engine variable)
$80361160 4 bytes Pointer Global Pointer to current object as used by the behavior processing system.
All behavior ASM routines use the pointer at this address + struct offsets to make changes to level objects.
Refer to the Level object linked list for a list of struct offsets.
$80361164 4 bytes Pointer Global Pointer to the current behavior script command that the game is processing
$80361170 4 bytes Misc. Global Current # of triangles in the collision map. (static collision + collision created by objects)
$80361178 4 bytes Misc. Global Number of triangles in static collision map.
$80361184 4 bytes Pointer Global Pointer to current level's water settings
$8038B8B0 240 bytes Pointer Global The level script jump table; a list of pointers to level script command functions:
0x00 8037E2C4
0x01 8037E388
0x02 8037E404
0x03 8037E47C
0x04 8037E4FC
0x05 8037E580
0x06 8037E5B8
0x07 8037E620
0x08 8037E650
0x09 8037E6D4
0x0A 8037E780
0x0B 8037E7F8
0x0C 8037E878
0x0D 8037E8E8
0x0E 8037E988
0x0F 8037EA18
0x10 8037EA70
0x11 8037EA98
0x12 8037EB04
0x13 8037EB98
0x14 8037EBD4
0x15 8037EC14
0x16 8037EC54
0x17 8037ECA4
0x18 8037ECF8
0x19 8037ED48
0x1A 8037EDF8
0x1B 8037EE48
0x1C 8037EEA8
0x1D 8037EF00
0x1E 8037EF70
0x1F 8037F010
0x20 8037F130
0x21 8037F164
0x22 8037F214
0x23 8037F2A4
0x24 8037F45C
0x25 8037F36C
0x26 8037F67C
0x27 8037F994
0x28 8037F790
0x29 80380014
0x2A 8038007C
0x2B 803800BC
0x2C 80380160
0x2D 803801A0
0x2E 8037FE94
0x2F 8037FF14
0x30 80380274
0x31 8037F920
0x32 8038024C
0x33 803801E0
0x34 8037FDE4
0x35 8037FE2C
0x36 80380300
0x37 8038039C
0x38 803803EC
0x39 8037FF94
0x3A 8037FB18
0x3B 8037FC38
0x3C 80380434
$8038B9B0 220 bytes Pointer Global The behavior script jump table; a list of pointers to behavior script command functions:
0x00 803854CC
0x01 8038425C
0x02 803841B8
0x03 80384224
0x04 8038438C
0x05 80384450
0x06 803844C0
0x07 80384554
0x08 803845E8
0x09 80384634
0x0A 80384188
0x0B 803841A0
0x0C 80384678
0x0D 80384C5C
0x0E 803846D0
0x0F 80384CF0
0x10 8038475C
0x11 80384D70
0x12 80384E04
0x13 803849F8
0x14 80384854
0x15 80384928
0x16 80384AB4
0x17 80384B90
0x18 8038503C
0x19 803850CC
0x1A 80385084
0x1B 80383F24
0x1C 80383F94
0x1D 80384164
0x1E 80384F8C
0x1F 80385114
0x20 803851D0
0x21 80383EE4
0x22 80383E5C
0x23 8038528C
0x24 8038546C
0x25 803842E4
0x26 803843E0
0x27 80384E9C
0x28 80384F08
0x29 803840B4
0x2A 803856A0
0x2B 803853AC
0x2C 8038401C
0x2D 80385700
0x2E 8038531C
0x2F 8038575C
0x30 8038586C
0x31 803857A0
0x32 803857E4
0x33 80385A60
0x34 80385B4C
0x35 80383EA0
0x36 803847D4
0x37 80385AF0
$8038BE28 4 bytes Pointer Global Pointer to the current level script command that the game is processing.
$8038EEA0 2 bytes Misc. Global Max number of triangles for collision map. 2,300 in vanilla SM64 and increased to 32,767 by the SM64 Editor. Set by function 0x80383340
$8038F800 460800 bytes Misc. Global The Framebuffer. Occupies the range starting from $8038F800 to $803FFFFF. This region is constantly being overwritten, so you cannot modify any of the data directly.
  • Pages:
  • 1