PIXI

PIXI (JackTheSpades' SpriteToolSuperDelux, current release 1.43) inserts custom sprites into a Super Mario World ROM. It reads a list of sprites and their configs, assembles each sprite with Asar, inserts a sprite driver and a set of shared routines, writes the tables the driver reads, hooks SMW's sprite code, re-encodes levels whose sprite records change length, and writes the auxiliary files Lunar Magic uses to show the sprites in its editor.

This page describes what PIXI puts in the ROM, its file formats and its behaviour, and gives interface contracts for its shared routines. All addresses are SNES LoROM addresses, written as $BBAAAA. Format facts come from PIXI's README and source tree (master 734b8ed), from PIXI-built ROMs, and from runs in Mesen. [MEASURED] marks a fact measured on an emulator run or by differential testing against PIXI's own code. [LM-DOC] marks a fact from Lunar Magic's help, restated rather than quoted. Untagged facts are read from PIXI's documentation, its output or the SMW disassembly.

PIXI is licensed GPL-3.0 (the root LICENSE covers asm/ and routines/). A clean-room MIT reimplementation of the driver and these routines exists in Pipe Dream; nothing on this page is PIXI code.

What PIXI is

What PIXI does

  1. Reads the list (list.txt). Entries are NN file for a global sprite and LLL:NN file for a per-level one (B0-BF only). The list is grouped by section headlines (SPRITE:, CLUSTER:, EXTENDED: and the misc kinds). In SPRITE:, slots below C0 read from sprites/, C0-CF from shooters/ and D0 and up from generators/. Only C0-DF run as custom shooters and generators.
  2. Reads each sprite's config (.cfg or .json, below).
  3. Assembles each sprite with Asar. A wrapper gives it the SA-1 and base defines, the shared routines as %Name() macros, its folder's _header.asm, then freecode and the sprite itself. The sprite reports its entry points with Asar prints (print "INIT ",pc, print "MAIN ",pc), and its status entry points (CARRIABLE, KICKED, CARRIED, MOUTH, GOAL) the same way.
  4. Inserts the routines once. Each shared routine a sprite uses goes into freespace once, and its address is kept in a table, so every sprite's macro JSLs the same copy.
  5. Writes the tables: the STSD header, the sprite table, per-level tables, the status pointers and Lunar Magic's sprite size table.
  6. Hooks the game (below).
  7. Fixes the levels whose sprite records changed length (MeiMei). A level's sprite list is walked with the size table, so every level using a number whose record length changed must be re-encoded, not only the levels being edited.
  8. Writes Lunar Magic's aux files (.ssc, .mwt, .mw2, .s16) so LM shows the sprites.

Before inserting, PIXI checks that the ROM has Lunar Magic's VRAM patch ($00F6E4 = $5C) and at least one level saved in LM ($06F624). It refuses a ROM that a newer PIXI version has patched. Sprites may carry VERG checks against the version the driver reports.

Sprite slots and types

kindnumberssource folderconfig
normal sprite00-BFsprites/.cfg / .json
per-level spriteB0-BF, per level (LLL:NN)sprites/.cfg / .json
shooterC0-CFshooters/.cfg / .json
generatorD0-DFgenerators/.cfg / .json
clusterlist number 00-7Fcluster/ASM only
extendedlist number 00-7Fextended/ASM only
minor extended, bounce, smoke, spinning coin, scorelist number per kindmisc_sprites/<kind>/ASM only

Each folder has its own _header.asm, included before every sprite in it.

A sprite placed in a level is custom when the extra bit $08 of its level-data record is set. A custom sprite shares its number with SMW's sprite of the same number; the extra bit tells them apart.

Cluster and extended sprites

These are ASM alone, with no config and MAIN-only pointer tables. Each must print MAIN. An extended sprite may also print CAPE; without one, cape interaction does nothing (README).

The sprite, or whatever spawns it, stores the custom number itself: the list number plus an offset, in $1892 (cluster) or $170B (extended). The offsets are SMW's own table sizes, read off its dispatchers:

kindnumber tableoffset definevalueSMW dispatch
cluster$1892!ClusterOffset$09jump table at $02F825 has entries 00-08; the loop reads the number at $02F815 (LDA $1892,X : BEQ)
extended$170B!ExtendedOffset$13jump table at $029B2B has entries 00-12; the loop reads the number at $029B16 (LDA $170B,X : BEQ)
minor extended$17F0$0C$028B69; SMW's jump table has 12 entries
bounce$1699$08$02904D, the top of the dispatch the bounce/smoke loop JSRs; the timer $16C5 counts down there for SMW's
smoke$17C0$06$0296C0; the next instruction drops bit 7 (a flag)
spinning coin$17D0$02$0299D7, a loop that JSRs one routine
score$16E1$16$02ADBD, a loop that JSRs one routine; it reads its tables by number

Bit 7 of a cluster number is its extra bit. The minor-kind offsets come from PIXI's asm/sa1def.asm. Its spawn routines (routines/Spawn/*Generic) store the number they are given, so the caller adds the offset. !ExtendedSize is $08 (!ExSprSize+1): spawning keeps off extended slots 8-9, which are Mario's fireballs. Cluster speed tables are named !cluster_misc_1e52 and so on, by address. !Bank8 is $80.

The README names the misc sections and folders and nothing more: not their entry points, registers or how the number is stored.

Apart from each kind's dispatch, SMW reads these number tables only to look for a free slot or to compare with a fixed number, with one exception: the cape's check of extended sprites at $029636, whose clipping ($02A519) is a table indexed by number. That is where an extended sprite's CAPE matters. Extended sprites' timer $176F counts down in SMW's loop before dispatch.

What PIXI puts in the ROM

The STSD header

At $02FFE2: the ASCII tag "STSD", a version byte, flags, a dl pointer to the sprite table, the per-level pointers and the status pointers. The version byte reads 140 on a ROM built by PIXI 1.40.

The sprite table

0x100 entries of 0x10 bytes each, one per sprite number:

offsetsizefield
01type (0 tweak, 1 custom, 2 shooter/generator)
11acts-like
26the six tweaker bytes, in the order $1656 $1662 $166E $167A $1686 $190F
83INIT pointer (24-bit)
113MAIN pointer (24-bit)
142extra property bytes 1 and 2

An empty entry points at $018021, an RTL. Per-level tables (B0-BF) are keyed by the level number in $010B. PIXI writes $010B from $05D8B9.

Lunar Magic's sprite size table

$0EF30C: dl Size : db $42 points at a 0x400-byte table that gives 3 + count bytes per (extra bits, number), where count is the sprite's extra-byte count. The game's sprite loader steps through a level's sprite list with it. The size table is per number, not per level: if any level has its own B0-BF sprite, B0-BF records are the longer length in every level.

Status pointers

A sprite may print CARRIABLE (status 09), KICKED (0A), CARRIED (0B), MOUTH (07) and GOAL (0C). The printed code then runs in that status in place of SMW's, and a status it does not print runs SMW's code as before. The second extra property byte overrides this: bit 7 runs MAIN instead, bit 6 runs MAIN first (then the sprite's entry, or SMW's).

The load table move (255 sprites per level)

SMW's load table $1938 holds one byte per record of the level's sprite list, indexed by $161A,x. A set byte means "spawned, do not spawn again". It is 128 bytes, so a 129th record writes into the screen exits at $19B8. Since PIXI 1.2.15 (its changelog) the table is moved to $7FAF00, 256 bytes; !1938 names it, and index FF still means "not from the level". Since PIXI 1.41, !1938 is always the remapped $7FAF00 and disabling the remap (!Disable255SpritesPerLevel) is an error.

Every SMW instruction that addresses $1938 (found by scanning for each absolute opcode with that operand; no long forms exist, and three hits in bank 0D are tile data) [MEASURED]:

Lunar Magic's bank-1E loader never touches $1938, and jumps back only to $02A846, $02A84B and $02A856.

Lunar Magic is told the limit is 255 by clearing bit 0 of $0FFFE0. LM's help ("Custom Sprite List Sizes") gives this as PC offset 0x801E0; LM's PC offsets count the 0x200-byte copier header (its 0x7750C is the $0EF30C size-table pointer) [LM-DOC]. Every PIXI ROM examined has $FE there; an LM-saved hack without PIXI has $FF.

Hooks

addresswhat is there in SMWwhy PIXI hooks it
$018172sprite INIT dispatchrun a custom sprite's INIT
$0185C3sprite MAIN dispatchrun a custom sprite's MAIN; on a PIXI ROM this is a JSL, which is how a PIXI ROM is recognised
$02A963, $02A94Bstore byte0 AND #$0D into a position-high byte ($14E0 vertical; $14D4 from LM's horizontal path, whose caller then ANDs A with 1)without a hook the extra bits would land in the position; the driver keeps bit 0 there and the extra bits in !extra_bits
$02A9C9the spawn's JSL $07F7D2 (clear the slot, then load SMW's tweakers by $9E)load the custom tables for a custom sprite
$07F785the tail of that slot clearthe custom state is cleared with the slot
$0187A7sprite 9B's INIT stub (reached via $0182B3)becomes the "give this slot its custom tables" call that spawning code makes; the stub moves
$018127sprite status handlerthe status entry points
$02A846the sprite loader's record stepstep by the size table
shooter and generator load and runcustom shooters and generators

