-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsmw.asm
636 lines (564 loc) · 11.8 KB
/
smw.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
;Disassembly of Super Mario World (Unl)
;This is still a work in progress and is not recommended for use in hacks.
;Assembles with morskoyzmey's fork of ASM6.
;----------------------------------------
db "NES", $1A ;NES Header
db 32 ;32 x 16k PRG banks
db 32 ;32 x 8k CHR banks
db $A1, $50 ;Mapper: 90
dsb 8, $00 ;Header Tail
;----------------------------------------
;Constants
include constants.asm
;Macros
include macros.asm
;General RAM defines
;Game engine
PPUControlMirror = $00
PPUMaskMirror = $01
ScrollXPos = $02
ScrollYPos = $03
FrameCount = $06
Bank42Backup = $08
Bank41Backup = $09
ButtonsHeld = $030A
ButtonsPressed = $030C
ButtonsMirrored = $030E
Controller2Input = $063E
SecFrameCount = $0313
ScratchRAM = $2E
PlayerAnimationPtr = $E5
NMIJMPOpcode = $063A
CameraXScreen = $51
VerticalScrollFlag = $5B
TileRowCount = $B0
BGAttrRowCount = $B1
MetaspriteRowAlignment = $B2
EntitySetPtr = $DC
InLevelFlag = $DE
GameState = $DF
GameSubstate = $E0
PlayerState = $E1
BGPalette = $0310
FadeoutMode = $0311
PalTransition = $0312
TileAttributes = $0400
TileColumnMem = $0485
PalAssignPtrHi = $04C1
PalAssignPtrLo = $04C2
PalAssignData = $04C3
PPUUpdatePtr = $03A1
PPUWriteCount = $03A4
PPUDataBuffer = $03A5
WarpLevelNumber = $060B
WarpNumber = $060C
VertScrollLock = $060D
HorizScrollLock = $060F
;Sprite rendering variables
OAMFreeIndex = $3C
MetaspriteBankIndex = $36
MetaspriteRelTile = $38
MetaspriteColXBuf = $41
MetaspriteRowYBuf = $B2
MetaspriteColCount = $3E
MetaspriteRowCount = $3F
GS0SpriteAnimPtr = $AE
GS0SpriteCount = $30
GS0SpriteBankNum = $31
GS0SpriteXPos = $41
GS0SpriteFrame = $B2
GS0SpriteSlot = $033B
GS0SpriteFlags = $034D
GS0SpriteYPos = $0356
TitleDemoAction = $0365
TitleJumpTimer = $0366
TitleWalkTimer = $0367
Current8x8Tilemap = $032F
TileRepeatCount = $3E
TileRepeatBytesLeft = $3E
GameType = $035F
HUDUpdateTiles = $0378
HUDUpdate = $037D
HUDDisplay = $0607
BGBank1 = $03C5
BGBank2 = $03CB
BGBank3 = $03C6
BGBank4 = $03CC ;Unused
BGBankAnimation = $03CD
SpriteBank1 = $03C7
SpriteBank2 = $03C8
SpriteBank3 = $03C9
SpriteBank4 = $03CA
DataBank1 = $04F3
DataBank2 = $04F5
WorldNumber = $04F6
DataBank3 = $04F7
LevelNumber = $04F7
LevelScreenOrderPtr = $8C
XScroll = $063F
YScroll = $0640
PlayerXScreen = $0A
PlayerXPos = $0B
PlayerYScreen = $0C
PlayerYPos = $0D
PlayerXScreenDup = $0E
PlayerXPosDup = $0F
PlayerYScreenDup = $10
PlayerYPosDup = $11
PlayerSprXPos = $12
PlayerSprYPos = $13
PlayerXSpeed = $14
ScaledPlayerXSpd = $28
PlayerYSpeed = $15
ScaledPlayerYSpd = $2B
PlayerAnimation = $16
PlayerAnimationFrame = $17
PlayerMovement = $19
PlayerPrevDirection = $4F
PlayerSpriteAttributes = $1A ;Not sure what else to call this
PlayerFramePtr = $1B
PlayerAction = $1D
PlayerPrevAction = $1E
PlayerClimbingState = $49
PlayerSprXPosOfs = $1F
PlayerSprYPosOfs = $21
PlayerSpriteMirror = $23
PlayerMetaspriteHAlign = $28
PlayerMetaspriteVAlign = $2B
PlayerWidth = $3A
PlayerHeight = $3B
PlayerPalMappingLo = $C9
PlayerPalMappingHi = $CA
MemJMPOpcode = $0600
MemJMPPtr = $0601
CapeAction = $062C
PlayerAttributes = $06E0
PlayerBackColl = $96
PlayerScreenID = $99
PlayerColXScreen = $64
PlayerColXPos = $65
PlayerColYScreen = $66
PlayerColYPos = $67
FireballSlot = $062F
FireballSlot2 = $0630
UsedFireballSlots = $0631
Player1Lives = $036A
Player2Lives = $036B
Player1YoshiCoins = $036C
Player2YoshiCoins = $036D
LevelTimerLo = $036E
LevelTimerHi = $036F
P1Score = $0372
P2ScoreLoByte = $0374
P2ScoreHiByte = $0375
Player1Coins = $0376
Player2Coins = $0377
P1YoshiBackup = $0393
P2YoshiBackup = $0394
CurrentPlayer = $0399
HurtFlag = $05FD
ActionFrameCount = $0611
PlayerActionTicks = $0612
SwallowFrameCount = $0613
YoshiSwallowTimer = $0614
FlightTakeoffTimer = $061C
Player1YoshiStatus = $061F
YoshiExitStatus = $0620
YoshiIdleStorage = $0621
YoshiIdleMovement = $0622
YoshiTongueState = $0623
PlayerPowerup = $0624
ItemBox = $0625
P1PowerupBackup = $06DA
P2PowerupBackup = $06DB
SpriteMem = $0200
ScrollSpeed = $0326
LogoFlag = $032D
LogoXOffset = $0330
LogoYOffset = $0331
OverworldMapTimer = $032F
WorldSelectNum = $032F
TitleCursorYPos = $0357
PlayerTitleYPos = $0357
PlayerMapAnim = $0361
PlayerMapFrame = $0378
MapMovementFlag = $0379
MapLevelID = $037F
CastleDestroyFlags = $0380
OverworldMapScreen = $0390
WorldSelectTrigger = $0396
UnlockNextLevel = $0397
LevelID = $039C
P1LevelsUnlocked = $039E
P2LevelsUnlocked = $039F
ColumnFinishFlag = $0480
NextBGColumn = $0481
;Object RAM
;object handler
ObjectPRGBank = $AC
ObjectCount = $A3
LowerObjSlot = $A4
ObjectSlot = $0500
ObjectXPos = $0514
ObjectXScreen = $0528
ObjectYPos = $053C
ObjectYScreen = $0550
ObjectState = $0564
ObjectVariables = $0578
ObjectXDistance = $05A0
ObjXScreenDistance = $05B4
ObjectYDistance = $05C8
ObjYScreenDistance = $05DC
ObjectAttributes = $05F0
ObjectAction = $0669
ObjActionTimer = $0641
EnemyAnimFrame = $0655
ObjFrameCounter = $062B
;special objects
BubbleXPos = $0619
BubbleYPos = $061A
BubbleSpawnPoint = $061B
BooBuddiesFlag = $C3
BooBuddiesXPos = $C4
BooBuddiesXScreen = $C5
BooBuddiesYPos = $C6
BooBuddiesYScreen = $C7
YoshiUnmountedState = $05F1
YoshiXPos = $05F2
YoshiXScreen = $05F3
YoshiYPos = $05F4
YoshiYScreen = $05F5
YoshiAnimation = $05F8
YoshiXDistance = $05F9
YoshiXScreenDist = $05FA
YoshiYDistance = $05FB
YoshiYScreenDist = $05FC
JYEasterEggInput = $05EF
BowserStatus = $05F7
InterruptMode = $0606
YScreenCount = $060E
XScreenCount = $0610
UnderwaterFlag = $061D
LevelTopScreenOffset = $04FA
LevelBottomScreenOffset = $04FB
PlayerPowerupBuffer = $0626
ScreenShake = $0633
PSwitchFrameCount = $0634
PSwitchTimer = $0635
PlayerHoldFlag = $0636
PlayerHoldFlag2 = $0637
InvincibilityTimer = $0638
ReznorsDefeated = $0666
ONOFFBlockFlag = $0668
FreezeFlag = $067D
CheckpointFlag = $06A2
BowserHits = $06E5
EndingFreezeFlag = $06E6
ClownCarFace = $06E8
PauseFlag = $0709
;Sound Driver RAM Defines
MusicRegister = $8E
SFXRegister = $8F
MusicBackup = $90
SoundPointer = $FE
MuteFlag = $0700
ChannelPtrs = $0724
VolMacroPtrs = $0751
DutyMacroPtrs = $075D
ChannelVolMacroInds = $074D
Pulse1Transpose = $070D
ChannelPitch = $0739
Pulse1VolumeEnv = $0749
Pulse1Duty = $0759
ChannelPitchSetting = $0761
Pulse2Transpose = $070E
Pulse2VolumeEnv = $074A
Pulse2Duty = $075A
Pulse2PitchSetting = $0762
TriangleTranspose = $070F
TriangleVolumeEnv = $074B
TrianglePitchSetting = $0763
NoiseVolumeEnv = $074C
NoisePitchSetting = $0764
MusicSpeed = $072C
TrianglePitchSetting = $0763
;Hardware registers
PPUCTRL = $2000
PPUMASK = $2001
PPUSTATUS = $2002
OAMADDR = $2003
OAMDATA = $2004
PPUSCROLL = $2005
PPUADDR = $2006
PPUDATA = $2007
SQ1_VOL = $4000
SQ1_SWEEP = $4001
SQ1_LO = $4002
SQ1_HI = $4003
SQ2_VOL = $4004
SQ2_SWEEP = $4005
SQ2_LO = $4006
SQ2_HI = $4007
TRI_LINEAR = $4008
TRI_LO = $400A
TRI_HI = $400B
NOISE_VOL = $400C
NOISE_LO = $400E
NOISE_HI = $400F
DMC_FREQ = $4010
DMC_RAW = $4011
DMC_START = $4012
DMC_LEN = $4013
OAMDMA = $4014
APUSTATUS = $4015
JOY1 = $4016
JOY2 = $4017
;Mapper-specific registers
;PRG banks
M90_PRG0 = $8000
M90_PRG1 = $8001
M90_PRG2 = $8002
M90_PRG3 = $8003
;CHR banks
M90_BG_CHR0 = $9000
M90_BG_CHR1 = $9001
M90_BG_CHR2 = $9002
M90_BG_CHR3 = $9003
M90_SP_CHR0 = $9004
M90_SP_CHR1 = $9005
M90_SP_CHR2 = $9006
M90_SP_CHR3 = $9007
;Nametable banks
M90_NT0 = $B000
M90_NT1 = $B001
M90_NT2 = $B002
M90_NT3 = $B003
;Multiplier
M90_MULTIPLICAND = $5800
M90_MULTIPLIER = $5801
;IRQ registers
M90_IRQ_MODE = $C001
M90_IRQ_DISABLE = $C002
M90_IRQ_ENABLE = $C003
M90_IRQ_PRESCALER = $C004
M90_IRQ_COUNTER = $C005
M90_IRQ_XOR = $C006
;Misc
M90_BANK_SIZE = $D000
M90_CHR_CTRL2 = $D001
M90_PPU_CFG = $D002
M90_CHR_CTRL1 = $D003
;--------------------------------------
;Level Data
;Levels
incbin levels/lvl_1-1.bin
incbin levels/lvl_1-2.bin
incbin levels/lvl_1-3.bin
incbin levels/lvl_1-4_1.bin ;1-4 is split up by special levels
incbin levels/lvl_GhostHouseIntro.bin
incbin levels/lvl_CastleIntro.bin
incbin levels/lvl_YoshiHouse.bin
incbin levels/lvl_1-4_2.bin
incbin levels/lvl_Bonus.bin
incbin levels/lvl_2-1.bin
incbin levels/lvl_2-2.bin
incbin levels/lvl_2-3.bin
incbin levels/lvl_2-4.bin
incbin levels/lvl_3-1.bin
incbin levels/lvl_3-2.bin
incbin levels/lvl_3-3.bin
incbin levels/lvl_3-4.bin
incbin levels/lvl_4-1.bin
incbin levels/lvl_4-2.bin
incbin levels/lvl_4-3.bin
incbin levels/lvl_4-4.bin
incbin levels/lvl_5-1.bin
incbin levels/lvl_5-2.bin
incbin levels/lvl_5-3.bin
incbin levels/lvl_5-4.bin
incbin levels/lvl_6-1.bin
incbin levels/lvl_6-2.bin
incbin levels/lvl_6-3.bin
incbin levels/lvl_6-4.bin
incbin levels/lvl_7-1.bin
incbin levels/lvl_7-2.bin
incbin levels/lvl_7-3.bin
incbin levels/lvl_7-4.bin
incbin levels/lvl_BowserRoom.bin
incbin levels/lvl_ClownCar.bin
;Tilesets
incbin tilesets/ts_1-1.bin
incbin tilesets/ts_1-2.bin
incbin tilesets/ts_1-3.bin
incbin tilesets/ts_1-4.bin
incbin tilesets/ts_2-1.bin
incbin tilesets/ts_2-2.bin
incbin tilesets/ts_2-3.bin
incbin tilesets/ts_2-4.bin
incbin tilesets/ts_3-1.bin
incbin tilesets/ts_3-2.bin
incbin tilesets/ts_3-3.bin
incbin tilesets/ts_3-4.bin
incbin tilesets/ts_4-1.bin
incbin tilesets/ts_4-2.bin
incbin tilesets/ts_4-3.bin
incbin tilesets/ts_4-4.bin
incbin tilesets/ts_5-1.bin
incbin tilesets/ts_5-2.bin
incbin tilesets/ts_5-3.bin
incbin tilesets/ts_5-4.bin
incbin tilesets/ts_6-1.bin
incbin tilesets/ts_6-2.bin
incbin tilesets/ts_6-3.bin
incbin tilesets/ts_6-4.bin
incbin tilesets/ts_7-1.bin
incbin tilesets/ts_7-2.bin
incbin tilesets/ts_7-3.bin
incbin tilesets/ts_7-4.bin
incbin tilesets/ts_YoshiHouse.bin
incbin tilesets/ts_Unused1.bin
incbin tilesets/ts_GhostHouseIntro.bin
incbin tilesets/ts_CastleIntro.bin
;--------------------------------------
;PRG banks
base $C000
include prg/prg036.asm
pad $E000
;48010 - 4a00f
;player mapping data
base $8000
include prg/prg037.asm
pad $A000, $00
;4a010 - 4c00f
;Code for various objects
base $8000
include prg/prg038.asm
pad $A000
;4c010 - 4e00f
;unknown/unused tileset data
base $E000
include prg/prg039.asm
pad $E000+8192
;4e010 - 5000f
;Collision code and tile behavior
include prg/prg040.asm
;50010 - 5200f
;Completely empty/unused
base $A000
include prg/prg041.asm
pad $C000
;52010 - 5400f
;Various Game Mode 0 stuff (Title, map, etc)
base $8000
include prg/prg042.asm
pad $A000
;54010 - 5600f
;8x8 Tilemaps and Overworld Data
base $8000
include prg/prg043.asm
pad $A000
;56010 - 5800f
;Bonus level tileset
base $8000
include prg/prg044.asm
pad $A000
;58010 - 5a00f
;Title Screen/Map Tilesets
base $8000
include prg/prg045.asm
pad $A000
;5a010 - 5c00f
;title screen level data
base $8000
include prg/prg046.asm
pad $A000
;5c010 - 5e00f
;Overworld Map Tile Data
base $C000
include prg/prg047.asm
pad $E000
;5e010 - 6000f
;Sprite palette mappings
base $8000
include prg/prg048.asm
pad $A000
;60010 - 6200f
;more object code
base $8000
include prg/prg049.asm
pad $A000
;62010 - 6400f
;Code for platforms and other objects
base $8000
include prg/prg050.asm
pad $A000
;64010 - 6600f
;Various objects
base $E000
include prg/prg051.asm
pad $E000+8192
;66010 - 6800f
;Movement data for various objects
base $A000
include prg/prg052.asm
pad $C000
;68010 - 6a00f
;sprite manager?
base $8000
include prg/prg053.asm
pad $A000
;6a010 - 6c00f
;Various objects
base $A000
include prg/prg054.asm
pad $C000
;6c010 - 6e00f
;Object handler
base $8000
include prg/prg055.asm
pad $A000
;6e010 - 7000f
;More code for objects
base $8000
include prg/prg056.asm
pad $A000
;70010 - 7200f
;Even more object code
base $A000
include prg/prg057.asm
pad $C000
;72010 - 7400f
;Player control code
base $8000
include prg/prg058_59.asm
pad $C000
;74010 - 7800f
;Music data and sound driver
base $8000
include prg/prg060.asm
;78010 - 7a00f
;Unknown
base $A000
include prg/prg061.asm
pad $C000
;7a010 - 7c00f
;Level handling
base $C000
include prg/prg062.asm
pad $E000
;7c010 - 7e00f
;Bank 47 clone
base $E000
include prg/prg063.asm
pad $FFFA
;7e010 - 8000f
;IRQ, game engine, etc.
;--------------------------------------
;Interrupt vectors
.dw NMIJMPOpcode
.dw Reset
.dw IRQ
;--------------------------------------
;CHR file
incbin SMW.chr
;--------------------------------------