If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!
Notes:Final Fight (SNES)/Bank 00
Jump to navigation
Jump to search
This is a sub-page of Notes:Final Fight (SNES).
Contents
- 1 Bank 00
- 1.1 Get Random Number
- 1.2 Update Random Number Generator
- 1.3 Load Random Number When Enemy Spawns
- 1.4 Controller Copy
- 1.5 Set Platform Height in Round
- 1.6 TODO 00D16B
- 1.7 Jump to Tile Properties for Tile Standing on
- 1.8 Copy Round Tile Properties from ROM to RAM
- 1.9 Copy 256 Byte Chunk of Round Tile Properties
- 1.10 Update Countdown Timer HUD
- 1.11 Update Lives HUD
Bank 00
Get Random Number
$00/B0E1 DA PHX $00/B0E2 A9 00 LDA #$00 $00/B0E4 EB XBA $00/B0E5 AD 09 01 LDA $0109 [$00:0109] $00/B0E8 1A INC A $00/B0E9 29 03 AND #$03 $00/B0EB 8D 09 01 STA $0109 [$00:0109] $00/B0EE AA TAX $00/B0EF BD 0A 01 LDA $010A,x $00/B0F2 69 13 ADC #$13 $00/B0F4 9D 0A 01 STA $010A,x $00/B0F7 FA PLX $00/B0F8 6B RTL
Update Random Number Generator
$00/B0F9 AD 0A 01 LDA $010A [$00:010A] $00/B0FC 69 01 ADC #$01 $00/B0FE 8D 0A 01 STA $010A [$00:010A] $00/B101 AD 0B 01 LDA $010B [$00:010B] $00/B104 69 03 ADC #$03 $00/B106 8D 0B 01 STA $010B [$00:010B] $00/B109 AD 0C 01 LDA $010C [$00:010C] $00/B10C 69 05 ADC #$05 $00/B10E 8D 0C 01 STA $010C [$00:010C] $00/B111 AD 0D 01 LDA $010D [$00:010D] $00/B114 69 07 ADC #$07 $00/B116 8D 0D 01 STA $010D [$00:010D] $00/B119 AD B4 0C LDA $0CB4 [$00:0CB4] //Frame counter (load lower 8 bits of 16-bit value) $00/B11C D0 15 BNE $15 [$B133] //Skip to $B133 if non-zero. Every 256 frames (approx. 4.27 seconds) the $B11E-$B132 block will execute to provide more randomness $00/B11E AD 0D 01 LDA $010D [$00:010D] $00/B121 6D 0C 01 ADC $010C [$00:010C] $00/B124 8D 0C 01 STA $010C [$00:010C] $00/B127 6D 0B 01 ADC $010B [$00:010B] $00/B12A 8D 0B 01 STA $010B [$00:010B] $00/B12D 6D 0A 01 ADC $010A [$00:010A] $00/B130 8D 0A 01 STA $010A [$00:010A] $00/B133 6B RTL
Load Random Number When Enemy Spawns
$00/B2A4 E2 10 SEP #$10 $00/B2A6 22 E1 B0 00 JSL $00B0E1[$00:B0E1] //Get Random Number $00/B2AA 29 0F AND #$0F //Keep only lower 4 bits of random number $00/B2AC AA TAX $00/B2AD BD B5 B2 LDA $B2B5,x //TODO - unknown table $00/B2B0 85 66 STA $66 $00/B2B2 C2 10 REP #$10 $00/B2B4 6B RTL
Controller Copy
$00/CA41 AD CC 00 LDA $00CC [$00:00CC] //Demo mode $00/CA44 F0 3D BEQ $3D [$CA83] //Skip to $CA83 if in demo mode $00/CA46 A2 00 0D LDX #$0D00 //Player 1 stats $00/CA49 A0 10 01 LDY #$0110 //Controller 1 buttons base address $00/CA4C BD 11 00 LDA $0011,x //Player 1 controller $00/CA4F F0 03 BEQ $03 [$CA54] //Skip to $CA54 if player 1 is using controller 1* $00/CA51 A0 12 01 LDY #$0112 //Controller 2 buttons base address $00/CA54 C2 20 REP #$20 $00/CA56 B9 08 00 LDA $0008,y $00/CA59 9D 64 00 STA $0064,x //Copy controller button presses $00/CA5C B9 00 00 LDA $0000,y $00/CA5F 9D 66 00 STA $0066,x //Copy controller button presses $00/CA62 E2 20 SEP #$20 $00/CA64 A2 80 0D LDX #$0D80 //Player 2 stats $00/CA67 A0 10 01 LDY #$0110 //Controller 1 buttons base address $00/CA6A BD 11 00 LDA $0011,x //Player 2 controller $00/CA6D F0 03 BEQ $03 [$CA72] //Skip to $CA72 if player 2 is using controller 1 $00/CA6F A0 12 01 LDY #$0112 //Controller 2 buttons base address $00/CA72 C2 20 REP #$20 $00/CA74 B9 08 00 LDA $0008,y $00/CA77 9D 64 00 STA $0064,x //Copy controller button presses $00/CA7A B9 00 00 LDA $0000,y $00/CA7D 9D 66 00 STA $0066,x //Copy controller button presses $00/CA80 E2 20 SEP #$20 $00/CA82 6B RTL *Use PAR code 00CA5000 to control player 1 using the second controller. Worth noting that only the first controller can pause the game.
Set Platform Height in Round
$00/D0A6 C2 20 REP #$20 $00/D0A8 AD B0 0C LDA $0CB0 [$00:0CB0] //Round $00/D0AB 29 FF 00 AND #$00FF $00/D0AE 0A ASL A $00/D0AF AA TAX $00/D0B0 BF BA D0 00 LDA $00D0BA,x //Platform height table $00/D0B4 8D CA 0C STA $0CCA [$00:0CCA] $00/D0B7 E2 20 SEP #$20 $00/D0B9 6B RTL
Platform Height in Round Table
00D0BA 4000 //Slum 00D0BC 2000 //Subway 00D0BE 4000 //West Side 00D0C0 4000 //Industrial Area 00D0C2 4000 //Bay Area 00D0C4 4000 //Up Town 00D0C6 4000 //Break Car 00D0C8 4000 //Break Glass 00D0CA 4000 //Empty slot 00D0CC 4000 //Empty slot 00D0CE 4000 //Empty slot
TODO 00D16B
$00/D16B AE CA 0C LDX $0CCA [$00:0CCA] //Platform height in stage $00/D16E 8E CE 0C STX $0CCE [$00:0CCE] //Height of platform/object player is standing next to $00/D171 22 FF D2 00 JSL $00D2FF[$00:D2FF]
Jump to Tile Properties for Tile Standing on
$00/D3C6 AD 00 00 LDA $0000 [$00:0000] $00/D3C9 0A ASL A $00/D3CA AA TAX $00/D3CB FC D4 D3 JSR ($D3D4,x)
Tile Properties Pointer Table
00D3D4 00 22D4 00D3D6 01 22D4 00D3D8 02 26D4 00D3DA 03 39D4 00D3DC 04 4CD4 00D3DE 05 64D4 00D3E0 06 7CD4 00D3E2 07 8FD4 00D3E4 08 B7D4 00D3E6 09 DFD4 00D3E8 0A 95D4 00D3EA 0B BDD4 00D3EC 0C F7D4 00D3EE 0D 13D5 00D3F0 0E 2FD5 00D3F2 0F 4BD5 00D3F4 10 FDD4 00D3F6 11 19D5 00D3F8 12 35D5 00D3FA 13 51D5 00D3FC 14 67D5 00D3FE 15 67D5 (unused) 00D400 16 67D5 (unused) 00D402 17 67D5 00D404 18 67D5 00D406 19 6BD5 (unused) 00D408 1A 9BD4 (unused) 00D40A 1B C3D4 (unused) 00D40C 1C 7ED5 00D40E 1D A1D4 00D410 1E C9D4 00D412 1F 96D5 00D414 20 9AD5 00D416 21 ADD5 00D418 22 C3D5 00D41A 23 D9D5 00D41C 24 DFD5 00D41E 25 F5D5 00D420 26 FBD5
Copy Round Tile Properties from ROM to RAM
$00/E010 C2 20 REP #$20 $00/E012 0B PHD $00/E013 8B PHB $00/E014 A9 00 00 LDA #$0000 $00/E017 5B TCD $00/E018 8D 12 00 STA $0012 [$00:0012] $00/E01B E2 20 SEP #$20 $00/E01D AD B0 0C LDA $0CB0 [$00:0CB0] //Round $00/E020 0A ASL A $00/E021 AA TAX $00/E022 BC 69 E0 LDY $E069,x //Pointer to Tile Properties Set $00/E025 BB TYX $00/E026 BD 00 00 LDA $0000,x $00/E029 8D 00 00 STA $0000 [$00:0000] //Number of chunks $00/E02C E8 INX $00/E02D 8E 10 00 STX $0010 [$00:0010] //Store start address of chunk $00/E030 20 3B E0 JSR $E03B [$00:E03B] //Copy 256 Byte Chunk of Round Tile Properties $00/E033 CE 00 00 DEC $0000 [$00:0000] //Chunks for Round counter -1 $00/E036 D0 F8 BNE $F8 [$E030] //Loop until all chunks for Round copied $00/E038 AB PLB $00/E039 2B PLD $00/E03A 60 RTS
Copy 256 Byte Chunk of Round Tile Properties
$00/E03B A9 00 LDA #$00 $00/E03D EB XBA $00/E03E B2 10 LDA ($10) //Start address of chunk $00/E040 EB XBA $00/E041 AA TAX $00/E042 AC 12 00 LDY $0012 [$00:0012] $00/E045 C2 20 REP #$20 $00/E047 EE 10 00 INC $0010 [$00:0010] //Set start address of next chunk for the next time this subroutine runs $00/E04A E2 20 SEP #$20 $00/E04C 8B PHB $00/E04D A9 7F LDA #$7F //Destination RAM bank $00/E04F 48 PHA $00/E050 AB PLB $00/E051 A9 00 LDA #$00 $00/E053 8D 08 00 STA $0008 [$7F:0008] $00/E056 BF 00 80 0F LDA $0F8000,x[$0F:8000] //Source ROM address $00/E05A 99 00 20 STA $2000,y[$7F:2000] //Destination RAM address (+$7F0000) $00/E05D E8 INX $00/E05E C8 INY $00/E05F CE 08 00 DEC $0008 [$7F:0008] $00/E062 D0 F2 BNE $F2 [$E056] //Loop until entire 256 byte chunk copied $00/E064 AB PLB $00/E065 8C 12 00 STY $0012 [$00:0012] $00/E068 60 RTS
Tile Properties Pointer Table
00E069 7FE0 Slum 00E06B B9E0 Subway 00E06D 88E0 West Side 00E06F 95E0 Industrial Area 00E071 95E0 Bay Area 00E073 9AE0 Up Town 00E075 ABE0 Break Car 00E077 ADE0 Break Glass 00E079 B1E0 Unused slot 00E07B B1E0 Unused slot 00E07D B1E0 Unused slot
Tile Properties Sets
The first byte is the number of 256 byte chunks in the set. For the following bytes, to get the start address of the 256 byte chunk, multiply the value by $0100 and add it to the base address of $0F8000.
E07F 08 0001020304050618 - Slum E088 0C 0008191A1B1C1D1E1F202118 - West Side E095 04 00060818 - Bay Area (Industrial Area also points here) E09A 10 00060F1011121314181F222325262728 - Up Town (note that $24 is skipped - the 256 byte chunk is blank, all $00) E0AB 01 1F - Break Car E0AD 03 151617 - Break Glass E0B1 07 00010203040506 (??? - a copy of the Slum, without the final chunk - what's the purpose of this?) E0B9 0C 00060708090A0B0C0D0E0F18 - Subway
Update Countdown Timer HUD
$00/E59B A9 20 LDA #$20 $00/E59D EB XBA $00/E59E AD BD 0C LDA $0CBD [$00:0CBD] //First digit of countdown timer $00/E5A1 0A ASL A $00/E5A2 0A ASL A $00/E5A3 09 80 ORA #$80 $00/E5A5 C2 20 REP #$20 $00/E5A7 8F 9C 24 7E STA $7E249C[$7E:249C] //Update upper left tile $00/E5AB 1A INC A $00/E5AC 8F 9E 24 7E STA $7E249E[$7E:249E] //Update upper right tile $00/E5B0 1A INC A $00/E5B1 8F DC 24 7E STA $7E24DC[$7E:24DC] //Update lower left tile $00/E5B5 1A INC A $00/E5B6 8F DE 24 7E STA $7E24DE[$7E:24DE] //Update lower right tile $00/E5BA E2 20 SEP #$20 $00/E5BC AD BC 0C LDA $0CBC [$00:0CBC] //Second digit of countdown timer $00/E5BF 0A ASL A $00/E5C0 0A ASL A $00/E5C1 09 80 ORA #$80 $00/E5C3 C2 20 REP #$20 $00/E5C5 8F A0 24 7E STA $7E24A0[$7E:24A0] //Update upper left tile $00/E5C9 1A INC A $00/E5CA 8F A2 24 7E STA $7E24A2[$7E:24A2] //Update upper right tile $00/E5CE 1A INC A $00/E5CF 8F E0 24 7E STA $7E24E0[$7E:24E0] //Update lower left tile $00/E5D3 1A INC A $00/E5D4 8F E2 24 7E STA $7E24E2[$7E:24E2] //Update lower right tile $00/E5D8 E2 20 SEP #$20 $00/E5DA EE E6 00 INC $00E6 [$00:00E6] $00/E5DD 6B RTL
Update Lives HUD
$00/E5DE AD 6F 0D LDA $0D6F [$00:0D6F] //Lives 9 and beyond $00/E5E1 F0 04 BEQ $04 [$E5E7] //Skip to $E5E7 if not 9 lives or more remaining $00/E5E3 A9 09 LDA #$09 //Appears as 8 lives on HUD $00/E5E5 80 07 BRA $07 [$E5EE] $00/E5E7 AD 6E 0D LDA $0D6E [$00:0D6E] //Lives $00/E5EA 3A DEC A //Lives -1 $00/E5EB 10 01 BPL $01 [$E5EE] //Skip to $E5EE if counter rolls over $00/E5EC 1A INC A //Restore previous value $00/E5EE 8F 56 24 7E STA $7E2456[$7E:2456] //Update lives HUD tilemap $00/E5F2 EE E6 00 INC $00E6 [$00:00E6] $00/E5F5 6B RTL