Notes on these hooks [MEASURED]:

Config formats

list.txt

NN file for a global sprite, LLL:NN file for a per-level one, under section headlines (SPRITE:, CLUSTER:, EXTENDED:, then the misc kinds by name). A misc kind's section name is its folder name under misc_sprites/.

CFG

Six lines:

  1. type: 0 tweak, 1 custom, 2 shooter/generator;
  2. acts-like;
  3. the six tweaker bytes $1656 $1662 $166E $167A $1686 $190F;
  4. extra property bytes 1 and 2;
  5. the ASM file;
  6. a:b extra-byte counts (extra bit clear : extra bit set), in hex, at most 0C.

JSON

The same fields, with these differences:

Extra data: five different things

These are easy to confuse:

The extra bit lives in bit 2 (value $04) of the sprite's !extra_bits,x byte at runtime ($7FAB10,x on LoROM, $6040,x on SA-1).

Display tiles

Display tiles are numbered in Lunar Magic's sprite Map16, 0x000-0x3FF. A sprite's own Map16 replaces tiles from 0x300. Most real configs use LM's own tiles (0x030 is the green shell; 0x006, 0x007, ...). LM's table sits uncompressed in Lunar Magic.exe: 0x400 tiles × 8 bytes. Tile words use FG Map16's layout, YXPCCCTT TTTTTTTT. 8×8 tiles 0x000-0x1FF are SP1-SP4 and 0x200-0x2FF are GFX33 (Yoshi is 0x080-0x0A3). LM 3.21's copy, as PIXI's CFG Editor++ embeds it in an LM16 export, differs from LM 3.40's in two tiles (16F and 21B) and stops at 0x2FF.

