-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrog.ini
521 lines (507 loc) · 22.5 KB
/
trog.ini
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
# @c: ma9|"byE`aoComment "bpa ""i
# @f: ye/^0
RAM $2000 PPUCTRL
RAM $2001 PPUMASK
RAM $2002 PPUSTATUS
RAM $2003 OAMADDR
RAM $2004 OAMDATA
RAM $2005 PPUSCROLL
RAM $2006 PPUADDR
RAM $2007 PPUDATA
RAM $4000 SQ1_VOL
RAM $4001 SQ1_SWEEP
RAM $4002 SQ1_LO
RAM $4003 SQ1_HI
RAM $4004 SQ2_VOL
RAM $4005 SQ2_SWEEP
RAM $4006 SQ2_LO
RAM $4007 SQ2_HI
RAM $4008 TRI_LINEAR
RAM $400A TRI_LO
RAM $400B TRI_HI
RAM $400C NOISE_VOL
RAM $400E NOISE_LO
RAM $400F NOISE_HI
RAM $4010 DMC_FREQ
RAM $4011 DMC_RAW
RAM $4012 DMC_START
RAM $4013 DMC_LEN
RAM $4014 OAMDMA
RAM $4015 SND_CHN
RAM $4016 JOY1
RAM $4017 JOY2
# Vars
RAM $00 savedCurPPUCTRL
RAM $01 savedCurPPUMASK
RAM $04 scrollX
RAM $05 scrollY
RAM $06 frameCtr
RAM $07 nmiHandlerSelector
RAM $08 somePatternTablePage
RAM $10 buttonScratch
#RAM $13-19 some fns save these to stack before modifying, then restore when done.
RAM $13 temp_13
RAM $14 temp_14
RAM $15 temp_15
RAM $16 temp_16
RAM $17 temp_17
RAM $18 temp_18
RAM $19 temp_19
RAM $1D currentPlayerPosX
RAM $1E currentPlayerPosY
# high bit indicates which player (0/1), bit 2 ($04) is set before entry, at least in player fireball handling
# in movement calculations for normal gameplay state, this is the player's facing.
RAM $1F currentPlayerInfoOrTemp
RAM $21 currentEnemyOrTemp
RAM $23 currentPlayerOrTemp
RAM $25 savedRomBank1
RAM $26 savedRomBank2
RAM $27 currentRomBank
RAM $2A initedTo01
RAM $2B initedTo02
# { if bit 7 set, player is alive:
# init'd to 81 at start
RAM $2C playerOneFlags
RAM $2D playerTwoFlags
# }
RAM $2E playerOneButtons
RAM $2F playerTwoButtons
RAM $30 playerOneInputMask
RAM $31 playerTwoInputMask
RAM $43 palleteZeroA
RAM $44 palleteZeroB
RAM $45 palleteZeroC
# { $1F533 - the following code is used to write
# a power up/down item to a spot on the
# map
RAM $46 tileItemLocL
RAM $47 tileItemLocH
RAM $48 tileItemName0
RAM $49 tileItemName1
RAM $4A tileItemName2
RAM $4B tileItemName3
RAM $4C nextTileItemLocH
RAM $54 mVec8Fireballs
RAM $5C tileItemFrameVec16
# }
#
# { if bit 7 is set and 4 ($10) is unset, mob is drawn ($140FD)
# if bit 6 ($40) is unset on enemy, enemy logic (at least) is not performed, and enemy will respawn.
# - bit 6 is probably the "alive" flag for enemies?
RAM $6C mobOneFlags
RAM $6D mobTwoFlags
# Two above are always player 1 & 2, leaving up to 4 enemies
RAM $6E mobThreeFlags
RAM $6F mobFourFlags
RAM $70 mobFiveFlags
RAM $71 mobSixFlags
# }
RAM $72 mobOnePosX
RAM $73 mobTwoPosX
RAM $78 mobOnePosY
RAM $79 mobTwoPosY
#RAM $7E see _loc_98C6
#RAM $7F see _loc_98C6
RAM $0300 trogOneStartSpriteTileId
RAM $0324 playerOneSomething_324
RAM $032A playerOneSomething_32A
# state: if state == #$0F, extra left/right punch is drawn in DrawPlayerEffects (extra sprited unneeded if moving up or down)
# might be a movement, or index into which graphics to draw into the sprite tiles?
RAM $031E playerOneSomeKindaState
RAM $031F playerTwoSomeKindaState
RAM $033C playerOneFacing
RAM $033D playerTwoFacing
# { mob state jump table indexes
#
# - See subs named PlayerState*_* for player logic states
#
# { players
RAM $035A mobOneLogicState
RAM $035B mobTwoLogicState
# } enemies {
RAM $035C mobThreeLogicState
RAM $035D mobFourLogicState
RAM $035E mobFiveLogicState
RAM $035F mobSixLogicState
# }
# }
RAM $0360 mobOneSomething_360
RAM $0361 mobTwoSomething_361
RAM $0362 mobThreeSomething_362
RAM $0366 mobOneTilePos
RAM $0367 mobTwoTilePos
RAM $0368 mobThreeTilePos
RAM $0372 mobOneSpeed
RAM $0373 mobTwoSpeed
RAM $0374 mobThreeSpeed
# { when reaches 4 hits, player is KO'd
RAM $037E playerOneHitsTaken
RAM $037F playerTwoHitsTaken
# }
RAM $03EC maybePlayerOne8ByteVec
RAM $03F4 maybePlayerTwo8ByteVec
#RAM $0500 maybeCurPlayerNum
RAM $05D7 dunnoButZeroedWhenNmiHandlerSet
RAM $0600 playerOneInvincibleCount
RAM $0601 playerTwoInvincibleCount
# { One of these two might be t-rex mode?
RAM $0602 playerOneRemainingTRexTime
RAM $0603 playerTwoRemainingTRexTime
RAM $0604 playerOneRemainingFireballTime
RAM $0605 playerTwoRemainingFireballTime
RAM $0606 playerOneSomethingPreventsFall_0606
# }
RAM $0612 relatedTo03EC
RAM $0613 relatedTo03F4
RAM $061B tileItemRemainingLifeVec16
RAM $062B tileItemLocationVec16
RAM $063B levelIsTRexWave
RAM $063C currentLevel
RAM $0653 m_horseshoeTimeOutAmt
RAM $0655 playerStartSpeed
RAM $0667 m_currentLoadingTile
# Ranges from $0D to $13:
RAM $0675 enemyBaseSpeedThisLevel
RAM $0676 enemyChaseSpeedThisLevel
RAM $0677 enemiesThisLevel
# When high bit is set, level is ended: low bit indicates winner :
RAM $067D levelWinFlag
RAM $0682 warpLevel
RAM $0683 initedToFFInPlayerStart
RAM $0685 35ByteVec_0685
RAM $06A8 sumOf35ByteVecH
RAM $06A9 sumOf35ByteVecL
RAM $06AD someEnableFlag_06AD
# tileItemsMap:
# High bit set - item is being grown?
# <$07 - pickup item such as horseshoe, speed weed, mushroom, pineapple
# $01 - mushroom
# $02 - speed weed
# $03 - horseshoe
# $07 - tarpit
# $10 - stones (blocked paths)
# $18 - egg
RAM $0700 tileItemsMap
#RAM $07B6 see _loc_98E3 - sound-related?
#RAM $07C7 see _loc_98E3 - sound-related?
#RAM $07C8 see _loc_98E3 - sound-related?
# Vec6 stuff MIGHT have to do with sound?
# 07D5 - elements used to load Vec6Mask when Vec6Values decrease to 0
RAM $07D5 MusicVec6PtrsL_7D5
RAM $07DB MusicVec6PtrsH_7DB
RAM $07E1 MusicVec6Values_7E1
# Joystick traces
#
# If this isn't the right spot, then seek down for more instances of "playerOneButtons",
# and masks that favor the start button ($10).
#Comment $18825 "@A0 - Seems a likely spot for checking for punches? searching upwards for callers..."
#Comment $18937 "@B0 - Another AB check here"
# !!! This could maybe be where I change it? make the ordering depend on the frame counter?
Comment $181B5 "@1"
Comment $1B4E9 "If we got here from M_PlayerPunchHandling/$18F43, y is now $08 (entry $04)"
#Comment $1D3FE "@D0 - This might be it? Follows immediately after movement button checks (which exit early if found)"
#Comment $1D42B "Clear state of buttons A and B (which brought us to this branch)."
#Comment $1D43C "This could conceivably be the check for having struck 3 times?"
#Comment $1D451 "In which case this would be the handler for striking 3 times? ...maybe not, because it's called for the other branches too"
#Comment $1D5AF "@E0"
## Reset traces
#Comment $1C131 "#$5A is 90, or a second and a half of NTSC frames"
#Comment $1C131 "@5"
#Comment $1E870 "@4"
#Comment $1D0A5 "@3"
#Comment $800C "@2"
#Comment $98E0 "@1"
#Comment $9ABB "@0"
## Don't back up just yet - note which memory locs are being used, and mark them appropriately.
# --- sorted below this line ---
# use .,$ !sort -k2,2 -s
Comment $14852 "INDEX into table of powerup items to spawn (below)"
Comment $1485A "Powerup items to spawn"
CertainlyCode $14000 JoyStickProbeWrap
Comment $141EB "This is where a mob sprite is drawn."
Comment $141EB "The tile IDs a mob uses are always the same ones -"
Comment $141EB "The tiles are rewritten as needed when mob changes position!"
CertainlyCode $1448C DrawPlayerEffects
Comment $1448C "Draws effects such as punches, and invincibility rings"
Comment $14493 "Draw the player punch"
Comment $144B7 "Draw invincibility ring!"
Comment $144B7 "I _think_ this is: if the count in $0600,x is greater than 8, display ring, otherwise start flashing it (on and off display based on fctr)"
CertainlyCode $145E0 JoyStickProbe
Comment $145E0 ""
Comment $145E0 " buttons <- the currently pressed buttons, without clearing any already-recorded,"
Comment $145E0 " non-movement buttons."
Comment $145E0 " mask <- used to mask out any non-movement buttons;"
Comment $145E0 " we set it to the mask of buttons not found pressed in this frame."
Comment $145E0 ""
Comment $145E1 "Poll joystick 0, store state in $10"
Comment $1461D "End poll of joystick 0."
Comment $14633 "Poll joystick 1, store state in $10"
Comment $1466F "End poll of joystick 1."
Comment $146AC "This is where the frame-based offset into the tileset is determined (it is multiplied by 4)"
Comment $146D3 "*** This seems to be where tile item data comes from?"
Comment $146D3 " Maybe set a BREAKPOINT here to find when weed item is set; when y has the right value"
Comment $14714 "Here's where an item goes from GROWING to AVAILABLE"
Comment $14B0E "This is where we set the lookup into the current level's variable settings."
CertainlyCode $14CE8 PlayerEncounteredTileItemA
CertainlyCode $15171 InitializeLevelVars
Comment $15171 "Initialize some vars, such as # enemies in this level, reading from a vector whose address was set by look up into $1747F/B47F
Comment $15188 "If this level's settings vector + $20 is >= $05, we set # enemies to 4, otherwise to vector + $20"
CertainlyCode $15317 PlaceEggHereIfPossible
Comment $1532B "PATCH: set #$18 to #$00 to prevent eggs spawning - also have to fix the #$19 below"
Comment $1532B " ...eh, I don't think that's enough. Better fix is detecting when x is #$50 at"
Comment $1532B " SetMapTileToAAndDrawTileXAtY/$15478/$9478"
Comment $1535A "Another place where eggs could spawn..."
Comment $1538F "Spawn an egg?"
CertainlyCode $15478 SetMapTileToAAndDrawTileXAtY
CertainlyCode $15484 DrawTileXAtY
Comment $171B4 "PATCH: Here is where enemy base speed is set"
Comment $172AD TileSetAnimations
CertainlyData $172F1 MushroomTileSets
CertainlyData $172FE SpeedWeedTileSets
CertainlyData $17317 HorseshoeTileSets
Comment $1747F "Indexes to starts of level variable setting vectors."
CertainlyCode $18000 HandleThePlayers
CertainlyCode $18003 HandleTheEnemies
Comment $18003 "PATCH: Could disable all enemies by setting $18003 to $60 (rts)
CertainlyCode $18012 HandleThePlayers_
CertainlyCode $18025 DoPlayer
CertainlyCode $1806F SetMobLogicStateToAccum
CertainlyCode $1807B PlayerStateSpawning_0
Comment $180B4 "PATCH: TREX: Set lda #$02 here to start as TRex"
CertainlyCode $180BF PlayerSpawnInit
Comment $180C9 "PATCH: change #$14 to #$00 to disable spawn invincibility"
CertainlyCode $1817F PlayerStateNormalPlay_1
CertainlyCode $181D0 PlayerStateStartingTRex_2
CertainlyCode $18231 PlayerStateEndingTRex_3
CertainlyCode $18292 PlayerStateTunneling_4
CertainlyCode $182C7 PlayerStateBeingPunched_5
Comment $1831F "Player knocked out"
Comment $18324 "Player conked by Trog"
Comment $1832E "Restore player to normal state"
CertainlyCode $18359 PlayerStateKO_6
CertainlyCode $1837F PlayerStateHitByFireball_7
CertainlyCode $183E7 PlayerStateTarpit_8
CertainlyCode $18431 PlayerStateStompingTRex_9
CertainlyCode $18549 PlayerStateRunInPlace_IMM_RTS__A
CertainlyCode $1854A PlayerStateLoseInvincibility_B
CertainlyCode $18574 PlayerStateTRexHoppingOver_C
CertainlyCode $185F2 PlayerStateFrozenInPlace_E
CertainlyCode $18716 PlayerStateUNSURE_F
CertainlyCode $18809 PlayerStateEatingTrog_10
CertainlyCode $188DA PlayerStateStruckByTrog_11
CertainlyCode $1896A PlayerStateFallingInWater_12
CertainlyCode $1899A PlayerStateFallingInPit_13
CertainlyCode $189E5 PlayerStateUNSURE_M_BEING_EATEN_14
CertainlyCode $18A14 PlayerStateSmushed_15
CertainlyCode $18A3D PlayerStateRecoverFromKO_16
CertainlyCode $18A73 PlayerStateLedgeFall_17
CertainlyCode $18AEC PlayerStateWaterSplash_D
CertainlyCode $18B70 PlayerStateTurnToCamera_18
CertainlyCode $18BA3 PlayerStateHoppingMad_19
Comment $18C6F "This is where player position gets set during normal gameplay"
CertainlyCode $18CD2 M_HandleTileEncounter
Comment $18CD9 "Here is calculated the lookup into the set of on-board tile items"
CertainlyCode $18E4B PlayerHitTheLedge
Comment $18E5A "PATCH: change this to a beq + to avoid ledge falling"
CertainlyCode $18F43 PlayerPunchHandling
Comment $18F49 "PATCH FAIR: This line prevents punch from firing at same time for both trogs"
Comment $18F49 "...but something else still prevents punch from *hitting* at the same time"
Comment $18F61 "Player is shooting a fireball"
#CertainlyCode $18F67 PlayerPunching ... no it's not. Maybe firing?
Comment $18F7D "Now X = posX, Y = posY, and A is $04 if P1, $84 if P2"
CertainlyCode $18F7D PlayerFireBallHandling
Comment $18F9A "Player is punching (no fireball)"
Comment $19000 "If we got here, we're punching another mob"
Comment $19009 "PATCH FAIR: If we can delay this state set until both players are processed,"
Comment $19009 " I think we'll have what we're looking for!"
Comment $19029 "If we get here, current player is a t-rex"
CertainlyCode $1907C CheckForPunchingOtherPlayerElseSetCarry
Comment $1907C "Accum. is active player's facing (from $033C,x)"
Comment $19080 "X is now the _other_ player"
Comment $1908A "Calculate player distances then jump to +++ ($190B9)"
Comment $190B9 "We've calculated the distance between this player and other now"
Comment $190CB "We're close enough to punch them! Clear the carry"
CertainlyCode $19210 M_HandleTiledItemEncounter
Comment $19210 "A is set to tileItemsMap,y"
Comment $1921B "PATCH: set beq arg to $0C (+ clc -> rts) to block egg pickups"
Comment $19225 "less than $07 indicates an item pickup"
Comment $19227 "PATCH: Set branch argument to $00 (stay here) to prevent item pickup (except eggs)"
Comment $19252 "This code responds to tile item pickups (not eggs)"
CertainlyCode $19283 DoPickupMushroom
CertainlyCode $192AE DoPickupSpeedWeed
CertainlyCode $192D2 DoPickupInvincibility
Comment $194A2 "PATCH: change dec ($DE) to lda ($BD) to never count down TRex"
CertainlyCode $1961B ClearPlayerABButtons
CertainlyCode $19666 HandleTheEnemies_
CertainlyCode $1967D DoEnemy
Comment $196C0 "Enemy logic state jump table"
CertainlyCode $196C2 EnemyLogicStateNormalGameplay_1
CertainlyCode $196EE M_HandleDeadEnemy
CertainlyCode $197A6 ReviveOneEnemyOrElseSetCarry
Comment $197DE "This is where an enemy is marked alive (after having opened the entry pit)"
CertainlyCode $19866 EnemyLogicStateSpawn_0
Comment $19885 "This is a spot where a trog sprite is activated, at least after"
Comment $19885 "having left temporarily for having eaten a player"
Comment $19885 "Dunno if other types of sprite could also activate here"
Comment $1B4DC "Mask out to just the lower bits (0-15), then *2 for jump pointers"
Comment $1B4E2 "What are we searching for here? We seem to throw it out once found"
Comment $1B4E2 "We're looking for a zero - maybe an empty spot?"
Comment $1B4E9 "We didn't find anything in the $54 vector"
Comment $1B4F9 "We did find something in the $54 vector"
CertainlyCode $1C06F Reset
Comment $1C071 "Here a #$FF is written to $8007, but that location in ROM contains"
Comment $1C071 "#$FC. Isn't that a bus conflict? Maybe it's meant to obfuscate which"
Comment $1C071 "bank would really be selected (B7 if #$FF, B4 if #$FC?)"
Comment $1C078 "Clear PPU flags"
Comment $1C07E "Wait 5 frames (v blanks)"
Comment $1C088 "We're now in (5th) v blank"
Comment $1C08D "X scroll followed by Y"
Comment $1C093 "Clear PPU flags"
Comment $1C099 "Silence sound"
Comment $1C0A6 "Reset stack pointer"
Comment $1C0A9 "Disable IRQ from APU"
Comment $1C0B3 "memory mapper initialization? series of writes to register"
Comment $1C0B3 "final value written is 01, selecting Bank 01 (the second)?"
Comment $1C0B3 "...seems like it might actually be resetting IRQ handler vectors to $806F... but aren't those locations in ROM? How are they set?!"
Comment $1C0BB "$PPUCTRL <- | $10, set bkgnd tile page 1"
Comment $1C0C4 "Initialize PPU palettes with $0F (black)"
Comment $1C0DA "Enable NMI interrupt:"
Comment $1C0DD "?"
Comment $1C0E5 "if the function succeeded ($1F found), branch will (to re-initialize $0685)"
Comment $1C0E7 "Get the sum of $0685[0-34]."
Comment $1C0EA "Is that sum different from what's stored in $06A8, $06A9?"
Comment $1C0EA "Then jump to +. Else, jump to ++."
Comment $1C0F4 "+: Reinitialize the vector at $0685 and store the sum of those values."
Comment $1C0F4 "Reset $05FE to $FF"
Comment $1C0FF "Variable initialization"
Comment $1C0FF "Initialize a bunch of variables to 0."
Comment $1C117 "Init to 1"
Comment $1C11F "Init to 2"
Comment $1C127 "Initialize a pair of 8-byte vectors starting at $03EC"
CertainlyCode $1C16D AdvanceToNextLevel
CertainlyCode $1C176 AdvanceToWarpLevel
Comment $1C204 "Clear the start button state"
CertainlyCode $1C299 M_StartTheLevel
CertainlyCode $1C2D9 GameplayLoop
Comment $1C2DC "This is where WaitForNmi returned in the midst of gameplay (and possibly after button press was detected)"
Comment $1C32B "End of the (in-level) gameplay loop
Comment $1C4AA "Initialize each of the players"
CertainlyCode $1C4B1 InitializePlayerXIfAlive
CertainlyCode $1C5BE MaybeContinueDialogOrPauseScreen
Comment $1C5BE "Check player one & two start buttons (modulo masks), go to ++ if one is pressed"
CertainlyCode $1CD7E SpawnInPendingItemsClearCarryIfSpawned
Comment $1CD9B "PATCH: Set instruction to and ($29), to prevent tile item spawns"
CertainlyCode $1D088 LoadBank2AndFeedSquare1Music
CertainlyCode $1D0BD LoadBank2AndRestoreAXYFromStack
Comment $1D0BD "Restore Rom Bank 2, then restore A,X and Y from stack."
CertainlyCode $1D550 MaybeInputCheckInLevelSelect
Comment $1D550 "Don't actually know how this function is used, just know it checks input..."
;CertainlyCode $1E700 MJCHandleThePlayerTwo
CertainlyCode $1E7C0 EnableNmiInPpu
Comment $1E7C0 "Why does it read PPUSTATUS nd then immediately discard?"
CertainlyCode $1E7DA LoadRomBank4_NmiSafe
MapperChangeRoutine $1E7DA const 4
CertainlyCode $1E7E2 LoadRomBank2_NmiSafe
MapperChangeRoutine $1E7E2 const 2
CertainlyCode $1E7EA LoadRomBank5_NmiSafe
MapperChangeRoutine $1E7EA const 5
CertainlyCode $1E7F2 LoadSavedRomBank2_NmiSafe
CertainlyCode $1E7F6 LoadSavedRomBank1_NmiSafe
CertainlyCode $1E7F8 SaveCurAndLoadRomBankA_NmiSafe
MapperChangeRoutine $1E7F8 reg A
CertainlyCode $1E7FC LoadRomBankA_NmiSafe
Comment $1E7FF "Disable PPU NMI signal"
CertainlyCode $1E816 LoadRomBank5
MapperChangeRoutine $1E816 const 5
CertainlyCode $1E818 LoadRomBankA
MapperChangeRoutine $1E818 reg A
CertainlyCode $1E867 PlaySquareOneForAFrames
Comment $1E867 "REPEAT (ACCUMULATOR) TIMES:"
Comment $1E870 "if $06AD != 0 then:"
CertainlyCode $1E87A WaitForNmi
Comment $1E87A "Wait for NMI handler to incr the value at $06 (inc'd at $1F03E)."
CertainlyCode $1E883 CheckForPressedJoinOrContinueStart
Comment $1E883 "If Start pressed, set carry. A <- which player pressed."
Comment $1E894 "PATCH: Change #$10 to #$90 to let P2 use A in place of Start."
Comment $1E894 "...It seems this routine is only used exactly where we would want to change that!"
Comment $1E894 "It works for level select and continue, but not for pause, so you can still punch."
CertainlyCode $1E89E SetCarryBitIfPlayerPressingAB
CertainlyCode $1E8E2 ClearJoystickButtonsAndMasks
CertainlyCode $1E8ED BankSwitchAndJoyStickProbeThenBank2
;CertainlyCode $1E905 MJCHandleThePlayerOne
CertainlyCode $1E922 ReplacedInit
CertainlyCode $1F008 NMI
Comment $1F008 "Push A, X, Y"
Comment $1F00D "if (*(0x01) & 0x18 == 0 /* flag ck? */) then call _func_1F049, restore A,X,Y and return"
CertainlyCode $1F03E NMI_Finish
Comment $1F049 "if (*(0x06AD) == 0) return"
Comment $1F04E "Save memory locs $13-19, and restore them after fn call."
Comment $1F04E "The called function will overwrite some of those locations, hence the restore."
CertainlyCode $1F086 SetNmiHandlerZero
CertainlyCode $1F088 SetNmiHandlerResetFrameCtr
CertainlyCode $1F0A1 NmiHandlerZERO
CertainlyCode $1F145 NmiHandlerONE_GameLoop
CertainlyCode $1F1A1 NmiHandlerTWO
CertainlyCode $1F29E NmiHandlerTHREE
CertainlyCode $1F470 NmiHandlerFOUR
CertainlyCode $1F486 NmiDisablePPUAndSetPaletteZero
CertainlyCode $1F533 M_DrawTiledItem
Comment $1F541 "breakpoint fired here for writing #$6C (a weed tile) to the nametable"
Comment $1F541 "Got called from $1/F145 which in turn was jumped into from a table, at $1/F02F"
Comment $1F541 "($07) * 2 seems to be the selector for where in the jump table we go, so"
Comment $1F541 "we get here when ($07) is 1. Probably an NMI-handler state selector?"
Comment $1F565 "what does this stuff do? egg item twinkling?"
CertainlyCode $1F5E1 NmiHandlerFIVE
CertainlyCode $1F627 InitializeAn8BitPlayerVec
Comment $1F627 "If accum is 0 (or $180?) store 8 zeroes at $03F4[0-7], and set $0613 to "
Comment $1F627 "zero; otherwise at $03EC[0-7], and set $0612 to zero"
CertainlyCode $1F642 InitVec0685
Comment $1F642 "Init $0685[0-34] to the values from _data_1F650_indexed."
CertainlyCode $1F673 Find_1F_Vec0685
Comment $1F673 "When this function exits, either y = $123 (35), or else y points to an"
Comment $1F673 "index multiple of 7 that, when added to $10685, points to a place"
Comment $1F673 "where the current set of 3 bytes contains a $11F value somewhere (and"
Comment $1F673 "carry is set)"
CertainlyCode $1F690 SaveSumOfVec0685
Comment $1F690 "Sum $0685[0-34], save results in $06A8 (high byte first). Preserves accum."
CertainlyCode $1F69E SumVec0685
Comment $1F69E "Add $0685[0-34]. Result is 16 bit number, high byte in x, low in a"
Comment $1F69E ""
Comment $1F69E "16 bit value in $106A8 (high byte first) is rlated."
CertainlyCode $1F94B InitializePlayer
CertainlyCode $800C WrapProcessVec6s
CertainlyCode $98C6 ProcessMusicVec6s
Comment $98C6 "Add bytes at $7E and $7F, store the low nybble back to $7F"
Comment $98D1 "Divide by 16, moving the high nibble to low"
Comment $98D7 "Call DecrementAndFeedVec6Values that many times"
Comment $98E3 "for x=0 to 16 step 4:"
Comment $98F7 "initialize sound"
Comment $9907 "initialize Vec6Mask_7DB"
CertainlyCode $9913 DecrementAndFeedVec6Values
Comment $9913 "for x=0 to 5"
Comment $9918 ""
Comment $9918 "if (ptrsH[x]) { if (values[x] != 0) values[x]--; if (valuex[x]==0) then goto ++; }"
Comment $9918 ""
Comment $993E "branch: values[x] is 0 (either preexisting, or after decrement)"
Comment $9951 ""
Comment $9951 "ptrs[x] += y"
Comment $9951 "{{{"
Comment $9951 ""
Comment $995F "}}}, return to decrement-the-values loop"
Comment $9962 "if new value (which is negative) > 0xE0 (which is also negative) goto $9A04"
Comment $9962 "else if newVal == 0xFC (-4) goto $998B"
Comment $9962 "else if newVal < 0xFC (-4) goto $99CC"
Comment $9962 "else if newVal == 0xFE (-2) goto $99A4"
Comment $9962 "else if newVal == 0xFD (-3) goto $997A"
Comment $9962 "else (newVal == 0xFF (-1)) goto $99FC {{{"
Comment $997A "}}} (end of if/else if on newVal)"
Comment $997A "branch: newVal is 0xFD (-3)"
Comment $998B "branch: newVal is 0xFC (-4)"
Comment $99A4 "branch: newVal is 0xFC (-2)"
Comment $99CC "branch: newVal < 0xFC (-4)"
Comment $99FC "branch: newVal is 0xFF (-1)"
Comment $99FC ""
Comment $99FC "Store 0 in values[x]; we've reached the end of data."
Comment $99FC "Return to the decrement-values loop."
CertainlyCode $9ABB FeedSquareOneMusicChannel
CertainlyCode $9ABD FeedAMusicChannel