Language…
7 users online: BUX88, DanMario24YT, Golden Yoshi, Hidincuzimsmokin, Mario's GameBase, Shiki_Makiro, Zavok - Guests: 202 - Bots: 224
Users: 64,667 (2,404 active)
Latest user: DarthHylian

SM64 Memory Map

Displaying 50 out of 85 addresses.

View: moderated | waiting (9)

Filter

Link
  • Pages:
  • 1
  • 2
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.
  • Pages:
  • 1
  • 2