Files PIXI writes for Lunar Magic

PIXI writes <rom>.ssc (tooltips and display), .mwt (list names), .mw2 (list data) and .s16 (sprite Map16) beside the ROM, from the global slots' JSON configs. The formats are in Lunar Magic's help ("Custom Tooltips for Sprites", "Custom Collections of Sprites", "Custom Map16 for Sprites") [LM-DOC]. These details are as PIXI writes them, where the help is silent [MEASURED]:

PIXI does not write the overworld's .sscov/.s16ov.

Version differences

1.2.x1.401.41+ / 1.43
shared routines27, flat in routines/50: the 27 plus 23 new, in subfolders (Spawn/, Bounce/, Score/, Smoke/, SpinningCoin/, MinorExtended/, Cluster/, Extended/)
routine macro namesthe file namethe path with the folders run together: Bounce/SetSpeed.asm is %BounceSetSpeed()
255 sprites per levelsince 1.2.15, can be disabledcan be disabledalways on; disabling is an error
sa1def.asm7 macros; first includes an optional config.asmadds invoke_sa1; no config.asm include
_header.asmdefines %LDE() and spawn macros that call the 1.40 routines
.s16 sizezero-padded to 0x1C000 bytes0x10 pages

Known bugs and quirks

Shared routines

These are interface contracts for PIXI's shared sprite routines: each is inserted once and called with JSL through %Name(). They are written from the routines' observable behaviour. Each contract says what a caller can see: inputs, outputs, RAM written, flags, stack effects and edge cases. They hold no PIXI code: no instruction sequences, no instruction-by-instruction paraphrase, no PIXI comments and no PIXI data tables. A table is described only when it is SMW's own (its address is cited) or when it can be defined by a formula. SMW addresses were checked against a vanilla ROM.

