Files
sm-vita/assets/enemy_instr_decode.py
Snesrev f591d89f84 Some tooling to extract assets
Run:
restool.py decode
to extract assets into assets/defs/*

Run:
restool.py compile
to compile the assets back into a rom
2023-04-17 20:29:29 +02:00

549 lines
22 KiB
Python

from decode_common import *
BANK = None
kInstructionSet = {
0xa288c5: ('BouncingGoofball_Instr_88C5', ''),
0xa288c6: ('BouncingGoofball_Instr_88C6', ''),
0xa2897e: ('MiniCrocomire_Instr_897E', 'H'),
0xa28990: ('MiniCrocomire_Instr_8990', ''),
0xa2899d: ('MiniCrocomire_Instr_899D', ''),
0xa29381: ('MaridiaBeybladeTurtle_Instr_9381', ''),
0xa29412: ('MaridiaBeybladeTurtle_Instr_9412', ''),
0xa29447: ('MaridiaBeybladeTurtle_Instr_9447', ''),
0xa29451: ('MaridiaBeybladeTurtle_Instr_9451', ''),
0xa2946b: ('MaridiaBeybladeTurtle_Instr_946B', ''),
0xa29485: ('MaridiaBeybladeTurtle_Instr_9485', ''),
0xa294a1: ('MaridiaBeybladeTurtle_Instr_94A1', ''),
0xa294c7: ('MaridiaBeybladeTurtle_Instr_94C7', ''),
0xa294d1: ('MaridiaBeybladeTurtle_Instr_94D1', ''),
0xa29f2a: ('SpikeShootingPlant_Instr_9F2A', ''),
0xa2a095: ('SpikeShootingPlant_Instr_A095', ''),
0xa2a56d: ('MaridiaSpikeyShell_Instr_A56D', ''),
0xa2a571: ('MaridiaSpikeyShell_Instr_A571', ''),
0xa2a0a7: ('SpikeShootingPlant_Instr_A0A7', 'H'),
0xa2b9c7: ('Rinka_Instr_B9C7', ''),
0xa2be8e: ('NorfairLavajumpingEnemy_Instr_BE8E', ''),
0xa2bbc3: ('EnemyInstr_Rio_Instr_1', ''),
0xa2c1c9: ('NorfairRio_Instr_C1C9', ''),
0xa2c1d4: ('NorfairRio_Instr_C1D4', ''),
0xa2c1df: ('NorfairRio_Instr_C1DF', ''),
0xa2c1ea: ('NorfairRio_Instr_C1EA', ''),
0xa2c1f5: ('NorfairRio_Instr_C1F5', ''),
0xa2c200: ('NorfairRio_Instr_C200', ''),
0xa2c20b: ('NorfairRio_Instr_C20B', ''),
0xa2c216: ('NorfairRio_Instr_C216', ''),
0xa2c221: ('NorfairRio_Instr_C221', ''),
0xa2c22c: ('NorfairRio_Instr_C22C', ''),
0xa2c237: ('NorfairRio_Instr_C237', ''),
0xa2c6d2: ('LowerNorfairRio_Instr_C6D2', ''),
0xa2c6dd: ('LowerNorfairRio_Instr_C6DD', ''),
0xa2c6e8: ('LowerNorfairRio_Instr_C6E8', ''),
0xa2b9b3: ('Rinka_Instr_B9B3', ''),
0xa2b9bd: ('Rinka_Instr_B9BD', ''),
0xa2cb6b: ('MaridiaLargeSnail_Instr_CB6B', ''),
0xa2ccb3: ('MaridiaLargeSnail_Instr_CCB3', ''),
0xa2ccbe: ('MaridiaLargeSnail_Instr_CCBE', ''),
0xa2ccc9: ('MaridiaLargeSnail_Instr_CCC9', ''),
0xa2e5fb: ('LavaSeahorse_Instr_E5FB', ''),
0xa386e3: ('Waver_Instr_1', ''),
0xa38956: ('Metalee_Instr_1', ''),
0xa39096: ('MaridiaFish_Instr_3', ''),
0xa390a0: ('MaridiaFish_Instr_1', ''),
0xa390aa: ('MaridiaFish_Instr_2', ''),
0xa39c6b: ('PlatformThatFallsWithSamus_Instr_3', ''),
0xa39c76: ('PlatformThatFallsWithSamus_Instr_4', ''),
0xa39c81: ('PlatformThatFallsWithSamus_Instr_1', ''),
0xa39c8c: ('PlatformThatFallsWithSamus_Instr_2', ''),
0xa3aa68: ('Sidehopper_Func_1', 'H'),
0xa3aafe: ('Sidehopper_Instr_1', ''),
0xa3b429: ('MaridiaRefillCandy_Instr_1', ''),
0xa3b434: ('MaridiaRefillCandy_Instr_2', ''),
0xa3b43f: ('MaridiaRefillCandy_Instr_3', ''),
0xa3ba78: ('Bang_Instr_1', ''),
0xa3baa8: ('Bang_Instr_2', ''),
0xa3c6a4: ('Skree_Instr_1', ''),
0xa3cc36: ('MaridiaSnail_Instr_1', 'A'),
0xa3cc3f: ('MaridiaSnail_Instr_2', 'A'),
0xa3cc48: ('MaridiaSnail_Instr_4', 'H'),
0xa3cc5f: ('MaridiaSnail_Instr_3', 'II'),
0xa3cc78: ('MaridiaSnail_Instr_5', ''),
0xa3dfc2: ('WreckedShipOrangeZoomer_Func_1', 'A'),
0xa3dbc8: ('Reflec_Instr_1', 'H'),
0xa3e660: ('Zoomer_Instr_SetPreinstr', 'A'),
0xa3eaa5: ('Metroid_Instr_2', ''),
0xa3eab1: ('Metroid_Instr_1', ''),
0xa486a6: ('Crocomire_Instr_1', ''),
0xa48cfb: ('Crocomire_Instr_11', ''),
0xa48fc7: ('Crocomire_Instr_2', ''),
0xa48ffa: ('Crocomire_Instr_3', ''),
0xa48fdf: ('Crocomire_Instr_4', ''),
0xa48752: ('Crocomire_Instr_14', ''),
0xa48d07: ('Crocomire_Instr_7', ''),
0xa48d13: ('Crocomire_Instr_19', ''),
0xa48fff: ('Crocomire_Instr_15', ''),
0xa4907f: ('Crocomire_Instr_18', ''),
0xa4908f: ('Crocomire_Instr_12', ''),
0xa49094: ('Crocomire_Instr_17', ''),
0xa4905b: ('Crocomire_Instr_13', ''),
0xa4901d: ('Crocomire_Instr_16', ''),
0xa49a9b: ('Crocomire_Instr_8', ''),
0xa49aa0: ('Crocomire_Instr_6', ''),
0xa49aa5: ('Crocomire_Instr_9', ''),
0xa49aaa: ('Crocomire_Instr_5', ''),
0xa49aaf: ('Crocomire_Instr_20', ''),
0xa49ab4: ('Crocomire_Instr_21', ''),
0xa49ab9: ('Crocomire_Instr_22', ''),
0xa49abe: ('Crocomire_Instr_23', ''),
0xa49ac3: ('Crocomire_Instr_24', ''),
0xa49ac8: ('Crocomire_Instr_10', ''),
0xa49acd: ('Crocomire_Instr_25', ''),
0xa49ad2: ('Crocomire_Instr_26', ''),
0xa49ad7: ('Crocomire_Instr_27', ''),
0xa594dd: ('Draygon_Instr_1', 'GGGG'),
0xa59736: ('Draygon_Instr_13', 'A'),
0xa5973f: ('Draygon_Instr_8', ''),
0xa59752: ('Draygon_Instr_7', ''),
0xa59765: ('Draygon_Instr_6', ''),
0xa59778: ('Draygon_Instr_9', ''),
0xa59895: ('Draygon_Instr_2', ''),
0xa598d3: ('Draygon_Instr_11', ''),
0xa598ef: ('Draygon_Instr_5', ''),
0xa59b9a: ('Draygon_Instr_15', ''),
0xa59c8a: ('Draygon_Instr_17', ''),
0xa59e0a: ('Draygon_Instr_14', 'II'),
0xa59f57: ('Draygon_Instr_16', 'A'),
0xa59f60: ('Draygon_Instr_10', 'H'),
0xa59f6e: ('Draygon_Instr_4', 'H'),
0xa59f7c: ('Draygon_Instr_12', ''),
0xa59fae: ('Draygon_Instr_18', ''),
0xa5c47b: ('Draygon_Instr_3', 'A'),
0xa5e75f: ('Draygon_Instr_25', ''),
0xa5e771: ('Draygon_Instr_24', ''),
0xa5e9b1: ('Draygon_Instr_26', ''),
0xa5e87c: ('Draygon_Instr_27', ''),
0xa5e96e: ('Draygon_Instr_28', ''),
0xa5e82d: ('Draygon_Instr_21', 'HH'),
0xa5e872: ('Draygon_Instr_22', 'H'),
0xa5e895: ('Draygon_Instr_23', 'H'),
0xa5e8a3: ('Draygon_Instr_55', 'H'),
0xa5e8b1: ('Draygon_Instr_30', ''),
0xa5e8ba: ('Draygon_Instr_20', 'A'),
0xa5e8ca: ('Draygon_Instr_29', 'H'),
0xa5e91c: ('Draygon_Instr_19', 'H'),
0xa68daf: ('FireGeyser_Instr_1', ''),
0xa68e13: ('FireGeyser_Instr_2', ''),
0xa68e2d: ('FireGeyser_Instr_3', ''),
0xa68e41: ('FireGeyser_Instr_4', ''),
0xa68e55: ('FireGeyser_Instr_5', ''),
0xa68e69: ('FireGeyser_Instr_6', ''),
0xa68e7d: ('FireGeyser_Instr_7', ''),
0xa68e91: ('FireGeyser_Instr_8', ''),
0xa68ea5: ('FireGeyser_Instr_9', ''),
0xa68eb9: ('FireGeyser_Instr_10', ''),
0xa68ecd: ('FireGeyser_Instr_11', ''),
0xa68ee1: ('FireGeyser_Instr_12', ''),
0xa68ef5: ('FireGeyser_Instr_13', ''),
0xa68f09: ('FireGeyser_Instr_14', ''),
0xa68f1d: ('FireGeyser_Instr_15', ''),
0xa68f31: ('FireGeyser_Instr_16', ''),
0xa68f45: ('FireGeyser_Instr_17', ''),
0xa68f59: ('FireGeyser_Instr_18', ''),
0xa68f6d: ('FireGeyser_Instr_19', ''),
0xa68f81: ('FireGeyser_Instr_20', ''),
0xa68f95: ('FireGeyser_Instr_21', ''),
0xa68fa9: ('FireGeyser_Instr_22', ''),
0xa68fbd: ('FireGeyser_Instr_23', ''),
0xa68fd1: ('FireGeyser_Instr_24', ''),
0xa69b26: ('FakeKraid_Instr_2', ''),
0xa69b74: ('FakeKraid_Instr_1', ''),
0xa69bb2: ('FakeKraid_Instr_3', ''),
0xa69bc4: ('FakeKraid_Instr_4', ''),
0xa69c02: ('FakeKraid_Instr_5', ''),
0xa6bfc9: ('BabyMetroid_Instr_2', 'G'),
0xa6bfe1: ('BabyMetroid_Instr_3', '6'),
0xa6bff2: ('BabyMetroid_Instr_1', 'G'),
0xa6bff8: ('BabyMetroid_Instr_4', 'G'),
0xa6e4be: ('Ridley_Instr_5', ''),
0xa6e4ca: ('Ridley_Instr_6', ''),
0xa6e4d2: ('Ridley_Instr_10', 'G'),
0xa6e4e9: ('sub_A6E4E9', 'H'),
0xa6e4ee: ('Ridley_Instr_4', 'GG'),
0xa6e4f8: ('Ridley_Instr_3', 'G'),
0xa6e501: ('Ridley_Instr_2', 'H'),
0xa6e517: ('Ridley_Instr_1', 'G'),
0xa6e51f: ('Ridley_Instr_14', 'II'),
0xa6e71c: ('Ridley_Instr_9', ''),
0xa6e727: ('Ridley_Instr_7', ''),
0xa6e72f: ('Ridley_Instr_8', ''),
0xa6e84d: ('Ridley_Instr_11', ''),
0xa6e904: ('Ridley_Instr_12', ''),
0xa6e909: ('Ridley_Instr_13', ''),
0xa6e969: ('Ridley_Instr_15', ''),
0xa6e976: ('Ridley_Instr_16', ''),
0xa6f11d: ('CeresSteam_Instr_1', ''),
0xa6f127: ('CeresSteam_Instr_2', 'GG'),
0xa6f135: ('CeresSteam_Instr_3', ''),
0xa6f63e: ('CeresDoor_Instr_6', 'G'),
0xa6f66a: ('CeresDoor_Instr_4', 'G'),
0xa6f678: ('CeresDoor_Instr_8', 'G'),
0xa6f68b: ('CeresSteam_Instr_4', ''),
0xa6f695: ('CeresDoor_Instr_1', ''),
0xa6f69f: ('CeresDoor_Instr_3', ''),
0xa6f6a6: ('CeresSteam_Instr_5', ''),
0xa6f6b0: ('CeresDoor_Instr_5', ''),
0xa6f6b3: ('CeresDoor_Instr_2', ''),
0xa6f6bd: ('CeresDoor_Instr_7', ''),
0xa78a8f: ('Kraid_Instr_9', ''),
0xa7b633: ('Kraid_Instr_1', ''),
0xa7b636: ('Kraid_Instr_DecYpos', ''),
0xa7b63c: ('Kraid_Instr_IncrYpos_Shake', ''),
0xa7b64e: ('Kraid_Instr_PlaySound_0x76', ''),
0xa7b65a: ('Kraid_Instr_XposMinus3', ''),
0xa7b667: ('Kraid_Instr_XposMinus3b', ''),
0xa7b674: ('Kraid_Instr_XposPlus3', ''),
0xa7b683: ('Kraid_Instr_MoveHimRight', ''),
0xa8878f: ('MiniDraygon_Instr_2', ''),
0xa8879b: ('MiniDraygon_Instr_1', ''),
0xa887b6: ('MiniDraygon_Instr_3', ''),
0xa887cb: ('MiniDraygon_Instr_4', ''),
0xa89625: ('Fune_Instr_2', ''),
0xa89631: ('Fune_Instr_6', ''),
0xa8964a: ('Fune_Instr_7', ''),
0xa89663: ('Fune_Instr_1', ''),
0xa8967c: ('Fune_Instr_4', ''),
0xa89695: ('Fune_Instr_3', ''),
0xa896b4: ('Fune_Instr_5', ''),
0xa8ae26: ('NorfairLavaMan_Instr_8', ''),
0xa8ae30: ('NorfairLavaMan_Instr_14', ''),
0xa8ae3a: ('NorfairLavaMan_Instr_2', ''),
0xa8ae45: ('NorfairLavaMan_Instr_7', ''),
0xa8ae50: ('NorfairLavaMan_Instr_10', ''),
0xa8ae5a: ('NorfairLavaMan_Instr_12', ''),
0xa8ae64: ('NorfairLavaMan_Instr_9', ''),
0xa8ae88: ('NorfairLavaMan_Instr_11', ''),
0xa8ae96: ('NorfairLavaMan_Instr_13', ''),
0xa8aeba: ('NorfairLavaMan_Instr_5', ''),
0xa8aeca: ('NorfairLavaMan_Instr_15', ''),
0xa8aee4: ('NorfairLavaMan_Instr_4', ''),
0xa8aefe: ('NorfairLavaMan_Instr_16', ''),
0xa8af18: ('NorfairLavaMan_Instr_6', ''),
0xa8af32: ('sub_A8AF32', ''),
0xa8af44: ('NorfairLavaMan_Instr_3', ''),
0xa8a0c7: ('YappingMaw_Instr_2', ''),
0xa8a0d9: ('YappingMaw_Instr_4', ''),
0xa8a10f: ('YappingMaw_Instr_3', ''),
0xa8a0eb: ('YappingMaw_Instr_5', ''),
0xa8a0fd: ('YappingMaw_Instr_7', ''),
0xa8a121: ('YappingMaw_Instr_6', ''),
0xa8a133: ('YappingMaw_Instr_1', ''),
0xa8ae12: ('NorfairLavaMan_Instr_1', 'H'),
0xa8b75e: ('Beetom_Instr_1', ''),
0xa8cd09: ('WreckedShipRobot_Instr_4', ''),
0xa8cda4: ('WreckedShipRobot_Instr_9', ''),
0xa8cdea: ('WreckedShipRobot_Instr_6', ''),
0xa8ce85: ('WreckedShipRobot_Instr_8', ''),
0xa8cecb: ('WreckedShipRobot_Instr_7', ''),
0xa8cecf: ('WreckedShipRobot_Instr_15', ''),
0xa8cf6a: ('WreckedShipRobot_Instr_18', ''),
0xa8cfb0: ('WreckedShipRobot_Instr_16', ''),
0xa8d04b: ('WreckedShipRobot_Instr_17', ''),
0xa8d091: ('WreckedShipRobot_Instr_3', ''),
0xa8d0c2: ('WreckedShipRobot_Instr_10', ''),
0xa8d0c6: ('WreckedShipRobot_Instr_14', ''),
0xa8d0d2: ('WreckedShipRobot_Instr_2', ''),
0xa8d100: ('WreckedShipRobot_Instr_13', ''),
0xa8d107: ('WreckedShipRobot_Instr_1', ''),
0xa8d131: ('WreckedShipRobot_Instr_12', ''),
0xa8d13d: ('WreckedShipRobot_Instr_5', ''),
0xa8d16b: ('WreckedShipRobot_Instr_11', ''),
0xa8df1c: ('WalkingLavaSeahorse_Instr_4', ''),
0xa8df33: ('WalkingLavaSeahorse_Instr_3', ''),
0xa8df39: ('WalkingLavaSeahorse_Instr_5', ''),
0xa8df3f: ('WalkingLavaSeahorse_Instr_6', ''),
0xa8df63: ('WalkingLavaSeahorse_Instr_2', ''),
0xa8df71: ('WalkingLavaSeahorse_Instr_1', ''),
0xa8e61d: ('WreckedShipSpark_Instr_2', ''),
0xa8e62a: ('WreckedShipSpark_Instr_1', ''),
0xa8f526: ('KiHunter_Instr_1', ''),
0xa8f5e4: ('KiHunter_Instr_2', ''),
0xa8f67f: ('KiHunter_Instr_3', ''),
0xa8f6d2: ('KiHunter_Instr_4', ''),
0xa8f6d8: ('KiHunter_Instr_5', ''),
0xa995b6: ('MotherBrain_Instr_MoveBodyUp10Left4', ''),
0xa995c0: ('MotherBrain_Instr_MoveBodyUp16Left4', ''),
0xa995ca: ('MotherBrain_Instr_MoveBodyUp12Right2', ''),
0xa995de: ('MotherBrain_Instr_MoveDown12Left4', ''),
0xa995e8: ('MotherBrain_Instr_MoveDown16Right2', ''),
0xa995f2: ('MotherBrain_Instr_MoveDown10Right2', ''),
0xa995fc: ('MotherBrain_Instr_MoveUp2Right1', ''),
0xa9960c: ('MotherBrain_Instr_MoveRight2', ''),
0xa9961c: ('MotherBrain_Instr_MoveUp1', ''),
0xa99622: ('MotherBrain_Instr_MoveUp1Right3_Sfx', ''),
0xa99638: ('MotherBrain_Instr_Down2Right15', ''),
0xa99648: ('MotherBrain_Instr_Down4Right6', ''),
0xa99658: ('MotherBrain_Instr_Up4Left2', ''),
0xa99668: ('MotherBrain_Instr_Up2Left1_Sfx', ''),
0xa9967e: ('MotherBrain_Instr_Up2Left1_Sfx2', ''),
0xa99694: ('MotherBrain_Instr_MoveLeft2', ''),
0xa996a4: ('MotherBrain_Instr_MoveDown1', ''),
0xa996aa: ('MotherBrain_Instr_MoveDown1Left3', ''),
0xa996ba: ('MotherBrain_Instr_MoveUp2Left15_Sfx', ''),
0xa996d0: ('MotherBrain_Instr_MoveUp4Left6', ''),
0xa996e0: ('MotherBrain_Instr_MoveDown4Right2', ''),
0xa996f0: ('MotherBrain_Instr_MoveDown2Right1', ''),
0xa99700: ('MotherBrain_Instr_SetPose_Standing', ''),
0xa99708: ('MotherBrain_Instr_SetPose_Walking', ''),
0xa99710: ('MotherBrain_Instr_SetPose_Crouched', ''),
0xa99718: ('MotherBrain_Instr_SetPose_CrouchedTrans', ''),
0xa99720: ('MotherBrain_Instr_SetPose_DeathBeamMode', ''),
0xa99728: ('MotherBrain_Instr_SetPose_LeaningDown', ''),
0xa99ac8: ('MotherBrain_Instr_SpawnEprojToOffset', 'IIH'),
0xa99aef: ('MotherBrain_Instr_SpawnDeathBeamEproj', ''),
0xa99b05: ('MotherBrain_Instr_IncrBeamAttackPhase', ''),
0xa99b0f: ('MotherBrain_Instr_Goto', 'G'),
0xa99b14: ('MotherBrain_Instr_EnableNeckMovementGoto', 'G'),
0xa99b20: ('MotherBrain_Instr_DisableNeckMovement', ''),
0xa99b28: ('MotherBrain_Instr_QueueSfx2', 'H'),
0xa99b32: ('MotherBrain_Instr_QueueSfx3', 'H'),
0xa99b3c: ('MotherBrain_Instr_SpawnDroolEproj', ''),
0xa99b6d: ('MotherBrain_Instr_SpawnPurpleBreath', ''),
0xa99b77: ('MotherBrain_Instr_SetMainShakeTimer50', ''),
0xa99c65: ('MotherBrain_Instr_GotoEitherOr', ''),
0xa99cad: ('MotherBrain_Instr_MaybeGoto', ''),
0xa99d0d: ('MotherBrain_Instr_MaybeGoto2', ''),
0xa99d21: ('MotherBrain_Instr_Goto2', ''),
0xa99df7: ('MotherBrain_Instr_QueueShitroidAttackSfx', ''),
0xa99e29: ('MotherBrain_Instr_SpawnBlueRingEproj', ''),
0xa99e37: ('MotherBrain_Instr_AimRingsAtShitroid', ''),
0xa99e5b: ('MotherBrain_Instr_AimRingsAtSamus', ''),
0xa99ea3: ('MotherBrain_Instr_IncrShitroidAttackCtr', ''),
0xa99eb5: ('MotherBrain_Instr_SetShitroidAttackCtr0', ''),
0xa99ebd: ('MotherBrain_Instr_SpawnBombEproj', 'H'),
0xa99f46: ('MotherBrain_Instr_SpawnLaserEproj', ''),
0xa99f84: ('MotherBrain_Instr_SpawnRainbowEproj', ''),
0xa99f8e: ('MotherBrain_Instr_SetupFxForRainbowBeam', ''),
0xa9cfb4: ('Shitroid_Instr_1', ''),
0xa9cfca: ('Shitroid_Instr_2', ''),
0xa9ecd0: ('sub_A9ECD0', ''),
0xa9f920: ('Shitroid_Instr_3', ''),
0xa9f936: ('Shitroid_Instr_4', ''),
0xa9f990: ('Shitroid_Instr_6', ''),
0xa9f994: ('Shitroid_Instr_5', 'G'),
0xaab09c: ('Torizo_Instr_3', 'A'),
0xaab11d: ('Torizo_Instr_31', ''),
0xaab1be: ('Torizo_Instr_33', ''),
0xaab224: ('Torizo_Instr_36', ''),
0xaab22e: ('Torizo_Instr_37', ''),
0xaab238: ('Torizo_Instr_35', ''),
0xaab24d: ('Torizo_Instr_38', ''),
0xaab271: ('Torizo_Instr_6', ''),
0xaab94d: ('Torizo_Instr_5', ''),
0xaab951: ('Torizo_Instr_9', ''),
0xaac2c8: ('Torizo_Instr_7', ''),
0xaac2c9: ('Torizo_Instr_2', ''),
0xaac2d1: ('Torizo_Instr_8', ''),
0xaac2d9: ('Torizo_Instr_25', 'GG'),
0xaac2ed: ('Torizo_Instr_22', 'A'),
0xaac2f7: ('Torizo_Instr_19', ''),
0xaac2fd: ('Torizo_Instr_32', ''),
0xaac303: ('Torizo_Instr_30', 'H'),
0xaac32f: ('Torizo_Instr_34', ''),
0xaac34a: ('Torizo_Instr_24', ''),
0xaac35b: ('Torizo_Instr_12', ''),
0xaac36d: ('Torizo_Instr_10', ''),
0xaac377: ('Torizo_Instr_11', ''),
0xaac38a: ('Torizo_Instr_29', ''),
0xaac3a0: ('Torizo_Instr_1', ''),
0xaac3b6: ('Torizo_Instr_28', ''),
0xaac3cc: ('Torizo_Instr_4', 'H'),
0xaac41e: ('Torizo_Instr_40', 'H'),
0xaac470: ('Torizo_Instr_16', 'H'),
0xaac4e5: ('Torizo_Instr_27', 'H'),
0xaac55a: ('Torizo_Instr_23', 'G'),
0xaac567: ('Torizo_Instr_14', 'G'),
0xaac58b: ('Torizo_Instr_15', 'G'),
0xaac5a4: ('Torizo_Instr_26', 'GG'),
0xaac5cb: ('Torizo_Instr_18', ''),
0xaac5e3: ('Torizo_Instr_20', 'H'),
0xaac5f2: ('Torizo_Instr_44', 'H'),
0xaac601: ('Torizo_Instr_21', 'H'),
0xaac610: ('Torizo_Instr_17', ''),
0xaac618: ('Torizo_Instr_13', ''),
0xaacace: ('Torizo_Instr_39', 'G'),
0xaacade: ('Torizo_Instr_41', ''),
0xaacae2: ('Torizo_Instr_42', ''),
0xaacdd7: ('Torizo_Instr_48', ''),
0xaad0e9: ('Torizo_Instr_57', ''),
0xaad0f3: ('Torizo_Instr_58', 'G'),
0xaad17b: ('Torizo_Instr_59', ''),
0xaad187: ('Torizo_Instr_62', ''),
0xaad1e7: ('Torizo_Instr_63', ''),
0xaad38f: ('Torizo_Instr_56', ''),
0xaad397: ('Torizo_Instr_60', ''),
0xaad39f: ('Torizo_Instr_46', ''),
0xaad3e0: ('Torizo_Instr_47', ''),
0xaad3ea: ('Torizo_Instr_49', 'G'),
0xaad436: ('Torizo_Instr_61', 'H'),
0xaad445: ('Torizo_Instr_53', 'G'),
0xaad474: ('Torizo_Instr_55', 'G'),
0xaad49b: ('Torizo_Instr_52', 'G'),
0xaad4ba: ('Torizo_Instr_50', 'G'),
0xaad4f3: ('Torizo_Instr_43', ''),
0xaad4fd: ('Torizo_Instr_51', 'G'),
0xaad526: ('Torizo_Instr_45', 'GG'),
0xaad54d: ('Torizo_Instr_54', 'H'),
0xaad9ba: ('Shaktool_Instr_1', ''),
0xaad931: ('Shaktool_Instr_2', ''),
0xaad93f: ('Shaktool_Instr_3', ''),
0xaad94a: ('Shaktool_Instr_4', ''),
0xaad953: ('Shaktool_Instr_5', ''),
0xaad99f: ('Shaktool_Instr_6', ''),
0xaae429: ('Shaktool_Instr_9', ''),
0xaae436: ('Shaktool_Instr_11', ''),
0xaae43d: ('Shaktool_Instr_10', ''),
0xaae57f: ('Shaktool_Instr_8', ''),
0xaae587: ('Shaktool_Instr_13', ''),
0xaae58f: ('Shaktool_Instr_12', 'I'),
0xaae5d8: ('Shaktool_Instr_7', 'H'),
0xaae6f0: ('Shaktool_Instr_14', ''),
0xb2ee40: ('SpacePirates_Instr_MovePixelsDownAndChangeDirFaceRight', 'I'),
0xb2ee72: ('SpacePirates_Instr_MovePixelsDownAndChangeDirFaceLeft', 'I'),
0xb2eea4: ('SpacePirates_Instr_RandomNewDirFaceR', ''),
0xb2eebc: ('SpacePirates_Instr_RandomNewDirFaceL', ''),
0xb2eed4: ('SpacePirates_Instr_PrepareWallJumpR', ''),
0xb2eefd: ('SpacePirates_Instr_PrepareWallJumpL', ''),
0xb2ef2a: ('SpacePirates_Instr_FireLaserL', ''),
0xb2ef5d: ('SpacePirates_Instr_FireLaserR', ''),
0xb2ef83: ('SpacePirates_Instr_SetEnemyFunc', 'A'),
0xb2ef93: ('SpacePirates_Instr_PlaySfx', ''),
0xb2f536: ('SpacePirates_Instr_20', 'H'),
0xb2f546: ('SpacePirates_Instr_16', 'H'),
0xb2f554: ('sub_B2F554', ''),
0xb2f564: ('SpacePirates_Instr_15', 'HII'),
0xb2f590: ('SpacePirates_Instr_18', ''),
0xb2f5b3: ('sub_B2F5B3', ''),
0xb2f5d6: ('SpacePirates_Instr_17', ''),
0xb2f969: ('SpacePirates_Instr_19', ''),
0xb2f985: ('SpacePirates_F985', ''),
0xb2fa3d: ('SpacePirates_Instr_21', ''),
0xb2fa59: ('SpacePirates_FA59', ''),
0xb2fc68: ('SpacePirates_Instr_12', 'I'),
0xb2fc90: ('SpacePirates_Instr_14', 'I'),
0xb2fcb8: ('SpacePirates_Instr_11', 'A'),
0xb2fcc8: ('SpacePirates_Instr_13', ''),
0xb394c7: ('Botwoon_Instr_1', ''),
0xb394d7: ('Botwoon_Instr_2', ''),
0xb394e7: ('Botwoon_Instr_3', ''),
0xb394f7: ('Botwoon_Instr_4', ''),
0xb39507: ('Botwoon_Instr_5', ''),
0xb39517: ('Botwoon_Instr_6', ''),
0xb39527: ('Botwoon_Instr_7', ''),
0xb39537: ('Botwoon_Instr_8', ''),
0xb39547: ('Botwoon_Instr_9', ''),
0xb39557: ('Botwoon_Instr_10', ''),
0xb39567: ('Botwoon_Instr_SetSpitting', ''),
0xb39572: ('Botwoon_Instr_QueueSpitSfx', ''),
0xb3e545: ('EscapeEtecoon_Instr_1', 'G'),
0xb3e610: ('EscapeEtecoon_Instr_2', 'I'),
0xb3eaa8: ('EscapeDachora_Instr_2', 'G'),
0xb3eab8: ('EscapeDachora_Instr_3', 'G'),
0xb3eac9: ('EscapeDachora_Instr_1', ''),
0xb3ead7: ('EscapeDachora_Instr_4', ''),
}
commons = {
0x806b: ('SetAiPreInstr', 'A'),
0x8074: ('ClearAiPreInstr', ''),
0x807c: ('StopScript', ''),
0x808a: ('Call', 'A'),
0x80b5: ('CallFar', 'L'),
0x80ed: ('Goto', 'G'),
0x8110: ('DecTimerAndGoto', 'G'),
0x8123: ('SetTimer', 'H'),
0x812f: ('Sleep', ''),
0x813a: ('WaitNframes', 'H'),
0x814b: ('CopyToVram', 'HLX'),
0x8173: ('EnableOffScreenProcessing', ''),
0x817d: ('DisableOffScreenProcessing', ''),
}
kInstrTerminator = {
0x807C, 0x80ED, 0x812F,
0xa6BFF8, 0xa29451, 0xa8CECB, 0xa8D0C2, 0xa8F526, 0xa99B0F, 0xa99B14, 0xa99C65, 0xa99d21, 0xa9cfb4, 0xA9CFCA, 0xa9f920, 0xa9f936, 0xa9f990,
0xaaC2F7, 0xaaC2FD, 0xb2EEA4, 0xb2EEBC, 0xb2FCC8
}
for x in [0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3]:
for k, v in commons.items():
kInstructionSet[k + (x << 16)] = v
kCommandByName = {v[0] : (k, v[1]) for k, v in kInstructionSet.items()}
class EnemyInstrParser(InstrParserCommon):
instruction_set = kInstructionSet
instruction_set_term = kInstrTerminator
TAG = 'enemy'
def __init__(self):
super().__init__()
self.sprite_maps = set()
def handle_draw_command(self, ins, ea):
drawp = get_word(ea + 2) | (ea & 0xff0000)
self.sprite_maps.add(drawp)
#assert drawp != 0xa6f142, hex(ea)
self.print_line(ea, f' {ins} ! {get_ea_name(drawp)}')
return 4
def process_queue_entry(self, ea):
assert ea & 0x8000
while ea not in self.visited:
self.visited.add(ea)
ins = get_word(ea)
if ins & 0x8000:
ea_org = ea
ins = (ea & 0xff0000) | ins
if ins not in self.instruction_set:
print(f'// Ins {ins:X} not in iset at {ea:X}')
return
name, operands = self.instruction_set[ins]
ea += 2
r = []
for op in operands:
if op == 'H':
r.append('%d' % get_word(ea))
ea += 2
elif op == 'I':
r.append('%d' % sex16(get_word(ea)))
ea += 2
elif op == 'X':
r.append('0x%x' % get_word(ea))
ea += 2
elif op == 'L':
r.append(get_ea_name(get_word(ea) + get_byte(ea+2) * 65536))
ea += 3
elif op == 'A':
addr = (ea & 0xff0000) | get_word(ea)
r.append(get_ea_name(addr))
ea += 2
elif op == '6':
addr = 0xa60000 | get_word(ea)
r.append(get_ea_name(addr))
ea += 2
elif op == 'G':
addr = (ea & 0xff0000) | get_word(ea)
assert addr & 0x8000, hex(ea)
r.append(get_ea_name(addr, short_label = True))
self.visit(addr)
ea += 2
else:
assert 0, op
self.print_line(ea_org, f' {name}({", ".join(r)})')
if ins in self.instruction_set_term or (ins & 0xffff) in self.instruction_set_term:
self.print_line(ea_org + 1, '')
break
else:
ea += self.handle_draw_command(ins, ea)