We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

SMW Resource Memory Map

From SnesLab
Revision as of 14:59, 2 October 2019 by Vitor Vilela (talk | contribs) (Fill the VRAM rearrangement patch with more accurate information)
Jump to: navigation, search

Organization comes later. Feel free to add major patches here as well.
Also feel free to suggest a good way to represent SA-1 addresses (if applicable).

Lunar Magic

Note about SA-1:

For addresses between $7E:0000-$7E:00FF, the SA-1 equivalent is $3000-$30FF (code bank). For addresses between $7E:0200-$7E:1FFF, the SA-1 equivalent is $6200-$7FFF (code bank) or $40:0200-$40:1FFF (absolute).

Any other address used by Lunar Magic does not have any SA-1 equivalent and must be manipulated by the SNES CPU.

RAM

Most of these addresses were acquired from Lunar Magic's help file and files floating around the internet.

Address Size LM Version Description
$7E:0BF5 1 byte Lunar Magic 3.00+ ExLevel flags (to be filled later).
$7E:0BF6 256 bytes Lunar Magic 3.00+ ExLevel RAM (to be filled later).
$7E:13D7 2 bytes Lunar Magic 3.00+ Screen vertical size.
$7E:1936 2 bytes Lunar Magic 3.00+ Screen vertical size - #$0010. Used only for adjusting smkdan's VRAM patch.
$7F:C004 1 byte Unknown Legacy ExAnimations frame counter. Used to be the frame counter for every ExAnimation slot, now it's only accurate for slots 0, 8, 10 and 18.
$7F:C060 16 bytes Unknown Conditional Direct Map16 flags.
$7F:C070 16 bytes Unknown Manual ExAnimation triggers.

Each byte corresponds to one manual ExAnimation slot. This block of RAM addresses isn't initialized unless you use the Trigger Init button in the ExAnimation dialog.

$7F:C080 32 bytes Unknown Level ExAnimations frame counter. Each byte corresponds to one slot.
$7F:C0A0 32 bytes Unknown Global ExAnimations frame counter. Each byte corresponds to one slot.
$7F:C0F8 4 bytes Lunar Magic 1.70+ One Shot Exanimation triggers.
$7F:C0FC 2 bytes Unknown Custom ExAnimation triggers.

Each bit corresponds to each custom ExAnimation slot. If a bit is on it means the trigger is enabled. This block of RAM addresses isn't initialized unless you use the Trigger Init button in the ExAnimation dialog.

$7F:C00B 2 bytes? Unknown Unknown purpose. Used in $0E:FD00 to perform a bit 2 check.
$7F:8183 422 bytes Lunar Magic 1.70+ Used for VRAM modification.
  • $7F:8185 holds a 16-bit value. Written to on $0FB054.
  • $7F:8327 is used on $0FB054 to store either 0x01B0 or 0x200. Maybe it's related to Layer 2 BG height?

ROM/Routines

SNES Address Description
$0FF900 GFX decompression routine.

It can't decompress GFX files 32 or 33.
On entry:

  • A should contain the 16-bit GFX/ExGFX file number you want to decompress.
  • $00-$02 should contain the 24-bit address of where to decompress the data to.

On exit:

  • Processor bits are preserved.
  • Contents of X are preserved.
  • Contents of Y are preserved.
  • A is not preserved.
$0EFD00 LM Routine? Does something related to Layer 2 tilemaps. Returns the value of $7E1928 in A.
$000000 To be edited later.

AddMusicK

RAM

Note: AddMusicK's RAM addresses ($7FB000-$7FB00A) are reset during the SPC Program upload.

Address Size Description
$7E1DFA 0x1 Command list.
  • $01 - Jump SFX. Sounds glitched due to it overwritting part of arpeggio's RAM with unexpected data. See L_0A14 for more details.
  • $02 - Turns on Yoshi Drums.
  • $03 - Turns off Yoshi Drums.
  • $04 - Grinder SFX. Potentially glitched.
  • $05 - Disables echo effect on SFXs.
  • $06 - Enables echo effect on SFXs.
  • $07 - Pauses music.
  • $08 - Unpauses music.
  • $09-$FE - Unused
  • $FF - Jumps to L_099C. It seems to prepare the SPC700 to receive data. Disables echo, sets delay to 0, turns off channels, resets the song number (SPC Output 2 = 0). Needs testing.
$7FB000 0x1 Current song playing.
$7FB001 0x1 Flag used to disable sample upload when switching to a new song.

Reset when a song finishes being uploaded to ARAM.

$7FB002 0x2 Unused. Meant to be:

ARAM/DSP Address.

  • To write to ARAM: Set $7FB002 to the address, and $7FB004 to the value to write. Note that the address cannot be $FFxx.
  • To write to the S-DSP: Set $7FB002 to the address, $7FB003 to #$FF, and $7FB004 to the value to write.
$7FB004 0x4 SPC Output.
  • $F4 $05 will reset $7FB004 and $7FB005.
  • $F9 $XX $YY will send $XX and $YY to $7FB004 and $7FB005 respectively. (Needs verification)
  • $7FB006 and $7FB007 are unused and most likely have garbage sent by the program.
$7FB008 0x1 Unused. Meant to have the same purpose as $7E0DDA.
$7FB009 0x1 Sample count in the current song.
$7FB00A 0x400 ARAM SRCN table.

Used as a buffer for the sample pointer/loop table. Could be up to 1024 bytes long, but this is unlikely (4 bytes per sample; do the math).

ROM/Routines

SNES Address Description
$008079 UploadSPCData.

This is an ever-so-slightly modified version of SMW's SPC upload routine. You can jump here at any time to upload data to the SPC.
Input:

  • $00-$02 - Address of the block to upload to ARAM
  • $03-$04 - Position in ARAM to jump to upon completion
  • $05-$06 - Clobbered. Unused on entry; will be the size of the transferred data when finished.
$008135 UploadSPCDataDynamic. This address needs to be checked.

This is an alternate version of the upload routine. Call this if it is impossible to determine ahead of time where data will go. This routine is used to upload samples by default, but it can upload anything.
Input:

  • $00-$02 - Address of the block to upload to ARAM
  • $03-$04 - Position in ARAM to jump to upon completion
  • $05-$06 - Size of the data to upload (this address is NOT clobbered).
  • $07-$08 - Address in ARAM to upload to (recommended to increment it by ($05) when you finish to upload consecutive data)

PIXI

RAM

Address Size Description
$000000 0x0 To be edited later.

ROM/Routines

SNES Address Description
$000000 To be edited later.

GPS

RAM

Address Size Description
$000000 0x0 To be edited later.

ROM/Routines

SNES Address Description
$000000 To be edited later.

Custom Powerups

RAM

Address Size Description
$7E2000 0x800 RAM with different purposes. Only uses 0x1D4 bytes at the moment.
$7E2800 0x2000 Reserved as a decompression buffer for the 5th tile GFX.
$7E4800 0x2000 Reserved as a decompression buffer for dynamic items GFX.
$7E6800 0x800 Reserved as a copy of the first 2KiB of the latest decompresed GFX file.
$7E7000 0xCFF Free to use.
$000000 0x0 To be edited later.

ROM/Routines

SNES Address Description
$000000 To be edited later.