The contracts were checked by running an independent implementation against PIXI's own routines from thousands of random states each, on the same vanilla ROM in a CPU interpreter, comparing every register, flag and byte of RAM with only what is called a by-product here masked. Where that disagreed with a contract, PIXI was measured black-box (inputs varied one at a time, outputs read) and the contract corrected; corrected points are marked [MEASURED]. The random states were kept to real level modes and screens, Map16 pointers into ROM at $0FBE, a short stripe buffer and a data bank below $10; outside those, SMW's own pointers lead into low RAM.

Conventions that apply to every routine

PIXI reaches the RTS-ending routines ($02B554/$02B560, $00C0FB) from another bank with the usual "push a long return address, then push the address of an RTL in the target bank minus 1" trick. The RTL bytes it uses are at $00804D and $02B889. Any equivalent call mechanism is acceptable.

Aiming

Computes an 8-bit X speed and Y speed of magnitude about speed, pointing from the shooter toward the target.

CapeContact

Checks whether sprite X is touching the spinning cape.

Otherwise:

  1. Box A comes from SMW's $03B69F.
  2. Box B is the cape box:
    • X = 16-bit ($13E9/$13EA) − 2, giving $00/$08. Width $14 in $02.
    • Y = $13EB/$13EC, giving $01/$09. Height $10 in $03.
  3. The result is $03B72B's.

ChangeMap16

Writes a Map16 tile number at a level position and queues the VRAM update.

| layer orientation | $08 | $0A | |---|---|---| | horizontal L1 | $1A − $80 | $1C | | horizontal L2 | $1E | $20 − $80 | | vertical L1 | $1A | $1C − $80 | | vertical L2 | $1E − $80 | $20 |

The orientation is bit 0 of the value saved in $0A, which is consumed by shifting $0A right once, so $0A holds half its GetMap16 value before being overwritten. All of these are 16-bit.

$00C0FB decides whether the block is close enough to the camera to upload. If it is, it appends a stripe entry at $7F837D + [$7F837B] and adds $10 to $7F837B. It clobbers $00 and $04-$06.

CheckForContactAlternate

Tests two boxes for overlap with 16-bit coordinates.

All comparisons are unsigned 16-bit, and the X axis is evaluated first.

CircleX

Computes radius · cos(angle).

CircleY

Computes radius · sin(angle). The contract is the same as CircleX, with these differences:

ExtendedCapeClipping

Checks whether extended sprite X is touching the cape, using a box the caller supplies.

ExtendedGetDrawInfo

Finds the OAM slot for extended sprite X and the sprite's screen position. Erases or hides the sprite when it is off screen. This is the 1.2.x contract; 1.40 changes the vertical rule (see "Changes to the 1.2.x routines in 1.40").

ExtendedHurt

Hurts the player if extended sprite X touches them. Uses a fixed 10×10 box.

ExtendedSpeed

Applies an extended sprite's speed to its position, optionally with gravity.

FinishOAMWrite

Finalises a sprite's OAM tiles: sets each tile's size bit and hides tiles that are off screen.

FireballContact

Checks whether sprite X is touching either player fireball.

GetDrawInfo

Sets sprite X's off-screen flags and returns its OAM index and screen position. When the sprite is too far off screen, it abandons the routine that called it.

The net effect is to pop 5 bytes and resume just after the JSR that called the graphics routine, in bank DB. This requires that the graphics routine was entered with JSR, that nothing else was pushed in between, and that DB equals that code's bank. PIXI sprites set DB = their own bank at their entry.

