Module earthbound.bank00

low level stuff, ActionScript, overworld code

Functions

NameDescription
actionScriptBackupPosition() $C0D7B3
actionScriptCommand00(y) ActionScript command 00 - End
actionScriptCommand01(y) ActionScript command 01 - Loop XX times
actionScriptCommand0124Common(a, x, y) Common code for ActionScript commands 01 and 24
actionScriptCommand02(y) ActionScript command 02 - Loop End
actionScriptCommand03(y) ActionScript command 03 - Long Jump
actionScriptCommand04(y) ActionScript command 04 - Long Call
actionScriptCommand05(y) ActionScript command 05 - Long Return
actionScriptCommand06(y) ActionScript command 06 - Pause XX frames
actionScriptCommand07(y) ActionScript command 07 - Start task
actionScriptCommand08(y) ActionScript command 08 - Set tick callback
actionScriptCommand09(y) ActionScript command 09 - Halt
actionScriptCommand0A(y) ActionScript command 0A - Jump if temp var is false
actionScriptCommand0B(y) ActionScript command 0B - Jump if temp var is true
actionScriptCommand0C(y) ActionScript command 0C - End task
actionScriptCommand0C13Common(y) Common code for ActionScript commands 0C and 13
actionScriptCommand0D(y) ActionScript command 0D - Perform binary operation on RAM address
actionScriptCommand0D14Common(a, y) Common code for ActionScript commands 0D and 14
actionScriptCommand0D27Common(a, y) Common code for ActionScript commands 0D, 14 and 27
actionScriptCommand0E(y) ActionScript command 0E - Set var
actionScriptCommand0F(y) ActionScript command 0F - Clear tick callback
actionScriptCommand10(y) ActionScript command 10 - Jump to Xth pointer
actionScriptCommand11(y) ActionScript command 11 - Call Xth pointer
actionScriptCommand12(y) Actionscript command 12 - Write XX to memory
actionScriptCommand13(y) ActionScript command 13 - End last task
actionScriptCommand14(y) ActionScript command 14 - Perform binary operation on entity var
actionScriptCommand15(y) Actionscript command 15 - Write XXXX to memory
actionScriptCommand16(y) ActionScript command 16 - Break if false
actionScriptCommand17(y) ActionScript command 17 - Break if true
actionScriptCommand18(y) ActionScript command 18 - Perform 8-bit binary operation on RAM address
actionScriptCommand19(y) ActionScript command 19 - Short Jump
actionScriptCommand1A(y) ActionScript command 1A - Short Call
actionScriptCommand1B(y) ActionScript command 1B - Short Return
actionScriptCommand1C(y) ActionScript command 1C - Set Spritemap
actionScriptCommand1D(y) ActionScript command 1D - Write word to tempvar
actionScriptCommand1E(y) ActionScript command 1E - Write data at address to tempvar
actionScriptCommand1F(y) ActionScript command 1F - Write tempvar to var
actionScriptCommand20(y) ActionScript command 20 - Write var to tempvar
actionScriptCommand21(y) ActionScript command 21 - Sleep for var XX frames
actionScriptCommand22(y) ActionScript command 22 - Set Draw Callback
actionScriptCommand23(y) ActionScript command 23 - Set Position Change Callback
actionScriptCommand24(y) ActionScript command 24 - Loop (Tempvar)
actionScriptCommand25(y) ActionScript command 25 - Set Physics Callback
actionScriptCommand26(y) ActionScript command 26 - Set Animation Frame to Var XX
actionScriptCommand27(y) ActionScript command 27 - Perform binary operation on temp var
actionScriptCommand28(y) ActionScript command 28 - Set X position
actionScriptCommand29(y) ActionScript command 29 - Set Y position
actionScriptCommand2A(y) ActionScript command 2A - Set Z position
actionScriptCommand2B(y) ActionScript command 2B - Set relative X position
actionScriptCommand2C(y) ActionScript command 2C - Set relative Y position
actionScriptCommand2D(y) ActionScript command 2D - Set relative Z position
actionScriptCommand2E(y) ActionScript command 2E - Set relative X velocity
actionScriptCommand2F(y) ActionScript command 2F - Set relative Z velocity
actionScriptCommand30(y) ActionScript command 30 - Set relative Z velocity
actionScriptCommand31(y) ActionScript command 31 - Set background horizontal offset
actionScriptCommand32(y) ActionScript command 32 - Set background vertical offset
actionScriptCommand33(y) ActionScript command 33 - Set background horizontal velocity
actionScriptCommand34(y) ActionScript command 34 - Set background vertical velocity
actionScriptCommand35(y) ActionScript command 35 - Increase background horizontal velocity
actionScriptCommand36(y) ActionScript command 36 - Increase background vertical velocity
actionScriptCommand37(y) ActionScript command 37 - Set relative background horizontal offset
actionScriptCommand38(y) ActionScript command 38 - Set relative background vertical offset
actionScriptCommand39(y) ActionScript command 39 - Reset velocities
actionScriptCommand3A(y) ActionScript command 3A - Reset horizontal and vertical background velocity
actionScriptCommand3B45(y) ActionScript command 3B/45 - Set Animation Frame
actionScriptCommand3C46(y) ActionScript command 3C/46 - Next animation frame
actionScriptCommand3D47(y) ActionScript command 3D/47 - Previous animation frame
actionScriptCommand3E48(y) ActionScript command 3E/48 - Skip N animation frames
actionScriptCommand3F49(y) ActionScript command 3F/49 - Set Z velocity
actionScriptCommand404A(y) ActionScript command 40/4A - Set Z velocity
actionScriptCommand414B(y) ActionScript command 41/4B - Set Z velocity
actionScriptCommand424C(y) ActionScript command 42/4C - Call function
actionScriptCommand43(y) ActionScript command 43 - Set draw priority
actionScriptCommand44(y) ActionScript command 44 - Sleep for $tempvar frames
actionScriptCopyAdjustedXYToVars(__param_0, arg2) $C0A8B3
actionScriptCreateEntityAtV01PlusBG3Y(__param_0, arg2) $C0A99F
actionScriptCreateTitleScreenEntity(__param_0, arg2) Creates an entity for the title screen. The entities will not be created with valid X, Y coordinates, so their scripts must handle initial positioning.
actionScriptDisplayTextNow(__param_0, arg2) $C0A8A0
actionScriptDrawEntities() $C0DB0F
actionScriptDrawEntitiesAlt() $C0DA31
actionScriptDrawEntity(entityOffset) $C0A0CA
actionScriptEnableStageHDMA(__param_0, arg2) $C0AA23
actionScriptFadeIn(__param_0, arg1) $C09FAE
actionScriptFadeOut(__param_0, arg1) $C09FAE
actionScriptFadeOutWithMosaic(__param_0, arg1) $C0AA07
actionScriptFindNPCLocationForActiveEntity(__param_0, arg2) $C0A92D
actionScriptFindSpriteLocationForActiveEntity(__param_0, arg2) $C0A938
actionScriptGenerateRandomAngle() $C09FA8
actionScriptGetActiveEntityMapCollisionProspective() Gets the map collision for where the active entity intends to move and sets its collision flags
actionScriptGetEventFlag(__param_0, arg2) $C0A84C
actionScriptGetPositionOfPartyMember(__param_0, arg1) $C0A943
actionScriptGetSelfDirection() $C0A673
actionScriptInitializePartyMember() Actionscript function - Initializes party member data for the party member id stored in var 1
actionScriptJumpToLabelNTimes(__param_0, arg2) $C0AAD5
actionScriptLoadBattleBG(__param_0, arg1) $C0A977
actionScriptMakeNPCLookAtActiveEntity(__param_0, arg2) $C0A94E
actionScriptMakeSpriteLookAtActiveEntity(__param_0, arg2) $C0A959
actionScriptMoveActiveEntityTowardsDestination() $C0A8C6
actionScriptMoveActiveEntityTowardsDestinationFaceOpposite() $C0A8D1
actionScriptMoveActiveEntityTowardsDestinationNoDirChange() $C0A8DC
actionScriptMoveDirection(direction) Moves en entity according to their current speed
actionScriptMoveEntityToLocationBG1Relative(__param_0, arg2) $C0A87A
actionScriptMoveEntityToPartyMember(__param_0, arg2) $C0A864
actionScriptMoveEntityToSprite(__param_0, arg2) $C0A86F
actionScriptNoPhysics() $C09F??
actionScriptPathfindingOverride() Overrides an entity's normal direction decision logic with pathfinding-based direction logic, if available
actionScriptPerformPaletteFade(__param_0, arg2) $C0AAB5
actionScriptPlaySFX(__param_0, arg2) $C0A841
actionScriptPrepareNewEntity(__param_0, arg1) $C0A912
actionScriptPrepareNewEntityAtPartyLeader(__param_0, arg2) $C0A8FF
actionScriptPrepareNewEntityAtSelf(__param_0, arg2) $C0A8F7
actionScriptPrepareNewEntityAtWarpPreset(__param_0, arg2) $C0A907
actionScriptPrintCastName(__param_0, arg2) $C0A9B3
actionScriptPrintCastNameEntityVar0(__param_0, arg2) $C0A9EB
actionScriptPrintCastNameParty(__param_0, arg2) $C0A9CF
actionScriptQueueInteractionTalkTo(__param_0, arg2) $C0A88D
actionScriptRead16(arg1) Reads a 16-bit value from the actionscript.
actionScriptRead16Copy(script) Reads a 16-bit value from the actionscript. Same as actionScriptRead16, but with a short return C09D99
actionScriptRead8(arg1) Reads an 8-bit value from the ActionScript.
actionScriptReadPtr(script) Reads a pointer from the actionscript data. Does not exist in original game
actionScriptReadString(script) Reads a string from the actionscript data. Does not exist in original game
actionScriptRestorePositionBackup() $C0D7C7
actionScriptSetCOLDATACGADSUB(tempvar, arg2) $C0AA3F
actionScriptSetEntityBoundaries(__param_0, arg2) $C0A964
actionScriptSetEntityToEntityCollisionProspectiveEnemy() Tests for colliding entities where the active enemy entity wants to move and sets the collision field as needed
actionScriptSetEntityToEntityCollisionProspectiveNPC() Tests for colliding entities where the active NPC entity wants to move and sets the collision field as needed
actionScriptSetEventFlag(arg1, arg2) $C0A857
actionScriptSetMovementSpeedConstant(__param_0, arg2) $C0A685
actionScriptSetSelfDirection(arg1) $C0A66D
actionScriptSleepUntilCardinalPixelsMoved(__param_0, arg2) $C0A6A2
actionScriptSleepUntilPixelsMoved(__param_0, arg2)
actionScriptSpawnEntityAtSelf(__param_0, arg2) $C0A98B
actionScriptSpiralMovement() $C0A8E7
actionScriptTestCollisionEnabled()
actionScriptTestPartyCollision() $C0D15C
actionScriptUpdatePartyMemberPosition() Actionscript function - Updates the current position for the party member associated with this entity
actionScriptUpdatePositionAndCollision() $C0A37A
actionScriptUpdateSpriteDirection(__param_0, arg2) $C0AA6E
activateHotspot(id, preset, text) Activates a hotspot with preset coordinates and text pointer. If player is already inside the hotspot coordinates, will instead trigger when the player steps outside of the area.
activeScriptCleanupSelf() Cleans up all extra entity data, such as spawned enemy count and sprites
addPriority0Sprite(spriteMap, x, y) $C08C6D
addPriority1Sprite(spriteMap, x, y) $C08C87
addPriority2Sprite(spriteMap, x, y) $C08CA1
addPriority3Sprite(spriteMap, x, y) $C08CBB
adjustPSITeleportBetaDirection() Adjust the movement of PSI Teleport beta based on controller input
adjustSingleColour(original, modified) $C00434
adjustSpritePalettesByAverage() $C00480
allocateEntity(flag) Allocates an unused slot for a new entity
allocateScript(flag) Allocates a script slot
animatePalette() $C0030F
animateTileset() $C00172
appendActiveEntity(index) $C09C57
backupEntityCallbackFlagsAndDisable() Backs up all entity callback flags and freezes each active entity
binopAdd() Perform an ActionScript addition binop
binopAND() Perform an ActionScript AND binop
binopOR() Perform an ActionScript OR binop
binopXOR() Perform an ActionScript XOR binop
boostPartySpeed(duration) Adds a temporary speed boost, unless the party already has one
callEntityTickCallback() Calls the current entity tick callback
centerScreen(x, y) $C0400E
changeMapMusic() $C069AF
changeMapMusicImmediately() $C069ED
checkBicycleCollisionFlags() $C03C4B
checkDiagonalMovementCollision(direction) $C05B4E
checkEastMovementMapCollision() Runs collision checks for east movement and returns whether it's possible to move eastish
checkEnemyCanMove(collisionFlags, entity, enemyID) Check if the enemy can spawn on the given collision flags. Translates the given collision flags into a new set, according to the enemy's preferences
checkHardware() $C0A11C
checkHorizontalLeftTileCollision(arg1, arg2) $C05639
checkHorizontalRightTileCollision(arg1, arg2) $C056D0
checkMovementMapCollision(x, y, arg3, direction) See if movement in a particular direction is possible and return flags
checkNorthMovementMapCollision() Runs collision checks for north movement and returns whether it's possible to move northish
checkSouthMovementMapCollision() Runs collision checks for south movement and returns whether it's possible to move southish
checkVerticalDownTileCollision(arg1, arg2) $C0559C
checkVerticalUpTileCollision(arg1, arg2) $C05503
checkWestMovementMapCollision() Runs collision checks for west movement and returns whether it's possible to move westish
chooseRandom(__param_0, arg1) $C09F82
clearCurrentEntityCollision(__param_0, arg2) $C0A6DA
clearCurrentEntityCollision2(__param_0, arg2) $C0A838
clearEntityDrawSortingTable() Clears and returns the entity draw sorting table
clearEntityTickCallback(index) Clear an entity tick callback by setting it to a no-op.
clearParty() Remove everyone and everything in the party
clearSpriteTable() $C01A86
copyMapPaletteFrame(arg1) $C0A1F2
copyToVRAM(mode, count, address, data) Queues up a DMA transfer to VRAM
copyToVRAMAlt(mode, count, address, data) Identical to copyToVRAM, but used far pointers split into bank and near addresses.
copyToVRAMChunked(mode, count, address, data) Immediately copy data to VRAM in 4608-byte chunks, presumably to avoid lag frames.
copyToVRAMCommon() Common code for copyToVRAM and copyToVRAMAlt
cosineMult(factor, angle) Calculates cos(angle) * factor / 2
createMiniGhostEntity() Creates a mini ghost entity. Does nothing during cutscenes.
createOverworldEntity(sprite, actionScript, index, x, y) Creates a new overworld entity with the given sprite, script and coordinates
creditsScrollFrame() Performs a single frame of scrolling for the credits scene
defaultIRQCallback() The default callback called every frame by the interrupt handler. Does nothing.
deleteActiveEntry(a, entry) $C09C73
deleteEntity(entity) $C09C35
deleteEntityOffset(offset) $C09C3B
deleteMiniGhostEntity() Deletes a previously-spawned mini ghost entity
deleteOverworldEntity(entity) Deletes an overworld entity. In addition to calling [deleteEntity], this cleans up any sprite allocations and decreases spawned enemy and magic butterfly counts.
demoRecordButtons() Records a frame of input if a demo is actively being recorded. Be aware that this combines both pad 1 and pad 2's input into a single pad state.
demoRecordingEnd() Stops recording a game demo
demoRecordingStart(buffer) Starts recording a game demo to the specified buffer
demoReplayStart(arg1) $C083E3
disableCurrentEntityCollision(__param_0, arg2) $C0A6D1
disableCurrentEntityCollision2(__param_0, arg2) $C0A82F
disableHotspot(arg1) $C071E5
doBackgroundDMA(arg1, arg2, arg3) $C0ADB2
doorTransition(arg1) $C06BFF
doPartyMovementFrame(characterID, walkingStyle, entityID) $C07A56
doSectorMusicUpdate() $C03C25
drawSprite(spriteMap, x, y) $C08C58
ebMain() $C0B7D8
enableNMIJoypad() Enables vertical blank interrupts and joypad auto-reading
enableSwirlWindowHDMA(channel, flags) $C0B0EF
enableWindowHDMA(channel, table) Enables window HDMA. Destination is fixed to WH0-WH3
enemyEntityCollisionCheck(x, y, subjectEntity) $C06267
enterEscalator() $C06E2C
executeIRQCallback() Executes the IRQ callback for the interrupt handler. Has its own function due to function pointers being awkward in 65816 assembly.
exitEscalator() $C06E4A
faceOppositeLeader(arg1) $C042C2
fadeIn(step, timeBetweenFrames) Perform an asynchronous fade-in. Useful for performing extra work while the effect occurs
fadeInWithMosaic(step, timeBetweenFrames, mosaicLayers) Performs a fade-in effect with optional mosaic
fadeOut(step, timeBetweenFrames) Perform an asynchronous fade-out. Useful for performing extra work while the effect occurs
fadeOutWithMosaic(step, timeBetweenFrames, mosaicLayers) Performs a fade-out effect with optional mosaic
fileSelectInit() $C0B525
findFreeSpriteMap(arg1) $C01A9D
findNearbyCheckableNPC() $C04279
findNearbyTalkableNPC() $C04452
findPathToParty(partyCount, arg2, arg3) $C0BC74
freeSpritemap(arg1) $C01B15
freezeEntities() $C0943C
gameInit() $C0B99A
gasStation() $C0F33C
gasStationLoad() $C0F0D2
generateSwirlHDMATable(arg1, arg2, arg3, arg4) $C0B149
getAngleTowardsDestinationUnlessWeak() $C0C62B
getCharacterPositionIndex(characterID) $C03E5A
getCollisionAtLoadedTile(x, y) Gets the collision of a loaded tile at the given coordinates, and sets ladder/stairs coordinates if applicable
getCollisionFlags(x, y, size) $C05D8B
getColorAverage(palette) $C00391
getCreditsPhotographPartySprite(arg1) $C079EC
getDirectionFromPlayerToEntity() $C0C4F6
getDirectionRotatedClockwise(arg1) $C0C682
getEncounterGroupID(x, y) $C0263D
getLastQueuedInteractionPointer() $C0654E
getLastQueuedInteractionType() $C06537
getMapObjectAt(x, y) Searches for map objects at the given coordinates
getMovementSpeed() $C0A691
getMovingCollisionFlags(x, y, entity, direction) $C05CD7
getNewPositionIndex(characterID, distance, arg3, arg4) $C03EC3
getNewX(direction, baseX, flags) Gets a character's new horizontal position after a single frame of movement speed, taking into account the type of surface currently being walked upon
getNewY(direction, baseY, flags) Gets a character's new vertical position after a single frame of movement speed, taking into account the type of surface currently being walked upon
getOffBicycle() $C03CFD
getOffStairs() $C06FED
getOnBicycle() $C03C5E
getOnStairs() $C06F82
getOverworldSpriteTileSize(arg1) $C01DED
getPositionIndexDelta(characterID) $C03E9D
getScreenTransitionSoundEffect(transition, getStart) $C068AF
getSurfaceFlagsHorizontal(x, y, entityID) $C05F33
getSurfaceFlagsVertical(x, y, entityID) $C05F82
handleBicycleMovement(hasMoved) Handles movement while riding a bicycle. Has a few unique quirks: - changing direction while moving diagonally has a 4 frame delay - player does not stop moving forward until a collision or a direction change - press R to ring the bell!
handleEscalatorMovement() $C047CF
handleNormalMovement() Handle a single frame of standard movement, from determining movement direction from input to collision checks to setting the player's final position. Decrease battle countdown if active, performing the entity collision checks necessary for other enemies to join in. Movement on stairs is restricted to two directions, depending on their orientation. Also checks for active hotspot collisions, but only one of the two are checked per frame.
handleSpecialCamera() $C04B53
hdmaDisable(layer) $C0AE34
initBattleCommon() $C052AA
initBattleOverworld() $C0B731
initEntity(actionScript, x, y) $C09321
initEntityWipe(actionScript, x, y) $C092F5
initializeEntitySubsystem() Resets entity subsystem state for a fresh start
initializeMap(x, y, direction) $C019B2
initializeMiscEntityData() $C01A69
initializePSITeleportation() Initialize PSI Teleport variables and entities
interactDoor(arg1) $C06ACA
interactEscalator(arg1, x, y) $C06E6E
interactMapNPC(__param_0) $C06A8E
interactMapSwitch(switchEntry) Handle interaction with a switch on the map
interactObject(__param_0) $C06A8B
interactRopeLadder(arg1) $C06A91
interactStairs(direction, x, y) $C070CB
irqNMICommon() Interrupt handler routine. Runs exactly once every frame, syncing buffered registers to hardware, resetting the heap and starting queued DMA requests.
isEntityOnscreen() $C0C6B6
isEntityWeak() $C0C524
loadBackgroundOffsetParameters(arg1, arg2, arg3) $C0AE4C
loadBackgroundOffsetParameters2(arg1) $C0AE56
loadCollisionColumn(x, y) $C00D7E
loadCollisionData(tileset) $C0062A
loadCollisionRow(x, y) $C00CF3
loadDadPhone() $C0DCC6
loadGasStationFlashPalette() Loads the 'flash' palette for the gas station screen
loadGasStationPalette() Loads the original gas station screen palette
loadMapAtPosition(x, y) $C013F6
loadMapAtSector(x, y) Loads all map data for the specified map sector - palette, graphics, collision, etc.
loadMapBlock(x, y) Loads the map block at (x,y)
loadMapBlockEventChanges(id) Applies relevant event flag-controlled map changes for the given tileset
loadMapBlockF(x, y) $C0A1??
loadMapColumn(x, y) Loads a column of map block data, starting from (x, y) to (x, y + 16), representing a 32x512 pixel area
loadMapColumnVRAM(x, y) $C00FCB
loadMapPalette(tileCombo, palette) Loads the specified map palette. If the flag in bg palette 2's transparent colour is set, try the palette pointed to by bg palette 3's transparent colour until a palette with a non-set flag is reached.
loadMapRow(x, y) Loads a row of map block data, starting from (x, y) to (x + 16, y), representing a 512x32 pixel area
loadMapRowVRAM(x, y) $C00E16
loadPaletteAnim() $C0023F
loadSectorAttributes(x, y) Sets and retrieves the sector attributes for the specified coordinates
loadSectorMusic(x, y) $C068F4
loadSpecialSpritePalette() Loads sprite palette 4, using bg palette 4's transparent colour as a palette index to copy from
loadTilesetAnim() $C00085
loadTitleScreenGraphics() Loads the graphics data needed for the title screen
loadTitleScreenPaletteEffect(id) Loads the palettes for one of the two special title screen effects
logoScreen() $C0F009
logoScreenLoad(arg1) $C0EE68
mapInputToDirection(style) $C0404F
moveCameraToEntity() $C0476D
movePartyLeader() Handles a single frame of party leader movement on the map
movePartyToLeaderPosition() $C03F1E
moveRelativeToBG3() $C0A06C
mushroomizationMovementSwap() Shuffles inputs if mushroomization is active, switching to a different shuffled mapping every 30 seconds. Has no effect during demo playback.
musicEffect(arg1) $C0AC0C
npcEntityCollisionCheck(arg1, arg2, arg3) $C0613C
oamClear() Clears the OAM state in preparation for a new frame
overworldInitialize() $C0004B
overworldSetupVRAM() Sets up the PPU for the overworld game mode
partyLeaderTick() $C05200
partyMemberTick() A single frame of a single party member's movement. Applies direction and position from movement buffer, and updates sprite when necessary
performCollisionChecks(directionMask) Runs some collision checks. Checks the tiles at each direction specified by directionMask and returns each check that failed
playerEntityCollisionCheck(x, y, entity) Find any NPCs colliding with player entity, respecting intangibility
playerIntangibilityFlash() Do a single frame of intangibility flashing
playSfx(sfx) $C0ABE0 - Play a sound effect
prepareAverageForSpritePalettes() $C005E7
prepareBackgroundOffsetTables(rippleFrequency, rippleAmplitude, distortionSpeed) $C0AE5A
prepareDeliveryEntrancePath(arg1) $C0C19B
prepareDeliveryExitPath(arg1) $C0C251
prepareForImmediateDMA() Ensures hardware is in a state appropriate for VRAM DMA. Blocks for a single frame
preparePaletteUpload(mode) Signals to the interrupt handler that a palette upload is meant to happen next frame.
prepareSpriteMap(arg1, arg2, flags, spriteTemplates) $C01D38
prepareTitleScreenFadeIn() Prepares the background fade-in effect for the title screen
processEntityCreationRequests() $C065A3
processOverworldTasks() $C0DC4E
processQueuedInteraction() Processes a single queued interaction, such as displaying text or using a door
psiTeleportAlphaLeaderTick() A single tick of PSI Teleport alpha movement
psiTeleportArrive() Fade in and finish teleporting into destination
psiTeleportArriveLeaderTick() Leader tick function for PSI Teleport arrivals
psiTeleportBetaLeaderTick() Leader tick function for PSI Teleport beta movement
psiTeleportCheckCollision(curX, curY, nextX, nextY, __param_4) Perform a PSI Teleport collision check. Check both the leader's current position and the position where it will be
psiTeleportDepart() Disables collision and teleports out of the current area
psiTeleportFail() Player failed to teleport, update state as appropriate
psiTeleportFailFollowerTick() When party members get to move, clean the soot off C0E97C
psiTeleportFailLeaderTick() Leader does nothing during a PSI Teleport fail
psiTeleportFollowerTick() Update following party members while teleporting
psiTeleportFreezeObjects() Make sure all the non-party entities are frozen for PSI teleportation
psiTeleportFreezeObjectsLoop() Make sure all the non-party entities are frozen for PSI teleportation in a less expensive way suitable for a hot loop
psiTeleportGetPositionIndex(characterID, currentIndex) Get current position buffer index while PSI Teleporting
psiTeleportLoadDestination() Load the destination for a successful PSI Teleport
psiTeleportRestoreControl() Restore control after a successful PSI Teleport
psiTeleportSuccessDepartLeaderTick() Leader tick function for PSI Teleport departure
psiTeleportUpdateAnimationSpeed() Increase animation frame rate according to teleportation speed
psiTeleportUpdateBetaSpeed() Update PSI Teleport beta speed according to current direction
psiTeleportUpdateSpeed(direction) Update teleportation speed based on old speed and teleportation stage
psiTeleportWaitNFrames(n) Wait n frames
queueEntityCreationRequest(sprite, script) $C06578
queueHotspotInteraction(id) Queues up a hotspot interaction, as long as the player is within bounds and isn't teleporting
queueInteraction(arg1, arg2) $C064E3
queueVRAMDMAInternal() Queues up a DMA transfer in 4608-byte chunks, with one sent per frame.
rand() $C08E9A
readJoypad() $C0841B
recalculateEntityScreenPosition(arg1) $C0A254
redFlash() Causes the screen to flash red for a single frame by disabling all layers and setting the screen background colour to red
refreshMapAtPosition(x, y) $C01558
reloadHotspots() $C07213
reloadMap() $C018F3
reloadMapAtPosition(x, y) $C012ED
reloadMapCurrentLocation() Reloads the map rows and columns in a 60x60 area centred on the current BG1 coordinates
reloadMapMusic() Changes the music track to the normal overworld music for the player's location
removeNonTransitionSurvivingInteractions() $C06B3D
renderFirstFrame() Renders the first frame of the game
renderSpriteDebug() Called immediately before the sprite priority specified by spriteRenderDebugPriority. Debugging leftover
renderSpritesToOAM() Renders all sprites to OAM, sorted by priority first and order queued second
renderSpriteToOAM(arg1, xbase, ybase) $C08CD5 - Draw a SpriteMap list into the OAM buffer
replaceBlock(target, source) Replaces a loaded overworld block with another
reserveOverworldSpriteVRAM(tileWidth, tileHeight, needle) $C01C52
resetIRQCallback() Clears the IRQ callback by setting it to the default no-op function.
resetWindows() Resets windows 1 and 2 by setting the left edge to the right edge of the screen
restoreBackgroundLayers() Restores screen background colour backup and re-enables backgrounds 1, 2, 3 and OBJ
restoreCameraMode() $C04A7B
restoreEntityCallbackFlags() Restores entity callback flags from backup
restorePartySpeed() Restores party speed to normal
rotateLoadedPalette() Rotates in a loaded palette based on VAR0, VAR1 and VAR2 of the active entity
runActionscriptFrame() $C09466
runEntityScript() $C09506
runEntityScripts(a, x) $C09466
runGasStationSkippablePortion() Runs the portion of the gas station intro screen that can end early when a button is pressed
sbrk(bytes) Reserve some memory from the heap
scheduleOverworldTask(arg1, arg2) $C0DBE6 - schedules a task to be run at some point in the future while on the overworld
screenTransition(arg1, arg2) $C06662
searchNextEntityTable(needle) Searches for an entity and returns it. If not found, never returns
setBG1VRAMLocation(arg1, arg2, arg3) $C08D9E
setBG2VRAMLocation(arg1, arg2, arg3) $C08DDE
setBG3VRAMLocation(arg1, arg2, arg3) $C08E1C
setBG4VRAMLocation(arg1, arg2, arg3) $C08E5C
setBGMODE(arg1) $C08D79
setBGPalettesBlack() Sets all BG palettes to black
setBGPalettesWhite() Sets all BG palettes to white
setColData(red, green, blue) $C0B01A
setColourAddSubMode(cgwsel, cgadsub) $C0B039
setDirection(arg1, __param_1) $C0A65F
setDirection8(__param_0, arg2) $C0A651
setFollowerEntityLocationToLeaderPosition() $C039E5
setForceBlank() Turns off the display. Blocks for a single frame to guarantee that the display is off before returning.
setINIDISP(value) Configures screen brightness. Can also turn screen black.
setIRQCallback(arg1) Sets an IRQ callback to be run each frame during the interrupt handler. Make sure this function executes quickly, otherwise you won't have much CPU time per frame.
setLayerConfig(arg1) $C0AFCD
setLeaderLocation(arg1, arg2) $C0B65F
setLeaderPosition(x, y, direction) $C03FA9
setMOSAICFade(layers) Configures the MOSAIC register using the screen's current brightness for the specified layers
setMovementSpeed(arg1, arg2) $C0A685
setOAMSize(arg1) $C08D92
setSpritemapBank(bank) Sets the bank address for spritemaps (not used on modern systems)
setSurfaceFlags(__param_0, arg2) $C0A679
setTeleportState(arg1, arg2) Initiate a PSI Teleport sequence
setTitleScreenActionScriptState() Sets the ActionScript interpreter state to a special title screen state, which is identical to the running state except interrupting the title screen script is forbidden
setupTeleportingEntities() Set initial animation flags for party members starting to PSI Teleport
setWindowMask(layers, invert) Sets window masking registers WxxxSEL, TMW, TSW and WxxxLOG with presets
sineMult(factor, angle) Returns sin(angle) * factor / 2
sleepUntilCardinalPixelsMoved(pixels) Causes a script to sleep until the entity has moved a certain number of pixels in the cardinal directions
sleepUntilPixelsMoved(pixels) Causes a script to sleep until the entity has moved a certain number of pixels
spawnBuzzBuzz() $C06B21
spawnEnemiesColumn(tileX, tileY) Attempts to spawn enemies when the player moves horizontally. Makes up to six attempts for each of six of the enemy sectors at the left or right of the screen. Enemies will not spawn if sysMonsterOff or winGiegu are set, if enemySpawnsEnabled is set to allDisabled, or if the column is out of bounds or perfectly divisible by 8.
spawnEnemiesFromGroup(tileX, tileY, encounterGroupID) Spawns the enemies in the encounter group, if the conditions for doing so are met. If enemy spawn debugging is enabled, will spawn enemies from the test group (0). Every 16th spawn attempt (successful or not) will instead attempt to spawn a magic butterfly. If a pirated copy of the game is detected, enemy spawning will ALWAYS succeed, even when the spawn chance is set to 0%. Only one instance of a group can be spawned in an area, subsequent attempts will fail until the first instance despawns.
spawnEnemiesRow(tileX, tileY) Attempts to spawn enemies when the player moves vertically. Makes up to six attempts for each of six of the enemy sectors at the top or bottom of the screen. Enemies will not spawn if sysMonsterOff or winGiegu are set, if enemySpawnsEnabled is set to allDisabled, or if the row is out of bounds or perfectly divisible by 8.
spawnNPCsColumn(x, y) $C025CF
spawnNPCsRow(x, y) $C0255C
spriteVramTableAllocateSpace(numTiles, needle) $C01B96
spriteVramTableOverwrite(needle, tableValue) $C01C11
start() SNES entry point. Prepare hardware for running C code.
startAutoMovementDemo(arg1) $C0402B
stopMusic() $C0ABC6
switchToCameraMode3() $C04A88
teleportMainLoop() Handles entire PSI teleportation process
testBattleStarting() Tests if a battle is about to start
testEntityMovementActive() Tests if the active entity is moving somewhere. Stores possible destination in entityMovementProspectX/Y
testEntityMovementCommon(offset) Tests if an active entity (offset) is moving somewhere. Stores possible destination in entityMovementProspectX/Y
testEntityMovementSlot(id) Tests if an arbitrary entity is moving somewhere. Stores possible destination in entityMovementProspectX/Y
testEntityMovementUnusedEntry() Tests if the active entity(?) is moving somewhere. Stores possible destination in entityMovementProspectX/Y. Unused
testPartyLeaderDistanceClose() Transforms the distance between the party leader and current active entity into a value more suitable for switching on
testPartyLeaderDistanceCloseIntangibility() Gets a switchable distance between the active entity and party leader, unless pathfinding is happening or the player is still intangible
testPartyLeaderDistanceFar() Transforms the distance between the party leader and current active entity into a value more suitable for switching on
testPartyLeaderDistanceFarIntangibility() Gets a switchable distance between the active entity and party leader, unless pathfinding is happening or the player is still intangible
testSRAMSize() $C0841B
tryBattleStart() Tries starting a battle with any enemies touching the party members
tryShowHPAlert(character) Tries to show an HP alert for the given character, if HP is low enough and an alert hasn't been shown recently
trySpawnNPCs(x, y) $C0222B
unfreezeEntities() $C09451
unknownC0035B(a, x, y) $C0035B
unknownC01181(arg1, arg2) $C01181
unknownC0122A(arg1, arg2) $C0122A
unknownC01731(x, y) $C01731
unknownC01A63(x, y) $C01A63
unknownC02194() $C02194
unknownC021E6() $C021E6
unknownC0369B(id) $C0369B
unknownC03903(id) $C03903
unknownC03A24() $C03A24
unknownC03A94(arg1) $C03A94
unknownC04116(direction) $C04116
unknownC041E3() $C041E3
unknownC042EF(direction) $C042EF
unknownC043BC() $C043BC
unknownC04AAD() $C04AAD
unknownC04FFE() $C04FFE
unknownC052D4(arg1) $C052D4
unknownC0546B() $C0546B
unknownC05FD1(x, y, entity)
unknownC064D4() $C064D4
unknownC065C2(direction) $C065C2
unknownC069F7() $C069F7
unknownC0705F(arg1) $C0705F
unknownC07526(x, y) $C07526
unknownC0780F(characterID, walkingStyle, character) $C0780F
unknownC07A31(arg1, arg2) $C07A31
unknownC07B52() $C07B52
unknownC09279() $C09279
unknownC09907(arg1) $C09907
unknownC09C8F(x) $C09C8F
unknownC09C99(offset) $C09C99
unknownC09CD7() $C09CD7
unknownC09D12(entityOffset, y) $C09D12
unknownC09D1F(entityOffset, y) $C09D1F
unknownC09D3E(entityOffset, y, finalX) $C09D3E
unknownC09F3BUnusedEntry() $C09F3B
unknownC0A0E3(arg1, overflowed) $C0A0E3
unknownC0A0FA(arg1, arg2) $C0A0FA
unknownC0A21C(arg1) $C0A21C
unknownC0A26B() $C0A26B
unknownC0A2B7(entityOffset) $C0A2B7
unknownC0A2E1(entityOffset) $C0A2E1
unknownC0A317(entityOffset) $C0A317
unknownC0A360() $C0A360
unknownC0A384() $C0A384
unknownC0A3A4(__param_0, id) $C0A3A4
unknownC0A443() $C0A443
unknownC0A643(__param_0, arg2) $C0A643
unknownC0A6E3() $C0A6E3
unknownC0AAAC() $C0AAAC
unknownC0AACD() $C0AACD
unknownC0AAFD() $C0AAFD
unknownC0AC43() $C0AC43
unknownC0AD9F() $C0AD9F
unknownC0B67F() $C0B67F
unknownC0B9BC(arg1, arg2, arg3, arg4) $C0B9BC
unknownC0BA35(pathState, targets, baseX, baseY, offscreen, arg6, arg7) $C0BA35
unknownC0BD96() $C0BD96
unknownC0BF72() $C0BF72
unknownC0C35D() $C0C35D
unknownC0C711() $C0C711
unknownC0CC11() $C0CC11
unknownC0CCCC() $C0CCCC
unknownC0CD50() $C0CD50
unknownC0CEBE(arg1) $C0CEBE
unknownC0CF97(arg1, arg2) $C0CF97
unknownC0D0D9() $C0D0D9
unknownC0D0E6() $C0D0E6
unknownC0D19B() $C0D19B
unknownC0D4DE() $C0D4DE
unknownC0D77F() $C0D77F
unknownC0D7E0() $C0D7E0
unknownC0D98F() $C0D98F
unknownC0ED5C() $C0ED5C
unknownC0EE47() $C0EE47
unknownC0EE53() $C0EE53
unknownC0EFE1(arg1) $C0EFE1
unknownC0F1D2(duration) $C0F1D2
updateActiveEntityPosition2D() $C09FC8
updateActiveGiftBoxState() $C0C353
updateEnemyEntityCollision() Updates enemy collision flags for the new location
updateEntityCollision(entity) $C05E3B
updateEntityPosition2D(arg1) $C09FB0
updateEntityPosition3D() $C09FF1
updateEntityPosition3DIgnoreSurface() $C0A00C
updateEntityPositionAbsolute() $C0A0BB
updateEntitySpriteCurrentFrameCounter() $C0A472
updateEntitySpriteFrame(arg1) $C0A780
updateEntitySpriteFrameCurrent() $C0A794
updateEntitySurfaceFlags() $C0C7DB
updateFlyingEnemyEntityCollision() Alternate enemy entity collision function, used by flying enemies (magic butterflies included)
updateGiftBoxState(entity) Sets an NPC entity's direction based on the state of its associated event flag. Used for gift box entities.
updateMiniGhostPosition() $C0778A
updateMushroomizedWalking() Updates mushroomized walking state if anyone is mushroomized, forcing the player off a bicycle and resetting the input shuffle timer to 30 seconds as needed
updateOverlayFrame(arg1, frames, overlay) $C0AD56
updatePadState() Updates the pad* variables with gamepad input. Unless debugging is enabled, pad 2's state is a copy of pad 1's. Also records a frame of demo input, if active.
updateParty() $C034D6
updatePartyNPCs() $C032EC
updateScreen() Updates the screen state for a new frame. Updates OAM and BG layer positioning
updateScreenPositionBG12D() $C0A023
updateScreenPositionBG13D() $C0A03A
updateScreenPositionBG13DDupe() $C0A0A0
updateScreenPositionBG32D() $C0A055
updateScreenPositionNoOp() $C0A039
uploadSpriteTileRow() $C0A56E
waitDMAFinished() $C08F8B
waitForFadeToFinish() Wait enough frames for the active screen fade effect to complete
waitForFadeToFinishNoActionScript() Waits for an asynchronous fade effect to finish. Same as waitForFadeToFinish, but ActionScripts aren't executed
waitNFrames(frames) Wait at least one frame
waitUntilNextFrame() Waits a single frame, with gamepad state updated appropriately
writePartyLeaderStateToPositionBuffer() $C0E196

