View on GitHub

ASM libraries

Sprite insertion tool for SMW ROM image.

Glossary

Name Description
Accumlator An alias for the A register.
Index Register Alias for X and Y register.
AL Lower 8 bits of A register.
AH Higher 8 bits of A register. You can’t access this value unless you use 16 bits mode or swap the value with XBA.
XL Lower 8 bits of X register.
XH Higher 8 bits of X register. You can’t access this value unless you use 16 bits mode or swap the value with TAX, XBA and TXA.
YL Lower 8 bits of Y register.
YH Higher 8 bits of Y register. You can’t access this value unless you use 16 bits mode or swap the value with TAY, XBA and TYA.

smwlibs.asm

Under constructing…

Address Name Type Description
$0086DF SMW_ExecutePtr JSL routine  
$0086FA SMW_ExecutePtrLong JSL routine  
$00F5B7 SMW_HurtMario JSL routine  
$00F606 SMW_KillMario JSL routine  
$05B160 SMW_SubSideExit JSL routine  
$0286BF SMW_YoshiStomp JSL routine  
$0294C1 SMW_GroundPound JSL routine  
$00BEB0 SMW_GenerateTile JSL routine  
$01ACF9 SMW_GetRand JSL routine  
$02ACE5 SMW_GivePoints JSL routine  
$05B329 SMW_GiveCoins JSL routine  
$03A6C8 SMW_KillMostSprites JSL routine  
$01AA33 SMW_BoostMarioSpeed JSL routine  
$03B664 SMW_GetMarioClipping JSL routine  
$03B69F SMW_GetSpriteClippingA JSL routine  
$03B6E5 SMW_GetSpriteClippingB JSL routine  
$03B72B SMW_CheckContack JSL routine  
$07F7D2 SMW_InitSpriteTables JSL routine  
$01801A SMW_UpdateSpriteYPosNoGravity JSL routine  
$018022 SMW_UpdateSpriteXPosNoGravity JSL routine  
$01802A SMW_UpdateSpritePosWithGravity JSL routine  
$018032 SMW_SpriteSpriteInteraction JSL routine  
$01A7DC SMW_SpriteMarioInteraction JSL routine  
$01803A SMW_SpriteInteraction JSL routine  
$019138 SMW_SpriteObjectInteraction JSL routine  
$01B7B3 SMW_SpriteFinishOAMWrite JSL routine  
$0DA8A6 SMW_IndexToBit Data  
$07F7DB SMW_CircleCoords Data  

libAkagi.asm

The library of frequently used routines.

Name Type Description
GetDrawInfo JSL routine Get sprite tile map index.
SubOffScreen JSL routine Kill sprite when sprite is off screen.
SubOffScreenA JSL routine Kill sprite when sprite is off screen.

GetDrawInfo

Get sprite tile map index.

Register width

Register Width
Accumlator (A) 8 bits
Index (X,Y) 8 bits

Inputs

Input Description
XL Index of currently executing sprite

Return

Return Description
YL Index to sprite tile map($0300)

Note

Be sure to call this routine in the following format.

AnyRoutine:
    JSR SubGfx   ; <-- Be sure to use JSR.
        ;
        ;
    RTL

SubGfx:
    JSL GetDrawInfo
        ;
        ;
    RTS

SubOffScreen

Kill sprite when sprite is off screen.

Caution: The Inputs specification differs from PIXI’s one.

Register width

Register Width
Accumlator (A) 8 bits
Index (X,Y) 8 bits

Inputs

Input Description
YL Sub off screen type
0: X0
2: X1
4: X2
6: X3
8: X4
10: X5
12: X6
14: X7
XL Index of currently executing sprite

Return

Return Description
Carry flag Set: sprite is killed
Clear: sprite is alive(OnScreen)

Note

The operation from X4 to X7 processing isn’t guaranteed.

SubOffScreenA

Kill sprite when sprite is off screen.

It is compatible with PIXI’s SubOffScreen, but slightly slower.

Register width

Register Width
Accumlator (A) 8 bits
Index (X,Y) 8 bits

Inputs

Input Description
AL Sub off screen type
0: X0
1: X1
2: X2
3: X3
4: X4
5: X5
6: X6
7: X7
XL Index of currently executing sprite

Return

Return Description
Carry flag Set: sprite is killed
Clear: sprite is alive(OnScreen)

Note

The operation from X4 to X7 processing isn’t guaranteed.


libScroller.asm

Library about scroller process.

Name Type Description
UpdateLayerPos JSL routine The routine for update layer position.

UpdateLayerPos

The routine for update layer position.

Add the value of $1446+X to $146E+X (and $1462+X).

Register width

Register Width
Accumlator (A) 16 bits
Index (X,Y) 8 bits

Inputs

Input Description
XL Position type
0: Layer1 X
2: Layer1 Y
4: Layer2 X
6: Layer2 Y

Return

none.


libGarbage.asm

Misc library.

Name Type Description
ShowShooterSmoke JSL routine Generate smoke for shooter.

ShowShooterSmoke

Generate smoke for shooter.

Register width

Register Width
Accumlator (A) 8 bits
Index (X,Y) 8 bits

Inputs

Input Description
AL The number of extended sprite for generate
XL Index of currently executing shooter

Return

none.