GetMap16

Reads the Map16 tile number at a level position.

This is SMW's own pointer chain: $00BEA8 = {$BDA8, $BDE8, …} → per-level-mode tables → 3-byte per-screen pointers. Only their low 16 bits are used. 2 × $1933, 2 × $1925 and 3 × the screen are each taken modulo $100, and the tripling keeps the carry out of its doubling (3 × $80 = $81); only out-of-range inputs see this. $1926, $1934 and $0C do not count [MEASURED].

  1. Tile = $7F:addr << 8 | $7E:addr.

LoseYoshi

If the player is riding Yoshi, Yoshi runs away as if the player had been hit.

Random

Returns a random number from 0 to max inclusive.

SetPlayerClippingAlternate

Writes the player's interaction box as clipping 1, with 16-bit values.

SetSpriteClippingAlternate

Turns a caller-supplied box into clipping 2 for sprite X by adding the sprite's position.

ShooterMain

Decides whether shooter X fires this frame and finds a free sprite slot for the shot.

SpawnExtended

Spawns an extended sprite at sprite X's position plus an offset, with initial speeds.

SpawnSmoke

Spawns a smoke sprite at sprite X's position plus an offset.

SpawnSprite

Spawns a normal or custom sprite at sprite X's position plus an offset, with initial speeds.

SpawnSpriteSafe

The same as SpawnSprite, except that the search starts at slot $04 (caller-supplied) and goes down to 0.

Star

Star-kills sprite X and gives the player points, as a star hit does.

SubHorzPos

Reports which side of sprite X the player is on.

SubOffScreen

Erases sprite X when it has moved too far off screen. A selects the size of the off-screen margin.

$13D7 = level height. $0BF2 and $0BF0 are the Y range limits kept in RAM.

  1. If $167A,x bit 2 is set (process while off screen): return.
  2. Margin test:
    • i = (A&7)·2 + ($13 & 1).
    • D = high byte of ($1A16 + sext16(off[i]) − X16), where off = t15[i]:t14[i].
    • If $13 bit 0 is set, D ^= $80.
    • Erase if D bit 7 is set, otherwise return.

The effect: on even frames, test the right margin (erase if the sprite is beyond it); on odd frames, test the left margin.

Differences from bank 1:

SubVertPos

Reports whether the player is above or below sprite X.

Summary of the 1.2.x routines