Global variables

NameTypeDescription
addPriorityXSpriteFuncs immutable(void function(const(earthbound.commondefs.SpriteMap)*, short, short)*[4]) $C08C65
animatedBackgroundLayer1HDMATableTemplate const(earthbound.hardware.HDMAIndirectTableEntry[3]) $C0AE26
animatedBackgroundLayer2HDMATableTemplate const(earthbound.hardware.HDMAIndirectTableEntry[3]) $C0AE2D
binopFunctions immutable(void function()*[4]) Binary operation command functions
dmaFlags immutable(ubyte[7]) $C0AE16
dmaTable immutable(DMATableEntry[18]) $C08FB0
dmaTargetRegisters immutable(ubyte[9]) $C0AE1D
entityScriptVarTables short*[8] Entity variable tables
escalatorEntryOffsetsX immutable(short[4]) $C06E02
escalatorExitOffsetsX immutable(short[4]) $C06E0A
hdmaDisableMasks immutable(ubyte[8]) $C0AE44
layerConfigCGADSUBs immutable(ubyte[10]) $C0B010
layerConfigCGWSELs immutable(ubyte[10]) $C0B006
layerConfigTDs immutable(ubyte[10]) $C0AFFC
layerConfigTMs immutable(ubyte[11]) $C0AFF1
movementControlCodesPointerTable immutable(const(ubyte)* function(const(ubyte)*)*[77]) ActionScript command function pointers
paletteDMAParameters immutable(PaletteDMAParameters[4]) DMA parameters for partial or full palette updates
sineLookupTable immutable(byte[256]) $C0B425
spriteDirectionMappings4Direction ushort[12] $C0A60B
spriteDirectionMappings8Direction ushort[8] $C0A623
stairInputDirectionMap immutable(short[4]) $C06E12
unknownC08FE6 immutable(ubyte[2]) $C08FE6 - unused. these bytes happen to correspond to XBA / TYA opcodes, however
unknownC0A2AB immutable(short[6]) $C0A2AB
unknownC0A30B immutable(short[6]) $C0A30B
unknownC0A350 immutable(short function(short)*[8]) $C0A350
unknownC0B2FF immutable(byte[256]) $C0B2FF
unknownC0CF58 immutable(ubyte[63]) $C0CF58
windowMaskSettingPresets immutable(ubyte[4]) Mask setting presets for W12SEL, W34SEL, WOBJSEL used by setWindowMask