"Used by" counts the sprite files that call the routine (%Name() in a sample of 82 PIXI sprite files from several hacks, routines folders excluded. The count of distinct files by content is in brackets.

routineused bySMW equivalentnotes
Aiming0noneHardest to get bit-exact: band selection, R[k] formula, three floor-multiplies, sign rules. Fully specified for non-SA-1.
CapeContact0$0293CE-$0293F2 body + $029696Easy; layer/climb rule is the only subtlety.
ChangeMap161 [1]none ($00C0FB reused)Address math shared with GetMap16; bit 15 dropped on store; leaves $99/$9B swapped.
CheckForContactAlternate0noneEasy; returns M=1 always.
CircleX0table = $07F7DB clampedSigned PPU multiply (radius ≥ $80 is negative); writes Mode 7 registers.
CircleY0table = $07F7DB clampedAs CircleX.
ExtendedCapeClipping0$02A51C + $029696Easy; offsets unsigned.
ExtendedGetDrawInfo0$02A1A4-$02A1D3 (≈)Odd vertical rule (t uses addition, changed in 1.40); slots 8-9 read past the table.
ExtendedHurt0$02A3F6-tail + $02A469Calls $02A469 with DB = $00 (SMW: $02).
ExtendedSpeed7 [1]$02B554/$02B560X = $15E9 after X update; gravity sign quirk.
FinishOAMWrite0$01B7B3Size bit added, not ORed; scratch layout differs from SMW.
FireballContact0box = $02A547Any type in slots 8/9 counts.
GetDrawInfo15 [5]$01A365Stack rewrite on off-screen (5 bytes out, needs DB = caller's bank); no status-9 exclusion.
GetMap160nonePointer chain via $00BEA8; EXLEVEL range check; RAM swap side effect.
LoseYoshi1 [1]$02A473-$02A4ADUses $18E2 where SMW uses $18DF.
Random0wraps $01ACF9Easy.
SetPlayerClippingAlternate0$03B664 (16-bit form)Easy.
SetSpriteClippingAlternate0noneTrivial.
ShooterMain0$02B466-$02B4A5Y unchanged on most "don't fire" paths.
SpawnExtended0none (inline idiom)Y unchanged on off-screen refusal.
SpawnSmoke0inline idiom ($01AB6F)Fails instead of reusing slot 0.
SpawnSprite10 [2]noneCarry through $07F7D2; $0187A7 with $00-$03 saved; write order.
SpawnSpriteSafe1 [1]noneAs SpawnSprite, start at $04.
Star8 [1]$01A847-$01A87DOrder and $94 vs $D1; $0E-$0F written.
SubHorzPos13 [3]$03B817/$02D4FAWrites $0E=low and $0F=high, unlike SMW.
SubOffScreen13 [3]$01AC31… / $03B85D…EXLEVEL branch, $7FAF00 load table, X ← $15E9, DB switch.
SubVertPos0$03B829Exact.

Routines added in PIXI 1.40

Contracts for the 23 shared routines that PIXI 1.40 has and 1.2.x does not, under the same rules. The macro name is the path with the folders run together: Bounce/SetSpeed.asm is %BounceSetSpeed(). Intended use was read from the _header.asm files of cluster, extended, shooters, sprites and misc_sprites/*. The 1.40 PIXI folder has no README.

Conventions for this section

Everything under "Conventions that apply to every routine" above still holds (LoROM, D = 0, JSL/RTL, 8/8 on entry, by-product flags). In addition:

| kind | slots | number | X lo/hi | Y lo/hi | X speed | Y speed | X frac | Y frac | other | |---|---|---|---|---|---|---|---|---|---| | bounce | 4 | $1699 | $16A5/$16AD | $16A1/$16A9 | $16B5 | $16B1 | $16B9 | $16BD | $16C9 direction (bits 0-1), $1901 properties | | score | 6 | $16E1 | $16ED/$16F3 | $16E7/$16F9 | — | $16FF | — | — | $1705 layer | | smoke | 4 | $17C0 | $17C8/— | $17C4/— | — | — | — | — | $17CC timer | | spinning coin | 4 | $17D0 | $17E0/$17EC | $17D4/$17E8 | — | $17D8 | — | $17DC | $17E4 layer | | minor extended | 12 | $17F0 | $1808/$18EA | $17FC/$1814 | $182C | $1820 | $1844 | $1838 | $1850 timer | | cluster | 20 | $1892 | $1E16/$1E3E | $1E02/$1E2A | — | — | — | — | | | extended | 8 (+2 fireball) | $170B | $171F/$1733 | $1715/$1729 | $1747 | $173D | $175B | $1751 | |

The bounce fractions: PIXI's names put the X fraction at $16B9 and the Y fraction at $16BD. SMW's own bounce code uses them the other way round (see BounceUpdatePos).

This is exactly SMW's $02B526 (bounce Y), $02B560 (extended Y) and $02B58E (spinning coin Y).

BounceGetDrawInfo

Finds the OAM slot and screen position of bounce sprite X. Handles the X high bit and layer 2.

BounceGenericDraw

Draws bounce sprite X as one 16×16 tile.

BounceSetMarioSpeed

Gives the player the push of a bounce block.

BounceSetSpriteSpeed

Gives a normal sprite the push of a bounce block.

BounceSetSpeed

Accelerates a bounce sprite as SMW's bounce blocks are accelerated.

BounceSetupMap16

Sets $98-$9B and $1933 to the block under bounce sprite X, ready for SMW's $00BEB0.

BounceUpdatePos

Moves bounce sprite X by its speeds.

ScoreGetDrawInfo

Finds the OAM slot and screen position of score sprite X.

ScoreGenericDraw

Draws score sprite X as two 8×8 tiles side by side, in front of all layers.

ScoreUpdateYPos

Lets score sprite X rise one pixel at a time, stopping near the top of the screen.

SmokeGetDrawInfo

Finds the OAM slot and screen position of smoke sprite X.

SmokeGenericDraw

Draws smoke sprite X as one tile.

SpinningCoinGetDrawInfo

Meant to find the OAM slot and screen position of spinning-coin sprite X, erasing it when off the side of the screen. As shipped it compares the wrong camera bytes (see Behaviour). The contract describes what it does, not what it was meant to do.

SpinningCoinUpdateYPos

MinorExtendedGetDrawInfo

Finds the OAM slot and screen position of minor extended sprite X; erases it when well off screen.

ClusterGetDrawInfo

The same contract as MinorExtendedGetDrawInfo (including the erase-path flags), on the cluster tables:

MinorExtendedSpeed

Moves minor extended sprite X along one axis.

SpawnClusterGeneric (Spawn/ClusterGeneric.asm)

Spawns a cluster sprite at an origin plus an offset.

SpawnExtendedGeneric (Spawn/ExtendedGeneric.asm)

SpawnGeneric (Spawn/Generic.asm), the minor extended spawner

SpawnScoreGeneric (Spawn/ScoreGeneric.asm)

SpawnSmokeGeneric (Spawn/SmokeGeneric.asm)

SpawnSpinningCoinGeneric (Spawn/SpinningCoinGeneric.asm)

Edge cases common to the *Generic spawns

Changes to the 1.2.x routines in 1.40

The 1.2.x files were compared with the 1.40 files of the same macro name (ExtendedX → Extended/X.asm, SpawnX → Spawn/X.asm), both reduced to their instructions (comments, label spelling and 1.40's local-label syntax removed, defines resolved). The two sa1def.asm files give the same values for every define these routines use.

Changed in behaviour: 1 of 27 (ExtendedGetDrawInfo).

ExtendedGetDrawInfo: changed

Registers on return keep the same shape: visible with h = 0: A = d, C=0; visible with h = $FF: A = d, C=1; hidden or erased: A = $F0, N=1, Z=0. The X-axis rule, $00, $01 and the erase ($170B,x = 0) are unchanged.

Same behaviour, different code

Identical

Aiming, CapeContact, ChangeMap16, CheckForContactAlternate, CircleX, CircleY, ExtendedCapeClipping, ExtendedHurt, ExtendedSpeed, FinishOAMWrite, FireballContact, GetDrawInfo, GetMap16, LoseYoshi, Random, SetPlayerClippingAlternate, SetSpriteClippingAlternate, ShooterMain, SpawnExtended, SpawnSmoke, SpawnSprite, SpawnSpriteSafe, Star, SubHorzPos, SubOffScreen and SubVertPos behave the same (only labels, comments, layout and the spellings noted above differ). The [MEASURED] corrections in the 1.2.x contracts apply to the 1.40 versions unchanged.

sa1def.asm macros

Interface contracts for the assembler macros PIXI defines in asm/sa1def.asm, the file every PIXI sprite is assembled with. Same rules as the routines: behaviour only. The 1.2.x-era copy has 7 macros and first includes an optional config.asm; the 1.40 copy has the same 7 plus invoke_sa1, and no config.asm include.

Defines the macros depend on

debugmsg(msg)

BES(label): branch if extra bit set

BEC(label): branch if extra bit clear

Between(x, label)

invoke_snes(addr)

invoke_sa1(label), 1.40 only

define_sprite_table(name, addr, addr_sa1)

define_base2_address(name, addr)

Who calls them

In a scan of 107 PIXI sprite and driver files (routines folders excluded):

macrofilesspriteswhere
BEC113copies of KoopaShell (including PIXI's own sprites/koopa_shell.asm), UpsideDownKoopaShell and FlyingQuestionBlock
debugmsg10PIXI's own driver, asm/main.asm
BES, Between, invoke_snes, invoke_sa1, define_sprite_table, define_base2_address00—

Other %Name( calls in that scan that are not shared routines and not from sa1def.asm: