If you are still using the old URL (datacrystal.romhacking.net), please update your bookmarks! The old URL may stop working soon.
The current URL is datacrystal.tcrf.net.
The current URL is datacrystal.tcrf.net.
Dragon Warrior II (NES)/ROM map/ASM bank 04: Difference between revisions
Jump to navigation
Jump to search
m (Xkeeper moved page Dragon Warrior II::ROM map/ASM bank 04 to Dragon Warrior II//ROM map/ASM bank 04: normalize subpages and titles) |
(→top) |
||
Line 1: | Line 1: | ||
{{subpage}} | |||
; bank 0x04 of 16 starts at file address 0x010010 | |||
; code bytes: $2F45 (73.86% of bytes in this ROM bank) | ; code bytes: $2F45 (73.86% of bytes in this ROM bank) | ||
; data bytes: $101B (25.16% of bytes in this ROM bank) | ; data bytes: $101B (25.16% of bytes in this ROM bank) |
Revision as of 10:35, 25 January 2024
This is a sub-page of Dragon Warrior II (NES)/ROM map.
- bank 0x04 of 16 starts at file address 0x010010
; code bytes: $2F45 (73.86% of bytes in this ROM bank) ; data bytes: $101B (25.16% of bytes in this ROM bank) ; pcm bytes: $0000 (0.00% of bytes in this ROM bank) ; chr bytes: $0000 (0.00% of bytes in this ROM bank) ; free bytes: $0078 (0.73% of bytes in this ROM bank) ; unknown bytes: $0029 (0.25% of bytes in this ROM bank) ; $3F5F bytes last seen in RAM bank $8000 - $BFFF (100.00% of bytes seen in this ROM bank, 99.02% of bytes in this ROM bank): ; $2F45 code bytes (74.59% of bytes seen in this RAM bank, 73.86% of bytes in this ROM bank) ; $101B data bytes (25.41% of bytes seen in this RAM bank, 25.16% of bytes in this ROM bank) ; PRG Bank 0x04: mostly stuff related to getting into, through, and out of battles, including monster stats, hero EXP table, and equipment stats ; [bank start] -> code ; external control flow target (from $0F:$C905) ; possible external indexed data load target (from $0F:$F3ED, $0F:$FF28) 0x010010|$04:$8000:4C ; possible external indexed data load target (from $0F:$F3F2, $0F:$FF2D) 0x010011|$04:$8001: 22 80 JMP $8022 ; restore the hero ID in A's MP by a random amount based on the Wizard's Ring's power; returns a random number between $03 and #$0A in A and $99 ; external control flow target (from $0F:$F725) 0x010013|$04:$8003:4C 9E A4 JMP $A49E ; restore the hero ID in A's MP by a random amount based on the Wizard's Ring's power; returns a random number between $03 and #$0A in A and $99 ; external control flow target (from $0F:$D149, $0F:$F72E) 0x010016|$04:$8006:4C 02 A4 JMP $A402 ; heal hero ID in A by random amount based on healing power in X ; update each hero's stats based on their current EXP ; external control flow target (from $0F:$C774, $0F:$D0EF) 0x010019|$04:$8009:4C 0E 9D JMP $9D0E ; update each hero's stats based on their current EXP ; set $8F-$90 to EXP required to reach next level ; external control flow target (from $0F:$F737) 0x01001C|$04:$800C:4C F1 9C JMP $9CF1 ; set $8F-$90 to EXP required to reach next level ; external control flow target (from $0F:$C961, $0F:$D1A9, $0F:$D1CE, $0F:$D205, $0F:$D25F) 0x01001F|$04:$800F:4C B9 82 JMP $82B9 ; trigger fixed battle A ; external control flow target (from $0F:$F740) 0x010022|$04:$8012:4C E6 99 JMP $99E6 ; external control flow target (from $0F:$C509) 0x010025|$04:$8015:4C E7 8F JMP $8FE7 ; external control flow target (from $0F:$C8FF) 0x010028|$04:$8018:4C 1D 80 JMP $801D ; code -> unknown 0x01002B|$04:$801B:00 ; BRK 0x01002C|$04:$801C:00 ; BRK ; unknown -> code ; control flow target (from $8018) 0x01002D|$04:$801D:A9 01 LDA #$01 ; Terrain ID #$01: Transitions, Chamber of Horks 0x01002F|$04:$801F:4C 24 80 JMP $8024 ; control flow target (from $8000) 0x010032|$04:$8022:A9 02 LDA #$02 ; Terrain ID #$02: Dungeon, Lava, Tower, Castle ; control flow target (from $801F) 0x010034|$04:$8024:48 PHA 0x010035|$04:$8025:A9 00 LDA #$00 0x010037|$04:$8027:85 98 STA $98 ; outcome of last fight? 0x010039|$04:$8029:A9 08 LDA #$08 ; maximum # of attempts at starting a battle 0x01003B|$04:$802B:85 D9 STA $D9 ; control flow target (from $8032) ; call to code in a different bank ($0F:$C3AB) 0x01003D|$04:$802D:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x010040|$04:$8030:A5 32 LDA $32 ; RNG byte 0 0x010042|$04:$8032:F0 F9 BEQ $802D ; keep cycling through random numbers until $32 is not #$00; we'll maybe use $32 later on 0x010044|$04:$8034:68 PLA 0x010045|$04:$8035:AA TAX 0x010046|$04:$8036:A5 31 LDA $31 ; current map ID 0x010048|$04:$8038:C9 01 CMP #$01 ; Map ID #$01: World Map 0x01004A|$04:$803A:F0 32 BEQ $806E ; determine world map battle formation 0x01004C|$04:$803C:C9 09 CMP #$09 ; Map ID #$09: Moonbrooke 0x01004E|$04:$803E:F0 26 BEQ $8066 ; override terrain ID to Terrain ID #$02: Dungeon, Lava, Tower, Castle and use battle formation #$11: Zombie, Big Cobra, ---, Smoke, Centipod, Metal Slime 0x010050|$04:$8040:38 SEC 0x010051|$04:$8041:E9 2B SBC #$2B ; aside from the world map and Moonbrooke, map IDs < #$2B do not have random encounters 0x010053|$04:$8043:90 28 BCC $806D ; no encounter 0x010055|$04:$8045:A8 TAY 0x010056|$04:$8046:B9 C6 84 LDA $84C6,Y ; Dungeon Encounter Formations 0x010059|$04:$8049:E0 01 CPX #$01 ; Terrain ID #$01: Transitions, Chamber of Horks 0x01005B|$04:$804B:F0 57 BEQ $80A4 ; use the current battle formation ID 0x01005D|$04:$804D:C0 0C CPY #$0C ; Map ID #$37: Cave to Rhone B1 0x01005F|$04:$804F:F0 0B BEQ $805C ; override terrain ID to Terrain ID #$01: Transitions, Chamber of Horks 0x010061|$04:$8051:C0 12 CPY #$12 ; Map ID #$3D: Cave to Rhone 4F 0x010063|$04:$8053:F0 0C BEQ $8061 ; override terrain ID to Terrain ID #$07: Cave to Rhone floors 5-7 0x010065|$04:$8055:C0 13 CPY #$13 ; Map ID #$3E: Cave to Rhone 5F 0x010067|$04:$8057:F0 08 BEQ $8061 ; override terrain ID to Terrain ID #$07: Cave to Rhone floors 5-7 0x010069|$04:$8059:4C A4 80 JMP $80A4 ; override terrain ID to Terrain ID #$01: Transitions, Chamber of Horks ; control flow target (from $804F) 0x01006C|$04:$805C:A2 01 LDX #$01 ; Terrain ID #$01: Transitions, Chamber of Horks 0x01006E|$04:$805E:4C A4 80 JMP $80A4 ; override terrain ID to Terrain ID #$07: Cave to Rhone floors 5-7 ; control flow target (from $8053, $8057) 0x010071|$04:$8061:A2 07 LDX #$07 ; Terrain ID #$07: Cave to Rhone floors 5-7 0x010073|$04:$8063:4C A4 80 JMP $80A4 ; override terrain ID to Terrain ID #$02: Dungeon, Lava, Tower, Castle and use battle formation #$11: Zombie, Big Cobra, ---, Smoke, Centipod, Metal Slime ; control flow target (from $803E) 0x010076|$04:$8066:A2 02 LDX #$02 ; Terrain ID #$02: Dungeon, Lava, Tower, Castle 0x010078|$04:$8068:A9 11 LDA #$11 0x01007A|$04:$806A:4C A4 80 JMP $80A4 ; no encounter ; control flow target (from $8043, $809E, $80A2, $80AD) 0x01007D|$04:$806D:60 RTS ; determine world map battle formation ; control flow target (from $803A) 0x01007E|$04:$806E:A5 16 LDA $16 ; current map X-pos (1) 0x010080|$04:$8070:4A LSR ; world map encounters are based on which 16x16 block you're in 0x010081|$04:$8071:4A LSR 0x010082|$04:$8072:4A LSR 0x010083|$04:$8073:4A LSR 0x010084|$04:$8074:85 D5 STA $D5 0x010086|$04:$8076:A5 17 LDA $17 ; current map Y-pos (1) 0x010088|$04:$8078:29 F0 AND #$F0 0x01008A|$04:$807A:05 D5 ORA $D5 ; $D5 = high nybble of Y-pos | (high nybble of X-pos >> 4) 0x01008C|$04:$807C:AA TAX 0x01008D|$04:$807D:BD C6 83 LDA $83C6,X ; World Map Encounters 0x010090|$04:$8080:48 PHA ; battle formation 0x010091|$04:$8081:A5 3B LDA $3B ; high nybble = terrain ID 0x010093|$04:$8083:4A LSR 0x010094|$04:$8084:4A LSR 0x010095|$04:$8085:4A LSR 0x010096|$04:$8086:4A LSR 0x010097|$04:$8087:AA TAX 0x010098|$04:$8088:68 PLA ; battle formation 0x010099|$04:$8089:E0 00 CPX #$00 ; Terrain ID #$00: Grass 0x01009B|$04:$808B:F0 17 BEQ $80A4 0x01009D|$04:$808D:CA DEX 0x01009E|$04:$808E:E0 03 CPX #$03 ; Terrain ID #$03: Sea 0x0100A0|$04:$8090:D0 0C BNE $809E 0x0100A2|$04:$8092:2A ROL ; move high 2 bits to low 2 bits 0x0100A3|$04:$8093:2A ROL 0x0100A4|$04:$8094:2A ROL 0x0100A5|$04:$8095:29 03 AND #$03 0x0100A7|$04:$8097:18 CLC 0x0100A8|$04:$8098:6D 08 85 ADC $8508 ; ocean battle formations come after terrestrial battle formations; why not just ADC #$40 directly? 0x0100AB|$04:$809B:4C A6 80 JMP $80A6 ; control flow target (from $8090) 0x0100AE|$04:$809E:90 CD BCC $806D ; no encounter; terrains #$01 and #$02 are invalid on the world map 0x0100B0|$04:$80A0:E0 07 CPX #$07 ; Terrain ID #$07: Cave to Rhone floors 5-7 0x0100B2|$04:$80A2:B0 C9 BCS $806D ; no encounter; terrains >= #$07 are invalid on the world map ; control flow target (from $804B, $8059, $805E, $8063, $806A, $808B) 0x0100B4|$04:$80A4:29 3F AND #$3F ; control flow target (from $809B) 0x0100B6|$04:$80A6:85 D8 STA $D8 ; battle formation index 0x0100B8|$04:$80A8:BD 2C 83 LDA $832C,X ; per-terrain encounter rates 0x0100BB|$04:$80AB:C5 32 CMP $32 ; RNG byte 0; compare to previously generated non-zero number 0x0100BD|$04:$80AD:90 BE BCC $806D ; no encounter; encounter rate < RNG => no encounter ; control flow target (from $80F9, $8149, $8162, $8188, $81C3) 0x0100BF|$04:$80AF:C6 D9 DEC $D9 ; maximum # of attempts at starting a battle 0x0100C1|$04:$80B1:F0 06 BEQ $80B9 0x0100C3|$04:$80B3:A5 D8 LDA $D8 ; battle formation index 0x0100C5|$04:$80B5:C9 3F CMP #$3F ; #$3F => no encounters 0x0100C7|$04:$80B7:D0 01 BNE $80BA ; control flow target (from $80B1) 0x0100C9|$04:$80B9:60 RTS ; control flow target (from $80B7) 0x0100CA|$04:$80BA:A2 00 LDX #$00 ; pointer high byte offset 0x0100CC|$04:$80BC:0A ASL 0x0100CD|$04:$80BD:90 02 BCC $80C1 ; high bit of battle formation is never set, but if it were, this would add 3 to the high byte of the battle formation pointer 0x0100CF|$04:$80BF:A2 03 LDX #$03 ; control flow target (from $80BD) 0x0100D1|$04:$80C1:85 D5 STA $D5 ; $D5 = battle formation * 2 0x0100D3|$04:$80C3:0A ASL 0x0100D4|$04:$80C4:90 01 BCC $80C7 ; if second highest bit of battle formation is set, add 1 to the high byte of the battle formation pointer 0x0100D6|$04:$80C6:E8 INX ; control flow target (from $80C4) 0x0100D7|$04:$80C7:18 CLC 0x0100D8|$04:$80C8:65 D5 ADC $D5 0x0100DA|$04:$80CA:90 01 BCC $80CD ; if (battle formation * 6) overflows, add 1 to the high byte of the battle formation pointer 0x0100DC|$04:$80CC:E8 INX ; control flow target (from $80CA) 0x0100DD|$04:$80CD:18 CLC 0x0100DE|$04:$80CE:6D 34 83 ADC $8334 ; -> $04:$8509: Battle Formations 0x0100E1|$04:$80D1:85 D5 STA $D5 ; $D5 = low byte of pointer to desired battle formation 0x0100E3|$04:$80D3:8A TXA 0x0100E4|$04:$80D4:6D 35 83 ADC $8335 0x0100E7|$04:$80D7:85 D6 STA $D6 ; battle formation; $D6 = high byte of pointer to desired battle formation 0x0100E9|$04:$80D9:20 7E 83 JSR $837E ; initialize enemy group data at $0663-$068F to #$FF ; call to code in a different bank ($0F:$C3AB) 0x0100EC|$04:$80DC:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x0100EF|$04:$80DF:A5 32 LDA $32 ; RNG byte 0 0x0100F1|$04:$80E1:29 07 AND #$07 0x0100F3|$04:$80E3:D0 56 BNE $813B ; 1/8 chance for a special formation 0x0100F5|$04:$80E5:A0 00 LDY #$00 0x0100F7|$04:$80E7:84 D7 STY $D7 ; high bits of IDs in selected battle formation ; control flow target (from $80F1) 0x0100F9|$04:$80E9:B1 D5 LDA ($D5),Y ; copy the high bits of the regular formation's 6 enemies into $D7 0x0100FB|$04:$80EB:0A ASL 0x0100FC|$04:$80EC:26 D7 ROL $D7 ; high bits of IDs in selected battle formation 0x0100FE|$04:$80EE:C8 INY 0x0100FF|$04:$80EF:C0 06 CPY #$06 ; battle formation data is 6 bytes each 0x010101|$04:$80F1:D0 F6 BNE $80E9 0x010103|$04:$80F3:A5 D7 LDA $D7 ; high bits of IDs in selected battle formation 0x010105|$04:$80F5:C9 3F CMP #$3F 0x010107|$04:$80F7:D0 03 BNE $80FC ; if all 6 enemies had their high bit set, try again with a different random number 0x010109|$04:$80F9:4C AF 80 JMP $80AF ; otherwise loop to try again ; control flow target (from $80F7) 0x01010C|$04:$80FC:0A ASL ; special formations are 4 bytes each 0x01010D|$04:$80FD:0A ASL 0x01010E|$04:$80FE:AA TAX 0x01010F|$04:$80FF:A0 00 LDY #$00 ; control flow target (from $8115) 0x010111|$04:$8101:BD A1 86 LDA $86A1,X ; Special Formations 0x010114|$04:$8104:29 7F AND #$7F 0x010116|$04:$8106:C9 7F CMP #$7F 0x010118|$04:$8108:F0 03 BEQ $810D ; #$FF and #$7F => no enemy 0x01011A|$04:$810A:99 63 06 STA $0663,Y ; monster ID, group 1; store monster ID ; control flow target (from $8108) 0x01011D|$04:$810D:E8 INX ; update special formation enemy read index 0x01011E|$04:$810E:98 TYA ; update monster group write index 0x01011F|$04:$810F:18 CLC 0x010120|$04:$8110:69 0B ADC #$0B ; monster group data is #$0B bytes 0x010122|$04:$8112:A8 TAY 0x010123|$04:$8113:C0 2C CPY #$2C ; and there are a maximum of 4 groups (#$0B * #$04 = #$2C) 0x010125|$04:$8115:D0 EA BNE $8101 ; if more groups to fill, go fill them 0x010127|$04:$8117:A5 32 LDA $32 ; RNG byte 0 0x010129|$04:$8119:0A ASL 0x01012A|$04:$811A:0A ASL 0x01012B|$04:$811B:0A ASL 0x01012C|$04:$811C:0A ASL 0x01012D|$04:$811D:48 PHA ; RNG byte 0 << 4 0x01012E|$04:$811E:A9 00 LDA #$00 0x010130|$04:$8120:69 02 ADC #$02 0x010132|$04:$8122:8D 82 06 STA $0682 ; $0682 = #$02 + 1 bit of randomness 0x010135|$04:$8125:68 PLA ; RNG byte 0 << 4 0x010136|$04:$8126:0A ASL ; RNG byte 0 << 5 0x010137|$04:$8127:A9 00 LDA #$00 0x010139|$04:$8129:69 01 ADC #$01 0x01013B|$04:$812B:8D 77 06 STA $0677 ; $0677 = #$01 + 1 bit of randomness 0x01013E|$04:$812E:A9 01 LDA #$01 0x010140|$04:$8130:8D 6C 06 STA $066C 0x010143|$04:$8133:A9 08 LDA #$08 0x010145|$04:$8135:8D 8D 06 STA $068D 0x010148|$04:$8138:4C F5 81 JMP $81F5 ; control flow target (from $80E3) 0x01014B|$04:$813B:C9 07 CMP #$07 ; low 3 bits of RNG byte 0 are not all 0; check if they're all 1 0x01014D|$04:$813D:D0 15 BNE $8154 0x01014F|$04:$813F:A0 05 LDY #$05 0x010151|$04:$8141:B1 D5 LDA ($D5),Y 0x010153|$04:$8143:29 7F AND #$7F 0x010155|$04:$8145:C9 7F CMP #$7F 0x010157|$04:$8147:D0 03 BNE $814C 0x010159|$04:$8149:4C AF 80 JMP $80AF ; control flow target (from $8147) 0x01015C|$04:$814C:A2 02 LDX #$02 0x01015E|$04:$814E:20 A3 83 JSR $83A3 0x010161|$04:$8151:4C F5 81 JMP $81F5 ; control flow target (from $813D) 0x010164|$04:$8154:C9 06 CMP #$06 0x010166|$04:$8156:D0 22 BNE $817A 0x010168|$04:$8158:A0 04 LDY #$04 0x01016A|$04:$815A:B1 D5 LDA ($D5),Y 0x01016C|$04:$815C:29 7F AND #$7F 0x01016E|$04:$815E:C9 7F CMP #$7F 0x010170|$04:$8160:D0 03 BNE $8165 0x010172|$04:$8162:4C AF 80 JMP $80AF ; control flow target (from $8160) 0x010175|$04:$8165:A2 02 LDX #$02 0x010177|$04:$8167:20 B7 83 JSR $83B7 ; given a monster group index in X, write the monster ID in A to the appropriate monster group data at $0663 0x01017A|$04:$816A:A5 32 LDA $32 ; RNG byte 0 0x01017C|$04:$816C:4A LSR 0x01017D|$04:$816D:4A LSR 0x01017E|$04:$816E:4A LSR 0x01017F|$04:$816F:29 03 AND #$03 0x010181|$04:$8171:18 CLC 0x010182|$04:$8172:69 03 ADC #$03 0x010184|$04:$8174:99 6C 06 STA $066C,Y 0x010187|$04:$8177:4C F5 81 JMP $81F5 ; control flow target (from $8156) 0x01018A|$04:$817A:C9 05 CMP #$05 0x01018C|$04:$817C:D0 34 BNE $81B2 0x01018E|$04:$817E:A0 03 LDY #$03 0x010190|$04:$8180:B1 D5 LDA ($D5),Y 0x010192|$04:$8182:29 7F AND #$7F 0x010194|$04:$8184:C9 7F CMP #$7F 0x010196|$04:$8186:D0 03 BNE $818B 0x010198|$04:$8188:4C AF 80 JMP $80AF ; control flow target (from $8186) 0x01019B|$04:$818B:A2 02 LDX #$02 0x01019D|$04:$818D:20 A3 83 JSR $83A3 0x0101A0|$04:$8190:A2 00 LDX #$00 0x0101A2|$04:$8192:20 89 83 JSR $8389 ; take current RNG value $33, figure out which $8398 bucket it fits into, and store that index in Y 0x0101A5|$04:$8195:C0 06 CPY #$06 0x0101A7|$04:$8197:B0 4D BCS $81E6 0x0101A9|$04:$8199:C0 03 CPY #$03 0x0101AB|$04:$819B:90 0F BCC $81AC 0x0101AD|$04:$819D:88 DEY 0x0101AE|$04:$819E:88 DEY 0x0101AF|$04:$819F:88 DEY 0x0101B0|$04:$81A0:98 TYA 0x0101B1|$04:$81A1:48 PHA 0x0101B2|$04:$81A2:D0 02 BNE $81A6 0x0101B4|$04:$81A4:A0 03 LDY #$03 ; control flow target (from $81A2) 0x0101B6|$04:$81A6:88 DEY 0x0101B7|$04:$81A7:20 AC 83 JSR $83AC ; given a weird value <= #$03 in Y, get the monster ID from ($D5),Y and if it's not #$FF/#$7F, get the monster group index corresponding to Y from $83BE and write the monster ID to the appropriate monster group data at $0663 0x0101BA|$04:$81AA:68 PLA 0x0101BB|$04:$81AB:A8 TAY ; control flow target (from $819B) 0x0101BC|$04:$81AC:20 AC 83 JSR $83AC ; given a weird value <= #$03 in Y, get the monster ID from ($D5),Y and if it's not #$FF/#$7F, get the monster group index corresponding to Y from $83BE and write the monster ID to the appropriate monster group data at $0663 0x0101BF|$04:$81AF:4C F5 81 JMP $81F5 ; control flow target (from $817C) 0x0101C2|$04:$81B2:A8 TAY 0x0101C3|$04:$81B3:C0 02 CPY #$02 0x0101C5|$04:$81B5:90 01 BCC $81B8 0x0101C7|$04:$81B7:88 DEY ; control flow target (from $81B5) 0x0101C8|$04:$81B8:88 DEY 0x0101C9|$04:$81B9:84 D7 STY $D7 ; high bits of IDs in selected battle formation 0x0101CB|$04:$81BB:B1 D5 LDA ($D5),Y 0x0101CD|$04:$81BD:29 7F AND #$7F 0x0101CF|$04:$81BF:C9 7F CMP #$7F 0x0101D1|$04:$81C1:D0 03 BNE $81C6 0x0101D3|$04:$81C3:4C AF 80 JMP $80AF ; control flow target (from $81C1) 0x0101D6|$04:$81C6:20 B4 83 JSR $83B4 ; given a weird value <= #$03 in Y, get the corresponding monster group index from $83BE and write the monster ID in A to the appropriate monster group data at $0663 0x0101D9|$04:$81C9:A2 07 LDX #$07 0x0101DB|$04:$81CB:20 89 83 JSR $8389 ; take current RNG value $33, figure out which $8398 bucket it fits into, and store that index in Y 0x0101DE|$04:$81CE:98 TYA 0x0101DF|$04:$81CF:F0 12 BEQ $81E3 0x0101E1|$04:$81D1:C9 03 CMP #$03 0x0101E3|$04:$81D3:B0 11 BCS $81E6 0x0101E5|$04:$81D5:18 CLC 0x0101E6|$04:$81D6:65 D7 ADC $D7 ; high bits of IDs in selected battle formation 0x0101E8|$04:$81D8:C9 03 CMP #$03 0x0101EA|$04:$81DA:90 03 BCC $81DF 0x0101EC|$04:$81DC:38 SEC 0x0101ED|$04:$81DD:E9 03 SBC #$03 ; control flow target (from $81DA) 0x0101EF|$04:$81DF:A8 TAY 0x0101F0|$04:$81E0:20 AC 83 JSR $83AC ; given a weird value <= #$03 in Y, get the monster ID from ($D5),Y and if it's not #$FF/#$7F, get the monster group index corresponding to Y from $83BE and write the monster ID to the appropriate monster group data at $0663 ; control flow target (from $81CF) 0x0101F3|$04:$81E3:4C F5 81 JMP $81F5 ; control flow target (from $8197, $81D3) 0x0101F6|$04:$81E6:A9 00 LDA #$00 ; control flow target (from $81F3) 0x0101F8|$04:$81E8:48 PHA 0x0101F9|$04:$81E9:A8 TAY 0x0101FA|$04:$81EA:20 AC 83 JSR $83AC ; given a weird value <= #$03 in Y, get the monster ID from ($D5),Y and if it's not #$FF/#$7F, get the monster group index corresponding to Y from $83BE and write the monster ID to the appropriate monster group data at $0663 0x0101FD|$04:$81ED:68 PLA 0x0101FE|$04:$81EE:18 CLC 0x0101FF|$04:$81EF:69 01 ADC #$01 0x010201|$04:$81F1:C9 03 CMP #$03 0x010203|$04:$81F3:D0 F3 BNE $81E8 ; control flow target (from $8138, $8151, $8177, $81AF, $81E3) 0x010205|$04:$81F5:AD 46 00 LDA $0046 ; Repel (#$FE) / Fairy Water (#$FF) flag 0x010208|$04:$81F8:F0 55 BEQ $824F 0x01020A|$04:$81FA:A5 31 LDA $31 ; current map ID 0x01020C|$04:$81FC:C9 01 CMP #$01 ; Map ID #$01: World Map 0x01020E|$04:$81FE:D0 4F BNE $824F 0x010210|$04:$8200:A9 00 LDA #$00 0x010212|$04:$8202:85 D5 STA $D5 ; control flow target (from $8240) 0x010214|$04:$8204:AA TAX 0x010215|$04:$8205:BC 63 06 LDY $0663,X ; monster ID, group 1 0x010218|$04:$8208:C0 FF CPY #$FF 0x01021A|$04:$820A:F0 2E BEQ $823A 0x01021C|$04:$820C:A9 00 LDA #$00 0x01021E|$04:$820E:85 D7 STA $D7 ; high bits of IDs in selected battle formation 0x010220|$04:$8210:88 DEY 0x010221|$04:$8211:84 D6 STY $D6 ; battle formation 0x010223|$04:$8213:98 TYA 0x010224|$04:$8214:A0 04 LDY #$04 ; control flow target (from $821A) 0x010226|$04:$8216:0A ASL 0x010227|$04:$8217:26 D7 ROL $D7 ; high bits of IDs in selected battle formation 0x010229|$04:$8219:88 DEY 0x01022A|$04:$821A:D0 FA BNE $8216 0x01022C|$04:$821C:38 SEC 0x01022D|$04:$821D:E5 D6 SBC $D6 ; battle formation 0x01022F|$04:$821F:B0 02 BCS $8223 0x010231|$04:$8221:C6 D7 DEC $D7 ; high bits of IDs in selected battle formation ; control flow target (from $821F) 0x010233|$04:$8223:18 CLC 0x010234|$04:$8224:6D 4D 82 ADC $824D 0x010237|$04:$8227:85 D6 STA $D6 ; battle formation 0x010239|$04:$8229:A5 D7 LDA $D7 ; high bits of IDs in selected battle formation 0x01023B|$04:$822B:6D 4E 82 ADC $824E 0x01023E|$04:$822E:85 D7 STA $D7 ; high bits of IDs in selected battle formation 0x010240|$04:$8230:A0 05 LDY #$05 0x010242|$04:$8232:B1 D6 LDA ($D6),Y ; battle formation 0x010244|$04:$8234:C5 D5 CMP $D5 0x010246|$04:$8236:90 02 BCC $823A 0x010248|$04:$8238:85 D5 STA $D5 ; control flow target (from $820A, $8236) 0x01024A|$04:$823A:8A TXA 0x01024B|$04:$823B:18 CLC 0x01024C|$04:$823C:69 0B ADC #$0B 0x01024E|$04:$823E:C9 2C CMP #$2C 0x010250|$04:$8240:D0 C2 BNE $8204 0x010252|$04:$8242:AD 38 06 LDA $0638 ; Midenhall Attack Power 0x010255|$04:$8245:4A LSR 0x010256|$04:$8246:C5 D5 CMP $D5 0x010258|$04:$8248:F0 05 BEQ $824F 0x01025A|$04:$824A:90 03 BCC $824F 0x01025C|$04:$824C:60 RTS ; code -> data ; data load target (from $8224) 0x01025D|$04:$824D:F5 ; data load target (from $822B) 0x01025E|$04:$824E:B7 ; data -> code ; control flow target (from $81F8, $81FE, $8248, $824A) ; call to code in a different bank ($0F:$C3AB) 0x01025F|$04:$824F:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x010262|$04:$8252:A2 00 LDX #$00 0x010264|$04:$8254:86 D5 STX $D5 ; control flow target (from $8284) 0x010266|$04:$8256:A9 FF LDA #$FF 0x010268|$04:$8258:DD 63 06 CMP $0663,X ; monster ID, group 1 0x01026B|$04:$825B:F0 20 BEQ $827D 0x01026D|$04:$825D:DD 6C 06 CMP $066C,X 0x010270|$04:$8260:D0 13 BNE $8275 0x010272|$04:$8262:A0 04 LDY #$04 ; control flow target (from $826A) 0x010274|$04:$8264:06 32 ASL $32 ; RNG byte 0; pull 4 bits from RNG, updating RNG in the process 0x010276|$04:$8266:26 33 ROL $33 ; RNG byte 1 0x010278|$04:$8268:2A ROL 0x010279|$04:$8269:88 DEY 0x01027A|$04:$826A:D0 F8 BNE $8264 0x01027C|$04:$826C:29 0F AND #$0F 0x01027E|$04:$826E:A8 TAY ; use random 4-bit index 0x01027F|$04:$826F:B9 36 83 LDA $8336,Y 0x010282|$04:$8272:9D 6C 06 STA $066C,X ; control flow target (from $8260) 0x010285|$04:$8275:A5 D5 LDA $D5 0x010287|$04:$8277:18 CLC 0x010288|$04:$8278:7D 6C 06 ADC $066C,X 0x01028B|$04:$827B:85 D5 STA $D5 ; control flow target (from $825B) 0x01028D|$04:$827D:8A TXA 0x01028E|$04:$827E:18 CLC 0x01028F|$04:$827F:69 0B ADC #$0B 0x010291|$04:$8281:AA TAX 0x010292|$04:$8282:E0 2C CPX #$2C ; #$2C = #$0B * 4, at which point we will have exhausted the 16-bit RNG supply 0x010294|$04:$8284:D0 D0 BNE $8256 0x010296|$04:$8286:A5 D8 LDA $D8 ; battle formation index 0x010298|$04:$8288:C9 12 CMP #$12 ; formation size 0x01029A|$04:$828A:B0 52 BCS $82DE 0x01029C|$04:$828C:A2 05 LDX #$05 0x01029E|$04:$828E:C9 0D CMP #$0D 0x0102A0|$04:$8290:B0 01 BCS $8293 0x0102A2|$04:$8292:CA DEX ; control flow target (from $8290) 0x0102A3|$04:$8293:86 D6 STX $D6 ; battle formation ; control flow target (from $82B6) 0x0102A5|$04:$8295:A5 D5 LDA $D5 0x0102A7|$04:$8297:C5 D6 CMP $D6 ; battle formation 0x0102A9|$04:$8299:90 43 BCC $82DE ; control flow target (from $82AA, $82AF) 0x0102AB|$04:$829B:C8 INY 0x0102AC|$04:$829C:C0 04 CPY #$04 0x0102AE|$04:$829E:90 02 BCC $82A2 0x0102B0|$04:$82A0:A0 00 LDY #$00 ; control flow target (from $829E) 0x0102B2|$04:$82A2:BE 7A 83 LDX $837A,Y ; pre-computed multiples of #$0B 0x0102B5|$04:$82A5:BD 63 06 LDA $0663,X ; monster ID, group 1 0x0102B8|$04:$82A8:C9 FF CMP #$FF 0x0102BA|$04:$82AA:F0 EF BEQ $829B 0x0102BC|$04:$82AC:BD 6C 06 LDA $066C,X 0x0102BF|$04:$82AF:F0 EA BEQ $829B 0x0102C1|$04:$82B1:DE 6C 06 DEC $066C,X 0x0102C4|$04:$82B4:C6 D5 DEC $D5 0x0102C6|$04:$82B6:4C 95 82 JMP $8295 ; trigger fixed battle A ; control flow target (from $800F) 0x0102C9|$04:$82B9:48 PHA 0x0102CA|$04:$82BA:A9 00 LDA #$00 0x0102CC|$04:$82BC:85 98 STA $98 ; outcome of last fight? 0x0102CE|$04:$82BE:20 7E 83 JSR $837E ; initialize enemy group data at $0663-$068F to #$FF 0x0102D1|$04:$82C1:68 PLA 0x0102D2|$04:$82C2:0A ASL 0x0102D3|$04:$82C3:0A ASL 0x0102D4|$04:$82C4:AA TAX 0x0102D5|$04:$82C5:A0 00 LDY #$00 ; control flow target (from $82DC) 0x0102D7|$04:$82C7:BD 46 83 LDA $8346,X ; Fixed Encounters (group 1 Monster ID, group 1 count, group 2 Monster ID, group 2 count) 0x0102DA|$04:$82CA:E8 INX 0x0102DB|$04:$82CB:99 63 06 STA $0663,Y ; monster ID, group 1 0x0102DE|$04:$82CE:BD 46 83 LDA $8346,X ; Fixed Encounters (group 1 Monster ID, group 1 count, group 2 Monster ID, group 2 count) 0x0102E1|$04:$82D1:E8 INX 0x0102E2|$04:$82D2:99 6C 06 STA $066C,Y 0x0102E5|$04:$82D5:98 TYA 0x0102E6|$04:$82D6:18 CLC 0x0102E7|$04:$82D7:69 0B ADC #$0B 0x0102E9|$04:$82D9:A8 TAY 0x0102EA|$04:$82DA:C9 16 CMP #$16 0x0102EC|$04:$82DC:D0 E9 BNE $82C7 ; control flow target (from $828A, $8299) 0x0102EE|$04:$82DE:20 ED 86 JSR $86ED 0x0102F1|$04:$82E1:A2 00 LDX #$00 ; control flow target (from $8324) 0x0102F3|$04:$82E3:86 D6 STX $D6 ; battle formation 0x0102F5|$04:$82E5:BC 7A 83 LDY $837A,X ; pre-computed multiples of #$0B 0x0102F8|$04:$82E8:A9 00 LDA #$00 0x0102FA|$04:$82EA:85 D5 STA $D5 0x0102FC|$04:$82EC:B9 6C 06 LDA $066C,Y 0x0102FF|$04:$82EF:F0 29 BEQ $831A 0x010301|$04:$82F1:B9 63 06 LDA $0663,Y ; monster ID, group 1 0x010304|$04:$82F4:C9 FF CMP #$FF 0x010306|$04:$82F6:F0 22 BEQ $831A ; control flow target (from $8318) 0x010308|$04:$82F8:A4 D5 LDY $D5 0x01030A|$04:$82FA:C8 INY 0x01030B|$04:$82FB:A6 D6 LDX $D6 ; battle formation 0x01030D|$04:$82FD:20 9E 8A JSR $8A9E 0x010310|$04:$8300:A6 D6 LDX $D6 ; battle formation 0x010312|$04:$8302:BC 7A 83 LDY $837A,X ; pre-computed multiples of #$0B 0x010315|$04:$8305:B0 13 BCS $831A 0x010317|$04:$8307:98 TYA 0x010318|$04:$8308:18 CLC 0x010319|$04:$8309:65 D5 ADC $D5 0x01031B|$04:$830B:AA TAX 0x01031C|$04:$830C:A9 00 LDA #$00 0x01031E|$04:$830E:9D 64 06 STA $0664,X 0x010321|$04:$8311:E6 D5 INC $D5 0x010323|$04:$8313:A5 D5 LDA $D5 0x010325|$04:$8315:D9 6C 06 CMP $066C,Y 0x010328|$04:$8318:D0 DE BNE $82F8 ; control flow target (from $82EF, $82F6, $8305) 0x01032A|$04:$831A:A5 D5 LDA $D5 0x01032C|$04:$831C:99 6C 06 STA $066C,Y 0x01032F|$04:$831F:A6 D6 LDX $D6 ; battle formation 0x010331|$04:$8321:E8 INX 0x010332|$04:$8322:E0 04 CPX #$04 0x010334|$04:$8324:D0 BD BNE $82E3 0x010336|$04:$8326:20 1E 87 JSR $871E 0x010339|$04:$8329:4C B5 94 JMP $94B5 ; code -> data ; per-terrain encounter rates ; indexed data load target (from $80A8) 0x01033C|$04:$832C:0A ; Terrain ID #$00: Grass 0x01033D|$04:$832D:54 ; Terrain ID #$01: Transitions, Chamber of Horks 0x01033E|$04:$832E:08 ; Terrain ID #$02: Dungeon, Lava, Tower, Castle 0x01033F|$04:$832F:04 ; Terrain ID #$03: Sea 0x010340|$04:$8330:10 ; Terrain ID #$04: Forest, Desert 0x010341|$04:$8331:19 ; Terrain ID #$05: Mountain 0x010342|$04:$8332:10 ; Terrain ID #$06: Swamp 0x010343|$04:$8333:10 ; Terrain ID #$07: Cave to Rhone floors 5-7 ; -> $04:$8509: Battle Formations ; data load target (from $80CE) 0x010344|$04:$8334:09 ; data load target (from $80D4) 0x010345|$04:$8335: 85 ; $04:$8509; Battle Formations ; indexed data load target (from $826F) 0x010346|$04:$8336:01 ; # of monsters per group 0x010347|$04:$8337:02 0x010348|$04:$8338:01 0x010349|$04:$8339:02 0x01034A|$04:$833A:03 0x01034B|$04:$833B:01 0x01034C|$04:$833C:02 0x01034D|$04:$833D:01 0x01034E|$04:$833E:02 0x01034F|$04:$833F:03 0x010350|$04:$8340:01 0x010351|$04:$8341:02 0x010352|$04:$8342:01 0x010353|$04:$8343:02 0x010354|$04:$8344:03 0x010355|$04:$8345:05 ; Fixed Encounters (group 1 Monster ID, group 1 count, group 2 Monster ID, group 2 count) ; indexed data load target (from $82C7, $82CE) 0x010356|$04:$8346:FF 00 1E 02 ; 2 Gremlins (Lianport) 0x01035A|$04:$834A:FF 00 36 01 ; 1 Evil Clown (Midenhall) 0x01035E|$04:$834E:FF 00 3A 01 ; 1 Saber Lion (Osterfair) 0x010362|$04:$8352:FF 00 3C 02 ; 2 Ozwargs (Hamlin) 0x010366|$04:$8356:FF 00 4C 02 ; 2 Gold Batboons (Hargon's Castle) 0x01036A|$04:$835A:FF 00 1E 04 ; 4 Gremlins (Lighthouse) 0x01036E|$04:$835E:FF 00 36 02 ; 2 Evil Clown (Sea Cave) 0x010372|$04:$8362:36 01 37 02 ; 1 Evil Clown, 2 Ghouls (???) 0x010376|$04:$8366:FF 00 4E 01 ; 1 Atlas (Hargon's Castle) 0x01037A|$04:$836A:FF 00 4F 01 ; 1 Bazuzu (Hargon's Castle) 0x01037E|$04:$836E:FF 00 50 01 ; 1 Zarlox (Hargon's Castle) 0x010382|$04:$8372:FF 00 51 01 ; 1 Hargon (Hargon's Castle) 0x010386|$04:$8376:FF 00 52 01 ; Malroth (Hargon's Castle) ; pre-computed multiples of #$0B ; indexed data load target (from $82A2, $82E5, $8302) 0x01038A|$04:$837A:00 0B 16 21 ; data -> code ; initialize enemy group data at $0663-$068F to #$FF ; control flow target (from $80D9, $82BE) 0x01038E|$04:$837E:A9 FF LDA #$FF 0x010390|$04:$8380:A2 2C LDX #$2C ; control flow target (from $8386) 0x010392|$04:$8382:9D 62 06 STA $0662,X ; Moonbrooke Level 0x010395|$04:$8385:CA DEX 0x010396|$04:$8386:D0 FA BNE $8382 0x010398|$04:$8388:60 RTS ; take current RNG value $33, figure out which $8398 bucket it fits into, and store that index in Y ; control flow target (from $8192, $81CB) 0x010399|$04:$8389:A0 00 LDY #$00 0x01039B|$04:$838B:A5 33 LDA $33 ; RNG byte 1 ; control flow target (from $8394) 0x01039D|$04:$838D:DD 98 83 CMP $8398,X 0x0103A0|$04:$8390:B0 05 BCS $8397 0x0103A2|$04:$8392:C8 INY 0x0103A3|$04:$8393:E8 INX 0x0103A4|$04:$8394:4C 8D 83 JMP $838D ; control flow target (from $8390) 0x0103A7|$04:$8397:60 RTS ; code -> data ; indexed data load target (from $838D) 0x0103A8|$04:$8398:D6 AC 82 68 4E 34 00 0x0103AF|$04:$839F:82 5B 34 00 ; data -> code ; control flow target (from $814E, $818D) 0x0103B3|$04:$83A3:20 B7 83 JSR $83B7 ; given a monster group index in X, write the monster ID in A to the appropriate monster group data at $0663 0x0103B6|$04:$83A6:A9 01 LDA #$01 0x0103B8|$04:$83A8:99 6C 06 STA $066C,Y 0x0103BB|$04:$83AB:60 RTS ; given a weird value <= #$03 in Y, get the monster ID from ($D5),Y and if it's not #$FF/#$7F, get the monster group index corresponding to Y from $83BE and write the monster ID to the appropriate monster group data at $0663 ; control flow target (from $81A7, $81AC, $81E0, $81EA) 0x0103BC|$04:$83AC:B1 D5 LDA ($D5),Y 0x0103BE|$04:$83AE:29 7F AND #$7F 0x0103C0|$04:$83B0:C9 7F CMP #$7F 0x0103C2|$04:$83B2:F0 09 BEQ $83BD ; given a weird value <= #$03 in Y, get the corresponding monster group index from $83BE and write the monster ID in A to the appropriate monster group data at $0663 ; control flow target (from $81C6) 0x0103C4|$04:$83B4:BE BE 83 LDX $83BE,Y ; given a monster group index in X, write the monster ID in A to the appropriate monster group data at $0663 ; control flow target (from $8167, $83A3) 0x0103C7|$04:$83B7:BC C2 83 LDY $83C2,X ; pre-computed multiples of #$0B (what was wrong with the identical data at $04:$837A?) 0x0103CA|$04:$83BA:99 63 06 STA $0663,Y ; monster ID, group 1 ; control flow target (from $83B2) 0x0103CD|$04:$83BD:60 RTS ; code -> data ; indexed data load target (from $83B4) 0x0103CE|$04:$83BE:01 0x0103CF|$04:$83BF:00 0x0103D0|$04:$83C0:03 0x0103D1|$04:$83C1:02 ; pre-computed multiples of #$0B (what was wrong with the identical data at $04:$837A?) ; indexed data load target (from $83B7) 0x0103D2|$04:$83C2:00 0B 16 21 ; World Map Encounters ; indexed data load target (from $807D) 0x0103D6|$04:$83C6:61 21 21 08 08 08 07 07 05 05 04 04 45 45 46 E1 0x0103E6|$04:$83D6:18 18 19 19 1A 08 08 06 06 04 03 04 04 44 46 58 0x0103F6|$04:$83E6:18 17 19 19 1A 1A 08 07 07 04 03 02 02 03 45 58 0x010406|$04:$83F6:17 17 18 19 1B 1B 1B 0D 0D 04 03 02 01 00 05 18 0x010416|$04:$8406:16 16 19 1A 1B 1B 1B 0D 0D 0E 03 03 03 01 05 18 0x010426|$04:$8416:16 16 19 1A 1B 10 0F 0D 0E 0E 0E 58 04 03 04 58 0x010436|$04:$8426:18 16 15 15 1B 10 0F 0E 0F 0F 0F 58 58 23 05 58 0x010446|$04:$8436:18 15 95 B9 15 10 CF CF D0 10 51 D8 E3 63 23 58 0x010456|$04:$8446:61 24 A4 A4 A5 A5 CF CF E5 23 63 E3 63 23 23 23 0x010466|$04:$8456:21 21 24 A4 A5 A5 F3 F3 F3 23 63 E3 23 23 23 63 0x010476|$04:$8466:21 21 21 61 64 B3 B3 B2 B2 62 63 E5 23 23 23 63 0x010486|$04:$8476:61 21 21 21 21 32 32 32 32 E2 4F 50 63 63 63 63 0x010496|$04:$8486:21 20 20 21 08 08 25 25 25 62 47 41 42 41 42 56 0x0104A6|$04:$8496:61 21 21 21 7B 7B 62 22 22 22 22 22 22 E2 DB DB 0x0104B6|$04:$84A6:4D 0E 21 21 5B 65 DB 5B 5B 5B 22 62 62 E2 C1 E3 0x0104C6|$04:$84B6:4D 0E 21 21 5B 65 DB 5B 5B 5B 22 62 62 E2 C1 E3 ; Dungeon Encounter Formations ; indexed data load target (from $8046) 0x0104D6|$04:$84C6:0C ; Map ID #$2B: Cave to Hamlin 0x0104D7|$04:$84C7:0A ; Map ID #$2C: Lake Cave B1 0x0104D8|$04:$84C8:0B ; Map ID #$2D: Lake Cave B2 0x0104D9|$04:$84C9:2A ; Map ID #$2E: Sea Cave B1 0x0104DA|$04:$84CA:2B ; Map ID #$2F: Sea Cave B2 0x0104DB|$04:$84CB:2C ; Map ID #$30: Sea Cave B3-1 0x0104DC|$04:$84CC:2C ; Map ID #$31: Sea Cave B3-2 0x0104DD|$04:$84CD:36 ; Map ID #$32: Sea Cave B4 0x0104DE|$04:$84CE:37 ; Map ID #$33: Sea Cave B5 0x0104DF|$04:$84CF:1C ; Map ID #$34: Charlock Castle B1/B2 0x0104E0|$04:$84D0:1C ; Map ID #$35: Charlock Castle B3/B4-1/B5-1 0x0104E1|$04:$84D1:1C ; Map ID #$36: Charlock Castle B4-2/B5-2/B6 0x0104E2|$04:$84D2:38 ; Map ID #$37: Cave to Rhone B1 0x0104E3|$04:$84D3:2D ; Map ID #$38: Cave to Rhone 1F 0x0104E4|$04:$84D4:2E ; Map ID #$39: Cave to Rhone 2F-1 0x0104E5|$04:$84D5:2E ; Map ID #$3A: Cave to Rhone 2F-2 0x0104E6|$04:$84D6:2E ; Map ID #$3B: Cave to Rhone 2F-3 0x0104E7|$04:$84D7:2F ; Map ID #$3C: Cave to Rhone 3F 0x0104E8|$04:$84D8:30 ; Map ID #$3D: Cave to Rhone 4F 0x0104E9|$04:$84D9:31 ; Map ID #$3E: Cave to Rhone 5F 0x0104EA|$04:$84DA:31 ; Map ID #$3F: Cave to Rhone 6F 0x0104EB|$04:$84DB:09 ; Map ID #$40: Spring of Bravery 0x0104EC|$04:$84DC:3F ; Map ID #$41: unused? 0x0104ED|$04:$84DD:3F ; Map ID #$42: unused? 0x0104EE|$04:$84DE:3F ; Map ID #$43: Cave to Rimuldar 0x0104EF|$04:$84DF:35 ; Map ID #$44: Hargon's Castle 2F 0x0104F0|$04:$84E0:34 ; Map ID #$45: Hargon's Castle 3F 0x0104F1|$04:$84E1:3F ; Map ID #$46: Hargon's Castle 4F 0x0104F2|$04:$84E2:3F ; Map ID #$47: Hargon's Castle 5F 0x0104F3|$04:$84E3:3F ; Map ID #$48: Hargon's Castle 6F 0x0104F4|$04:$84E4:26 ; Map ID #$49: Moon Tower 1F 0x0104F5|$04:$84E5:27 ; Map ID #$4A: Moon Tower 2F 0x0104F6|$04:$84E6:27 ; Map ID #$4B: Moon Tower 3F 0x0104F7|$04:$84E7:28 ; Map ID #$4C: Moon Tower 4F 0x0104F8|$04:$84E8:28 ; Map ID #$4D: Moon Tower 5F 0x0104F9|$04:$84E9:29 ; Map ID #$4E: Moon Tower 6F 0x0104FA|$04:$84EA:29 ; Map ID #$4F: Moon Tower 7F 0x0104FB|$04:$84EB:1D ; Map ID #$50: Lighthouse 1F 0x0104FC|$04:$84EC:1E ; Map ID #$51: Lighthouse 2F 0x0104FD|$04:$84ED:1E ; Map ID #$52: Lighthouse 3F 0x0104FE|$04:$84EE:1F ; Map ID #$53: Lighthouse 4F 0x0104FF|$04:$84EF:1F ; Map ID #$54: Lighthouse 5F 0x010500|$04:$84F0:1F ; Map ID #$55: Lighthouse 6F 0x010501|$04:$84F1:1F ; Map ID #$56: Lighthouse 7F 0x010502|$04:$84F2:3F ; Map ID #$57: Lighthouse 8F 0x010503|$04:$84F3:12 ; Map ID #$58: Wind Tower 1F 0x010504|$04:$84F4:12 ; Map ID #$59: Wind Tower 2F 0x010505|$04:$84F5:13 ; Map ID #$5A: Wind Tower 3F 0x010506|$04:$84F6:13 ; Map ID #$5B: Wind Tower 4F 0x010507|$04:$84F7:14 ; Map ID #$5C: Wind Tower 5F 0x010508|$04:$84F8:14 ; Map ID #$5D: Wind Tower 6F 0x010509|$04:$84F9:14 ; Map ID #$5E: Wind Tower 7F 0x01050A|$04:$84FA:3F ; Map ID #$5F: Wind Tower 8F 0x01050B|$04:$84FB:39 ; Map ID #$60: Dragon Horn South 1F 0x01050C|$04:$84FC:39 ; Map ID #$61: Dragon Horn South 2F 0x01050D|$04:$84FD:39 ; Map ID #$62: Dragon Horn South 3F 0x01050E|$04:$84FE:3A ; Map ID #$63: Dragon Horn South 4F 0x01050F|$04:$84FF:3A ; Map ID #$64: Dragon Horn South 5F 0x010510|$04:$8500:3A ; Map ID #$65: Dragon Horn South 6F 0x010511|$04:$8501:39 ; Map ID #$66: Dragon Horn North 1F 0x010512|$04:$8502:39 ; Map ID #$67: Dragon Horn North 2F 0x010513|$04:$8503:39 ; Map ID #$68: Dragon Horn North 3F 0x010514|$04:$8504:3A ; Map ID #$69: Dragon Horn North 4F 0x010515|$04:$8505:3A ; Map ID #$6A: Dragon Horn North 5F 0x010516|$04:$8506:3A ; Map ID #$6B: Dragon Horn North 6F 0x010517|$04:$8507:3F ; Map ID #$6C: Dragon Horn North 7F ; data load target (from $8098) 0x010518|$04:$8508:40 ; Battle Formations ; indirect data load target (via $8334) 0x010519|$04:$8509:81 FF FF FF 81 82 ; Battle Formation #$00: Slime, ---, ---, ---, Slime, Big Slug 0x01051F|$04:$850F:81 82 81 82 FF FF ; Battle Formation #$01: Slime, Big Slug, Slime, Big Slug, ---, --- 0x010525|$04:$8515:82 81 81 83 82 FF ; Battle Formation #$02: Big Slug, Slime, Slime, Iron Ant, Big Slug, --- 0x01052B|$04:$851B:83 84 82 84 83 87 ; Battle Formation #$03: Iron Ant, Drakee, Big Slug, Drakee, Iron Ant, Ghost Mouse 0x010531|$04:$8521:84 85 82 83 84 87 ; Battle Formation #$04: Drakee, Wild Mouse, Big Slug, Iron Ant, Drakee, Ghost Mouse 0x010537|$04:$8527:85 84 88 82 85 86 ; Battle Formation #$05: Wild Mouse, Drakee, Babble, Big Slug, Wild Mouse, Healer 0x01053D|$04:$852D:88 84 85 88 88 8A ; Battle Formation #$06: Babble, Drakee, Wild Mouse, Babble, Babble, Magician 0x010543|$04:$8533:8C 88 8B 82 89 86 ; Battle Formation #$07: Big Cobra, Babble, Big Rat, Big Slug, Army Ant, Healer 0x010549|$04:$8539:0C 0B 07 0A 09 7F ; Battle Formation #$08: Big Cobra, Big Rat, Ghost Mouse, Army Ant, --- 0x01054F|$04:$853F:85 82 83 84 85 8C ; Battle Formation #$09: Wild Mouse, Big Slug, Iron Ant, Drakee, Wild Mouse, Big Cobra 0x010555|$04:$8545:0B 07 0C 06 0C 8D ; Battle Formation #$0A: Big Rat, Ghost Mouse, Big Cobra, Healer, Big Cobra, Magic Ant 0x01055B|$04:$854B:8C 8B 8A 8A 89 8F ; Battle Formation #$0B: Big Cobra, Big Rat, Magician, Magician, Army Ant, Centipod 0x010561|$04:$8551:87 8B 8A FF 8C 8F ; Battle Formation #$0C: Ghost Mouse, Big Rat, Magician, ---, Big Cobra, Centipod 0x010567|$04:$8557:0F 8A 0C 0E 0B 92 ; Battle Formation #$0D: Magician, Big Rat, Big Cobra, Magidrakee, Centipod 0x01056D|$04:$855D:95 91 8F 8A 89 93 ; Battle Formation #$0E: Baboon, Lizard Fly, Centipod, Magician, Army Ant, Smoke 0x010573|$04:$8563:0F 8E 11 0D 8B 12 ; Battle Formation #$0F: Centipod, Magidrakee, Lizard Fly, Magic Ant, Big Rat, Zombie 0x010579|$04:$8569:08 13 0D 92 0D 17 ; Battle Formation #$10: Babble, Smoke, Magic Ant, Zombie, Magic Ant, Megapede 0x01057F|$04:$856F:12 0C FF 93 8F 30 ; Battle Formation #$11: Zombie, Big Cobra, ---, Smoke, Centipod, Metal Slime 0x010585|$04:$8575:12 0A 8B 92 8C 17 ; Battle Formation #$12: Zombie, Magician, Big Rat, Zombie, Big Cobra, Megapede 0x01058B|$04:$857B:93 92 92 87 94 97 ; Battle Formation #$13: Smoke, Zombie, Zombie, Ghost Mouse, Ghost Rat, Megapede 0x010591|$04:$8581:14 12 0E 8D 14 FF ; Battle Formation #$14: Ghost Rat, Zombie, Magidrakee, Magic Ant, Ghost Rat, --- 0x010597|$04:$8587:15 14 16 B0 15 A0 ; Battle Formation #$15: Baboon, Ghost Rat, Carnivog, Metal Slime, Baboon, Mummy Man 0x01059D|$04:$858D:96 95 94 8E 97 92 ; Battle Formation #$16: Carnivog, Baboon, Ghost Rat, Magidrakee, Megapede, Zombie 0x0105A3|$04:$8593:1B 16 12 1A 9C 1D ; Battle Formation #$17: Mud Man, Carnivog, Zombie, Enchanter, Magic Baboon, Demighost 0x0105A9|$04:$8599:1C 1B 1A 9D 92 30 ; Battle Formation #$18: Magic Baboon, Mud Man, Enchanter, Demighost, Zombie, Metal Slime 0x0105AF|$04:$859F:1B 1D 1B 1A 9E 01 ; Battle Formation #$19: Mud Man, Demighost, Mud Man, Enchanter, Gremlin, Slime 0x0105B5|$04:$85A5:1E 1C 1D 81 9F 04 ; Battle Formation #$1A: Gremlin, Magic Baboon, Demighost, Slime, Poison Lily, Drakee 0x0105BB|$04:$85AB:1F 13 8E 22 A2 28 ; Battle Formation #$1B: Poison Lily, Smoke, Gremlin, Saber Tiger, Saber Tiger, Orc 0x0105C1|$04:$85B1:20 21 A2 9E FF A6 ; Battle Formation #$1C: Mummy Man, Gorgon, Saber Tiger, Gremlin, ---, Basilisk 0x0105C7|$04:$85B7:A1 A0 A2 9A 9D FF ; Battle Formation #$1D: Gorgon, Mummy Man, Saber Tiger, Enchanter, Demighost, --- 0x0105CD|$04:$85BD:A2 A0 A1 A5 A3 FF ; Battle Formation #$1E: Saber Tiger, Mummy Man, Gorgon, Undead, Dragon Fly, --- 0x0105D3|$04:$85C3:A5 A1 8D 9E A3 B5 ; Battle Formation #$1F: Undead, Gorgon, Magic Ant, Gremlin, Dragon Fly, Gold Orc 0x0105D9|$04:$85C9:24 23 A6 26 27 A8 ; Battle Formation #$20: Titan Tree, Dragon Fly, Basilisk, Basilisk, Goopi, Orc 0x0105DF|$04:$85CF:28 26 A4 28 26 FF ; Battle Formation #$21: Orc, Basilisk, Titan Tree, Orc, Basilisk, --- 0x0105E5|$04:$85D5:2B 2C 27 8D FF AF ; Battle Formation #$22: Evil Tree, Gas, Goopi, Magic Ant, ---, Sorcerer 0x0105EB|$04:$85DB:2E 7F AC 2F AB 2D ; Battle Formation #$23: Hawk Man, ---, Gas, Sorcerer, Evil Tree, Hork 0x0105F1|$04:$85E1:31 29 33 AF AD C2 ; Battle Formation #$24: Hunter, Puppet Man, Hibabango, Sorcerer, Hork, Metal Babble 0x0105F7|$04:$85E7:33 31 B4 35 2F 35 ; Battle Formation #$25: Hibabango, Hunter, Graboopi, Gold Orc, Sorcerer, Gold Orc 0x0105FD|$04:$85ED:2A 32 B4 7F 37 36 ; Battle Formation #$26: Mummy, Evil Eye, Graboopi, ---, Ghoul, Evil Clown 0x010603|$04:$85F3:35 38 A9 35 B7 FF ; Battle Formation #$27: Gold Orc, Vampirus, Puppet Man, Gold Orc, Ghoul, --- 0x010609|$04:$85F9:38 7F B7 7F B6 C2 ; Battle Formation #$28: Vampirus, ---, Ghoul, ---, Evil Clown, Metal Babble 0x01060F|$04:$85FF:BE BE B5 B6 FF C2 ; Battle Formation #$29: Gargoyle, Gargoyle, Gold Orc, Evil Clown, ---, Metal Babble 0x010615|$04:$8605:B2 B4 AC B6 FF FF ; Battle Formation #$2A: Evil Eye, Graboopi, Gas, Evil Clown, ---, --- 0x01061B|$04:$860B:B5 B4 AB B5 A9 C2 ; Battle Formation #$2B: Gold Orc, Graboopi, Evil Tree, Gold Orc, Puppet Man, Metal Babble 0x010621|$04:$8611:BA B5 AA B5 BA BA ; Battle Formation #$2C: Saber Lion, Gold Orc, Mummy, Gold Orc, Saber Lion, Saber Lion 0x010627|$04:$8617:B9 BA BB B6 BD C2 ; Battle Formation #$2D: Mega Knight, Saber Lion, Metal Hunter, Evil Clown, Dark Eye, Metal Babble 0x01062D|$04:$861D:3C 39 BD 3C B7 7F ; Battle Formation #$2E: Ozwarg, Mega Knight, Dark Eye, Ozwarg, Ghoul, --- 0x010633|$04:$8623:BF BE C1 AD FF C2 ; Battle Formation #$2F: Orc King, Gargoyle, Magic Vampirus, Hork, ---, Metal Babble 0x010639|$04:$8629:C8 C1 C3 C3 C1 C5 ; Battle Formation #$30: Flame, Berserker, Hargon’s Knight, Hargon’s Knight, Berserker, Attack Bot 0x01063F|$04:$862F:41 40 C6 C5 46 C9 ; Battle Formation #$31: Berserker, Magic Vampirus, Green Dragon, Attack Bot, Green Dragon, Silver Batboon 0x010645|$04:$8635:C4 C9 C5 CA C4 FF ; Battle Formation #$32: Cyclops, Silver Batboon, Attack Bot, Blizzard, Cyclops, --- 0x01064B|$04:$863B:CB CA CC CD CC CD ; Battle Formation #$33: Giant, Blizzard, Gold Batboon, Bullwong, Gold Batboon, Bullwong 0x010651|$04:$8641:7F 42 CB C7 47 7F ; Battle Formation #$34: ---, Metal Babble, Giant, Mace Master, Mace Master, --- 0x010657|$04:$8647:C6 C8 C9 C5 C6 CD ; Battle Formation #$35: Green Dragon, Flame, Silver Batboon, Attack Bot, Green Dragon, Bullwong 0x01065D|$04:$864D:B9 BA A9 B5 B9 C2 ; Battle Formation #$36: Mega Knight, Saber Lion, Puppet Man, Gold Orc, Mega Knight, Metal Babble 0x010663|$04:$8653:BB B9 A3 B6 BB BB ; Battle Formation #$37: Metal Hunter, Mega Knight, Dragon Fly, Evil Clown, Metal Hunter, Metal Hunter 0x010669|$04:$8659:AD AD AD AD AD FF ; Battle Formation #$38: Hork, Hork, Hork, Hork, Hork, --- 0x01066F|$04:$865F:14 15 16 17 92 B0 ; Battle Formation #$39: Ghost Rat, Baboon, Carnivog, Megapede, Zombie, Metal Slime 0x010675|$04:$8665:19 15 16 1A 99 9D ; Battle Formation #$3A: Medusa Ball, Baboon, Carnivog, Enchanter, Medusa Ball, Demighost 0x01067B|$04:$866B:8C 9F A4 85 B1 A9 ; Battle Formation #$3B: Big Cobra, Poison Lily, Titan Tree, Wild Mouse, Hunter, Puppet Man 0x010681|$04:$8671:FF FF FF FF FF FF ; Battle Formation #$3C: ---, ---, ---, ---, ---, --- 0x010687|$04:$8677:FF FF FF FF FF FF ; Battle Formation #$3D: ---, ---, ---, ---, ---, --- 0x01068D|$04:$867D:FF FF FF FF FF FF ; Battle Formation #$3E: ---, ---, ---, ---, ---, --- 0x010693|$04:$8683:FF FF FF FF FF FF ; Battle Formation #$3F: ---, ---, ---, ---, ---, --- (no World Map encounters if you use this one) ; Ocean Formations (high 2 bits of encounter group) 0x010699|$04:$8689:90 98 99 FF 87 FF ; Battle Formation #$40: Man O’ War, Sea Slug, Medusa Ball, ---, Ghost Mouse, --- 0x01069F|$04:$868F:98 8E 90 AE FF BE ; Battle Formation #$41: Sea Slug, Magidrakee, Man O’ War, Hawk Man, ---, Gargoyle 0x0106A5|$04:$8695:31 AE 2D 2C 7F 7F ; Battle Formation #$42: Hunter, Hawk Man, Hork, Gas, ---, --- 0x0106AB|$04:$869B:B8 93 91 BE FF FF ; Battle Formation #$43: Vampirus, Smoke, Lizard Fly, Gargoyle, ---, --- ; Special Formations ; indexed data load target (from $8101) 0x0106B1|$04:$86A1:FF FF 09 FF ; Special Formation #$00: Army Ant 0x0106B5|$04:$86A5:FF FF 0D FF ; Special Formation #$01: Magic Ant 0x0106B9|$04:$86A9:FF 1C FF 0E ; Special Formation #$02: Magic Baboon, Magidrakee 0x0106BD|$04:$86AD:FF 15 FF 06 ; Special Formation #$03: Baboon, Healer 0x0106C1|$04:$86B1:FF FF FF 09 ; Special Formation #$04: Army Ant 0x0106C5|$04:$86B5:FF 17 FF 13 ; Special Formation #$05: Megapede, Smoke 0x0106C9|$04:$86B9:FF 1D FF 0D ; Special Formation #$06: Demighost, Magic Ant 0x0106CD|$04:$86BD:FF 28 FF 06 ; Special Formation #$07: Orc, Healer 0x0106D1|$04:$86C1:FF FF 31 0E ; Special Formation #$08: Hunter, Magidrakee 0x0106D5|$04:$86C5:35 FF FF 13 ; Special Formation #$09: Gold Orc, Smoke 0x0106D9|$04:$86C9:FF FF FF 30 ; Special Formation #$0A: Metal Slime 0x0106DD|$04:$86CD:36 FF FF 2D ; Special Formation #$0B: Evil Clown, Hork 0x0106E1|$04:$86D1:47 FF FF 41 ; Special Formation #$0C: Mace Master, Berserker 0x0106E5|$04:$86D5:FF 42 FF 06 ; Special Formation #$0D: Metal Babble, Healer 0x0106E9|$04:$86D9:FF FF FF 11 ; Special Formation #$0E: Lizard Fly 0x0106ED|$04:$86DD:FF FF 23 FF ; Special Formation #$0F: Dragon Fly 0x0106F1|$04:$86E1:38 31 FF FF ; Special Formation #$10: Vampirus, Hunter 0x0106F5|$04:$86E5:FF FF FF 0A ; Special Formation #$11: Magician 0x0106F9|$04:$86E9:12 FF 06 FF ; Special Formation #$12: Zombie, Healer ; data -> code ; control flow target (from $82DE) ; call to code in a different bank ($0F:$C515) 0x0106FD|$04:$86ED:20 15 C5 JSR $C515 ; flash screen 10 times 0x010700|$04:$86F0:A9 17 LDA #$17 ; Music ID #$17: normal battle BGM 0x010702|$04:$86F2:AE 6E 06 LDX $066E 0x010705|$04:$86F5:E0 52 CPX #$52 0x010707|$04:$86F7:D0 02 BNE $86FB 0x010709|$04:$86F9:A9 18 LDA #$18 ; Music ID #$18: Malroth battle BGM ; control flow target (from $86F7) ; call to code in a different bank ($0F:$C561) 0x01070B|$04:$86FB:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) ; call to code in a different bank ($0F:$C465) 0x01070E|$04:$86FE:20 65 C4 JSR $C465 ; wait for interrupt and then set every 4th byte of $0200 - $02FC to #$F0 0x010711|$04:$8701:20 2C 90 JSR $902C 0x010714|$04:$8704:A9 00 LDA #$00 0x010716|$04:$8706:85 04 STA $04 0x010718|$04:$8708:85 05 STA $05 0x01071A|$04:$870A:85 06 STA $06 ; call to code in a different bank ($0F:$C446) 0x01071C|$04:$870C:20 46 C4 JSR $C446 ; turn screen off, write $800 [space] tiles to PPU $2000, turn screen on ; call to code in a different bank ($0F:$C42A) 0x01071F|$04:$870F:20 2A C4 JSR $C42A 0x010722|$04:$8712:20 26 8F JSR $8F26 ; call to code in a different bank ($0F:$C3E8) 0x010725|$04:$8715:20 E8 C3 JSR $C3E8 ; wait for interrupt, set $6007 to #$FF, turn screen off 0x010728|$04:$8718:A2 00 LDX #$00 0x01072A|$04:$871A:8E 00 04 STX $0400 ; menu-based palette overrides start 0x01072D|$04:$871D:60 RTS ; control flow target (from $8326) 0x01072E|$04:$871E:A9 F0 LDA #$F0 0x010730|$04:$8720:A2 00 LDX #$00 ; control flow target (from $8729) 0x010732|$04:$8722:9D 00 02 STA $0200,X ; sprite buffer start 0x010735|$04:$8725:E8 INX 0x010736|$04:$8726:E8 INX 0x010737|$04:$8727:E8 INX 0x010738|$04:$8728:E8 INX 0x010739|$04:$8729:D0 F7 BNE $8722 0x01073B|$04:$872B:A9 00 LDA #$00 0x01073D|$04:$872D:8D 05 04 STA $0405 ; call to code in a different bank ($0F:$C41C) 0x010740|$04:$8730:20 1C C4 JSR $C41C ; wait for interrupt, turn screen sprites and backround on 0x010743|$04:$8733:A9 01 LDA #$01 0x010745|$04:$8735:8D 00 04 STA $0400 ; menu-based palette overrides start ; call to code in a different bank ($0F:$C22C) 0x010748|$04:$8738:20 2C C2 JSR $C22C 0x01074B|$04:$873B:A2 40 LDX #$40 0x01074D|$04:$873D:A9 00 LDA #$00 ; control flow target (from $8743) 0x01074F|$04:$873F:9D 49 04 STA $0449,X 0x010752|$04:$8742:CA DEX 0x010753|$04:$8743:D0 FA BNE $873F 0x010755|$04:$8745:A2 00 LDX #$00 0x010757|$04:$8747:86 DA STX $DA ; control flow target (from $877D) 0x010759|$04:$8749:BD 2A 04 LDA $042A,X 0x01075C|$04:$874C:10 29 BPL $8777 0x01075E|$04:$874E:85 DB STA $DB 0x010760|$04:$8750:29 7F AND #$7F 0x010762|$04:$8752:9D 2A 04 STA $042A,X 0x010765|$04:$8755:29 03 AND #$03 0x010767|$04:$8757:0A ASL 0x010768|$04:$8758:0A ASL 0x010769|$04:$8759:0A ASL 0x01076A|$04:$875A:85 DC STA $DC 0x01076C|$04:$875C:A5 DB LDA $DB 0x01076E|$04:$875E:4A LSR 0x01076F|$04:$875F:4A LSR 0x010770|$04:$8760:29 07 AND #$07 0x010772|$04:$8762:05 DC ORA $DC 0x010774|$04:$8764:A8 TAY 0x010775|$04:$8765:BD 2C 04 LDA $042C,X 0x010778|$04:$8768:38 SEC 0x010779|$04:$8769:65 DA ADC $DA 0x01077B|$04:$876B:C9 1E CMP #$1E 0x01077D|$04:$876D:B0 08 BCS $8777 0x01077F|$04:$876F:85 DA STA $DA 0x010781|$04:$8771:8A TXA 0x010782|$04:$8772:09 80 ORA #$80 0x010784|$04:$8774:99 4A 04 STA $044A,Y ; control flow target (from $874C, $876D) 0x010787|$04:$8777:E8 INX 0x010788|$04:$8778:E8 INX 0x010789|$04:$8779:E8 INX 0x01078A|$04:$877A:E8 INX 0x01078B|$04:$877B:E0 20 CPX #$20 0x01078D|$04:$877D:D0 CA BNE $8749 0x01078F|$04:$877F:C6 DA DEC $DA 0x010791|$04:$8781:A9 20 LDA #$20 0x010793|$04:$8783:38 SEC 0x010794|$04:$8784:E5 DA SBC $DA 0x010796|$04:$8786:4A LSR 0x010797|$04:$8787:85 DA STA $DA 0x010799|$04:$8789:A0 00 LDY #$00 ; control flow target (from $87AB) 0x01079B|$04:$878B:A5 DA LDA $DA 0x01079D|$04:$878D:B9 4A 04 LDA $044A,Y 0x0107A0|$04:$8790:10 16 BPL $87A8 0x0107A2|$04:$8792:29 1F AND #$1F 0x0107A4|$04:$8794:AA TAX 0x0107A5|$04:$8795:BD 2A 04 LDA $042A,X 0x0107A8|$04:$8798:09 80 ORA #$80 0x0107AA|$04:$879A:9D 2A 04 STA $042A,X 0x0107AD|$04:$879D:A5 DA LDA $DA 0x0107AF|$04:$879F:9D 2B 04 STA $042B,X 0x0107B2|$04:$87A2:38 SEC 0x0107B3|$04:$87A3:7D 2C 04 ADC $042C,X 0x0107B6|$04:$87A6:85 DA STA $DA ; control flow target (from $8790) 0x0107B8|$04:$87A8:C8 INY 0x0107B9|$04:$87A9:C0 20 CPY #$20 0x0107BB|$04:$87AB:D0 DE BNE $878B 0x0107BD|$04:$87AD:60 RTS ; control flow target (from $954A) 0x0107BE|$04:$87AE:A2 00 LDX #$00 ; control flow target (from $87C2) 0x0107C0|$04:$87B0:86 DA STX $DA 0x0107C2|$04:$87B2:BD 2A 04 LDA $042A,X 0x0107C5|$04:$87B5:10 05 BPL $87BC 0x0107C7|$04:$87B7:20 80 8C JSR $8C80 0x0107CA|$04:$87BA:A6 DA LDX $DA ; control flow target (from $87B5) 0x0107CC|$04:$87BC:E8 INX 0x0107CD|$04:$87BD:E8 INX 0x0107CE|$04:$87BE:E8 INX 0x0107CF|$04:$87BF:E8 INX 0x0107D0|$04:$87C0:E0 20 CPX #$20 0x0107D2|$04:$87C2:D0 EC BNE $87B0 0x0107D4|$04:$87C4:18 CLC 0x0107D5|$04:$87C5:60 RTS ; control flow target (from $8B48) 0x0107D6|$04:$87C6:AD 00 04 LDA $0400 ; menu-based palette overrides start 0x0107D9|$04:$87C9:F0 02 BEQ $87CD 0x0107DB|$04:$87CB:38 SEC 0x0107DC|$04:$87CC:60 RTS ; control flow target (from $87C9) 0x0107DD|$04:$87CD:A6 DB LDX $DB 0x0107DF|$04:$87CF:BD 06 04 LDA $0406,X 0x0107E2|$04:$87D2:F0 02 BEQ $87D6 0x0107E4|$04:$87D4:38 SEC 0x0107E5|$04:$87D5:60 RTS ; control flow target (from $87D2) 0x0107E6|$04:$87D6:AD 03 04 LDA $0403 0x0107E9|$04:$87D9:85 E6 STA $E6 0x0107EB|$04:$87DB:AD 04 04 LDA $0404 0x0107EE|$04:$87DE:85 E7 STA $E7 0x0107F0|$04:$87E0:AD 01 04 LDA $0401 0x0107F3|$04:$87E3:85 E8 STA $E8 0x0107F5|$04:$87E5:AD 02 04 LDA $0402 0x0107F8|$04:$87E8:85 E9 STA $E9 0x0107FA|$04:$87EA:A9 00 LDA #$00 0x0107FC|$04:$87EC:85 E0 STA $E0 0x0107FE|$04:$87EE:A5 DB LDA $DB 0x010800|$04:$87F0:29 03 AND #$03 0x010802|$04:$87F2:0A ASL 0x010803|$04:$87F3:18 CLC 0x010804|$04:$87F4:65 DB ADC $DB 0x010806|$04:$87F6:A8 TAY 0x010807|$04:$87F7:B9 63 06 LDA $0663,Y ; monster ID, group 1 0x01080A|$04:$87FA:C9 53 CMP #$53 0x01080C|$04:$87FC:90 02 BCC $8800 0x01080E|$04:$87FE:38 SEC 0x01080F|$04:$87FF:60 RTS ; control flow target (from $87FC) 0x010810|$04:$8800:0A ASL 0x010811|$04:$8801:26 E0 ROL $E0 0x010813|$04:$8803:0A ASL 0x010814|$04:$8804:26 E0 ROL $E0 0x010816|$04:$8806:18 CLC 0x010817|$04:$8807:79 63 06 ADC $0663,Y ; monster ID, group 1 0x01081A|$04:$880A:90 02 BCC $880E 0x01081C|$04:$880C:E6 E0 INC $E0 ; control flow target (from $880A) 0x01081E|$04:$880E:18 CLC 0x01081F|$04:$880F:6D BE 88 ADC $88BE ; -> $04:$90FC: count? + pointer to enemy graphics? + pointer to enemy palette 0x010822|$04:$8812:85 DF STA $DF 0x010824|$04:$8814:AD BF 88 LDA $88BF 0x010827|$04:$8817:65 E0 ADC $E0 0x010829|$04:$8819:85 E0 STA $E0 0x01082B|$04:$881B:A6 DB LDX $DB 0x01082D|$04:$881D:20 A2 8F JSR $8FA2 ; read ($DF), INC 16-bit $DF-$E0 0x010830|$04:$8820:9D 0E 04 STA $040E,X 0x010833|$04:$8823:20 A2 8F JSR $8FA2 ; read ($DF), INC 16-bit $DF-$E0 0x010836|$04:$8826:9D 0C 04 STA $040C,X 0x010839|$04:$8829:20 A2 8F JSR $8FA2 ; read ($DF), INC 16-bit $DF-$E0 0x01083C|$04:$882C:9D 0D 04 STA $040D,X 0x01083F|$04:$882F:20 A2 8F JSR $8FA2 ; read ($DF), INC 16-bit $DF-$E0 0x010842|$04:$8832:48 PHA 0x010843|$04:$8833:20 A2 8F JSR $8FA2 ; read ($DF), INC 16-bit $DF-$E0 0x010846|$04:$8836:85 E0 STA $E0 0x010848|$04:$8838:68 PLA 0x010849|$04:$8839:85 DF STA $DF 0x01084B|$04:$883B:20 A2 8F JSR $8FA2 ; read ($DF), INC 16-bit $DF-$E0 0x01084E|$04:$883E:85 DC STA $DC 0x010850|$04:$8840:29 0F AND #$0F 0x010852|$04:$8842:F0 27 BEQ $886B 0x010854|$04:$8844:85 DE STA $DE 0x010856|$04:$8846:A9 00 LDA #$00 0x010858|$04:$8848:85 DD STA $DD 0x01085A|$04:$884A:20 C0 88 JSR $88C0 0x01085D|$04:$884D:90 02 BCC $8851 0x01085F|$04:$884F:38 SEC 0x010860|$04:$8850:60 RTS ; control flow target (from $884D) 0x010861|$04:$8851:A6 DB LDX $DB 0x010863|$04:$8853:A5 E4 LDA $E4 0x010865|$04:$8855:9D 0A 04 STA $040A,X 0x010868|$04:$8858:A5 DC LDA $DC 0x01086A|$04:$885A:29 0F AND #$0F 0x01086C|$04:$885C:85 DD STA $DD 0x01086E|$04:$885E:0A ASL 0x01086F|$04:$885F:18 CLC 0x010870|$04:$8860:65 DD ADC $DD 0x010872|$04:$8862:18 CLC 0x010873|$04:$8863:65 DF ADC $DF 0x010875|$04:$8865:85 DF STA $DF 0x010877|$04:$8867:90 02 BCC $886B 0x010879|$04:$8869:E6 E0 INC $E0 ; control flow target (from $8842, $8867) 0x01087B|$04:$886B:A5 DC LDA $DC 0x01087D|$04:$886D:4A LSR 0x01087E|$04:$886E:4A LSR 0x01087F|$04:$886F:4A LSR 0x010880|$04:$8870:4A LSR 0x010881|$04:$8871:29 0F AND #$0F 0x010883|$04:$8873:F0 14 BEQ $8889 0x010885|$04:$8875:85 DE STA $DE 0x010887|$04:$8877:A9 0D LDA #$0D 0x010889|$04:$8879:85 DD STA $DD 0x01088B|$04:$887B:20 C0 88 JSR $88C0 0x01088E|$04:$887E:90 02 BCC $8882 0x010890|$04:$8880:38 SEC 0x010891|$04:$8881:60 RTS ; control flow target (from $887E) 0x010892|$04:$8882:A6 DB LDX $DB 0x010894|$04:$8884:A5 E4 LDA $E4 0x010896|$04:$8886:9D 0B 04 STA $040B,X ; control flow target (from $8873) 0x010899|$04:$8889:20 71 89 JSR $8971 0x01089C|$04:$888C:90 02 BCC $8890 0x01089E|$04:$888E:38 SEC 0x01089F|$04:$888F:60 RTS ; control flow target (from $888C) 0x0108A0|$04:$8890:A6 DB LDX $DB 0x0108A2|$04:$8892:A5 E6 LDA $E6 0x0108A4|$04:$8894:8D 03 04 STA $0403 0x0108A7|$04:$8897:A5 E7 LDA $E7 0x0108A9|$04:$8899:8D 04 04 STA $0404 0x0108AC|$04:$889C:A5 E5 LDA $E5 0x0108AE|$04:$889E:9D 06 04 STA $0406,X 0x0108B1|$04:$88A1:AD 01 04 LDA $0401 0x0108B4|$04:$88A4:9D 08 04 STA $0408,X 0x0108B7|$04:$88A7:AD 02 04 LDA $0402 0x0108BA|$04:$88AA:9D 07 04 STA $0407,X 0x0108BD|$04:$88AD:A5 E4 LDA $E4 0x0108BF|$04:$88AF:9D 09 04 STA $0409,X 0x0108C2|$04:$88B2:A5 E8 LDA $E8 0x0108C4|$04:$88B4:8D 01 04 STA $0401 0x0108C7|$04:$88B7:A5 E9 LDA $E9 0x0108C9|$04:$88B9:8D 02 04 STA $0402 0x0108CC|$04:$88BC:18 CLC 0x0108CD|$04:$88BD:60 RTS ; code -> data ; -> $04:$90FC: count? + pointer to enemy graphics? + pointer to enemy palette ; data load target (from $880F) 0x0108CE|$04:$88BE:FC ; data load target (from $8814) 0x0108CF|$04:$88BF: 90 ; $04:$90FC; count? + pointer to enemy graphics? + pointer to enemy palette ; data -> code ; control flow target (from $884A, $887B) 0x0108D0|$04:$88C0:A9 00 LDA #$00 0x0108D2|$04:$88C2:85 E1 STA $E1 0x0108D4|$04:$88C4:85 E4 STA $E4 0x0108D6|$04:$88C6:A5 DD LDA $DD 0x0108D8|$04:$88C8:29 01 AND #$01 0x0108DA|$04:$88CA:AA TAX 0x0108DB|$04:$88CB:B5 E6 LDA $E6,X 0x0108DD|$04:$88CD:85 E2 STA $E2 0x0108DF|$04:$88CF:F0 59 BEQ $892A ; control flow target (from $8963) 0x0108E1|$04:$88D1:A6 DD LDX $DD 0x0108E3|$04:$88D3:F0 1F BEQ $88F4 0x0108E5|$04:$88D5:A0 03 LDY #$03 ; control flow target (from $88DF) 0x0108E7|$04:$88D7:B9 0D 05 LDA $050D,Y 0x0108EA|$04:$88DA:C9 30 CMP #$30 0x0108EC|$04:$88DC:D0 16 BNE $88F4 0x0108EE|$04:$88DE:88 DEY 0x0108EF|$04:$88DF:D0 F6 BNE $88D7 0x0108F1|$04:$88E1:A5 E1 LDA $E1 0x0108F3|$04:$88E3:0A ASL 0x0108F4|$04:$88E4:18 CLC 0x0108F5|$04:$88E5:65 E1 ADC $E1 0x0108F7|$04:$88E7:A8 TAY 0x0108F8|$04:$88E8:B1 DF LDA ($DF),Y 0x0108FA|$04:$88EA:C9 30 CMP #$30 0x0108FC|$04:$88EC:D0 06 BNE $88F4 0x0108FE|$04:$88EE:A9 00 LDA #$00 0x010900|$04:$88F0:48 PHA 0x010901|$04:$88F1:4C 3C 89 JMP $893C ; control flow target (from $88D3, $88DC, $88EC) 0x010904|$04:$88F4:A9 00 LDA #$00 0x010906|$04:$88F6:85 E3 STA $E3 0x010908|$04:$88F8:A6 DD LDX $DD ; control flow target (from $8922) 0x01090A|$04:$88FA:A5 E1 LDA $E1 0x01090C|$04:$88FC:0A ASL 0x01090D|$04:$88FD:18 CLC 0x01090E|$04:$88FE:65 E1 ADC $E1 0x010910|$04:$8900:A8 TAY 0x010911|$04:$8901:A9 03 LDA #$03 0x010913|$04:$8903:85 E5 STA $E5 ; control flow target (from $8910) 0x010915|$04:$8905:BD 01 05 LDA $0501,X 0x010918|$04:$8908:D1 DF CMP ($DF),Y 0x01091A|$04:$890A:D0 0B BNE $8917 0x01091C|$04:$890C:E8 INX 0x01091D|$04:$890D:C8 INY 0x01091E|$04:$890E:C6 E5 DEC $E5 0x010920|$04:$8910:D0 F3 BNE $8905 0x010922|$04:$8912:A5 E3 LDA $E3 0x010924|$04:$8914:4C 4C 89 JMP $894C ; control flow target (from $890A, $891A) 0x010927|$04:$8917:E8 INX 0x010928|$04:$8918:C6 E5 DEC $E5 0x01092A|$04:$891A:D0 FB BNE $8917 0x01092C|$04:$891C:E6 E3 INC $E3 0x01092E|$04:$891E:A5 E2 LDA $E2 0x010930|$04:$8920:C5 E3 CMP $E3 0x010932|$04:$8922:D0 D6 BNE $88FA 0x010934|$04:$8924:C9 04 CMP #$04 0x010936|$04:$8926:D0 02 BNE $892A 0x010938|$04:$8928:38 SEC 0x010939|$04:$8929:60 RTS ; control flow target (from $88CF, $8926) 0x01093A|$04:$892A:48 PHA 0x01093B|$04:$892B:0A ASL 0x01093C|$04:$892C:18 CLC 0x01093D|$04:$892D:65 E2 ADC $E2 0x01093F|$04:$892F:18 CLC 0x010940|$04:$8930:65 DD ADC $DD 0x010942|$04:$8932:AA TAX 0x010943|$04:$8933:E6 E2 INC $E2 0x010945|$04:$8935:A5 E1 LDA $E1 0x010947|$04:$8937:0A ASL 0x010948|$04:$8938:18 CLC 0x010949|$04:$8939:65 E1 ADC $E1 0x01094B|$04:$893B:A8 TAY ; control flow target (from $88F1) 0x01094C|$04:$893C:A9 03 LDA #$03 0x01094E|$04:$893E:85 E5 STA $E5 ; control flow target (from $8949) 0x010950|$04:$8940:B1 DF LDA ($DF),Y 0x010952|$04:$8942:9D 01 05 STA $0501,X 0x010955|$04:$8945:E8 INX 0x010956|$04:$8946:C8 INY 0x010957|$04:$8947:C6 E5 DEC $E5 0x010959|$04:$8949:D0 F5 BNE $8940 0x01095B|$04:$894B:68 PLA ; control flow target (from $8914) 0x01095C|$04:$894C:A6 E1 LDX $E1 0x01095E|$04:$894E:E8 INX 0x01095F|$04:$894F:86 E1 STX $E1 ; control flow target (from $8956) 0x010961|$04:$8951:CA DEX 0x010962|$04:$8952:F0 05 BEQ $8959 0x010964|$04:$8954:0A ASL 0x010965|$04:$8955:0A ASL 0x010966|$04:$8956:4C 51 89 JMP $8951 ; control flow target (from $8952) 0x010969|$04:$8959:05 E4 ORA $E4 0x01096B|$04:$895B:85 E4 STA $E4 0x01096D|$04:$895D:A5 E1 LDA $E1 0x01096F|$04:$895F:C5 DE CMP $DE 0x010971|$04:$8961:F0 03 BEQ $8966 0x010973|$04:$8963:4C D1 88 JMP $88D1 ; control flow target (from $8961) 0x010976|$04:$8966:A5 DD LDA $DD 0x010978|$04:$8968:29 01 AND #$01 0x01097A|$04:$896A:AA TAX 0x01097B|$04:$896B:A5 E2 LDA $E2 0x01097D|$04:$896D:95 E6 STA $E6,X 0x01097F|$04:$896F:18 CLC 0x010980|$04:$8970:60 RTS ; control flow target (from $8889) 0x010981|$04:$8971:A6 DB LDX $DB 0x010983|$04:$8973:BD 0C 04 LDA $040C,X 0x010986|$04:$8976:85 DF STA $DF 0x010988|$04:$8978:BD 0D 04 LDA $040D,X 0x01098B|$04:$897B:85 E0 STA $E0 0x01098D|$04:$897D:BD 0E 04 LDA $040E,X 0x010990|$04:$8980:85 E1 STA $E1 0x010992|$04:$8982:A9 00 LDA #$00 0x010994|$04:$8984:85 E4 STA $E4 0x010996|$04:$8986:85 E5 STA $E5 ; control flow target (from $8A95) 0x010998|$04:$8988:A5 DF LDA $DF 0x01099A|$04:$898A:48 PHA 0x01099B|$04:$898B:A5 E0 LDA $E0 0x01099D|$04:$898D:48 PHA 0x01099E|$04:$898E:A9 00 LDA #$00 0x0109A0|$04:$8990:85 DC STA $DC 0x0109A2|$04:$8992:A9 FF LDA #$FF 0x0109A4|$04:$8994:85 DD STA $DD 0x0109A6|$04:$8996:85 DE STA $DE ; control flow target (from $89A7) 0x0109A8|$04:$8998:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x0109AB|$04:$899B:AA TAX 0x0109AC|$04:$899C:29 40 AND #$40 0x0109AE|$04:$899E:D0 03 BNE $89A3 0x0109B0|$04:$89A0:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 ; control flow target (from $899E) 0x0109B3|$04:$89A3:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x0109B6|$04:$89A6:8A TXA 0x0109B7|$04:$89A7:10 EF BPL $8998 0x0109B9|$04:$89A9:4A LSR 0x0109BA|$04:$89AA:29 04 AND #$04 0x0109BC|$04:$89AC:F0 11 BEQ $89BF 0x0109BE|$04:$89AE:90 05 BCC $89B5 0x0109C0|$04:$89B0:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x0109C3|$04:$89B3:85 DC STA $DC ; control flow target (from $89AE) 0x0109C5|$04:$89B5:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x0109C8|$04:$89B8:85 DD STA $DD 0x0109CA|$04:$89BA:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x0109CD|$04:$89BD:85 DE STA $DE ; control flow target (from $89AC) 0x0109CF|$04:$89BF:A2 00 LDX #$00 ; control flow target (from $89DB) 0x0109D1|$04:$89C1:A5 DC LDA $DC 0x0109D3|$04:$89C3:06 DD ASL $DD 0x0109D5|$04:$89C5:26 DE ROL $DE 0x0109D7|$04:$89C7:90 03 BCC $89CC 0x0109D9|$04:$89C9:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 ; control flow target (from $89C7) 0x0109DC|$04:$89CC:9D 4A 04 STA $044A,X 0x0109DF|$04:$89CF:A0 08 LDY #$08 ; control flow target (from $89D6) 0x0109E1|$04:$89D1:0A ASL 0x0109E2|$04:$89D2:7E 5A 04 ROR $045A,X 0x0109E5|$04:$89D5:88 DEY 0x0109E6|$04:$89D6:D0 F9 BNE $89D1 0x0109E8|$04:$89D8:E8 INX 0x0109E9|$04:$89D9:E0 10 CPX #$10 0x0109EB|$04:$89DB:D0 E4 BNE $89C1 0x0109ED|$04:$89DD:A2 00 LDX #$00 ; control flow target (from $89F2) 0x0109EF|$04:$89DF:8A TXA 0x0109F0|$04:$89E0:09 07 ORA #$07 0x0109F2|$04:$89E2:A8 TAY ; control flow target (from $89EE) 0x0109F3|$04:$89E3:BD 4A 04 LDA $044A,X 0x0109F6|$04:$89E6:99 6A 04 STA $046A,Y 0x0109F9|$04:$89E9:E8 INX 0x0109FA|$04:$89EA:88 DEY 0x0109FB|$04:$89EB:8A TXA 0x0109FC|$04:$89EC:29 07 AND #$07 0x0109FE|$04:$89EE:D0 F3 BNE $89E3 0x010A00|$04:$89F0:E0 20 CPX #$20 0x010A02|$04:$89F2:D0 EB BNE $89DF 0x010A04|$04:$89F4:68 PLA 0x010A05|$04:$89F5:85 E0 STA $E0 0x010A07|$04:$89F7:68 PLA 0x010A08|$04:$89F8:85 DF STA $DF 0x010A0A|$04:$89FA:A9 00 LDA #$00 0x010A0C|$04:$89FC:85 E2 STA $E2 ; control flow target (from $8A8B) 0x010A0E|$04:$89FE:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010A11|$04:$8A01:85 E3 STA $E3 0x010A13|$04:$8A03:4A LSR 0x010A14|$04:$8A04:29 03 AND #$03 0x010A16|$04:$8A06:AA TAX 0x010A17|$04:$8A07:E8 INX 0x010A18|$04:$8A08:A5 E3 LDA $E3 0x010A1A|$04:$8A0A:29 40 AND #$40 0x010A1C|$04:$8A0C:D0 0D BNE $8A1B 0x010A1E|$04:$8A0E:E6 E4 INC $E4 0x010A20|$04:$8A10:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010A23|$04:$8A13:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010A26|$04:$8A16:A2 00 LDX #$00 0x010A28|$04:$8A18:4C 26 8A JMP $8A26 ; control flow target (from $8A0C) 0x010A2B|$04:$8A1B:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010A2E|$04:$8A1E:29 0F AND #$0F 0x010A30|$04:$8A20:C5 E5 CMP $E5 0x010A32|$04:$8A22:90 02 BCC $8A26 0x010A34|$04:$8A24:85 E5 STA $E5 ; control flow target (from $8A18, $8A22) 0x010A36|$04:$8A26:8A TXA 0x010A37|$04:$8A27:A8 TAY 0x010A38|$04:$8A28:C8 INY 0x010A39|$04:$8A29:A9 20 LDA #$20 ; control flow target (from $8A2D) 0x010A3B|$04:$8A2B:4A LSR 0x010A3C|$04:$8A2C:88 DEY 0x010A3D|$04:$8A2D:D0 FC BNE $8A2B 0x010A3F|$04:$8A2F:A8 TAY 0x010A40|$04:$8A30:25 E2 AND $E2 0x010A42|$04:$8A32:D0 53 BNE $8A87 0x010A44|$04:$8A34:98 TYA 0x010A45|$04:$8A35:05 E2 ORA $E2 0x010A47|$04:$8A37:85 E2 STA $E2 0x010A49|$04:$8A39:A0 00 LDY #$00 0x010A4B|$04:$8A3B:8A TXA 0x010A4C|$04:$8A3C:D0 03 BNE $8A41 0x010A4E|$04:$8A3E:A0 10 LDY #$10 0x010A50|$04:$8A40:E8 INX ; control flow target (from $8A3C) 0x010A51|$04:$8A41:84 11 STY $11 0x010A53|$04:$8A43:CA DEX 0x010A54|$04:$8A44:8A TXA 0x010A55|$04:$8A45:0A ASL 0x010A56|$04:$8A46:0A ASL 0x010A57|$04:$8A47:0A ASL 0x010A58|$04:$8A48:0A ASL 0x010A59|$04:$8A49:18 CLC 0x010A5A|$04:$8A4A:6D 9C 8A ADC $8A9C 0x010A5D|$04:$8A4D:85 0C STA $0C 0x010A5F|$04:$8A4F:A9 00 LDA #$00 0x010A61|$04:$8A51:6D 9D 8A ADC $8A9D 0x010A64|$04:$8A54:85 0D STA $0D 0x010A66|$04:$8A56:A9 0F LDA #$0F 0x010A68|$04:$8A58:18 CLC 0x010A69|$04:$8A59:65 0C ADC $0C 0x010A6B|$04:$8A5B:85 0E STA $0E 0x010A6D|$04:$8A5D:A9 00 LDA #$00 0x010A6F|$04:$8A5F:65 0D ADC $0D 0x010A71|$04:$8A61:85 0F STA $0F 0x010A73|$04:$8A63:A9 00 LDA #$00 0x010A75|$04:$8A65:85 10 STA $10 0x010A77|$04:$8A67:A5 11 LDA $11 0x010A79|$04:$8A69:4A LSR 0x010A7A|$04:$8A6A:4A LSR 0x010A7B|$04:$8A6B:4A LSR 0x010A7C|$04:$8A6C:4A LSR 0x010A7D|$04:$8A6D:49 01 EOR #$01 0x010A7F|$04:$8A6F:AA TAX 0x010A80|$04:$8A70:B5 E8 LDA $E8,X 0x010A82|$04:$8A72:F6 E8 INC $E8,X 0x010A84|$04:$8A74:D0 02 BNE $8A78 0x010A86|$04:$8A76:38 SEC 0x010A87|$04:$8A77:60 RTS ; control flow target (from $8A74) 0x010A88|$04:$8A78:A0 04 LDY #$04 ; control flow target (from $8A7E) 0x010A8A|$04:$8A7A:4A LSR 0x010A8B|$04:$8A7B:66 10 ROR $10 0x010A8D|$04:$8A7D:88 DEY 0x010A8E|$04:$8A7E:D0 FA BNE $8A7A 0x010A90|$04:$8A80:05 11 ORA $11 0x010A92|$04:$8A82:85 11 STA $11 ; call to code in a different bank ($0F:$C3F6) 0x010A94|$04:$8A84:20 F6 C3 JSR $C3F6 ; copy ($0C) inclusive - ($0E) exclusive to PPU at ($10) ; control flow target (from $8A32) 0x010A97|$04:$8A87:A5 E3 LDA $E3 0x010A99|$04:$8A89:30 03 BMI $8A8E 0x010A9B|$04:$8A8B:4C FE 89 JMP $89FE ; control flow target (from $8A89) 0x010A9E|$04:$8A8E:20 AD 8F JSR $8FAD 0x010AA1|$04:$8A91:C6 E1 DEC $E1 0x010AA3|$04:$8A93:F0 03 BEQ $8A98 0x010AA5|$04:$8A95:4C 88 89 JMP $8988 ; control flow target (from $8A93) 0x010AA8|$04:$8A98:E6 E5 INC $E5 0x010AAA|$04:$8A9A:18 CLC 0x010AAB|$04:$8A9B:60 RTS ; code -> data ; data load target (from $8A4A) 0x010AAC|$04:$8A9C:4A ; data load target (from $8A51) 0x010AAD|$04:$8A9D:04 ; data -> code ; control flow target (from $82FD, $9CA3) 0x010AAE|$04:$8A9E:20 09 8B JSR $8B09 0x010AB1|$04:$8AA1:B0 0C BCS $8AAF 0x010AB3|$04:$8AA3:BD 2A 04 LDA $042A,X 0x010AB6|$04:$8AA6:09 80 ORA #$80 0x010AB8|$04:$8AA8:9D 2A 04 STA $042A,X 0x010ABB|$04:$8AAB:20 80 8C JSR $8C80 0x010ABE|$04:$8AAE:18 CLC ; control flow target (from $8AA1) 0x010ABF|$04:$8AAF:60 RTS ; control flow target (from $9C87) 0x010AC0|$04:$8AB0:20 58 8F JSR $8F58 0x010AC3|$04:$8AB3:90 02 BCC $8AB7 0x010AC5|$04:$8AB5:38 SEC 0x010AC6|$04:$8AB6:60 RTS ; control flow target (from $8AB3) 0x010AC7|$04:$8AB7:86 DA STX $DA 0x010AC9|$04:$8AB9:BD 2A 04 LDA $042A,X 0x010ACC|$04:$8ABC:29 03 AND #$03 0x010ACE|$04:$8ABE:85 DB STA $DB 0x010AD0|$04:$8AC0:0A ASL 0x010AD1|$04:$8AC1:85 DC STA $DC 0x010AD3|$04:$8AC3:0A ASL 0x010AD4|$04:$8AC4:0A ASL 0x010AD5|$04:$8AC5:18 CLC 0x010AD6|$04:$8AC6:65 DB ADC $DB 0x010AD8|$04:$8AC8:18 CLC 0x010AD9|$04:$8AC9:65 DC ADC $DC 0x010ADB|$04:$8ACB:A8 TAY 0x010ADC|$04:$8ACC:B9 63 06 LDA $0663,Y ; monster ID, group 1 0x010ADF|$04:$8ACF:C9 4E CMP #$4E 0x010AE1|$04:$8AD1:B0 15 BCS $8AE8 0x010AE3|$04:$8AD3:A9 87 LDA #$87 ; Music ID #$87: hit 2 SFX ; call to code in a different bank ($0F:$C561) 0x010AE5|$04:$8AD5:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x010AE8|$04:$8AD8:A2 04 LDX #$04 ; Number of flashes when Enemies take a hit ; control flow target (from $8AE5) 0x010AEA|$04:$8ADA:8A TXA 0x010AEB|$04:$8ADB:48 PHA 0x010AEC|$04:$8ADC:20 09 8E JSR $8E09 0x010AEF|$04:$8ADF:20 80 8C JSR $8C80 0x010AF2|$04:$8AE2:68 PLA 0x010AF3|$04:$8AE3:AA TAX 0x010AF4|$04:$8AE4:CA DEX 0x010AF5|$04:$8AE5:D0 F3 BNE $8ADA 0x010AF7|$04:$8AE7:60 RTS ; control flow target (from $8AD1) 0x010AF8|$04:$8AE8:A9 81 LDA #$81 ; Music ID #$81: hit 1 SFX ; call to code in a different bank ($0F:$C561) 0x010AFA|$04:$8AEA:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x010AFD|$04:$8AED:20 BB 90 JSR $90BB 0x010B00|$04:$8AF0:60 RTS ; control flow target (from $9C8F, $A22A) 0x010B01|$04:$8AF1:20 58 8F JSR $8F58 0x010B04|$04:$8AF4:90 02 BCC $8AF8 0x010B06|$04:$8AF6:38 SEC 0x010B07|$04:$8AF7:60 RTS ; control flow target (from $8AF4) 0x010B08|$04:$8AF8:86 DA STX $DA 0x010B0A|$04:$8AFA:20 09 8E JSR $8E09 0x010B0D|$04:$8AFD:A6 DA LDX $DA 0x010B0F|$04:$8AFF:BD 2A 04 LDA $042A,X 0x010B12|$04:$8B02:29 7F AND #$7F 0x010B14|$04:$8B04:9D 2A 04 STA $042A,X 0x010B17|$04:$8B07:18 CLC 0x010B18|$04:$8B08:60 RTS ; control flow target (from $8A9E, $B29E) 0x010B19|$04:$8B09:20 23 8B JSR $8B23 0x010B1C|$04:$8B0C:B0 14 BCS $8B22 0x010B1E|$04:$8B0E:A6 DA LDX $DA 0x010B20|$04:$8B10:A4 DB LDY $DB 0x010B22|$04:$8B12:B9 06 04 LDA $0406,Y 0x010B25|$04:$8B15:9D 2C 04 STA $042C,X 0x010B28|$04:$8B18:20 DD 8B JSR $8BDD 0x010B2B|$04:$8B1B:B0 05 BCS $8B22 0x010B2D|$04:$8B1D:A6 DA LDX $DA 0x010B2F|$04:$8B1F:9D 2B 04 STA $042B,X ; control flow target (from $8B0C, $8B1B) 0x010B32|$04:$8B22:60 RTS ; control flow target (from $8B09) 0x010B33|$04:$8B23:20 58 8F JSR $8F58 0x010B36|$04:$8B26:B0 02 BCS $8B2A 0x010B38|$04:$8B28:38 SEC 0x010B39|$04:$8B29:60 RTS ; control flow target (from $8B26) 0x010B3A|$04:$8B2A:98 TYA 0x010B3B|$04:$8B2B:D0 02 BNE $8B2F 0x010B3D|$04:$8B2D:38 SEC 0x010B3E|$04:$8B2E:60 RTS ; control flow target (from $8B2B) 0x010B3F|$04:$8B2F:A5 DA LDA $DA 0x010B41|$04:$8B31:9D 2A 04 STA $042A,X 0x010B44|$04:$8B34:86 DA STX $DA 0x010B46|$04:$8B36:29 03 AND #$03 0x010B48|$04:$8B38:85 DB STA $DB 0x010B4A|$04:$8B3A:0A ASL 0x010B4B|$04:$8B3B:0A ASL 0x010B4C|$04:$8B3C:0A ASL 0x010B4D|$04:$8B3D:18 CLC 0x010B4E|$04:$8B3E:65 DB ADC $DB 0x010B50|$04:$8B40:85 DB STA $DB 0x010B52|$04:$8B42:A8 TAY 0x010B53|$04:$8B43:B9 06 04 LDA $0406,Y 0x010B56|$04:$8B46:D0 0A BNE $8B52 0x010B58|$04:$8B48:20 C6 87 JSR $87C6 0x010B5B|$04:$8B4B:A4 DB LDY $DB 0x010B5D|$04:$8B4D:A6 DA LDX $DA 0x010B5F|$04:$8B4F:90 01 BCC $8B52 0x010B61|$04:$8B51:60 RTS ; control flow target (from $8B46, $8B4F) 0x010B62|$04:$8B52:9D 2C 04 STA $042C,X 0x010B65|$04:$8B55:B9 09 04 LDA $0409,Y 0x010B68|$04:$8B58:18 CLC 0x010B69|$04:$8B59:D0 01 BNE $8B5C 0x010B6B|$04:$8B5B:60 RTS ; control flow target (from $8B59) 0x010B6C|$04:$8B5C:6D 05 04 ADC $0405 0x010B6F|$04:$8B5F:C9 41 CMP #$41 0x010B71|$04:$8B61:90 02 BCC $8B65 0x010B73|$04:$8B63:38 SEC 0x010B74|$04:$8B64:60 RTS ; control flow target (from $8B61) 0x010B75|$04:$8B65:B9 0E 04 LDA $040E,Y 0x010B78|$04:$8B68:85 DE STA $DE 0x010B7A|$04:$8B6A:B9 0C 04 LDA $040C,Y 0x010B7D|$04:$8B6D:85 DF STA $DF 0x010B7F|$04:$8B6F:B9 0D 04 LDA $040D,Y 0x010B82|$04:$8B72:85 E0 STA $E0 0x010B84|$04:$8B74:A2 00 LDX #$00 ; control flow target (from $8B8C, $8B93) 0x010B86|$04:$8B76:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010B89|$04:$8B79:48 PHA 0x010B8A|$04:$8B7A:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010B8D|$04:$8B7D:29 40 AND #$40 0x010B8F|$04:$8B7F:D0 0A BNE $8B8B 0x010B91|$04:$8B81:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010B94|$04:$8B84:18 CLC 0x010B95|$04:$8B85:69 17 ADC #$17 0x010B97|$04:$8B87:9D 4A 04 STA $044A,X 0x010B9A|$04:$8B8A:E8 INX ; control flow target (from $8B7F) 0x010B9B|$04:$8B8B:68 PLA 0x010B9C|$04:$8B8C:10 E8 BPL $8B76 0x010B9E|$04:$8B8E:20 AD 8F JSR $8FAD 0x010BA1|$04:$8B91:C6 DE DEC $DE 0x010BA3|$04:$8B93:D0 E1 BNE $8B76 0x010BA5|$04:$8B95:86 DD STX $DD 0x010BA7|$04:$8B97:A9 10 LDA #$10 0x010BA9|$04:$8B99:85 DE STA $DE ; control flow target (from $8BD9) 0x010BAB|$04:$8B9B:A2 00 LDX #$00 0x010BAD|$04:$8B9D:AD 05 04 LDA $0405 0x010BB0|$04:$8BA0:F0 19 BEQ $8BBB 0x010BB2|$04:$8BA2:85 DF STA $DF 0x010BB4|$04:$8BA4:A2 00 LDX #$00 0x010BB6|$04:$8BA6:A0 00 LDY #$00 ; control flow target (from $8BB9) 0x010BB8|$04:$8BA8:B9 00 02 LDA $0200,Y ; sprite buffer start 0x010BBB|$04:$8BAB:38 SEC 0x010BBC|$04:$8BAC:E5 DE SBC $DE 0x010BBE|$04:$8BAE:C9 08 CMP #$08 0x010BC0|$04:$8BB0:B0 01 BCS $8BB3 0x010BC2|$04:$8BB2:E8 INX ; control flow target (from $8BB0) 0x010BC3|$04:$8BB3:C8 INY 0x010BC4|$04:$8BB4:C8 INY 0x010BC5|$04:$8BB5:C8 INY 0x010BC6|$04:$8BB6:C8 INY 0x010BC7|$04:$8BB7:C6 DF DEC $DF 0x010BC9|$04:$8BB9:D0 ED BNE $8BA8 ; control flow target (from $8BA0) 0x010BCB|$04:$8BBB:A0 00 LDY #$00 ; control flow target (from $8BCB) 0x010BCD|$04:$8BBD:B9 4A 04 LDA $044A,Y 0x010BD0|$04:$8BC0:38 SEC 0x010BD1|$04:$8BC1:E5 DE SBC $DE 0x010BD3|$04:$8BC3:C9 08 CMP #$08 0x010BD5|$04:$8BC5:B0 01 BCS $8BC8 0x010BD7|$04:$8BC7:E8 INX ; control flow target (from $8BC5) 0x010BD8|$04:$8BC8:C8 INY 0x010BD9|$04:$8BC9:C4 DD CPY $DD 0x010BDB|$04:$8BCB:D0 F0 BNE $8BBD 0x010BDD|$04:$8BCD:E0 09 CPX #$09 0x010BDF|$04:$8BCF:90 02 BCC $8BD3 0x010BE1|$04:$8BD1:38 SEC 0x010BE2|$04:$8BD2:60 RTS ; control flow target (from $8BCF) 0x010BE3|$04:$8BD3:E6 DE INC $DE 0x010BE5|$04:$8BD5:A5 DE LDA $DE 0x010BE7|$04:$8BD7:C9 90 CMP #$90 0x010BE9|$04:$8BD9:D0 C0 BNE $8B9B 0x010BEB|$04:$8BDB:18 CLC 0x010BEC|$04:$8BDC:60 RTS ; control flow target (from $8B18) 0x010BED|$04:$8BDD:A6 DB LDX $DB 0x010BEF|$04:$8BDF:BD 06 04 LDA $0406,X 0x010BF2|$04:$8BE2:D0 02 BNE $8BE6 0x010BF4|$04:$8BE4:38 SEC 0x010BF5|$04:$8BE5:60 RTS ; control flow target (from $8BE2) 0x010BF6|$04:$8BE6:85 DC STA $DC 0x010BF8|$04:$8BE8:AD 00 04 LDA $0400 ; menu-based palette overrides start 0x010BFB|$04:$8BEB:F0 61 BEQ $8C4E 0x010BFD|$04:$8BED:A9 1D LDA #$1D 0x010BFF|$04:$8BEF:38 SEC 0x010C00|$04:$8BF0:E5 DC SBC $DC 0x010C02|$04:$8BF2:85 DD STA $DD 0x010C04|$04:$8BF4:A6 DC LDX $DC 0x010C06|$04:$8BF6:CA DEX 0x010C07|$04:$8BF7:8A TXA 0x010C08|$04:$8BF8:4A LSR 0x010C09|$04:$8BF9:49 FF EOR #$FF 0x010C0B|$04:$8BFB:38 SEC 0x010C0C|$04:$8BFC:69 0F ADC #$0F 0x010C0E|$04:$8BFE:85 DE STA $DE 0x010C10|$04:$8C00:A9 00 LDA #$00 0x010C12|$04:$8C02:85 DF STA $DF ; control flow target (from $8C3E) 0x010C14|$04:$8C04:A9 00 LDA #$00 ; control flow target (from $8C48) 0x010C16|$04:$8C06:85 E0 STA $E0 0x010C18|$04:$8C08:AA TAX 0x010C19|$04:$8C09:BD 2A 04 LDA $042A,X 0x010C1C|$04:$8C0C:10 33 BPL $8C41 0x010C1E|$04:$8C0E:BD 2B 04 LDA $042B,X 0x010C21|$04:$8C11:18 CLC 0x010C22|$04:$8C12:7D 2C 04 ADC $042C,X 0x010C25|$04:$8C15:C5 DE CMP $DE 0x010C27|$04:$8C17:90 28 BCC $8C41 0x010C29|$04:$8C19:BD 2B 04 LDA $042B,X 0x010C2C|$04:$8C1C:18 CLC 0x010C2D|$04:$8C1D:E5 DC SBC $DC 0x010C2F|$04:$8C1F:C9 20 CMP #$20 0x010C31|$04:$8C21:B0 04 BCS $8C27 0x010C33|$04:$8C23:C5 DE CMP $DE 0x010C35|$04:$8C25:B0 1A BCS $8C41 ; control flow target (from $8C21) 0x010C37|$04:$8C27:E6 DF INC $DF 0x010C39|$04:$8C29:A5 DF LDA $DF 0x010C3B|$04:$8C2B:C5 DD CMP $DD 0x010C3D|$04:$8C2D:D0 02 BNE $8C31 0x010C3F|$04:$8C2F:38 SEC 0x010C40|$04:$8C30:60 RTS ; control flow target (from $8C2D) 0x010C41|$04:$8C31:49 01 EOR #$01 0x010C43|$04:$8C33:4A LSR 0x010C44|$04:$8C34:A5 DF LDA $DF 0x010C46|$04:$8C36:90 02 BCC $8C3A 0x010C48|$04:$8C38:49 FF EOR #$FF ; control flow target (from $8C36) 0x010C4A|$04:$8C3A:65 DE ADC $DE 0x010C4C|$04:$8C3C:85 DE STA $DE 0x010C4E|$04:$8C3E:4C 04 8C JMP $8C04 ; control flow target (from $8C0C, $8C17, $8C25) 0x010C51|$04:$8C41:A5 E0 LDA $E0 0x010C53|$04:$8C43:18 CLC 0x010C54|$04:$8C44:69 04 ADC #$04 0x010C56|$04:$8C46:C9 20 CMP #$20 0x010C58|$04:$8C48:D0 BC BNE $8C06 0x010C5A|$04:$8C4A:A5 DE LDA $DE 0x010C5C|$04:$8C4C:18 CLC 0x010C5D|$04:$8C4D:60 RTS ; control flow target (from $8BEB) 0x010C5E|$04:$8C4E:A9 02 LDA #$02 0x010C60|$04:$8C50:85 DE STA $DE 0x010C62|$04:$8C52:A2 00 LDX #$00 ; control flow target (from $8C6C) 0x010C64|$04:$8C54:BD 2A 04 LDA $042A,X 0x010C67|$04:$8C57:10 0D BPL $8C66 0x010C69|$04:$8C59:BD 2B 04 LDA $042B,X 0x010C6C|$04:$8C5C:38 SEC 0x010C6D|$04:$8C5D:7D 2C 04 ADC $042C,X 0x010C70|$04:$8C60:C5 DE CMP $DE 0x010C72|$04:$8C62:90 02 BCC $8C66 0x010C74|$04:$8C64:85 DE STA $DE ; control flow target (from $8C57, $8C62) 0x010C76|$04:$8C66:E8 INX 0x010C77|$04:$8C67:E8 INX 0x010C78|$04:$8C68:E8 INX 0x010C79|$04:$8C69:E8 INX 0x010C7A|$04:$8C6A:E0 20 CPX #$20 0x010C7C|$04:$8C6C:D0 E6 BNE $8C54 0x010C7E|$04:$8C6E:A5 DE LDA $DE 0x010C80|$04:$8C70:A6 DA LDX $DA 0x010C82|$04:$8C72:18 CLC 0x010C83|$04:$8C73:7D 2C 04 ADC $042C,X 0x010C86|$04:$8C76:C9 1F CMP #$1F 0x010C88|$04:$8C78:90 02 BCC $8C7C 0x010C8A|$04:$8C7A:38 SEC 0x010C8B|$04:$8C7B:60 RTS ; control flow target (from $8C78) 0x010C8C|$04:$8C7C:A5 DE LDA $DE 0x010C8E|$04:$8C7E:18 CLC 0x010C8F|$04:$8C7F:60 RTS ; control flow target (from $87B7, $8AAB, $8ADF) 0x010C90|$04:$8C80:A4 DA LDY $DA 0x010C92|$04:$8C82:B9 2A 04 LDA $042A,Y 0x010C95|$04:$8C85:29 03 AND #$03 0x010C97|$04:$8C87:85 DB STA $DB 0x010C99|$04:$8C89:0A ASL 0x010C9A|$04:$8C8A:0A ASL 0x010C9B|$04:$8C8B:0A ASL 0x010C9C|$04:$8C8C:18 CLC 0x010C9D|$04:$8C8D:65 DB ADC $DB 0x010C9F|$04:$8C8F:85 DB STA $DB 0x010CA1|$04:$8C91:AA TAX 0x010CA2|$04:$8C92:AD 05 04 LDA $0405 0x010CA5|$04:$8C95:85 DC STA $DC 0x010CA7|$04:$8C97:BD 0C 04 LDA $040C,X 0x010CAA|$04:$8C9A:85 DF STA $DF 0x010CAC|$04:$8C9C:BD 0D 04 LDA $040D,X 0x010CAF|$04:$8C9F:85 E0 STA $E0 0x010CB1|$04:$8CA1:BD 0E 04 LDA $040E,X 0x010CB4|$04:$8CA4:85 E1 STA $E1 0x010CB6|$04:$8CA6:AD 00 04 LDA $0400 ; menu-based palette overrides start; xx HP reduced 0x010CB9|$04:$8CA9:D0 2B BNE $8CD6 ; control flow target (from $8CC7, $8CCE) 0x010CBB|$04:$8CAB:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010CBE|$04:$8CAE:48 PHA 0x010CBF|$04:$8CAF:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010CC2|$04:$8CB2:29 40 AND #$40 0x010CC4|$04:$8CB4:D0 10 BNE $8CC6 0x010CC6|$04:$8CB6:A5 DC LDA $DC 0x010CC8|$04:$8CB8:0A ASL 0x010CC9|$04:$8CB9:0A ASL 0x010CCA|$04:$8CBA:AA TAX 0x010CCB|$04:$8CBB:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010CCE|$04:$8CBE:18 CLC 0x010CCF|$04:$8CBF:69 17 ADC #$17 0x010CD1|$04:$8CC1:9D 00 02 STA $0200,X ; sprite buffer start 0x010CD4|$04:$8CC4:E6 DC INC $DC ; control flow target (from $8CB4) 0x010CD6|$04:$8CC6:68 PLA 0x010CD7|$04:$8CC7:10 E2 BPL $8CAB 0x010CD9|$04:$8CC9:20 AD 8F JSR $8FAD 0x010CDC|$04:$8CCC:C6 E1 DEC $E1 0x010CDE|$04:$8CCE:D0 DB BNE $8CAB 0x010CE0|$04:$8CD0:A5 DC LDA $DC 0x010CE2|$04:$8CD2:8D 05 04 STA $0405 0x010CE5|$04:$8CD5:60 RTS ; control flow target (from $8CA9) 0x010CE6|$04:$8CD6:B9 2B 04 LDA $042B,Y 0x010CE9|$04:$8CD9:85 E2 STA $E2 0x010CEB|$04:$8CDB:BD 07 04 LDA $0407,X 0x010CEE|$04:$8CDE:85 DE STA $DE 0x010CF0|$04:$8CE0:C6 DE DEC $DE 0x010CF2|$04:$8CE2:BD 08 04 LDA $0408,X 0x010CF5|$04:$8CE5:85 DD STA $DD 0x010CF7|$04:$8CE7:C6 DD DEC $DD ; call to code in a different bank ($0F:$C1DC) 0x010CF9|$04:$8CE9:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; control flow target (from $8DF2) 0x010CFC|$04:$8CEC:A9 00 LDA #$00 0x010CFE|$04:$8CEE:85 E3 STA $E3 ; control flow target (from $8DE8) 0x010D00|$04:$8CF0:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010D03|$04:$8CF3:85 E4 STA $E4 0x010D05|$04:$8CF5:29 40 AND #$40 0x010D07|$04:$8CF7:D0 5D BNE $8D56 0x010D09|$04:$8CF9:A5 DC LDA $DC 0x010D0B|$04:$8CFB:0A ASL 0x010D0C|$04:$8CFC:0A ASL 0x010D0D|$04:$8CFD:AA TAX 0x010D0E|$04:$8CFE:A5 E3 LDA $E3 0x010D10|$04:$8D00:29 10 AND #$10 0x010D12|$04:$8D02:D0 08 BNE $8D0C 0x010D14|$04:$8D04:E6 DD INC $DD 0x010D16|$04:$8D06:A5 E3 LDA $E3 0x010D18|$04:$8D08:09 10 ORA #$10 0x010D1A|$04:$8D0A:85 E3 STA $E3 ; control flow target (from $8D02) 0x010D1C|$04:$8D0C:A5 DD LDA $DD 0x010D1E|$04:$8D0E:9D 01 02 STA $0201,X 0x010D21|$04:$8D11:A5 E4 LDA $E4 0x010D23|$04:$8D13:6A ROR 0x010D24|$04:$8D14:6A ROR 0x010D25|$04:$8D15:6A ROR 0x010D26|$04:$8D16:6A ROR 0x010D27|$04:$8D17:48 PHA 0x010D28|$04:$8D18:29 03 AND #$03 0x010D2A|$04:$8D1A:85 E5 STA $E5 0x010D2C|$04:$8D1C:A4 DB LDY $DB 0x010D2E|$04:$8D1E:B9 0A 04 LDA $040A,Y 0x010D31|$04:$8D21:A4 E5 LDY $E5 0x010D33|$04:$8D23:C8 INY ; control flow target (from $8D29) 0x010D34|$04:$8D24:88 DEY 0x010D35|$04:$8D25:F0 05 BEQ $8D2C 0x010D37|$04:$8D27:4A LSR 0x010D38|$04:$8D28:4A LSR 0x010D39|$04:$8D29:4C 24 8D JMP $8D24 ; control flow target (from $8D25) 0x010D3C|$04:$8D2C:29 03 AND #$03 0x010D3E|$04:$8D2E:85 E5 STA $E5 0x010D40|$04:$8D30:68 PLA 0x010D41|$04:$8D31:29 C0 AND #$C0 0x010D43|$04:$8D33:05 E5 ORA $E5 0x010D45|$04:$8D35:9D 02 02 STA $0202,X 0x010D48|$04:$8D38:A5 E2 LDA $E2 0x010D4A|$04:$8D3A:0A ASL 0x010D4B|$04:$8D3B:0A ASL 0x010D4C|$04:$8D3C:0A ASL 0x010D4D|$04:$8D3D:85 E5 STA $E5 0x010D4F|$04:$8D3F:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010D52|$04:$8D42:18 CLC 0x010D53|$04:$8D43:65 E5 ADC $E5 0x010D55|$04:$8D45:9D 03 02 STA $0203,X 0x010D58|$04:$8D48:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010D5B|$04:$8D4B:18 CLC 0x010D5C|$04:$8D4C:69 17 ADC #$17 0x010D5E|$04:$8D4E:9D 00 02 STA $0200,X ; sprite buffer start 0x010D61|$04:$8D51:E6 DC INC $DC 0x010D63|$04:$8D53:4C E4 8D JMP $8DE4 ; control flow target (from $8CF7) 0x010D66|$04:$8D56:A5 E4 LDA $E4 0x010D68|$04:$8D58:4A LSR 0x010D69|$04:$8D59:4A LSR 0x010D6A|$04:$8D5A:4A LSR 0x010D6B|$04:$8D5B:4A LSR 0x010D6C|$04:$8D5C:29 03 AND #$03 0x010D6E|$04:$8D5E:A8 TAY 0x010D6F|$04:$8D5F:A6 DB LDX $DB 0x010D71|$04:$8D61:BD 0B 04 LDA $040B,X 0x010D74|$04:$8D64:C8 INY ; control flow target (from $8D6A) 0x010D75|$04:$8D65:88 DEY 0x010D76|$04:$8D66:F0 05 BEQ $8D6D 0x010D78|$04:$8D68:4A LSR 0x010D79|$04:$8D69:4A LSR 0x010D7A|$04:$8D6A:4C 65 8D JMP $8D65 ; control flow target (from $8D66) 0x010D7D|$04:$8D6D:29 03 AND #$03 0x010D7F|$04:$8D6F:85 09 STA $09 0x010D81|$04:$8D71:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010D84|$04:$8D74:48 PHA 0x010D85|$04:$8D75:29 0F AND #$0F 0x010D87|$04:$8D77:18 CLC 0x010D88|$04:$8D78:65 E2 ADC $E2 0x010D8A|$04:$8D7A:85 0C STA $0C 0x010D8C|$04:$8D7C:68 PLA 0x010D8D|$04:$8D7D:4A LSR 0x010D8E|$04:$8D7E:4A LSR 0x010D8F|$04:$8D7F:4A LSR 0x010D90|$04:$8D80:4A LSR 0x010D91|$04:$8D81:29 07 AND #$07 0x010D93|$04:$8D83:18 CLC 0x010D94|$04:$8D84:69 0A ADC #$0A 0x010D96|$04:$8D86:85 0E STA $0E ; call to code in a different bank ($0F:$DE6E) 0x010D98|$04:$8D88:20 6E DE JSR $DE6E 0x010D9B|$04:$8D8B:A5 08 LDA $08 ; current PPU write address, high byte 0x010D9D|$04:$8D8D:18 CLC 0x010D9E|$04:$8D8E:69 20 ADC #$20 0x010DA0|$04:$8D90:85 08 STA $08 ; current PPU write address, high byte ; call to code in a different bank ($0F:$C1FA) 0x010DA2|$04:$8D92:20 FA C1 JSR $C1FA ; wait for $02 to not be #$C0, write PPU address in $07-$08 and data in $09 to PPU write buffer at $0300,$02, $01 += 1, $02 += 3, and set $0183 to #$00 0x010DA5|$04:$8D95:A5 02 LDA $02 0x010DA7|$04:$8D97:C9 A5 CMP #$A5 0x010DA9|$04:$8D99:90 03 BCC $8D9E ; call to code in a different bank ($0F:$C1DC) 0x010DAB|$04:$8D9B:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; control flow target (from $8D99) 0x010DAE|$04:$8D9E:A5 E4 LDA $E4 0x010DB0|$04:$8DA0:4A LSR 0x010DB1|$04:$8DA1:29 03 AND #$03 0x010DB3|$04:$8DA3:AA TAX 0x010DB4|$04:$8DA4:A8 TAY 0x010DB5|$04:$8DA5:C8 INY 0x010DB6|$04:$8DA6:A9 10 LDA #$10 ; control flow target (from $8DAA) 0x010DB8|$04:$8DA8:4A LSR 0x010DB9|$04:$8DA9:88 DEY 0x010DBA|$04:$8DAA:D0 FC BNE $8DA8 0x010DBC|$04:$8DAC:85 E5 STA $E5 0x010DBE|$04:$8DAE:25 E3 AND $E3 0x010DC0|$04:$8DB0:D0 0C BNE $8DBE 0x010DC2|$04:$8DB2:A5 E3 LDA $E3 0x010DC4|$04:$8DB4:05 E5 ORA $E5 0x010DC6|$04:$8DB6:85 E3 STA $E3 0x010DC8|$04:$8DB8:E6 DE INC $DE 0x010DCA|$04:$8DBA:A5 DE LDA $DE 0x010DCC|$04:$8DBC:95 E6 STA $E6,X ; control flow target (from $8DB0) 0x010DCE|$04:$8DBE:B5 E6 LDA $E6,X 0x010DD0|$04:$8DC0:85 09 STA $09 0x010DD2|$04:$8DC2:A9 00 LDA #$00 0x010DD4|$04:$8DC4:46 0E LSR $0E 0x010DD6|$04:$8DC6:6A ROR 0x010DD7|$04:$8DC7:46 0E LSR $0E 0x010DD9|$04:$8DC9:6A ROR 0x010DDA|$04:$8DCA:46 0E LSR $0E 0x010DDC|$04:$8DCC:6A ROR 0x010DDD|$04:$8DCD:05 0C ORA $0C 0x010DDF|$04:$8DCF:85 07 STA $07 ; current PPU write address, low byte 0x010DE1|$04:$8DD1:A5 0E LDA $0E 0x010DE3|$04:$8DD3:18 CLC 0x010DE4|$04:$8DD4:69 20 ADC #$20 0x010DE6|$04:$8DD6:85 08 STA $08 ; current PPU write address, high byte ; call to code in a different bank ($0F:$C1FA) 0x010DE8|$04:$8DD8:20 FA C1 JSR $C1FA ; wait for $02 to not be #$C0, write PPU address in $07-$08 and data in $09 to PPU write buffer at $0300,$02, $01 += 1, $02 += 3, and set $0183 to #$00 0x010DEB|$04:$8DDB:A5 02 LDA $02 0x010DED|$04:$8DDD:C9 A5 CMP #$A5 0x010DEF|$04:$8DDF:90 03 BCC $8DE4 ; call to code in a different bank ($0F:$C1DC) 0x010DF1|$04:$8DE1:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; control flow target (from $8D53, $8DDF) 0x010DF4|$04:$8DE4:A5 E4 LDA $E4 0x010DF6|$04:$8DE6:30 03 BMI $8DEB 0x010DF8|$04:$8DE8:4C F0 8C JMP $8CF0 ; control flow target (from $8DE6) 0x010DFB|$04:$8DEB:20 AD 8F JSR $8FAD 0x010DFE|$04:$8DEE:C6 E1 DEC $E1 0x010E00|$04:$8DF0:F0 03 BEQ $8DF5 0x010E02|$04:$8DF2:4C EC 8C JMP $8CEC ; control flow target (from $8DF0) 0x010E05|$04:$8DF5:A6 DA LDX $DA 0x010E07|$04:$8DF7:AD 05 04 LDA $0405 0x010E0A|$04:$8DFA:9D 2D 04 STA $042D,X 0x010E0D|$04:$8DFD:A5 DC LDA $DC 0x010E0F|$04:$8DFF:8D 05 04 STA $0405 ; call to code in a different bank ($0F:$C1DC) 0x010E12|$04:$8E02:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; call to code in a different bank ($0F:$C1DC) 0x010E15|$04:$8E05:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF 0x010E18|$04:$8E08:60 RTS ; control flow target (from $8ADC, $8AFA) 0x010E19|$04:$8E09:AD 00 04 LDA $0400 ; menu-based palette overrides start 0x010E1C|$04:$8E0C:D0 02 BNE $8E10 0x010E1E|$04:$8E0E:38 SEC 0x010E1F|$04:$8E0F:60 RTS ; control flow target (from $8E0C) 0x010E20|$04:$8E10:A4 DA LDY $DA 0x010E22|$04:$8E12:B9 2A 04 LDA $042A,Y 0x010E25|$04:$8E15:30 02 BMI $8E19 0x010E27|$04:$8E17:38 SEC 0x010E28|$04:$8E18:60 RTS ; control flow target (from $8E15) 0x010E29|$04:$8E19:29 03 AND #$03 0x010E2B|$04:$8E1B:85 DB STA $DB 0x010E2D|$04:$8E1D:0A ASL 0x010E2E|$04:$8E1E:0A ASL 0x010E2F|$04:$8E1F:0A ASL 0x010E30|$04:$8E20:18 CLC 0x010E31|$04:$8E21:65 DB ADC $DB 0x010E33|$04:$8E23:85 DB STA $DB 0x010E35|$04:$8E25:AA TAX 0x010E36|$04:$8E26:B9 2B 04 LDA $042B,Y 0x010E39|$04:$8E29:85 E2 STA $E2 0x010E3B|$04:$8E2B:B9 2D 04 LDA $042D,Y 0x010E3E|$04:$8E2E:85 E3 STA $E3 0x010E40|$04:$8E30:BD 0C 04 LDA $040C,X 0x010E43|$04:$8E33:85 DF STA $DF 0x010E45|$04:$8E35:BD 0D 04 LDA $040D,X 0x010E48|$04:$8E38:85 E0 STA $E0 0x010E4A|$04:$8E3A:BD 0E 04 LDA $040E,X 0x010E4D|$04:$8E3D:85 E1 STA $E1 ; call to code in a different bank ($0F:$C1DC) 0x010E4F|$04:$8E3F:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; control flow target (from $8EA1, $8EAB) 0x010E52|$04:$8E42:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010E55|$04:$8E45:85 E4 STA $E4 0x010E57|$04:$8E47:29 40 AND #$40 0x010E59|$04:$8E49:D0 15 BNE $8E60 0x010E5B|$04:$8E4B:A5 E3 LDA $E3 0x010E5D|$04:$8E4D:0A ASL 0x010E5E|$04:$8E4E:0A ASL 0x010E5F|$04:$8E4F:AA TAX 0x010E60|$04:$8E50:A9 F8 LDA #$F8 0x010E62|$04:$8E52:9D 00 02 STA $0200,X ; sprite buffer start 0x010E65|$04:$8E55:E6 E3 INC $E3 0x010E67|$04:$8E57:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010E6A|$04:$8E5A:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010E6D|$04:$8E5D:4C 9D 8E JMP $8E9D ; control flow target (from $8E49) 0x010E70|$04:$8E60:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010E73|$04:$8E63:48 PHA 0x010E74|$04:$8E64:29 0F AND #$0F 0x010E76|$04:$8E66:18 CLC 0x010E77|$04:$8E67:65 E2 ADC $E2 0x010E79|$04:$8E69:85 0C STA $0C 0x010E7B|$04:$8E6B:68 PLA 0x010E7C|$04:$8E6C:4A LSR 0x010E7D|$04:$8E6D:4A LSR 0x010E7E|$04:$8E6E:4A LSR 0x010E7F|$04:$8E6F:4A LSR 0x010E80|$04:$8E70:29 07 AND #$07 0x010E82|$04:$8E72:18 CLC 0x010E83|$04:$8E73:69 0A ADC #$0A 0x010E85|$04:$8E75:85 0E STA $0E 0x010E87|$04:$8E77:A9 5F LDA #$5F 0x010E89|$04:$8E79:85 09 STA $09 0x010E8B|$04:$8E7B:A9 00 LDA #$00 0x010E8D|$04:$8E7D:46 0E LSR $0E 0x010E8F|$04:$8E7F:6A ROR 0x010E90|$04:$8E80:46 0E LSR $0E 0x010E92|$04:$8E82:6A ROR 0x010E93|$04:$8E83:46 0E LSR $0E 0x010E95|$04:$8E85:6A ROR 0x010E96|$04:$8E86:05 0C ORA $0C 0x010E98|$04:$8E88:85 07 STA $07 ; current PPU write address, low byte 0x010E9A|$04:$8E8A:A5 0E LDA $0E 0x010E9C|$04:$8E8C:18 CLC 0x010E9D|$04:$8E8D:69 20 ADC #$20 0x010E9F|$04:$8E8F:85 08 STA $08 ; current PPU write address, high byte ; call to code in a different bank ($0F:$C1FA) 0x010EA1|$04:$8E91:20 FA C1 JSR $C1FA ; wait for $02 to not be #$C0, write PPU address in $07-$08 and data in $09 to PPU write buffer at $0300,$02, $01 += 1, $02 += 3, and set $0183 to #$00 0x010EA4|$04:$8E94:A5 02 LDA $02 0x010EA6|$04:$8E96:C9 A5 CMP #$A5 0x010EA8|$04:$8E98:90 03 BCC $8E9D ; call to code in a different bank ($0F:$C1DC) 0x010EAA|$04:$8E9A:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; control flow target (from $8E5D, $8E98) 0x010EAD|$04:$8E9D:A5 E4 LDA $E4 0x010EAF|$04:$8E9F:30 03 BMI $8EA4 0x010EB1|$04:$8EA1:4C 42 8E JMP $8E42 ; control flow target (from $8E9F) 0x010EB4|$04:$8EA4:20 AD 8F JSR $8FAD 0x010EB7|$04:$8EA7:C6 E1 DEC $E1 0x010EB9|$04:$8EA9:F0 03 BEQ $8EAE 0x010EBB|$04:$8EAB:4C 42 8E JMP $8E42 ; control flow target (from $8EA9) ; call to code in a different bank ($0F:$C1DC) 0x010EBE|$04:$8EAE:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; call to code in a different bank ($0F:$C1DC) 0x010EC1|$04:$8EB1:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF 0x010EC4|$04:$8EB4:A4 DA LDY $DA 0x010EC6|$04:$8EB6:A6 DB LDX $DB 0x010EC8|$04:$8EB8:BD 09 04 LDA $0409,X 0x010ECB|$04:$8EBB:D0 02 BNE $8EBF 0x010ECD|$04:$8EBD:18 CLC 0x010ECE|$04:$8EBE:60 RTS ; control flow target (from $8EBB) 0x010ECF|$04:$8EBF:85 DD STA $DD 0x010ED1|$04:$8EC1:B9 2D 04 LDA $042D,Y 0x010ED4|$04:$8EC4:85 DC STA $DC 0x010ED6|$04:$8EC6:AD 05 04 LDA $0405 0x010ED9|$04:$8EC9:38 SEC 0x010EDA|$04:$8ECA:E5 DD SBC $DD 0x010EDC|$04:$8ECC:8D 05 04 STA $0405 0x010EDF|$04:$8ECF:38 SEC 0x010EE0|$04:$8ED0:E5 DC SBC $DC 0x010EE2|$04:$8ED2:F0 1D BEQ $8EF1 0x010EE4|$04:$8ED4:0A ASL 0x010EE5|$04:$8ED5:0A ASL 0x010EE6|$04:$8ED6:85 DE STA $DE 0x010EE8|$04:$8ED8:A5 DC LDA $DC 0x010EEA|$04:$8EDA:18 CLC 0x010EEB|$04:$8EDB:65 DD ADC $DD 0x010EED|$04:$8EDD:0A ASL 0x010EEE|$04:$8EDE:0A ASL 0x010EEF|$04:$8EDF:A8 TAY 0x010EF0|$04:$8EE0:A5 DC LDA $DC 0x010EF2|$04:$8EE2:0A ASL 0x010EF3|$04:$8EE3:0A ASL 0x010EF4|$04:$8EE4:AA TAX ; control flow target (from $8EEF) 0x010EF5|$04:$8EE5:B9 00 02 LDA $0200,Y ; sprite buffer start 0x010EF8|$04:$8EE8:9D 00 02 STA $0200,X ; sprite buffer start 0x010EFB|$04:$8EEB:E8 INX 0x010EFC|$04:$8EEC:C8 INY 0x010EFD|$04:$8EED:C6 DE DEC $DE 0x010EFF|$04:$8EEF:D0 F4 BNE $8EE5 ; control flow target (from $8ED2) 0x010F01|$04:$8EF1:A5 DD LDA $DD 0x010F03|$04:$8EF3:85 DE STA $DE 0x010F05|$04:$8EF5:AD 05 04 LDA $0405 0x010F08|$04:$8EF8:0A ASL 0x010F09|$04:$8EF9:0A ASL 0x010F0A|$04:$8EFA:AA TAX 0x010F0B|$04:$8EFB:A9 F8 LDA #$F8 ; control flow target (from $8F06) 0x010F0D|$04:$8EFD:9D 00 02 STA $0200,X ; sprite buffer start 0x010F10|$04:$8F00:E8 INX 0x010F11|$04:$8F01:E8 INX 0x010F12|$04:$8F02:E8 INX 0x010F13|$04:$8F03:E8 INX 0x010F14|$04:$8F04:C6 DE DEC $DE 0x010F16|$04:$8F06:D0 F5 BNE $8EFD 0x010F18|$04:$8F08:A2 00 LDX #$00 ; control flow target (from $8F22) 0x010F1A|$04:$8F0A:BD 2A 04 LDA $042A,X 0x010F1D|$04:$8F0D:10 0D BPL $8F1C 0x010F1F|$04:$8F0F:BD 2D 04 LDA $042D,X 0x010F22|$04:$8F12:C5 DC CMP $DC 0x010F24|$04:$8F14:90 06 BCC $8F1C 0x010F26|$04:$8F16:38 SEC 0x010F27|$04:$8F17:E5 DD SBC $DD 0x010F29|$04:$8F19:9D 2D 04 STA $042D,X ; control flow target (from $8F0D, $8F14) 0x010F2C|$04:$8F1C:E8 INX 0x010F2D|$04:$8F1D:E8 INX 0x010F2E|$04:$8F1E:E8 INX 0x010F2F|$04:$8F1F:E8 INX 0x010F30|$04:$8F20:E0 20 CPX #$20 0x010F32|$04:$8F22:D0 E6 BNE $8F0A 0x010F34|$04:$8F24:18 CLC 0x010F35|$04:$8F25:60 RTS ; control flow target (from $8712) 0x010F36|$04:$8F26:A9 00 LDA #$00 0x010F38|$04:$8F28:8D 05 04 STA $0405 0x010F3B|$04:$8F2B:A2 44 LDX #$44 ; control flow target (from $8F31) 0x010F3D|$04:$8F2D:9D 05 04 STA $0405,X 0x010F40|$04:$8F30:CA DEX 0x010F41|$04:$8F31:D0 FA BNE $8F2D 0x010F43|$04:$8F33:8D 03 04 STA $0403 0x010F46|$04:$8F36:A9 01 LDA #$01 0x010F48|$04:$8F38:8D 04 04 STA $0404 0x010F4B|$04:$8F3B:A9 00 LDA #$00 0x010F4D|$04:$8F3D:8D 01 04 STA $0401 0x010F50|$04:$8F40:A9 8D LDA #$8D 0x010F52|$04:$8F42:8D 02 04 STA $0402 0x010F55|$04:$8F45:A9 0F LDA #$0F 0x010F57|$04:$8F47:8D 00 05 STA $0500 0x010F5A|$04:$8F4A:8D 0D 05 STA $050D 0x010F5D|$04:$8F4D:A9 30 LDA #$30 0x010F5F|$04:$8F4F:A2 03 LDX #$03 ; control flow target (from $8F55) 0x010F61|$04:$8F51:9D 0D 05 STA $050D,X 0x010F64|$04:$8F54:CA DEX 0x010F65|$04:$8F55:D0 FA BNE $8F51 0x010F67|$04:$8F57:60 RTS ; control flow target (from $8AB0, $8AF1, $8B23) 0x010F68|$04:$8F58:88 DEY 0x010F69|$04:$8F59:C0 08 CPY #$08 0x010F6B|$04:$8F5B:B0 04 BCS $8F61 0x010F6D|$04:$8F5D:E0 04 CPX #$04 0x010F6F|$04:$8F5F:90 04 BCC $8F65 ; control flow target (from $8F5B) 0x010F71|$04:$8F61:A0 00 LDY #$00 0x010F73|$04:$8F63:38 SEC 0x010F74|$04:$8F64:60 RTS ; control flow target (from $8F5F) 0x010F75|$04:$8F65:98 TYA 0x010F76|$04:$8F66:0A ASL 0x010F77|$04:$8F67:0A ASL 0x010F78|$04:$8F68:29 1C AND #$1C 0x010F7A|$04:$8F6A:85 DA STA $DA 0x010F7C|$04:$8F6C:8A TXA 0x010F7D|$04:$8F6D:29 03 AND #$03 0x010F7F|$04:$8F6F:05 DA ORA $DA 0x010F81|$04:$8F71:85 DA STA $DA 0x010F83|$04:$8F73:A2 00 LDX #$00 0x010F85|$04:$8F75:A0 08 LDY #$08 ; control flow target (from $8F87) 0x010F87|$04:$8F77:BD 2A 04 LDA $042A,X 0x010F8A|$04:$8F7A:10 06 BPL $8F82 0x010F8C|$04:$8F7C:29 1F AND #$1F 0x010F8E|$04:$8F7E:C5 DA CMP $DA 0x010F90|$04:$8F80:F0 19 BEQ $8F9B ; control flow target (from $8F7A) 0x010F92|$04:$8F82:E8 INX 0x010F93|$04:$8F83:E8 INX 0x010F94|$04:$8F84:E8 INX 0x010F95|$04:$8F85:E8 INX 0x010F96|$04:$8F86:88 DEY 0x010F97|$04:$8F87:D0 EE BNE $8F77 0x010F99|$04:$8F89:A2 00 LDX #$00 0x010F9B|$04:$8F8B:A0 08 LDY #$08 ; control flow target (from $8F97) 0x010F9D|$04:$8F8D:BD 2A 04 LDA $042A,X 0x010FA0|$04:$8F90:10 07 BPL $8F99 0x010FA2|$04:$8F92:E8 INX 0x010FA3|$04:$8F93:E8 INX 0x010FA4|$04:$8F94:E8 INX 0x010FA5|$04:$8F95:E8 INX 0x010FA6|$04:$8F96:88 DEY 0x010FA7|$04:$8F97:D0 F4 BNE $8F8D ; control flow target (from $8F90) 0x010FA9|$04:$8F99:38 SEC 0x010FAA|$04:$8F9A:60 RTS ; control flow target (from $8F80) 0x010FAB|$04:$8F9B:18 CLC 0x010FAC|$04:$8F9C:60 RTS ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 ; control flow target (from $8998, $89B0, $89B5, $89BA, $89C9, $89FE, $8A1B, $8B76, $8B81, $8CAB, $8CBB, $8CF0, $8D3F, $8D48, $8D71, $8E42, $8E60, $8FC3, $8FC7) 0x010FAD|$04:$8F9D:A0 DF LDY #$DF ; call to code in a different bank ($0F:$C4E6) 0x010FAF|$04:$8F9F:4C E6 C4 JMP $C4E6 ; return 1 byte from bank 1's ($00,Y) in A, INC 16-bit $00,Y-$01,Y ; read ($DF), INC 16-bit $DF-$E0 ; control flow target (from $881D, $8823, $8829, $882F, $8833, $883B) 0x010FB2|$04:$8FA2:A0 00 LDY #$00 0x010FB4|$04:$8FA4:B1 DF LDA ($DF),Y ; INC 16-bit $DF-$E0 ; control flow target (from $89A0, $89A3, $8A10, $8A13, $8B7A, $8CAF, $8E57, $8E5A, $8FC0, $8FD0, $8FDB) 0x010FB6|$04:$8FA6:E6 DF INC $DF 0x010FB8|$04:$8FA8:D0 02 BNE $8FAC 0x010FBA|$04:$8FAA:E6 E0 INC $E0 ; control flow target (from $8FA8) 0x010FBC|$04:$8FAC:60 RTS ; control flow target (from $8A8E, $8B8E, $8CC9, $8DEB, $8EA4) 0x010FBD|$04:$8FAD:4A LSR 0x010FBE|$04:$8FAE:29 04 AND #$04 0x010FC0|$04:$8FB0:D0 0C BNE $8FBE 0x010FC2|$04:$8FB2:A9 10 LDA #$10 0x010FC4|$04:$8FB4:18 CLC 0x010FC5|$04:$8FB5:65 DF ADC $DF 0x010FC7|$04:$8FB7:85 DF STA $DF 0x010FC9|$04:$8FB9:90 02 BCC $8FBD 0x010FCB|$04:$8FBB:E6 E0 INC $E0 ; control flow target (from $8FB9) 0x010FCD|$04:$8FBD:60 RTS ; control flow target (from $8FB0) 0x010FCE|$04:$8FBE:90 03 BCC $8FC3 0x010FD0|$04:$8FC0:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 ; control flow target (from $8FBE) 0x010FD3|$04:$8FC3:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010FD6|$04:$8FC6:48 PHA 0x010FD7|$04:$8FC7:20 9D 8F JSR $8F9D ; return 1 byte from bank 1's ($DF) in A, INC 16-bit $DF-$E0 0x010FDA|$04:$8FCA:A8 TAY 0x010FDB|$04:$8FCB:68 PLA ; control flow target (from $8FD4) 0x010FDC|$04:$8FCC:0A ASL 0x010FDD|$04:$8FCD:90 05 BCC $8FD4 0x010FDF|$04:$8FCF:48 PHA 0x010FE0|$04:$8FD0:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010FE3|$04:$8FD3:68 PLA ; control flow target (from $8FCD) 0x010FE4|$04:$8FD4:D0 F6 BNE $8FCC 0x010FE6|$04:$8FD6:98 TYA ; control flow target (from $8FDF) 0x010FE7|$04:$8FD7:0A ASL 0x010FE8|$04:$8FD8:90 05 BCC $8FDF 0x010FEA|$04:$8FDA:48 PHA 0x010FEB|$04:$8FDB:20 A6 8F JSR $8FA6 ; INC 16-bit $DF-$E0 0x010FEE|$04:$8FDE:68 PLA ; control flow target (from $8FD8) 0x010FEF|$04:$8FDF:D0 F6 BNE $8FD7 0x010FF1|$04:$8FE1:60 RTS ; control flow target (from $9CA9) 0x010FF2|$04:$8FE2:A9 8A LDA #$8A ; Music ID #$8A: hit 3 SFX ; call to code in a different bank ($0F:$C561) 0x010FF4|$04:$8FE4:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) ; control flow target (from $8015) ; call to code in a different bank ($0F:$C1DC) 0x010FF7|$04:$8FE7:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF 0x010FFA|$04:$8FEA:A9 02 LDA #$02 0x010FFC|$04:$8FEC:85 DB STA $DB 0x010FFE|$04:$8FEE:A2 00 LDX #$00 ; control flow target (from $9029) 0x011000|$04:$8FF0:86 DA STX $DA 0x011002|$04:$8FF2:8A TXA 0x011003|$04:$8FF3:A2 01 LDX #$01 0x011005|$04:$8FF5:29 02 AND #$02 0x011007|$04:$8FF7:F0 04 BEQ $8FFD 0x011009|$04:$8FF9:A9 03 LDA #$03 0x01100B|$04:$8FFB:A2 00 LDX #$00 ; control flow target (from $8FF7) 0x01100D|$04:$8FFD:A8 TAY 0x01100E|$04:$8FFE:B5 05 LDA $05,X 0x011010|$04:$9000:18 CLC 0x011011|$04:$9001:65 DB ADC $DB 0x011013|$04:$9003:95 05 STA $05,X 0x011015|$04:$9005:A2 40 LDX #$40 ; control flow target (from $9015) 0x011017|$04:$9007:B9 00 02 LDA $0200,Y ; sprite buffer start 0x01101A|$04:$900A:38 SEC 0x01101B|$04:$900B:E5 DB SBC $DB 0x01101D|$04:$900D:99 00 02 STA $0200,Y ; sprite buffer start 0x011020|$04:$9010:C8 INY 0x011021|$04:$9011:C8 INY 0x011022|$04:$9012:C8 INY 0x011023|$04:$9013:C8 INY 0x011024|$04:$9014:CA DEX 0x011025|$04:$9015:D0 F0 BNE $9007 0x011027|$04:$9017:A2 02 LDX #$02 ; call to code in a different bank ($0F:$C1EE) 0x011029|$04:$9019:20 EE C1 JSR $C1EE ; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF 0x01102C|$04:$901C:A5 DB LDA $DB 0x01102E|$04:$901E:49 FF EOR #$FF 0x011030|$04:$9020:85 DB STA $DB 0x011032|$04:$9022:E6 DB INC $DB 0x011034|$04:$9024:A6 DA LDX $DA 0x011036|$04:$9026:E8 INX 0x011037|$04:$9027:E0 0C CPX #$0C ; Amount of shaking when Characters take a hit 0x011039|$04:$9029:D0 C5 BNE $8FF0 0x01103B|$04:$902B:60 RTS ; control flow target (from $8701) ; call to code in a different bank ($0F:$C1DC) 0x01103C|$04:$902C:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF 0x01103F|$04:$902F:A9 3C LDA #$3C 0x011041|$04:$9031:85 DB STA $DB 0x011043|$04:$9033:A9 10 LDA #$10 0x011045|$04:$9035:85 DC STA $DC 0x011047|$04:$9037:A9 0F LDA #$0F 0x011049|$04:$9039:85 DD STA $DD ; control flow target (from $90B5) 0x01104B|$04:$903B:C6 DB DEC $DB 0x01104D|$04:$903D:A2 FF LDX #$FF 0x01104F|$04:$903F:A5 DB LDA $DB 0x011051|$04:$9041:4A LSR 0x011052|$04:$9042:6A ROR 0x011053|$04:$9043:B0 09 BCS $904E 0x011055|$04:$9045:A2 01 LDX #$01 0x011057|$04:$9047:49 1F EOR #$1F 0x011059|$04:$9049:30 03 BMI $904E 0x01105B|$04:$904B:38 SEC 0x01105C|$04:$904C:E9 01 SBC #$01 ; control flow target (from $9043, $9049) 0x01105E|$04:$904E:29 1F AND #$1F 0x011060|$04:$9050:85 DE STA $DE 0x011062|$04:$9052:86 DF STX $DF ; control flow target (from $90B1) 0x011064|$04:$9054:A5 06 LDA $06 0x011066|$04:$9056:4A LSR 0x011067|$04:$9057:4A LSR 0x011068|$04:$9058:4A LSR 0x011069|$04:$9059:18 CLC 0x01106A|$04:$905A:65 DD ADC $DD ; control flow target (from $9060) 0x01106C|$04:$905C:A8 TAY 0x01106D|$04:$905D:38 SEC 0x01106E|$04:$905E:E9 1E SBC #$1E 0x011070|$04:$9060:B0 FA BCS $905C 0x011072|$04:$9062:A5 04 LDA $04 0x011074|$04:$9064:F0 04 BEQ $906A 0x011076|$04:$9066:98 TYA 0x011077|$04:$9067:09 20 ORA #$20 0x011079|$04:$9069:A8 TAY ; control flow target (from $9064) 0x01107A|$04:$906A:A5 05 LDA $05 0x01107C|$04:$906C:4A LSR 0x01107D|$04:$906D:4A LSR 0x01107E|$04:$906E:4A LSR 0x01107F|$04:$906F:38 SEC 0x011080|$04:$9070:65 DC ADC $DC 0x011082|$04:$9072:C9 20 CMP #$20 0x011084|$04:$9074:90 06 BCC $907C 0x011086|$04:$9076:AA TAX 0x011087|$04:$9077:98 TYA 0x011088|$04:$9078:49 20 EOR #$20 0x01108A|$04:$907A:A8 TAY 0x01108B|$04:$907B:8A TXA ; control flow target (from $9074) 0x01108C|$04:$907C:29 1F AND #$1F 0x01108E|$04:$907E:85 07 STA $07 ; current PPU write address, low byte 0x011090|$04:$9080:84 08 STY $08 ; current PPU write address, high byte 0x011092|$04:$9082:A9 00 LDA #$00 0x011094|$04:$9084:A2 03 LDX #$03 0x011096|$04:$9086:38 SEC ; control flow target (from $908B) 0x011097|$04:$9087:66 08 ROR $08 ; current PPU write address, high byte 0x011099|$04:$9089:6A ROR 0x01109A|$04:$908A:CA DEX 0x01109B|$04:$908B:D0 FA BNE $9087 0x01109D|$04:$908D:05 07 ORA $07 ; current PPU write address, low byte 0x01109F|$04:$908F:85 07 STA $07 ; current PPU write address, low byte 0x0110A1|$04:$9091:A9 5F LDA #$5F 0x0110A3|$04:$9093:85 09 STA $09 0x0110A5|$04:$9095:A5 02 LDA $02 0x0110A7|$04:$9097:C9 A5 CMP #$A5 0x0110A9|$04:$9099:90 03 BCC $909E ; call to code in a different bank ($0F:$C1DC) 0x0110AB|$04:$909B:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; control flow target (from $9099) ; call to code in a different bank ($0F:$C1FA) 0x0110AE|$04:$909E:20 FA C1 JSR $C1FA ; wait for $02 to not be #$C0, write PPU address in $07-$08 and data in $09 to PPU write buffer at $0300,$02, $01 += 1, $02 += 3, and set $0183 to #$00 0x0110B1|$04:$90A1:A5 DB LDA $DB 0x0110B3|$04:$90A3:49 01 EOR #$01 0x0110B5|$04:$90A5:29 01 AND #$01 0x0110B7|$04:$90A7:AA TAX 0x0110B8|$04:$90A8:B5 DC LDA $DC,X 0x0110BA|$04:$90AA:18 CLC 0x0110BB|$04:$90AB:65 DF ADC $DF 0x0110BD|$04:$90AD:95 DC STA $DC,X 0x0110BF|$04:$90AF:C5 DE CMP $DE 0x0110C1|$04:$90B1:D0 A1 BNE $9054 0x0110C3|$04:$90B3:A5 DB LDA $DB 0x0110C5|$04:$90B5:D0 84 BNE $903B ; call to code in a different bank ($0F:$C1DC) 0x0110C7|$04:$90B7:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF 0x0110CA|$04:$90BA:60 RTS ; control flow target (from $8AED) 0x0110CB|$04:$90BB:A2 08 LDX #$08 ; control flow target (from $90DD) 0x0110CD|$04:$90BD:8A TXA 0x0110CE|$04:$90BE:48 PHA 0x0110CF|$04:$90BF:20 E0 90 JSR $90E0 0x0110D2|$04:$90C2:A2 00 LDX #$00 0x0110D4|$04:$90C4:A9 30 LDA #$30 ; control flow target (from $90CF) 0x0110D6|$04:$90C6:9D 0E 05 STA $050E,X 0x0110D9|$04:$90C9:9D 01 05 STA $0501,X 0x0110DC|$04:$90CC:E8 INX 0x0110DD|$04:$90CD:E0 0D CPX #$0D 0x0110DF|$04:$90CF:D0 F5 BNE $90C6 ; call to code in a different bank ($0F:$C22C) 0x0110E1|$04:$90D1:20 2C C2 JSR $C22C 0x0110E4|$04:$90D4:20 EE 90 JSR $90EE ; call to code in a different bank ($0F:$C22C) 0x0110E7|$04:$90D7:20 2C C2 JSR $C22C 0x0110EA|$04:$90DA:68 PLA 0x0110EB|$04:$90DB:AA TAX 0x0110EC|$04:$90DC:CA DEX 0x0110ED|$04:$90DD:D0 DE BNE $90BD 0x0110EF|$04:$90DF:60 RTS ; control flow target (from $90BF) 0x0110F0|$04:$90E0:A2 00 LDX #$00 ; control flow target (from $90EB) 0x0110F2|$04:$90E2:BD 00 05 LDA $0500,X 0x0110F5|$04:$90E5:9D 4A 04 STA $044A,X 0x0110F8|$04:$90E8:E8 INX 0x0110F9|$04:$90E9:E0 1A CPX #$1A 0x0110FB|$04:$90EB:D0 F5 BNE $90E2 0x0110FD|$04:$90ED:60 RTS ; control flow target (from $90D4) 0x0110FE|$04:$90EE:A2 00 LDX #$00 ; control flow target (from $90F9) 0x011100|$04:$90F0:BD 4A 04 LDA $044A,X 0x011103|$04:$90F3:9D 00 05 STA $0500,X 0x011106|$04:$90F6:E8 INX 0x011107|$04:$90F7:E0 1A CPX #$1A 0x011109|$04:$90F9:D0 F5 BNE $90F0 0x01110B|$04:$90FB:60 RTS ; code -> data ; count? + pointer to enemy graphics? + pointer to enemy palette ; indirect data load target (via $88BE) 0x01110C|$04:$90FC:01 0x01110D|$04:$90FD:00 0x01110E|$04:$90FE:80 0x01110F|$04:$90FF:00 0x011110|$04:$9100:80 0x011111|$04:$9101:04 ; count 0x011112|$04:$9102:02 80 ; $01:$8002; Monster ID #$01: Slime + Monster ID #$30: Metal Slime 0x011114|$04:$9104:9B 92 ; $04:$929B; monster palettes 0x011116|$04:$9106:0B ; count 0x011117|$04:$9107:3D 80 ; $01:$803D; Monster ID #$02: Big Slug + Monster ID #$18: Sea Slug 0x011119|$04:$9109:9F 92 ; $04:$929F 0x01111B|$04:$910B:0D ; count 0x01111C|$04:$910C:CE 80 ; $01:$80CE; Monster ID #$03: Iron Ant + Monster ID #$09: Army Ant + Monster ID #$0D: Magic Ant 0x01111E|$04:$910E:A6 92 ; $04:$92A6 0x011120|$04:$9110:06 ; count 0x011121|$04:$9111:75 81 ; $01:$8175; Monster ID #$04: Drakee + Monster ID #$0E: Magidrakee 0x011123|$04:$9113:AD 92 ; $04:$92AD 0x011125|$04:$9115:10 ; count 0x011126|$04:$9116:CA 81 ; $01:$81CA; Monster ID #$05: Wild Mouse + Monster ID #$0B: Big Rat + Monster ID #$14: Ghost Rat 0x011128|$04:$9118:B1 92 ; $04:$92B1 0x01112A|$04:$911A:06 ; count 0x01112B|$04:$911B:8E 82 ; $01:$828E; Monster ID #$06: Healer + Monster ID #$10: Man O’ War 0x01112D|$04:$911D:B5 92 ; $04:$92B5 0x01112F|$04:$911F:0F ; count 0x011130|$04:$9120:DB 82 ; $01:$82DB; Monster ID #$07: Ghost Mouse + Monster ID #$1D: Demighost 0x011132|$04:$9122:B9 92 ; $04:$92B9 0x011134|$04:$9124:06 ; count 0x011135|$04:$9125:04 84 ; $01:$8404; Monster ID #$08: Babble + Monster ID #$42: Metal Babble 0x011137|$04:$9127:C0 92 ; $04:$92C0 0x011139|$04:$9129:0D ; count 0x01113A|$04:$912A:CE 80 ; $01:$80CE; Monster ID #$03: Iron Ant + Monster ID #$09: Army Ant + Monster ID #$0D: Magic Ant 0x01113C|$04:$912C:C4 92 ; $04:$92C4 0x01113E|$04:$912E:19 ; count 0x01113F|$04:$912F:4F 84 ; $01:$844F; Monster ID #$0A: Magician + Monster ID #$1A: Enchanter + Monster ID #$2F: Sorcerer 0x011141|$04:$9131:CB 92 ; $04:$92CB 0x011143|$04:$9133:10 ; count 0x011144|$04:$9134:CA 81 ; $01:$81CA; Monster ID #$05: Wild Mouse + Monster ID #$0B: Big Rat + Monster ID #$14: Ghost Rat 0x011146|$04:$9136:D2 92 ; $04:$92D2 0x011148|$04:$9138:10 ; count 0x011149|$04:$9139:E0 85 ; $01:$85E0; Monster ID #$0C: Big Cobra + Monster ID #$26: Basilisk 0x01114B|$04:$913B:D6 92 ; $04:$92D6 0x01114D|$04:$913D:0D ; count 0x01114E|$04:$913E:CE 80 ; $01:$80CE; Monster ID #$03: Iron Ant + Monster ID #$09: Army Ant + Monster ID #$0D: Magic Ant 0x011150|$04:$9140:DD 92 ; $04:$92DD 0x011152|$04:$9142:06 ; count 0x011153|$04:$9143:75 81 ; $01:$8175; Monster ID #$04: Drakee + Monster ID #$0E: Magidrakee 0x011155|$04:$9145:E4 92 ; $04:$92E4 0x011157|$04:$9147:10 ; count 0x011158|$04:$9148:CF 86 ; $01:$86CF; Monster ID #$0F: Centipod + Monster ID #$17: Megapede 0x01115A|$04:$914A:E8 92 ; $04:$92E8 0x01115C|$04:$914C:06 ; count 0x01115D|$04:$914D:8E 82 ; $01:$828E; Monster ID #$06: Healer + Monster ID #$10: Man O’ War 0x01115F|$04:$914F:EF 92 ; $04:$92EF 0x011161|$04:$9151:09 ; count 0x011162|$04:$9152:A5 87 ; $01:$87A5; Monster ID #$11: Lizard Fly + Monster ID #$23: Dragon Fly 0x011164|$04:$9154:F3 92 ; $04:$92F3 0x011166|$04:$9156:1D ; count 0x011167|$04:$9157:3B 88 ; $01:$883B; Monster ID #$12: Zombie + Monster ID #$2D: Hork + Monster ID #$37: Ghoul 0x011169|$04:$9159:FA 92 ; $04:$92FA 0x01116B|$04:$915B:10 ; count 0x01116C|$04:$915C:B1 89 ; $01:$89B1; Monster ID #$13: Smoke + Monster ID #$2C: Gas 0x01116E|$04:$915E:01 93 ; $04:$9301 0x011170|$04:$9160:10 ; count 0x011171|$04:$9161:CA 81 ; $01:$81CA; Monster ID #$05: Wild Mouse + Monster ID #$0B: Big Rat + Monster ID #$14: Ghost Rat 0x011173|$04:$9163:05 93 ; $04:$9305 0x011175|$04:$9165:10 ; count 0x011176|$04:$9166:BB 8A ; $01:$8ABB; Monster ID #$15: Baboon + Monster ID #$1C: Magic Baboon + Monster ID #$33: Hibabango 0x011178|$04:$9168:09 93 ; $04:$9309 0x01117A|$04:$916A:17 ; count 0x01117B|$04:$916B:9F 8B ; $01:$8B9F; Monster ID #$16: Carnivog + Monster ID #$1F: Poison Lily 0x01117D|$04:$916D:10 93 ; $04:$9310 0x01117F|$04:$916F:10 ; count 0x011180|$04:$9170:CF 86 ; $01:$86CF; Monster ID #$0F: Centipod + Monster ID #$17: Megapede 0x011182|$04:$9172:17 93 ; $04:$9317 0x011184|$04:$9174:0B ; count 0x011185|$04:$9175:3D 80 ; $01:$803D; Monster ID #$02: Big Slug + Monster ID #$18: Sea Slug 0x011187|$04:$9177:1E 93 ; $04:$931E 0x011189|$04:$9179:1B ; count 0x01118A|$04:$917A:D0 8C ; $01:$8CD0; Monster ID #$19: Medusa Ball + Monster ID #$21: Gorgon 0x01118C|$04:$917C:25 93 ; $04:$9325 0x01118E|$04:$917E:1D ; count 0x01118F|$04:$917F:4F 84 ; $01:$844F; Monster ID #$0A: Magician + Monster ID #$1A: Enchanter + Monster ID #$2F: Sorcerer 0x011191|$04:$9181:2C 93 ; $04:$932C 0x011193|$04:$9183:12 ; count 0x011194|$04:$9184:84 8E ; $01:$8E84; Monster ID #$1B: Mud Man + Monster ID #$29: Puppet Man 0x011196|$04:$9186:33 93 ; $04:$9333 0x011198|$04:$9188:10 ; count 0x011199|$04:$9189:BB 8A ; $01:$8ABB; Monster ID #$15: Baboon + Monster ID #$1C: Magic Baboon + Monster ID #$33: Hibabango 0x01119B|$04:$918B:37 93 ; $04:$9337 0x01119D|$04:$918D:14 ; count 0x01119E|$04:$918E:DB 82 ; $01:$82DB; Monster ID #$07: Ghost Mouse + Monster ID #$1D: Demighost 0x0111A0|$04:$9190:3E 93 ; $04:$933E 0x0111A2|$04:$9192:0D ; count 0x0111A3|$04:$9193:AF 8F ; $01:$8FAF; Monster ID #$1E: Gremlin + Monster ID #$3C: Ozwarg 0x0111A5|$04:$9195:45 93 ; $04:$9345 0x0111A7|$04:$9197:17 ; count 0x0111A8|$04:$9198:9F 8B ; $01:$8B9F; Monster ID #$16: Carnivog + Monster ID #$1F: Poison Lily 0x0111AA|$04:$919A:4C 93 ; $04:$934C 0x0111AC|$04:$919C:1A ; count 0x0111AD|$04:$919D:66 90 ; $01:$9066; Monster ID #$20: Mummy Man + Monster ID #$2A: Mummy 0x0111AF|$04:$919F:53 93 ; $04:$9353 0x0111B1|$04:$91A1:1B ; count 0x0111B2|$04:$91A2:D0 8C ; $01:$8CD0; Monster ID #$19: Medusa Ball + Monster ID #$21: Gorgon 0x0111B4|$04:$91A4:5A 93 ; $04:$935A 0x0111B6|$04:$91A6:19 ; count 0x0111B7|$04:$91A7:E0 91 ; $01:$91E0; Monster ID #$22: Saber Tiger + Monster ID #$3A: Saber Lion 0x0111B9|$04:$91A9:61 93 ; $04:$9361 0x0111BB|$04:$91AB:09 ; count 0x0111BC|$04:$91AC:A5 87 ; $01:$87A5; Monster ID #$11: Lizard Fly + Monster ID #$23: Dragon Fly 0x0111BE|$04:$91AE:68 93 ; $04:$9368 0x0111C0|$04:$91B0:20 ; count 0x0111C1|$04:$91B1:41 93 ; $01:$9341; Monster ID #$24: Titan Tree + Monster ID #$2B: Evil Tree 0x0111C3|$04:$91B3:6F 93 ; $04:$936F 0x0111C5|$04:$91B5:18 ; count 0x0111C6|$04:$91B6:DA 94 ; $01:$94DA; Monster ID #$25: Undead + Monster ID #$39: Mega Knight + Monster ID #$43: Hargon’s Knight 0x0111C8|$04:$91B8:76 93 ; $04:$9376 0x0111CA|$04:$91BA:10 ; count 0x0111CB|$04:$91BB:E0 85 ; $01:$85E0; Monster ID #$0C: Big Cobra + Monster ID #$26: Basilisk 0x0111CD|$04:$91BD:7A 93 ; $04:$937A 0x0111CF|$04:$91BF:0C ; count 0x0111D0|$04:$91C0:27 96 ; $01:$9627; Monster ID #$27: Goopi + Monster ID #$34: Graboopi 0x0111D2|$04:$91C2:81 93 ; $04:$9381 0x0111D4|$04:$91C4:20 ; count 0x0111D5|$04:$91C5:CA 96 ; $01:$96CA; Monster ID #$28: Orc + Monster ID #$35: Gold Orc + Monster ID #$3F: Orc King 0x0111D7|$04:$91C7:85 93 ; $04:$9385 0x0111D9|$04:$91C9:12 ; count 0x0111DA|$04:$91CA:84 8E ; $01:$8E84; Monster ID #$1B: Mud Man + Monster ID #$29: Puppet Man 0x0111DC|$04:$91CC:8C 93 ; $04:$938C 0x0111DE|$04:$91CE:1A ; count 0x0111DF|$04:$91CF:66 90 ; $01:$9066; Monster ID #$20: Mummy Man + Monster ID #$2A: Mummy 0x0111E1|$04:$91D1:90 93 ; $04:$9390 0x0111E3|$04:$91D3:20 ; count 0x0111E4|$04:$91D4:41 93 ; $01:$9341; Monster ID #$24: Titan Tree + Monster ID #$2B: Evil Tree 0x0111E6|$04:$91D6:97 93 ; $04:$9397 0x0111E8|$04:$91D8:10 ; count 0x0111E9|$04:$91D9:B1 89 ; $01:$89B1; Monster ID #$13: Smoke + Monster ID #$2C: Gas 0x0111EB|$04:$91DB:9E 93 ; $04:$939E 0x0111ED|$04:$91DD:1D ; count 0x0111EE|$04:$91DE:3B 88 ; $01:$883B; Monster ID #$12: Zombie + Monster ID #$2D: Hork + Monster ID #$37: Ghoul 0x0111F0|$04:$91E0:A2 93 ; $04:$93A2 0x0111F2|$04:$91E2:14 ; count 0x0111F3|$04:$91E3:B2 98 ; $01:$98B2; Monster ID #$2E: Hawk Man + Monster ID #$3E: Gargoyle 0x0111F5|$04:$91E5:A9 93 ; $04:$93A9 0x0111F7|$04:$91E7:1D ; count 0x0111F8|$04:$91E8:4F 84 ; $01:$844F; Monster ID #$0A: Magician + Monster ID #$1A: Enchanter + Monster ID #$2F: Sorcerer 0x0111FA|$04:$91EA:B0 93 ; $04:$93B0 0x0111FC|$04:$91EC:04 ; count 0x0111FD|$04:$91ED:02 80 ; $01:$8002; Monster ID #$01: Slime + Monster ID #$30: Metal Slime 0x0111FF|$04:$91EF:B7 93 ; $04:$93B7 0x011201|$04:$91F1:20 ; count 0x011202|$04:$91F2:09 9A ; $01:$9A09; Monster ID #$31: Hunter + Monster ID #$41: Berserker 0x011204|$04:$91F4:BB 93 ; $04:$93BB 0x011206|$04:$91F6:13 ; count 0x011207|$04:$91F7:36 9C ; $01:$9C36; Monster ID #$32: Evil Eye + Monster ID #$3D: Dark Eye 0x011209|$04:$91F9:C2 93 ; $04:$93C2 0x01120B|$04:$91FB:10 ; count 0x01120C|$04:$91FC:BB 8A ; $01:$8ABB; Monster ID #$15: Baboon + Monster ID #$1C: Magic Baboon + Monster ID #$33: Hibabango 0x01120E|$04:$91FE:C6 93 ; $04:$93C6 0x011210|$04:$9200:0C ; count 0x011211|$04:$9201:27 96 ; $01:$9627; Monster ID #$27: Goopi + Monster ID #$34: Graboopi 0x011213|$04:$9203:CD 93 ; $04:$93CD 0x011215|$04:$9205:22 ; count 0x011216|$04:$9206:CA 96 ; $01:$96CA; Monster ID #$28: Orc + Monster ID #$35: Gold Orc + Monster ID #$3F: Orc King 0x011218|$04:$9208:D1 93 ; $04:$93D1 0x01121A|$04:$920A:13 ; count 0x01121B|$04:$920B:50 9D ; $01:$9D50; Monster ID #$36: Evil Clown + Monster ID #$47: Mace Master 0x01121D|$04:$920D:D8 93 ; $04:$93D8 0x01121F|$04:$920F:1D ; count 0x011220|$04:$9210:3B 88 ; $01:$883B; Monster ID #$12: Zombie + Monster ID #$2D: Hork + Monster ID #$37: Ghoul 0x011222|$04:$9212:DF 93 ; $04:$93DF 0x011224|$04:$9214:22 ; count 0x011225|$04:$9215:9A 9E ; $01:$9E9A; Monster ID #$38: Vampirus + Monster ID #$40: Magic Vampirus 0x011227|$04:$9217:E6 93 ; $04:$93E6 0x011229|$04:$9219:18 ; count 0x01122A|$04:$921A:DA 94 ; $01:$94DA; Monster ID #$25: Undead + Monster ID #$39: Mega Knight + Monster ID #$43: Hargon’s Knight 0x01122C|$04:$921C:ED 93 ; $04:$93ED 0x01122E|$04:$921E:19 ; count 0x01122F|$04:$921F:E0 91 ; $01:$91E0; Monster ID #$22: Saber Tiger + Monster ID #$3A: Saber Lion 0x011231|$04:$9221:F1 93 ; $04:$93F1 0x011233|$04:$9223:1C ; count 0x011234|$04:$9224:76 A0 ; $01:$A076; Monster ID #$3B: Metal Hunter + Monster ID #$45: Attackbot 0x011236|$04:$9226:F8 93 ; $04:$93F8 0x011238|$04:$9228:0D ; count 0x011239|$04:$9229:AF 8F ; $01:$8FAF; Monster ID #$1E: Gremlin + Monster ID #$3C: Ozwarg 0x01123B|$04:$922B:FF 93 ; $04:$93FF 0x01123D|$04:$922D:13 ; count 0x01123E|$04:$922E:36 9C ; $01:$9C36; Monster ID #$32: Evil Eye + Monster ID #$3D: Dark Eye 0x011240|$04:$9230:06 94 ; $04:$9406 0x011242|$04:$9232:17 ; count 0x011243|$04:$9233:B2 98 ; $01:$98B2; Monster ID #$2E: Hawk Man + Monster ID #$3E: Gargoyle 0x011245|$04:$9235:0A 94 ; $04:$940A 0x011247|$04:$9237:22 ; count 0x011248|$04:$9238:CA 96 ; $01:$96CA; Monster ID #$28: Orc + Monster ID #$35: Gold Orc + Monster ID #$3F: Orc King 0x01124A|$04:$923A:11 94 ; $04:$9411 0x01124C|$04:$923C:22 ; count 0x01124D|$04:$923D:9A 9E ; $01:$9E9A; Monster ID #$38: Vampirus + Monster ID #$40: Magic Vampirus 0x01124F|$04:$923F:18 94 ; $04:$9418 0x011251|$04:$9241:27 ; count 0x011252|$04:$9242:09 9A ; $01:$9A09; Monster ID #$31: Hunter + Monster ID #$41: Berserker 0x011254|$04:$9244:1F 94 ; $04:$941F 0x011256|$04:$9246:06 ; count 0x011257|$04:$9247:04 84 ; $01:$8404; Monster ID #$08: Babble + Monster ID #$42: Metal Babble 0x011259|$04:$9249:26 94 ; $04:$9426 0x01125B|$04:$924B:18 ; count 0x01125C|$04:$924C:DA 94 ; $01:$94DA; Monster ID #$25: Undead + Monster ID #$39: Mega Knight + Monster ID #$43: Hargon’s Knight 0x01125E|$04:$924E:2A 94 ; $04:$942A 0x011260|$04:$9250:37 ; count 0x011261|$04:$9251:73 A2 ; $01:$A273; Monster ID #$44: Cyclops + Monster ID #$4B: Giant + Monster ID #$4E: Atlas 0x011263|$04:$9253:2E 94 ; $04:$942E 0x011265|$04:$9255:26 ; count 0x011266|$04:$9256:76 A0 ; $01:$A076; Monster ID #$3B: Metal Hunter + Monster ID #$45: Attackbot 0x011268|$04:$9258:38 94 ; $04:$9438 0x01126A|$04:$925A:17 ; count 0x01126B|$04:$925B:19 A6 ; $01:$A619; Monster ID #$46: Green Dragon 0x01126D|$04:$925D:3F 94 ; $04:$943F 0x01126F|$04:$925F:13 ; count 0x011270|$04:$9260:50 9D ; $01:$9D50; Monster ID #$36: Evil Clown + Monster ID #$47: Mace Master 0x011272|$04:$9262:46 94 ; $04:$9446 0x011274|$04:$9264:1E ; count 0x011275|$04:$9265:6A A7 ; $01:$A76A; Monster ID #$48: Flame + Monster ID #$4A: Blizzard 0x011277|$04:$9267:4D 94 ; $04:$944D 0x011279|$04:$9269:1D ; count 0x01127A|$04:$926A:FC A8 ; $01:$A8FC; Monster ID #$49: Silver Batboon + Monster ID #$4C: Gold Batboon + Monster ID #$4F: Bazuzu 0x01127C|$04:$926C:51 94 ; $04:$9451 0x01127E|$04:$926E:1E ; count 0x01127F|$04:$926F:6A A7 ; $01:$A76A; Monster ID #$48: Flame + Monster ID #$4A: Blizzard 0x011281|$04:$9271:58 94 ; $04:$9458 0x011283|$04:$9273:40 ; count 0x011284|$04:$9274:73 A2 ; $01:$A273; Monster ID #$44: Cyclops + Monster ID #$4B: Giant + Monster ID #$4E: Atlas 0x011286|$04:$9276:5C 94 ; $04:$945C 0x011288|$04:$9278:1D ; count 0x011289|$04:$9279:FC A8 ; $01:$A8FC; Monster ID #$49: Silver Batboon + Monster ID #$4C: Gold Batboon + Monster ID #$4F: Bazuzu 0x01128B|$04:$927B:66 94 ; $04:$9466 0x01128D|$04:$927D:47 ; count 0x01128E|$04:$927E:AF AA ; $01:$AAAF; Monster ID #$4D: Bullwong + Monster ID #$50: Zarlox 0x011290|$04:$9280:6D 94 ; $04:$946D 0x011292|$04:$9282:40 ; count 0x011293|$04:$9283:73 A2 ; $01:$A273; Monster ID #$44: Cyclops + Monster ID #$4B: Giant + Monster ID #$4E: Atlas 0x011295|$04:$9285:7A 94 ; $04:$947A 0x011297|$04:$9287:1D ; count 0x011298|$04:$9288:FC A8 ; $01:$A8FC; Monster ID #$49: Silver Batboon + Monster ID #$4C: Gold Batboon + Monster ID #$4F: Bazuzu 0x01129A|$04:$928A:84 94 ; $04:$9484 0x01129C|$04:$928C:4C ; count 0x01129D|$04:$928D:AF AA ; $01:$AAAF; Monster ID #$4D: Bullwong + Monster ID #$50: Zarlox 0x01129F|$04:$928F:8B 94 ; $04:$948B 0x0112A1|$04:$9291:35 ; count 0x0112A2|$04:$9292:98 AE ; $01:$AE98; Monster ID #$51: Hargon 0x0112A4|$04:$9294:98 94 ; $04:$9498 0x0112A6|$04:$9296:4D ; count 0x0112A7|$04:$9297:78 B1 ; $01:$B178; Monster ID #$52: Malroth 0x0112A9|$04:$9299:9F ; indirect data load target 0x0112AA|$04:$929A: 94 ; $04:$949F ; monster palettes ; format is 1 byte X/Y dimensions, 3*(sum of dimension nybbles) palette data ; indirect data load target (via $9104) 0x0112AB|$04:$929B:10 30 15 1C ; Monster ID #$01: Slime ; indirect data load target (via $9109) 0x0112AF|$04:$929F:11 19 0F 0F 30 37 16 ; Monster ID #$02: Big Slug ; indirect data load target (via $910E) 0x0112B6|$04:$92A6:11 30 15 0F 21 27 17 ; Monster ID #$03: Iron Ant ; indirect data load target (via $9113) 0x0112BD|$04:$92AD:10 30 15 01 ; Monster ID #$04: Drakee ; indirect data load target (via $9118) 0x0112C1|$04:$92B1:10 00 24 1C ; Monster ID #$05: Wild Mouse ; indirect data load target (via $911D) 0x0112C5|$04:$92B5:10 11 27 30 ; Monster ID #$06: Healer ; indirect data load target (via $9122) 0x0112C9|$04:$92B9:11 30 11 19 11 21 17 ; Monster ID #$07: Ghost Mouse ; indirect data load target (via $9127) 0x0112D0|$04:$92C0:10 19 29 30 ; Monster ID #$08: Babble ; indirect data load target (via $912C) 0x0112D4|$04:$92C4:11 30 17 0F 2A 2C 1C ; Monster ID #$09: Army Ant ; indirect data load target (via $9131) 0x0112DB|$04:$92CB:11 36 0F 0F 30 1B 06 ; Monster ID #$0A: Magician ; indirect data load target (via $9136) 0x0112E2|$04:$92D2:10 1C 10 26 ; Monster ID #$0B: Big Rat ; indirect data load target (via $913B) 0x0112E6|$04:$92D6:11 30 10 0F 00 15 27 ; Monster ID #$0C: Big Cobra ; indirect data load target (via $9140) 0x0112ED|$04:$92DD:11 30 11 0F 25 26 16 ; Monster ID #$0D: Magic Ant ; indirect data load target (via $9145) 0x0112F4|$04:$92E4:10 35 02 19 ; Monster ID #$0E: Magidrakee ; indirect data load target (via $914A) 0x0112F8|$04:$92E8:11 30 0F 0F 16 21 37 ; Monster ID #$0F: Centipod ; indirect data load target (via $914F) 0x0112FF|$04:$92EF:10 30 2C 10 ; Monster ID #$10: Man O’ War ; indirect data load target (via $9154) 0x011303|$04:$92F3:11 35 0F 0F 19 29 30 ; Monster ID #$11: Lizard Fly ; indirect data load target (via $9159) 0x01130A|$04:$92FA:11 22 28 0F 18 1A 36 ; Monster ID #$12: Zombie ; indirect data load target (via $915E) 0x011311|$04:$9301:10 00 26 10 ; Monster ID #$13: Smoke ; indirect data load target (via $9163) 0x011315|$04:$9305:10 06 2C 10 ; Monster ID #$14: Ghost Rat ; indirect data load target (via $9168) 0x011319|$04:$9309:11 30 0F 0F 17 1C 26 ; Monster ID #$15: Baboon ; indirect data load target (via $916D) 0x011320|$04:$9310:11 30 0F 0F 15 2A 22 ; Monster ID #$16: Carnivog ; indirect data load target (via $9172) 0x011327|$04:$9317:11 13 0F 0F 1C 26 3A ; Monster ID #$17: Megapede ; indirect data load target (via $9177) 0x01132E|$04:$931E:11 26 0F 0F 21 23 1C ; Monster ID #$18: Sea Slug ; indirect data load target (via $917C) 0x011335|$04:$9325:11 30 0F 0F 16 15 21 ; Monster ID #$19: Medusa Ball ; indirect data load target (via $9181) 0x01133C|$04:$932C:11 2C 16 36 30 13 1C ; Monster ID #$1A: Enchanter ; indirect data load target (via $9186) 0x011343|$04:$9333:10 17 27 00 ; Monster ID #$1B: Mud Man ; indirect data load target (via $918B) 0x011347|$04:$9337:11 36 0F 0F 1A 13 16 ; Monster ID #$1C: Magic Baboon ; indirect data load target (via $9190) 0x01134E|$04:$933E:11 30 11 19 16 26 14 ; Monster ID #$1D: Demighost ; indirect data load target (via $9195) 0x011355|$04:$9345:11 30 15 0F 10 23 1C ; Monster ID #$1E: Gremlin ; indirect data load target (via $919A) 0x01135C|$04:$934C:11 30 0F 0F 21 24 17 ; Monster ID #$1F: Poison Lily ; indirect data load target (via $919F) 0x011363|$04:$9353:11 0F 15 27 30 10 1C ; Monster ID #$20: Mummy Man ; indirect data load target (via $91A4) 0x01136A|$04:$935A:11 37 0F 0F 1C 26 29 ; Monster ID #$21: Gorgon ; indirect data load target (via $91A9) 0x011371|$04:$9361:11 11 0F 0F 30 17 27 ; Monster ID #$22: Saber Tiger ; indirect data load target (via $91AE) 0x011378|$04:$9368:11 3A 0F 0F 15 25 3C ; Monster ID #$23: Dragon Fly ; indirect data load target (via $91B3) 0x01137F|$04:$936F:11 30 15 0F 17 1A 0A ; Monster ID #$24: Titan Tree ; indirect data load target (via $91B8) 0x011386|$04:$9376:10 30 21 26 ; Monster ID #$25: Undead ; indirect data load target (via $91BD) 0x01138A|$04:$937A:11 3C 1C 0F 21 13 25 ; Monster ID #$26: Basilisk ; indirect data load target (via $91C2) 0x011391|$04:$9381:10 30 27 10 ; Monster ID #$27: Goopi ; indirect data load target (via $91C7) 0x011395|$04:$9385:11 30 24 0F 17 29 10 ; Monster ID #$28: Orc ; indirect data load target (via $91CC) 0x01139C|$04:$938C:10 1C 2C 11 ; Monster ID #$29: Puppet Man ; indirect data load target (via $91D1) 0x0113A0|$04:$9390:11 0F 0F 36 31 21 14 ; Monster ID #$2A: Mummy ; indirect data load target (via $91D6) 0x0113A7|$04:$9397:11 30 27 0F 1C 15 05 ; Monster ID #$2B: Evil Tree ; indirect data load target (via $91DB) 0x0113AE|$04:$939E:10 14 06 34 ; Monster ID #$2C: Gas ; indirect data load target (via $91E0) 0x0113B2|$04:$93A2:11 0C 00 0F 1C 10 17 ; Monster ID #$2D: Hork ; indirect data load target (via $91E5) 0x0113B9|$04:$93A9:11 30 28 00 21 1C 24 ; Monster ID #$2E: Hawk Man ; indirect data load target (via $91EA) 0x0113C0|$04:$93B0:11 23 00 10 32 15 1C ; Monster ID #$2F: Sorcerer ; indirect data load target (via $91EF) 0x0113C7|$04:$93B7:10 30 0F 00 ; Monster ID #$30: Metal Slime ; indirect data load target (via $91F4) 0x0113CB|$04:$93BB:11 30 25 00 1C 29 17 ; Monster ID #$31: Hunter ; indirect data load target (via $91F9) 0x0113D2|$04:$93C2:10 30 15 27 ; Monster ID #$32: Evil Eye ; indirect data load target (via $91FE) 0x0113D6|$04:$93C6:11 30 0F 0F 23 16 1C ; Monster ID #$33: Hibabango ; indirect data load target (via $9203) 0x0113DD|$04:$93CD:10 35 06 15 ; Monster ID #$34: Graboopi ; indirect data load target (via $9208) 0x0113E1|$04:$93D1:11 30 24 30 37 13 10 ; Monster ID #$35: Gold Orc ; indirect data load target (via $920D) 0x0113E8|$04:$93D8:11 2A 10 00 30 15 1C ; Monster ID #$36: Evil Clown ; indirect data load target (via $9212) 0x0113EF|$04:$93DF:11 06 34 0F 30 15 1C ; Monster ID #$37: Ghoul ; indirect data load target (via $9217) 0x0113F6|$04:$93E6:11 30 15 0F 1C 27 00 ; Monster ID #$38: Vampirus ; indirect data load target (via $921C) 0x0113FD|$04:$93ED:10 37 06 25 ; Monster ID #$39: Mega Knight ; indirect data load target (via $9221) 0x011401|$04:$93F1:11 17 0F 0F 31 15 25 ; Monster ID #$3A: Saber Lion ; indirect data load target (via $9226) 0x011408|$04:$93F8:11 30 2A 19 10 1C 23 ; Monster ID #$3B: Metal Hunter ; indirect data load target (via $922B) 0x01140F|$04:$93FF:11 30 15 0F 1C 16 07 ; Monster ID #$3C: Ozwarg ; indirect data load target (via $9230) 0x011416|$04:$9406:10 35 1C 23 ; Monster ID #$3D: Dark Eye ; indirect data load target (via $9235) 0x01141A|$04:$940A:11 30 1C 00 14 18 10 ; Monster ID #$3E: Gargoyle ; indirect data load target (via $923A) 0x011421|$04:$9411:11 37 00 31 22 17 1B ; Monster ID #$3F: Orc King ; indirect data load target (via $923F) 0x011428|$04:$9418:11 30 12 0F 17 10 04 ; Monster ID #$40: Magic Vampirus ; indirect data load target (via $9244) 0x01142F|$04:$941F:11 30 28 00 19 26 15 ; Monster ID #$41: Berserker ; indirect data load target (via $9249) 0x011436|$04:$9426:10 00 10 30 ; Monster ID #$42: Metal Babble ; indirect data load target (via $924E) 0x01143A|$04:$942A:10 2C 13 24 ; Monster ID #$43: Hargon’s Knight ; indirect data load target (via $9253) 0x01143E|$04:$942E:12 30 15 25 0F 0F 0F 21 11 18 ; Monster ID #$44: Cyclops ; indirect data load target (via $9258) 0x011448|$04:$9438:11 30 27 16 21 13 15 ; Monster ID #$45: Attack Bot ; indirect data load target (via $925D) 0x01144F|$04:$943F:11 30 15 01 10 19 27 ; Monster ID #$46: Green Dragon ; indirect data load target (via $9262) 0x011456|$04:$9446:11 21 15 05 3B 11 14 ; Monster ID #$47: Mace Master ; indirect data load target (via $9267) 0x01145D|$04:$944D:10 11 26 0F ; Monster ID #$48: Flame ; indirect data load target (via $926C) 0x011461|$04:$9451:11 15 21 0F 30 00 11 ; Monster ID #$49: Silver Batboon ; indirect data load target (via $9271) 0x011468|$04:$9458:10 30 21 0F ; Monster ID #$4A: Blizzard ; indirect data load target (via $9276) 0x01146C|$04:$945C:12 30 16 36 0F 16 26 2A 1A 1C ; Monster ID #$4B: Giant ; indirect data load target (via $927B) 0x011476|$04:$9466:11 30 15 0F 36 1C 06 ; Monster ID #$4C: Gold Batboon ; indirect data load target (via $9280) 0x01147D|$04:$946D:13 30 28 14 1C 1A 14 23 0F 0F 23 10 15 ; Monster ID #$4D: Bullwong ; indirect data load target (via $9285) 0x01148A|$04:$947A:12 30 21 31 0F 00 10 26 16 12 ; Monster ID #$4E: Atlas ; indirect data load target (via $928A) 0x011494|$04:$9484:11 30 25 0F 13 06 1C ; Monster ID #$4F: Bazuzu ; indirect data load target (via $928F) 0x01149B|$04:$948B:13 30 23 26 00 15 26 37 0F 0F 37 21 11 ; Monster ID #$50: Zarlox ; indirect data load target (via $9294) 0x0114A8|$04:$9498:11 21 13 17 30 15 25 ; Monster ID #$51: Hargon ; indirect data load target (via $9299) 0x0114AF|$04:$949F:34 30 24 2C 1A 26 24 1A 24 1C 15 24 1C 1A 26 1C 1A 24 1C 1A 26 24 ; Monster ID #$52: Malroth ; data -> code ; control flow target (from $8329) 0x0114C5|$04:$94B5:A2 08 LDX #$08 0x0114C7|$04:$94B7:86 14 STX $14 ; coords? 0x0114C9|$04:$94B9:CA DEX 0x0114CA|$04:$94BA:86 15 STX $15 ; coords? 0x0114CC|$04:$94BC:20 16 9A JSR $9A16 ; set number of NMIs to wait for to current battle message delay if current battle message delay is not SLOW 0x0114CF|$04:$94BF:A2 24 LDX #$24 ; start with Moonbrooke ; control flow target (from $94CE) 0x0114D1|$04:$94C1:BD 2D 06 LDA $062D,X ; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x0114D4|$04:$94C4:29 A4 AND #$A4 ; clear all battle-only statuses (keep Alive, Poison, and In Party) 0x0114D6|$04:$94C6:9D 2D 06 STA $062D,X ; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x0114D9|$04:$94C9:8A TXA 0x0114DA|$04:$94CA:38 SEC 0x0114DB|$04:$94CB:E9 12 SBC #$12 ; hero data is #$12 bytes wide 0x0114DD|$04:$94CD:AA TAX 0x0114DE|$04:$94CE:10 F1 BPL $94C1 ; if more hero data to update, update it 0x0114E0|$04:$94D0:A9 FF LDA #$FF 0x0114E2|$04:$94D2:85 8E STA $8E ; flag for in battle or not (#$FF)? 0x0114E4|$04:$94D4:A9 0F LDA #$0F 0x0114E6|$04:$94D6:85 B3 STA $B3 0x0114E8|$04:$94D8:20 F7 B5 JSR $B5F7 0x0114EB|$04:$94DB:A9 00 LDA #$00 0x0114ED|$04:$94DD:85 98 STA $98 ; outcome of last fight? 0x0114EF|$04:$94DF:20 AC 9A JSR $9AAC 0x0114F2|$04:$94E2:20 B4 9A JSR $9AB4 0x0114F5|$04:$94E5:A2 00 LDX #$00 0x0114F7|$04:$94E7:8E D8 60 STX $60D8 ; control flow target (from $94FA) 0x0114FA|$04:$94EA:8A TXA 0x0114FB|$04:$94EB:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x0114FE|$04:$94EE:A0 09 LDY #$09 0x011500|$04:$94F0:B1 B5 LDA ($B5),Y 0x011502|$04:$94F2:F0 03 BEQ $94F7 0x011504|$04:$94F4:EE D8 60 INC $60D8 ; control flow target (from $94F2) 0x011507|$04:$94F7:E8 INX 0x011508|$04:$94F8:E0 04 CPX #$04 0x01150A|$04:$94FA:90 EE BCC $94EA 0x01150C|$04:$94FC:A9 00 LDA #$00 0x01150E|$04:$94FE:85 A8 STA $A8 0x011510|$04:$9500:85 A7 STA $A7 ; control flow target (from $9538) 0x011512|$04:$9502:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x011515|$04:$9505:A0 09 LDY #$09 0x011517|$04:$9507:B1 B5 LDA ($B5),Y 0x011519|$04:$9509:85 8F STA $8F 0x01151B|$04:$950B:F0 25 BEQ $9532 0x01151D|$04:$950D:E6 A8 INC $A8 0x01151F|$04:$950F:A0 00 LDY #$00 0x011521|$04:$9511:B1 B5 LDA ($B5),Y 0x011523|$04:$9513:8D 61 01 STA $0161 ; current monster ID 0x011526|$04:$9516:A2 00 LDX #$00 0x011528|$04:$9518:20 D6 9C JSR $9CD6 ; write monster name in A (+ monster number within its group in X, if > 0) to $6119 0x01152B|$04:$951B:CE D8 60 DEC $60D8 0x01152E|$04:$951E:D0 0D BNE $952D 0x011530|$04:$9520:A6 A8 LDX $A8 0x011532|$04:$9522:CA DEX 0x011533|$04:$9523:D0 04 BNE $9529 0x011535|$04:$9525:A9 54 LDA #$54 ; String ID #$0054: [cardinal #] [monster(s)][line]appeared.[end-FC] 0x011537|$04:$9527:D0 06 BNE $952F ; control flow target (from $9523) 0x011539|$04:$9529:A9 53 LDA #$53 ; String ID #$0053: And [cardinal #] [monster(s)][line]appeared.[end-FC] 0x01153B|$04:$952B:D0 02 BNE $952F ; control flow target (from $951E) 0x01153D|$04:$952D:A9 01 LDA #$01 ; String ID #$0001: [cardinal #] [monster(s)],[end-FC] ; control flow target (from $9527, $952B) 0x01153F|$04:$952F:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 ; control flow target (from $950B) 0x011542|$04:$9532:E6 A7 INC $A7 0x011544|$04:$9534:A5 A7 LDA $A7 0x011546|$04:$9536:C9 04 CMP #$04 0x011548|$04:$9538:90 C8 BCC $9502 0x01154A|$04:$953A:A5 A8 LDA $A8 0x01154C|$04:$953C:D0 0C BNE $954A 0x01154E|$04:$953E:A9 02 LDA #$02 ; String ID #$0002: But it wasn't real.[end-FC] 0x011550|$04:$9540:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011553|$04:$9543:A9 FD LDA #$FD 0x011555|$04:$9545:85 98 STA $98 ; outcome of last fight? 0x011557|$04:$9547:4C 85 96 JMP $9685 ; control flow target (from $953C) 0x01155A|$04:$954A:20 AE 87 JSR $87AE 0x01155D|$04:$954D:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise 0x011560|$04:$9550:20 61 99 JSR $9961 0x011563|$04:$9553:A9 20 LDA #$20 0x011565|$04:$9555:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x011568|$04:$9558:8D DD 06 STA $06DD 0x01156B|$04:$955B:C9 01 CMP #$01 0x01156D|$04:$955D:90 1E BCC $957D 0x01156F|$04:$955F:D0 24 BNE $9585 0x011571|$04:$9561:A9 03 LDA #$03 ; String ID #$0003: [name] attacked![end-FC] 0x011573|$04:$9563:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011576|$04:$9566:20 7F 99 JSR $997F 0x011579|$04:$9569:A9 04 LDA #$04 ; String ID #$0004: Before [name] was set for battle.[end-FC] 0x01157B|$04:$956B:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x01157E|$04:$956E:20 A0 9A JSR $9AA0 0x011581|$04:$9571:20 DC B6 JSR $B6DC 0x011584|$04:$9574:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise 0x011587|$04:$9577:20 D6 9A JSR $9AD6 0x01158A|$04:$957A:4C E3 95 JMP $95E3 ; control flow target (from $955D) 0x01158D|$04:$957D:A9 05 LDA #$05 ; String ID #$0005: But the [name] did not see thee.[end-FC] 0x01158F|$04:$957F:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011592|$04:$9582:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise ; control flow target (from $955F, $9682) 0x011595|$04:$9585:20 DC B6 JSR $B6DC 0x011598|$04:$9588:20 12 B3 JSR $B312 0x01159B|$04:$958B:AD 2F 06 LDA $062F ; Midenhall Battle Command 0x01159E|$04:$958E:C9 32 CMP #$32 0x0115A0|$04:$9590:F0 03 BEQ $9595 0x0115A2|$04:$9592:4C E3 95 JMP $95E3 ; control flow target (from $9590) 0x0115A5|$04:$9595:20 7F 99 JSR $997F 0x0115A8|$04:$9598:A9 83 LDA #$83 ; Music ID #$83: flee SFX ; call to code in a different bank ($0F:$C561) 0x0115AA|$04:$959A:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x0115AD|$04:$959D:A9 0F LDA #$0F ; String ID #$000F: [name] broke away and ran.[end-FC] 0x0115AF|$04:$959F:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x0115B2|$04:$95A2:AD 61 01 LDA $0161 ; current monster ID 0x0115B5|$04:$95A5:C9 4E CMP #$4E ; bosses start at #$4E 0x0115B7|$04:$95A7:B0 29 BCS $95D2 ; can't run away from bosses 0x0115B9|$04:$95A9:A5 31 LDA $31 ; current map ID 0x0115BB|$04:$95AB:C9 33 CMP #$33 ; Map ID #$33: Sea Cave B5 0x0115BD|$04:$95AD:D0 10 BNE $95BF 0x0115BF|$04:$95AF:A5 16 LDA $16 ; current map X-pos (1) 0x0115C1|$04:$95B1:C9 10 CMP #$10 0x0115C3|$04:$95B3:D0 0A BNE $95BF 0x0115C5|$04:$95B5:A5 17 LDA $17 ; current map Y-pos (1) 0x0115C7|$04:$95B7:C9 0C CMP #$0C 0x0115C9|$04:$95B9:F0 17 BEQ $95D2 ; can't run away from this fixed combat either 0x0115CB|$04:$95BB:C9 0D CMP #$0D 0x0115CD|$04:$95BD:F0 13 BEQ $95D2 ; control flow target (from $95AD, $95B3) 0x0115CF|$04:$95BF:AD DD 06 LDA $06DD 0x0115D2|$04:$95C2:F0 07 BEQ $95CB 0x0115D4|$04:$95C4:A9 03 LDA #$03 0x0115D6|$04:$95C6:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x0115D9|$04:$95C9:F0 07 BEQ $95D2 ; control flow target (from $95C2) 0x0115DB|$04:$95CB:A9 FC LDA #$FC 0x0115DD|$04:$95CD:85 98 STA $98 ; outcome of last fight? 0x0115DF|$04:$95CF:4C 85 96 JMP $9685 ; control flow target (from $95A7, $95B9, $95BD, $95C9) 0x0115E2|$04:$95D2:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise 0x0115E5|$04:$95D5:20 A0 9A JSR $9AA0 0x0115E8|$04:$95D8:A9 10 LDA #$10 ; String ID #$0010: But there was no escape.[end-FC] 0x0115EA|$04:$95DA:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x0115ED|$04:$95DD:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise 0x0115F0|$04:$95E0:20 D6 9A JSR $9AD6 ; control flow target (from $957A, $9592) 0x0115F3|$04:$95E3:A2 05 LDX #$05 0x0115F5|$04:$95E5:A9 FF LDA #$FF ; control flow target (from $95EB) 0x0115F7|$04:$95E7:9D D5 06 STA $06D5,X 0x0115FA|$04:$95EA:CA DEX 0x0115FB|$04:$95EB:10 FA BPL $95E7 0x0115FD|$04:$95ED:A9 00 LDA #$00 0x0115FF|$04:$95EF:8D DB 06 STA $06DB 0x011602|$04:$95F2:A9 07 LDA #$07 0x011604|$04:$95F4:85 A7 STA $A7 ; control flow target (from $95FD) 0x011606|$04:$95F6:20 52 B0 JSR $B052 0x011609|$04:$95F9:C6 A7 DEC $A7 0x01160B|$04:$95FB:A5 A7 LDA $A7 0x01160D|$04:$95FD:10 F7 BPL $95F6 0x01160F|$04:$95FF:20 16 9A JSR $9A16 ; set number of NMIs to wait for to current battle message delay if current battle message delay is not SLOW 0x011612|$04:$9602:A9 00 LDA #$00 0x011614|$04:$9604:8D E0 06 STA $06E0 ; control flow target (from $9655) 0x011617|$04:$9607:AA TAX 0x011618|$04:$9608:A9 4F LDA #$4F 0x01161A|$04:$960A:85 AD STA $AD 0x01161C|$04:$960C:A9 00 LDA #$00 0x01161E|$04:$960E:8D 76 01 STA $0176 0x011621|$04:$9611:BD C7 06 LDA $06C7,X 0x011624|$04:$9614:C9 18 CMP #$18 0x011626|$04:$9616:B0 24 BCS $963C 0x011628|$04:$9618:C9 03 CMP #$03 0x01162A|$04:$961A:90 12 BCC $962E 0x01162C|$04:$961C:29 07 AND #$07 0x01162E|$04:$961E:AC DD 06 LDY $06DD 0x011631|$04:$9621:C0 00 CPY #$00 0x011633|$04:$9623:F0 17 BEQ $963C 0x011635|$04:$9625:20 5B A8 JSR $A85B 0x011638|$04:$9628:A5 98 LDA $98 ; outcome of last fight? 0x01163A|$04:$962A:F0 10 BEQ $963C 0x01163C|$04:$962C:D0 57 BNE $9685 ; control flow target (from $961A) 0x01163E|$04:$962E:AC DD 06 LDY $06DD 0x011641|$04:$9631:C0 01 CPY #$01 0x011643|$04:$9633:F0 07 BEQ $963C 0x011645|$04:$9635:20 FD A0 JSR $A0FD 0x011648|$04:$9638:A5 98 LDA $98 ; outcome of last fight? 0x01164A|$04:$963A:D0 49 BNE $9685 ; control flow target (from $9616, $9623, $962A, $9633) 0x01164C|$04:$963C:AD 76 01 LDA $0176 0x01164F|$04:$963F:D0 09 BNE $964A 0x011651|$04:$9641:A5 AD LDA $AD 0x011653|$04:$9643:C9 4F CMP #$4F 0x011655|$04:$9645:F0 03 BEQ $964A 0x011657|$04:$9647:20 DC 9C JSR $9CDC ; control flow target (from $963F, $9645) 0x01165A|$04:$964A:20 F1 A0 JSR $A0F1 0x01165D|$04:$964D:EE E0 06 INC $06E0 0x011660|$04:$9650:AD E0 06 LDA $06E0 0x011663|$04:$9653:C9 0B CMP #$0B 0x011665|$04:$9655:90 B0 BCC $9607 0x011667|$04:$9657:A9 00 LDA #$00 0x011669|$04:$9659:85 A7 STA $A7 ; control flow target (from $967B) 0x01166B|$04:$965B:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x01166E|$04:$965E:A0 0A LDY #$0A 0x011670|$04:$9660:B1 B5 LDA ($B5),Y 0x011672|$04:$9662:C9 03 CMP #$03 0x011674|$04:$9664:B0 0F BCS $9675 0x011676|$04:$9666:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x011679|$04:$9669:A0 00 LDY #$00 0x01167B|$04:$966B:B1 B9 LDA ($B9),Y 0x01167D|$04:$966D:30 06 BMI $9675 0x01167F|$04:$966F:A9 FF LDA #$FF 0x011681|$04:$9671:A0 0A LDY #$0A 0x011683|$04:$9673:91 B5 STA ($B5),Y ; control flow target (from $9664, $966D) 0x011685|$04:$9675:E6 A7 INC $A7 0x011687|$04:$9677:A5 A7 LDA $A7 0x011689|$04:$9679:C9 04 CMP #$04 0x01168B|$04:$967B:90 DE BCC $965B 0x01168D|$04:$967D:A9 FF LDA #$FF 0x01168F|$04:$967F:8D DD 06 STA $06DD 0x011692|$04:$9682:4C 85 95 JMP $9585 ; control flow target (from $9547, $95CF, $962C, $963A) 0x011695|$04:$9685:A9 01 LDA #$01 0x011697|$04:$9687:85 8E STA $8E ; flag for in battle or not (#$FF)? 0x011699|$04:$9689:A5 98 LDA $98 ; outcome of last fight? 0x01169B|$04:$968B:C9 FE CMP #$FE 0x01169D|$04:$968D:B0 03 BCS $9692 ; call to code in a different bank ($0F:$C5A3) 0x01169F|$04:$968F:4C A3 C5 JMP $C5A3 ; control flow target (from $968D) 0x0116A2|$04:$9692:C9 FF CMP #$FF 0x0116A4|$04:$9694:D0 25 BNE $96BB 0x0116A6|$04:$9696:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise 0x0116A9|$04:$9699:20 BF 9A JSR $9ABF 0x0116AC|$04:$969C:A9 12 LDA #$12 ; Music ID #$12: party defeat BGM ; call to code in a different bank ($0F:$C561) 0x0116AE|$04:$969E:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x0116B1|$04:$96A1:A2 1B LDX #$1B ; String ID #$001B: Alas, brave [name] hast died.[end-FC] 0x0116B3|$04:$96A3:AD 3F 06 LDA $063F ; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x0116B6|$04:$96A6:29 04 AND #$04 0x0116B8|$04:$96A8:F0 04 BEQ $96AE 0x0116BA|$04:$96AA:A9 80 LDA #$80 0x0116BC|$04:$96AC:A2 B1 LDX #$B1 ; String ID #$0151: [name] is utterly destroyed.[end-FC] ; control flow target (from $96A8) 0x0116BE|$04:$96AE:86 C7 STX $C7 0x0116C0|$04:$96B0:20 D0 9C JSR $9CD0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA 0x0116C3|$04:$96B3:A5 C7 LDA $C7 0x0116C5|$04:$96B5:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x0116C8|$04:$96B8:4C 58 9A JMP $9A58 ; control flow target (from $9694) 0x0116CB|$04:$96BB:20 91 99 JSR $9991 0x0116CE|$04:$96BE:A9 00 LDA #$00 ; Midenhall 0x0116D0|$04:$96C0:85 A7 STA $A7 ; hero ID ; control flow target (from $971A) 0x0116D2|$04:$96C2:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x0116D5|$04:$96C5:A0 00 LDY #$00 0x0116D7|$04:$96C7:B1 B9 LDA ($B9),Y ; Status 0x0116D9|$04:$96C9:10 49 BPL $9714 ; branch if dead 0x0116DB|$04:$96CB:A0 06 LDY #$06 0x0116DD|$04:$96CD:B1 B9 LDA ($B9),Y ; hero's current EXP, byte 0 0x0116DF|$04:$96CF:18 CLC 0x0116E0|$04:$96D0:6D 26 06 ADC $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x0116E3|$04:$96D3:85 99 STA $99 ; new EXP, byte 0 0x0116E5|$04:$96D5:C8 INY 0x0116E6|$04:$96D6:B1 B9 LDA ($B9),Y ; hero's current EXP, byte 1 0x0116E8|$04:$96D8:6D 27 06 ADC $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x0116EB|$04:$96DB:85 9A STA $9A ; new EXP, byte 1 0x0116ED|$04:$96DD:C8 INY 0x0116EE|$04:$96DE:B1 B9 LDA ($B9),Y ; hero's current EXP, byte 2 0x0116F0|$04:$96E0:69 00 ADC #$00 0x0116F2|$04:$96E2:85 9B STA $9B ; new EXP, byte 2 0x0116F4|$04:$96E4:C9 0F CMP #$0F ; start checking for 1,000,000 EXP cap 0x0116F6|$04:$96E6:90 1C BCC $9704 0x0116F8|$04:$96E8:D0 0E BNE $96F8 ; cap EXP at 1,000,000 0x0116FA|$04:$96EA:A5 9A LDA $9A 0x0116FC|$04:$96EC:C9 42 CMP #$42 0x0116FE|$04:$96EE:90 14 BCC $9704 0x011700|$04:$96F0:D0 06 BNE $96F8 ; cap EXP at 1,000,000 0x011702|$04:$96F2:A5 99 LDA $99 0x011704|$04:$96F4:C9 41 CMP #$41 0x011706|$04:$96F6:90 0C BCC $9704 ; cap EXP at 1,000,000 ; control flow target (from $96E8, $96F0) 0x011708|$04:$96F8:A9 40 LDA #$40 0x01170A|$04:$96FA:85 99 STA $99 0x01170C|$04:$96FC:A9 42 LDA #$42 0x01170E|$04:$96FE:85 9A STA $9A 0x011710|$04:$9700:A9 0F LDA #$0F 0x011712|$04:$9702:85 9B STA $9B ; control flow target (from $96E6, $96EE, $96F6) 0x011714|$04:$9704:A0 06 LDY #$06 0x011716|$04:$9706:A5 99 LDA $99 ; new EXP, byte 0 0x011718|$04:$9708:91 B9 STA ($B9),Y ; hero's current EXP, byte 0 0x01171A|$04:$970A:C8 INY 0x01171B|$04:$970B:A5 9A LDA $9A ; new EXP, byte 1 0x01171D|$04:$970D:91 B9 STA ($B9),Y ; hero's current EXP, byte 1 0x01171F|$04:$970F:C8 INY 0x011720|$04:$9710:A5 9B LDA $9B ; new EXP, byte 2 0x011722|$04:$9712:91 B9 STA ($B9),Y ; hero's current EXP, byte 2 ; control flow target (from $96C9) 0x011724|$04:$9714:E6 A7 INC $A7 ; hero ID 0x011726|$04:$9716:A5 A7 LDA $A7 ; hero ID 0x011728|$04:$9718:C9 03 CMP #$03 ; max of 3 heroes 0x01172A|$04:$971A:90 A6 BCC $96C2 ; if more heroes to update, update them 0x01172C|$04:$971C:AD 26 06 LDA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x01172F|$04:$971F:85 8F STA $8F 0x011731|$04:$9721:AD 27 06 LDA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x011734|$04:$9724:85 90 STA $90 0x011736|$04:$9726:05 8F ORA $8F 0x011738|$04:$9728:D0 0D BNE $9737 0x01173A|$04:$972A:AD 61 01 LDA $0161 ; current monster ID 0x01173D|$04:$972D:C9 51 CMP #$51 0x01173F|$04:$972F:B0 06 BCS $9737 ; call to code in a different bank ($0F:$C5A3) 0x011741|$04:$9731:20 A3 C5 JSR $C5A3 0x011744|$04:$9734:4C 3C 9A JMP $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise ; control flow target (from $9728, $972F) 0x011747|$04:$9737:20 EA 99 JSR $99EA 0x01174A|$04:$973A:20 BF 9A JSR $9ABF 0x01174D|$04:$973D:A9 09 LDA #$09 ; Music ID #$09: battle win BGM ; call to code in a different bank ($0F:$C561) 0x01174F|$04:$973F:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x011752|$04:$9742:AD 60 01 LDA $0160 ; ID of only monster (/monster group) or #$53 for "Enemies" if there are multiple groups 0x011755|$04:$9745:A2 00 LDX #$00 0x011757|$04:$9747:20 D6 9C JSR $9CD6 ; write monster name in A (+ monster number within its group in X, if > 0) to $6119 0x01175A|$04:$974A:A9 19 LDA #$19 ; String ID #$0019: Thou hast defeated the [name].[end-FC] 0x01175C|$04:$974C:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x01175F|$04:$974F:AD 61 01 LDA $0161 ; current monster ID 0x011762|$04:$9752:C9 52 CMP #$52 0x011764|$04:$9754:D0 05 BNE $975B 0x011766|$04:$9756:A9 00 LDA #$00 0x011768|$04:$9758:8D F7 05 STA $05F7 ; probably BGM for current area ; control flow target (from $9754) ; call to code in a different bank ($0F:$C595) 0x01176B|$04:$975B:20 95 C5 JSR $C595 0x01176E|$04:$975E:AD 61 01 LDA $0161 ; current monster ID 0x011771|$04:$9761:C9 51 CMP #$51 ; monster #$51 = Hargon 0x011773|$04:$9763:90 03 BCC $9768 ; if you beat anything less than Hargon or Malroth, go see if you got an item drop 0x011775|$04:$9765:4C 3C 9A JMP $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise; otherwise, no item drop for you! ; control flow target (from $9763) 0x011778|$04:$9768:A9 49 LDA #$49 ; String ID #$0049: [FD]Of Experience points thou has gained [number][end-FF] 0x01177A|$04:$976A:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x01177D|$04:$976D:A9 00 LDA #$00 ; start by assuming no item drop (since it's probably true anyway :p) 0x01177F|$04:$976F:8D B0 61 STA $61B0 ; flag for whether you get an item drop or not 0x011782|$04:$9772:20 46 99 JSR $9946 ; determine max possible inventory offset based on current party 0x011785|$04:$9775:A2 00 LDX #$00 ; start scanning inventory from the beginning ; control flow target (from $977F) 0x011787|$04:$9777:BD 00 06 LDA $0600,X ; Midenhall inventory item 1 (| #$40 if equipped) 0x01178A|$04:$977A:F0 08 BEQ $9784 ; if you have an empty slot, maybe you'll get an item drop 0x01178C|$04:$977C:E8 INX ; otherwise get ready to check the next slot 0x01178D|$04:$977D:E4 A3 CPX $A3 ; max possible inventory offset based on current party 0x01178F|$04:$977F:90 F6 BCC $9777 ; if there are more slots to check, check them 0x011791|$04:$9781:4C 6A 98 JMP $986A ; if you get here, you have a full inventory; no item drop for you! ; control flow target (from $977A) 0x011794|$04:$9784:86 A7 STX $A7 0x011796|$04:$9786:8A TXA 0x011797|$04:$9787:4A LSR ; inventory slot / 8 == whose inventory that slot belongs to 0x011798|$04:$9788:4A LSR 0x011799|$04:$9789:4A LSR 0x01179A|$04:$978A:85 A9 STA $A9 0x01179C|$04:$978C:A2 00 LDX #$00 ; start by assuming Midenhall's alive 0x01179E|$04:$978E:AD 2D 06 LDA $062D ; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x0117A1|$04:$9791:30 09 BMI $979C ; branch if Midenhall really is alive 0x0117A3|$04:$9793:A2 01 LDX #$01 ; otherwise assume Cannock's alive 0x0117A5|$04:$9795:AD 3F 06 LDA $063F ; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x0117A8|$04:$9798:30 02 BMI $979C ; branch if Cannock really is alive 0x0117AA|$04:$979A:A2 02 LDX #$02 ; otherwise Moonbrooke has to be alive, right? ; control flow target (from $9791, $9798) 0x0117AC|$04:$979C:86 A8 STX $A8 0x0117AE|$04:$979E:A5 31 LDA $31 ; current map ID 0x0117B0|$04:$97A0:C9 04 CMP #$04 ; guaranteed drop; #$04 = both Item ID #$04: Staff of Thunder and Map ID #$04: Midenhall B1 0x0117B2|$04:$97A2:F0 35 BEQ $97D9 0x0117B4|$04:$97A4:AE 61 01 LDX $0161 ; current monster ID 0x0117B7|$04:$97A7:CA DEX ; monster IDs start at 1, drop list starts at 0 0x0117B8|$04:$97A8:BD 0E BF LDA $BF0E,X ; monster drop rates/items 0x0117BB|$04:$97AB:D0 03 BNE $97B0 ; if monster has a drop, see if you get it 0x0117BD|$04:$97AD:4C 6A 98 JMP $986A ; otherwise, on with the show... ; control flow target (from $97AB) 0x0117C0|$04:$97B0:85 A4 STA $A4 ; drop rate/item 0x0117C2|$04:$97B2:29 C0 AND #$C0 ; pick out the drop rate bits 0x0117C4|$04:$97B4:F0 0A BEQ $97C0 ; 0b00xxxxxx 0x0117C6|$04:$97B6:C9 80 CMP #$80 0x0117C8|$04:$97B8:F0 0A BEQ $97C4 ; 0b10xxxxxx 0x0117CA|$04:$97BA:B0 0C BCS $97C8 ; 0b11xxxxxx 0x0117CC|$04:$97BC:A9 0F LDA #$0F ; 0b01xxxxxx; need to match 4 bits => 1/16 chance 0x0117CE|$04:$97BE:D0 0A BNE $97CA ; control flow target (from $97B4) 0x0117D0|$04:$97C0:A9 07 LDA #$07 ; need to match 3 bits => 1/8 chance 0x0117D2|$04:$97C2:D0 06 BNE $97CA ; control flow target (from $97B8) 0x0117D4|$04:$97C4:A9 1F LDA #$1F ; need to match 5 bits => 1/32 chance 0x0117D6|$04:$97C6:D0 02 BNE $97CA ; control flow target (from $97BA) 0x0117D8|$04:$97C8:A9 7F LDA #$7F ; need to match 7 bits => 1/128 chance ; control flow target (from $97BE, $97C2, $97C6) 0x0117DA|$04:$97CA:85 99 STA $99 ; drop rate ; call to code in a different bank ($0F:$C3AB) 0x0117DC|$04:$97CC:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x0117DF|$04:$97CF:A5 32 LDA $32 ; RNG byte 0 0x0117E1|$04:$97D1:25 99 AND $99 ; drop rate 0x0117E3|$04:$97D3:D0 72 BNE $9847 ; if random number is not 0 in all the required bits, no item drop for you! 0x0117E5|$04:$97D5:A5 A4 LDA $A4 ; drop rate/item 0x0117E7|$04:$97D7:29 3F AND #$3F ; this time pick out the dropped item ; control flow target (from $97A2) 0x0117E9|$04:$97D9:85 A4 STA $A4 ; dropped item 0x0117EB|$04:$97DB:A2 00 LDX #$00 ; start scanning through party inventory from the beginning ; control flow target (from $97E9) 0x0117ED|$04:$97DD:BD 00 06 LDA $0600,X ; Midenhall inventory item 1 (| #$40 if equipped) 0x0117F0|$04:$97E0:29 3F AND #$3F ; pick out the base item, don't care whether it's equipped or not 0x0117F2|$04:$97E2:C5 A4 CMP $A4 ; do you already have one of these items? 0x0117F4|$04:$97E4:F0 64 BEQ $984A ; if yes, go see if it's one you're allowed to get another copy of anyway 0x0117F6|$04:$97E6:E8 INX ; otherwise set X for the next inventory slot 0x0117F7|$04:$97E7:E4 A3 CPX $A3 ; max possible inventory offset based on current party 0x0117F9|$04:$97E9:90 F2 BCC $97DD ; if there are more inventory slots to check, check them ; control flow target (from $984C, $9850, $9854, $9858, $985C) 0x0117FB|$04:$97EB:A6 A7 LDX $A7 ; offset of first empty inventory slot 0x0117FD|$04:$97ED:A5 A4 LDA $A4 ; dropped item 0x0117FF|$04:$97EF:9D 00 06 STA $0600,X ; Midenhall inventory item 1 (| #$40 if equipped) ; control flow target (from $9862) 0x011802|$04:$97F2:A9 8A LDA #$8A ; String ID #$008A: .[end-FC] ; call to code in a different bank ($0F:$FA4A) 0x011804|$04:$97F4:20 4A FA JSR $FA4A ; display string ID specified by A 0x011807|$04:$97F7:A9 01 LDA #$01 ; flag item gain for later logic 0x011809|$04:$97F9:8D B0 61 STA $61B0 ; flag for whether you get an item drop or not 0x01180C|$04:$97FC:AD 60 01 LDA $0160 ; ID of only monster (/monster group) or #$53 for "Enemies" if there are multiple groups 0x01180F|$04:$97FF:A2 00 LDX #$00 0x011811|$04:$9801:20 D6 9C JSR $9CD6 ; write monster name in A (+ monster number within its group in X, if > 0) to $6119 0x011814|$04:$9804:A9 AA LDA #$AA ; String ID #$014A: [wait][name] had the Treasure Chest.[wait][end-FC] 0x011816|$04:$9806:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011819|$04:$9809:A9 92 LDA #$92 ; Music ID #$92: open chest SFX ; call to code in a different bank ($0F:$C561) 0x01181B|$04:$980B:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x01181E|$04:$980E:A5 A9 LDA $A9 0x011820|$04:$9810:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x011823|$04:$9813:A0 00 LDY #$00 0x011825|$04:$9815:B1 B9 LDA ($B9),Y ; status byte 0x011827|$04:$9817:30 05 BMI $981E ; if the hero with the first empty inventory slot is also alive, they get to open the chest, otherwise the first living hero opens it 0x011829|$04:$9819:A5 A8 LDA $A8 0x01182B|$04:$981B:4C 20 98 JMP $9820 ; control flow target (from $9817) 0x01182E|$04:$981E:A5 A9 LDA $A9 ; control flow target (from $981B) 0x011830|$04:$9820:20 D0 9C JSR $9CD0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA 0x011833|$04:$9823:A9 65 LDA #$65 ; String ID #$0105: Seeing a treasure chest, [name] opened it.[wait][end-FC] 0x011835|$04:$9825:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011838|$04:$9828:A5 A4 LDA $A4 ; dropped item 0x01183A|$04:$982A:F0 38 BEQ $9864 ; branch if no dropped item 0x01183C|$04:$982C:85 95 STA $95 ; ID for [item] and [spell] control codes; dropped item 0x01183E|$04:$982E:A9 64 LDA #$64 ; String ID #$0104: And there [name] discovered the [item]![end-FC] 0x011840|$04:$9830:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011843|$04:$9833:A0 00 LDY #$00 0x011845|$04:$9835:B1 B9 LDA ($B9),Y ; status byte 0x011847|$04:$9837:30 31 BMI $986A ; if hero with the first empty inventory slot is alive, then we're done with items, otherwise give it to their ghost 0x011849|$04:$9839:A5 A9 LDA $A9 0x01184B|$04:$983B:20 D0 9C JSR $9CD0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA 0x01184E|$04:$983E:A5 A4 LDA $A4 ; dropped item 0x011850|$04:$9840:85 95 STA $95 ; ID for [item] and [spell] control codes; yup, still the dropped item... 0x011852|$04:$9842:A9 77 LDA #$77 ; String ID #$0117: gave the [item] to the ghost of [name].[end-FC] 0x011854|$04:$9844:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 ; control flow target (from $97D3) 0x011857|$04:$9847:4C 6A 98 JMP $986A ; done with items, now it's time to deal with gold ; list of item drops you're allowed to have multiples of ; control flow target (from $97E4) 0x01185A|$04:$984A:C9 33 CMP #$33 ; Item ID #$33: Lottery Ticket 0x01185C|$04:$984C:F0 9D BEQ $97EB ; allowed to keep duplicates 0x01185E|$04:$984E:C9 34 CMP #$34 ; Item ID #$34: Fairy Water 0x011860|$04:$9850:F0 99 BEQ $97EB ; allowed to keep duplicates 0x011862|$04:$9852:C9 35 CMP #$35 ; Item ID #$35: Wing of the Wyvern 0x011864|$04:$9854:F0 95 BEQ $97EB ; allowed to keep duplicates 0x011866|$04:$9856:C9 3B CMP #$3B ; Item ID #$3B: Antidote Herb 0x011868|$04:$9858:F0 91 BEQ $97EB ; allowed to keep duplicates 0x01186A|$04:$985A:C9 3C CMP #$3C ; Item ID #$3C: Medical Herb 0x01186C|$04:$985C:F0 8D BEQ $97EB ; allowed to keep duplicates 0x01186E|$04:$985E:A9 00 LDA #$00 ; otherwise, not allowed to keep the dropped item :( 0x011870|$04:$9860:85 A4 STA $A4 0x011872|$04:$9862:F0 8E BEQ $97F2 ; control flow target (from $982A) 0x011874|$04:$9864:0E E6 06 ASL $06E6 0x011877|$04:$9867:2E EC 06 ROL $06EC ; control flow target (from $9781, $97AD, $9837, $9847) 0x01187A|$04:$986A:AD E6 06 LDA $06E6 0x01187D|$04:$986D:85 99 STA $99 0x01187F|$04:$986F:AD EC 06 LDA $06EC 0x011882|$04:$9872:85 9A STA $9A 0x011884|$04:$9874:05 99 ORA $99 0x011886|$04:$9876:F0 56 BEQ $98CE 0x011888|$04:$9878:46 9A LSR $9A 0x01188A|$04:$987A:66 99 ROR $99 0x01188C|$04:$987C:46 9A LSR $9A 0x01188E|$04:$987E:66 99 ROR $99 ; call to code in a different bank ($0F:$C3AB) 0x011890|$04:$9880:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x011893|$04:$9883:A5 32 LDA $32 ; RNG byte 0 0x011895|$04:$9885:85 9B STA $9B 0x011897|$04:$9887:20 5B A0 JSR $A05B ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) 0x01189A|$04:$988A:AD E6 06 LDA $06E6 0x01189D|$04:$988D:38 SEC 0x01189E|$04:$988E:E5 9D SBC $9D 0x0118A0|$04:$9890:85 99 STA $99 0x0118A2|$04:$9892:AD EC 06 LDA $06EC 0x0118A5|$04:$9895:E5 9E SBC $9E 0x0118A7|$04:$9897:85 9A STA $9A 0x0118A9|$04:$9899:A5 99 LDA $99 0x0118AB|$04:$989B:18 CLC 0x0118AC|$04:$989C:6D 24 06 ADC $0624 ; party gold, low byte 0x0118AF|$04:$989F:8D 24 06 STA $0624 ; party gold, low byte 0x0118B2|$04:$98A2:A5 9A LDA $9A 0x0118B4|$04:$98A4:6D 25 06 ADC $0625 ; party gold, high byte 0x0118B7|$04:$98A7:90 05 BCC $98AE ; if adding gold did not overflow the 16-bit storage, then just save the new high byte 0x0118B9|$04:$98A9:A9 FF LDA #$FF ; otherwise set both bytes to #$FF i.e. 65535 G 0x0118BB|$04:$98AB:8D 24 06 STA $0624 ; party gold, low byte ; control flow target (from $98A7) 0x0118BE|$04:$98AE:8D 25 06 STA $0625 ; party gold, high byte 0x0118C1|$04:$98B1:A5 99 LDA $99 ; store received gold to $8F-$90 so we can print it later 0x0118C3|$04:$98B3:85 8F STA $8F 0x0118C5|$04:$98B5:A5 9A LDA $9A 0x0118C7|$04:$98B7:85 90 STA $90 0x0118C9|$04:$98B9:AD B0 61 LDA $61B0 ; flag for whether you get an item drop or not 0x0118CC|$04:$98BC:D0 0B BNE $98C9 ; if you get an item drop, go deal with that 0x0118CE|$04:$98BE:A9 8B LDA #$8B ; String ID #$008B: [no voice]and earned [number] piece[(s)] of gold.[end-FC] 0x0118D0|$04:$98C0:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 ; call to code in a different bank ($0F:$FA4A) 0x0118D3|$04:$98C3:20 4A FA JSR $FA4A ; display string ID specified by A 0x0118D6|$04:$98C6:4C CE 98 JMP $98CE ; control flow target (from $98BC) 0x0118D9|$04:$98C9:A9 48 LDA #$48 ; String ID #$0048: And earned [number] piece[(s)] of gold.[end-FC] 0x0118DB|$04:$98CB:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 ; control flow target (from $9876, $98C6) 0x0118DE|$04:$98CE:A9 00 LDA #$00 0x0118E0|$04:$98D0:85 C7 STA $C7 ; control flow target (from $993B) 0x0118E2|$04:$98D2:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x0118E5|$04:$98D5:A0 06 LDY #$06 ; control flow target (from $98DF) 0x0118E7|$04:$98D7:B1 B9 LDA ($B9),Y 0x0118E9|$04:$98D9:99 20 06 STA $0620,Y ; monster group 3 monster ID 0x0118EC|$04:$98DC:C8 INY 0x0118ED|$04:$98DD:C0 09 CPY #$09 0x0118EF|$04:$98DF:90 F6 BCC $98D7 ; control flow target (from $9932) 0x0118F1|$04:$98E1:A6 C7 LDX $C7 0x0118F3|$04:$98E3:20 43 9D JSR $9D43 ; given hero ID in X and hero's current EXP in $0626-$0628, set $8F-$90 to EXP required to reach next level; return current level in A 0x0118F6|$04:$98E6:85 C8 STA $C8 0x0118F8|$04:$98E8:A0 11 LDY #$11 0x0118FA|$04:$98EA:B1 B9 LDA ($B9),Y 0x0118FC|$04:$98EC:C5 C8 CMP $C8 0x0118FE|$04:$98EE:B0 45 BCS $9935 0x011900|$04:$98F0:A6 C7 LDX $C7 0x011902|$04:$98F2:A8 TAY 0x011903|$04:$98F3:C8 INY 0x011904|$04:$98F4:98 TYA 0x011905|$04:$98F5:20 C8 9D JSR $9DC8 ; calculate hero X stats for level A 0x011908|$04:$98F8:A9 08 LDA #$08 ; Music ID #$08: level up BGM ; call to code in a different bank ($0F:$C561) 0x01190A|$04:$98FA:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x01190D|$04:$98FD:A5 C7 LDA $C7 0x01190F|$04:$98FF:20 D0 9C JSR $9CD0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA ; call to code in a different bank ($0F:$C595) 0x011912|$04:$9902:20 95 C5 JSR $C595 0x011915|$04:$9905:A9 47 LDA #$47 ; String ID #$0047: [wait]Wit and courage have served thee well, for [name] has been promoted to the next level.[end-FC] 0x011917|$04:$9907:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x01191A|$04:$990A:20 AC 9A JSR $9AAC 0x01191D|$04:$990D:A0 4A LDY #$4A 0x01191F|$04:$990F:84 C5 STY $C5 ; control flow target (from $9927) 0x011921|$04:$9911:B9 59 00 LDA $0059,Y ; menu ID 0x011924|$04:$9914:F0 0B BEQ $9921 0x011926|$04:$9916:85 8F STA $8F 0x011928|$04:$9918:A9 00 LDA #$00 0x01192A|$04:$991A:85 90 STA $90 0x01192C|$04:$991C:A5 C5 LDA $C5 ; String IDs #$004A-#$004D: "[wait]Power increases by [number].[end-FC]", "[wait]Reaction Speed increases by [number].[end-FC]", "[wait]Maximum HP increases by [number].[end-FC]", "[wait]Maximum MP increases by [number].[end-FC]" 0x01192E|$04:$991E:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 ; control flow target (from $9914) 0x011931|$04:$9921:E6 C5 INC $C5 0x011933|$04:$9923:A4 C5 LDY $C5 0x011935|$04:$9925:C0 4E CPY #$4E 0x011937|$04:$9927:90 E8 BCC $9911 0x011939|$04:$9929:A5 B3 LDA $B3 0x01193B|$04:$992B:F0 05 BEQ $9932 0x01193D|$04:$992D:A9 4E LDA #$4E ; String ID #$004E: [wait]And [name] learned one new spell.[end-FC] 0x01193F|$04:$992F:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 ; control flow target (from $992B) 0x011942|$04:$9932:4C E1 98 JMP $98E1 ; control flow target (from $98EE) 0x011945|$04:$9935:E6 C7 INC $C7 0x011947|$04:$9937:A5 C7 LDA $C7 0x011949|$04:$9939:C9 03 CMP #$03 0x01194B|$04:$993B:90 95 BCC $98D2 0x01194D|$04:$993D:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 ; call to code in a different bank ($0F:$F642) 0x011950|$04:$9940:20 42 F6 JSR $F642 ; display appropriate battle EXP + Gold menu 0x011953|$04:$9943:4C 58 9A JMP $9A58 ; determine max possible inventory offset based on current party ; control flow target (from $9772) 0x011956|$04:$9946:AD 3F 06 LDA $063F ; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x011959|$04:$9949:29 04 AND #$04 ; pick out Cannock's In Party bit 0x01195B|$04:$994B:F0 0F BEQ $995C ; branch if Cannock not in party yet 0x01195D|$04:$994D:AD 51 06 LDA $0651 ; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x011960|$04:$9950:29 04 AND #$04 ; pick out Moonbrooke's In Party bit 0x011962|$04:$9952:F0 04 BEQ $9958 ; branch if Moonbrooke not in party yet 0x011964|$04:$9954:A2 18 LDX #$18 ; otherwise the gang's all together and you have a full 24 inventory slots 0x011966|$04:$9956:D0 06 BNE $995E ; control flow target (from $9952) 0x011968|$04:$9958:A2 10 LDX #$10 ; if it's just the boys, you have 16 inventory slots 0x01196A|$04:$995A:D0 02 BNE $995E ; control flow target (from $994B) 0x01196C|$04:$995C:A2 08 LDX #$08 ; if Midenhall's alone, you only have 8 slots ; control flow target (from $9956, $995A) 0x01196E|$04:$995E:86 A3 STX $A3 ; max possible inventory offset based on current party 0x011970|$04:$9960:60 RTS ; control flow target (from $9550) 0x011971|$04:$9961:20 D6 9A JSR $9AD6 0x011974|$04:$9964:20 84 9A JSR $9A84 0x011977|$04:$9967:C9 01 CMP #$01 0x011979|$04:$9969:D0 10 BNE $997B 0x01197B|$04:$996B:98 TYA 0x01197C|$04:$996C:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x01197F|$04:$996F:A0 00 LDY #$00 0x011981|$04:$9971:B1 B5 LDA ($B5),Y ; control flow target (from $997D) 0x011983|$04:$9973:A2 00 LDX #$00 0x011985|$04:$9975:8D 60 01 STA $0160 ; ID of only monster (/monster group) or #$53 for "Enemies" if there are multiple groups 0x011988|$04:$9978:4C D6 9C JMP $9CD6 ; write monster name in A (+ monster number within its group in X, if > 0) to $6119 ; control flow target (from $9969) 0x01198B|$04:$997B:A9 53 LDA #$53 0x01198D|$04:$997D:D0 F4 BNE $9973 ; control flow target (from $9566, $9595) 0x01198F|$04:$997F:A9 01 LDA #$01 0x011991|$04:$9981:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x011994|$04:$9984:A0 00 LDY #$00 0x011996|$04:$9986:B1 B9 LDA ($B9),Y 0x011998|$04:$9988:29 04 AND #$04 0x01199A|$04:$998A:F0 02 BEQ $998E 0x01199C|$04:$998C:A9 80 LDA #$80 ; control flow target (from $998A) 0x01199E|$04:$998E:4C D0 9C JMP $9CD0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA ; control flow target (from $96BB) 0x0119A1|$04:$9991:AD FE 05 LDA $05FE ; number of monsters in current group killed by last attack? 0x0119A4|$04:$9994:F0 35 BEQ $99CB 0x0119A6|$04:$9996:85 9B STA $9B 0x0119A8|$04:$9998:AD 26 06 LDA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x0119AB|$04:$999B:85 99 STA $99 0x0119AD|$04:$999D:AD 27 06 LDA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x0119B0|$04:$99A0:85 9A STA $9A 0x0119B2|$04:$99A2:05 99 ORA $99 0x0119B4|$04:$99A4:F0 3F BEQ $99E5 0x0119B6|$04:$99A6:20 5B A0 JSR $A05B ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) 0x0119B9|$04:$99A9:A9 0A LDA #$0A 0x0119BB|$04:$99AB:85 9B STA $9B 0x0119BD|$04:$99AD:A9 00 LDA #$00 0x0119BF|$04:$99AF:85 9C STA $9C 0x0119C1|$04:$99B1:20 A2 A0 JSR $A0A2 0x0119C4|$04:$99B4:E6 99 INC $99 0x0119C6|$04:$99B6:D0 02 BNE $99BA 0x0119C8|$04:$99B8:E6 9A INC $9A ; control flow target (from $99B6) 0x0119CA|$04:$99BA:AD 26 06 LDA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x0119CD|$04:$99BD:18 CLC 0x0119CE|$04:$99BE:65 99 ADC $99 0x0119D0|$04:$99C0:8D 26 06 STA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x0119D3|$04:$99C3:AD 27 06 LDA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x0119D6|$04:$99C6:65 9A ADC $9A 0x0119D8|$04:$99C8:8D 27 06 STA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 ; control flow target (from $9994) 0x0119DB|$04:$99CB:AD 27 06 LDA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x0119DE|$04:$99CE:C9 27 CMP #$27 0x0119E0|$04:$99D0:90 13 BCC $99E5 0x0119E2|$04:$99D2:D0 07 BNE $99DB 0x0119E4|$04:$99D4:AD 26 06 LDA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x0119E7|$04:$99D7:C9 10 CMP #$10 0x0119E9|$04:$99D9:90 0A BCC $99E5 ; control flow target (from $99D2) 0x0119EB|$04:$99DB:A9 0F LDA #$0F 0x0119ED|$04:$99DD:8D 26 06 STA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x0119F0|$04:$99E0:A9 27 LDA #$27 0x0119F2|$04:$99E2:8D 27 06 STA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 ; control flow target (from $99A4, $99D0, $99D9) 0x0119F5|$04:$99E5:60 RTS ; control flow target (from $8012, $9B3F, $9B81, $9BA8, $A179) 0x0119F6|$04:$99E6:A5 8E LDA $8E ; flag for in battle or not (#$FF)? 0x0119F8|$04:$99E8:10 35 BPL $9A1F ; control flow target (from $9737) 0x0119FA|$04:$99EA:AD 2C 06 LDA $062C ; current battle message delay 0x0119FD|$04:$99ED:C9 FF CMP #$FF ; is it SLOW? 0x0119FF|$04:$99EF:D0 22 BNE $9A13 ; control flow target (from $99FF, $9A09) 0x011A01|$04:$99F1:20 4D 9A JSR $9A4D ; read joypad 1 data into $2F; if no button pressed, set $015D to #$00 0x011A04|$04:$99F4:AD 5D 01 LDA $015D 0x011A07|$04:$99F7:F0 0A BEQ $9A03 ; branch if no button pressed ; call to code in a different bank ($0F:$C1DC) 0x011A09|$04:$99F9:20 DC C1 JSR $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF 0x011A0C|$04:$99FC:CE 5D 01 DEC $015D 0x011A0F|$04:$99FF:D0 F0 BNE $99F1 0x011A11|$04:$9A01:F0 03 BEQ $9A06 ; control flow target (from $99F7) 0x011A13|$04:$9A03:20 20 9A JSR $9A20 ; write either [space] or [down triangle] to PPU $2358 based on the current value of $03 ; control flow target (from $9A01) 0x011A16|$04:$9A06:A5 2F LDA $2F ; joypad 1 data 0x011A18|$04:$9A08:6A ROR ; set C to "A" button status 0x011A19|$04:$9A09:90 E6 BCC $99F1 0x011A1B|$04:$9A0B:A9 32 LDA #$32 0x011A1D|$04:$9A0D:8D 5D 01 STA $015D 0x011A20|$04:$9A10:4C 2A 9A JMP $9A2A ; write [space] to PPU $2358 ; control flow target (from $99EF, $9A4B) ; call to code in a different bank ($0F:$C1F5) 0x011A23|$04:$9A13:20 F5 C1 JSR $C1F5 ; wait for battle message delay to expire ; set number of NMIs to wait for to current battle message delay if current battle message delay is not SLOW ; control flow target (from $94BC, $95FF, $9AE7) 0x011A26|$04:$9A16:AD 2C 06 LDA $062C ; current battle message delay 0x011A29|$04:$9A19:C9 FF CMP #$FF ; is it SLOW? 0x011A2B|$04:$9A1B:F0 02 BEQ $9A1F ; if yes, leave number of NMIs to wait for alone, otherwise set number of NMIs to wait for to battle message delay 0x011A2D|$04:$9A1D:85 93 STA $93 ; NMI counter, decremented once per NMI until it reaches 0 ; control flow target (from $99E8, $9A1B) 0x011A2F|$04:$9A1F:60 RTS ; write either [space] or [down triangle] to PPU $2358 based on the current value of $03 ; control flow target (from $9A03) 0x011A30|$04:$9A20:A5 03 LDA $03 ; game clock? 0x011A32|$04:$9A22:29 18 AND #$18 0x011A34|$04:$9A24:F0 04 BEQ $9A2A ; write [space] to PPU $2358 0x011A36|$04:$9A26:A9 73 LDA #$73 ; Tile ID #$73: [down triangle] 0x011A38|$04:$9A28:D0 02 BNE $9A2C ; write [space] to PPU $2358 ; control flow target (from $9A10, $9A24) 0x011A3A|$04:$9A2A:A9 5F LDA #$5F ; Tile ID #$5F: [space] ; control flow target (from $9A28) 0x011A3C|$04:$9A2C:85 09 STA $09 ; tile ID to write to PPU 0x011A3E|$04:$9A2E:A9 58 LDA #$58 0x011A40|$04:$9A30:85 07 STA $07 ; current PPU write address, low byte; PPU address, low byte 0x011A42|$04:$9A32:A9 23 LDA #$23 0x011A44|$04:$9A34:85 08 STA $08 ; current PPU write address, high byte; PPU address, high byte ; call to code in a different bank ($0F:$C1FA) 0x011A46|$04:$9A36:20 FA C1 JSR $C1FA ; wait for $02 to not be #$C0, write PPU address in $07-$08 and data in $09 to PPU write buffer at $0300,$02, $01 += 1, $02 += 3, and set $0183 to #$00 ; call to code in a different bank ($0F:$C1DC) 0x011A49|$04:$9A39:4C DC C1 JMP $C1DC ; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise ; control flow target (from $954D, $9574, $9582, $95D2, $95DD, $9696, $9734, $9765, $B3C2, $B49B) 0x011A4C|$04:$9A3C:AD 2C 06 LDA $062C ; current battle message delay 0x011A4F|$04:$9A3F:10 04 BPL $9A45 ; only SLOW sets bit 7 0x011A51|$04:$9A41:A9 64 LDA #$64 ; for SLOW, use #$64 0x011A53|$04:$9A43:D0 04 BNE $9A49 ; control flow target (from $9A3F) 0x011A55|$04:$9A45:4A LSR ; otherwise use current # of frames * 1.5 (i.e. #$3C [60] or #$69 [105]) 0x011A56|$04:$9A46:6D 2C 06 ADC $062C ; current battle message delay ; control flow target (from $9A43) 0x011A59|$04:$9A49:85 93 STA $93 ; NMI counter, decremented once per NMI until it reaches 0 0x011A5B|$04:$9A4B:D0 C6 BNE $9A13 ; branch always taken ; read joypad 1 data into $2F; if no button pressed, set $015D to #$00 ; control flow target (from $99F1, $9A5D) ; call to code in a different bank ($0F:$C476) 0x011A5D|$04:$9A4D:20 76 C4 JSR $C476 ; read joypad 1 data into $2F 0x011A60|$04:$9A50:A5 2F LDA $2F ; joypad 1 data 0x011A62|$04:$9A52:D0 03 BNE $9A57 0x011A64|$04:$9A54:8D 5D 01 STA $015D ; #$00 ; control flow target (from $9A52) 0x011A67|$04:$9A57:60 RTS ; control flow target (from $96B8, $9943) 0x011A68|$04:$9A58:A9 01 LDA #$01 0x011A6A|$04:$9A5A:8D 5D 01 STA $015D ; control flow target (from $9A67, $9A6B) 0x011A6D|$04:$9A5D:20 4D 9A JSR $9A4D ; read joypad 1 data into $2F; if no button pressed, set $015D to #$00 0x011A70|$04:$9A60:29 F0 AND #$F0 0x011A72|$04:$9A62:D0 09 BNE $9A6D 0x011A74|$04:$9A64:AD 5D 01 LDA $015D 0x011A77|$04:$9A67:D0 F4 BNE $9A5D 0x011A79|$04:$9A69:A5 2F LDA $2F ; joypad 1 data 0x011A7B|$04:$9A6B:F0 F0 BEQ $9A5D ; control flow target (from $9A62) 0x011A7D|$04:$9A6D:AD 17 40 LDA $4017 ; Joypad #2/SOFTCLK (READ: #$80: Vertical Clock Signal (External), #$40: Vertical Clock Signal (Internal), #$10: Zapper Trigger Not Pulled, #$08: Zapper Sprite Detection, #$01: Joypad Data; WRITE: #$01: set Expansion Port Method to Read) 0x011A80|$04:$9A70:6A ROR 0x011A81|$04:$9A71:90 10 BCC $9A83 0x011A83|$04:$9A73:A5 16 LDA $16 ; current map X-pos (1) 0x011A85|$04:$9A75:C9 EB CMP #$EB 0x011A87|$04:$9A77:D0 0A BNE $9A83 0x011A89|$04:$9A79:18 CLC 0x011A8A|$04:$9A7A:65 31 ADC $31 ; current map ID 0x011A8C|$04:$9A7C:65 17 ADC $17 ; current map Y-pos (1) 0x011A8E|$04:$9A7E:D0 03 BNE $9A83 0x011A90|$04:$9A80:EE 2C 06 INC $062C ; current battle message delay ; control flow target (from $9A71, $9A77, $9A7E) 0x011A93|$04:$9A83:60 RTS ; control flow target (from $9964, $A73E, $AA64) 0x011A94|$04:$9A84:A2 00 LDX #$00 0x011A96|$04:$9A86:86 C7 STX $C7 ; control flow target (from $9A99) 0x011A98|$04:$9A88:8A TXA 0x011A99|$04:$9A89:20 D2 9E JSR $9ED2 ; given an index (in A) into the array of structures at $0663, set $BF-$C0 to the address of the corresponding item inside that structure 0x011A9C|$04:$9A8C:A0 09 LDY #$09 0x011A9E|$04:$9A8E:B1 BF LDA ($BF),Y 0x011AA0|$04:$9A90:F0 04 BEQ $9A96 0x011AA2|$04:$9A92:E6 C7 INC $C7 0x011AA4|$04:$9A94:86 C8 STX $C8 ; control flow target (from $9A90) 0x011AA6|$04:$9A96:E8 INX 0x011AA7|$04:$9A97:E0 04 CPX #$04 0x011AA9|$04:$9A99:90 ED BCC $9A88 0x011AAB|$04:$9A9B:A4 C8 LDY $C8 0x011AAD|$04:$9A9D:A5 C7 LDA $C7 0x011AAF|$04:$9A9F:60 RTS ; control flow target (from $956E, $95D5, $B38F) 0x011AB0|$04:$9AA0:A9 32 LDA #$32 0x011AB2|$04:$9AA2:8D 2F 06 STA $062F ; Midenhall Battle Command 0x011AB5|$04:$9AA5:8D 41 06 STA $0641 ; Cannock Battle Command 0x011AB8|$04:$9AA8:8D 53 06 STA $0653 ; Moonbrooke Battle Command 0x011ABB|$04:$9AAB:60 RTS ; control flow target (from $94DF, $990A, $9BA1, $A1D2) 0x011ABC|$04:$9AAC:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 0x011ABF|$04:$9AAF:A9 01 LDA #$01 ; Menu ID #$01: Mini status window, top ; call to code in a different bank ($0F:$EB89) 0x011AC1|$04:$9AB1:4C 89 EB JMP $EB89 ; open menu specified by A ; control flow target (from $94E2, $B392, $B3BA, $B3ED, $B48D, $B4F7) 0x011AC4|$04:$9AB4:20 C7 9A JSR $9AC7 0x011AC7|$04:$9AB7:A5 B3 LDA $B3 0x011AC9|$04:$9AB9:29 80 AND #$80 0x011ACB|$04:$9ABB:09 0F ORA #$0F 0x011ACD|$04:$9ABD:85 B3 STA $B3 ; control flow target (from $9699, $973A) 0x011ACF|$04:$9ABF:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 0x011AD2|$04:$9AC2:A9 04 LDA #$04 ; Menu ID #$04: Dialogue window ; call to code in a different bank ($0F:$EB89) 0x011AD4|$04:$9AC4:4C 89 EB JMP $EB89 ; open menu specified by A ; control flow target (from $9AB4, $B32C) 0x011AD7|$04:$9AC7:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 0x011ADA|$04:$9ACA:A9 04 LDA #$04 ; control flow target (from $9AD4) ; call to code in a different bank ($0F:$F78C) 0x011ADC|$04:$9ACC:4C 8C F7 JMP $F78C ; wipe selected menu region 0x011ADF|$04:$9ACF:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 0x011AE2|$04:$9AD2:A9 06 LDA #$06 0x011AE4|$04:$9AD4:D0 F6 BNE $9ACC ; control flow target (from $9577, $95E0, $9961, $9AF8, $A168) 0x011AE6|$04:$9AD6:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 0x011AE9|$04:$9AD9:A9 0F LDA #$0F ; call to code in a different bank ($0F:$FBFF) 0x011AEB|$04:$9ADB:4C FF FB JMP $FBFF ; STA $B4, $B3 |= #$20 ; control flow target (from $A61E, $A69A, $AA22, $AEF6) 0x011AEE|$04:$9ADE:85 B4 STA $B4 0x011AF0|$04:$9AE0:A5 B3 LDA $B3 0x011AF2|$04:$9AE2:09 20 ORA #$20 0x011AF4|$04:$9AE4:85 B3 STA $B3 0x011AF6|$04:$9AE6:60 RTS ; control flow target (from $9CE2, $9CE7, $A24B, $A3A6, $A683, $A747, $AF7E) 0x011AF7|$04:$9AE7:20 16 9A JSR $9A16 ; set number of NMIs to wait for to current battle message delay if current battle message delay is not SLOW 0x011AFA|$04:$9AEA:A9 FF LDA #$FF 0x011AFC|$04:$9AEC:8D 76 01 STA $0176 0x011AFF|$04:$9AEF:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 0x011B02|$04:$9AF2:A5 B3 LDA $B3 0x011B04|$04:$9AF4:29 10 AND #$10 0x011B06|$04:$9AF6:D0 4A BNE $9B42 0x011B08|$04:$9AF8:20 D6 9A JSR $9AD6 0x011B0B|$04:$9AFB:A5 AB LDA $AB 0x011B0D|$04:$9AFD:85 99 STA $99 0x011B0F|$04:$9AFF:A5 AC LDA $AC 0x011B11|$04:$9B01:85 9A STA $9A 0x011B13|$04:$9B03:A5 AD LDA $AD 0x011B15|$04:$9B05:C9 E0 CMP #$E0 0x011B17|$04:$9B07:90 06 BCC $9B0F 0x011B19|$04:$9B09:29 1F AND #$1F 0x011B1B|$04:$9B0B:85 95 STA $95 ; ID for [item] and [spell] control codes 0x011B1D|$04:$9B0D:A9 1A LDA #$1A ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] ; control flow target (from $9B07) 0x011B1F|$04:$9B0F:85 9B STA $9B 0x011B21|$04:$9B11:20 B8 9B JSR $9BB8 0x011B24|$04:$9B14:A6 9C LDX $9C 0x011B26|$04:$9B16:CA DEX 0x011B27|$04:$9B17:D0 02 BNE $9B1B 0x011B29|$04:$9B19:A9 1F LDA #$1F ; control flow target (from $9B17) 0x011B2B|$04:$9B1B:CA DEX 0x011B2C|$04:$9B1C:D0 02 BNE $9B20 0x011B2E|$04:$9B1E:A9 1E LDA #$1E ; control flow target (from $9B1C) 0x011B30|$04:$9B20:CA DEX 0x011B31|$04:$9B21:D0 02 BNE $9B25 0x011B33|$04:$9B23:A9 1C LDA #$1C ; control flow target (from $9B21) 0x011B35|$04:$9B25:CA DEX 0x011B36|$04:$9B26:D0 02 BNE $9B2A 0x011B38|$04:$9B28:A9 18 LDA #$18 ; control flow target (from $9B26) 0x011B3A|$04:$9B2A:85 99 STA $99 0x011B3C|$04:$9B2C:A5 B3 LDA $B3 0x011B3E|$04:$9B2E:29 F0 AND #$F0 0x011B40|$04:$9B30:05 99 ORA $99 0x011B42|$04:$9B32:85 B3 STA $B3 0x011B44|$04:$9B34:29 40 AND #$40 0x011B46|$04:$9B36:F0 07 BEQ $9B3F 0x011B48|$04:$9B38:A5 B3 LDA $B3 0x011B4A|$04:$9B3A:29 BF AND #$BF 0x011B4C|$04:$9B3C:4C 9F 9B JMP $9B9F ; control flow target (from $9B36) 0x011B4F|$04:$9B3F:20 E6 99 JSR $99E6 ; control flow target (from $9AF6) 0x011B52|$04:$9B42:A5 B3 LDA $B3 0x011B54|$04:$9B44:29 0F AND #$0F ; call to code in a different bank ($0F:$FBFF) 0x011B56|$04:$9B46:20 FF FB JSR $FBFF 0x011B59|$04:$9B49:A5 B3 LDA $B3 0x011B5B|$04:$9B4B:29 20 AND #$20 0x011B5D|$04:$9B4D:F0 35 BEQ $9B84 0x011B5F|$04:$9B4F:A5 B4 LDA $B4 0x011B61|$04:$9B51:C9 0D CMP #$0D 0x011B63|$04:$9B53:F0 0A BEQ $9B5F 0x011B65|$04:$9B55:C9 0E CMP #$0E 0x011B67|$04:$9B57:F0 06 BEQ $9B5F 0x011B69|$04:$9B59:C9 07 CMP #$07 0x011B6B|$04:$9B5B:F0 0A BEQ $9B67 0x011B6D|$04:$9B5D:D0 1D BNE $9B7C ; control flow target (from $9B53, $9B57) 0x011B6F|$04:$9B5F:A9 88 LDA #$88 ; Music ID #$88: critical hit SFX ; call to code in a different bank ($0F:$C561) 0x011B71|$04:$9B61:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x011B74|$04:$9B64:4C 7C 9B JMP $9B7C ; control flow target (from $9B5B) 0x011B77|$04:$9B67:A5 AB LDA $AB 0x011B79|$04:$9B69:30 04 BMI $9B6F 0x011B7B|$04:$9B6B:A9 8D LDA #$8D ; Music ID #$8D: miss 2 SFX 0x011B7D|$04:$9B6D:D0 02 BNE $9B71 ; control flow target (from $9B69) 0x011B7F|$04:$9B6F:A9 8C LDA #$8C ; Music ID #$8C: miss 1 SFX ; control flow target (from $9B6D) ; call to code in a different bank ($0F:$C561) 0x011B81|$04:$9B71:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x011B84|$04:$9B74:A5 B4 LDA $B4 0x011B86|$04:$9B76:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011B89|$04:$9B79:4C 84 9B JMP $9B84 ; control flow target (from $9B5D, $9B64) 0x011B8C|$04:$9B7C:A5 B4 LDA $B4 0x011B8E|$04:$9B7E:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x011B91|$04:$9B81:20 E6 99 JSR $99E6 ; control flow target (from $9B4D, $9B79) 0x011B94|$04:$9B84:A5 B0 LDA $B0 0x011B96|$04:$9B86:85 8F STA $8F 0x011B98|$04:$9B88:A5 B1 LDA $B1 0x011B9A|$04:$9B8A:85 90 STA $90 0x011B9C|$04:$9B8C:A5 AE LDA $AE 0x011B9E|$04:$9B8E:85 99 STA $99 0x011BA0|$04:$9B90:A5 AF LDA $AF 0x011BA2|$04:$9B92:85 9A STA $9A 0x011BA4|$04:$9B94:A5 B2 LDA $B2 0x011BA6|$04:$9B96:85 9B STA $9B 0x011BA8|$04:$9B98:20 B8 9B JSR $9BB8 0x011BAB|$04:$9B9B:A5 B3 LDA $B3 0x011BAD|$04:$9B9D:29 DF AND #$DF ; control flow target (from $9B3C) 0x011BAF|$04:$9B9F:85 B3 STA $B3 0x011BB1|$04:$9BA1:20 AC 9A JSR $9AAC 0x011BB4|$04:$9BA4:A5 98 LDA $98 ; outcome of last fight? 0x011BB6|$04:$9BA6:D0 03 BNE $9BAB 0x011BB8|$04:$9BA8:20 E6 99 JSR $99E6 ; control flow target (from $9BA6) 0x011BBB|$04:$9BAB:60 RTS ; control flow target (from $9BF9) 0x011BBC|$04:$9BAC:A0 03 LDY #$03 ; control flow target (from $9BB4) 0x011BBE|$04:$9BAE:D9 72 01 CMP $0172,Y 0x011BC1|$04:$9BB1:F0 04 BEQ $9BB7 0x011BC3|$04:$9BB3:88 DEY 0x011BC4|$04:$9BB4:10 F8 BPL $9BAE 0x011BC6|$04:$9BB6:18 CLC ; control flow target (from $9BB1) 0x011BC7|$04:$9BB7:60 RTS ; control flow target (from $9B11, $9B98) 0x011BC8|$04:$9BB8:A5 99 LDA $99 0x011BCA|$04:$9BBA:C9 F0 CMP #$F0 0x011BCC|$04:$9BBC:90 08 BCC $9BC6 0x011BCE|$04:$9BBE:49 FF EOR #$FF 0x011BD0|$04:$9BC0:20 D0 9C JSR $9CD0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA 0x011BD3|$04:$9BC3:4C 4D 9C JMP $9C4D ; if $9B < #$60, display string ID specified by $9B, otherwise display string ID specified by $9B + #$A0; play extra SFX ; control flow target (from $9BBC) 0x011BD6|$04:$9BC6:A5 9A LDA $9A 0x011BD8|$04:$9BC8:A2 00 LDX #$00 0x011BDA|$04:$9BCA:29 30 AND #$30 0x011BDC|$04:$9BCC:F0 10 BEQ $9BDE 0x011BDE|$04:$9BCE:C9 20 CMP #$20 0x011BE0|$04:$9BD0:90 0A BCC $9BDC 0x011BE2|$04:$9BD2:F0 04 BEQ $9BD8 0x011BE4|$04:$9BD4:A2 21 LDX #$21 0x011BE6|$04:$9BD6:D0 06 BNE $9BDE ; control flow target (from $9BD2) 0x011BE8|$04:$9BD8:A2 16 LDX #$16 0x011BEA|$04:$9BDA:D0 02 BNE $9BDE ; control flow target (from $9BD0) 0x011BEC|$04:$9BDC:A2 0B LDX #$0B ; control flow target (from $9BCC, $9BD6, $9BDA) 0x011BEE|$04:$9BDE:A5 9A LDA $9A 0x011BF0|$04:$9BE0:29 0F AND #$0F 0x011BF2|$04:$9BE2:F0 12 BEQ $9BF6 0x011BF4|$04:$9BE4:85 9F STA $9F 0x011BF6|$04:$9BE6:8A TXA 0x011BF7|$04:$9BE7:18 CLC 0x011BF8|$04:$9BE8:65 9F ADC $9F 0x011BFA|$04:$9BEA:AA TAX 0x011BFB|$04:$9BEB:BD 63 06 LDA $0663,X ; monster ID, group 1 0x011BFE|$04:$9BEE:29 07 AND #$07 0x011C00|$04:$9BF0:85 9F STA $9F 0x011C02|$04:$9BF2:AA TAX 0x011C03|$04:$9BF3:BD 6A 01 LDA $016A,X ; control flow target (from $9BE2) 0x011C06|$04:$9BF6:AA TAX 0x011C07|$04:$9BF7:A5 99 LDA $99 0x011C09|$04:$9BF9:20 AC 9B JSR $9BAC 0x011C0C|$04:$9BFC:90 0A BCC $9C08 0x011C0E|$04:$9BFE:A4 9B LDY $9B 0x011C10|$04:$9C00:C0 19 CPY #$19 0x011C12|$04:$9C02:F0 04 BEQ $9C08 0x011C14|$04:$9C04:C0 24 CPY #$24 0x011C16|$04:$9C06:D0 02 BNE $9C0A ; control flow target (from $9BFC, $9C02) 0x011C18|$04:$9C08:A2 00 LDX #$00 ; control flow target (from $9C06) 0x011C1A|$04:$9C0A:20 D6 9C JSR $9CD6 ; write monster name in A (+ monster number within its group in X, if > 0) to $6119 0x011C1D|$04:$9C0D:20 BC 9C JSR $9CBC ; if $9B < #$60, display string ID specified by $9B, otherwise display string ID specified by $9B + #$A0 0x011C20|$04:$9C10:A5 9A LDA $9A 0x011C22|$04:$9C12:29 30 AND #$30 0x011C24|$04:$9C14:4A LSR 0x011C25|$04:$9C15:4A LSR 0x011C26|$04:$9C16:4A LSR 0x011C27|$04:$9C17:4A LSR 0x011C28|$04:$9C18:AA TAX 0x011C29|$04:$9C19:A5 9A LDA $9A 0x011C2B|$04:$9C1B:29 0F AND #$0F 0x011C2D|$04:$9C1D:A8 TAY 0x011C2E|$04:$9C1E:A5 9B LDA $9B 0x011C30|$04:$9C20:C9 06 CMP #$06 0x011C32|$04:$9C22:F0 5E BEQ $9C82 0x011C34|$04:$9C24:C9 0B CMP #$0B 0x011C36|$04:$9C26:F0 5F BEQ $9C87 0x011C38|$04:$9C28:C9 0F CMP #$0F 0x011C3A|$04:$9C2A:F0 5E BEQ $9C8A 0x011C3C|$04:$9C2C:C9 19 CMP #$19 0x011C3E|$04:$9C2E:F0 5F BEQ $9C8F 0x011C40|$04:$9C30:C9 24 CMP #$24 0x011C42|$04:$9C32:F0 5B BEQ $9C8F 0x011C44|$04:$9C34:C9 26 CMP #$26 0x011C46|$04:$9C36:F0 57 BEQ $9C8F 0x011C48|$04:$9C38:C9 15 CMP #$15 0x011C4A|$04:$9C3A:F0 67 BEQ $9CA3 0x011C4C|$04:$9C3C:C9 2C CMP #$2C 0x011C4E|$04:$9C3E:F0 63 BEQ $9CA3 0x011C50|$04:$9C40:C9 1A CMP #$1A 0x011C52|$04:$9C42:F0 57 BEQ $9C9B 0x011C54|$04:$9C44:C9 33 CMP #$33 0x011C56|$04:$9C46:F0 32 BEQ $9C7A 0x011C58|$04:$9C48:C9 0A CMP #$0A 0x011C5A|$04:$9C4A:F0 2A BEQ $9C76 0x011C5C|$04:$9C4C:60 RTS ; if $9B < #$60, display string ID specified by $9B, otherwise display string ID specified by $9B + #$A0; play extra SFX ; control flow target (from $9BC3) 0x011C5D|$04:$9C4D:20 BC 9C JSR $9CBC ; if $9B < #$60, display string ID specified by $9B, otherwise display string ID specified by $9B + #$A0 0x011C60|$04:$9C50:A5 9B LDA $9B 0x011C62|$04:$9C52:C9 06 CMP #$06 0x011C64|$04:$9C54:F0 28 BEQ $9C7E 0x011C66|$04:$9C56:C9 0C CMP #$0C 0x011C68|$04:$9C58:F0 4C BEQ $9CA6 0x011C6A|$04:$9C5A:C9 2F CMP #$2F 0x011C6C|$04:$9C5C:F0 48 BEQ $9CA6 0x011C6E|$04:$9C5E:C9 30 CMP #$30 0x011C70|$04:$9C60:F0 44 BEQ $9CA6 0x011C72|$04:$9C62:C9 1A CMP #$1A 0x011C74|$04:$9C64:F0 35 BEQ $9C9B 0x011C76|$04:$9C66:C9 0A CMP #$0A 0x011C78|$04:$9C68:F0 08 BEQ $9C72 0x011C7A|$04:$9C6A:C9 17 CMP #$17 0x011C7C|$04:$9C6C:F0 01 BEQ $9C6F 0x011C7E|$04:$9C6E:60 RTS ; control flow target (from $9C6C) 0x011C7F|$04:$9C6F:4C F1 A0 JMP $A0F1 ; control flow target (from $9C68) 0x011C82|$04:$9C72:A9 8D LDA #$8D ; Music ID #$8D: miss 2 SFX 0x011C84|$04:$9C74:D0 0E BNE $9C84 ; control flow target (from $9C4A) 0x011C86|$04:$9C76:A9 8C LDA #$8C ; Music ID #$8C: miss 1 SFX 0x011C88|$04:$9C78:D0 0A BNE $9C84 ; control flow target (from $9C46) 0x011C8A|$04:$9C7A:A9 94 LDA #$94 ; Music ID #$94: burning SFX 0x011C8C|$04:$9C7C:D0 06 BNE $9C84 ; control flow target (from $9C54) 0x011C8E|$04:$9C7E:A9 89 LDA #$89 ; Music ID #$89: attack 1 SFX 0x011C90|$04:$9C80:D0 02 BNE $9C84 ; control flow target (from $9C22) 0x011C92|$04:$9C82:A9 8B LDA #$8B ; Music ID #$8B: attack 2 SFX ; control flow target (from $9C74, $9C78, $9C7C, $9C80) ; call to code in a different bank ($0F:$C561) 0x011C94|$04:$9C84:4C 61 C5 JMP $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) ; control flow target (from $9C26) 0x011C97|$04:$9C87:4C B0 8A JMP $8AB0 ; control flow target (from $9C2A) 0x011C9A|$04:$9C8A:A9 83 LDA #$83 ; Music ID #$83: flee SFX 0x011C9C|$04:$9C8C:20 AC 9C JSR $9CAC ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]); preserves X/Y ; control flow target (from $9C2E, $9C32, $9C36) 0x011C9F|$04:$9C8F:20 F1 8A JSR $8AF1 0x011CA2|$04:$9C92:A5 9F LDA $9F 0x011CA4|$04:$9C94:AA TAX 0x011CA5|$04:$9C95:A9 FF LDA #$FF 0x011CA7|$04:$9C97:9D 62 01 STA $0162,X 0x011CAA|$04:$9C9A:60 RTS ; control flow target (from $9C42, $9C64) 0x011CAB|$04:$9C9B:A9 90 LDA #$90 ; Music ID #$90: casting SFX ; call to code in a different bank ($0F:$C561) 0x011CAD|$04:$9C9D:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) ; call to code in a different bank ($0F:$C515) 0x011CB0|$04:$9CA0:4C 15 C5 JMP $C515 ; flash screen 10 times ; control flow target (from $9C3A, $9C3E) 0x011CB3|$04:$9CA3:4C 9E 8A JMP $8A9E ; control flow target (from $9C58, $9C5C, $9C60) 0x011CB6|$04:$9CA6:20 F1 A0 JSR $A0F1 0x011CB9|$04:$9CA9:4C E2 8F JMP $8FE2 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]); preserves X/Y ; control flow target (from $9C8C) 0x011CBC|$04:$9CAC:85 9D STA $9D 0x011CBE|$04:$9CAE:8A TXA 0x011CBF|$04:$9CAF:48 PHA 0x011CC0|$04:$9CB0:98 TYA 0x011CC1|$04:$9CB1:48 PHA 0x011CC2|$04:$9CB2:A5 9D LDA $9D ; call to code in a different bank ($0F:$C561) 0x011CC4|$04:$9CB4:20 61 C5 JSR $C561 ; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]) 0x011CC7|$04:$9CB7:68 PLA 0x011CC8|$04:$9CB8:A8 TAY 0x011CC9|$04:$9CB9:68 PLA 0x011CCA|$04:$9CBA:AA TAX 0x011CCB|$04:$9CBB:60 RTS ; if $9B < #$60, display string ID specified by $9B, otherwise display string ID specified by $9B + #$A0 ; control flow target (from $9C0D, $9C4D) 0x011CCC|$04:$9CBC:A5 9B LDA $9B ; if A < #$60, display string ID specified by A, otherwise display string ID specified by A + #$A0 ; control flow target (from $9CCD) 0x011CCE|$04:$9CBE:C9 60 CMP #$60 0x011CD0|$04:$9CC0:90 05 BCC $9CC7 ; display string ID specified by A 0x011CD2|$04:$9CC2:E9 60 SBC #$60 ; call to code in a different bank ($0F:$FA4E) 0x011CD4|$04:$9CC4:4C 4E FA JMP $FA4E ; display string ID specified by A + #$0100 ; display string ID specified by A ; control flow target (from $9CC0) ; call to code in a different bank ($0F:$FA4A) 0x011CD7|$04:$9CC7:4C 4A FA JMP $FA4A ; display string ID specified by A ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 ; control flow target (from $952F, $9540, $9563, $956B, $957F, $959F, $95DA, $96B5, $974C, $976A, $9806, $9825, $9830, $9844, $98CB, $9907, $991E, $992F, $9B76, $9B7E, $B3BF, $B498) 0x011CDA|$04:$9CCA:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 0x011CDD|$04:$9CCD:4C BE 9C JMP $9CBE ; if A < #$60, display string ID specified by A, otherwise display string ID specified by A + #$A0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA ; control flow target (from $96B0, $9820, $983B, $98FF, $998E, $9BC0, $B493) 0x011CE0|$04:$9CD0:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 ; call to code in a different bank ($0F:$FC50) 0x011CE3|$04:$9CD3:4C 50 FC JMP $FC50 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA ; write monster name in A (+ monster number within its group in X, if > 0) to $6119 ; control flow target (from $9518, $9747, $9801, $9978, $9C0A) 0x011CE6|$04:$9CD6:20 EA 9C JSR $9CEA ; set return bank $94 to #$04 ; call to code in a different bank ($0F:$FC89) 0x011CE9|$04:$9CD9:4C 89 FC JMP $FC89 ; write monster name in A (+ monster number within its group in X, if > 0) to $6119 ; control flow target (from $9647, $A12B, $A149, $A4D7, $A8CB, $AA4E, $AA6D) 0x011CEC|$04:$9CDC:A5 B3 LDA $B3 0x011CEE|$04:$9CDE:09 40 ORA #$40 0x011CF0|$04:$9CE0:85 B3 STA $B3 0x011CF2|$04:$9CE2:4C E7 9A JMP $9AE7 ; control flow target (from $A160, $A1DE, $A261, $A342, $A36C, $A44D, $A564, $A673, $A9FC, $AB64, $AC49, $ACB5, $ACF1, $AD1A, $AD2A, $AD5B, $ADCB, $AE12, $AE6A, $AE86, $AEFB) 0x011CF5|$04:$9CE5:85 B2 STA $B2 0x011CF7|$04:$9CE7:4C E7 9A JMP $9AE7 ; set return bank $94 to #$04 ; control flow target (from $98C0, $993D, $9AAC, $9ABF, $9AC7, $9ACF, $9AD6, $9AEF, $9CCA, $9CD0, $9CD6) 0x011CFA|$04:$9CEA:48 PHA 0x011CFB|$04:$9CEB:A9 04 LDA #$04 0x011CFD|$04:$9CED:85 94 STA $94 ; return bank for various function calls, doubles as index of selected option for multiple-choice menus 0x011CFF|$04:$9CEF:68 PLA 0x011D00|$04:$9CF0:60 RTS ; set $8F-$90 to EXP required to reach next level ; control flow target (from $800C) 0x011D01|$04:$9CF1:85 A7 STA $A7 0x011D03|$04:$9CF3:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x011D06|$04:$9CF6:A0 06 LDY #$06 ; offset into hero data for current EXP byte 0 0x011D08|$04:$9CF8:B1 B9 LDA ($B9),Y 0x011D0A|$04:$9CFA:8D 26 06 STA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x011D0D|$04:$9CFD:C8 INY 0x011D0E|$04:$9CFE:B1 B9 LDA ($B9),Y 0x011D10|$04:$9D00:8D 27 06 STA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x011D13|$04:$9D03:C8 INY 0x011D14|$04:$9D04:B1 B9 LDA ($B9),Y 0x011D16|$04:$9D06:8D 28 06 STA $0628 ; EXP earned this battle or current hero's current EXP, byte 2 0x011D19|$04:$9D09:A6 A7 LDX $A7 0x011D1B|$04:$9D0B:4C 43 9D JMP $9D43 ; given hero ID in X and hero's current EXP in $0626-$0628, set $8F-$90 to EXP required to reach next level; return current level in A ; update each hero's stats based on their current EXP ; control flow target (from $8009) 0x011D1E|$04:$9D0E:A9 00 LDA #$00 ; Midenhall 0x011D20|$04:$9D10:8D DF 06 STA $06DF ; hero ID ; control flow target (from $9D3D) 0x011D23|$04:$9D13:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x011D26|$04:$9D16:A0 06 LDY #$06 ; offset into hero data for current EXP byte 0 0x011D28|$04:$9D18:B1 B9 LDA ($B9),Y 0x011D2A|$04:$9D1A:8D 26 06 STA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x011D2D|$04:$9D1D:C8 INY 0x011D2E|$04:$9D1E:B1 B9 LDA ($B9),Y 0x011D30|$04:$9D20:8D 27 06 STA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x011D33|$04:$9D23:C8 INY 0x011D34|$04:$9D24:B1 B9 LDA ($B9),Y 0x011D36|$04:$9D26:8D 28 06 STA $0628 ; EXP earned this battle or current hero's current EXP, byte 2 0x011D39|$04:$9D29:AE DF 06 LDX $06DF ; hero ID 0x011D3C|$04:$9D2C:20 43 9D JSR $9D43 ; given hero ID in X and hero's current EXP in $0626-$0628, set $8F-$90 to EXP required to reach next level; return current level in A 0x011D3F|$04:$9D2F:AE DF 06 LDX $06DF ; hero ID 0x011D42|$04:$9D32:20 C8 9D JSR $9DC8 ; calculate hero X stats for level A 0x011D45|$04:$9D35:EE DF 06 INC $06DF ; hero ID 0x011D48|$04:$9D38:AD DF 06 LDA $06DF ; 3 heroes total 0x011D4B|$04:$9D3B:C9 03 CMP #$03 0x011D4D|$04:$9D3D:90 D4 BCC $9D13 0x011D4F|$04:$9D3F:60 RTS ; code -> data ; per-hero offsets into required EXP lists ; indexed data load target (from $9D43) 0x011D50|$04:$9D40:00 ; Midenhall 0x011D51|$04:$9D41:62 ; Cannock 0x011D52|$04:$9D42:BA ; Moonbrooke ; data -> code ; given hero ID in X and hero's current EXP in $0626-$0628, set $8F-$90 to EXP required to reach next level; return current level in A ; control flow target (from $98E3, $9D0B, $9D2C) 0x011D53|$04:$9D43:BD 40 9D LDA $9D40,X ; per-hero offsets into required EXP lists 0x011D56|$04:$9D46:AA TAX 0x011D57|$04:$9D47:A9 00 LDA #$00 0x011D59|$04:$9D49:8D 29 06 STA $0629 ; current hero's required EXP, byte 0 0x011D5C|$04:$9D4C:8D 2A 06 STA $062A ; current hero's required EXP, byte 1 0x011D5F|$04:$9D4F:8D 2B 06 STA $062B ; current hero's required EXP, byte 2 0x011D62|$04:$9D52:A9 01 LDA #$01 0x011D64|$04:$9D54:85 A7 STA $A7 ; start at level 1 ; control flow target (from $9DAB) 0x011D66|$04:$9D56:A0 00 LDY #$00 ; normally byte 2 of the required EXP is #$00... 0x011D68|$04:$9D58:E0 F2 CPX #$F2 ; i.e. $BDB5, a.k.a. start of Moonbrooke's level 30 EXP 0x011D6A|$04:$9D5A:90 02 BCC $9D5E 0x011D6C|$04:$9D5C:A0 01 LDY #$01 ; ... but Moonbrooke's level 30+ each take an extra 65536 EXP that isn't contained in the (2 byte per level) required EXP table ; control flow target (from $9D5A) 0x011D6E|$04:$9D5E:BD C3 BC LDA $BCC3,X ; EXP per level, low byte 0x011D71|$04:$9D61:DD C4 BC CMP $BCC4,X ; EXP per level, high byte 0x011D74|$04:$9D64:F0 5C BEQ $9DC2 ; hero at max level; write 0 EXP remaining until next level to $8F-$90; but low byte is never equal to high byte, so this is pointless; would make sense if e.g. list was terminated with #$00 #$00 0x011D76|$04:$9D66:18 CLC 0x011D77|$04:$9D67:6D 29 06 ADC $0629 ; current hero's required EXP, byte 0 0x011D7A|$04:$9D6A:8D 29 06 STA $0629 ; current hero's required EXP, byte 0 0x011D7D|$04:$9D6D:BD C4 BC LDA $BCC4,X ; EXP per level, high byte 0x011D80|$04:$9D70:6D 2A 06 ADC $062A ; current hero's required EXP, byte 1 0x011D83|$04:$9D73:8D 2A 06 STA $062A ; current hero's required EXP, byte 1 0x011D86|$04:$9D76:98 TYA 0x011D87|$04:$9D77:6D 2B 06 ADC $062B ; current hero's required EXP, byte 2 0x011D8A|$04:$9D7A:8D 2B 06 STA $062B ; current hero's required EXP, byte 2 0x011D8D|$04:$9D7D:AD 2B 06 LDA $062B ; current hero's required EXP, byte 2 0x011D90|$04:$9D80:CD 28 06 CMP $0628 ; EXP earned this battle or current hero's current EXP, byte 2 0x011D93|$04:$9D83:90 16 BCC $9D9B ; required EXP < current EXP; increment level, check for end of list, loop to next level 0x011D95|$04:$9D85:D0 27 BNE $9DAE ; required EXP > current EXP; write EXP remaining until next level to $8F-$90 (but what about Moonbrooke's extra 65536 EXP?) 0x011D97|$04:$9D87:AD 2A 06 LDA $062A ; current hero's required EXP, byte 1 0x011D9A|$04:$9D8A:CD 27 06 CMP $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x011D9D|$04:$9D8D:90 0C BCC $9D9B ; required EXP < current EXP; increment level, check for end of list, loop to next level 0x011D9F|$04:$9D8F:D0 1D BNE $9DAE ; required EXP > current EXP; write EXP remaining until next level to $8F-$90 (but what about Moonbrooke's extra 65536 EXP?) 0x011DA1|$04:$9D91:AD 29 06 LDA $0629 ; current hero's required EXP, byte 0 0x011DA4|$04:$9D94:CD 26 06 CMP $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x011DA7|$04:$9D97:90 02 BCC $9D9B ; required EXP < current EXP; increment level, check for end of list, loop to next level 0x011DA9|$04:$9D99:D0 13 BNE $9DAE ; required EXP > current EXP; write EXP remaining until next level to $8F-$90 (but what about Moonbrooke's extra 65536 EXP?) ; required EXP < current EXP; increment level, check for end of list, loop to next level ; control flow target (from $9D83, $9D8D, $9D97) 0x011DAB|$04:$9D9B:E6 A7 INC $A7 ; move to next level 0x011DAD|$04:$9D9D:E8 INX ; 2 bytes of data per level 0x011DAE|$04:$9D9E:E8 INX 0x011DAF|$04:$9D9F:E0 62 CPX #$62 ; end of Midenhall's data 0x011DB1|$04:$9DA1:F0 1F BEQ $9DC2 ; hero at max level; write 0 EXP remaining until next level to $8F-$90 0x011DB3|$04:$9DA3:E0 BA CPX #$BA ; end of Cannock's data 0x011DB5|$04:$9DA5:F0 1B BEQ $9DC2 ; hero at max level; write 0 EXP remaining until next level to $8F-$90 0x011DB7|$04:$9DA7:E0 FE CPX #$FE ; end of Moonbrooke's data 0x011DB9|$04:$9DA9:F0 17 BEQ $9DC2 ; hero at max level; write 0 EXP remaining until next level to $8F-$90 0x011DBB|$04:$9DAB:4C 56 9D JMP $9D56 ; loop to calculate next level ; required EXP > current EXP; write EXP remaining until next level to $8F-$90 (but what about Moonbrooke's extra 65536 EXP?) ; control flow target (from $9D85, $9D8F, $9D99) 0x011DBE|$04:$9DAE:AD 29 06 LDA $0629 ; current hero's required EXP, byte 0 0x011DC1|$04:$9DB1:38 SEC 0x011DC2|$04:$9DB2:ED 26 06 SBC $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x011DC5|$04:$9DB5:85 8F STA $8F 0x011DC7|$04:$9DB7:AD 2A 06 LDA $062A ; current hero's required EXP, byte 1 0x011DCA|$04:$9DBA:ED 27 06 SBC $0627 ; EXP earned this battle or current hero's current EXP, byte 1 ; control flow target (from $9DC6) 0x011DCD|$04:$9DBD:85 90 STA $90 0x011DCF|$04:$9DBF:A5 A7 LDA $A7 0x011DD1|$04:$9DC1:60 RTS ; hero at max level; write 0 EXP remaining until next level to $8F-$90 ; control flow target (from $9D64, $9DA1, $9DA5, $9DA9) 0x011DD2|$04:$9DC2:A9 00 LDA #$00 0x011DD4|$04:$9DC4:85 8F STA $8F 0x011DD6|$04:$9DC6:F0 F5 BEQ $9DBD ; calculate hero X stats for level A ; control flow target (from $98F5, $9D32) 0x011DD8|$04:$9DC8:85 A7 STA $A7 ; level 0x011DDA|$04:$9DCA:86 A8 STX $A8 ; hero 0x011DDC|$04:$9DCC:8A TXA 0x011DDD|$04:$9DCD:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x011DE0|$04:$9DD0:A5 A8 LDA $A8 ; hero 0x011DE2|$04:$9DD2:0A ASL 0x011DE3|$04:$9DD3:AA TAX ; 4 level up stats are pack into 2 bytes 0x011DE4|$04:$9DD4:0A ASL 0x011DE5|$04:$9DD5:A8 TAY ; starting stats are 1 per byte (since they can't fit into a nybble) 0x011DE6|$04:$9DD6:A9 01 LDA #$01 0x011DE8|$04:$9DD8:85 A9 STA $A9 ; start calculating from level 1 0x011DEA|$04:$9DDA:A9 00 LDA #$00 0x011DEC|$04:$9DDC:85 B3 STA $B3 ; # of spells learned this level (maybe just flag) 0x011DEE|$04:$9DDE:B9 C1 BD LDA $BDC1,Y ; starting STR 0x011DF1|$04:$9DE1:85 99 STA $99 0x011DF3|$04:$9DE3:B9 C2 BD LDA $BDC2,Y ; starting AGI 0x011DF6|$04:$9DE6:85 9A STA $9A 0x011DF8|$04:$9DE8:B9 C3 BD LDA $BDC3,Y ; starting Max HP 0x011DFB|$04:$9DEB:85 9B STA $9B 0x011DFD|$04:$9DED:B9 C4 BD LDA $BDC4,Y ; starting Max MP 0x011E00|$04:$9DF0:85 9C STA $9C ; control flow target (from $9E1E) 0x011E02|$04:$9DF2:A5 A9 LDA $A9 ; current level 0x011E04|$04:$9DF4:C5 A7 CMP $A7 ; desired level 0x011E06|$04:$9DF6:B0 29 BCS $9E21 ; if we've finished calculating up to the desired level, we're done with this loop 0x011E08|$04:$9DF8:A0 00 LDY #$00 ; start with stat #$00 (STR) 0x011E0A|$04:$9DFA:20 97 9E JSR $9E97 ; process high nybble of level up data 0x011E0D|$04:$9DFD:BD CD BD LDA $BDCD,X ; level up stat nybbles (STR/AGI, HP/MP) 0x011E10|$04:$9E00:20 9E 9E JSR $9E9E ; process low nybble of level up data 0x011E13|$04:$9E03:E8 INX ; move to next byte of level up data (Max HP/MP) 0x011E14|$04:$9E04:20 97 9E JSR $9E97 ; process high nybble of level up data 0x011E17|$04:$9E07:BD CD BD LDA $BDCD,X ; level up stat nybbles (STR/AGI, HP/MP) 0x011E1A|$04:$9E0A:20 9E 9E JSR $9E9E ; process low nybble of level up data 0x011E1D|$04:$9E0D:E6 A9 INC $A9 ; current level++ 0x011E1F|$04:$9E0F:A5 A9 LDA $A9 0x011E21|$04:$9E11:C9 2E CMP #$2E ; only Midenhall has level up data for levels > 45, so in that case the next byte of level up data is his too 0x011E23|$04:$9E13:B0 08 BCS $9E1D 0x011E25|$04:$9E15:C9 24 CMP #$24 ; only Midenhall and Cannock have level up data for levels > 35, so in those cases we need to skip an extra 2 bytes for the other hero's data 0x011E27|$04:$9E17:B0 02 BCS $9E1B 0x011E29|$04:$9E19:E8 INX ; otherwise all 3 heroes have level up data, so skip over the data for the 2 other heroes 0x011E2A|$04:$9E1A:E8 INX ; control flow target (from $9E17) 0x011E2B|$04:$9E1B:E8 INX 0x011E2C|$04:$9E1C:E8 INX ; control flow target (from $9E13) 0x011E2D|$04:$9E1D:E8 INX 0x011E2E|$04:$9E1E:4C F2 9D JMP $9DF2 ; loop to calculate next level ; update hero stats and spell lists ; control flow target (from $9DF6) 0x011E31|$04:$9E21:A0 11 LDY #$11 ; offset into hero data for level 0x011E33|$04:$9E23:A5 A7 LDA $A7 ; current level 0x011E35|$04:$9E25:91 C3 STA ($C3),Y ; update hero's current level 0x011E37|$04:$9E27:A0 09 LDY #$09 ; offset for STR 0x011E39|$04:$9E29:A5 99 LDA $99 ; current STR 0x011E3B|$04:$9E2B:91 C3 STA ($C3),Y ; update hero's current STR 0x011E3D|$04:$9E2D:C8 INY 0x011E3E|$04:$9E2E:A5 9A LDA $9A ; current AGI 0x011E40|$04:$9E30:91 C3 STA ($C3),Y ; update hero's current AGI 0x011E42|$04:$9E32:A0 03 LDY #$03 ; offset for Max HP 0x011E44|$04:$9E34:A5 9B LDA $9B ; Max HP 0x011E46|$04:$9E36:91 C3 STA ($C3),Y ; update hero's Max HP 0x011E48|$04:$9E38:C8 INY 0x011E49|$04:$9E39:A9 00 LDA #$00 0x011E4B|$04:$9E3B:91 C3 STA ($C3),Y ; set high byte of Max HP to #$00 0x011E4D|$04:$9E3D:C8 INY 0x011E4E|$04:$9E3E:A5 9C LDA $9C ; Max MP 0x011E50|$04:$9E40:91 C3 STA ($C3),Y ; update hero's Max MP 0x011E52|$04:$9E42:46 9A LSR $9A ; AGI / 2 = hero's base DEF 0x011E54|$04:$9E44:A5 A8 LDA $A8 ; hero 0x011E56|$04:$9E46:0A ASL ; 8 inventory items per hero 0x011E57|$04:$9E47:0A ASL 0x011E58|$04:$9E48:0A ASL 0x011E59|$04:$9E49:AA TAX 0x011E5A|$04:$9E4A:86 A7 STX $A7 ; loop through inventory items to update ATK/DEF ; control flow target (from $9E70) 0x011E5C|$04:$9E4C:BD 00 06 LDA $0600,X ; Midenhall inventory item 1 (| #$40 if equipped) 0x011E5F|$04:$9E4F:A0 00 LDY #$00 ; start index with ATK 0x011E61|$04:$9E51:C9 41 CMP #$41 ; equipped items have bit 6 set 0x011E63|$04:$9E53:90 14 BCC $9E69 ; if not equipped, it doesn't count 0x011E65|$04:$9E55:C9 51 CMP #$51 ; there are #$10 weapons 0x011E67|$04:$9E57:90 05 BCC $9E5E ; if it's an equipped weapon, go update stat 0x011E69|$04:$9E59:C8 INY ; update index to DEF 0x011E6A|$04:$9E5A:C9 64 CMP #$64 ; the last armour/shield/helmet ID is #$23 0x011E6C|$04:$9E5C:B0 0B BCS $9E69 ; if it's equipped but not a weapon/armour/shield/helmet, it doesn't count ; control flow target (from $9E57) 0x011E6E|$04:$9E5E:AA TAX 0x011E6F|$04:$9E5F:BD AA BE LDA $BEAA,X ; base offset for equipment power list at $BEEB 0x011E72|$04:$9E62:18 CLC ; not needed since we only get here via taking BCC or not taking BCS, so C is known to be clear 0x011E73|$04:$9E63:79 99 00 ADC $0099,Y ; add current stat and equipment's power 0x011E76|$04:$9E66:99 99 00 STA $0099,Y ; update current stat ; control flow target (from $9E53, $9E5C) 0x011E79|$04:$9E69:E6 A7 INC $A7 ; update inventory index 0x011E7B|$04:$9E6B:A6 A7 LDX $A7 0x011E7D|$04:$9E6D:8A TXA 0x011E7E|$04:$9E6E:29 07 AND #$07 0x011E80|$04:$9E70:D0 DA BNE $9E4C ; if there's more inventory to check, loop to keep checking 0x011E82|$04:$9E72:A0 0B LDY #$0B ; offset into hero data for ATK 0x011E84|$04:$9E74:A5 99 LDA $99 ; current ATK 0x011E86|$04:$9E76:91 C3 STA ($C3),Y ; update hero's current ATK 0x011E88|$04:$9E78:A0 0C LDY #$0C ; offset for DEF 0x011E8A|$04:$9E7A:A5 9A LDA $9A ; current DEF 0x011E8C|$04:$9E7C:91 C3 STA ($C3),Y ; update hero's current DEF 0x011E8E|$04:$9E7E:A5 A8 LDA $A8 ; hero 0x011E90|$04:$9E80:F0 14 BEQ $9E96 ; if Midenhall, then done 0x011E92|$04:$9E82:C9 02 CMP #$02 0x011E94|$04:$9E84:A2 00 LDX #$00 ; Cannock's spell learning list offset 0x011E96|$04:$9E86:90 02 BCC $9E8A ; if not Cannock, then Moonbrooke 0x011E98|$04:$9E88:A2 10 LDX #$10 ; Moonbrooke's spell learning list offset ; control flow target (from $9E86) 0x011E9A|$04:$9E8A:20 AC 9E JSR $9EAC ; update learned spell list 0x011E9D|$04:$9E8D:99 18 06 STA $0618,Y ; Cannock's learned battle spell list 0x011EA0|$04:$9E90:20 AC 9E JSR $9EAC ; update learned spell list 0x011EA3|$04:$9E93:99 1A 06 STA $061A,Y ; Cannock's learned field spell list ; control flow target (from $9E80) 0x011EA6|$04:$9E96:60 RTS ; process high nybble of level up data ; control flow target (from $9DFA, $9E04) 0x011EA7|$04:$9E97:BD CD BD LDA $BDCD,X ; level up stat nybbles (STR/AGI, HP/MP) 0x011EAA|$04:$9E9A:6A ROR ; shift high nybble down to low nybble 0x011EAB|$04:$9E9B:6A ROR 0x011EAC|$04:$9E9C:6A ROR 0x011EAD|$04:$9E9D:6A ROR ; process low nybble of level up data ; control flow target (from $9E00, $9E0A) 0x011EAE|$04:$9E9E:29 0F AND #$0F 0x011EB0|$04:$9EA0:99 A3 00 STA $00A3,Y ; stat gain for this level 0x011EB3|$04:$9EA3:18 CLC 0x011EB4|$04:$9EA4:79 99 00 ADC $0099,Y 0x011EB7|$04:$9EA7:99 99 00 STA $0099,Y ; total stat amount 0x011EBA|$04:$9EAA:C8 INY ; set for next stat 0x011EBB|$04:$9EAB:60 RTS ; update learned spell list ; control flow target (from $9E8A, $9E90) 0x011EBC|$04:$9EAC:A5 A9 LDA $A9 ; current level 0x011EBE|$04:$9EAE:A0 08 LDY #$08 ; 8 spells per battle/field list ; control flow target (from $9EBB) 0x011EC0|$04:$9EB0:DD CB BE CMP $BECB,X ; levels for learning spells 0x011EC3|$04:$9EB3:D0 02 BNE $9EB7 0x011EC5|$04:$9EB5:C6 B3 DEC $B3 ; update number of spells learned ; control flow target (from $9EB3) 0x011EC7|$04:$9EB7:26 99 ROL $99 ; $99 morphs into learned spell list, 1 bit per spell 0x011EC9|$04:$9EB9:E8 INX ; increment spell list index 0x011ECA|$04:$9EBA:88 DEY ; decrement number of spells left to check 0x011ECB|$04:$9EBB:D0 F3 BNE $9EB0 ; if more spells to check, keep checking 0x011ECD|$04:$9EBD:A4 A8 LDY $A8 ; hero 0x011ECF|$04:$9EBF:88 DEY ; Midenhall has no spell data 0x011ED0|$04:$9EC0:A5 99 LDA $99 ; learned spell list 0x011ED2|$04:$9EC2:60 RTS ; given an index (in A) into the array of battle spell/item structures at $A7C0, set $C5-$C6 to the address of the corresponding item inside that structure ; control flow target (from $A192, $A92F) 0x011ED3|$04:$9EC3:48 PHA 0x011ED4|$04:$9EC4:A9 10 LDA #$10 0x011ED6|$04:$9EC6:D0 29 BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure ; control flow target (from $9DCD, $A3B3, $A3D5, $A402, $B3E2, $B448, $B455, $B5EB) 0x011ED8|$04:$9EC8:48 PHA 0x011ED9|$04:$9EC9:A9 0E LDA #$0E 0x011EDB|$04:$9ECB:D0 24 BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index (in A) into the array of structures at $068F, set $C1-$C2 to the address of the corresponding item inside that structure ; control flow target (from $A2EA, $AB73, $B27A) 0x011EDD|$04:$9ECD:48 PHA 0x011EDE|$04:$9ECE:A9 0C LDA #$0C 0x011EE0|$04:$9ED0:D0 1F BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index (in A) into the array of structures at $0663, set $BF-$C0 to the address of the corresponding item inside that structure ; control flow target (from $9A89, $AB83, $B273, $B57F, $B5BB) 0x011EE2|$04:$9ED2:48 PHA 0x011EE3|$04:$9ED3:A9 0A LDA #$0A 0x011EE5|$04:$9ED5:D0 1A BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index (in A) into the array of enemy special % structures at $B2F6, set $BD-$BE to the address of the corresponding item inside that structure ; control flow target (from $B07D) 0x011EE7|$04:$9ED7:48 PHA 0x011EE8|$04:$9ED8:A9 08 LDA #$08 0x011EEA|$04:$9EDA:D0 15 BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure ; control flow target (from $A51A, $A6E7, $AB2C, $AB8A, $AC0A, $B163, $B1F3, $B618, $B70C) 0x011EEC|$04:$9EDC:38 SEC 0x011EED|$04:$9EDD:E9 01 SBC #$01 0x011EEF|$04:$9EDF:48 PHA 0x011EF0|$04:$9EE0:A9 06 LDA #$06 0x011EF2|$04:$9EE2:D0 0D BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure ; control flow target (from $9666, $96C2, $9810, $98D2, $9981, $9CF3, $9D13, $A0FF, $A49E, $A9C9, $AC8D, $AE6D, $AEAD, $B011, $B22F, $B316, $B686, $B6E2) 0x011EF4|$04:$9EE4:48 PHA 0x011EF5|$04:$9EE5:A9 04 LDA #$04 0x011EF7|$04:$9EE7:D0 08 BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure ; control flow target (from $A511, $A6CE, $A964, $AB1C, $ABF6, $ADD3, $B170, $B1DE, $B630, $B671) 0x011EF9|$04:$9EE9:48 PHA 0x011EFA|$04:$9EEA:A9 02 LDA #$02 0x011EFC|$04:$9EEC:D0 03 BNE $9EF1 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure ; control flow target (from $94EB, $9502, $965B, $996C, $A27D, $A4FB, $A8FD, $AB23, $ABDE, $AC01, $B15C, $B1EC, $B60E, $B705) 0x011EFE|$04:$9EEE:48 PHA 0x011EFF|$04:$9EEF:A9 00 LDA #$00 ; given an index for the structure list at $9F21/$9F33 in A and an index (on the stack) into the corresponding structure, set the corresponding index of $B5,X to the address of the thing you want ; control flow target (from $9EC6, $9ECB, $9ED0, $9ED5, $9EDA, $9EE2, $9EE7, $9EEC) 0x011F01|$04:$9EF1:85 99 STA $99 ; index for $9F21/$9F33 0x011F03|$04:$9EF3:68 PLA ; desired index into desired array 0x011F04|$04:$9EF4:48 PHA ; desired index into desired array; save A 0x011F05|$04:$9EF5:85 9B STA $9B ; desired index into desired array 0x011F07|$04:$9EF7:8A TXA ; save X 0x011F08|$04:$9EF8:48 PHA 0x011F09|$04:$9EF9:A6 99 LDX $99 ; index for $9F21/$9F33 0x011F0B|$04:$9EFB:BD 33 9F LDA $9F33,X ; array record size low byte 0x011F0E|$04:$9EFE:85 99 STA $99 0x011F10|$04:$9F00:BD 34 9F LDA $9F34,X ; array record size high byte 0x011F13|$04:$9F03:85 9A STA $9A 0x011F15|$04:$9F05:20 5B A0 JSR $A05B ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) ; at this point, $99-$9A = record size * desired index into desired array = desired record's offset into the desired array ; next we'll add the desired array's base address 0x011F18|$04:$9F08:BD 21 9F LDA $9F21,X ; base array address low byte 0x011F1B|$04:$9F0B:85 9B STA $9B 0x011F1D|$04:$9F0D:BD 22 9F LDA $9F22,X ; base array address high byte 0x011F20|$04:$9F10:85 9C STA $9C 0x011F22|$04:$9F12:20 CF A0 JSR $A0CF ; 16-bit addition: ($99-$9A) = ($99-$9A) + ($9B-$9C) ; at this point, $99-$9A is the address of the thing we want to interact with, so save it to $B5,X-$B6-X for later use 0x011F25|$04:$9F15:A5 99 LDA $99 0x011F27|$04:$9F17:95 B5 STA $B5,X 0x011F29|$04:$9F19:A5 9A LDA $9A 0x011F2B|$04:$9F1B:95 B6 STA $B6,X 0x011F2D|$04:$9F1D:68 PLA ; restore X 0x011F2E|$04:$9F1E:AA TAX 0x011F2F|$04:$9F1F:68 PLA ; restore A 0x011F30|$04:$9F20:60 RTS ; code -> data ; base array address low byte ; indexed data load target (from $9F08) 0x011F31|$04:$9F21:63 ; base array address high byte ; indexed data load target (from $9F0D) 0x011F32|$04:$9F22: 06 ; $0663; monster ID, group 1 0x011F33|$04:$9F23:8F 06 ; $068F 0x011F35|$04:$9F25:2D 06 ; $062D; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x011F37|$04:$9F27:F5 B7 ; $04:$B7F5; Enemy Stats (Max HP, [4-bit evade chance / 64, 4-bit unused], Max Gold dropped, EXP low byte, AGI, Attack Power, Defense Power, [2-bit attack probability list, 3-bit Sleep res., 3-bit spell damage res.], [2-bit EXP * 256, 3-bit Defeat res., 3-bit Stopspell res.], [2-bit EXP * 1024, 3-bit Defense res., 3-bit Surround res.], [4-bit Attack command 1, 4-bit Attack command 2], [4-bit Attack command 3, 4-bit Attack command 4], [4-bit Attack command 5, 4-bit Attack command 6], [4-bit Attack command 7, 4-bit Attack command 8], 8*1-bit use alternate attack command) 0x011F39|$04:$9F29:F6 B2 ; $04:$B2F6; Attack % for Enemy Specials 0x011F3B|$04:$9F2B:63 06 ; $0663; monster ID, group 1 0x011F3D|$04:$9F2D:8F 06 ; $068F 0x011F3F|$04:$9F2F:2D 06 ; $062D; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x011F41|$04:$9F31:C0 A7 ; $04:$A7C0; Battle Structs for Spells and Usable Items (target, power, cast string ID, hit string ID, miss string ID) ; array record size low byte ; indexed data load target (from $9EFB) 0x011F43|$04:$9F33:0B ; array record size high byte ; indexed data load target (from $9F00) 0x011F44|$04:$9F34: 00 ; $0663 struct records are #$0B bytes long 0x011F45|$04:$9F35:07 00 ; $068F struct records are #$07 bytes long 0x011F47|$04:$9F37:12 00 ; $062D struct records are #$12 bytes long 0x011F49|$04:$9F39:0F 00 ; $B7F5 struct records are #$0F bytes long 0x011F4B|$04:$9F3B:07 00 ; $B2F6 struct records are #$07 bytes long 0x011F4D|$04:$9F3D:0B 00 ; $0663 struct records are #$0B bytes long 0x011F4F|$04:$9F3F:07 00 ; $068F struct records are #$07 bytes long 0x011F51|$04:$9F41:12 00 ; $062D struct records are #$12 bytes long 0x011F53|$04:$9F43:05 00 ; $A7C0 struct records are #$05 bytes long ; data -> code ; control flow target (from $A636) 0x011F55|$04:$9F45:46 9C LSR $9C 0x011F57|$04:$9F47:66 9B ROR $9B 0x011F59|$04:$9F49:20 E3 A0 JSR $A0E3 ; 16-bit subtraction: ($99-$9A) = ($99-$9A) - ($9B-$9C) 0x011F5C|$04:$9F4C:90 19 BCC $9F67 ; generate a random number between $03 and #$02 in A and $99 0x011F5E|$04:$9F4E:A5 99 LDA $99 0x011F60|$04:$9F50:C9 02 CMP #$02 0x011F62|$04:$9F52:B0 04 BCS $9F58 0x011F64|$04:$9F54:A5 9A LDA $9A 0x011F66|$04:$9F56:F0 0F BEQ $9F67 ; generate a random number between $03 and #$02 in A and $99 ; control flow target (from $9F52) 0x011F68|$04:$9F58:20 FB 9F JSR $9FFB ; set $9B to a random number tightly distributed around #$80 and $9C to #$00 0x011F6B|$04:$9F5B:20 5B A0 JSR $A05B ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) ; control flow target (from $9FCF) 0x011F6E|$04:$9F5E:A5 9D LDA $9D 0x011F70|$04:$9F60:85 99 STA $99 0x011F72|$04:$9F62:A5 9E LDA $9E 0x011F74|$04:$9F64:85 9A STA $9A 0x011F76|$04:$9F66:60 RTS ; generate a random number between $03 and #$02 in A and $99 ; control flow target (from $9F4C, $9F56, $9FEE) 0x011F77|$04:$9F67:A9 02 LDA #$02 0x011F79|$04:$9F69:4C 20 A0 JMP $A020 ; generate a random number between $03 and A in A and $99 ; control flow target (from $B02E) 0x011F7C|$04:$9F6C:A5 99 LDA $99 0x011F7E|$04:$9F6E:85 C7 STA $C7 0x011F80|$04:$9F70:A5 9A LDA $9A 0x011F82|$04:$9F72:85 C8 STA $C8 0x011F84|$04:$9F74:46 9C LSR $9C 0x011F86|$04:$9F76:66 9B ROR $9B 0x011F88|$04:$9F78:46 C8 LSR $C8 0x011F8A|$04:$9F7A:66 C7 ROR $C7 0x011F8C|$04:$9F7C:46 C8 LSR $C8 0x011F8E|$04:$9F7E:66 C7 ROR $C7 0x011F90|$04:$9F80:A5 C7 LDA $C7 0x011F92|$04:$9F82:85 BD STA $BD 0x011F94|$04:$9F84:A5 C8 LDA $C8 0x011F96|$04:$9F86:85 BE STA $BE 0x011F98|$04:$9F88:20 E3 A0 JSR $A0E3 ; 16-bit subtraction: ($99-$9A) = ($99-$9A) - ($9B-$9C) 0x011F9B|$04:$9F8B:90 20 BCC $9FAD 0x011F9D|$04:$9F8D:A5 C8 LDA $C8 0x011F9F|$04:$9F8F:C5 9A CMP $9A 0x011FA1|$04:$9F91:90 36 BCC $9FC9 0x011FA3|$04:$9F93:D0 06 BNE $9F9B 0x011FA5|$04:$9F95:A5 C7 LDA $C7 0x011FA7|$04:$9F97:C5 99 CMP $99 0x011FA9|$04:$9F99:90 2E BCC $9FC9 ; control flow target (from $9F93) 0x011FAB|$04:$9F9B:46 C8 LSR $C8 0x011FAD|$04:$9F9D:66 C7 ROR $C7 0x011FAF|$04:$9F9F:A5 C8 LDA $C8 0x011FB1|$04:$9FA1:C5 9A CMP $9A 0x011FB3|$04:$9FA3:90 18 BCC $9FBD 0x011FB5|$04:$9FA5:D0 06 BNE $9FAD 0x011FB7|$04:$9FA7:A5 C7 LDA $C7 0x011FB9|$04:$9FA9:C5 99 CMP $99 0x011FBB|$04:$9FAB:90 10 BCC $9FBD ; control flow target (from $9F8B, $9FA5) 0x011FBD|$04:$9FAD:A9 02 LDA #$02 ; control flow target (from $9FBF) 0x011FBF|$04:$9FAF:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x011FC2|$04:$9FB2:A5 99 LDA $99 0x011FC4|$04:$9FB4:D0 0B BNE $9FC1 0x011FC6|$04:$9FB6:A9 00 LDA #$00 0x011FC8|$04:$9FB8:85 99 STA $99 0x011FCA|$04:$9FBA:85 9A STA $9A 0x011FCC|$04:$9FBC:60 RTS ; control flow target (from $9FA3, $9FAB) 0x011FCD|$04:$9FBD:A9 04 LDA #$04 0x011FCF|$04:$9FBF:D0 EE BNE $9FAF ; control flow target (from $9FB4) 0x011FD1|$04:$9FC1:A5 BD LDA $BD 0x011FD3|$04:$9FC3:85 99 STA $99 0x011FD5|$04:$9FC5:A5 BE LDA $BE 0x011FD7|$04:$9FC7:85 9A STA $9A ; control flow target (from $9F91, $9F99) 0x011FD9|$04:$9FC9:20 FB 9F JSR $9FFB ; set $9B to a random number tightly distributed around #$80 and $9C to #$00 0x011FDC|$04:$9FCC:20 5B A0 JSR $A05B ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) 0x011FDF|$04:$9FCF:20 5E 9F JSR $9F5E 0x011FE2|$04:$9FD2:46 9E LSR $9E 0x011FE4|$04:$9FD4:66 9D ROR $9D 0x011FE6|$04:$9FD6:46 9E LSR $9E 0x011FE8|$04:$9FD8:66 9D ROR $9D 0x011FEA|$04:$9FDA:A5 99 LDA $99 0x011FEC|$04:$9FDC:38 SEC 0x011FED|$04:$9FDD:E5 9D SBC $9D 0x011FEF|$04:$9FDF:85 99 STA $99 0x011FF1|$04:$9FE1:A5 9A LDA $9A 0x011FF3|$04:$9FE3:E5 9E SBC $9E 0x011FF5|$04:$9FE5:85 9A STA $9A 0x011FF7|$04:$9FE7:A5 9A LDA $9A 0x011FF9|$04:$9FE9:05 99 ORA $99 0x011FFB|$04:$9FEB:F0 01 BEQ $9FEE 0x011FFD|$04:$9FED:60 RTS ; control flow target (from $9FEB) 0x011FFE|$04:$9FEE:4C 67 9F JMP $9F67 ; generate a random number between $03 and #$02 in A and $99 ; set $9B to a random number tightly distributed around #$80 and $9C to #$00 0x012001|$04:$9FF1:A9 1F LDA #$1F 0x012003|$04:$9FF3:85 9F STA $9F 0x012005|$04:$9FF5:A9 08 LDA #$08 0x012007|$04:$9FF7:85 9B STA $9B 0x012009|$04:$9FF9:D0 08 BNE $A003 ; set $9B to a random number tightly distributed around #$80 and $9C to #$00 ; control flow target (from $9F58, $9FC9, $AE92) 0x01200B|$04:$9FFB:A9 0F LDA #$0F ; sum up random 4-bit numbers 0x01200D|$04:$9FFD:85 9F STA $9F ; WARNING! $9FFF was also seen as data 0x01200F|$04:$9FFF:A9 88 LDA #$88 0x012011|$04:$A001:85 9B STA $9B ; control flow target (from $9FF9) 0x012013|$04:$A003:A2 10 LDX #$10 ; 16 loops of summing random N-bit number ; control flow target (from $A012) ; call to code in a different bank ($0F:$C3AB) 0x012015|$04:$A005:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x012018|$04:$A008:A5 32 LDA $32 ; RNG byte 0 0x01201A|$04:$A00A:25 9F AND $9F 0x01201C|$04:$A00C:18 CLC 0x01201D|$04:$A00D:65 9B ADC $9B 0x01201F|$04:$A00F:85 9B STA $9B 0x012021|$04:$A011:CA DEX 0x012022|$04:$A012:D0 F1 BNE $A005 0x012024|$04:$A014:A5 9B LDA $9B 0x012026|$04:$A016:38 SEC 0x012027|$04:$A017:E9 80 SBC #$80 0x012029|$04:$A019:85 9B STA $9B 0x01202B|$04:$A01B:A9 00 LDA #$00 0x01202D|$04:$A01D:85 9C STA $9C 0x01202F|$04:$A01F:60 RTS ; generate a random number between $03 and A in A and $99 ; control flow target (from $9555, $95C6, $9F69, $9FAF, $A118, $A287, $A292, $A4C3, $A602, $A609, $A64B, $A668, $A760, $A8B5, $A8D8, $A8EF, $A9D9, $AA2A, $ADBC, $AE24, $AFF7, $B001, $B009, $B2E0, $B42F, $B436, $B443) 0x012030|$04:$A020:85 99 STA $99 0x012032|$04:$A022:C9 00 CMP #$00 0x012034|$04:$A024:F0 34 BEQ $A05A 0x012036|$04:$A026:8A TXA 0x012037|$04:$A027:48 PHA 0x012038|$04:$A028:98 TYA 0x012039|$04:$A029:48 PHA 0x01203A|$04:$A02A:A9 00 LDA #$00 0x01203C|$04:$A02C:85 9A STA $9A 0x01203E|$04:$A02E:85 9F STA $9F 0x012040|$04:$A030:A5 03 LDA $03 ; game clock? 0x012042|$04:$A032:85 A0 STA $A0 0x012044|$04:$A034:A5 99 LDA $99 0x012046|$04:$A036:A0 09 LDY #$09 ; control flow target (from $A03C) 0x012048|$04:$A038:88 DEY 0x012049|$04:$A039:F0 09 BEQ $A044 0x01204B|$04:$A03B:0A ASL 0x01204C|$04:$A03C:90 FA BCC $A038 ; control flow target (from $A042) 0x01204E|$04:$A03E:38 SEC 0x01204F|$04:$A03F:26 9F ROL $9F 0x012051|$04:$A041:88 DEY 0x012052|$04:$A042:D0 FA BNE $A03E ; control flow target (from $A039, $A050) ; call to code in a different bank ($0F:$C3AB) 0x012054|$04:$A044:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x012057|$04:$A047:A5 32 LDA $32 ; RNG byte 0 0x012059|$04:$A049:18 CLC 0x01205A|$04:$A04A:65 A0 ADC $A0 0x01205C|$04:$A04C:25 9F AND $9F 0x01205E|$04:$A04E:C5 99 CMP $99 0x012060|$04:$A050:B0 F2 BCS $A044 0x012062|$04:$A052:85 99 STA $99 0x012064|$04:$A054:68 PLA 0x012065|$04:$A055:A8 TAY 0x012066|$04:$A056:68 PLA 0x012067|$04:$A057:AA TAX 0x012068|$04:$A058:A5 99 LDA $99 ; control flow target (from $A024) 0x01206A|$04:$A05A:60 RTS ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) ; control flow target (from $9887, $99A6, $9F05, $9F5B, $9FCC, $B6C8) 0x01206B|$04:$A05B:A9 00 LDA #$00 0x01206D|$04:$A05D:85 9C STA $9C ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B-$9C), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) ; control flow target (from $AE95, $B03E) 0x01206F|$04:$A05F:A9 00 LDA #$00 ; initialize vars to #$00 0x012071|$04:$A061:85 9D STA $9D ; result byte 1 0x012073|$04:$A063:85 9E STA $9E ; result byte 2 0x012075|$04:$A065:85 A1 STA $A1 ; result byte 0 0x012077|$04:$A067:85 A2 STA $A2 ; multiplicand byte 2 0x012079|$04:$A069:A5 9B LDA $9B ; original multiplicant byte 0 0x01207B|$04:$A06B:85 9F STA $9F ; current multiplicand byte 0 0x01207D|$04:$A06D:A5 9C LDA $9C ; original multiplicand byte 1 0x01207F|$04:$A06F:85 A0 STA $A0 ; current multiplicand byte 1 ; control flow target (from $A096) 0x012081|$04:$A071:A5 99 LDA $99 ; multiplier low byte 0x012083|$04:$A073:05 9A ORA $9A ; multiplier high byte 0x012085|$04:$A075:F0 22 BEQ $A099 ; if multiplier == 0, copy results to $99-$9A and RTS 0x012087|$04:$A077:46 9A LSR $9A ; LSR 16-bit multiplier 0x012089|$04:$A079:66 99 ROR $99 0x01208B|$04:$A07B:90 13 BCC $A090 ; check low bit of multiplier 0x01208D|$04:$A07D:A5 9F LDA $9F ; current multiplicand byte 0 0x01208F|$04:$A07F:18 CLC 0x012090|$04:$A080:65 A1 ADC $A1 0x012092|$04:$A082:85 A1 STA $A1 ; result byte 0 += current multiplicand byte 0 0x012094|$04:$A084:A5 A0 LDA $A0 0x012096|$04:$A086:65 9D ADC $9D 0x012098|$04:$A088:85 9D STA $9D ; result byte 1 += current multiplicand byte 1 + carry from byte 0 0x01209A|$04:$A08A:A5 A2 LDA $A2 0x01209C|$04:$A08C:65 9E ADC $9E 0x01209E|$04:$A08E:85 9E STA $9E ; result byte 2 += current multiplicand byte 2 + carry from byte 1 ; control flow target (from $A07B) 0x0120A0|$04:$A090:06 9F ASL $9F ; ASL 24-bit multiplicand 0x0120A2|$04:$A092:26 A0 ROL $A0 0x0120A4|$04:$A094:26 A2 ROL $A2 0x0120A6|$04:$A096:4C 71 A0 JMP $A071 ; loop to process next bit ; control flow target (from $A075) 0x0120A9|$04:$A099:A5 A1 LDA $A1 ; result byte 0 0x0120AB|$04:$A09B:85 99 STA $99 0x0120AD|$04:$A09D:A5 9D LDA $9D ; result byte 1 0x0120AF|$04:$A09F:85 9A STA $9A 0x0120B1|$04:$A0A1:60 RTS ; overflow is still sitting in $9E if anybody wants it ; control flow target (from $99B1, $AB9F) 0x0120B2|$04:$A0A2:A0 10 LDY #$10 0x0120B4|$04:$A0A4:A9 00 LDA #$00 0x0120B6|$04:$A0A6:85 9D STA $9D 0x0120B8|$04:$A0A8:85 9E STA $9E ; control flow target (from $A0CC) 0x0120BA|$04:$A0AA:06 99 ASL $99 0x0120BC|$04:$A0AC:26 9A ROL $9A 0x0120BE|$04:$A0AE:26 9D ROL $9D 0x0120C0|$04:$A0B0:26 9E ROL $9E 0x0120C2|$04:$A0B2:E6 99 INC $99 0x0120C4|$04:$A0B4:A5 9D LDA $9D 0x0120C6|$04:$A0B6:38 SEC 0x0120C7|$04:$A0B7:E5 9B SBC $9B 0x0120C9|$04:$A0B9:48 PHA 0x0120CA|$04:$A0BA:A5 9E LDA $9E 0x0120CC|$04:$A0BC:E5 9C SBC $9C 0x0120CE|$04:$A0BE:B0 06 BCS $A0C6 0x0120D0|$04:$A0C0:68 PLA 0x0120D1|$04:$A0C1:C6 99 DEC $99 0x0120D3|$04:$A0C3:4C CB A0 JMP $A0CB ; control flow target (from $A0BE) 0x0120D6|$04:$A0C6:85 9E STA $9E 0x0120D8|$04:$A0C8:68 PLA 0x0120D9|$04:$A0C9:85 9D STA $9D ; control flow target (from $A0C3) 0x0120DB|$04:$A0CB:88 DEY 0x0120DC|$04:$A0CC:D0 DC BNE $A0AA 0x0120DE|$04:$A0CE:60 RTS ; 16-bit addition: ($99-$9A) = ($99-$9A) + ($9B-$9C) ; control flow target (from $9F12) 0x0120DF|$04:$A0CF:A5 99 LDA $99 0x0120E1|$04:$A0D1:18 CLC 0x0120E2|$04:$A0D2:65 9B ADC $9B 0x0120E4|$04:$A0D4:85 99 STA $99 0x0120E6|$04:$A0D6:A5 9A LDA $9A 0x0120E8|$04:$A0D8:65 9C ADC $9C 0x0120EA|$04:$A0DA:85 9A STA $9A 0x0120EC|$04:$A0DC:60 RTS 0x0120ED|$04:$A0DD:85 9B STA $9B 0x0120EF|$04:$A0DF:A9 00 LDA #$00 0x0120F1|$04:$A0E1:85 9C STA $9C ; 16-bit subtraction: ($99-$9A) = ($99-$9A) - ($9B-$9C) ; control flow target (from $9F49, $9F88, $AF45) 0x0120F3|$04:$A0E3:A5 99 LDA $99 0x0120F5|$04:$A0E5:38 SEC 0x0120F6|$04:$A0E6:E5 9B SBC $9B 0x0120F8|$04:$A0E8:85 99 STA $99 0x0120FA|$04:$A0EA:A5 9A LDA $9A 0x0120FC|$04:$A0EC:E5 9C SBC $9C 0x0120FE|$04:$A0EE:85 9A STA $9A 0x012100|$04:$A0F0:60 RTS ; control flow target (from $964A, $9C6F, $9CA6, $AF5D) 0x012101|$04:$A0F1:98 TYA 0x012102|$04:$A0F2:48 PHA 0x012103|$04:$A0F3:8A TXA 0x012104|$04:$A0F4:48 PHA ; call to code in a different bank ($0F:$C22C) 0x012105|$04:$A0F5:20 2C C2 JSR $C22C 0x012108|$04:$A0F8:68 PLA 0x012109|$04:$A0F9:AA TAX 0x01210A|$04:$A0FA:68 PLA 0x01210B|$04:$A0FB:A8 TAY 0x01210C|$04:$A0FC:60 RTS ; control flow target (from $9635) 0x01210D|$04:$A0FD:85 A7 STA $A7 0x01210F|$04:$A0FF:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x012112|$04:$A102:20 B9 A7 JSR $A7B9 0x012115|$04:$A105:A5 A7 LDA $A7 0x012117|$04:$A107:49 FF EOR #$FF 0x012119|$04:$A109:85 AB STA $AB 0x01211B|$04:$A10B:A0 00 LDY #$00 0x01211D|$04:$A10D:B1 B9 LDA ($B9),Y 0x01211F|$04:$A10F:0A ASL 0x012120|$04:$A110:B0 01 BCS $A113 0x012122|$04:$A112:60 RTS ; control flow target (from $A110) 0x012123|$04:$A113:0A ASL 0x012124|$04:$A114:90 1C BCC $A132 0x012126|$04:$A116:A9 08 LDA #$08 0x012128|$04:$A118:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x01212B|$04:$A11B:C9 04 CMP #$04 0x01212D|$04:$A11D:B0 0F BCS $A12E 0x01212F|$04:$A11F:A0 00 LDY #$00 0x012131|$04:$A121:B1 B9 LDA ($B9),Y 0x012133|$04:$A123:29 BF AND #$BF 0x012135|$04:$A125:91 B9 STA ($B9),Y 0x012137|$04:$A127:A9 20 LDA #$20 ; control flow target (from $A130, $A1FE) 0x012139|$04:$A129:85 AD STA $AD 0x01213B|$04:$A12B:4C DC 9C JMP $9CDC ; control flow target (from $A11D) 0x01213E|$04:$A12E:A9 1F LDA #$1F 0x012140|$04:$A130:D0 F7 BNE $A129 ; control flow target (from $A114) 0x012142|$04:$A132:A0 02 LDY #$02 0x012144|$04:$A134:B1 B9 LDA ($B9),Y 0x012146|$04:$A136:85 A8 STA $A8 0x012148|$04:$A138:C9 20 CMP #$20 0x01214A|$04:$A13A:90 56 BCC $A192 0x01214C|$04:$A13C:C9 3C CMP #$3C 0x01214E|$04:$A13E:F0 05 BEQ $A145 0x012150|$04:$A140:C9 80 CMP #$80 0x012152|$04:$A142:B0 08 BCS $A14C 0x012154|$04:$A144:60 RTS ; control flow target (from $A13E) 0x012155|$04:$A145:A9 00 LDA #$00 0x012157|$04:$A147:85 AD STA $AD 0x012159|$04:$A149:4C DC 9C JMP $9CDC ; control flow target (from $A142) 0x01215C|$04:$A14C:29 7F AND #$7F 0x01215E|$04:$A14E:85 95 STA $95 ; ID for [item] and [spell] control codes 0x012160|$04:$A150:A2 07 LDX #$07 ; control flow target (from $A158) 0x012162|$04:$A152:DD 7C A1 CMP $A17C,X 0x012165|$04:$A155:F0 0C BEQ $A163 0x012167|$04:$A157:CA DEX 0x012168|$04:$A158:10 F8 BPL $A152 0x01216A|$04:$A15A:A9 7E LDA #$7E 0x01216C|$04:$A15C:85 AD STA $AD 0x01216E|$04:$A15E:A9 FE LDA #$FE 0x012170|$04:$A160:4C E5 9C JMP $9CE5 ; control flow target (from $A155) 0x012173|$04:$A163:A9 FF LDA #$FF 0x012175|$04:$A165:8D 76 01 STA $0176 0x012178|$04:$A168:20 D6 9A JSR $9AD6 0x01217B|$04:$A16B:A5 A7 LDA $A7 0x01217D|$04:$A16D:85 97 STA $97 ; subject hero ID $97 0x01217F|$04:$A16F:AA TAX 0x012180|$04:$A170:BD D2 06 LDA $06D2,X 0x012183|$04:$A173:AA TAX 0x012184|$04:$A174:A5 95 LDA $95 ; ID for [item] and [spell] control codes ; call to code in a different bank ($0F:$F746) 0x012186|$04:$A176:20 46 F7 JSR $F746 0x012189|$04:$A179:4C E6 99 JMP $99E6 ; code -> data ; indexed data load target (from $A152) 0x01218C|$04:$A17C:24 0x01218D|$04:$A17D:26 0x01218E|$04:$A17E:27 0x01218F|$04:$A17F:36 0x012190|$04:$A180:32 0x012191|$04:$A181:2F 0x012192|$04:$A182:30 0x012193|$04:$A183:2E ; data -> code ; control flow target (from $A1A1) 0x012194|$04:$A184:A9 3C LDA #$3C 0x012196|$04:$A186:D0 02 BNE $A18A ; control flow target (from $A1A5) 0x012198|$04:$A188:A9 3B LDA #$3B ; control flow target (from $A186) 0x01219A|$04:$A18A:85 95 STA $95 ; ID for [item] and [spell] control codes 0x01219C|$04:$A18C:20 F0 A4 JSR $A4F0 0x01219F|$04:$A18F:4C E1 A1 JMP $A1E1 ; control flow target (from $A13A) 0x0121A2|$04:$A192:20 C3 9E JSR $9EC3 ; given an index (in A) into the array of battle spell/item structures at $A7C0, set $C5-$C6 to the address of the corresponding item inside that structure 0x0121A5|$04:$A195:A0 02 LDY #$02 ; cast string ID 0x0121A7|$04:$A197:B1 C5 LDA ($C5),Y 0x0121A9|$04:$A199:85 AD STA $AD 0x0121AB|$04:$A19B:A5 A8 LDA $A8 0x0121AD|$04:$A19D:F0 42 BEQ $A1E1 0x0121AF|$04:$A19F:C9 1C CMP #$1C 0x0121B1|$04:$A1A1:F0 E1 BEQ $A184 0x0121B3|$04:$A1A3:C9 1D CMP #$1D 0x0121B5|$04:$A1A5:F0 E1 BEQ $A188 0x0121B7|$04:$A1A7:C9 17 CMP #$17 0x0121B9|$04:$A1A9:B0 36 BCS $A1E1 0x0121BB|$04:$A1AB:C9 0F CMP #$0F 0x0121BD|$04:$A1AD:90 02 BCC $A1B1 0x0121BF|$04:$A1AF:A9 0F LDA #$0F ; control flow target (from $A1AD) 0x0121C1|$04:$A1B1:AA TAX 0x0121C2|$04:$A1B2:A9 61 LDA #$61 ; Item ID #$61: Mysterious Hat (equipped) 0x0121C4|$04:$A1B4:20 E7 A4 JSR $A4E7 ; given a hero ID in $A7 and an item ID in A, SEC if hero has that item, CLC otherwise 0x0121C7|$04:$A1B7:90 05 BCC $A1BE 0x0121C9|$04:$A1B9:8A TXA 0x0121CA|$04:$A1BA:18 CLC 0x0121CB|$04:$A1BB:69 0F ADC #$0F 0x0121CD|$04:$A1BD:AA TAX ; control flow target (from $A1B7) 0x0121CE|$04:$A1BE:BD F9 B4 LDA $B4F9,X 0x0121D1|$04:$A1C1:85 A6 STA $A6 0x0121D3|$04:$A1C3:A0 10 LDY #$10 0x0121D5|$04:$A1C5:B1 B9 LDA ($B9),Y 0x0121D7|$04:$A1C7:38 SEC 0x0121D8|$04:$A1C8:E5 A6 SBC $A6 0x0121DA|$04:$A1CA:B0 04 BCS $A1D0 0x0121DC|$04:$A1CC:A9 11 LDA #$11 0x0121DE|$04:$A1CE:D0 0E BNE $A1DE ; control flow target (from $A1CA) 0x0121E0|$04:$A1D0:91 B9 STA ($B9),Y 0x0121E2|$04:$A1D2:20 AC 9A JSR $9AAC 0x0121E5|$04:$A1D5:A0 00 LDY #$00 0x0121E7|$04:$A1D7:B1 B9 LDA ($B9),Y 0x0121E9|$04:$A1D9:4A LSR 0x0121EA|$04:$A1DA:90 05 BCC $A1E1 0x0121EC|$04:$A1DC:A9 12 LDA #$12 ; control flow target (from $A1CE) 0x0121EE|$04:$A1DE:4C E5 9C JMP $9CE5 ; control flow target (from $A18F, $A19D, $A1A9, $A1DA) 0x0121F1|$04:$A1E1:A0 00 LDY #$00 0x0121F3|$04:$A1E3:B1 C5 LDA ($C5),Y 0x0121F5|$04:$A1E5:29 07 AND #$07 0x0121F7|$04:$A1E7:AA TAX 0x0121F8|$04:$A1E8:E8 INX 0x0121F9|$04:$A1E9:CA DEX 0x0121FA|$04:$A1EA:D0 03 BNE $A1EF 0x0121FC|$04:$A1EC:4C D1 A3 JMP $A3D1 ; control flow target (from $A1EA) 0x0121FF|$04:$A1EF:CA DEX 0x012200|$04:$A1F0:D0 61 BNE $A253 0x012202|$04:$A1F2:A5 A8 LDA $A8 0x012204|$04:$A1F4:C9 15 CMP #$15 0x012206|$04:$A1F6:D0 10 BNE $A208 0x012208|$04:$A1F8:A9 FD LDA #$FD 0x01220A|$04:$A1FA:85 AE STA $AE 0x01220C|$04:$A1FC:A9 EF LDA #$EF 0x01220E|$04:$A1FE:20 29 A1 JSR $A129 0x012211|$04:$A201:20 B9 A7 JSR $A7B9 0x012214|$04:$A204:A9 2D LDA #$2D 0x012216|$04:$A206:85 AD STA $AD ; control flow target (from $A1F6) 0x012218|$04:$A208:A9 00 LDA #$00 ; control flow target (from $A218) 0x01221A|$04:$A20A:A0 01 LDY #$01 0x01221C|$04:$A20C:91 B9 STA ($B9),Y 0x01221E|$04:$A20E:48 PHA 0x01221F|$04:$A20F:20 D1 A3 JSR $A3D1 0x012222|$04:$A212:68 PLA 0x012223|$04:$A213:AA TAX 0x012224|$04:$A214:E8 INX 0x012225|$04:$A215:8A TXA 0x012226|$04:$A216:C9 03 CMP #$03 0x012228|$04:$A218:90 F0 BCC $A20A 0x01222A|$04:$A21A:A5 A8 LDA $A8 0x01222C|$04:$A21C:C9 15 CMP #$15 0x01222E|$04:$A21E:D0 32 BNE $A252 0x012230|$04:$A220:A2 00 LDX #$00 0x012232|$04:$A222:86 99 STX $99 ; control flow target (from $A23B) 0x012234|$04:$A224:A0 01 LDY #$01 0x012236|$04:$A226:84 9A STY $9A ; control flow target (from $A233) 0x012238|$04:$A228:A6 99 LDX $99 0x01223A|$04:$A22A:20 F1 8A JSR $8AF1 0x01223D|$04:$A22D:E6 9A INC $9A 0x01223F|$04:$A22F:A4 9A LDY $9A 0x012241|$04:$A231:C0 09 CPY #$09 0x012243|$04:$A233:90 F3 BCC $A228 0x012245|$04:$A235:E6 99 INC $99 0x012247|$04:$A237:A6 99 LDX $99 0x012249|$04:$A239:E0 04 CPX #$04 0x01224B|$04:$A23B:90 E7 BCC $A224 0x01224D|$04:$A23D:A9 0F LDA #$0F 0x01224F|$04:$A23F:85 B2 STA $B2 0x012251|$04:$A241:A9 53 LDA #$53 0x012253|$04:$A243:85 AE STA $AE 0x012255|$04:$A245:A9 00 LDA #$00 0x012257|$04:$A247:85 AF STA $AF 0x012259|$04:$A249:85 9F STA $9F 0x01225B|$04:$A24B:20 E7 9A JSR $9AE7 0x01225E|$04:$A24E:A9 FD LDA #$FD 0x012260|$04:$A250:85 98 STA $98 ; outcome of last fight? ; control flow target (from $A21E) 0x012262|$04:$A252:60 RTS ; control flow target (from $A1F0) 0x012263|$04:$A253:CA DEX 0x012264|$04:$A254:F0 03 BEQ $A259 0x012266|$04:$A256:4C 2F A3 JMP $A32F ; control flow target (from $A254) 0x012269|$04:$A259:A5 A8 LDA $A8 0x01226B|$04:$A25B:C9 17 CMP #$17 0x01226D|$04:$A25D:D0 05 BNE $A264 0x01226F|$04:$A25F:A9 39 LDA #$39 0x012271|$04:$A261:20 E5 9C JSR $9CE5 ; control flow target (from $A25D) 0x012274|$04:$A264:A9 49 LDA #$49 ; Item ID #$49: Falcon Sword (equipped) 0x012276|$04:$A266:20 E7 A4 JSR $A4E7 ; given a hero ID in $A7 and an item ID in A, SEC if hero has that item, CLC otherwise 0x012279|$04:$A269:90 04 BCC $A26F 0x01227B|$04:$A26B:A5 A8 LDA $A8 0x01227D|$04:$A26D:F0 04 BEQ $A273 ; control flow target (from $A269, $A2BF) 0x01227F|$04:$A26F:A9 00 LDA #$00 0x012281|$04:$A271:F0 02 BEQ $A275 ; control flow target (from $A26D) 0x012283|$04:$A273:A9 FF LDA #$FF ; control flow target (from $A271) 0x012285|$04:$A275:85 A3 STA $A3 0x012287|$04:$A277:A0 01 LDY #$01 0x012289|$04:$A279:B1 B9 LDA ($B9),Y 0x01228B|$04:$A27B:85 AA STA $AA 0x01228D|$04:$A27D:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x012290|$04:$A280:A0 09 LDY #$09 0x012292|$04:$A282:B1 B5 LDA ($B5),Y 0x012294|$04:$A284:D0 01 BNE $A287 0x012296|$04:$A286:60 RTS ; control flow target (from $A284) 0x012297|$04:$A287:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x01229A|$04:$A28A:A6 99 LDX $99 0x01229C|$04:$A28C:E8 INX 0x01229D|$04:$A28D:8E DC 06 STX $06DC 0x0122A0|$04:$A290:A9 04 LDA #$04 0x0122A2|$04:$A292:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x0122A5|$04:$A295:F0 0B BEQ $A2A2 0x0122A7|$04:$A297:20 C2 A2 JSR $A2C2 0x0122AA|$04:$A29A:C9 08 CMP #$08 0x0122AC|$04:$A29C:B0 04 BCS $A2A2 0x0122AE|$04:$A29E:85 A9 STA $A9 0x0122B0|$04:$A2A0:90 11 BCC $A2B3 ; control flow target (from $A295, $A29C) 0x0122B2|$04:$A2A2:AE DC 06 LDX $06DC 0x0122B5|$04:$A2A5:A0 00 LDY #$00 ; control flow target (from $A2AC, $A2AF) 0x0122B7|$04:$A2A7:C8 INY 0x0122B8|$04:$A2A8:B1 B5 LDA ($B5),Y 0x0122BA|$04:$A2AA:C9 08 CMP #$08 0x0122BC|$04:$A2AC:B0 F9 BCS $A2A7 0x0122BE|$04:$A2AE:CA DEX 0x0122BF|$04:$A2AF:D0 F6 BNE $A2A7 0x0122C1|$04:$A2B1:84 A9 STY $A9 ; control flow target (from $A2A0) 0x0122C3|$04:$A2B3:20 F9 A4 JSR $A4F9 0x0122C6|$04:$A2B6:A5 98 LDA $98 ; outcome of last fight? 0x0122C8|$04:$A2B8:D0 07 BNE $A2C1 0x0122CA|$04:$A2BA:20 B9 A7 JSR $A7B9 0x0122CD|$04:$A2BD:A5 A3 LDA $A3 0x0122CF|$04:$A2BF:D0 AE BNE $A26F ; control flow target (from $A2B8) 0x0122D1|$04:$A2C1:60 RTS ; control flow target (from $A297) 0x0122D2|$04:$A2C2:A9 FF LDA #$FF 0x0122D4|$04:$A2C4:85 A4 STA $A4 0x0122D6|$04:$A2C6:85 A5 STA $A5 0x0122D8|$04:$A2C8:85 A6 STA $A6 0x0122DA|$04:$A2CA:A5 AA LDA $AA 0x0122DC|$04:$A2CC:0A ASL 0x0122DD|$04:$A2CD:0A ASL 0x0122DE|$04:$A2CE:0A ASL 0x0122DF|$04:$A2CF:38 SEC 0x0122E0|$04:$A2D0:2A ROL 0x0122E1|$04:$A2D1:85 A9 STA $A9 0x0122E3|$04:$A2D3:29 0F AND #$0F ; control flow target (from $A318) 0x0122E5|$04:$A2D5:A8 TAY 0x0122E6|$04:$A2D6:A2 00 LDX #$00 ; control flow target (from $A2E2) 0x0122E8|$04:$A2D8:BD D5 06 LDA $06D5,X 0x0122EB|$04:$A2DB:C5 A9 CMP $A9 0x0122ED|$04:$A2DD:F0 31 BEQ $A310 0x0122EF|$04:$A2DF:E8 INX 0x0122F0|$04:$A2E0:E0 06 CPX #$06 0x0122F2|$04:$A2E2:90 F4 BCC $A2D8 0x0122F4|$04:$A2E4:B1 B5 LDA ($B5),Y 0x0122F6|$04:$A2E6:C9 08 CMP #$08 0x0122F8|$04:$A2E8:B0 26 BCS $A310 0x0122FA|$04:$A2EA:20 CD 9E JSR $9ECD ; given an index (in A) into the array of structures at $068F, set $C1-$C2 to the address of the corresponding item inside that structure 0x0122FD|$04:$A2ED:A0 04 LDY #$04 0x0122FF|$04:$A2EF:B1 C1 LDA ($C1),Y 0x012301|$04:$A2F1:85 0C STA $0C 0x012303|$04:$A2F3:C8 INY 0x012304|$04:$A2F4:B1 C1 LDA ($C1),Y 0x012306|$04:$A2F6:85 0D STA $0D 0x012308|$04:$A2F8:C5 A6 CMP $A6 0x01230A|$04:$A2FA:90 08 BCC $A304 0x01230C|$04:$A2FC:D0 12 BNE $A310 0x01230E|$04:$A2FE:A5 0C LDA $0C 0x012310|$04:$A300:C5 A5 CMP $A5 0x012312|$04:$A302:B0 0C BCS $A310 ; control flow target (from $A2FA) 0x012314|$04:$A304:A5 0C LDA $0C 0x012316|$04:$A306:85 A5 STA $A5 0x012318|$04:$A308:A5 0D LDA $0D 0x01231A|$04:$A30A:85 A6 STA $A6 0x01231C|$04:$A30C:A5 A9 LDA $A9 0x01231E|$04:$A30E:85 A4 STA $A4 ; control flow target (from $A2DD, $A2E8, $A2FC, $A302) 0x012320|$04:$A310:E6 A9 INC $A9 0x012322|$04:$A312:A5 A9 LDA $A9 0x012324|$04:$A314:29 0F AND #$0F 0x012326|$04:$A316:C9 09 CMP #$09 0x012328|$04:$A318:90 BB BCC $A2D5 0x01232A|$04:$A31A:AE DB 06 LDX $06DB 0x01232D|$04:$A31D:A5 A4 LDA $A4 0x01232F|$04:$A31F:9D D5 06 STA $06D5,X 0x012332|$04:$A322:E8 INX 0x012333|$04:$A323:E0 06 CPX #$06 0x012335|$04:$A325:90 02 BCC $A329 0x012337|$04:$A327:A2 00 LDX #$00 ; control flow target (from $A325) 0x012339|$04:$A329:8E DB 06 STX $06DB 0x01233C|$04:$A32C:29 0F AND #$0F 0x01233E|$04:$A32E:60 RTS ; control flow target (from $A256) 0x01233F|$04:$A32F:CA DEX 0x012340|$04:$A330:D0 2F BNE $A361 0x012342|$04:$A332:A5 A8 LDA $A8 0x012344|$04:$A334:C9 18 CMP #$18 0x012346|$04:$A336:D0 04 BNE $A33C 0x012348|$04:$A338:A9 3B LDA #$3B 0x01234A|$04:$A33A:D0 06 BNE $A342 ; control flow target (from $A336) 0x01234C|$04:$A33C:C9 19 CMP #$19 0x01234E|$04:$A33E:D0 05 BNE $A345 0x012350|$04:$A340:A9 3D LDA #$3D ; control flow target (from $A33A) 0x012352|$04:$A342:20 E5 9C JSR $9CE5 ; control flow target (from $A33E) 0x012355|$04:$A345:A0 01 LDY #$01 0x012357|$04:$A347:B1 B9 LDA ($B9),Y 0x012359|$04:$A349:85 AA STA $AA ; control flow target (from $A373) 0x01235B|$04:$A34B:A9 01 LDA #$01 0x01235D|$04:$A34D:85 A9 STA $A9 ; control flow target (from $A35E) 0x01235F|$04:$A34F:20 F9 A4 JSR $A4F9 0x012362|$04:$A352:A5 98 LDA $98 ; outcome of last fight? 0x012364|$04:$A354:D0 0A BNE $A360 0x012366|$04:$A356:E6 A9 INC $A9 0x012368|$04:$A358:A5 A9 LDA $A9 0x01236A|$04:$A35A:29 0F AND #$0F 0x01236C|$04:$A35C:C9 09 CMP #$09 0x01236E|$04:$A35E:90 EF BCC $A34F ; control flow target (from $A354, $A386) 0x012370|$04:$A360:60 RTS ; control flow target (from $A330) 0x012371|$04:$A361:CA DEX 0x012372|$04:$A362:D0 35 BNE $A399 0x012374|$04:$A364:A5 A8 LDA $A8 0x012376|$04:$A366:C9 1A CMP #$1A 0x012378|$04:$A368:D0 05 BNE $A36F 0x01237A|$04:$A36A:A9 3F LDA #$3F 0x01237C|$04:$A36C:20 E5 9C JSR $9CE5 ; control flow target (from $A368) 0x01237F|$04:$A36F:A9 00 LDA #$00 0x012381|$04:$A371:85 AA STA $AA ; control flow target (from $A380) 0x012383|$04:$A373:20 4B A3 JSR $A34B 0x012386|$04:$A376:A5 98 LDA $98 ; outcome of last fight? 0x012388|$04:$A378:D0 08 BNE $A382 0x01238A|$04:$A37A:E6 AA INC $AA 0x01238C|$04:$A37C:A5 AA LDA $AA 0x01238E|$04:$A37E:C9 04 CMP #$04 0x012390|$04:$A380:90 F1 BCC $A373 ; control flow target (from $A378) 0x012392|$04:$A382:A5 A8 LDA $A8 0x012394|$04:$A384:C9 0C CMP #$0C 0x012396|$04:$A386:D0 D8 BNE $A360 0x012398|$04:$A388:A5 AB LDA $AB 0x01239A|$04:$A38A:85 AE STA $AE 0x01239C|$04:$A38C:A5 98 LDA $98 ; outcome of last fight? 0x01239E|$04:$A38E:F0 04 BEQ $A394 0x0123A0|$04:$A390:A9 FD LDA #$FD 0x0123A2|$04:$A392:85 98 STA $98 ; outcome of last fight? ; control flow target (from $A38E) 0x0123A4|$04:$A394:A9 27 LDA #$27 0x0123A6|$04:$A396:4C 55 AF JMP $AF55 ; control flow target (from $A362) 0x0123A9|$04:$A399:CA DEX 0x0123AA|$04:$A39A:D0 0D BNE $A3A9 0x0123AC|$04:$A39C:A5 B3 LDA $B3 0x0123AE|$04:$A39E:09 80 ORA #$80 0x0123B0|$04:$A3A0:85 B3 STA $B3 0x0123B2|$04:$A3A2:A9 16 LDA #$16 0x0123B4|$04:$A3A4:85 B2 STA $B2 0x0123B6|$04:$A3A6:4C E7 9A JMP $9AE7 ; control flow target (from $A39A) 0x0123B9|$04:$A3A9:A0 01 LDY #$01 0x0123BB|$04:$A3AB:B1 B9 LDA ($B9),Y 0x0123BD|$04:$A3AD:49 FF EOR #$FF 0x0123BF|$04:$A3AF:85 AE STA $AE 0x0123C1|$04:$A3B1:49 FF EOR #$FF 0x0123C3|$04:$A3B3:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x0123C6|$04:$A3B6:A0 00 LDY #$00 0x0123C8|$04:$A3B8:A9 84 LDA #$84 0x0123CA|$04:$A3BA:91 C3 STA ($C3),Y 0x0123CC|$04:$A3BC:20 50 A4 JSR $A450 ; set hero current HP to max HP 0x0123CF|$04:$A3BF:A0 05 LDY #$05 0x0123D1|$04:$A3C1:B1 C3 LDA ($C3),Y 0x0123D3|$04:$A3C3:A0 10 LDY #$10 0x0123D5|$04:$A3C5:91 C3 STA ($C3),Y 0x0123D7|$04:$A3C7:A0 0C LDY #$0C 0x0123D9|$04:$A3C9:B1 C3 LDA ($C3),Y 0x0123DB|$04:$A3CB:C8 INY 0x0123DC|$04:$A3CC:91 C3 STA ($C3),Y 0x0123DE|$04:$A3CE:4C 49 A4 JMP $A449 ; control flow target (from $A1EC, $A20F) 0x0123E1|$04:$A3D1:A0 01 LDY #$01 0x0123E3|$04:$A3D3:B1 B9 LDA ($B9),Y 0x0123E5|$04:$A3D5:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x0123E8|$04:$A3D8:A0 00 LDY #$00 0x0123EA|$04:$A3DA:B1 C3 LDA ($C3),Y 0x0123EC|$04:$A3DC:30 01 BMI $A3DF 0x0123EE|$04:$A3DE:60 RTS ; control flow target (from $A3DC) 0x0123EF|$04:$A3DF:A0 01 LDY #$01 0x0123F1|$04:$A3E1:B1 B9 LDA ($B9),Y 0x0123F3|$04:$A3E3:49 FF EOR #$FF 0x0123F5|$04:$A3E5:85 AE STA $AE 0x0123F7|$04:$A3E7:20 6A A7 JSR $A76A 0x0123FA|$04:$A3EA:A5 A8 LDA $A8 0x0123FC|$04:$A3EC:C9 1D CMP #$1D 0x0123FE|$04:$A3EE:F0 50 BEQ $A440 0x012400|$04:$A3F0:C9 1E CMP #$1E 0x012402|$04:$A3F2:F0 4F BEQ $A443 0x012404|$04:$A3F4:C9 15 CMP #$15 0x012406|$04:$A3F6:F0 51 BEQ $A449 0x012408|$04:$A3F8:C9 0A CMP #$0A 0x01240A|$04:$A3FA:F0 65 BEQ $A461 0x01240C|$04:$A3FC:C9 14 CMP #$14 0x01240E|$04:$A3FE:F0 61 BEQ $A461 0x012410|$04:$A400:D0 44 BNE $A446 ; heal hero ID in A by random amount based on healing power in X ; control flow target (from $8006) 0x012412|$04:$A402:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x012415|$04:$A405:8A TXA 0x012416|$04:$A406:C9 FF CMP #$FF 0x012418|$04:$A408:D0 08 BNE $A412 0x01241A|$04:$A40A:A9 F0 LDA #$F0 ; X == #$FF => heal 61,680 HP 0x01241C|$04:$A40C:85 B0 STA $B0 0x01241E|$04:$A40E:85 B1 STA $B1 0x012420|$04:$A410:D0 03 BNE $A415 ; control flow target (from $A408) 0x012422|$04:$A412:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 ; control flow target (from $A410, $A446) 0x012425|$04:$A415:A0 0E LDY #$0E ; hero current HP, low byte 0x012427|$04:$A417:B1 C3 LDA ($C3),Y 0x012429|$04:$A419:18 CLC 0x01242A|$04:$A41A:65 B0 ADC $B0 ; HP to restore, low byte 0x01242C|$04:$A41C:91 C3 STA ($C3),Y 0x01242E|$04:$A41E:85 99 STA $99 ; new current HP, low byte 0x012430|$04:$A420:A0 0F LDY #$0F ; hero current HP, high byte 0x012432|$04:$A422:B1 C3 LDA ($C3),Y 0x012434|$04:$A424:65 B1 ADC $B1 ; HP to restore, high byte 0x012436|$04:$A426:91 C3 STA ($C3),Y 0x012438|$04:$A428:85 9A STA $9A ; new current HP, high byte 0x01243A|$04:$A42A:A0 04 LDY #$04 ; hero max HP, high byte 0x01243C|$04:$A42C:B1 C3 LDA ($C3),Y 0x01243E|$04:$A42E:C5 9A CMP $9A ; new current HP, high byte 0x012440|$04:$A430:90 0A BCC $A43C 0x012442|$04:$A432:D0 0B BNE $A43F ; if high bytes are the same, compare low bytes, otherwise done 0x012444|$04:$A434:A0 03 LDY #$03 ; hero max HP, low byte 0x012446|$04:$A436:B1 C3 LDA ($C3),Y 0x012448|$04:$A438:C5 99 CMP $99 ; new current HP, low byte 0x01244A|$04:$A43A:B0 03 BCS $A43F ; if max >= current, then done ; control flow target (from $A430) 0x01244C|$04:$A43C:20 50 A4 JSR $A450 ; set hero current HP to max HP ; control flow target (from $A432, $A43A) 0x01244F|$04:$A43F:60 RTS ; control flow target (from $A3EE) 0x012450|$04:$A440:4C 93 A4 JMP $A493 ; control flow target (from $A3F2) 0x012453|$04:$A443:4C C6 A4 JMP $A4C6 ; control flow target (from $A400) 0x012456|$04:$A446:20 15 A4 JSR $A415 ; control flow target (from $A3CE, $A3F6, $A490, $A49B, $A6A2) 0x012459|$04:$A449:A0 03 LDY #$03 ; control flow target (from $A4D0, $A69F) 0x01245B|$04:$A44B:B1 C5 LDA ($C5),Y 0x01245D|$04:$A44D:4C E5 9C JMP $9CE5 ; set hero current HP to max HP ; control flow target (from $A3BC, $A43C) 0x012460|$04:$A450:A0 03 LDY #$03 ; hero max HP, low byte 0x012462|$04:$A452:B1 C3 LDA ($C3),Y 0x012464|$04:$A454:A0 0E LDY #$0E ; hero current HP, low byte 0x012466|$04:$A456:91 C3 STA ($C3),Y 0x012468|$04:$A458:A0 04 LDY #$04 ; hero max HP, high byte 0x01246A|$04:$A45A:B1 C3 LDA ($C3),Y 0x01246C|$04:$A45C:A0 0F LDY #$0F ; hero current HP, high byte 0x01246E|$04:$A45E:91 C3 STA ($C3),Y 0x012470|$04:$A460:60 RTS ; control flow target (from $A3FA, $A3FE) 0x012471|$04:$A461:A0 0D LDY #$0D 0x012473|$04:$A463:B1 C3 LDA ($C3),Y 0x012475|$04:$A465:85 9D STA $9D 0x012477|$04:$A467:18 CLC 0x012478|$04:$A468:65 B0 ADC $B0 0x01247A|$04:$A46A:90 02 BCC $A46E 0x01247C|$04:$A46C:A9 FF LDA #$FF ; control flow target (from $A46A) 0x01247E|$04:$A46E:85 9A STA $9A 0x012480|$04:$A470:A0 0C LDY #$0C 0x012482|$04:$A472:B1 C3 LDA ($C3),Y 0x012484|$04:$A474:85 99 STA $99 0x012486|$04:$A476:20 DA A4 JSR $A4DA 0x012489|$04:$A479:A5 99 LDA $99 0x01248B|$04:$A47B:C5 9A CMP $9A 0x01248D|$04:$A47D:B0 02 BCS $A481 0x01248F|$04:$A47F:85 9A STA $9A ; control flow target (from $A47D) 0x012491|$04:$A481:A5 9A LDA $9A 0x012493|$04:$A483:A0 0D LDY #$0D 0x012495|$04:$A485:91 C3 STA ($C3),Y 0x012497|$04:$A487:38 SEC 0x012498|$04:$A488:E5 9D SBC $9D 0x01249A|$04:$A48A:85 B0 STA $B0 0x01249C|$04:$A48C:A9 00 LDA #$00 0x01249E|$04:$A48E:85 B1 STA $B1 0x0124A0|$04:$A490:4C 49 A4 JMP $A449 ; control flow target (from $A440) 0x0124A3|$04:$A493:A0 00 LDY #$00 0x0124A5|$04:$A495:B1 C3 LDA ($C3),Y 0x0124A7|$04:$A497:29 DF AND #$DF 0x0124A9|$04:$A499:91 C3 STA ($C3),Y 0x0124AB|$04:$A49B:4C 49 A4 JMP $A449 ; restore the hero ID in A's MP by a random amount based on the Wizard's Ring's power; returns a random number between $03 and #$0A in A and $99 ; control flow target (from $8003) 0x0124AE|$04:$A49E:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x0124B1|$04:$A4A1:A9 2C LDA #$2C ; power for Item ID #$3D: Wizard's Ring 0x0124B3|$04:$A4A3:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 ; restore the current hero's MP by the amount in $B0; returns a random number between $03 and #$0A in A and $99 ; control flow target (from $A4C6) 0x0124B6|$04:$A4A6:A0 10 LDY #$10 0x0124B8|$04:$A4A8:B1 B9 LDA ($B9),Y ; Current MP 0x0124BA|$04:$A4AA:18 CLC 0x0124BB|$04:$A4AB:65 B0 ADC $B0 ; MP gain from Wizard's Ring 0x0124BD|$04:$A4AD:90 02 BCC $A4B1 ; cap new current MP at #$FF 0x0124BF|$04:$A4AF:A9 FF LDA #$FF ; control flow target (from $A4AD) 0x0124C1|$04:$A4B1:91 B9 STA ($B9),Y ; Current MP 0x0124C3|$04:$A4B3:85 99 STA $99 ; Current MP 0x0124C5|$04:$A4B5:A0 05 LDY #$05 0x0124C7|$04:$A4B7:B1 B9 LDA ($B9),Y ; Max MP 0x0124C9|$04:$A4B9:C5 99 CMP $99 ; Current MP 0x0124CB|$04:$A4BB:B0 04 BCS $A4C1 ; cap new current MP at Max MP 0x0124CD|$04:$A4BD:A0 10 LDY #$10 0x0124CF|$04:$A4BF:91 B9 STA ($B9),Y ; Current MP ; control flow target (from $A4BB) 0x0124D1|$04:$A4C1:A9 0A LDA #$0A 0x0124D3|$04:$A4C3:4C 20 A0 JMP $A020 ; generate a random number between $03 and A in A and $99 ; control flow target (from $A443) 0x0124D6|$04:$A4C6:20 A6 A4 JSR $A4A6 ; restore the current hero's MP by the amount in $B0; returns a random number between $03 and #$0A in A and $99 0x0124D9|$04:$A4C9:D0 08 BNE $A4D3 0x0124DB|$04:$A4CB:20 F0 A4 JSR $A4F0 0x0124DE|$04:$A4CE:A0 04 LDY #$04 0x0124E0|$04:$A4D0:4C 4B A4 JMP $A44B ; control flow target (from $A4C9) 0x0124E3|$04:$A4D3:A9 A1 LDA #$A1 0x0124E5|$04:$A4D5:85 AD STA $AD 0x0124E7|$04:$A4D7:4C DC 9C JMP $9CDC ; control flow target (from $A476, $AC2A) 0x0124EA|$04:$A4DA:A5 99 LDA $99 0x0124EC|$04:$A4DC:4A LSR 0x0124ED|$04:$A4DD:18 CLC 0x0124EE|$04:$A4DE:65 99 ADC $99 0x0124F0|$04:$A4E0:90 02 BCC $A4E4 0x0124F2|$04:$A4E2:A9 FF LDA #$FF ; control flow target (from $A4E0) 0x0124F4|$04:$A4E4:85 99 STA $99 0x0124F6|$04:$A4E6:60 RTS ; given a hero ID in $A7 and an item ID in A, SEC if hero has that item, CLC otherwise ; control flow target (from $A1B4, $A266, $A5E9, $A5F4, $A5FB) 0x0124F7|$04:$A4E7:48 PHA 0x0124F8|$04:$A4E8:A5 A7 LDA $A7 0x0124FA|$04:$A4EA:85 9C STA $9C 0x0124FC|$04:$A4EC:68 PLA ; call to code in a different bank ($0F:$C4B0) 0x0124FD|$04:$A4ED:4C B0 C4 JMP $C4B0 ; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise ; control flow target (from $A18C, $A4CB) 0x012500|$04:$A4F0:A5 A7 LDA $A7 0x012502|$04:$A4F2:A8 TAY 0x012503|$04:$A4F3:BE D2 06 LDX $06D2,Y ; call to code in a different bank ($0F:$C4D4) 0x012506|$04:$A4F6:4C D4 C4 JMP $C4D4 ; given hero ID in A and hero inventory offset in X, remove that item from hero's inventory and move all lower items up 1 slot ; control flow target (from $A2B3, $A34F) 0x012509|$04:$A4F9:A5 AA LDA $AA 0x01250B|$04:$A4FB:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x01250E|$04:$A4FE:A5 AA LDA $AA 0x012510|$04:$A500:0A ASL 0x012511|$04:$A501:0A ASL 0x012512|$04:$A502:0A ASL 0x012513|$04:$A503:0A ASL 0x012514|$04:$A504:A4 A9 LDY $A9 0x012516|$04:$A506:05 A9 ORA $A9 0x012518|$04:$A508:85 AF STA $AF 0x01251A|$04:$A50A:B1 B5 LDA ($B5),Y 0x01251C|$04:$A50C:C9 08 CMP #$08 0x01251E|$04:$A50E:90 01 BCC $A511 0x012520|$04:$A510:60 RTS ; control flow target (from $A50E) 0x012521|$04:$A511:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x012524|$04:$A514:A0 00 LDY #$00 0x012526|$04:$A516:B1 B5 LDA ($B5),Y 0x012528|$04:$A518:85 AE STA $AE 0x01252A|$04:$A51A:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x01252D|$04:$A51D:20 8F A7 JSR $A78F 0x012530|$04:$A520:A5 A8 LDA $A8 0x012532|$04:$A522:C9 00 CMP #$00 0x012534|$04:$A524:F0 41 BEQ $A567 0x012536|$04:$A526:C9 04 CMP #$04 0x012538|$04:$A528:F0 48 BEQ $A572 0x01253A|$04:$A52A:C9 11 CMP #$11 0x01253C|$04:$A52C:F0 44 BEQ $A572 0x01253E|$04:$A52E:C9 02 CMP #$02 0x012540|$04:$A530:F0 4E BEQ $A580 0x012542|$04:$A532:C9 12 CMP #$12 0x012544|$04:$A534:F0 4A BEQ $A580 0x012546|$04:$A536:C9 06 CMP #$06 0x012548|$04:$A538:F0 4E BEQ $A588 0x01254A|$04:$A53A:C9 07 CMP #$07 0x01254C|$04:$A53C:F0 52 BEQ $A590 0x01254E|$04:$A53E:C9 1A CMP #$1A 0x012550|$04:$A540:F0 4E BEQ $A590 0x012552|$04:$A542:C9 08 CMP #$08 0x012554|$04:$A544:F0 68 BEQ $A5AE 0x012556|$04:$A546:C9 13 CMP #$13 0x012558|$04:$A548:F0 64 BEQ $A5AE 0x01255A|$04:$A54A:C9 0C CMP #$0C 0x01255C|$04:$A54C:F0 1C BEQ $A56A 0x01255E|$04:$A54E:A9 00 LDA #$00 0x012560|$04:$A550:20 4A A7 JSR $A74A 0x012563|$04:$A553:90 0B BCC $A560 0x012565|$04:$A555:A5 B0 LDA $B0 0x012567|$04:$A557:D0 04 BNE $A55D 0x012569|$04:$A559:A9 01 LDA #$01 0x01256B|$04:$A55B:85 B0 STA $B0 ; control flow target (from $A557) 0x01256D|$04:$A55D:4C 92 A6 JMP $A692 ; control flow target (from $A553, $A56E, $A577, $A5A1, $A5B3) 0x012570|$04:$A560:A0 04 LDY #$04 ; control flow target (from $A5AB) 0x012572|$04:$A562:B1 C5 LDA ($C5),Y 0x012574|$04:$A564:4C E5 9C JMP $9CE5 ; control flow target (from $A524) 0x012577|$04:$A567:4C E3 A5 JMP $A5E3 ; control flow target (from $A54C) 0x01257A|$04:$A56A:A5 AE LDA $AE 0x01257C|$04:$A56C:C9 4E CMP #$4E 0x01257E|$04:$A56E:B0 F0 BCS $A560 0x012580|$04:$A570:90 07 BCC $A579 ; control flow target (from $A528, $A52C) 0x012582|$04:$A572:A9 03 LDA #$03 0x012584|$04:$A574:20 4A A7 JSR $A74A 0x012587|$04:$A577:90 E7 BCC $A560 ; control flow target (from $A570) 0x012589|$04:$A579:A0 03 LDY #$03 0x01258B|$04:$A57B:B1 C5 LDA ($C5),Y 0x01258D|$04:$A57D:4C C2 A6 JMP $A6C2 ; control flow target (from $A530, $A534) 0x012590|$04:$A580:A9 80 LDA #$80 0x012592|$04:$A582:85 A1 STA $A1 0x012594|$04:$A584:A9 01 LDA #$01 0x012596|$04:$A586:D0 0E BNE $A596 ; control flow target (from $A538) 0x012598|$04:$A588:A9 40 LDA #$40 0x01259A|$04:$A58A:85 A1 STA $A1 0x01259C|$04:$A58C:A9 02 LDA #$02 0x01259E|$04:$A58E:D0 06 BNE $A596 ; control flow target (from $A53C, $A540) 0x0125A0|$04:$A590:A9 01 LDA #$01 0x0125A2|$04:$A592:85 A1 STA $A1 0x0125A4|$04:$A594:A9 04 LDA #$04 ; control flow target (from $A586, $A58E) 0x0125A6|$04:$A596:20 4A A7 JSR $A74A 0x0125A9|$04:$A599:A0 00 LDY #$00 0x0125AB|$04:$A59B:B1 B7 LDA ($B7),Y 0x0125AD|$04:$A59D:25 A1 AND $A1 0x0125AF|$04:$A59F:D0 0C BNE $A5AD 0x0125B1|$04:$A5A1:90 BD BCC $A560 0x0125B3|$04:$A5A3:B1 B7 LDA ($B7),Y 0x0125B5|$04:$A5A5:05 A1 ORA $A1 0x0125B7|$04:$A5A7:91 B7 STA ($B7),Y ; control flow target (from $A5E0) 0x0125B9|$04:$A5A9:A0 03 LDY #$03 0x0125BB|$04:$A5AB:D0 B5 BNE $A562 ; control flow target (from $A59F) 0x0125BD|$04:$A5AD:60 RTS ; control flow target (from $A544, $A548) 0x0125BE|$04:$A5AE:A9 05 LDA #$05 0x0125C0|$04:$A5B0:20 4A A7 JSR $A74A 0x0125C3|$04:$A5B3:90 AB BCC $A560 0x0125C5|$04:$A5B5:A0 06 LDY #$06 0x0125C7|$04:$A5B7:B1 B7 LDA ($B7),Y 0x0125C9|$04:$A5B9:85 9A STA $9A 0x0125CB|$04:$A5BB:38 SEC 0x0125CC|$04:$A5BC:E5 B0 SBC $B0 0x0125CE|$04:$A5BE:B0 02 BCS $A5C2 0x0125D0|$04:$A5C0:A9 00 LDA #$00 ; control flow target (from $A5BE) 0x0125D2|$04:$A5C2:85 99 STA $99 0x0125D4|$04:$A5C4:A0 06 LDY #$06 0x0125D6|$04:$A5C6:B1 BB LDA ($BB),Y 0x0125D8|$04:$A5C8:4A LSR 0x0125D9|$04:$A5C9:C5 99 CMP $99 0x0125DB|$04:$A5CB:B0 02 BCS $A5CF 0x0125DD|$04:$A5CD:A5 99 LDA $99 ; control flow target (from $A5CB) 0x0125DF|$04:$A5CF:A0 06 LDY #$06 0x0125E1|$04:$A5D1:91 B7 STA ($B7),Y 0x0125E3|$04:$A5D3:85 99 STA $99 0x0125E5|$04:$A5D5:A5 9A LDA $9A 0x0125E7|$04:$A5D7:38 SEC 0x0125E8|$04:$A5D8:E5 99 SBC $99 0x0125EA|$04:$A5DA:85 B0 STA $B0 0x0125EC|$04:$A5DC:A9 00 LDA #$00 0x0125EE|$04:$A5DE:85 B1 STA $B1 0x0125F0|$04:$A5E0:4C A9 A5 JMP $A5A9 ; control flow target (from $A567) 0x0125F3|$04:$A5E3:A9 08 LDA #$08 0x0125F5|$04:$A5E5:85 A6 STA $A6 0x0125F7|$04:$A5E7:A9 4C LDA #$4C ; Item ID #$4C: Sword of Destruction (equipped) 0x0125F9|$04:$A5E9:20 E7 A4 JSR $A4E7 ; given a hero ID in $A7 and an item ID in A, SEC if hero has that item, CLC otherwise 0x0125FC|$04:$A5EC:B0 12 BCS $A600 0x0125FE|$04:$A5EE:A9 40 LDA #$40 0x012600|$04:$A5F0:85 A6 STA $A6 0x012602|$04:$A5F2:A9 57 LDA #$57 ; Item ID #$57: Gremlin’s Armor (equipped) 0x012604|$04:$A5F4:20 E7 A4 JSR $A4E7 ; given a hero ID in $A7 and an item ID in A, SEC if hero has that item, CLC otherwise 0x012607|$04:$A5F7:B0 07 BCS $A600 0x012609|$04:$A5F9:A9 5F LDA #$5F ; Item ID #$5F: Evil Shield (equipped) 0x01260B|$04:$A5FB:20 E7 A4 JSR $A4E7 ; given a hero ID in $A7 and an item ID in A, SEC if hero has that item, CLC otherwise 0x01260E|$04:$A5FE:90 07 BCC $A607 ; control flow target (from $A5EC, $A5F7) 0x012610|$04:$A600:A9 04 LDA #$04 0x012612|$04:$A602:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x012615|$04:$A605:F0 72 BEQ $A679 ; control flow target (from $A5FE) 0x012617|$04:$A607:A5 A6 LDA $A6 0x012619|$04:$A609:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x01261C|$04:$A60C:D0 16 BNE $A624 0x01261E|$04:$A60E:AD 61 01 LDA $0161 ; current monster ID 0x012621|$04:$A611:C9 52 CMP #$52 0x012623|$04:$A613:F0 0F BEQ $A624 0x012625|$04:$A615:A0 0B LDY #$0B 0x012627|$04:$A617:B1 B9 LDA ($B9),Y 0x012629|$04:$A619:20 A1 A7 JSR $A7A1 0x01262C|$04:$A61C:A9 0D LDA #$0D ; String ID #$000D: A tremendous blow![end-FC] 0x01262E|$04:$A61E:20 DE 9A JSR $9ADE ; STA $B4, $B3 |= #$20 0x012631|$04:$A621:4C 86 A6 JMP $A686 ; control flow target (from $A60C, $A613) 0x012634|$04:$A624:A0 0B LDY #$0B 0x012636|$04:$A626:B1 B9 LDA ($B9),Y 0x012638|$04:$A628:85 99 STA $99 0x01263A|$04:$A62A:A0 06 LDY #$06 0x01263C|$04:$A62C:B1 B7 LDA ($B7),Y 0x01263E|$04:$A62E:85 9B STA $9B 0x012640|$04:$A630:A9 00 LDA #$00 0x012642|$04:$A632:85 9A STA $9A 0x012644|$04:$A634:85 9C STA $9C 0x012646|$04:$A636:20 45 9F JSR $9F45 0x012649|$04:$A639:A5 99 LDA $99 0x01264B|$04:$A63B:85 B0 STA $B0 0x01264D|$04:$A63D:A5 9A LDA $9A 0x01264F|$04:$A63F:85 B1 STA $B1 0x012651|$04:$A641:A0 00 LDY #$00 0x012653|$04:$A643:B1 B9 LDA ($B9),Y 0x012655|$04:$A645:29 02 AND #$02 0x012657|$04:$A647:F0 0D BEQ $A656 0x012659|$04:$A649:A9 04 LDA #$04 0x01265B|$04:$A64B:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x01265E|$04:$A64E:D0 06 BNE $A656 0x012660|$04:$A650:A9 00 LDA #$00 0x012662|$04:$A652:85 B0 STA $B0 0x012664|$04:$A654:85 B1 STA $B1 ; control flow target (from $A647, $A64E) 0x012666|$04:$A656:A0 00 LDY #$00 0x012668|$04:$A658:B1 B7 LDA ($B7),Y 0x01266A|$04:$A65A:30 1A BMI $A676 0x01266C|$04:$A65C:A0 01 LDY #$01 0x01266E|$04:$A65E:B1 BB LDA ($BB),Y 0x012670|$04:$A660:4A LSR 0x012671|$04:$A661:4A LSR 0x012672|$04:$A662:4A LSR 0x012673|$04:$A663:4A LSR 0x012674|$04:$A664:85 A6 STA $A6 0x012676|$04:$A666:A9 40 LDA #$40 0x012678|$04:$A668:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x01267B|$04:$A66B:A5 99 LDA $99 0x01267D|$04:$A66D:C5 A6 CMP $A6 0x01267F|$04:$A66F:B0 05 BCS $A676 0x012681|$04:$A671:A9 0A LDA #$0A ; String ID #$000A: [name] dodged the blow.[end-FC] 0x012683|$04:$A673:4C E5 9C JMP $9CE5 ; control flow target (from $A65A, $A66F) 0x012686|$04:$A676:4C 86 A6 JMP $A686 ; control flow target (from $A605) 0x012689|$04:$A679:A9 42 LDA #$42 ; String ID #$0042: No movement was possible, for the curse had frozen [name]'s body.[end-FC] 0x01268B|$04:$A67B:85 B2 STA $B2 0x01268D|$04:$A67D:A5 A7 LDA $A7 0x01268F|$04:$A67F:49 FF EOR #$FF 0x012691|$04:$A681:85 AE STA $AE 0x012693|$04:$A683:4C E7 9A JMP $9AE7 ; control flow target (from $A621, $A676, $A932) 0x012696|$04:$A686:A0 01 LDY #$01 0x012698|$04:$A688:B1 B7 LDA ($B7),Y 0x01269A|$04:$A68A:C9 04 CMP #$04 0x01269C|$04:$A68C:D0 04 BNE $A692 0x01269E|$04:$A68E:46 B1 LSR $B1 0x0126A0|$04:$A690:66 B0 ROR $B0 ; control flow target (from $A55D, $A68C) 0x0126A2|$04:$A692:A5 B0 LDA $B0 0x0126A4|$04:$A694:05 B1 ORA $B1 0x0126A6|$04:$A696:D0 0A BNE $A6A2 0x0126A8|$04:$A698:A9 07 LDA #$07 ; String ID #$0007: But missed![end-FC] 0x0126AA|$04:$A69A:20 DE 9A JSR $9ADE ; STA $B4, $B3 |= #$20 0x0126AD|$04:$A69D:A0 04 LDY #$04 0x0126AF|$04:$A69F:4C 4B A4 JMP $A44B ; control flow target (from $A696) 0x0126B2|$04:$A6A2:20 49 A4 JSR $A449 0x0126B5|$04:$A6A5:A0 04 LDY #$04 0x0126B7|$04:$A6A7:B1 B7 LDA ($B7),Y 0x0126B9|$04:$A6A9:38 SEC 0x0126BA|$04:$A6AA:E5 B0 SBC $B0 0x0126BC|$04:$A6AC:91 B7 STA ($B7),Y 0x0126BE|$04:$A6AE:85 99 STA $99 0x0126C0|$04:$A6B0:C8 INY 0x0126C1|$04:$A6B1:B1 B7 LDA ($B7),Y 0x0126C3|$04:$A6B3:E5 B1 SBC $B1 0x0126C5|$04:$A6B5:91 B7 STA ($B7),Y 0x0126C7|$04:$A6B7:90 07 BCC $A6C0 0x0126C9|$04:$A6B9:D0 04 BNE $A6BF 0x0126CB|$04:$A6BB:A5 99 LDA $99 0x0126CD|$04:$A6BD:F0 01 BEQ $A6C0 ; control flow target (from $A6B9) 0x0126CF|$04:$A6BF:60 RTS ; control flow target (from $A6B7, $A6BD) 0x0126D0|$04:$A6C0:A9 19 LDA #$19 ; control flow target (from $A57D) 0x0126D2|$04:$A6C2:85 B2 STA $B2 0x0126D4|$04:$A6C4:A4 A9 LDY $A9 0x0126D6|$04:$A6C6:B1 B5 LDA ($B5),Y 0x0126D8|$04:$A6C8:09 08 ORA #$08 0x0126DA|$04:$A6CA:91 B5 STA ($B5),Y 0x0126DC|$04:$A6CC:29 07 AND #$07 0x0126DE|$04:$A6CE:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x0126E1|$04:$A6D1:A9 FF LDA #$FF 0x0126E3|$04:$A6D3:A0 03 LDY #$03 0x0126E5|$04:$A6D5:91 B7 STA ($B7),Y 0x0126E7|$04:$A6D7:A0 09 LDY #$09 0x0126E9|$04:$A6D9:B1 B5 LDA ($B5),Y 0x0126EB|$04:$A6DB:AA TAX 0x0126EC|$04:$A6DC:CA DEX 0x0126ED|$04:$A6DD:8A TXA 0x0126EE|$04:$A6DE:91 B5 STA ($B5),Y 0x0126F0|$04:$A6E0:A0 00 LDY #$00 0x0126F2|$04:$A6E2:B1 B5 LDA ($B5),Y 0x0126F4|$04:$A6E4:8D 61 01 STA $0161 ; current monster ID 0x0126F7|$04:$A6E7:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x0126FA|$04:$A6EA:A6 A7 LDX $A7 0x0126FC|$04:$A6EC:E0 77 CPX #$77 0x0126FE|$04:$A6EE:F0 4E BEQ $A73E 0x012700|$04:$A6F0:A0 09 LDY #$09 0x012702|$04:$A6F2:B1 BB LDA ($BB),Y 0x012704|$04:$A6F4:2A ROL 0x012705|$04:$A6F5:2A ROL 0x012706|$04:$A6F6:2A ROL 0x012707|$04:$A6F7:29 03 AND #$03 0x012709|$04:$A6F9:85 99 STA $99 0x01270B|$04:$A6FB:88 DEY 0x01270C|$04:$A6FC:B1 BB LDA ($BB),Y 0x01270E|$04:$A6FE:2A ROL 0x01270F|$04:$A6FF:26 99 ROL $99 0x012711|$04:$A701:2A ROL 0x012712|$04:$A702:26 99 ROL $99 0x012714|$04:$A704:A0 03 LDY #$03 0x012716|$04:$A706:B1 BB LDA ($BB),Y 0x012718|$04:$A708:18 CLC 0x012719|$04:$A709:6D 26 06 ADC $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x01271C|$04:$A70C:8D 26 06 STA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x01271F|$04:$A70F:A5 99 LDA $99 0x012721|$04:$A711:6D 27 06 ADC $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x012724|$04:$A714:8D 27 06 STA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 0x012727|$04:$A717:90 08 BCC $A721 0x012729|$04:$A719:A9 FF LDA #$FF 0x01272B|$04:$A71B:8D 26 06 STA $0626 ; EXP earned this battle or current hero's current EXP, byte 0 0x01272E|$04:$A71E:8D 27 06 STA $0627 ; EXP earned this battle or current hero's current EXP, byte 1 ; control flow target (from $A717) 0x012731|$04:$A721:A0 02 LDY #$02 0x012733|$04:$A723:B1 BB LDA ($BB),Y 0x012735|$04:$A725:18 CLC 0x012736|$04:$A726:6D E6 06 ADC $06E6 0x012739|$04:$A729:8D E6 06 STA $06E6 0x01273C|$04:$A72C:A9 00 LDA #$00 0x01273E|$04:$A72E:6D EC 06 ADC $06EC 0x012741|$04:$A731:8D EC 06 STA $06EC 0x012744|$04:$A734:90 08 BCC $A73E 0x012746|$04:$A736:A9 FF LDA #$FF 0x012748|$04:$A738:8D E6 06 STA $06E6 0x01274B|$04:$A73B:8D EC 06 STA $06EC ; control flow target (from $A6EE, $A734) 0x01274E|$04:$A73E:20 84 9A JSR $9A84 0x012751|$04:$A741:D0 04 BNE $A747 0x012753|$04:$A743:A9 FE LDA #$FE 0x012755|$04:$A745:85 98 STA $98 ; outcome of last fight? ; control flow target (from $A741) 0x012757|$04:$A747:4C E7 9A JMP $9AE7 ; control flow target (from $A550, $A574, $A596, $A5B0) 0x01275A|$04:$A74A:86 A5 STX $A5 0x01275C|$04:$A74C:4A LSR 0x01275D|$04:$A74D:08 PHP 0x01275E|$04:$A74E:18 CLC 0x01275F|$04:$A74F:69 07 ADC #$07 0x012761|$04:$A751:A8 TAY 0x012762|$04:$A752:B1 BB LDA ($BB),Y 0x012764|$04:$A754:28 PLP 0x012765|$04:$A755:90 03 BCC $A75A 0x012767|$04:$A757:4A LSR 0x012768|$04:$A758:4A LSR 0x012769|$04:$A759:4A LSR ; control flow target (from $A755) 0x01276A|$04:$A75A:29 07 AND #$07 0x01276C|$04:$A75C:85 9B STA $9B 0x01276E|$04:$A75E:A9 07 LDA #$07 0x012770|$04:$A760:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x012773|$04:$A763:A5 99 LDA $99 0x012775|$04:$A765:C5 9B CMP $9B 0x012777|$04:$A767:A6 A5 LDX $A5 0x012779|$04:$A769:60 RTS ; control flow target (from $A3E7) 0x01277A|$04:$A76A:A0 01 LDY #$01 0x01277C|$04:$A76C:B1 C5 LDA ($C5),Y 0x01277E|$04:$A76E:C9 01 CMP #$01 0x012780|$04:$A770:F0 02 BEQ $A774 0x012782|$04:$A772:B0 10 BCS $A784 ; control flow target (from $A770) 0x012784|$04:$A774:08 PHP 0x012785|$04:$A775:A0 0C LDY #$0C 0x012787|$04:$A777:B1 C3 LDA ($C3),Y ; control flow target (from $A79E) 0x012789|$04:$A779:4A LSR 0x01278A|$04:$A77A:28 PLP 0x01278B|$04:$A77B:B0 01 BCS $A77E 0x01278D|$04:$A77D:4A LSR ; Increase and Decrease effect ; control flow target (from $A77B) 0x01278E|$04:$A77E:18 CLC 0x01278F|$04:$A77F:69 01 ADC #$01 ; control flow target (from $A786) 0x012791|$04:$A781:4C 8C AE JMP $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 ; control flow target (from $A772, $A797) 0x012794|$04:$A784:C9 FF CMP #$FF 0x012796|$04:$A786:D0 F9 BNE $A781 0x012798|$04:$A788:85 B0 STA $B0 0x01279A|$04:$A78A:A9 F0 LDA #$F0 0x01279C|$04:$A78C:85 B1 STA $B1 0x01279E|$04:$A78E:60 RTS ; control flow target (from $A51D) 0x01279F|$04:$A78F:A0 01 LDY #$01 0x0127A1|$04:$A791:B1 C5 LDA ($C5),Y 0x0127A3|$04:$A793:C9 01 CMP #$01 0x0127A5|$04:$A795:F0 02 BEQ $A799 0x0127A7|$04:$A797:B0 EB BCS $A784 ; control flow target (from $A795) 0x0127A9|$04:$A799:08 PHP 0x0127AA|$04:$A79A:A0 06 LDY #$06 0x0127AC|$04:$A79C:B1 BB LDA ($BB),Y 0x0127AE|$04:$A79E:4C 79 A7 JMP $A779 ; control flow target (from $A619, $AA1D) 0x0127B1|$04:$A7A1:85 99 STA $99 0x0127B3|$04:$A7A3:4A LSR 0x0127B4|$04:$A7A4:85 A6 STA $A6 0x0127B6|$04:$A7A6:A5 99 LDA $99 0x0127B8|$04:$A7A8:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x0127BB|$04:$A7AB:A5 A6 LDA $A6 0x0127BD|$04:$A7AD:18 CLC 0x0127BE|$04:$A7AE:65 B0 ADC $B0 0x0127C0|$04:$A7B0:85 B0 STA $B0 0x0127C2|$04:$A7B2:A5 B1 LDA $B1 0x0127C4|$04:$A7B4:69 00 ADC #$00 0x0127C6|$04:$A7B6:85 B1 STA $B1 0x0127C8|$04:$A7B8:60 RTS ; control flow target (from $A102, $A201, $A2BA, $A87E, $AE18) 0x0127C9|$04:$A7B9:A5 B3 LDA $B3 0x0127CB|$04:$A7BB:29 8F AND #$8F 0x0127CD|$04:$A7BD:85 B3 STA $B3 0x0127CF|$04:$A7BF:60 RTS ; code -> data ; Battle Structs for Spells and Usable Items (target, power, cast string ID, hit string ID, miss string ID) ; "Spell" ID #$00: Fight ; Spells ; indirect data load target (via $9F31) 0x0127D0|$04:$A7C0:02 02 0x0127D2|$04:$A7C2: 06 ; String ID #$0006: [name] attacked![end-FC] 0x0127D3|$04:$A7C3: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x0127D4|$04:$A7C4: 08 ; String ID #$0008: [name] was wounded.[end-FC] ; Spell ID #$01: Firebal 0x0127D5|$04:$A7C5:02 28 0x0127D7|$04:$A7C7: E1 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127D8|$04:$A7C8: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x0127D9|$04:$A7C9: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$02: Sleep 0x0127DA|$04:$A7CA:03 02 0x0127DC|$04:$A7CC: E2 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127DD|$04:$A7CD: 1C ; String ID #$001C: [name] fell asleep.[end-FC] 0x0127DE|$04:$A7CE: 1D ; String ID #$001D: [name] did not fall asleep.[end-FC] ; Spell ID #$03: Firebane 0x0127DF|$04:$A7CF:04 32 0x0127E1|$04:$A7D1: E3 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127E2|$04:$A7D2: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x0127E3|$04:$A7D3: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$04: Defeat 0x0127E4|$04:$A7D4:03 02 0x0127E6|$04:$A7D6: E4 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127E7|$04:$A7D7: 24 ; String ID #$0024: Thou hast defeated [name].[end-FC] 0x0127E8|$04:$A7D8: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$05: Infernos 0x0127E9|$04:$A7D9:03 32 0x0127EB|$04:$A7DB: E5 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127EC|$04:$A7DC: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x0127ED|$04:$A7DD: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$06: Stopspell 0x0127EE|$04:$A7DE:03 02 0x0127F0|$04:$A7E0: E6 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127F1|$04:$A7E1: 29 ; String ID #$0029: And [name]'s spell was blocked.[end-FC] 0x0127F2|$04:$A7E2: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$07: Surround 0x0127F3|$04:$A7E3:03 02 0x0127F5|$04:$A7E5: E7 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127F6|$04:$A7E6: 2B ; String ID #$002B: And [name] was surrounded by the Phantom Force.[end-FC] 0x0127F7|$04:$A7E7: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$08: Defence 0x0127F8|$04:$A7E8:04 00 0x0127FA|$04:$A7EA: E8 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x0127FB|$04:$A7EB: 21 ; String ID #$0021: [name]'s Defense Power decreased by [number].[end-FC] 0x0127FC|$04:$A7EC: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$09: Heal 0x0127FD|$04:$A7ED:00 40 0x0127FF|$04:$A7EF: E9 ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012800|$04:$A7F0: 17 ; String ID #$0017: [name]'s wounds were healed.[end-FC] 0x012801|$04:$A7F1: 00 ; (impossible outcome; no string for this) ; Spell ID #$0A: Increase 0x012802|$04:$A7F2:01 00 0x012804|$04:$A7F4: EA ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012805|$04:$A7F5: 23 ; String ID #$0023: [name]'s Defense Power increased by [number].[end-FC] 0x012806|$04:$A7F6: 00 ; (impossible outcome; no string for this) ; Spell ID #$0B: Healmore 0x012807|$04:$A7F7:00 80 0x012809|$04:$A7F9: EB ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x01280A|$04:$A7FA: 17 ; String ID #$0017: [name]'s wounds were healed.[end-FC] 0x01280B|$04:$A7FB: 00 ; (impossible outcome; no string for this) ; Spell ID #$0C: Sacrifice 0x01280C|$04:$A7FC:04 02 0x01280E|$04:$A7FE: EC ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x01280F|$04:$A7FF: 26 ; String ID #$0026: [name] was utterly defeated.[end-FC] 0x012810|$04:$A800: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$0D: Healall 0x012811|$04:$A801:00 FF 0x012813|$04:$A803: ED ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012814|$04:$A804: 17 ; String ID #$0017: [name]'s wounds were healed.[end-FC] 0x012815|$04:$A805: 00 ; (impossible outcome; no string for this) ; Spell ID #$0E: Explodet 0x012816|$04:$A806:04 82 0x012818|$04:$A808: EE ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012819|$04:$A809: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x01281A|$04:$A80A: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Chance spell effects ; Spell ID #$0F: Chance; Effect #$01: Confuse 0x01281B|$04:$A80B:05 00 0x01281D|$04:$A80D: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x01281E|$04:$A80E: 16 ; String ID #$0016: The enemies was confused.[end-FC] 0x01281F|$04:$A80F: 00 ; (impossible outcome; no string for this) ; Spell ID #$0F: Chance; Effect #$02: Heal 0x012820|$04:$A810:01 40 0x012822|$04:$A812: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012823|$04:$A813: 17 ; String ID #$0017: [name]'s wounds were healed.[end-FC] 0x012824|$04:$A814: 00 ; (impossible outcome; no string for this) ; Spell ID #$0F: Chance; Effect #$03: Defeat 0x012825|$04:$A815:04 02 0x012827|$04:$A817: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012828|$04:$A818: 24 ; String ID #$0024: Thou hast defeated [name].[end-FC] 0x012829|$04:$A819: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$0F: Chance; Effect #$04: Sleep 0x01282A|$04:$A81A:04 02 0x01282C|$04:$A81C: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x01282D|$04:$A81D: 1C ; String ID #$001C: [name] fell asleep.[end-FC] 0x01282E|$04:$A81E: 1D ; String ID #$001D: [name] did not fall asleep.[end-FC] ; Spell ID #$0F: Chance; Effect #$05: Defense 0x01282F|$04:$A81F:04 01 0x012831|$04:$A821: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012832|$04:$A822: 21 ; String ID #$0021: [name]'s Defense Power decreased by [number].[end-FC] 0x012833|$04:$A823: 18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; Spell ID #$0F: Chance; Effect #$06: Increase 0x012834|$04:$A824:01 01 0x012836|$04:$A826: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012837|$04:$A827: 23 ; String ID #$0023: [name]'s Defense Power increased by [number].[end-FC] 0x012838|$04:$A828: 00 ; (impossible outcome; no string for this) ; Spell ID #$0F: Chance; Effect #$07: Sorceror 0x012839|$04:$A829:01 02 0x01283B|$04:$A82B: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x01283C|$04:$A82C: 2E ; String ID #$002E: [name] fainted when the Sorcerer appeared.[end-FC] 0x01283D|$04:$A82D: 00 ; (impossible outcome; no string for this) ; Spell ID #$0F: Chance; Effect #$08: Revive Max 0x01283E|$04:$A82E:06 02 0x012840|$04:$A830: EF ; String ID #$001A: [name] chanted the spell of [spell].[end-FC] 0x012841|$04:$A831: 2C ; String ID #$002C: Then [name] was brought back to life![end-FC] 0x012842|$04:$A832: 00 ; (impossible outcome; no string for this) ; Item ID #$03: Wizard’s Wand ; Usable Items 0x012843|$04:$A833:02 18 0x012845|$04:$A835: 38 ; String ID #$0038: [name] raised the Wizard's Wand overhead.[end-FC] 0x012846|$04:$A836: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x012847|$04:$A837: 40 ; String ID #$0040: It did not work against [name].[end-FC] ; Item ID #$04: Staff of Thunder 0x012848|$04:$A838:03 32 0x01284A|$04:$A83A: 3A ; String ID #$003A: [name] raised the Staff of Thunder overhead.[end-FC] 0x01284B|$04:$A83B: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x01284C|$04:$A83C: 40 ; String ID #$0040: It did not work against [name].[end-FC] ; Item ID #$10: Thunder Sword 0x01284D|$04:$A83D:03 37 0x01284F|$04:$A83F: 3C ; String ID #$003C: [name] raised the Thunder Sword overhead.[end-FC] 0x012850|$04:$A840: 0B ; String ID #$000B: [name]'s HP is reduced by [number].[end-FC] 0x012851|$04:$A841: 40 ; String ID #$0040: It did not work against [name].[end-FC] ; Item ID #$0E: Light Sword 0x012852|$04:$A842:04 02 0x012854|$04:$A844: 3E ; String ID #$003E: [name] raised the Light Sword overhead.[end-FC] 0x012855|$04:$A845: 2B ; String ID #$002B: And [name] was surrounded by the Phantom Force.[end-FC] 0x012856|$04:$A846: 40 ; String ID #$0040: It did not work against [name].[end-FC] ; Item ID #$1D: Shield of Strength 0x012857|$04:$A847:00 80 0x012859|$04:$A849: 41 ; String ID #$0041: [name] raised the Shield of Strength toward the heavens.[end-FC] 0x01285A|$04:$A84A: 17 ; String ID #$0017: [name]'s wounds were healed.[end-FC] 0x01285B|$04:$A84B: 00 ; (impossible outcome; no string for this) ; Item ID #$3C: Medical Herb 0x01285C|$04:$A84C:00 64 0x01285E|$04:$A84E: 7E ; String ID #$011E: [name] used the [item].[end-FC] 0x01285F|$04:$A84F: 17 ; String ID #$0017: [name]'s wounds were healed.[end-FC] 0x012860|$04:$A850: 00 ; (impossible outcome; no string for this) ; Item ID #$3B: Antidote Herb 0x012861|$04:$A851:00 02 0x012863|$04:$A853: 7E ; String ID #$011E: [name] used the [item].[end-FC] 0x012864|$04:$A854: 43 ; String ID #$0043: The poison was drawn out of [name]'s wound.[end-FC] 0x012865|$04:$A855: 00 ; (impossible outcome; no string for this) ; Item ID #$3D: Wizard’s Ring 0x012866|$04:$A856:00 2C 0x012868|$04:$A858: A1 ; String ID #$0141: [name] slipped on the Wizard's Ring and spoke a word of magic.[end-FC] 0x012869|$04:$A859: 00 ; (impossible outcome; no string for this) 0x01286A|$04:$A85A: A2 ; String ID #$0142: [wait]The ring crumbled like clay into dust, losing all its power.[end-FC] ; data -> code ; control flow target (from $9625) 0x01286B|$04:$A85B:85 A7 STA $A7 0x01286D|$04:$A85D:85 AE STA $AE 0x01286F|$04:$A85F:20 DC B1 JSR $B1DC 0x012872|$04:$A862:A5 AF LDA $AF 0x012874|$04:$A864:C9 04 CMP #$04 0x012876|$04:$A866:90 01 BCC $A869 0x012878|$04:$A868:60 RTS ; control flow target (from $A866) 0x012879|$04:$A869:A0 07 LDY #$07 0x01287B|$04:$A86B:B1 BB LDA ($BB),Y 0x01287D|$04:$A86D:2A ROL 0x01287E|$04:$A86E:2A ROL 0x01287F|$04:$A86F:2A ROL 0x012880|$04:$A870:29 03 AND #$03 0x012882|$04:$A872:8D EB 06 STA $06EB 0x012885|$04:$A875:C9 03 CMP #$03 0x012887|$04:$A877:D0 05 BNE $A87E 0x012889|$04:$A879:A5 A7 LDA $A7 0x01288B|$04:$A87B:20 52 B0 JSR $B052 ; control flow target (from $A877) 0x01288E|$04:$A87E:20 B9 A7 JSR $A7B9 0x012891|$04:$A881:A0 03 LDY #$03 ; control flow target (from $A889) 0x012893|$04:$A883:B1 B7 LDA ($B7),Y 0x012895|$04:$A885:99 E0 06 STA $06E0,Y 0x012898|$04:$A888:88 DEY 0x012899|$04:$A889:D0 F8 BNE $A883 0x01289B|$04:$A88B:A0 00 LDY #$00 0x01289D|$04:$A88D:B1 B7 LDA ($B7),Y 0x01289F|$04:$A88F:8D E7 06 STA $06E7 0x0128A2|$04:$A892:AD E3 06 LDA $06E3 0x0128A5|$04:$A895:A0 00 LDY #$00 0x0128A7|$04:$A897:B1 B5 LDA ($B5),Y 0x0128A9|$04:$A899:85 AB STA $AB 0x0128AB|$04:$A89B:AD E3 06 LDA $06E3 0x0128AE|$04:$A89E:0A ASL 0x0128AF|$04:$A89F:0A ASL 0x0128B0|$04:$A8A0:0A ASL 0x0128B1|$04:$A8A1:0A ASL 0x0128B2|$04:$A8A2:0D E2 06 ORA $06E2 0x0128B5|$04:$A8A5:85 AC STA $AC 0x0128B7|$04:$A8A7:A0 05 LDY #$05 0x0128B9|$04:$A8A9:B1 BB LDA ($BB),Y 0x0128BB|$04:$A8AB:8D EA 06 STA $06EA 0x0128BE|$04:$A8AE:AD E7 06 LDA $06E7 0x0128C1|$04:$A8B1:10 1F BPL $A8D2 0x0128C3|$04:$A8B3:A9 08 LDA #$08 0x0128C5|$04:$A8B5:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x0128C8|$04:$A8B8:AD EB 06 LDA $06EB 0x0128CB|$04:$A8BB:C5 99 CMP $99 0x0128CD|$04:$A8BD:90 0F BCC $A8CE 0x0128CF|$04:$A8BF:A0 00 LDY #$00 0x0128D1|$04:$A8C1:B1 B7 LDA ($B7),Y 0x0128D3|$04:$A8C3:29 7F AND #$7F 0x0128D5|$04:$A8C5:91 B7 STA ($B7),Y 0x0128D7|$04:$A8C7:A9 20 LDA #$20 ; control flow target (from $A8D0) 0x0128D9|$04:$A8C9:85 AD STA $AD 0x0128DB|$04:$A8CB:4C DC 9C JMP $9CDC ; control flow target (from $A8BD) 0x0128DE|$04:$A8CE:A9 1F LDA #$1F 0x0128E0|$04:$A8D0:D0 F7 BNE $A8C9 ; control flow target (from $A8B1) 0x0128E2|$04:$A8D2:A5 B3 LDA $B3 0x0128E4|$04:$A8D4:10 5F BPL $A935 0x0128E6|$04:$A8D6:A9 03 LDA #$03 0x0128E8|$04:$A8D8:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x0128EB|$04:$A8DB:D0 58 BNE $A935 0x0128ED|$04:$A8DD:A9 09 LDA #$09 0x0128EF|$04:$A8DF:85 0D STA $0D 0x0128F1|$04:$A8E1:20 5C A9 JSR $A95C 0x0128F4|$04:$A8E4:A5 0D LDA $0D 0x0128F6|$04:$A8E6:C9 09 CMP #$09 0x0128F8|$04:$A8E8:F0 4B BEQ $A935 0x0128FA|$04:$A8EA:A9 09 LDA #$09 0x0128FC|$04:$A8EC:38 SEC 0x0128FD|$04:$A8ED:E5 0D SBC $0D 0x0128FF|$04:$A8EF:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x012902|$04:$A8F2:85 0D STA $0D 0x012904|$04:$A8F4:E6 0D INC $0D 0x012906|$04:$A8F6:20 5C A9 JSR $A95C 0x012909|$04:$A8F9:A0 03 LDY #$03 0x01290B|$04:$A8FB:B1 B7 LDA ($B7),Y 0x01290D|$04:$A8FD:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x012910|$04:$A900:A0 00 LDY #$00 0x012912|$04:$A902:B1 B5 LDA ($B5),Y 0x012914|$04:$A904:85 AE STA $AE 0x012916|$04:$A906:A0 03 LDY #$03 0x012918|$04:$A908:B1 B7 LDA ($B7),Y 0x01291A|$04:$A90A:0A ASL 0x01291B|$04:$A90B:0A ASL 0x01291C|$04:$A90C:0A ASL 0x01291D|$04:$A90D:0A ASL 0x01291E|$04:$A90E:A0 02 LDY #$02 ; Sleep? 0x012920|$04:$A910:11 B7 ORA ($B7),Y 0x012922|$04:$A912:85 AF STA $AF 0x012924|$04:$A914:29 0F AND #$0F 0x012926|$04:$A916:85 A9 STA $A9 0x012928|$04:$A918:A0 06 LDY #$06 ; Stopspell? 0x01292A|$04:$A91A:B1 B7 LDA ($B7),Y 0x01292C|$04:$A91C:85 9B STA $9B 0x01292E|$04:$A91E:20 23 B0 JSR $B023 0x012931|$04:$A921:A9 06 LDA #$06 0x012933|$04:$A923:85 AD STA $AD 0x012935|$04:$A925:A9 0B LDA #$0B 0x012937|$04:$A927:85 B2 STA $B2 0x012939|$04:$A929:A9 77 LDA #$77 0x01293B|$04:$A92B:85 A7 STA $A7 0x01293D|$04:$A92D:A9 00 LDA #$00 0x01293F|$04:$A92F:20 C3 9E JSR $9EC3 ; given an index (in A) into the array of battle spell/item structures at $A7C0, set $C5-$C6 to the address of the corresponding item inside that structure 0x012942|$04:$A932:4C 86 A6 JMP $A686 ; control flow target (from $A8D4, $A8DB, $A8E8) 0x012945|$04:$A935:20 22 B2 JSR $B222 0x012948|$04:$A938:85 A8 STA $A8 0x01294A|$04:$A93A:A0 0A LDY #$0A 0x01294C|$04:$A93C:B1 B5 LDA ($B5),Y 0x01294E|$04:$A93E:C9 03 CMP #$03 0x012950|$04:$A940:B0 02 BCS $A944 0x012952|$04:$A942:85 A8 STA $A8 ; control flow target (from $A940) 0x012954|$04:$A944:AD E1 06 LDA $06E1 0x012957|$04:$A947:C9 20 CMP #$20 0x012959|$04:$A949:90 02 BCC $A94D 0x01295B|$04:$A94B:A9 00 LDA #$00 ; control flow target (from $A949) 0x01295D|$04:$A94D:0A ASL 0x01295E|$04:$A94E:AA TAX 0x01295F|$04:$A94F:BD 7C A9 LDA $A97C,X ; pointers to monster attack handlers 0x012962|$04:$A952:85 C7 STA $C7 0x012964|$04:$A954:BD 7D A9 LDA $A97D,X 0x012967|$04:$A957:85 C8 STA $C8 0x012969|$04:$A959:6C C7 00 JMP ($00C7) ; control flow target (from $A8E1, $A8F6) 0x01296C|$04:$A95C:A9 00 LDA #$00 0x01296E|$04:$A95E:85 0C STA $0C ; control flow target (from $A979) 0x012970|$04:$A960:C5 A7 CMP $A7 0x012972|$04:$A962:F0 0F BEQ $A973 0x012974|$04:$A964:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x012977|$04:$A967:A0 03 LDY #$03 0x012979|$04:$A969:B1 B7 LDA ($B7),Y 0x01297B|$04:$A96B:C9 04 CMP #$04 0x01297D|$04:$A96D:B0 04 BCS $A973 0x01297F|$04:$A96F:C6 0D DEC $0D 0x012981|$04:$A971:F0 08 BEQ $A97B ; control flow target (from $A962, $A96D) 0x012983|$04:$A973:E6 0C INC $0C 0x012985|$04:$A975:A5 0C LDA $0C 0x012987|$04:$A977:C9 08 CMP #$08 0x012989|$04:$A979:90 E5 BCC $A960 ; control flow target (from $A971) 0x01298B|$04:$A97B:60 RTS ; code -> data ; pointers to monster attack handlers ; indexed data load target (from $A94F) 0x01298C|$04:$A97C:BC ; indexed data load target (from $A954) 0x01298D|$04:$A97D: A9 ; $04:$A9BC; handler for Attack IDs #$00/#$1E: Attack / Concentrated Attack 0x01298E|$04:$A97E:11 AA ; $04:$AA11; handler for Attack ID #$01: Heroic Attack 0x012990|$04:$A980:28 AA ; $04:$AA28; handler for Attack ID #$02: Poison Attack 0x012992|$04:$A982:3A AA ; $04:$AA3A; handler for Attack ID #$03: Faint Attack 0x012994|$04:$A984:4A AA ; $04:$AA4A; handler for Attack ID #$04: Parry 0x012996|$04:$A986:51 AA ; $04:$AA51; handler for Attack ID #$05: Run Away 0x012998|$04:$A988:78 AA ; $04:$AA78; handler for Attack ID #$06: Firebal 0x01299A|$04:$A98A:87 AA ; $04:$AA87; handler for Attack ID #$07: Firebane 0x01299C|$04:$A98C:91 AA ; $04:$AA91; handler for Attack ID #$08: Explodet 0x01299E|$04:$A98E:B5 AA ; $04:$AAB5; handler for Attack ID #$09: Heal-1 0x0129A0|$04:$A990:C0 AA ; $04:$AAC0; handler for Attack ID #$0A: Healmore-1 0x0129A2|$04:$A992:D3 AA ; $04:$AAD3; handler for Attack ID #$0B: Healall-1 0x0129A4|$04:$A994:E3 AA ; $04:$AAE3; handler for Attack ID #$0C: Heal-2 0x0129A6|$04:$A996:ED AA ; $04:$AAED; handler for Attack ID #$0D: Healmore-2 0x0129A8|$04:$A998:03 AB ; $04:$AB03; handler for Attack ID #$0E: Healall-2 0x0129AA|$04:$A99A:C7 AB ; $04:$ABC7; handler for Attack ID #$0F: Revive 0x0129AC|$04:$A99C:E5 AB ; $04:$ABE5; handler for Attack ID #$10: Defence 0x0129AE|$04:$A99E:EA AB ; $04:$ABEA; handler for Attack ID #$11: Increase 0x0129B0|$04:$A9A0:57 AC ; $04:$AC57; handler for Attack ID #$12: Sleep 0x0129B2|$04:$A9A2:5C AC ; $04:$AC5C; handler for Attack ID #$13: Stopspell 0x0129B4|$04:$A9A4:61 AC ; $04:$AC61; handler for Attack ID #$14: Surround 0x0129B6|$04:$A9A6:66 AC ; $04:$AC66; handler for Attack ID #$15: Defeat 0x0129B8|$04:$A9A8:6B AC ; $04:$AC6B; handler for Attack ID #$16: Sacrifice 0x0129BA|$04:$A9AA:70 AC ; $04:$AC70; handler for Attack IDs #$17-#$19: Weak, Strong, Deadly Flames 0x0129BC|$04:$A9AC:70 AC ; $04:$AC70; handler for Attack IDs #$17-#$19: Weak, Strong, Deadly Flames 0x0129BE|$04:$A9AE:70 AC ; $04:$AC70; handler for Attack IDs #$17-#$19: Weak, Strong, Deadly Flames 0x0129C0|$04:$A9B0:75 AC ; $04:$AC75; handler for Attack ID #$1A: Poison Breath 0x0129C2|$04:$A9B2:7A AC ; $04:$AC7A; handler for Attack ID #$1B: Sweet Breath 0x0129C4|$04:$A9B4:AE AD ; $04:$ADAE; handler for Attack ID #$1C: Call For Help 0x0129C6|$04:$A9B6:15 AE ; $04:$AE15; handler for Attack ID #$1D: Two Attacks 0x0129C8|$04:$A9B8:BC A9 ; $04:$A9BC; handler for Attack IDs #$00/#$1E: Attack / Concentrated Attack 0x0129CA|$04:$A9BA:1E AE ; $04:$AE1E; handler for Attack ID #$1F: Strange Jig ; data -> code ; handler for Attack IDs #$00/#$1E: Attack / Concentrated Attack ; control flow target (from $AA14, $AA2D, $AE15, $AE1B) ; indirect control flow target (via $A97C, $A9B8) 0x0129CC|$04:$A9BC:A9 FF LDA #$FF 0x0129CE|$04:$A9BE:85 C5 STA $C5 ; control flow target (from $AA37, $AA47) 0x0129D0|$04:$A9C0:20 0F B0 JSR $B00F ; control flow target (from $AA25) 0x0129D3|$04:$A9C3:A9 06 LDA #$06 ; String ID #$0006: [name] attacked![end-FC] 0x0129D5|$04:$A9C5:85 AD STA $AD 0x0129D7|$04:$A9C7:A5 A8 LDA $A8 0x0129D9|$04:$A9C9:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x0129DC|$04:$A9CC:A0 00 LDY #$00 0x0129DE|$04:$A9CE:B1 B9 LDA ($B9),Y 0x0129E0|$04:$A9D0:30 01 BMI $A9D3 0x0129E2|$04:$A9D2:60 RTS ; control flow target (from $A9D0) 0x0129E3|$04:$A9D3:29 40 AND #$40 0x0129E5|$04:$A9D5:D0 28 BNE $A9FF 0x0129E7|$04:$A9D7:A9 40 LDA #$40 0x0129E9|$04:$A9D9:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x0129EC|$04:$A9DC:F0 10 BEQ $A9EE 0x0129EE|$04:$A9DE:A5 A8 LDA $A8 0x0129F0|$04:$A9E0:85 9C STA $9C 0x0129F2|$04:$A9E2:A9 52 LDA #$52 ; Item ID #$52: Clothes Hiding (equipped) ; call to code in a different bank ($0F:$C4B0) 0x0129F4|$04:$A9E4:20 B0 C4 JSR $C4B0 ; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise 0x0129F7|$04:$A9E7:90 16 BCC $A9FF 0x0129F9|$04:$A9E9:20 07 B0 JSR $B007 0x0129FC|$04:$A9EC:B0 11 BCS $A9FF ; control flow target (from $A9DC) 0x0129FE|$04:$A9EE:A5 B3 LDA $B3 0x012A00|$04:$A9F0:29 DF AND #$DF 0x012A02|$04:$A9F2:85 B3 STA $B3 0x012A04|$04:$A9F4:A5 A8 LDA $A8 0x012A06|$04:$A9F6:49 FF EOR #$FF 0x012A08|$04:$A9F8:85 AE STA $AE 0x012A0A|$04:$A9FA:A9 0A LDA #$0A ; String ID #$000A: [name] dodged the blow.[end-FC] 0x012A0C|$04:$A9FC:4C E5 9C JMP $9CE5 ; control flow target (from $A9D5, $A9E7, $A9EC) 0x012A0F|$04:$A9FF:A0 00 LDY #$00 0x012A11|$04:$AA01:B1 B9 LDA ($B9),Y 0x012A13|$04:$AA03:25 C5 AND $C5 0x012A15|$04:$AA05:D0 07 BNE $AA0E 0x012A17|$04:$AA07:A5 C6 LDA $C6 0x012A19|$04:$AA09:85 B2 STA $B2 0x012A1B|$04:$AA0B:4C A5 AE JMP $AEA5 ; control flow target (from $AA05) 0x012A1E|$04:$AA0E:4C A1 AE JMP $AEA1 ; handler for Attack ID #$01: Heroic Attack ; indirect control flow target (via $A97E) 0x012A21|$04:$AA11:20 07 B0 JSR $B007 ; control flow target (from $AA3D) 0x012A24|$04:$AA14:B0 A6 BCS $A9BC ; handler for Attack IDs #$00/#$1E: Attack / Concentrated Attack 0x012A26|$04:$AA16:A9 FF LDA #$FF 0x012A28|$04:$AA18:85 C5 STA $C5 0x012A2A|$04:$AA1A:AD EA 06 LDA $06EA 0x012A2D|$04:$AA1D:20 A1 A7 JSR $A7A1 0x012A30|$04:$AA20:A9 0E LDA #$0E ; String ID #$000E: A heroic attack![end-FC] 0x012A32|$04:$AA22:20 DE 9A JSR $9ADE ; STA $B4, $B3 |= #$20 0x012A35|$04:$AA25:4C C3 A9 JMP $A9C3 ; handler for Attack ID #$02: Poison Attack ; indirect control flow target (via $A980) 0x012A38|$04:$AA28:A9 04 LDA #$04 ; 1/4 Chance of Poison Attack Succeeding 0x012A3A|$04:$AA2A:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x012A3D|$04:$AA2D:D0 8D BNE $A9BC ; handler for Attack IDs #$00/#$1E: Attack / Concentrated Attack 0x012A3F|$04:$AA2F:A9 20 LDA #$20 0x012A41|$04:$AA31:85 C5 STA $C5 0x012A43|$04:$AA33:A9 2F LDA #$2F ; String ID #$002F: Alas, [name] was poisoned and lost [number] HP.[end-FC] 0x012A45|$04:$AA35:85 C6 STA $C6 0x012A47|$04:$AA37:4C C0 A9 JMP $A9C0 ; handler for Attack ID #$03: Faint Attack ; indirect control flow target (via $A982) 0x012A4A|$04:$AA3A:20 FF AF JSR $AFFF 0x012A4D|$04:$AA3D:B0 D5 BCS $AA14 0x012A4F|$04:$AA3F:A9 40 LDA #$40 0x012A51|$04:$AA41:85 C5 STA $C5 0x012A53|$04:$AA43:A9 30 LDA #$30 ; String ID #$0030: [name] fainted after losing [number] HP.[end-FC] 0x012A55|$04:$AA45:85 C6 STA $C6 0x012A57|$04:$AA47:4C C0 A9 JMP $A9C0 ; handler for Attack ID #$04: Parry ; indirect control flow target (via $A984) 0x012A5A|$04:$AA4A:A9 00 LDA #$00 0x012A5C|$04:$AA4C:85 AD STA $AD 0x012A5E|$04:$AA4E:4C DC 9C JMP $9CDC ; handler for Attack ID #$05: Run Away ; indirect control flow target (via $A986) 0x012A61|$04:$AA51:A9 0F LDA #$0F ; String ID #$000F: [name] broke away and ran.[end-FC] 0x012A63|$04:$AA53:85 AD STA $AD 0x012A65|$04:$AA55:A0 09 LDY #$09 0x012A67|$04:$AA57:B1 B5 LDA ($B5),Y 0x012A69|$04:$AA59:AA TAX 0x012A6A|$04:$AA5A:CA DEX 0x012A6B|$04:$AA5B:8A TXA 0x012A6C|$04:$AA5C:91 B5 STA ($B5),Y 0x012A6E|$04:$AA5E:A0 03 LDY #$03 0x012A70|$04:$AA60:A9 FF LDA #$FF 0x012A72|$04:$AA62:91 B7 STA ($B7),Y 0x012A74|$04:$AA64:20 84 9A JSR $9A84 0x012A77|$04:$AA67:D0 04 BNE $AA6D 0x012A79|$04:$AA69:A9 FE LDA #$FE 0x012A7B|$04:$AA6B:85 98 STA $98 ; outcome of last fight? ; control flow target (from $AA67) 0x012A7D|$04:$AA6D:20 DC 9C JSR $9CDC 0x012A80|$04:$AA70:AC E2 06 LDY $06E2 0x012A83|$04:$AA73:A9 FF LDA #$FF 0x012A85|$04:$AA75:91 B5 STA ($B5),Y 0x012A87|$04:$AA77:60 RTS ; handler for Attack ID #$06: Firebal ; indirect control flow target (via $A988) 0x012A88|$04:$AA78:A9 E1 LDA #$E1 0x012A8A|$04:$AA7A:85 AD STA $AD 0x012A8C|$04:$AA7C:20 7D AE JSR $AE7D 0x012A8F|$04:$AA7F:A9 18 LDA #$18 ; Power 0x012A91|$04:$AA81:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012A94|$04:$AA84:4C A1 AE JMP $AEA1 ; handler for Attack ID #$07: Firebane ; indirect control flow target (via $A98A) 0x012A97|$04:$AA87:A9 E3 LDA #$E3 0x012A99|$04:$AA89:85 AD STA $AD 0x012A9B|$04:$AA8B:A9 32 LDA #$32 ; Power 0x012A9D|$04:$AA8D:85 AA STA $AA 0x012A9F|$04:$AA8F:D0 08 BNE $AA99 ; handler for Attack ID #$08: Explodet ; indirect control flow target (via $A98C) 0x012AA1|$04:$AA91:A9 EE LDA #$EE 0x012AA3|$04:$AA93:85 AD STA $AD 0x012AA5|$04:$AA95:A9 82 LDA #$82 ; Power 0x012AA7|$04:$AA97:85 AA STA $AA ; control flow target (from $AA8F) 0x012AA9|$04:$AA99:20 7D AE JSR $AE7D 0x012AAC|$04:$AA9C:A9 00 LDA #$00 0x012AAE|$04:$AA9E:85 A8 STA $A8 ; control flow target (from $AAB2) 0x012AB0|$04:$AAA0:A5 AA LDA $AA 0x012AB2|$04:$AAA2:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012AB5|$04:$AAA5:20 A1 AE JSR $AEA1 0x012AB8|$04:$AAA8:A5 98 LDA $98 ; outcome of last fight? 0x012ABA|$04:$AAAA:D0 08 BNE $AAB4 0x012ABC|$04:$AAAC:E6 A8 INC $A8 0x012ABE|$04:$AAAE:A5 A8 LDA $A8 0x012AC0|$04:$AAB0:C9 03 CMP #$03 0x012AC2|$04:$AAB2:90 EC BCC $AAA0 ; control flow target (from $AAAA) 0x012AC4|$04:$AAB4:60 RTS ; handler for Attack ID #$09: Heal-1 ; indirect control flow target (via $A98E) 0x012AC5|$04:$AAB5:A9 E9 LDA #$E9 0x012AC7|$04:$AAB7:85 AD STA $AD 0x012AC9|$04:$AAB9:A9 40 LDA #$40 ; Power 0x012ACB|$04:$AABB:85 AA STA $AA 0x012ACD|$04:$AABD:4C C8 AA JMP $AAC8 ; handler for Attack ID #$0A: Healmore-1 ; indirect control flow target (via $A990) 0x012AD0|$04:$AAC0:A9 EB LDA #$EB 0x012AD2|$04:$AAC2:85 AD STA $AD 0x012AD4|$04:$AAC4:A9 80 LDA #$80 ; Power 0x012AD6|$04:$AAC6:85 AA STA $AA ; control flow target (from $AABD) 0x012AD8|$04:$AAC8:20 7D AE JSR $AE7D 0x012ADB|$04:$AACB:A5 AA LDA $AA 0x012ADD|$04:$AACD:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012AE0|$04:$AAD0:4C 14 AB JMP $AB14 ; handler for Attack ID #$0B: Healall-1 ; indirect control flow target (via $A992) 0x012AE3|$04:$AAD3:A9 ED LDA #$ED 0x012AE5|$04:$AAD5:85 AD STA $AD 0x012AE7|$04:$AAD7:20 7D AE JSR $AE7D 0x012AEA|$04:$AADA:A9 D0 LDA #$D0 ; Power 0x012AEC|$04:$AADC:85 B0 STA $B0 0x012AEE|$04:$AADE:85 B1 STA $B1 0x012AF0|$04:$AAE0:4C 14 AB JMP $AB14 ; handler for Attack ID #$0C: Heal-2 ; indirect control flow target (via $A994) 0x012AF3|$04:$AAE3:A9 E9 LDA #$E9 0x012AF5|$04:$AAE5:85 AD STA $AD 0x012AF7|$04:$AAE7:A9 40 LDA #$40 ; Power 0x012AF9|$04:$AAE9:85 AA STA $AA 0x012AFB|$04:$AAEB:D0 08 BNE $AAF5 ; handler for Attack ID #$0D: Healmore-2 ; indirect control flow target (via $A996) 0x012AFD|$04:$AAED:A9 EB LDA #$EB 0x012AFF|$04:$AAEF:85 AD STA $AD 0x012B01|$04:$AAF1:A9 80 LDA #$80 ; Power 0x012B03|$04:$AAF3:85 AA STA $AA ; control flow target (from $AAEB) 0x012B05|$04:$AAF5:20 7D AE JSR $AE7D 0x012B08|$04:$AAF8:A5 AA LDA $AA 0x012B0A|$04:$AAFA:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012B0D|$04:$AAFD:20 67 AB JSR $AB67 0x012B10|$04:$AB00:4C 16 AB JMP $AB16 ; handler for Attack ID #$0E: Healall-2 ; indirect control flow target (via $A998) 0x012B13|$04:$AB03:A9 ED LDA #$ED 0x012B15|$04:$AB05:85 AD STA $AD 0x012B17|$04:$AB07:20 7D AE JSR $AE7D 0x012B1A|$04:$AB0A:A9 D0 LDA #$D0 ; Power 0x012B1C|$04:$AB0C:85 B1 STA $B1 0x012B1E|$04:$AB0E:20 67 AB JSR $AB67 0x012B21|$04:$AB11:4C 16 AB JMP $AB16 ; control flow target (from $AAD0, $AAE0) 0x012B24|$04:$AB14:A5 A7 LDA $A7 ; control flow target (from $AB00, $AB11) 0x012B26|$04:$AB16:C9 08 CMP #$08 0x012B28|$04:$AB18:90 02 BCC $AB1C 0x012B2A|$04:$AB1A:A5 A7 LDA $A7 ; control flow target (from $AB18) 0x012B2C|$04:$AB1C:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x012B2F|$04:$AB1F:A0 03 LDY #$03 0x012B31|$04:$AB21:B1 B7 LDA ($B7),Y 0x012B33|$04:$AB23:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x012B36|$04:$AB26:A0 00 LDY #$00 0x012B38|$04:$AB28:B1 B5 LDA ($B5),Y 0x012B3A|$04:$AB2A:85 AE STA $AE 0x012B3C|$04:$AB2C:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x012B3F|$04:$AB2F:A0 03 LDY #$03 0x012B41|$04:$AB31:B1 B7 LDA ($B7),Y 0x012B43|$04:$AB33:0A ASL 0x012B44|$04:$AB34:0A ASL 0x012B45|$04:$AB35:0A ASL 0x012B46|$04:$AB36:0A ASL 0x012B47|$04:$AB37:A0 02 LDY #$02 0x012B49|$04:$AB39:11 B7 ORA ($B7),Y 0x012B4B|$04:$AB3B:85 AF STA $AF 0x012B4D|$04:$AB3D:20 F6 B1 JSR $B1F6 0x012B50|$04:$AB40:A5 99 LDA $99 0x012B52|$04:$AB42:18 CLC 0x012B53|$04:$AB43:65 B0 ADC $B0 0x012B55|$04:$AB45:85 99 STA $99 0x012B57|$04:$AB47:A5 9A LDA $9A 0x012B59|$04:$AB49:65 B1 ADC $B1 0x012B5B|$04:$AB4B:85 9A STA $9A 0x012B5D|$04:$AB4D:A2 02 LDX #$02 0x012B5F|$04:$AB4F:20 17 B2 JSR $B217 0x012B62|$04:$AB52:B0 02 BCS $AB56 0x012B64|$04:$AB54:A2 00 LDX #$00 ; control flow target (from $AB52) 0x012B66|$04:$AB56:B5 99 LDA $99,X 0x012B68|$04:$AB58:A0 04 LDY #$04 0x012B6A|$04:$AB5A:91 B7 STA ($B7),Y 0x012B6C|$04:$AB5C:B5 9A LDA $9A,X 0x012B6E|$04:$AB5E:A0 05 LDY #$05 0x012B70|$04:$AB60:91 B7 STA ($B7),Y 0x012B72|$04:$AB62:A9 17 LDA #$17 ; String ID #$0017: [name]'s wounds were healed.[end-FC] 0x012B74|$04:$AB64:4C E5 9C JMP $9CE5 ; control flow target (from $AAFD, $AB0E) 0x012B77|$04:$AB67:A9 FF LDA #$FF 0x012B79|$04:$AB69:85 A6 STA $A6 0x012B7B|$04:$AB6B:A9 00 LDA #$00 0x012B7D|$04:$AB6D:85 A3 STA $A3 0x012B7F|$04:$AB6F:85 A4 STA $A4 0x012B81|$04:$AB71:85 A5 STA $A5 ; control flow target (from $ABC2) 0x012B83|$04:$AB73:20 CD 9E JSR $9ECD ; given an index (in A) into the array of structures at $068F, set $C1-$C2 to the address of the corresponding item inside that structure 0x012B86|$04:$AB76:A0 03 LDY #$03 0x012B88|$04:$AB78:B1 C1 LDA ($C1),Y 0x012B8A|$04:$AB7A:C9 04 CMP #$04 0x012B8C|$04:$AB7C:B0 3E BCS $ABBC 0x012B8E|$04:$AB7E:CD E3 06 CMP $06E3 0x012B91|$04:$AB81:F0 39 BEQ $ABBC 0x012B93|$04:$AB83:20 D2 9E JSR $9ED2 ; given an index (in A) into the array of structures at $0663, set $BF-$C0 to the address of the corresponding item inside that structure 0x012B96|$04:$AB86:A0 00 LDY #$00 0x012B98|$04:$AB88:B1 BF LDA ($BF),Y 0x012B9A|$04:$AB8A:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x012B9D|$04:$AB8D:A0 04 LDY #$04 0x012B9F|$04:$AB8F:B1 C1 LDA ($C1),Y 0x012BA1|$04:$AB91:85 9B STA $9B 0x012BA3|$04:$AB93:A0 00 LDY #$00 0x012BA5|$04:$AB95:B1 BB LDA ($BB),Y 0x012BA7|$04:$AB97:85 9A STA $9A 0x012BA9|$04:$AB99:A9 00 LDA #$00 0x012BAB|$04:$AB9B:85 99 STA $99 0x012BAD|$04:$AB9D:85 9C STA $9C 0x012BAF|$04:$AB9F:20 A2 A0 JSR $A0A2 0x012BB2|$04:$ABA2:A5 9A LDA $9A 0x012BB4|$04:$ABA4:C5 A4 CMP $A4 0x012BB6|$04:$ABA6:90 14 BCC $ABBC 0x012BB8|$04:$ABA8:D0 06 BNE $ABB0 0x012BBA|$04:$ABAA:A5 99 LDA $99 0x012BBC|$04:$ABAC:C5 A3 CMP $A3 0x012BBE|$04:$ABAE:90 0C BCC $ABBC ; control flow target (from $ABA8) 0x012BC0|$04:$ABB0:A5 99 LDA $99 0x012BC2|$04:$ABB2:85 A3 STA $A3 0x012BC4|$04:$ABB4:A5 9A LDA $9A 0x012BC6|$04:$ABB6:85 A4 STA $A4 0x012BC8|$04:$ABB8:A5 A5 LDA $A5 0x012BCA|$04:$ABBA:85 A6 STA $A6 ; control flow target (from $AB7C, $AB81, $ABA6, $ABAE) 0x012BCC|$04:$ABBC:E6 A5 INC $A5 0x012BCE|$04:$ABBE:A5 A5 LDA $A5 0x012BD0|$04:$ABC0:C9 08 CMP #$08 0x012BD2|$04:$ABC2:90 AF BCC $AB73 0x012BD4|$04:$ABC4:A5 A6 LDA $A6 0x012BD6|$04:$ABC6:60 RTS ; handler for Attack ID #$0F: Revive ; indirect control flow target (via $A99A) 0x012BD7|$04:$ABC7:A9 F7 LDA #$F7 0x012BD9|$04:$ABC9:85 AD STA $AD 0x012BDB|$04:$ABCB:20 7D AE JSR $AE7D 0x012BDE|$04:$ABCE:A9 2C LDA #$2C ; String ID #$002C: Then [name] was brought back to life![end-FC] 0x012BE0|$04:$ABD0:8D E4 06 STA $06E4 0x012BE3|$04:$ABD3:20 AE B2 JSR $B2AE 0x012BE6|$04:$ABD6:90 03 BCC $ABDB 0x012BE8|$04:$ABD8:A9 07 LDA #$07 0x012BEA|$04:$ABDA:60 RTS ; control flow target (from $ABD6) 0x012BEB|$04:$ABDB:8D E3 06 STA $06E3 0x012BEE|$04:$ABDE:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x012BF1|$04:$ABE1:8A TXA 0x012BF2|$04:$ABE2:4C CE AD JMP $ADCE ; handler for Attack ID #$10: Defence ; indirect control flow target (via $A99C) 0x012BF5|$04:$ABE5:A9 E8 LDA #$E8 0x012BF7|$04:$ABE7:4C 84 AC JMP $AC84 ; handler for Attack ID #$11: Increase ; indirect control flow target (via $A99E) 0x012BFA|$04:$ABEA:A9 EA LDA #$EA 0x012BFC|$04:$ABEC:85 AD STA $AD 0x012BFE|$04:$ABEE:20 7D AE JSR $AE7D 0x012C01|$04:$ABF1:A9 00 LDA #$00 0x012C03|$04:$ABF3:8D E8 06 STA $06E8 ; control flow target (from $AC54) 0x012C06|$04:$ABF6:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x012C09|$04:$ABF9:A0 03 LDY #$03 0x012C0B|$04:$ABFB:B1 B7 LDA ($B7),Y 0x012C0D|$04:$ABFD:C9 04 CMP #$04 0x012C0F|$04:$ABFF:B0 4B BCS $AC4C 0x012C11|$04:$AC01:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x012C14|$04:$AC04:A0 00 LDY #$00 0x012C16|$04:$AC06:B1 B5 LDA ($B5),Y 0x012C18|$04:$AC08:85 AE STA $AE 0x012C1A|$04:$AC0A:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x012C1D|$04:$AC0D:A0 03 LDY #$03 0x012C1F|$04:$AC0F:B1 B7 LDA ($B7),Y 0x012C21|$04:$AC11:0A ASL 0x012C22|$04:$AC12:0A ASL 0x012C23|$04:$AC13:0A ASL 0x012C24|$04:$AC14:0A ASL 0x012C25|$04:$AC15:A0 02 LDY #$02 0x012C27|$04:$AC17:11 B7 ORA ($B7),Y 0x012C29|$04:$AC19:85 AF STA $AF 0x012C2B|$04:$AC1B:A0 06 LDY #$06 0x012C2D|$04:$AC1D:B1 BB LDA ($BB),Y 0x012C2F|$04:$AC1F:85 A5 STA $A5 0x012C31|$04:$AC21:4A LSR 0x012C32|$04:$AC22:4A LSR 0x012C33|$04:$AC23:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012C36|$04:$AC26:A5 A5 LDA $A5 0x012C38|$04:$AC28:85 99 STA $99 0x012C3A|$04:$AC2A:20 DA A4 JSR $A4DA 0x012C3D|$04:$AC2D:A0 06 LDY #$06 0x012C3F|$04:$AC2F:B1 B7 LDA ($B7),Y 0x012C41|$04:$AC31:85 A6 STA $A6 0x012C43|$04:$AC33:18 CLC 0x012C44|$04:$AC34:65 B0 ADC $B0 0x012C46|$04:$AC36:90 02 BCC $AC3A 0x012C48|$04:$AC38:A9 FF LDA #$FF ; control flow target (from $AC36) 0x012C4A|$04:$AC3A:C5 99 CMP $99 0x012C4C|$04:$AC3C:90 02 BCC $AC40 0x012C4E|$04:$AC3E:A5 99 LDA $99 ; control flow target (from $AC3C) 0x012C50|$04:$AC40:91 B7 STA ($B7),Y 0x012C52|$04:$AC42:38 SEC 0x012C53|$04:$AC43:E5 A6 SBC $A6 0x012C55|$04:$AC45:85 B0 STA $B0 0x012C57|$04:$AC47:A9 23 LDA #$23 ; String ID #$0023: [name]'s Defense Power increased by [number].[end-FC] 0x012C59|$04:$AC49:20 E5 9C JSR $9CE5 ; control flow target (from $ABFF) 0x012C5C|$04:$AC4C:EE E8 06 INC $06E8 0x012C5F|$04:$AC4F:AD E8 06 LDA $06E8 0x012C62|$04:$AC52:C9 08 CMP #$08 0x012C64|$04:$AC54:90 A0 BCC $ABF6 0x012C66|$04:$AC56:60 RTS ; handler for Attack ID #$12: Sleep ; indirect control flow target (via $A9A0) 0x012C67|$04:$AC57:A9 E2 LDA #$E2 0x012C69|$04:$AC59:4C 84 AC JMP $AC84 ; handler for Attack ID #$13: Stopspell ; indirect control flow target (via $A9A2) 0x012C6C|$04:$AC5C:A9 E6 LDA #$E6 0x012C6E|$04:$AC5E:4C 84 AC JMP $AC84 ; handler for Attack ID #$14: Surround ; indirect control flow target (via $A9A4) 0x012C71|$04:$AC61:A9 E7 LDA #$E7 0x012C73|$04:$AC63:4C 84 AC JMP $AC84 ; handler for Attack ID #$15: Defeat ; indirect control flow target (via $A9A6) 0x012C76|$04:$AC66:A9 E4 LDA #$E4 0x012C78|$04:$AC68:4C 84 AC JMP $AC84 ; handler for Attack ID #$16: Sacrifice ; indirect control flow target (via $A9A8) 0x012C7B|$04:$AC6B:A9 EC LDA #$EC 0x012C7D|$04:$AC6D:4C 84 AC JMP $AC84 ; handler for Attack IDs #$17-#$19: Weak, Strong, Deadly Flames ; indirect control flow target (via $A9AA, $A9AC, $A9AE) 0x012C80|$04:$AC70:A9 33 LDA #$33 ; String ID #$0033: [name] blew scorching flames![end-FC] 0x012C82|$04:$AC72:4C 7F AC JMP $AC7F ; handler for Attack ID #$1A: Poison Breath ; indirect control flow target (via $A9B0) 0x012C85|$04:$AC75:A9 34 LDA #$34 ; String ID #$0034: [name] exhaled a blast of poisonous breath.[end-FC] 0x012C87|$04:$AC77:4C 7F AC JMP $AC7F ; handler for Attack ID #$1B: Sweet Breath ; indirect control flow target (via $A9B2) 0x012C8A|$04:$AC7A:A9 37 LDA #$37 ; String ID #$0037: [name] blew its sweet scented breath.[end-FC] 0x012C8C|$04:$AC7C:4C 7F AC JMP $AC7F ; control flow target (from $AC72, $AC77, $AC7C) 0x012C8F|$04:$AC7F:85 AD STA $AD 0x012C91|$04:$AC81:4C 89 AC JMP $AC89 ; control flow target (from $ABE7, $AC59, $AC5E, $AC63, $AC68, $AC6D) 0x012C94|$04:$AC84:85 AD STA $AD 0x012C96|$04:$AC86:20 7D AE JSR $AE7D ; control flow target (from $AC81) 0x012C99|$04:$AC89:A9 00 LDA #$00 0x012C9B|$04:$AC8B:85 A8 STA $A8 ; control flow target (from $ACA2) 0x012C9D|$04:$AC8D:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x012CA0|$04:$AC90:A0 00 LDY #$00 0x012CA2|$04:$AC92:B1 B9 LDA ($B9),Y 0x012CA4|$04:$AC94:30 23 BMI $ACB9 ; control flow target (from $ACF4, $AD1D, $AD2D, $AD5E, $AD66, $AD7D) 0x012CA6|$04:$AC96:A5 98 LDA $98 ; outcome of last fight? 0x012CA8|$04:$AC98:F0 02 BEQ $AC9C 0x012CAA|$04:$AC9A:D0 08 BNE $ACA4 ; control flow target (from $AC98) 0x012CAC|$04:$AC9C:E6 A8 INC $A8 0x012CAE|$04:$AC9E:A5 A8 LDA $A8 0x012CB0|$04:$ACA0:C9 03 CMP #$03 0x012CB2|$04:$ACA2:90 E9 BCC $AC8D ; control flow target (from $AC9A) 0x012CB4|$04:$ACA4:AD E1 06 LDA $06E1 0x012CB7|$04:$ACA7:C9 16 CMP #$16 0x012CB9|$04:$ACA9:D0 0D BNE $ACB8 0x012CBB|$04:$ACAB:A5 AB LDA $AB 0x012CBD|$04:$ACAD:85 AE STA $AE 0x012CBF|$04:$ACAF:A5 AC LDA $AC 0x012CC1|$04:$ACB1:85 AF STA $AF 0x012CC3|$04:$ACB3:A9 27 LDA #$27 0x012CC5|$04:$ACB5:20 E5 9C JSR $9CE5 ; control flow target (from $ACA9) 0x012CC8|$04:$ACB8:60 RTS ; control flow target (from $AC94) 0x012CC9|$04:$ACB9:A5 A8 LDA $A8 0x012CCB|$04:$ACBB:49 FF EOR #$FF 0x012CCD|$04:$ACBD:85 AE STA $AE 0x012CCF|$04:$ACBF:AD E1 06 LDA $06E1 0x012CD2|$04:$ACC2:C9 10 CMP #$10 0x012CD4|$04:$ACC4:D0 31 BNE $ACF7 0x012CD6|$04:$ACC6:A0 0C LDY #$0C 0x012CD8|$04:$ACC8:B1 B9 LDA ($B9),Y 0x012CDA|$04:$ACCA:4A LSR 0x012CDB|$04:$ACCB:85 A5 STA $A5 0x012CDD|$04:$ACCD:4A LSR 0x012CDE|$04:$ACCE:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012CE1|$04:$ACD1:A0 0D LDY #$0D 0x012CE3|$04:$ACD3:B1 B9 LDA ($B9),Y 0x012CE5|$04:$ACD5:85 A6 STA $A6 0x012CE7|$04:$ACD7:38 SEC 0x012CE8|$04:$ACD8:E5 B0 SBC $B0 0x012CEA|$04:$ACDA:B0 02 BCS $ACDE 0x012CEC|$04:$ACDC:A9 00 LDA #$00 ; control flow target (from $ACDA) 0x012CEE|$04:$ACDE:C5 A5 CMP $A5 0x012CF0|$04:$ACE0:B0 02 BCS $ACE4 0x012CF2|$04:$ACE2:A5 A5 LDA $A5 ; control flow target (from $ACE0) 0x012CF4|$04:$ACE4:91 B9 STA ($B9),Y 0x012CF6|$04:$ACE6:85 99 STA $99 0x012CF8|$04:$ACE8:A5 A6 LDA $A6 0x012CFA|$04:$ACEA:38 SEC 0x012CFB|$04:$ACEB:E5 99 SBC $99 0x012CFD|$04:$ACED:85 B0 STA $B0 0x012CFF|$04:$ACEF:A9 22 LDA #$22 ; String ID #$0022: [name]'s Defense Power decreased by [number].[end-FC] 0x012D01|$04:$ACF1:20 E5 9C JSR $9CE5 0x012D04|$04:$ACF4:4C 96 AC JMP $AC96 ; control flow target (from $ACC4) 0x012D07|$04:$ACF7:C9 12 CMP #$12 0x012D09|$04:$ACF9:D0 35 BNE $AD30 0x012D0B|$04:$ACFB:A9 1E LDA #$1E ; String ID #$001E: [name] fell asleep.[end-FC] 0x012D0D|$04:$ACFD:85 A5 STA $A5 0x012D0F|$04:$ACFF:A9 40 LDA #$40 0x012D11|$04:$AD01:85 A6 STA $A6 0x012D13|$04:$AD03:A9 1D LDA #$1D ; String ID #$001D: [name] did not fall asleep.[end-FC] 0x012D15|$04:$AD05:D0 02 BNE $AD09 ; control flow target (from $AD40, $AD4E) 0x012D17|$04:$AD07:A9 18 LDA #$18 ; String ID #$0018: But the spell had no effect on [name].[end-FC] ; control flow target (from $AD05, $AD9E, $ADAB) 0x012D19|$04:$AD09:85 A4 STA $A4 0x012D1B|$04:$AD0B:A0 00 LDY #$00 0x012D1D|$04:$AD0D:B1 B9 LDA ($B9),Y 0x012D1F|$04:$AD0F:25 A6 AND $A6 0x012D21|$04:$AD11:D0 1A BNE $AD2D 0x012D23|$04:$AD13:20 D2 AF JSR $AFD2 0x012D26|$04:$AD16:90 08 BCC $AD20 0x012D28|$04:$AD18:A5 A4 LDA $A4 0x012D2A|$04:$AD1A:20 E5 9C JSR $9CE5 ; control flow target (from $AD36) 0x012D2D|$04:$AD1D:4C 96 AC JMP $AC96 ; control flow target (from $AD16) 0x012D30|$04:$AD20:A0 00 LDY #$00 0x012D32|$04:$AD22:B1 B9 LDA ($B9),Y 0x012D34|$04:$AD24:05 A6 ORA $A6 0x012D36|$04:$AD26:91 B9 STA ($B9),Y 0x012D38|$04:$AD28:A5 A5 LDA $A5 0x012D3A|$04:$AD2A:20 E5 9C JSR $9CE5 ; control flow target (from $AD11) 0x012D3D|$04:$AD2D:4C 96 AC JMP $AC96 ; control flow target (from $ACF9) 0x012D40|$04:$AD30:C9 13 CMP #$13 0x012D42|$04:$AD32:D0 0E BNE $AD42 0x012D44|$04:$AD34:A5 A8 LDA $A8 0x012D46|$04:$AD36:F0 E5 BEQ $AD1D 0x012D48|$04:$AD38:A9 2A LDA #$2A 0x012D4A|$04:$AD3A:85 A5 STA $A5 0x012D4C|$04:$AD3C:A9 01 LDA #$01 0x012D4E|$04:$AD3E:85 A6 STA $A6 0x012D50|$04:$AD40:D0 C5 BNE $AD07 ; control flow target (from $AD32) 0x012D52|$04:$AD42:C9 14 CMP #$14 0x012D54|$04:$AD44:D0 0A BNE $AD50 0x012D56|$04:$AD46:A9 2B LDA #$2B ; String ID #$002B: And [name] was surrounded by the Phantom Force.[end-FC] 0x012D58|$04:$AD48:85 A5 STA $A5 0x012D5A|$04:$AD4A:A9 02 LDA #$02 0x012D5C|$04:$AD4C:85 A6 STA $A6 0x012D5E|$04:$AD4E:D0 B7 BNE $AD07 ; control flow target (from $AD44) 0x012D60|$04:$AD50:C9 15 CMP #$15 ; Monster Attack ID #$15: Defeat 0x012D62|$04:$AD52:D0 15 BNE $AD69 0x012D64|$04:$AD54:20 07 B0 JSR $B007 0x012D67|$04:$AD57:90 08 BCC $AD61 0x012D69|$04:$AD59:A9 40 LDA #$40 0x012D6B|$04:$AD5B:20 E5 9C JSR $9CE5 0x012D6E|$04:$AD5E:4C 96 AC JMP $AC96 ; control flow target (from $AD57) 0x012D71|$04:$AD61:A9 1B LDA #$1B ; control flow target (from $AD6F) 0x012D73|$04:$AD63:20 55 AF JSR $AF55 0x012D76|$04:$AD66:4C 96 AC JMP $AC96 ; control flow target (from $AD52) 0x012D79|$04:$AD69:C9 16 CMP #$16 ; Attack ID #$16: Sacrifice 0x012D7B|$04:$AD6B:D0 04 BNE $AD71 0x012D7D|$04:$AD6D:A9 26 LDA #$26 ; String ID #$0026: [name] was utterly defeated.[end-FC] 0x012D7F|$04:$AD6F:D0 F2 BNE $AD63 ; control flow target (from $AD6B) 0x012D81|$04:$AD71:C9 17 CMP #$17 ; Attack ID #$17: Weak Flames 0x012D83|$04:$AD73:D0 0B BNE $AD80 0x012D85|$04:$AD75:A9 18 LDA #$18 ; Breath 1 power ; control flow target (from $AD86, $AD8E) 0x012D87|$04:$AD77:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012D8A|$04:$AD7A:20 FF AE JSR $AEFF ; extra resist for armors 0x012D8D|$04:$AD7D:4C 96 AC JMP $AC96 ; control flow target (from $AD73) 0x012D90|$04:$AD80:C9 18 CMP #$18 ; Attack ID #$18: Strong Flames 0x012D92|$04:$AD82:D0 04 BNE $AD88 0x012D94|$04:$AD84:A9 32 LDA #$32 ; Breath 2 power 0x012D96|$04:$AD86:D0 EF BNE $AD77 ; control flow target (from $AD82) 0x012D98|$04:$AD88:C9 19 CMP #$19 ; Attack ID #$19: Deadly Flames 0x012D9A|$04:$AD8A:D0 04 BNE $AD90 0x012D9C|$04:$AD8C:A9 8C LDA #$8C ; Breath 3 power 0x012D9E|$04:$AD8E:D0 E7 BNE $AD77 ; control flow target (from $AD8A) 0x012DA0|$04:$AD90:C9 1A CMP #$1A ; Attack ID #$1A: Poison Breath 0x012DA2|$04:$AD92:D0 0D BNE $ADA1 0x012DA4|$04:$AD94:A9 35 LDA #$35 ; String ID #$0035: [name] was poisoned.[end-FC] 0x012DA6|$04:$AD96:85 A5 STA $A5 0x012DA8|$04:$AD98:A9 20 LDA #$20 0x012DAA|$04:$AD9A:85 A6 STA $A6 0x012DAC|$04:$AD9C:A9 36 LDA #$36 ; String ID #$0036: [name] repelled the poison.[end-FC] 0x012DAE|$04:$AD9E:4C 09 AD JMP $AD09 ; control flow target (from $AD92) 0x012DB1|$04:$ADA1:A9 1E LDA #$1E ; String ID #$001E: [name] fell asleep.[end-FC] 0x012DB3|$04:$ADA3:85 A5 STA $A5 0x012DB5|$04:$ADA5:A9 40 LDA #$40 0x012DB7|$04:$ADA7:85 A6 STA $A6 0x012DB9|$04:$ADA9:A9 1D LDA #$1D ; String ID #$001D: [name] did not fall asleep.[end-FC] 0x012DBB|$04:$ADAB:4C 09 AD JMP $AD09 ; handler for Attack ID #$1C: Call For Help ; indirect control flow target (via $A9B4) 0x012DBE|$04:$ADAE:A9 13 LDA #$13 ; String ID #$0013: [name] called for help.[end-FC] 0x012DC0|$04:$ADB0:85 AD STA $AD 0x012DC2|$04:$ADB2:20 7D AE JSR $AE7D 0x012DC5|$04:$ADB5:A9 15 LDA #$15 ; String ID #$0015: [name] came to help.[end-FC] 0x012DC7|$04:$ADB7:8D E4 06 STA $06E4 0x012DCA|$04:$ADBA:A9 02 LDA #$02 ; 1/2 Chance of Call For Help Succeeding 0x012DCC|$04:$ADBC:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x012DCF|$04:$ADBF:D0 08 BNE $ADC9 0x012DD1|$04:$ADC1:AD E3 06 LDA $06E3 0x012DD4|$04:$ADC4:20 6D B2 JSR $B26D 0x012DD7|$04:$ADC7:90 05 BCC $ADCE ; control flow target (from $ADBF) 0x012DD9|$04:$ADC9:A9 14 LDA #$14 ; String ID #$0014: But no help came.[end-FC] 0x012DDB|$04:$ADCB:4C E5 9C JMP $9CE5 ; control flow target (from $ABE2, $ADC7) 0x012DDE|$04:$ADCE:91 B5 STA ($B5),Y 0x012DE0|$04:$ADD0:8D 5E 01 STA $015E 0x012DE3|$04:$ADD3:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x012DE6|$04:$ADD6:98 TYA 0x012DE7|$04:$ADD7:A0 02 LDY #$02 0x012DE9|$04:$ADD9:91 B7 STA ($B7),Y 0x012DEB|$04:$ADDB:85 AF STA $AF 0x012DED|$04:$ADDD:A0 03 LDY #$03 0x012DEF|$04:$ADDF:AD E3 06 LDA $06E3 0x012DF2|$04:$ADE2:91 B7 STA ($B7),Y 0x012DF4|$04:$ADE4:0A ASL 0x012DF5|$04:$ADE5:0A ASL 0x012DF6|$04:$ADE6:0A ASL 0x012DF7|$04:$ADE7:0A ASL 0x012DF8|$04:$ADE8:05 AF ORA $AF 0x012DFA|$04:$ADEA:85 AF STA $AF 0x012DFC|$04:$ADEC:A0 00 LDY #$00 0x012DFE|$04:$ADEE:A9 00 LDA #$00 0x012E00|$04:$ADF0:91 B7 STA ($B7),Y 0x012E02|$04:$ADF2:C8 INY 0x012E03|$04:$ADF3:A9 04 LDA #$04 0x012E05|$04:$ADF5:91 B7 STA ($B7),Y 0x012E07|$04:$ADF7:A0 09 LDY #$09 0x012E09|$04:$ADF9:B1 B5 LDA ($B5),Y 0x012E0B|$04:$ADFB:AA TAX 0x012E0C|$04:$ADFC:E8 INX 0x012E0D|$04:$ADFD:8A TXA 0x012E0E|$04:$ADFE:91 B5 STA ($B5),Y 0x012E10|$04:$AE00:A0 00 LDY #$00 0x012E12|$04:$AE02:B1 B5 LDA ($B5),Y 0x012E14|$04:$AE04:8D 5F 01 STA $015F 0x012E17|$04:$AE07:85 AE STA $AE 0x012E19|$04:$AE09:20 A4 B7 JSR $B7A4 0x012E1C|$04:$AE0C:20 AB B6 JSR $B6AB 0x012E1F|$04:$AE0F:AD E4 06 LDA $06E4 0x012E22|$04:$AE12:4C E5 9C JMP $9CE5 ; handler for Attack ID #$1D: Two Attacks ; indirect control flow target (via $A9B6) 0x012E25|$04:$AE15:20 BC A9 JSR $A9BC ; handler for Attack IDs #$00/#$1E: Attack / Concentrated Attack 0x012E28|$04:$AE18:20 B9 A7 JSR $A7B9 0x012E2B|$04:$AE1B:4C BC A9 JMP $A9BC ; handler for Attack IDs #$00/#$1E: Attack / Concentrated Attack ; handler for Attack ID #$1F: Strange Jig ; indirect control flow target (via $A9BA) 0x012E2E|$04:$AE1E:A9 31 LDA #$31 ; String ID #$0031: Then [name] danced a strange jig.[end-FC] 0x012E30|$04:$AE20:85 AD STA $AD 0x012E32|$04:$AE22:A9 02 LDA #$02 ; 2 heroes with MP 0x012E34|$04:$AE24:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x012E37|$04:$AE27:85 A3 STA $A3 0x012E39|$04:$AE29:E6 A3 INC $A3 ; convert to 1-2 for Cannock-Moonbrooke 0x012E3B|$04:$AE2B:A5 A3 LDA $A3 0x012E3D|$04:$AE2D:20 6D AE JSR $AE6D ; given hero ID in A, return that hero's current MP in A or #$00 if hero is dead 0x012E40|$04:$AE30:D0 10 BNE $AE42 0x012E42|$04:$AE32:A5 A3 LDA $A3 0x012E44|$04:$AE34:29 01 AND #$01 0x012E46|$04:$AE36:85 A3 STA $A3 0x012E48|$04:$AE38:E6 A3 INC $A3 ; if at first you don't succeed, try the other hero 0x012E4A|$04:$AE3A:A5 A3 LDA $A3 0x012E4C|$04:$AE3C:20 6D AE JSR $AE6D ; given hero ID in A, return that hero's current MP in A or #$00 if hero is dead 0x012E4F|$04:$AE3F:D0 01 BNE $AE42 0x012E51|$04:$AE41:60 RTS ; control flow target (from $AE30, $AE3F) 0x012E52|$04:$AE42:A5 A3 LDA $A3 0x012E54|$04:$AE44:49 FF EOR #$FF 0x012E56|$04:$AE46:85 AE STA $AE 0x012E58|$04:$AE48:A0 05 LDY #$05 ; Hero Max MP 0x012E5A|$04:$AE4A:B1 B9 LDA ($B9),Y 0x012E5C|$04:$AE4C:4A LSR ; Power = 1/2 Max MP 0x012E5D|$04:$AE4D:20 8C AE JSR $AE8C ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 0x012E60|$04:$AE50:A0 10 LDY #$10 ; offset for current MP 0x012E62|$04:$AE52:B1 B9 LDA ($B9),Y 0x012E64|$04:$AE54:85 9A STA $9A ; original current MP 0x012E66|$04:$AE56:38 SEC 0x012E67|$04:$AE57:E5 B0 SBC $B0 ; randomized MP damage amount 0x012E69|$04:$AE59:B0 02 BCS $AE5D 0x012E6B|$04:$AE5B:A9 00 LDA #$00 ; if negative, use 0 instead ; control flow target (from $AE59) 0x012E6D|$04:$AE5D:91 B9 STA ($B9),Y ; update current MP 0x012E6F|$04:$AE5F:85 99 STA $99 ; new current MP 0x012E71|$04:$AE61:A5 9A LDA $9A ; original current MP 0x012E73|$04:$AE63:38 SEC 0x012E74|$04:$AE64:E5 99 SBC $99 ; new current MP 0x012E76|$04:$AE66:85 B0 STA $B0 ; actual MP damage 0x012E78|$04:$AE68:A9 32 LDA #$32 ; String ID #$0032: And [name] lost [number] MP.[end-FC] 0x012E7A|$04:$AE6A:4C E5 9C JMP $9CE5 ; given hero ID in A, return that hero's current MP in A or #$00 if hero is dead ; control flow target (from $AE2D, $AE3C) 0x012E7D|$04:$AE6D:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x012E80|$04:$AE70:A0 00 LDY #$00 ; status offset 0x012E82|$04:$AE72:B1 B9 LDA ($B9),Y 0x012E84|$04:$AE74:29 80 AND #$80 ; Alive 0x012E86|$04:$AE76:F0 04 BEQ $AE7C 0x012E88|$04:$AE78:A0 10 LDY #$10 ; offset for current MP 0x012E8A|$04:$AE7A:B1 B9 LDA ($B9),Y ; control flow target (from $AE76) 0x012E8C|$04:$AE7C:60 RTS ; control flow target (from $AA7C, $AA99, $AAC8, $AAD7, $AAF5, $AB07, $ABCB, $ABEE, $AC86, $ADB2) 0x012E8D|$04:$AE7D:AD E7 06 LDA $06E7 ; Fireball, Firebane, and Explodet 0x012E90|$04:$AE80:29 40 AND #$40 0x012E92|$04:$AE82:F0 07 BEQ $AE8B 0x012E94|$04:$AE84:A9 12 LDA #$12 0x012E96|$04:$AE86:20 E5 9C JSR $9CE5 0x012E99|$04:$AE89:68 PLA 0x012E9A|$04:$AE8A:68 PLA ; control flow target (from $AE82) 0x012E9B|$04:$AE8B:60 RTS ; $B0 = random number tightly distributed around A / 2, $B1 = #$00 ; control flow target (from $A412, $A4A3, $A781, $A7A8, $AA81, $AAA2, $AACD, $AAFA, $AC23, $ACCE, $AD77, $AE4D) 0x012E9C|$04:$AE8C:85 99 STA $99 0x012E9E|$04:$AE8E:A9 00 LDA #$00 0x012EA0|$04:$AE90:85 9A STA $9A 0x012EA2|$04:$AE92:20 FB 9F JSR $9FFB ; set $9B to a random number tightly distributed around #$80 and $9C to #$00 0x012EA5|$04:$AE95:20 5F A0 JSR $A05F ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B-$9C), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) 0x012EA8|$04:$AE98:A5 9D LDA $9D 0x012EAA|$04:$AE9A:85 B0 STA $B0 0x012EAC|$04:$AE9C:A5 9E LDA $9E ; product of 2 8-bit number can never exceed 16 bits, so this is guaranteed to be #$00 0x012EAE|$04:$AE9E:85 B1 STA $B1 0x012EB0|$04:$AEA0:60 RTS ; control flow target (from $AA0E, $AA84, $AAA5) 0x012EB1|$04:$AEA1:A9 0C LDA #$0C ; Firebal 0x012EB3|$04:$AEA3:85 B2 STA $B2 ; control flow target (from $AA0B) 0x012EB5|$04:$AEA5:A5 A8 LDA $A8 0x012EB7|$04:$AEA7:49 FF EOR #$FF 0x012EB9|$04:$AEA9:85 AE STA $AE 0x012EBB|$04:$AEAB:A5 A8 LDA $A8 0x012EBD|$04:$AEAD:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x012EC0|$04:$AEB0:A0 00 LDY #$00 0x012EC2|$04:$AEB2:B1 B9 LDA ($B9),Y 0x012EC4|$04:$AEB4:30 01 BMI $AEB7 0x012EC6|$04:$AEB6:60 RTS ; control flow target (from $AEB4) 0x012EC7|$04:$AEB7:A0 02 LDY #$02 0x012EC9|$04:$AEB9:B1 B9 LDA ($B9),Y 0x012ECB|$04:$AEBB:C9 3C CMP #$3C 0x012ECD|$04:$AEBD:D0 04 BNE $AEC3 0x012ECF|$04:$AEBF:46 B1 LSR $B1 0x012ED1|$04:$AEC1:66 B0 ROR $B0 ; control flow target (from $AEBD) 0x012ED3|$04:$AEC3:AD E1 06 LDA $06E1 0x012ED6|$04:$AEC6:C9 06 CMP #$06 ; Firebal 0x012ED8|$04:$AEC8:90 0F BCC $AED9 0x012EDA|$04:$AECA:C9 09 CMP #$09 0x012EDC|$04:$AECC:B0 0B BCS $AED9 0x012EDE|$04:$AECE:A5 B0 LDA $B0 0x012EE0|$04:$AED0:05 B1 ORA $B1 0x012EE2|$04:$AED2:D0 2F BNE $AF03 0x012EE4|$04:$AED4:E6 B0 INC $B0 0x012EE6|$04:$AED6:4C 03 AF JMP $AF03 ; control flow target (from $AEC8, $AECC) 0x012EE9|$04:$AED9:AD E7 06 LDA $06E7 0x012EEC|$04:$AEDC:6A ROR 0x012EED|$04:$AEDD:90 0F BCC $AEEE ; call to code in a different bank ($0F:$C3AB) 0x012EEF|$04:$AEDF:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x012EF2|$04:$AEE2:A5 32 LDA $32 ; RNG byte 0 0x012EF4|$04:$AEE4:29 03 AND #$03 0x012EF6|$04:$AEE6:D0 06 BNE $AEEE 0x012EF8|$04:$AEE8:A9 00 LDA #$00 0x012EFA|$04:$AEEA:85 B0 STA $B0 0x012EFC|$04:$AEEC:85 B1 STA $B1 ; control flow target (from $AEDD, $AEE6) 0x012EFE|$04:$AEEE:A5 B0 LDA $B0 0x012F00|$04:$AEF0:05 B1 ORA $B1 0x012F02|$04:$AEF2:D0 0F BNE $AF03 0x012F04|$04:$AEF4:A9 07 LDA #$07 ; String ID #$0007: But missed![end-FC] 0x012F06|$04:$AEF6:20 DE 9A JSR $9ADE ; STA $B4, $B3 |= #$20 0x012F09|$04:$AEF9:A9 09 LDA #$09 0x012F0B|$04:$AEFB:20 E5 9C JSR $9CE5 0x012F0E|$04:$AEFE:60 RTS ; control flow target (from $AD7A) 0x012F0F|$04:$AEFF:A9 0C LDA #$0C ; String ID #$000C: [name]'s HP is reduced by [number].[end-FC] 0x012F11|$04:$AF01:85 B2 STA $B2 ; control flow target (from $AED2, $AED6, $AEF2) 0x012F13|$04:$AF03:A5 B2 LDA $B2 0x012F15|$04:$AF05:C9 2F CMP #$2F ; Item ID #$2F: Gremlin’s Tail 0x012F17|$04:$AF07:F0 04 BEQ $AF0D 0x012F19|$04:$AF09:C9 30 CMP #$30 ; Item ID #$30: Dragon’s Bane 0x012F1B|$04:$AF0B:D0 08 BNE $AF15 ; control flow target (from $AF07) 0x012F1D|$04:$AF0D:A0 00 LDY #$00 0x012F1F|$04:$AF0F:B1 B9 LDA ($B9),Y 0x012F21|$04:$AF11:05 C5 ORA $C5 0x012F23|$04:$AF13:91 B9 STA ($B9),Y ; control flow target (from $AF0B) 0x012F25|$04:$AF15:A5 A8 LDA $A8 0x012F27|$04:$AF17:85 9C STA $9C 0x012F29|$04:$AF19:A9 53 LDA #$53 ; Item ID #$53: Water Flying Cloth (equipped) 0x012F2B|$04:$AF1B:20 CC AF JSR $AFCC 0x012F2E|$04:$AF1E:B0 61 BCS $AF81 0x012F30|$04:$AF20:A9 58 LDA #$58 ; Item ID #$58: Magic Armor (equipped) 0x012F32|$04:$AF22:20 CC AF JSR $AFCC 0x012F35|$04:$AF25:B0 5A BCS $AF81 0x012F37|$04:$AF27:A9 5B LDA #$5B ; Item ID #$5B: Armor of Erdrick (equipped) 0x012F39|$04:$AF29:20 CC AF JSR $AFCC 0x012F3C|$04:$AF2C:B0 53 BCS $AF81 0x012F3E|$04:$AF2E:4C C2 AF JMP $AFC2 ; control flow target (from $AF9B) 0x012F41|$04:$AF31:A5 B0 LDA $B0 0x012F43|$04:$AF33:85 9B STA $9B 0x012F45|$04:$AF35:A5 B1 LDA $B1 0x012F47|$04:$AF37:85 9C STA $9C 0x012F49|$04:$AF39:A0 0E LDY #$0E 0x012F4B|$04:$AF3B:B1 B9 LDA ($B9),Y 0x012F4D|$04:$AF3D:85 99 STA $99 0x012F4F|$04:$AF3F:A0 0F LDY #$0F 0x012F51|$04:$AF41:B1 B9 LDA ($B9),Y 0x012F53|$04:$AF43:85 9A STA $9A 0x012F55|$04:$AF45:20 E3 A0 JSR $A0E3 ; 16-bit subtraction: ($99-$9A) = ($99-$9A) - ($9B-$9C) 0x012F58|$04:$AF48:90 06 BCC $AF50 0x012F5A|$04:$AF4A:A5 99 LDA $99 0x012F5C|$04:$AF4C:05 9A ORA $9A 0x012F5E|$04:$AF4E:D0 23 BNE $AF73 ; control flow target (from $AF48) 0x012F60|$04:$AF50:20 6D AF JSR $AF6D 0x012F63|$04:$AF53:A9 1B LDA #$1B ; control flow target (from $A396, $AD63) 0x012F65|$04:$AF55:85 B2 STA $B2 0x012F67|$04:$AF57:A0 00 LDY #$00 0x012F69|$04:$AF59:A9 04 LDA #$04 0x012F6B|$04:$AF5B:91 B9 STA ($B9),Y 0x012F6D|$04:$AF5D:20 F1 A0 JSR $A0F1 0x012F70|$04:$AF60:A2 00 LDX #$00 0x012F72|$04:$AF62:20 43 B2 JSR $B243 0x012F75|$04:$AF65:A5 A3 LDA $A3 0x012F77|$04:$AF67:D0 04 BNE $AF6D 0x012F79|$04:$AF69:A9 FF LDA #$FF 0x012F7B|$04:$AF6B:85 98 STA $98 ; outcome of last fight? ; control flow target (from $AF50, $AF67) 0x012F7D|$04:$AF6D:A9 00 LDA #$00 0x012F7F|$04:$AF6F:85 99 STA $99 0x012F81|$04:$AF71:85 9A STA $9A ; control flow target (from $AF4E) 0x012F83|$04:$AF73:A0 0E LDY #$0E 0x012F85|$04:$AF75:A5 99 LDA $99 0x012F87|$04:$AF77:91 B9 STA ($B9),Y 0x012F89|$04:$AF79:C8 INY 0x012F8A|$04:$AF7A:A5 9A LDA $9A 0x012F8C|$04:$AF7C:91 B9 STA ($B9),Y 0x012F8E|$04:$AF7E:4C E7 9A JMP $9AE7 ; control flow target (from $AF1E, $AF25, $AF2C) 0x012F91|$04:$AF81:AD E1 06 LDA $06E1 ; All 3 armors BCS to here 0x012F94|$04:$AF84:C9 06 CMP #$06 ; Firebal 0x012F96|$04:$AF86:90 13 BCC $AF9B 0x012F98|$04:$AF88:C9 09 CMP #$09 0x012F9A|$04:$AF8A:90 12 BCC $AF9E 0x012F9C|$04:$AF8C:C9 17 CMP #$17 ; Breath 0x012F9E|$04:$AF8E:90 0B BCC $AF9B 0x012FA0|$04:$AF90:C9 1A CMP #$1A 0x012FA2|$04:$AF92:B0 07 BCS $AF9B 0x012FA4|$04:$AF94:AD E5 06 LDA $06E5 0x012FA7|$04:$AF97:C9 58 CMP #$58 ; Item ID #$58: Magic Armor (equipped) 0x012FA9|$04:$AF99:D0 03 BNE $AF9E ; control flow target (from $AF86, $AF8E, $AF92, $AFC6, $AFCA) 0x012FAB|$04:$AF9B:4C 31 AF JMP $AF31 ; control flow target (from $AF8A, $AF99) 0x012FAE|$04:$AF9E:46 B1 LSR $B1 0x012FB0|$04:$AFA0:66 B0 ROR $B0 0x012FB2|$04:$AFA2:A5 B1 LDA $B1 0x012FB4|$04:$AFA4:85 9A STA $9A 0x012FB6|$04:$AFA6:A5 B0 LDA $B0 0x012FB8|$04:$AFA8:85 99 STA $99 0x012FBA|$04:$AFAA:46 9A LSR $9A 0x012FBC|$04:$AFAC:66 99 ROR $99 0x012FBE|$04:$AFAE:AD E5 06 LDA $06E5 0x012FC1|$04:$AFB1:C9 53 CMP #$53 ; Item ID #$53: Water Flying Cloth (equipped) 0x012FC3|$04:$AFB3:F0 0D BEQ $AFC2 0x012FC5|$04:$AFB5:18 CLC 0x012FC6|$04:$AFB6:A5 99 LDA $99 0x012FC8|$04:$AFB8:65 B0 ADC $B0 0x012FCA|$04:$AFBA:85 B0 STA $B0 0x012FCC|$04:$AFBC:A5 9A LDA $9A 0x012FCE|$04:$AFBE:65 B1 ADC $B1 0x012FD0|$04:$AFC0:85 B1 STA $B1 ; control flow target (from $AF2E, $AFB3) 0x012FD2|$04:$AFC2:A5 B0 LDA $B0 0x012FD4|$04:$AFC4:05 B1 ORA $B1 0x012FD6|$04:$AFC6:D0 D3 BNE $AF9B 0x012FD8|$04:$AFC8:E6 B0 INC $B0 0x012FDA|$04:$AFCA:D0 CF BNE $AF9B ; control flow target (from $AF1B, $AF22, $AF29) 0x012FDC|$04:$AFCC:8D E5 06 STA $06E5 ; call to code in a different bank ($0F:$C4B0) 0x012FDF|$04:$AFCF:4C B0 C4 JMP $C4B0 ; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise ; control flow target (from $AD13) 0x012FE2|$04:$AFD2:AD E1 06 LDA $06E1 0x012FE5|$04:$AFD5:C9 13 CMP #$13 0x012FE7|$04:$AFD7:F0 04 BEQ $AFDD 0x012FE9|$04:$AFD9:C9 12 CMP #$12 0x012FEB|$04:$AFDB:D0 22 BNE $AFFF ; control flow target (from $AFD7) 0x012FED|$04:$AFDD:A5 A8 LDA $A8 0x012FEF|$04:$AFDF:85 9C STA $9C 0x012FF1|$04:$AFE1:A9 6F LDA #$6F ; Item ID #$6F: Gremlin’s Tail (equipped) ; call to code in a different bank ($0F:$C4B0) 0x012FF3|$04:$AFE3:20 B0 C4 JSR $C4B0 ; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise 0x012FF6|$04:$AFE6:A2 18 LDX #$18 ; 24/32 Sleep, Stopspell - Gremlin's Tail 0x012FF8|$04:$AFE8:B0 0B BCS $AFF5 0x012FFA|$04:$AFEA:A9 70 LDA #$70 ; Item ID #$70: Dragon’s Bane (equipped) ; call to code in a different bank ($0F:$C4B0) 0x012FFC|$04:$AFEC:20 B0 C4 JSR $C4B0 ; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise 0x012FFF|$04:$AFEF:A2 03 LDX #$03 ; 3/32 Sleep, Stopspell - Dragon's Bane 0x013001|$04:$AFF1:B0 02 BCS $AFF5 0x013003|$04:$AFF3:A2 0C LDX #$0C ; 12/32 Sleep, Stopspell ; control flow target (from $AFE8, $AFF1) 0x013005|$04:$AFF5:A9 20 LDA #$20 0x013007|$04:$AFF7:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x01300A|$04:$AFFA:86 9A STX $9A 0x01300C|$04:$AFFC:C5 9A CMP $9A 0x01300E|$04:$AFFE:60 RTS ; control flow target (from $AA3A, $AFDB) 0x01300F|$04:$AFFF:A9 08 LDA #$08 0x013011|$04:$B001:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x013014|$04:$B004:C9 03 CMP #$03 ; 3/8 Faint Attack, Surround, Poison Breath, Sweet Breath 0x013016|$04:$B006:60 RTS ; control flow target (from $A9E9, $AA11, $AD54) 0x013017|$04:$B007:A9 08 LDA #$08 0x013019|$04:$B009:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x01301C|$04:$B00C:C9 01 CMP #$01 ; 1/8 Heroic Attack, Defeat 0x01301E|$04:$B00E:60 RTS ; control flow target (from $A9C0) 0x01301F|$04:$B00F:A5 A8 LDA $A8 0x013021|$04:$B011:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x013024|$04:$B014:A0 0D LDY #$0D 0x013026|$04:$B016:B1 B9 LDA ($B9),Y 0x013028|$04:$B018:85 9B STA $9B 0x01302A|$04:$B01A:A0 00 LDY #$00 0x01302C|$04:$B01C:B1 B9 LDA ($B9),Y 0x01302E|$04:$B01E:29 40 AND #$40 0x013030|$04:$B020:8D E9 06 STA $06E9 ; control flow target (from $A91E) 0x013033|$04:$B023:AD EA 06 LDA $06EA 0x013036|$04:$B026:85 99 STA $99 0x013038|$04:$B028:A9 00 LDA #$00 0x01303A|$04:$B02A:85 9A STA $9A 0x01303C|$04:$B02C:85 9C STA $9C 0x01303E|$04:$B02E:20 6C 9F JSR $9F6C 0x013041|$04:$B031:AD E9 06 LDA $06E9 0x013044|$04:$B034:F0 13 BEQ $B049 0x013046|$04:$B036:A9 05 LDA #$05 0x013048|$04:$B038:85 9B STA $9B 0x01304A|$04:$B03A:A9 00 LDA #$00 ; this is a waste of bytes; should skip these 2 ops and call $A05B instead of $A05F 0x01304C|$04:$B03C:85 9C STA $9C 0x01304E|$04:$B03E:20 5F A0 JSR $A05F ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B-$9C), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) 0x013051|$04:$B041:46 9A LSR $9A 0x013053|$04:$B043:66 99 ROR $99 0x013055|$04:$B045:46 9A LSR $9A 0x013057|$04:$B047:66 99 ROR $99 ; control flow target (from $B034) 0x013059|$04:$B049:A5 99 LDA $99 0x01305B|$04:$B04B:85 B0 STA $B0 0x01305D|$04:$B04D:A5 9A LDA $9A 0x01305F|$04:$B04F:85 B1 STA $B1 0x013061|$04:$B051:60 RTS ; control flow target (from $95F6, $A87B) 0x013062|$04:$B052:85 AE STA $AE 0x013064|$04:$B054:20 DC B1 JSR $B1DC 0x013067|$04:$B057:A5 AF LDA $AF 0x013069|$04:$B059:C9 04 CMP #$04 0x01306B|$04:$B05B:90 01 BCC $B05E 0x01306D|$04:$B05D:60 RTS ; control flow target (from $B05B) 0x01306E|$04:$B05E:A0 07 LDY #$07 0x013070|$04:$B060:B1 BB LDA ($BB),Y 0x013072|$04:$B062:2A ROL 0x013073|$04:$B063:2A ROL 0x013074|$04:$B064:2A ROL 0x013075|$04:$B065:29 03 AND #$03 0x013077|$04:$B067:85 B0 STA $B0 0x013079|$04:$B069:A9 64 LDA #$64 0x01307B|$04:$B06B:8D E8 06 STA $06E8 ; control flow target (from $B0CB, $B0E5, $B12E, $B18E, $B1AC, $B1D5) 0x01307E|$04:$B06E:CE E8 06 DEC $06E8 0x013081|$04:$B071:D0 05 BNE $B078 0x013083|$04:$B073:A9 00 LDA #$00 0x013085|$04:$B075:4C D8 B1 JMP $B1D8 ; control flow target (from $B071) ; call to code in a different bank ($0F:$C3AB) 0x013088|$04:$B078:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x01308B|$04:$B07B:A5 B0 LDA $B0 0x01308D|$04:$B07D:20 D7 9E JSR $9ED7 ; given an index (in A) into the array of enemy special % structures at $B2F6, set $BD-$BE to the address of the corresponding item inside that structure 0x013090|$04:$B080:A0 00 LDY #$00 ; control flow target (from $B08B) 0x013092|$04:$B082:B1 BD LDA ($BD),Y 0x013094|$04:$B084:C5 32 CMP $32 ; RNG byte 0 0x013096|$04:$B086:B0 05 BCS $B08D 0x013098|$04:$B088:C8 INY 0x013099|$04:$B089:C0 07 CPY #$07 0x01309B|$04:$B08B:90 F5 BCC $B082 ; control flow target (from $B086) 0x01309D|$04:$B08D:98 TYA 0x01309E|$04:$B08E:AA TAX 0x01309F|$04:$B08F:4A LSR 0x0130A0|$04:$B090:08 PHP 0x0130A1|$04:$B091:85 9B STA $9B 0x0130A3|$04:$B093:A9 0A LDA #$0A 0x0130A5|$04:$B095:18 CLC 0x0130A6|$04:$B096:65 9B ADC $9B 0x0130A8|$04:$B098:A8 TAY 0x0130A9|$04:$B099:B1 BB LDA ($BB),Y 0x0130AB|$04:$B09B:28 PLP 0x0130AC|$04:$B09C:90 04 BCC $B0A2 0x0130AE|$04:$B09E:0A ASL 0x0130AF|$04:$B09F:0A ASL 0x0130B0|$04:$B0A0:0A ASL 0x0130B1|$04:$B0A1:0A ASL ; control flow target (from $B09C) 0x0130B2|$04:$B0A2:29 F0 AND #$F0 0x0130B4|$04:$B0A4:85 9C STA $9C 0x0130B6|$04:$B0A6:A0 0E LDY #$0E 0x0130B8|$04:$B0A8:B1 BB LDA ($BB),Y 0x0130BA|$04:$B0AA:E8 INX ; control flow target (from $B0AF) 0x0130BB|$04:$B0AB:CA DEX 0x0130BC|$04:$B0AC:F0 03 BEQ $B0B1 0x0130BE|$04:$B0AE:4A LSR 0x0130BF|$04:$B0AF:10 FA BPL $B0AB ; control flow target (from $B0AC) 0x0130C1|$04:$B0B1:4A LSR 0x0130C2|$04:$B0B2:66 9C ROR $9C 0x0130C4|$04:$B0B4:A5 9C LDA $9C 0x0130C6|$04:$B0B6:4A LSR 0x0130C7|$04:$B0B7:4A LSR 0x0130C8|$04:$B0B8:4A LSR 0x0130C9|$04:$B0B9:85 AD STA $AD 0x0130CB|$04:$B0BB:C9 16 CMP #$16 0x0130CD|$04:$B0BD:D0 0E BNE $B0CD 0x0130CF|$04:$B0BF:20 0F B2 JSR $B20F 0x0130D2|$04:$B0C2:46 9C LSR $9C 0x0130D4|$04:$B0C4:66 9B ROR $9B 0x0130D6|$04:$B0C6:20 17 B2 JSR $B217 0x0130D9|$04:$B0C9:90 02 BCC $B0CD 0x0130DB|$04:$B0CB:B0 A1 BCS $B06E ; control flow target (from $B0BD, $B0C9) 0x0130DD|$04:$B0CD:A5 B0 LDA $B0 0x0130DF|$04:$B0CF:C9 02 CMP #$02 0x0130E1|$04:$B0D1:90 58 BCC $B12B 0x0130E3|$04:$B0D3:A0 00 LDY #$00 0x0130E5|$04:$B0D5:B1 B7 LDA ($B7),Y 0x0130E7|$04:$B0D7:29 40 AND #$40 0x0130E9|$04:$B0D9:F0 0D BEQ $B0E8 0x0130EB|$04:$B0DB:A5 AD LDA $AD 0x0130ED|$04:$B0DD:C9 06 CMP #$06 0x0130EF|$04:$B0DF:90 07 BCC $B0E8 0x0130F1|$04:$B0E1:C9 17 CMP #$17 0x0130F3|$04:$B0E3:B0 03 BCS $B0E8 0x0130F5|$04:$B0E5:4C 6E B0 JMP $B06E ; control flow target (from $B0D9, $B0DF, $B0E3) 0x0130F8|$04:$B0E8:A2 00 LDX #$00 0x0130FA|$04:$B0EA:20 43 B2 JSR $B243 0x0130FD|$04:$B0ED:A5 AD LDA $AD 0x0130FF|$04:$B0EF:C9 12 CMP #$12 0x013101|$04:$B0F1:D0 0C BNE $B0FF 0x013103|$04:$B0F3:A2 01 LDX #$01 0x013105|$04:$B0F5:20 43 B2 JSR $B243 0x013108|$04:$B0F8:A5 A3 LDA $A3 0x01310A|$04:$B0FA:C5 A4 CMP $A4 0x01310C|$04:$B0FC:4C 1C B1 JMP $B11C ; control flow target (from $B0F1) 0x01310F|$04:$B0FF:C9 13 CMP #$13 0x013111|$04:$B101:D0 0C BNE $B10F 0x013113|$04:$B103:A2 03 LDX #$03 0x013115|$04:$B105:20 43 B2 JSR $B243 0x013118|$04:$B108:A5 A3 LDA $A3 0x01311A|$04:$B10A:C5 A6 CMP $A6 0x01311C|$04:$B10C:4C 1C B1 JMP $B11C ; control flow target (from $B101) 0x01311F|$04:$B10F:C9 14 CMP #$14 0x013121|$04:$B111:D0 0D BNE $B120 0x013123|$04:$B113:A2 02 LDX #$02 0x013125|$04:$B115:20 43 B2 JSR $B243 0x013128|$04:$B118:A5 A3 LDA $A3 0x01312A|$04:$B11A:C5 A5 CMP $A5 ; control flow target (from $B0FC, $B10C) 0x01312C|$04:$B11C:D0 0D BNE $B12B 0x01312E|$04:$B11E:F0 0E BEQ $B12E ; control flow target (from $B111) 0x013130|$04:$B120:C9 1C CMP #$1C 0x013132|$04:$B122:D0 0D BNE $B131 0x013134|$04:$B124:A5 AF LDA $AF 0x013136|$04:$B126:20 6D B2 JSR $B26D ; control flow target (from $B138, $B149) 0x013139|$04:$B129:B0 03 BCS $B12E ; control flow target (from $B0D1, $B11C) 0x01313B|$04:$B12B:4C 94 B1 JMP $B194 ; control flow target (from $B11E, $B129) 0x01313E|$04:$B12E:4C 6E B0 JMP $B06E ; control flow target (from $B122) 0x013141|$04:$B131:C9 0F CMP #$0F 0x013143|$04:$B133:D0 06 BNE $B13B 0x013145|$04:$B135:20 AE B2 JSR $B2AE 0x013148|$04:$B138:4C 29 B1 JMP $B129 ; control flow target (from $B133) 0x01314B|$04:$B13B:C9 09 CMP #$09 0x01314D|$04:$B13D:90 0D BCC $B14C 0x01314F|$04:$B13F:C9 0C CMP #$0C 0x013151|$04:$B141:B0 09 BCS $B14C 0x013153|$04:$B143:20 0F B2 JSR $B20F 0x013156|$04:$B146:20 17 B2 JSR $B217 0x013159|$04:$B149:4C 29 B1 JMP $B129 ; control flow target (from $B13D, $B141) 0x01315C|$04:$B14C:C9 0C CMP #$0C 0x01315E|$04:$B14E:90 44 BCC $B194 0x013160|$04:$B150:C9 0F CMP #$0F 0x013162|$04:$B152:B0 40 BCS $B194 0x013164|$04:$B154:A9 00 LDA #$00 0x013166|$04:$B156:85 A3 STA $A3 ; control flow target (from $B189) 0x013168|$04:$B158:C5 AF CMP $AF 0x01316A|$04:$B15A:F0 27 BEQ $B183 0x01316C|$04:$B15C:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x01316F|$04:$B15F:A0 00 LDY #$00 0x013171|$04:$B161:B1 B5 LDA ($B5),Y 0x013173|$04:$B163:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x013176|$04:$B166:A0 01 LDY #$01 0x013178|$04:$B168:84 A4 STY $A4 ; control flow target (from $B181) 0x01317A|$04:$B16A:B1 B5 LDA ($B5),Y 0x01317C|$04:$B16C:C9 08 CMP #$08 0x01317E|$04:$B16E:B0 0B BCS $B17B 0x013180|$04:$B170:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x013183|$04:$B173:20 0F B2 JSR $B20F 0x013186|$04:$B176:20 17 B2 JSR $B217 0x013189|$04:$B179:90 16 BCC $B191 ; control flow target (from $B16E) 0x01318B|$04:$B17B:E6 A4 INC $A4 0x01318D|$04:$B17D:A4 A4 LDY $A4 0x01318F|$04:$B17F:C0 09 CPY #$09 0x013191|$04:$B181:90 E7 BCC $B16A ; control flow target (from $B15A) 0x013193|$04:$B183:E6 A3 INC $A3 0x013195|$04:$B185:A5 A3 LDA $A3 0x013197|$04:$B187:C9 04 CMP #$04 0x013199|$04:$B189:90 CD BCC $B158 0x01319B|$04:$B18B:20 DC B1 JSR $B1DC 0x01319E|$04:$B18E:4C 6E B0 JMP $B06E ; control flow target (from $B179) 0x0131A1|$04:$B191:20 DC B1 JSR $B1DC ; control flow target (from $B12B, $B14E, $B152) 0x0131A4|$04:$B194:A5 AD LDA $AD 0x0131A6|$04:$B196:C9 05 CMP #$05 0x0131A8|$04:$B198:D0 15 BNE $B1AF 0x0131AA|$04:$B19A:A5 B0 LDA $B0 0x0131AC|$04:$B19C:F0 11 BEQ $B1AF 0x0131AE|$04:$B19E:A0 05 LDY #$05 0x0131B0|$04:$B1A0:B1 BB LDA ($BB),Y 0x0131B2|$04:$B1A2:85 A3 STA $A3 0x0131B4|$04:$B1A4:AD 36 06 LDA $0636 ; Midenhall Strength 0x0131B7|$04:$B1A7:4A LSR 0x0131B8|$04:$B1A8:C5 A3 CMP $A3 0x0131BA|$04:$B1AA:B0 03 BCS $B1AF 0x0131BC|$04:$B1AC:4C 6E B0 JMP $B06E ; control flow target (from $B198, $B19C, $B1AA) 0x0131BF|$04:$B1AF:A0 0D LDY #$0D 0x0131C1|$04:$B1B1:B1 BB LDA ($BB),Y 0x0131C3|$04:$B1B3:29 0F AND #$0F 0x0131C5|$04:$B1B5:C9 0E CMP #$0E 0x0131C7|$04:$B1B7:D0 16 BNE $B1CF 0x0131C9|$04:$B1B9:A0 0E LDY #$0E 0x0131CB|$04:$B1BB:B1 BB LDA ($BB),Y 0x0131CD|$04:$B1BD:2A ROL 0x0131CE|$04:$B1BE:90 0F BCC $B1CF 0x0131D0|$04:$B1C0:A0 0A LDY #$0A 0x0131D2|$04:$B1C2:B1 B5 LDA ($B5),Y 0x0131D4|$04:$B1C4:C9 FF CMP #$FF 0x0131D6|$04:$B1C6:D0 07 BNE $B1CF 0x0131D8|$04:$B1C8:20 22 B2 JSR $B222 0x0131DB|$04:$B1CB:A0 0A LDY #$0A 0x0131DD|$04:$B1CD:91 B5 STA ($B5),Y ; control flow target (from $B1B7, $B1BE, $B1C6) 0x0131DF|$04:$B1CF:A5 AD LDA $AD 0x0131E1|$04:$B1D1:C9 1E CMP #$1E 0x0131E3|$04:$B1D3:D0 03 BNE $B1D8 0x0131E5|$04:$B1D5:4C 6E B0 JMP $B06E ; control flow target (from $B075, $B1D3) 0x0131E8|$04:$B1D8:A0 01 LDY #$01 ; Character magic 0x0131EA|$04:$B1DA:91 B7 STA ($B7),Y ; control flow target (from $A85F, $B054, $B18B, $B191) 0x0131EC|$04:$B1DC:A5 AE LDA $AE 0x0131EE|$04:$B1DE:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x0131F1|$04:$B1E1:A0 03 LDY #$03 0x0131F3|$04:$B1E3:B1 B7 LDA ($B7),Y 0x0131F5|$04:$B1E5:85 AF STA $AF 0x0131F7|$04:$B1E7:C9 04 CMP #$04 0x0131F9|$04:$B1E9:90 01 BCC $B1EC 0x0131FB|$04:$B1EB:60 RTS ; control flow target (from $B1E9) 0x0131FC|$04:$B1EC:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x0131FF|$04:$B1EF:A0 00 LDY #$00 0x013201|$04:$B1F1:B1 B5 LDA ($B5),Y 0x013203|$04:$B1F3:4C DC 9E JMP $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure ; control flow target (from $AB3D, $B20F) 0x013206|$04:$B1F6:A0 04 LDY #$04 0x013208|$04:$B1F8:B1 B7 LDA ($B7),Y 0x01320A|$04:$B1FA:85 99 STA $99 0x01320C|$04:$B1FC:C8 INY 0x01320D|$04:$B1FD:B1 B7 LDA ($B7),Y 0x01320F|$04:$B1FF:85 9A STA $9A 0x013211|$04:$B201:A0 00 LDY #$00 0x013213|$04:$B203:B1 BB LDA ($BB),Y 0x013215|$04:$B205:85 9B STA $9B 0x013217|$04:$B207:C8 INY 0x013218|$04:$B208:B1 BB LDA ($BB),Y 0x01321A|$04:$B20A:29 0F AND #$0F 0x01321C|$04:$B20C:85 9C STA $9C 0x01321E|$04:$B20E:60 RTS ; control flow target (from $B0BF, $B143, $B173) 0x01321F|$04:$B20F:20 F6 B1 JSR $B1F6 0x013222|$04:$B212:46 9C LSR $9C 0x013224|$04:$B214:66 9B ROR $9B 0x013226|$04:$B216:60 RTS ; control flow target (from $AB4F, $B0C6, $B146, $B176) 0x013227|$04:$B217:A5 9A LDA $9A 0x013229|$04:$B219:C5 9C CMP $9C 0x01322B|$04:$B21B:D0 04 BNE $B221 0x01322D|$04:$B21D:A5 99 LDA $99 0x01322F|$04:$B21F:C5 9B CMP $9B ; control flow target (from $B21B) 0x013231|$04:$B221:60 RTS ; control flow target (from $A935, $B1C8) 0x013232|$04:$B222:20 D4 B2 JSR $B2D4 0x013235|$04:$B225:A2 00 LDX #$00 0x013237|$04:$B227:86 C5 STX $C5 ; control flow target (from $B23E) 0x013239|$04:$B229:B5 A3 LDA $A3,X 0x01323B|$04:$B22B:C9 03 CMP #$03 0x01323D|$04:$B22D:F0 09 BEQ $B238 0x01323F|$04:$B22F:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x013242|$04:$B232:A0 00 LDY #$00 0x013244|$04:$B234:B1 B9 LDA ($B9),Y 0x013246|$04:$B236:30 08 BMI $B240 ; control flow target (from $B22D) 0x013248|$04:$B238:E6 C5 INC $C5 0x01324A|$04:$B23A:A6 C5 LDX $C5 0x01324C|$04:$B23C:E0 04 CPX #$04 0x01324E|$04:$B23E:90 E9 BCC $B229 ; control flow target (from $B236) 0x013250|$04:$B240:B5 A3 LDA $A3,X 0x013252|$04:$B242:60 RTS ; control flow target (from $AF62, $B0EA, $B0F5, $B105, $B115) 0x013253|$04:$B243:A9 00 LDA #$00 0x013255|$04:$B245:95 A3 STA $A3,X ; control flow target (from $B26A) 0x013257|$04:$B247:A8 TAY 0x013258|$04:$B248:B9 2D 06 LDA $062D,Y ; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence) 0x01325B|$04:$B24B:E0 02 CPX #$02 0x01325D|$04:$B24D:90 09 BCC $B258 0x01325F|$04:$B24F:E0 03 CPX #$03 0x013261|$04:$B251:F0 01 BEQ $B254 0x013263|$04:$B253:4A LSR ; control flow target (from $B251) 0x013264|$04:$B254:4A LSR 0x013265|$04:$B255:4C 5E B2 JMP $B25E ; control flow target (from $B24D) 0x013268|$04:$B258:E0 00 CPX #$00 0x01326A|$04:$B25A:F0 01 BEQ $B25D 0x01326C|$04:$B25C:0A ASL ; control flow target (from $B25A) 0x01326D|$04:$B25D:0A ASL ; control flow target (from $B255) 0x01326E|$04:$B25E:A9 00 LDA #$00 0x013270|$04:$B260:75 A3 ADC $A3,X 0x013272|$04:$B262:95 A3 STA $A3,X 0x013274|$04:$B264:98 TYA 0x013275|$04:$B265:18 CLC 0x013276|$04:$B266:69 12 ADC #$12 0x013278|$04:$B268:C9 25 CMP #$25 0x01327A|$04:$B26A:90 DB BCC $B247 0x01327C|$04:$B26C:60 RTS ; control flow target (from $ADC4, $B126) 0x01327D|$04:$B26D:A0 FE LDY #$FE 0x01327F|$04:$B26F:84 95 STY $95 ; ID for [item] and [spell] control codes ; control flow target (from $B2BB) 0x013281|$04:$B271:85 C8 STA $C8 0x013283|$04:$B273:20 D2 9E JSR $9ED2 ; given an index (in A) into the array of structures at $0663, set $BF-$C0 to the address of the corresponding item inside that structure 0x013286|$04:$B276:A9 00 LDA #$00 0x013288|$04:$B278:85 C7 STA $C7 ; control flow target (from $B28B) 0x01328A|$04:$B27A:20 CD 9E JSR $9ECD ; given an index (in A) into the array of structures at $068F, set $C1-$C2 to the address of the corresponding item inside that structure 0x01328D|$04:$B27D:A0 03 LDY #$03 0x01328F|$04:$B27F:B1 C1 LDA ($C1),Y 0x013291|$04:$B281:C9 FF CMP #$FF 0x013293|$04:$B283:F0 09 BEQ $B28E 0x013295|$04:$B285:E6 C7 INC $C7 0x013297|$04:$B287:A5 C7 LDA $C7 0x013299|$04:$B289:C9 08 CMP #$08 0x01329B|$04:$B28B:90 ED BCC $B27A 0x01329D|$04:$B28D:60 RTS ; control flow target (from $B283) 0x01329E|$04:$B28E:A0 01 LDY #$01 ; control flow target (from $B2AB) 0x0132A0|$04:$B290:B1 BF LDA ($BF),Y 0x0132A2|$04:$B292:C9 08 CMP #$08 0x0132A4|$04:$B294:90 12 BCC $B2A8 0x0132A6|$04:$B296:C5 95 CMP $95 ; ID for [item] and [spell] control codes 0x0132A8|$04:$B298:F0 0E BEQ $B2A8 0x0132AA|$04:$B29A:84 C5 STY $C5 0x0132AC|$04:$B29C:A6 C8 LDX $C8 0x0132AE|$04:$B29E:20 09 8B JSR $8B09 0x0132B1|$04:$B2A1:08 PHP 0x0132B2|$04:$B2A2:A4 C5 LDY $C5 0x0132B4|$04:$B2A4:A5 C7 LDA $C7 0x0132B6|$04:$B2A6:28 PLP 0x0132B7|$04:$B2A7:60 RTS ; control flow target (from $B294, $B298) 0x0132B8|$04:$B2A8:C8 INY 0x0132B9|$04:$B2A9:C0 09 CPY #$09 0x0132BB|$04:$B2AB:90 E3 BCC $B290 0x0132BD|$04:$B2AD:60 RTS ; control flow target (from $ABD3, $B135) 0x0132BE|$04:$B2AE:20 D4 B2 JSR $B2D4 0x0132C1|$04:$B2B1:A0 FF LDY #$FF 0x0132C3|$04:$B2B3:85 95 STA $95 ; ID for [item] and [spell] control codes 0x0132C5|$04:$B2B5:A2 00 LDX #$00 0x0132C7|$04:$B2B7:86 C6 STX $C6 ; control flow target (from $B2D1) 0x0132C9|$04:$B2B9:B5 A3 LDA $A3,X 0x0132CB|$04:$B2BB:20 71 B2 JSR $B271 0x0132CE|$04:$B2BE:8D E9 06 STA $06E9 0x0132D1|$04:$B2C1:B0 08 BCS $B2CB 0x0132D3|$04:$B2C3:A6 C6 LDX $C6 0x0132D5|$04:$B2C5:B5 A3 LDA $A3,X 0x0132D7|$04:$B2C7:AE E9 06 LDX $06E9 0x0132DA|$04:$B2CA:60 RTS ; control flow target (from $B2C1) 0x0132DB|$04:$B2CB:E6 C6 INC $C6 0x0132DD|$04:$B2CD:A6 C6 LDX $C6 0x0132DF|$04:$B2CF:E0 04 CPX #$04 0x0132E1|$04:$B2D1:90 E6 BCC $B2B9 0x0132E3|$04:$B2D3:60 RTS ; control flow target (from $B222, $B2AE) 0x0132E4|$04:$B2D4:A9 FF LDA #$FF 0x0132E6|$04:$B2D6:A2 03 LDX #$03 ; control flow target (from $B2DB) 0x0132E8|$04:$B2D8:95 A3 STA $A3,X 0x0132EA|$04:$B2DA:CA DEX 0x0132EB|$04:$B2DB:10 FB BPL $B2D8 0x0132ED|$04:$B2DD:A0 04 LDY #$04 ; control flow target (from $B2F3) 0x0132EF|$04:$B2DF:98 TYA 0x0132F0|$04:$B2E0:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x0132F3|$04:$B2E3:E6 99 INC $99 0x0132F5|$04:$B2E5:A2 FF LDX #$FF ; control flow target (from $B2EA, $B2EE) 0x0132F7|$04:$B2E7:E8 INX 0x0132F8|$04:$B2E8:B5 A3 LDA $A3,X 0x0132FA|$04:$B2EA:10 FB BPL $B2E7 0x0132FC|$04:$B2EC:C6 99 DEC $99 0x0132FE|$04:$B2EE:D0 F7 BNE $B2E7 0x013300|$04:$B2F0:88 DEY 0x013301|$04:$B2F1:94 A3 STY $A3,X 0x013303|$04:$B2F3:D0 EA BNE $B2DF 0x013305|$04:$B2F5:60 RTS ; code -> data ; Attack % for Enemy Specials ; indirect data load target (via $9F29) 0x013306|$04:$B2F6:1F 3F 5F 7F 9F BF DF ; Attack % #1 0x01330D|$04:$B2FD:25 4C 6D 8F AD CB E5 ; Attack % #2 0x013314|$04:$B304:2D 57 7D 9F BD D7 ED ; Attack % #3 0x01331B|$04:$B30B:63 95 B1 C9 DC EB F7 ; Attack % #4 ; data -> code ; control flow target (from $9588) 0x013322|$04:$B312:A9 00 LDA #$00 0x013324|$04:$B314:85 A8 STA $A8 ; control flow target (from $B36D, $B382, $B4F4) 0x013326|$04:$B316:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x013329|$04:$B319:A0 00 LDY #$00 0x01332B|$04:$B31B:B1 B9 LDA ($B9),Y 0x01332D|$04:$B31D:29 C0 AND #$C0 0x01332F|$04:$B31F:C9 80 CMP #$80 0x013331|$04:$B321:F0 09 BEQ $B32C 0x013333|$04:$B323:A0 02 LDY #$02 0x013335|$04:$B325:A9 46 LDA #$46 0x013337|$04:$B327:91 B9 STA ($B9),Y 0x013339|$04:$B329:4C EC B4 JMP $B4EC ; control flow target (from $B321, $B39E, $B3C5, $B486, $B49E) 0x01333C|$04:$B32C:20 C7 9A JSR $9AC7 0x01333F|$04:$B32F:A9 FF LDA #$FF 0x013341|$04:$B331:20 78 B5 JSR $B578 0x013344|$04:$B334:A5 A8 LDA $A8 0x013346|$04:$B336:85 AA STA $AA 0x013348|$04:$B338:F0 1A BEQ $B354 0x01334A|$04:$B33A:A9 00 LDA #$00 0x01334C|$04:$B33C:20 EB B5 JSR $B5EB 0x01334F|$04:$B33F:F0 0D BEQ $B34E 0x013351|$04:$B341:A5 A8 LDA $A8 0x013353|$04:$B343:C9 01 CMP #$01 0x013355|$04:$B345:F0 0B BEQ $B352 0x013357|$04:$B347:A9 01 LDA #$01 0x013359|$04:$B349:20 EB B5 JSR $B5EB 0x01335C|$04:$B34C:D0 04 BNE $B352 ; control flow target (from $B33F) 0x01335E|$04:$B34E:A9 01 LDA #$01 0x013360|$04:$B350:D0 02 BNE $B354 ; control flow target (from $B345, $B34C) 0x013362|$04:$B352:A9 02 LDA #$02 ; control flow target (from $B338, $B350) 0x013364|$04:$B354:20 37 B5 JSR $B537 0x013367|$04:$B357:C9 02 CMP #$02 0x013369|$04:$B359:F0 3A BEQ $B395 0x01336B|$04:$B35B:C9 03 CMP #$03 0x01336D|$04:$B35D:F0 30 BEQ $B38F 0x01336F|$04:$B35F:C9 04 CMP #$04 0x013371|$04:$B361:F0 47 BEQ $B3AA 0x013373|$04:$B363:C9 05 CMP #$05 0x013375|$04:$B365:F0 1E BEQ $B385 0x013377|$04:$B367:C9 06 CMP #$06 0x013379|$04:$B369:F0 1D BEQ $B388 0x01337B|$04:$B36B:A5 A8 LDA $A8 0x01337D|$04:$B36D:F0 A7 BEQ $B316 0x01337F|$04:$B36F:C9 02 CMP #$02 0x013381|$04:$B371:F0 02 BEQ $B375 0x013383|$04:$B373:D0 09 BNE $B37E ; control flow target (from $B371) 0x013385|$04:$B375:A9 01 LDA #$01 0x013387|$04:$B377:20 EB B5 JSR $B5EB 0x01338A|$04:$B37A:F0 02 BEQ $B37E 0x01338C|$04:$B37C:C6 A8 DEC $A8 ; control flow target (from $B373, $B37A) 0x01338E|$04:$B37E:C6 A8 DEC $A8 0x013390|$04:$B380:A5 A8 LDA $A8 0x013392|$04:$B382:4C 16 B3 JMP $B316 ; control flow target (from $B365) 0x013395|$04:$B385:4C 72 B4 JMP $B472 ; control flow target (from $B369) 0x013398|$04:$B388:A9 3C LDA #$3C 0x01339A|$04:$B38A:85 A9 STA $A9 0x01339C|$04:$B38C:4C E0 B4 JMP $B4E0 ; control flow target (from $B35D) 0x01339F|$04:$B38F:20 A0 9A JSR $9AA0 0x0133A2|$04:$B392:4C B4 9A JMP $9AB4 ; control flow target (from $B359) 0x0133A5|$04:$B395:A9 00 LDA #$00 0x0133A7|$04:$B397:20 78 B5 JSR $B578 0x0133AA|$04:$B39A:C9 04 CMP #$04 0x0133AC|$04:$B39C:90 03 BCC $B3A1 ; control flow target (from $B3B4) 0x0133AE|$04:$B39E:4C 2C B3 JMP $B32C ; control flow target (from $B39C) 0x0133B1|$04:$B3A1:85 AA STA $AA 0x0133B3|$04:$B3A3:A9 00 LDA #$00 0x0133B5|$04:$B3A5:85 A9 STA $A9 0x0133B7|$04:$B3A7:4C E0 B4 JMP $B4E0 ; control flow target (from $B361, $B414, $B425) 0x0133BA|$04:$B3AA:A5 A8 LDA $A8 0x0133BC|$04:$B3AC:A8 TAY 0x0133BD|$04:$B3AD:88 DEY 0x0133BE|$04:$B3AE:98 TYA 0x0133BF|$04:$B3AF:20 D2 B5 JSR $B5D2 0x0133C2|$04:$B3B2:C9 FF CMP #$FF 0x0133C4|$04:$B3B4:F0 E8 BEQ $B39E 0x0133C6|$04:$B3B6:C9 FE CMP #$FE 0x0133C8|$04:$B3B8:D0 0E BNE $B3C8 0x0133CA|$04:$B3BA:20 B4 9A JSR $9AB4 0x0133CD|$04:$B3BD:A9 45 LDA #$45 ; String ID #$0045: cannot use the spell yet.[end-FC] ; control flow target (from $B3F2) 0x0133CF|$04:$B3BF:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x0133D2|$04:$B3C2:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise 0x0133D5|$04:$B3C5:4C 2C B3 JMP $B32C ; control flow target (from $B3B8) 0x0133D8|$04:$B3C8:AA TAX 0x0133D9|$04:$B3C9:86 C8 STX $C8 0x0133DB|$04:$B3CB:A5 A8 LDA $A8 0x0133DD|$04:$B3CD:85 9C STA $9C 0x0133DF|$04:$B3CF:A9 61 LDA #$61 ; call to code in a different bank ($0F:$C4B0) 0x0133E1|$04:$B3D1:20 B0 C4 JSR $C4B0 ; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise 0x0133E4|$04:$B3D4:90 05 BCC $B3DB 0x0133E6|$04:$B3D6:8A TXA 0x0133E7|$04:$B3D7:18 CLC 0x0133E8|$04:$B3D8:69 0F ADC #$0F 0x0133EA|$04:$B3DA:AA TAX ; control flow target (from $B3D4) 0x0133EB|$04:$B3DB:BD F9 B4 LDA $B4F9,X 0x0133EE|$04:$B3DE:85 C7 STA $C7 0x0133F0|$04:$B3E0:A5 A8 LDA $A8 0x0133F2|$04:$B3E2:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x0133F5|$04:$B3E5:A0 10 LDY #$10 0x0133F7|$04:$B3E7:B1 C3 LDA ($C3),Y 0x0133F9|$04:$B3E9:C5 C7 CMP $C7 0x0133FB|$04:$B3EB:B0 07 BCS $B3F4 0x0133FD|$04:$B3ED:20 B4 9A JSR $9AB4 0x013400|$04:$B3F0:A9 11 LDA #$11 ; String ID #$0011: Thy MP is low.[end-FC] 0x013402|$04:$B3F2:D0 CB BNE $B3BF ; control flow target (from $B3EB) 0x013404|$04:$B3F4:A6 C8 LDX $C8 0x013406|$04:$B3F6:BD 17 B5 LDA $B517,X 0x013409|$04:$B3F9:F0 09 BEQ $B404 0x01340B|$04:$B3FB:C9 02 CMP #$02 0x01340D|$04:$B3FD:90 0A BCC $B409 0x01340F|$04:$B3FF:F0 1B BEQ $B41C 0x013411|$04:$B401:4C 2D B4 JMP $B42D ; control flow target (from $B3F9) 0x013414|$04:$B404:86 A9 STX $A9 0x013416|$04:$B406:4C E0 B4 JMP $B4E0 ; control flow target (from $B3FD) 0x013419|$04:$B409:86 A9 STX $A9 0x01341B|$04:$B40B:A9 00 LDA #$00 0x01341D|$04:$B40D:20 78 B5 JSR $B578 0x013420|$04:$B410:C9 FF CMP #$FF 0x013422|$04:$B412:D0 03 BNE $B417 0x013424|$04:$B414:4C AA B3 JMP $B3AA ; control flow target (from $B412) 0x013427|$04:$B417:85 AA STA $AA 0x013429|$04:$B419:4C E0 B4 JMP $B4E0 ; control flow target (from $B3FF) 0x01342C|$04:$B41C:86 A9 STX $A9 0x01342E|$04:$B41E:20 E4 B5 JSR $B5E4 0x013431|$04:$B421:C9 FF CMP #$FF 0x013433|$04:$B423:D0 03 BNE $B428 0x013435|$04:$B425:4C AA B3 JMP $B3AA ; control flow target (from $B423) 0x013438|$04:$B428:85 AA STA $AA 0x01343A|$04:$B42A:4C E0 B4 JMP $B4E0 ; control flow target (from $B401) 0x01343D|$04:$B42D:A9 32 LDA #$32 0x01343F|$04:$B42F:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x013442|$04:$B432:F0 0D BEQ $B441 ; control flow target (from $B45E) 0x013444|$04:$B434:A9 07 LDA #$07 0x013446|$04:$B436:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x013449|$04:$B439:18 CLC 0x01344A|$04:$B43A:69 0F ADC #$0F 0x01344C|$04:$B43C:85 A9 STA $A9 0x01344E|$04:$B43E:4C E0 B4 JMP $B4E0 ; control flow target (from $B432) 0x013451|$04:$B441:A9 02 LDA #$02 0x013453|$04:$B443:20 20 A0 JSR $A020 ; generate a random number between $03 and A in A and $99 0x013456|$04:$B446:85 A9 STA $A9 0x013458|$04:$B448:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x01345B|$04:$B44B:A0 00 LDY #$00 0x01345D|$04:$B44D:B1 C3 LDA ($C3),Y 0x01345F|$04:$B44F:10 0F BPL $B460 0x013461|$04:$B451:A5 A9 LDA $A9 0x013463|$04:$B453:49 01 EOR #$01 0x013465|$04:$B455:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x013468|$04:$B458:A0 00 LDY #$00 0x01346A|$04:$B45A:B1 C3 LDA ($C3),Y 0x01346C|$04:$B45C:10 0D BPL $B46B 0x01346E|$04:$B45E:30 D4 BMI $B434 ; control flow target (from $B44F) 0x013470|$04:$B460:A5 A9 LDA $A9 ; control flow target (from $B46F) 0x013472|$04:$B462:85 AA STA $AA 0x013474|$04:$B464:A9 16 LDA #$16 0x013476|$04:$B466:85 A9 STA $A9 0x013478|$04:$B468:4C E0 B4 JMP $B4E0 ; control flow target (from $B45C) 0x01347B|$04:$B46B:A5 A9 LDA $A9 0x01347D|$04:$B46D:49 01 EOR #$01 0x01347F|$04:$B46F:4C 62 B4 JMP $B462 ; control flow target (from $B385, $B4CE, $B4DC) 0x013482|$04:$B472:A5 A8 LDA $A8 0x013484|$04:$B474:8D 4C 61 STA $614C 0x013487|$04:$B477:20 DB B5 JSR $B5DB 0x01348A|$04:$B47A:48 PHA 0x01348B|$04:$B47B:A4 A8 LDY $A8 0x01348D|$04:$B47D:8A TXA 0x01348E|$04:$B47E:99 D2 06 STA $06D2,Y 0x013491|$04:$B481:68 PLA 0x013492|$04:$B482:C9 FF CMP #$FF 0x013494|$04:$B484:D0 03 BNE $B489 0x013496|$04:$B486:4C 2C B3 JMP $B32C ; control flow target (from $B484) 0x013499|$04:$B489:C9 FE CMP #$FE 0x01349B|$04:$B48B:D0 14 BNE $B4A1 0x01349D|$04:$B48D:20 B4 9A JSR $9AB4 0x0134A0|$04:$B490:AD 4C 61 LDA $614C 0x0134A3|$04:$B493:20 D0 9C JSR $9CD0 ; print name of hero given by low 2 bits of A to $6119, terminated by #$FA 0x0134A6|$04:$B496:A9 46 LDA #$46 ; String ID #$0046: [name] doesn't have any tools.[end-FC] 0x0134A8|$04:$B498:20 CA 9C JSR $9CCA ; for A < #$60, display string ID specified by A; for A >= #$60, display string ID specified by A + #$A0 0x0134AB|$04:$B49B:20 3C 9A JSR $9A3C ; set number of NMIs to wait for to current battle message delay * 1.5 if current battle message delay is < #$80, #$64 otherwise 0x0134AE|$04:$B49E:4C 2C B3 JMP $B32C ; control flow target (from $B48B) 0x0134B1|$04:$B4A1:85 A9 STA $A9 0x0134B3|$04:$B4A3:A2 00 LDX #$00 ; control flow target (from $B4AF) 0x0134B5|$04:$B4A5:BD 27 B5 LDA $B527,X ; Items usable in battle 0x0134B8|$04:$B4A8:C5 A9 CMP $A9 0x0134BA|$04:$B4AA:F0 0E BEQ $B4BA 0x0134BC|$04:$B4AC:E8 INX 0x0134BD|$04:$B4AD:E0 08 CPX #$08 0x0134BF|$04:$B4AF:90 F4 BCC $B4A5 0x0134C1|$04:$B4B1:A5 A9 LDA $A9 0x0134C3|$04:$B4B3:09 80 ORA #$80 0x0134C5|$04:$B4B5:85 A9 STA $A9 0x0134C7|$04:$B4B7:4C E0 B4 JMP $B4E0 ; control flow target (from $B4AA) 0x0134CA|$04:$B4BA:8A TXA 0x0134CB|$04:$B4BB:18 CLC 0x0134CC|$04:$B4BC:69 17 ADC #$17 0x0134CE|$04:$B4BE:85 A9 STA $A9 0x0134D0|$04:$B4C0:BD 2F B5 LDA $B52F,X ; Base Target for Battle Items - (00: Open Cast) (01: Select Enemy) (02: Select Ally) 0x0134D3|$04:$B4C3:F0 1B BEQ $B4E0 0x0134D5|$04:$B4C5:C9 02 CMP #$02 0x0134D7|$04:$B4C7:90 0C BCC $B4D5 0x0134D9|$04:$B4C9:20 E4 B5 JSR $B5E4 0x0134DC|$04:$B4CC:C9 FF CMP #$FF 0x0134DE|$04:$B4CE:F0 A2 BEQ $B472 0x0134E0|$04:$B4D0:85 AA STA $AA 0x0134E2|$04:$B4D2:4C E0 B4 JMP $B4E0 ; control flow target (from $B4C7) 0x0134E5|$04:$B4D5:A9 00 LDA #$00 0x0134E7|$04:$B4D7:20 78 B5 JSR $B578 0x0134EA|$04:$B4DA:C9 FF CMP #$FF 0x0134EC|$04:$B4DC:F0 94 BEQ $B472 0x0134EE|$04:$B4DE:85 AA STA $AA ; control flow target (from $B38C, $B3A7, $B406, $B419, $B42A, $B43E, $B468, $B4B7, $B4C3, $B4D2) 0x0134F0|$04:$B4E0:A0 02 LDY #$02 0x0134F2|$04:$B4E2:A5 A9 LDA $A9 0x0134F4|$04:$B4E4:91 B9 STA ($B9),Y 0x0134F6|$04:$B4E6:A0 01 LDY #$01 0x0134F8|$04:$B4E8:A5 AA LDA $AA 0x0134FA|$04:$B4EA:91 B9 STA ($B9),Y ; control flow target (from $B329) 0x0134FC|$04:$B4EC:E6 A8 INC $A8 0x0134FE|$04:$B4EE:A5 A8 LDA $A8 0x013500|$04:$B4F0:C9 03 CMP #$03 0x013502|$04:$B4F2:B0 03 BCS $B4F7 0x013504|$04:$B4F4:4C 16 B3 JMP $B316 ; control flow target (from $B4F2) 0x013507|$04:$B4F7:4C B4 ; indexed data load target (from $A1BE, $B3DB) 0x013509|$04:$B4F9: 9A JMP $9AB4 ; code -> data ; MP Cost in Battle (normal) 0x01350A|$04:$B4FA:02 ; Spell ID #$01: Firebal 0x01350B|$04:$B4FB:02 ; Spell ID #$02: Sleep 0x01350C|$04:$B4FC:04 ; Spell ID #$03: Firebane 0x01350D|$04:$B4FD:04 ; Spell ID #$04: Defeat 0x01350E|$04:$B4FE:04 ; Spell ID #$05: Infernos 0x01350F|$04:$B4FF:03 ; Spell ID #$06: Stopspell 0x013510|$04:$B500:02 ; Spell ID #$07: Surround 0x013511|$04:$B501:02 ; Spell ID #$08: Defence 0x013512|$04:$B502:03 ; Spell ID #$09: Heal 0x013513|$04:$B503:02 ; Spell ID #$0A: Increase 0x013514|$04:$B504:05 ; Spell ID #$0B: Healmore 0x013515|$04:$B505:01 ; Spell ID #$0C: Sacrifice 0x013516|$04:$B506:08 ; Spell ID #$0D: Healall 0x013517|$04:$B507:08 ; Spell ID #$0E: Explodet 0x013518|$04:$B508:0F ; Spell ID #$0F: Chance ; MP Cost in Battle (with Mysterious Hat) 0x013519|$04:$B509:01 ; Spell ID #$01: Firebal 0x01351A|$04:$B50A:01 ; Spell ID #$02: Sleep 0x01351B|$04:$B50B:03 ; Spell ID #$03: Firebane 0x01351C|$04:$B50C:03 ; Spell ID #$04: Defeat 0x01351D|$04:$B50D:03 ; Spell ID #$05: Infernos 0x01351E|$04:$B50E:02 ; Spell ID #$06: Stopspell 0x01351F|$04:$B50F:01 ; Spell ID #$07: Surround 0x013520|$04:$B510:01 ; Spell ID #$08: Defence 0x013521|$04:$B511:02 ; Spell ID #$09: Heal 0x013522|$04:$B512:01 ; Spell ID #$0A: Increase 0x013523|$04:$B513:04 ; Spell ID #$0B: Healmore 0x013524|$04:$B514:01 ; Spell ID #$0C: Sacrifice 0x013525|$04:$B515:06 ; Spell ID #$0D: Healall 0x013526|$04:$B516:06 ; Spell ID #$0E: Explodet ; indexed data load target (from $B3F6) 0x013527|$04:$B517:0C ; Spell ID #$0F: Chance ; Base Target for Spells - (00: Open Cast) (01: Select Enemy) (02: Select Ally) 0x013528|$04:$B518:01 ; Spell ID #$01: Firebal 0x013529|$04:$B519:01 ; Spell ID #$02: Sleep 0x01352A|$04:$B51A:00 ; Spell ID #$03: Firebane 0x01352B|$04:$B51B:01 ; Spell ID #$04: Defeat 0x01352C|$04:$B51C:01 ; Spell ID #$05: Infernos 0x01352D|$04:$B51D:01 ; Spell ID #$06: Stopspell 0x01352E|$04:$B51E:01 ; Spell ID #$07: Surround 0x01352F|$04:$B51F:00 ; Spell ID #$08: Defence 0x013530|$04:$B520:02 ; Spell ID #$09: Heal 0x013531|$04:$B521:00 ; Spell ID #$0A: Increase 0x013532|$04:$B522:02 ; Spell ID #$0B: Healmore 0x013533|$04:$B523:00 ; Spell ID #$0C: Sacrifice 0x013534|$04:$B524:02 ; Spell ID #$0D: Healall 0x013535|$04:$B525:00 ; Spell ID #$0E: Explodet 0x013536|$04:$B526:03 ; Spell ID #$0F: Chance ; Items usable in battle ; indexed data load target (from $B4A5) 0x013537|$04:$B527:03 ; Item ID #$03: Wizard’s Wand 0x013538|$04:$B528:04 ; Item ID #$04: Staff of Thunder 0x013539|$04:$B529:10 ; Item ID #$10: Thunder Sword 0x01353A|$04:$B52A:0E ; Item ID #$0E: Light Sword 0x01353B|$04:$B52B:1D ; Item ID #$1D: Shield of Strength 0x01353C|$04:$B52C:3C ; Item ID #$3C: Medical Herb 0x01353D|$04:$B52D:3B ; Item ID #$3B: Antidote Herb 0x01353E|$04:$B52E:3D ; Item ID #$3D: Wizard’s Ring ; Base Target for Battle Items - (00: Open Cast) (01: Select Enemy) (02: Select Ally) ; indexed data load target (from $B4C0) 0x01353F|$04:$B52F:01 ; Item ID #$03: Wizard’s Wand 0x013540|$04:$B530:01 ; Item ID #$04: Staff of Thunder 0x013541|$04:$B531:01 ; Item ID #$10: Thunder Sword 0x013542|$04:$B532:00 ; Item ID #$0E: Light Sword 0x013543|$04:$B533:00 ; Item ID #$1D: Shield of Strength 0x013544|$04:$B534:02 ; Item ID #$3C: Medical Herb 0x013545|$04:$B535:02 ; Item ID #$3B: Antidote Herb 0x013546|$04:$B536:00 ; Item ID #$3D: Wizard’s Ring ; data -> code ; control flow target (from $B354) 0x013547|$04:$B537:85 99 STA $99 0x013549|$04:$B539:A2 00 LDX #$00 0x01354B|$04:$B53B:A9 01 LDA #$01 0x01354D|$04:$B53D:95 5A STA $5A,X ; Crest/direction name write buffer start 0x01354F|$04:$B53F:E8 INX 0x013550|$04:$B540:A9 02 LDA #$02 0x013552|$04:$B542:95 5A STA $5A,X ; Crest/direction name write buffer start 0x013554|$04:$B544:E8 INX 0x013555|$04:$B545:A5 99 LDA $99 0x013557|$04:$B547:C9 01 CMP #$01 0x013559|$04:$B549:A9 03 LDA #$03 0x01355B|$04:$B54B:90 02 BCC $B54F 0x01355D|$04:$B54D:A9 04 LDA #$04 ; control flow target (from $B54B) 0x01355F|$04:$B54F:95 5A STA $5A,X ; Crest/direction name write buffer start 0x013561|$04:$B551:E8 INX 0x013562|$04:$B552:A5 99 LDA $99 0x013564|$04:$B554:C9 02 CMP #$02 0x013566|$04:$B556:A9 06 LDA #$06 0x013568|$04:$B558:90 02 BCC $B55C 0x01356A|$04:$B55A:A9 03 LDA #$03 ; control flow target (from $B558) 0x01356C|$04:$B55C:95 5A STA $5A,X ; Crest/direction name write buffer start 0x01356E|$04:$B55E:E8 INX 0x01356F|$04:$B55F:A9 05 LDA #$05 0x013571|$04:$B561:95 5A STA $5A,X ; Crest/direction name write buffer start 0x013573|$04:$B563:E8 INX 0x013574|$04:$B564:A9 FF LDA #$FF 0x013576|$04:$B566:95 5A STA $5A,X ; Crest/direction name write buffer start 0x013578|$04:$B568:A9 04 LDA #$04 0x01357A|$04:$B56A:85 94 STA $94 ; return bank for various function calls, doubles as index of selected option for multiple-choice menus 0x01357C|$04:$B56C:A5 A8 LDA $A8 ; call to code in a different bank ($0F:$F4EF) 0x01357E|$04:$B56E:20 EF F4 JSR $F4EF ; open battle command menu for hero A 0x013581|$04:$B571:AA TAX 0x013582|$04:$B572:E8 INX 0x013583|$04:$B573:F0 02 BEQ $B577 0x013585|$04:$B575:B5 5A LDA $5A,X ; Crest/direction name write buffer start ; control flow target (from $B573) 0x013587|$04:$B577:60 RTS ; control flow target (from $B331, $B397, $B40D, $B4D7) 0x013588|$04:$B578:85 4B STA $4B ; flag for whether to display the selectable or non-selectable monster list 0x01358A|$04:$B57A:A2 00 LDX #$00 0x01358C|$04:$B57C:8A TXA 0x01358D|$04:$B57D:85 A7 STA $A7 ; control flow target (from $B59A) 0x01358F|$04:$B57F:20 D2 9E JSR $9ED2 ; given an index (in A) into the array of structures at $0663, set $BF-$C0 to the address of the corresponding item inside that structure 0x013592|$04:$B582:A0 09 LDY #$09 0x013594|$04:$B584:B1 BF LDA ($BF),Y 0x013596|$04:$B586:F0 0C BEQ $B594 0x013598|$04:$B588:9D 1D 06 STA $061D,X ; monster group 1 monster count 0x01359B|$04:$B58B:A0 00 LDY #$00 0x01359D|$04:$B58D:B1 BF LDA ($BF),Y 0x01359F|$04:$B58F:9D 1C 06 STA $061C,X ; monster group 1 monster ID 0x0135A2|$04:$B592:E8 INX 0x0135A3|$04:$B593:E8 INX ; control flow target (from $B586) 0x0135A4|$04:$B594:E6 A7 INC $A7 0x0135A6|$04:$B596:A5 A7 LDA $A7 0x0135A8|$04:$B598:C9 04 CMP #$04 0x0135AA|$04:$B59A:90 E3 BCC $B57F 0x0135AC|$04:$B59C:E0 08 CPX #$08 0x0135AE|$04:$B59E:B0 05 BCS $B5A5 0x0135B0|$04:$B5A0:A9 00 LDA #$00 0x0135B2|$04:$B5A2:9D 1C 06 STA $061C,X ; monster group 1 monster ID ; control flow target (from $B59E) 0x0135B5|$04:$B5A5:A9 04 LDA #$04 0x0135B7|$04:$B5A7:85 94 STA $94 ; return bank for various function calls, doubles as index of selected option for multiple-choice menus ; call to code in a different bank ($0F:$F51B) 0x0135B9|$04:$B5A9:20 1B F5 JSR $F51B ; display appropriate battle menu monster list 0x0135BC|$04:$B5AC:A4 4B LDY $4B ; flag for whether to display the selectable or non-selectable monster list 0x0135BE|$04:$B5AE:F0 01 BEQ $B5B1 0x0135C0|$04:$B5B0:60 RTS ; control flow target (from $B5AE) 0x0135C1|$04:$B5B1:C9 FF CMP #$FF 0x0135C3|$04:$B5B3:F0 1C BEQ $B5D1 0x0135C5|$04:$B5B5:AA TAX 0x0135C6|$04:$B5B6:E8 INX 0x0135C7|$04:$B5B7:A9 00 LDA #$00 0x0135C9|$04:$B5B9:85 A7 STA $A7 ; control flow target (from $B5CD) 0x0135CB|$04:$B5BB:20 D2 9E JSR $9ED2 ; given an index (in A) into the array of structures at $0663, set $BF-$C0 to the address of the corresponding item inside that structure 0x0135CE|$04:$B5BE:A0 09 LDY #$09 0x0135D0|$04:$B5C0:B1 BF LDA ($BF),Y 0x0135D2|$04:$B5C2:F0 03 BEQ $B5C7 0x0135D4|$04:$B5C4:CA DEX 0x0135D5|$04:$B5C5:F0 08 BEQ $B5CF ; control flow target (from $B5C2) 0x0135D7|$04:$B5C7:E6 A7 INC $A7 0x0135D9|$04:$B5C9:A5 A7 LDA $A7 0x0135DB|$04:$B5CB:C9 04 CMP #$04 0x0135DD|$04:$B5CD:90 EC BCC $B5BB ; control flow target (from $B5C5) 0x0135DF|$04:$B5CF:A5 A7 LDA $A7 ; control flow target (from $B5B3) 0x0135E1|$04:$B5D1:60 RTS ; control flow target (from $B3AF) 0x0135E2|$04:$B5D2:48 PHA 0x0135E3|$04:$B5D3:A9 04 LDA #$04 0x0135E5|$04:$B5D5:85 94 STA $94 ; return bank for various function calls, doubles as index of selected option for multiple-choice menus 0x0135E7|$04:$B5D7:68 PLA ; call to code in a different bank ($0F:$F49E) 0x0135E8|$04:$B5D8:4C 9E F4 JMP $F49E ; control flow target (from $B477) 0x0135EB|$04:$B5DB:48 PHA 0x0135EC|$04:$B5DC:A9 04 LDA #$04 0x0135EE|$04:$B5DE:85 94 STA $94 ; return bank for various function calls, doubles as index of selected option for multiple-choice menus 0x0135F0|$04:$B5E0:68 PLA ; call to code in a different bank ($0F:$F4B0) 0x0135F1|$04:$B5E1:4C B0 F4 JMP $F4B0 ; given hero ID in A, display that hero's battle item list window and return the selected item ID in A ; control flow target (from $B41E, $B4C9) 0x0135F4|$04:$B5E4:A9 04 LDA #$04 0x0135F6|$04:$B5E6:85 94 STA $94 ; return bank for various function calls, doubles as index of selected option for multiple-choice menus ; call to code in a different bank ($0F:$F529) 0x0135F8|$04:$B5E8:4C 29 F5 JMP $F529 ; display appropriate battle menu item/spell target ; control flow target (from $B33C, $B349, $B377) 0x0135FB|$04:$B5EB:20 C8 9E JSR $9EC8 ; given an index (in A) into the array of hero data structures at $062D, set $C3-$C4 to the address of the corresponding item inside that structure 0x0135FE|$04:$B5EE:A0 00 LDY #$00 0x013600|$04:$B5F0:B1 C3 LDA ($C3),Y 0x013602|$04:$B5F2:29 C0 AND #$C0 0x013604|$04:$B5F4:C9 80 CMP #$80 0x013606|$04:$B5F6:60 RTS ; control flow target (from $94D8) 0x013607|$04:$B5F7:A2 00 LDX #$00 0x013609|$04:$B5F9:A9 FF LDA #$FF 0x01360B|$04:$B5FB:8D FE 05 STA $05FE ; number of monsters in current group killed by last attack? ; control flow target (from $B604) 0x01360E|$04:$B5FE:9D 62 01 STA $0162,X 0x013611|$04:$B601:E8 INX 0x013612|$04:$B602:E0 14 CPX #$14 0x013614|$04:$B604:90 F8 BCC $B5FE 0x013616|$04:$B606:A9 00 LDA #$00 0x013618|$04:$B608:85 A7 STA $A7 0x01361A|$04:$B60A:85 A9 STA $A9 ; control flow target (from $B669) 0x01361C|$04:$B60C:A5 A9 LDA $A9 0x01361E|$04:$B60E:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x013621|$04:$B611:A0 00 LDY #$00 0x013623|$04:$B613:B1 B5 LDA ($B5),Y 0x013625|$04:$B615:8D 5F 01 STA $015F 0x013628|$04:$B618:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x01362B|$04:$B61B:A9 FF LDA #$FF 0x01362D|$04:$B61D:A0 0A LDY #$0A 0x01362F|$04:$B61F:91 B5 STA ($B5),Y 0x013631|$04:$B621:A9 01 LDA #$01 0x013633|$04:$B623:85 A8 STA $A8 ; control flow target (from $B661) 0x013635|$04:$B625:A4 A8 LDY $A8 0x013637|$04:$B627:B1 B5 LDA ($B5),Y 0x013639|$04:$B629:D0 30 BNE $B65B 0x01363B|$04:$B62B:EE FE 05 INC $05FE ; number of monsters in current group killed by last attack? 0x01363E|$04:$B62E:A5 A7 LDA $A7 0x013640|$04:$B630:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x013643|$04:$B633:A5 A7 LDA $A7 0x013645|$04:$B635:A4 A8 LDY $A8 0x013647|$04:$B637:91 B5 STA ($B5),Y 0x013649|$04:$B639:8D 5E 01 STA $015E 0x01364C|$04:$B63C:98 TYA 0x01364D|$04:$B63D:A0 02 LDY #$02 0x01364F|$04:$B63F:91 B7 STA ($B7),Y 0x013651|$04:$B641:A5 A9 LDA $A9 0x013653|$04:$B643:A0 03 LDY #$03 0x013655|$04:$B645:91 B7 STA ($B7),Y 0x013657|$04:$B647:A9 00 LDA #$00 0x013659|$04:$B649:A0 00 LDY #$00 0x01365B|$04:$B64B:91 B7 STA ($B7),Y 0x01365D|$04:$B64D:20 A4 B7 JSR $B7A4 0x013660|$04:$B650:20 AB B6 JSR $B6AB 0x013663|$04:$B653:E6 A7 INC $A7 0x013665|$04:$B655:A5 A7 LDA $A7 0x013667|$04:$B657:C9 08 CMP #$08 0x013669|$04:$B659:B0 28 BCS $B683 ; control flow target (from $B629) 0x01366B|$04:$B65B:E6 A8 INC $A8 0x01366D|$04:$B65D:A5 A8 LDA $A8 0x01366F|$04:$B65F:C9 09 CMP #$09 0x013671|$04:$B661:90 C2 BCC $B625 0x013673|$04:$B663:E6 A9 INC $A9 0x013675|$04:$B665:A5 A9 LDA $A9 0x013677|$04:$B667:C9 04 CMP #$04 0x013679|$04:$B669:90 A1 BCC $B60C ; control flow target (from $B680) 0x01367B|$04:$B66B:A5 A7 LDA $A7 0x01367D|$04:$B66D:C9 08 CMP #$08 0x01367F|$04:$B66F:B0 12 BCS $B683 0x013681|$04:$B671:20 E9 9E JSR $9EE9 ; given an index (in A) into the array of structures at $068F, set $B7-$B8 to the address of the corresponding item inside that structure 0x013684|$04:$B674:A9 FF LDA #$FF 0x013686|$04:$B676:A0 03 LDY #$03 0x013688|$04:$B678:91 B7 STA ($B7),Y 0x01368A|$04:$B67A:A0 02 LDY #$02 0x01368C|$04:$B67C:91 B7 STA ($B7),Y 0x01368E|$04:$B67E:E6 A7 INC $A7 0x013690|$04:$B680:4C 6B B6 JMP $B66B ; control flow target (from $B659, $B66F) 0x013693|$04:$B683:A9 00 LDA #$00 ; control flow target (from $B697) 0x013695|$04:$B685:48 PHA 0x013696|$04:$B686:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x013699|$04:$B689:A0 0C LDY #$0C 0x01369B|$04:$B68B:B1 B9 LDA ($B9),Y 0x01369D|$04:$B68D:A0 0D LDY #$0D 0x01369F|$04:$B68F:91 B9 STA ($B9),Y 0x0136A1|$04:$B691:68 PLA 0x0136A2|$04:$B692:AA TAX 0x0136A3|$04:$B693:E8 INX 0x0136A4|$04:$B694:8A TXA 0x0136A5|$04:$B695:C9 03 CMP #$03 0x0136A7|$04:$B697:90 EC BCC $B685 0x0136A9|$04:$B699:A9 00 LDA #$00 0x0136AB|$04:$B69B:AA TAX ; control flow target (from $B6A2) 0x0136AC|$04:$B69C:9D 26 06 STA $0626,X ; EXP earned this battle or current hero's current EXP, byte 0 0x0136AF|$04:$B69F:E8 INX 0x0136B0|$04:$B6A0:E0 06 CPX #$06 0x0136B2|$04:$B6A2:90 F8 BCC $B69C 0x0136B4|$04:$B6A4:8D E6 06 STA $06E6 0x0136B7|$04:$B6A7:8D EC 06 STA $06EC 0x0136BA|$04:$B6AA:60 RTS ; control flow target (from $AE0C, $B650) 0x0136BB|$04:$B6AB:A0 06 LDY #$06 0x0136BD|$04:$B6AD:B1 BB LDA ($BB),Y 0x0136BF|$04:$B6AF:A0 06 LDY #$06 0x0136C1|$04:$B6B1:91 B7 STA ($B7),Y 0x0136C3|$04:$B6B3:A0 00 LDY #$00 0x0136C5|$04:$B6B5:B1 BB LDA ($BB),Y 0x0136C7|$04:$B6B7:85 99 STA $99 0x0136C9|$04:$B6B9:46 99 LSR $99 0x0136CB|$04:$B6BB:46 99 LSR $99 0x0136CD|$04:$B6BD:A9 00 LDA #$00 0x0136CF|$04:$B6BF:85 9A STA $9A ; call to code in a different bank ($0F:$C3AB) 0x0136D1|$04:$B6C1:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x0136D4|$04:$B6C4:A5 32 LDA $32 ; RNG byte 0 0x0136D6|$04:$B6C6:85 9B STA $9B 0x0136D8|$04:$B6C8:20 5B A0 JSR $A05B ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D) 0x0136DB|$04:$B6CB:A0 00 LDY #$00 0x0136DD|$04:$B6CD:B1 BB LDA ($BB),Y 0x0136DF|$04:$B6CF:38 SEC 0x0136E0|$04:$B6D0:E5 9D SBC $9D 0x0136E2|$04:$B6D2:A0 04 LDY #$04 0x0136E4|$04:$B6D4:91 B7 STA ($B7),Y 0x0136E6|$04:$B6D6:C8 INY 0x0136E7|$04:$B6D7:A9 00 LDA #$00 0x0136E9|$04:$B6D9:91 B7 STA ($B7),Y 0x0136EB|$04:$B6DB:60 RTS ; control flow target (from $9571, $9585) 0x0136EC|$04:$B6DC:A9 00 LDA #$00 0x0136EE|$04:$B6DE:85 A7 STA $A7 0x0136F0|$04:$B6E0:85 A5 STA $A5 ; control flow target (from $B6FF) 0x0136F2|$04:$B6E2:20 E4 9E JSR $9EE4 ; given an index (in A) into the array of hero data structures at $062D, set $B9-$BA to the address of the corresponding item inside that structure 0x0136F5|$04:$B6E5:A0 00 LDY #$00 0x0136F7|$04:$B6E7:B1 B9 LDA ($B9),Y 0x0136F9|$04:$B6E9:10 0E BPL $B6F9 0x0136FB|$04:$B6EB:A5 A5 LDA $A5 0x0136FD|$04:$B6ED:A6 A7 LDX $A7 0x0136FF|$04:$B6EF:9D C7 06 STA $06C7,X 0x013702|$04:$B6F2:A0 0A LDY #$0A 0x013704|$04:$B6F4:B1 B9 LDA ($B9),Y 0x013706|$04:$B6F6:20 90 B7 JSR $B790 ; control flow target (from $B6E9) 0x013709|$04:$B6F9:E6 A5 INC $A5 0x01370B|$04:$B6FB:A5 A5 LDA $A5 0x01370D|$04:$B6FD:C9 03 CMP #$03 0x01370F|$04:$B6FF:90 E1 BCC $B6E2 0x013711|$04:$B701:A9 00 LDA #$00 0x013713|$04:$B703:85 A5 STA $A5 ; control flow target (from $B736) 0x013715|$04:$B705:20 EE 9E JSR $9EEE ; given an index (in A) into the array of structures at $0663, set $B5-$B6 to the address of the corresponding item inside that structure 0x013718|$04:$B708:A0 00 LDY #$00 0x01371A|$04:$B70A:B1 B5 LDA ($B5),Y 0x01371C|$04:$B70C:20 DC 9E JSR $9EDC ; given an index + 1 (in A) into the array of enemy stat structures at $B7F5, set $BB-$BC to the address of the corresponding item inside that structure 0x01371F|$04:$B70F:A9 01 LDA #$01 0x013721|$04:$B711:85 A6 STA $A6 ; control flow target (from $B72E) 0x013723|$04:$B713:A8 TAY 0x013724|$04:$B714:B1 B5 LDA ($B5),Y 0x013726|$04:$B716:C9 08 CMP #$08 0x013728|$04:$B718:B0 0E BCS $B728 0x01372A|$04:$B71A:69 10 ADC #$10 0x01372C|$04:$B71C:A6 A7 LDX $A7 0x01372E|$04:$B71E:9D C7 06 STA $06C7,X 0x013731|$04:$B721:A0 04 LDY #$04 0x013733|$04:$B723:B1 BB LDA ($BB),Y 0x013735|$04:$B725:20 90 B7 JSR $B790 ; control flow target (from $B718) 0x013738|$04:$B728:E6 A6 INC $A6 0x01373A|$04:$B72A:A5 A6 LDA $A6 0x01373C|$04:$B72C:C9 09 CMP #$09 0x01373E|$04:$B72E:90 E3 BCC $B713 0x013740|$04:$B730:E6 A5 INC $A5 0x013742|$04:$B732:A5 A5 LDA $A5 0x013744|$04:$B734:C9 04 CMP #$04 0x013746|$04:$B736:90 CD BCC $B705 0x013748|$04:$B738:A9 FF LDA #$FF 0x01374A|$04:$B73A:A6 A7 LDX $A7 ; control flow target (from $B744) 0x01374C|$04:$B73C:E0 0B CPX #$0B 0x01374E|$04:$B73E:B0 07 BCS $B747 0x013750|$04:$B740:9D C7 06 STA $06C7,X 0x013753|$04:$B743:E8 INX 0x013754|$04:$B744:4C 3C B7 JMP $B73C ; control flow target (from $B73E) 0x013757|$04:$B747:A5 A7 LDA $A7 0x013759|$04:$B749:C9 02 CMP #$02 0x01375B|$04:$B74B:B0 01 BCS $B74E 0x01375D|$04:$B74D:60 RTS ; control flow target (from $B74B) 0x01375E|$04:$B74E:A2 00 LDX #$00 ; control flow target (from $B78C) 0x013760|$04:$B750:BD D2 06 LDA $06D2,X 0x013763|$04:$B753:85 A8 STA $A8 0x013765|$04:$B755:86 A9 STX $A9 0x013767|$04:$B757:8A TXA 0x013768|$04:$B758:A8 TAY 0x013769|$04:$B759:C8 INY ; control flow target (from $B76B) 0x01376A|$04:$B75A:A5 A8 LDA $A8 0x01376C|$04:$B75C:D9 D2 06 CMP $06D2,Y 0x01376F|$04:$B75F:B0 07 BCS $B768 0x013771|$04:$B761:B9 D2 06 LDA $06D2,Y 0x013774|$04:$B764:85 A8 STA $A8 0x013776|$04:$B766:84 A9 STY $A9 ; control flow target (from $B75F) 0x013778|$04:$B768:C8 INY 0x013779|$04:$B769:C4 A7 CPY $A7 0x01377B|$04:$B76B:90 ED BCC $B75A 0x01377D|$04:$B76D:A4 A9 LDY $A9 0x01377F|$04:$B76F:B9 C7 06 LDA $06C7,Y 0x013782|$04:$B772:85 A8 STA $A8 0x013784|$04:$B774:BD D2 06 LDA $06D2,X 0x013787|$04:$B777:99 D2 06 STA $06D2,Y 0x01378A|$04:$B77A:BD C7 06 LDA $06C7,X 0x01378D|$04:$B77D:99 C7 06 STA $06C7,Y 0x013790|$04:$B780:A5 A8 LDA $A8 0x013792|$04:$B782:9D C7 06 STA $06C7,X 0x013795|$04:$B785:E8 INX 0x013796|$04:$B786:E8 INX 0x013797|$04:$B787:E4 A7 CPX $A7 0x013799|$04:$B789:B0 04 BCS $B78F 0x01379B|$04:$B78B:CA DEX 0x01379C|$04:$B78C:4C 50 B7 JMP $B750 ; control flow target (from $B789) 0x01379F|$04:$B78F:60 RTS ; control flow target (from $B6F6, $B725) 0x0137A0|$04:$B790:4A LSR 0x0137A1|$04:$B791:85 99 STA $99 ; call to code in a different bank ($0F:$C3AB) 0x0137A3|$04:$B793:20 AB C3 JSR $C3AB ; generate a random number and store it in $32-$33 (two passes) 0x0137A6|$04:$B796:A5 32 LDA $32 ; RNG byte 0 0x0137A8|$04:$B798:65 99 ADC $99 0x0137AA|$04:$B79A:90 02 BCC $B79E 0x0137AC|$04:$B79C:A9 FF LDA #$FF ; control flow target (from $B79A) 0x0137AE|$04:$B79E:9D D2 06 STA $06D2,X 0x0137B1|$04:$B7A1:E6 A7 INC $A7 0x0137B3|$04:$B7A3:60 RTS ; control flow target (from $AE09, $B64D) 0x0137B4|$04:$B7A4:A0 01 LDY #$01 ; control flow target (from $B7C6) 0x0137B6|$04:$B7A6:A2 00 LDX #$00 0x0137B8|$04:$B7A8:86 99 STX $99 ; control flow target (from $B7BD) 0x0137BA|$04:$B7AA:BD 62 01 LDA $0162,X 0x0137BD|$04:$B7AD:CD 5F 01 CMP $015F 0x0137C0|$04:$B7B0:D0 08 BNE $B7BA 0x0137C2|$04:$B7B2:98 TYA 0x0137C3|$04:$B7B3:DD 6A 01 CMP $016A,X 0x0137C6|$04:$B7B6:D0 02 BNE $B7BA 0x0137C8|$04:$B7B8:E6 99 INC $99 ; control flow target (from $B7B0, $B7B6) 0x0137CA|$04:$B7BA:E8 INX 0x0137CB|$04:$B7BB:E0 08 CPX #$08 0x0137CD|$04:$B7BD:90 EB BCC $B7AA 0x0137CF|$04:$B7BF:A5 99 LDA $99 0x0137D1|$04:$B7C1:F0 07 BEQ $B7CA 0x0137D3|$04:$B7C3:C8 INY 0x0137D4|$04:$B7C4:C0 09 CPY #$09 0x0137D6|$04:$B7C6:90 DE BCC $B7A6 0x0137D8|$04:$B7C8:A0 00 LDY #$00 ; control flow target (from $B7C1) 0x0137DA|$04:$B7CA:AE 5E 01 LDX $015E 0x0137DD|$04:$B7CD:AD 5F 01 LDA $015F 0x0137E0|$04:$B7D0:9D 62 01 STA $0162,X 0x0137E3|$04:$B7D3:98 TYA 0x0137E4|$04:$B7D4:9D 6A 01 STA $016A,X 0x0137E7|$04:$B7D7:C9 02 CMP #$02 0x0137E9|$04:$B7D9:B0 01 BCS $B7DC 0x0137EB|$04:$B7DB:60 RTS ; control flow target (from $B7D9) 0x0137EC|$04:$B7DC:A2 03 LDX #$03 ; control flow target (from $B7EB) 0x0137EE|$04:$B7DE:BD 72 01 LDA $0172,X 0x0137F1|$04:$B7E1:C9 FF CMP #$FF 0x0137F3|$04:$B7E3:F0 09 BEQ $B7EE 0x0137F5|$04:$B7E5:CD 5F 01 CMP $015F 0x0137F8|$04:$B7E8:F0 0A BEQ $B7F4 0x0137FA|$04:$B7EA:CA DEX 0x0137FB|$04:$B7EB:10 F1 BPL $B7DE 0x0137FD|$04:$B7ED:60 RTS ; control flow target (from $B7E3) 0x0137FE|$04:$B7EE:AD 5F 01 LDA $015F 0x013801|$04:$B7F1:9D 72 01 STA $0172,X ; control flow target (from $B7E8) 0x013804|$04:$B7F4:60 RTS ; code -> data ; Enemy Stats (Max HP, [4-bit evade chance / 64, 4-bit unused], Max Gold dropped, EXP low byte, AGI, Attack Power, Defense Power, [2-bit attack probability list, 3-bit Sleep res., 3-bit spell damage res.], [2-bit EXP * 256, 3-bit Defeat res., 3-bit Stopspell res.], [2-bit EXP * 1024, 3-bit Defense res., 3-bit Surround res.], [4-bit Attack command 1, 4-bit Attack command 2], [4-bit Attack command 3, 4-bit Attack command 4], [4-bit Attack command 5, 4-bit Attack command 6], [4-bit Attack command 7, 4-bit Attack command 8], 8*1-bit use alternate attack command) ; indirect data load target (via $9F27) 0x013805|$04:$B7F5:05 10 02 01 03 07 05 40 07 00 50 50 00 00 00 ; Monster ID #$01: Slime 0x013814|$04:$B804:08 00 03 02 03 09 06 00 07 00 00 00 00 00 00 ; Monster ID #$02: Big Slug 0x013823|$04:$B813:05 10 04 02 04 0B 0D 00 07 00 00 00 00 00 00 ; Monster ID #$03: Iron Ant 0x013832|$04:$B822:09 00 03 03 05 0C 08 40 07 01 05 00 00 00 00 ; Monster ID #$04: Drakee 0x013841|$04:$B831:0A 10 05 05 08 0E 0B 80 07 02 50 00 00 55 00 ; Monster ID #$05: Wild Mouse 0x013850|$04:$B840:19 00 05 0F 14 0F 0A 5B 0F 00 CC CC 0C CC 00 ; Monster ID #$06: Healer 0x01385F|$04:$B84F:0C 20 06 06 08 12 0A 00 07 00 00 00 00 00 00 ; Monster ID #$07: Ghost Mouse 0x01386E|$04:$B85E:0D 10 04 08 09 10 0D 08 07 00 00 00 20 2E 80 ; Monster ID #$08: Babble 0x01387D|$04:$B86D:0C 00 02 04 08 13 0D 50 0F 01 00 C0 00 CC C4 ; Monster ID #$09: Army Ant 0x01388C|$04:$B87C:0F 00 0A 0A 0B 11 0B 40 08 01 56 06 06 05 00 ; Monster ID #$0A: Magician 0x01389B|$04:$B88B:10 20 05 07 0F 13 0B 80 0F 02 50 00 00 5E 80 ; Monster ID #$0B: Big Rat 0x0138AA|$04:$B89A:0E 10 09 09 0B 16 0A 48 0F 02 22 22 00 00 00 ; Monster ID #$0C: Big Cobra 0x0138B9|$04:$B8A9:0E 10 08 12 14 12 0D 50 00 02 22 20 00 0E 87 ; Monster ID #$0D: Magic Ant 0x0138C8|$04:$B8B8:0C 10 0A 0C 0E 0E 0A 50 03 02 00 00 00 00 1F ; Monster ID #$0E: Magidrakee 0x0138D7|$04:$B8C7:15 00 1E 0E 0D 19 28 08 0F 00 00 02 00 00 00 ; Monster ID #$0F: Centipod 0x0138E6|$04:$B8D6:14 00 32 19 0C 1C 10 08 07 01 33 30 30 00 00 ; Monster ID #$10: Man O’ War 0x0138F5|$04:$B8E5:0F 20 0C 1B 10 14 0A 50 0B 01 66 06 00 60 00 ; Monster ID #$11: Lizard Fly 0x013904|$04:$B8F4:3C 00 19 28 0C 1F 07 78 3F 01 00 40 04 4E 84 ; Monster ID #$12: Zombie 0x013913|$04:$B903:0F 40 28 10 0F 0E 28 91 0A 11 33 30 00 00 07 ; Monster ID #$13: Smoke 0x013922|$04:$B912:19 20 0F 17 29 29 0C C8 07 03 50 C0 C0 05 14 ; Monster ID #$14: Ghost Rat 0x013931|$04:$B921:28 20 2D 14 14 30 0C 90 07 02 05 00 00 05 00 ; Monster ID #$15: Baboon 0x013940|$04:$B930:20 00 10 1D 0C 20 0B 50 07 07 B0 B0 B0 00 15 ; Monster ID #$16: Carnivog 0x01394F|$04:$B93F:14 10 19 21 0D 27 6E 48 07 0A 00 02 05 15 00 ; Monster ID #$17: Megapede 0x01395E|$04:$B94E:20 00 50 22 10 26 0B 6A 1F 0A B0 23 C5 15 11 ; Monster ID #$18: Sea Slug 0x01396D|$04:$B95D:2A 20 1D 24 16 23 0D 00 08 00 2D D2 00 00 0F ; Monster ID #$19: Medusa Ball 0x01397C|$04:$B96C:28 10 1E 25 19 24 0E A1 0A 09 36 66 50 21 C1 ; Monster ID #$1A: Enchanter 0x01398B|$04:$B97B:1C 20 23 20 16 1E 09 79 17 13 00 00 0F F0 60 ; Monster ID #$1B: Mud Man 0x01399A|$04:$B98A:2D 10 2D 28 12 2D 0C 50 0F 08 50 00 C0 0C 90 ; Monster ID #$1C: Magic Baboon 0x0139A9|$04:$B999:30 10 32 2C 1F 33 10 8A 1F 0A 00 D0 01 10 04 ; Monster ID #$1D: Demighost 0x0139B8|$04:$B9A8:3C 10 17 34 1E 39 14 9A 1C 12 20 90 70 95 11 ; Monster ID #$1E: Gremlin 0x0139C7|$04:$B9B7:2E 00 19 1F 17 2D 12 52 1F 0B A2 A2 02 A2 45 ; Monster ID #$1F: Poison Lily 0x0139D6|$04:$B9C6:2E 00 28 2C 01 3A 02 78 2F 12 00 00 00 00 00 ; Monster ID #$20: Mummy Man 0x0139E5|$04:$B9D5:1A 20 1E 32 1E 1E 78 8E 1C 04 40 14 10 42 FD ; Monster ID #$21: Gorgon 0x0139F4|$04:$B9E4:19 50 37 28 30 46 14 90 17 13 00 00 00 D1 40 ; Monster ID #$22: Saber Tiger 0x013A03|$04:$B9F3:28 10 2B 3B 23 33 15 78 1F 08 77 77 70 05 1F ; Monster ID #$23: Dragon Fly 0x013A12|$04:$BA02:33 00 50 32 1E 3A 13 50 27 1B 05 F0 00 05 04 ; Monster ID #$24: Titan Tree 0x013A21|$04:$BA11:41 10 28 2D 21 3F 11 10 3F 13 00 00 00 0E 80 ; Monster ID #$25: Undead 0x013A30|$04:$BA20:26 20 3A 29 29 4B 19 90 1F 12 22 22 22 25 00 ; Monster ID #$26: Basilisk 0x013A3F|$04:$BA2F:32 00 1C 19 27 37 10 38 27 07 CC 0C 0C 0C AB ; Monster ID #$27: Goopi 0x013A4E|$04:$BA3E:3C 10 32 3D 24 4B 17 51 27 09 50 00 00 05 00 ; Monster ID #$28: Orc 0x013A5D|$04:$BA4D:3C 00 64 34 5A 40 18 33 3F 36 11 1F FF F1 FF ; Monster ID #$29: Puppet Man 0x013A6C|$04:$BA5C:4B 10 3C 3E 2A 46 1A BC 27 1C 53 03 00 0E 80 ; Monster ID #$2A: Mummy 0x013A7B|$04:$BA6B:3F 10 2D 43 2D 48 1B 9A 27 24 03 0F 30 F5 5A ; Monster ID #$2B: Evil Tree 0x013A8A|$04:$BA7A:32 10 1E 27 2D 3C 50 B9 1F 0B 23 04 32 04 BB ; Monster ID #$2C: Gas 0x013A99|$04:$BA89:5F 00 33 3D 22 3B 0A 2A 3F 0A 20 B0 2B 2E A4 ; Monster ID #$2D: Hork 0x013AA8|$04:$BA98:3C 10 2D 40 33 4B 1B 91 11 09 50 30 00 95 04 ; Monster ID #$2E: Hawk Man 0x013AB7|$04:$BAA7:37 10 28 48 2B 3D 1C 91 12 12 73 70 07 15 42 ; Monster ID #$2F: Sorcerer 0x013AC6|$04:$BAB6:06 10 5A 87 64 0A B4 7F 3F 3F 56 66 25 55 10 ; Monster ID #$30: Metal Slime 0x013AD5|$04:$BAC5:41 10 2D 43 46 52 19 59 17 09 00 00 00 05 00 ; Monster ID #$31: Hunter 0x013AE4|$04:$BAD4:32 00 19 5C 37 4D 1E 51 1F 10 B0 B0 FF 00 35 ; Monster ID #$32: Evil Eye 0x013AF3|$04:$BAE3:3C 20 53 51 34 4A 1D 90 19 14 00 40 00 01 54 ; Monster ID #$33: Hibabango 0x013B02|$04:$BAF2:3C 00 1E 26 31 48 18 A1 17 3F CC 00 05 5E 83 ; Monster ID #$34: Graboopi 0x013B11|$04:$BB01:64 10 FF 3F 39 50 38 92 2A 0C 50 00 00 05 00 ; Monster ID #$35: Gold Orc 0x013B20|$04:$BB10:43 10 30 54 4B 49 1C 93 1E 0B E7 E7 10 05 50 ; Monster ID #$36: Evil Clown 0x013B2F|$04:$BB1F:50 30 64 3D 29 78 13 9A 18 09 66 66 66 60 00 ; Monster ID #$37: Ghoul 0x013B3E|$04:$BB2E:39 10 31 55 30 4B 19 52 17 09 DD 0D 00 C0 4B ; Monster ID #$38: Vampirus 0x013B4D|$04:$BB3D:48 10 50 59 35 5D 1C 9A 23 0B 00 00 00 00 84 ; Monster ID #$39: Mega Knight 0x013B5C|$04:$BB4C:50 10 37 51 47 5F 4C 3C 17 02 00 00 00 0E 80 ; Monster ID #$3A: Saber Lion 0x013B6B|$04:$BB5B:46 10 96 52 3D 37 50 DC 2F 01 DD D1 10 00 07 ; Monster ID #$3B: Metal Hunter 0x013B7A|$04:$BB6A:45 20 69 8B 39 50 1F 9B 23 1B A0 70 73 2C F0 ; Monster ID #$3C: Ozwarg 0x013B89|$04:$BB79:43 00 51 5D 37 4A 16 BC 17 25 B4 40 B0 FF D7 ; Monster ID #$3D: Dark Eye 0x013B98|$04:$BB88:3C 10 5F 47 40 55 1F 88 1A 13 30 00 30 30 51 ; Monster ID #$3E: Gargoyle 0x013BA7|$04:$BB97:6E 10 87 9A 3C 63 23 D2 23 12 0D DD AA 00 00 ; Monster ID #$3F: Orc King 0x013BB6|$04:$BBA6:41 10 67 B6 4F 4D 15 AA 1F 12 02 70 27 02 FF ; Monster ID #$40: Magic Vampirus 0x013BC5|$04:$BBB5:58 20 7B 75 41 77 17 A0 27 12 00 00 00 0E 80 ; Monster ID #$41: Berserker 0x013BD4|$04:$BBC4:23 00 FF 1A C8 4B FF 3F 3F 7F 77 74 55 55 08 ; Monster ID #$42: Metal Babble 0x013BE3|$04:$BBD3:50 80 87 C9 47 7D 24 B9 2B 13 AD 00 00 10 2A ; Monster ID #$43: Hargon’s Knight 0x013BF2|$04:$BBE2:73 40 63 47 3F 79 20 58 57 19 00 00 00 15 00 ; Monster ID #$44: Cyclops 0x013C01|$04:$BBF1:78 00 78 D3 5A 73 E6 FF BF 02 DD DD 11 D1 4F ; Monster ID #$45: Attackbot 0x013C10|$04:$BC00:5F 50 93 5E 45 82 38 FB 77 1B 88 00 88 07 B3 ; Monster ID #$46: Green Dragon 0x013C1F|$04:$BC0F:9E 50 64 69 8C 5C 26 BB BF 0C FF 8F 08 15 D0 ; Monster ID #$47: Mace Master 0x013C2E|$04:$BC1E:37 00 65 F5 4E 63 20 97 17 15 88 8C C8 C8 FF ; Monster ID #$48: Flame 0x013C3D|$04:$BC2D:59 50 60 0F 5A 5C 23 B9 67 14 B7 7B 7B BB A8 ; Monster ID #$49: Silver Batboon 0x013C4C|$04:$BC3C:5A 40 71 C5 55 6F 21 32 5F 1A 50 05 05 05 FF ; Monster ID #$4A: Blizzard 0x013C5B|$04:$BC4B:9B 10 5F 03 64 91 29 3A B7 12 00 00 10 01 00 ; Monster ID #$4B: Giant 0x013C6A|$04:$BC5A:70 60 64 8C 6E 6C 27 B3 72 12 60 77 8B 0B B1 ; Monster ID #$4C: Gold Batboon 0x013C79|$04:$BC69:D2 70 6E 68 96 8C 50 64 F7 12 88 8D 88 8D CC ; Monster ID #$4D: Bullwong 0x013C88|$04:$BC78:FA 70 FA 4C 3F C3 C8 3F 3F 52 DD DD DD DE FF ; Monster ID #$4E: Atlas 0x013C97|$04:$BC87:FA 70 F0 FA 4B 7F A0 9C 7F 66 68 57 25 DB 75 ; Monster ID #$4F: Bazuzu 0x013CA6|$04:$BC96:FA 00 FF 98 78 C8 DC AD 37 80 BB 88 88 D1 F0 ; Monster ID #$50: Zarlox 0x013CB5|$04:$BCA5:E6 00 00 00 96 B4 BB FB 3C 3F BB B8 82 BD E0 ; Monster ID #$51: Hargon 0x013CC4|$04:$BCB4:FA 70 00 00 6E FF FF 3F 3F 14 9B 93 B3 99 C5 ; Monster ID #$52: Malroth ; EXP per level, low byte ; Exp needed for Midenhall ; indexed data load target (from $9D5E) 0x013CD3|$04:$BCC3:0C ; EXP per level, high byte ; indexed data load target (from $9D61, $9D6D) 0x013CD4|$04:$BCC4: 00 ; Lv 2: (12 total) 0x013CD5|$04:$BCC5:14 00 ; Lv 3: (32 total) 0x013CD7|$04:$BCC7:28 00 ; Lv 4: (72 total) 0x013CD9|$04:$BCC9:44 00 ; Lv 5: (140 total) 0x013CDB|$04:$BCCB:8C 00 ; Lv 6: (280 total) 0x013CDD|$04:$BCCD:18 01 ; Lv 7: (560 total) 0x013CDF|$04:$BCCF:B8 01 ; Lv 8: (1000 total) 0x013CE1|$04:$BCD1:20 03 ; Lv 9: (1800 total) 0x013CE3|$04:$BCD3:E8 03 ; Lv 10: (2800 total) 0x013CE5|$04:$BCD5:4C 04 ; Lv 11: (3900 total) 0x013CE7|$04:$BCD7:78 05 ; Lv 12: (5300 total) 0x013CE9|$04:$BCD9:FC 08 ; Lv 13: (7600 total) 0x013CEB|$04:$BCDB:60 09 ; Lv 14: (10000 total) 0x013CED|$04:$BCDD:B8 0B ; Lv 15: (13000 total) 0x013CEF|$04:$BCDF:A0 0F ; Lv 16: (17000 total) 0x013CF1|$04:$BCE1:A0 0F ; Lv 17: (21000 total) 0x013CF3|$04:$BCE3:88 13 ; Lv 18: (26000 total) 0x013CF5|$04:$BCE5:70 17 ; Lv 19: (32000 total) 0x013CF7|$04:$BCE7:40 1F ; Lv 20: (40000 total) 0x013CF9|$04:$BCE9:10 27 ; Lv 21: (50000 total) 0x013CFB|$04:$BCEB:E0 2E ; Lv 22: (62000 total) 0x013CFD|$04:$BCED:C8 32 ; Lv 23: (75000 total) 0x013CFF|$04:$BCEF:98 3A ; Lv 24: (90000 total) 0x013D01|$04:$BCF1:68 42 ; Lv 25: (107000 total) 0x013D03|$04:$BCF3:20 4E ; Lv 26: (127000 total) 0x013D05|$04:$BCF5:D8 59 ; Lv 27: (150000 total) 0x013D07|$04:$BCF7:A8 61 ; Lv 28: (175000 total) 0x013D09|$04:$BCF9:A8 61 ; Lv 29: (200000 total) 0x013D0B|$04:$BCFB:30 75 ; Lv 30: (230000 total) 0x013D0D|$04:$BCFD:30 75 ; Lv 31: (260000 total) 0x013D0F|$04:$BCFF:30 75 ; Lv 32: (290000 total) 0x013D11|$04:$BD01:30 75 ; Lv 33: (320000 total) 0x013D13|$04:$BD03:30 75 ; Lv 34: (350000 total) 0x013D15|$04:$BD05:30 75 ; Lv 35: (380000 total) 0x013D17|$04:$BD07:30 75 ; Lv 36: (410000 total) 0x013D19|$04:$BD09:30 75 ; Lv 37: (440000 total) 0x013D1B|$04:$BD0B:30 75 ; Lv 38: (470000 total) 0x013D1D|$04:$BD0D:30 75 ; Lv 39: (500000 total) 0x013D1F|$04:$BD0F:30 75 ; Lv 40: (530000 total) 0x013D21|$04:$BD11:40 9C ; Lv 41: (570000 total) 0x013D23|$04:$BD13:50 C3 ; Lv 42: (620000 total) 0x013D25|$04:$BD15:50 C3 ; Lv 43: (670000 total) 0x013D27|$04:$BD17:50 C3 ; Lv 44: (720000 total) 0x013D29|$04:$BD19:50 C3 ; Lv 45: (770000 total) 0x013D2B|$04:$BD1B:50 C3 ; Lv 46: (820000 total) 0x013D2D|$04:$BD1D:50 C3 ; Lv 47: (870000 total) 0x013D2F|$04:$BD1F:50 C3 ; Lv 48: (920000 total) 0x013D31|$04:$BD21:50 C3 ; Lv 49: (970000 total) 0x013D33|$04:$BD23:30 75 ; Lv 50: (1000000 total) ; Exp needed for Cannock 0x013D35|$04:$BD25:18 00 ; Lv 2: (24 total) 0x013D37|$04:$BD27:24 00 ; Lv 3: (60 total) 0x013D39|$04:$BD29:32 00 ; Lv 4: (110 total) 0x013D3B|$04:$BD2B:5A 00 ; Lv 5: (200 total) 0x013D3D|$04:$BD2D:B4 00 ; Lv 6: (380 total) 0x013D3F|$04:$BD2F:40 01 ; Lv 7: (700 total) 0x013D41|$04:$BD31:58 02 ; Lv 8: (1300 total) 0x013D43|$04:$BD33:4C 04 ; Lv 9: (2400 total) 0x013D45|$04:$BD35:40 06 ; Lv 10: (4000 total) 0x013D47|$04:$BD37:D0 07 ; Lv 11: (6000 total) 0x013D49|$04:$BD39:98 08 ; Lv 12: (8200 total) 0x013D4B|$04:$BD3B:F0 0A ; Lv 13: (11000 total) 0x013D4D|$04:$BD3D:A0 0F ; Lv 14: (15000 total) 0x013D4F|$04:$BD3F:A0 0F ; Lv 15: (19000 total) 0x013D51|$04:$BD41:88 13 ; Lv 16: (24000 total) 0x013D53|$04:$BD43:70 17 ; Lv 17: (30000 total) 0x013D55|$04:$BD45:58 1B ; Lv 18: (37000 total) 0x013D57|$04:$BD47:28 23 ; Lv 19: (46000 total) 0x013D59|$04:$BD49:F8 2A ; Lv 20: (57000 total) 0x013D5B|$04:$BD4B:C8 32 ; Lv 21: (70000 total) 0x013D5D|$04:$BD4D:98 3A ; Lv 22: (85000 total) 0x013D5F|$04:$BD4F:98 3A ; Lv 23: (100000 total) 0x013D61|$04:$BD51:80 3E ; Lv 24: (116000 total) 0x013D63|$04:$BD53:50 46 ; Lv 25: (134000 total) 0x013D65|$04:$BD55:F0 55 ; Lv 26: (156000 total) 0x013D67|$04:$BD57:90 65 ; Lv 27: (182000 total) 0x013D69|$04:$BD59:60 6D ; Lv 28: (210000 total) 0x013D6B|$04:$BD5B:30 75 ; Lv 29: (240000 total) 0x013D6D|$04:$BD5D:40 9C ; Lv 30: (280000 total) 0x013D6F|$04:$BD5F:30 75 ; Lv 31: (310000 total) 0x013D71|$04:$BD61:30 75 ; Lv 32: (340000 total) 0x013D73|$04:$BD63:40 9C ; Lv 33: (380000 total) 0x013D75|$04:$BD65:50 C3 ; Lv 34: (430000 total) 0x013D77|$04:$BD67:50 C3 ; Lv 35: (480000 total) 0x013D79|$04:$BD69:40 9C ; Lv 36: (520000 total) 0x013D7B|$04:$BD6B:60 EA ; Lv 37: (580000 total) 0x013D7D|$04:$BD6D:60 EA ; Lv 38: (640000 total) 0x013D7F|$04:$BD6F:60 EA ; Lv 39: (700000 total) 0x013D81|$04:$BD71:60 EA ; Lv 40: (760000 total) 0x013D83|$04:$BD73:60 EA ; Lv 41: (820000 total) 0x013D85|$04:$BD75:20 4E ; Lv 42: (840000 total) 0x013D87|$04:$BD77:60 EA ; Lv 43: (900000 total) 0x013D89|$04:$BD79:60 EA ; Lv 44: (960000 total) 0x013D8B|$04:$BD7B:40 9C ; Lv 45: (1000000 total) ; Exp needed for Moonbrooke 0x013D8D|$04:$BD7D:64 00 ; Lv 2: (100 total) 0x013D8F|$04:$BD7F:C8 00 ; Lv 3: (300 total) 0x013D91|$04:$BD81:2C 01 ; Lv 4: (600 total) 0x013D93|$04:$BD83:58 02 ; Lv 5: (1200 total) 0x013D95|$04:$BD85:B0 04 ; Lv 6: (2400 total) 0x013D97|$04:$BD87:08 07 ; Lv 7: (4200 total) 0x013D99|$04:$BD89:98 08 ; Lv 8: (6400 total) 0x013D9B|$04:$BD8B:28 0A ; Lv 9: (9000 total) 0x013D9D|$04:$BD8D:B8 0B ; Lv 10: (12000 total) 0x013D9F|$04:$BD8F:A0 0F ; Lv 11: (16000 total) 0x013DA1|$04:$BD91:A0 0F ; Lv 12: (20000 total) 0x013DA3|$04:$BD93:88 13 ; Lv 13: (25000 total) 0x013DA5|$04:$BD95:70 17 ; Lv 14: (31000 total) 0x013DA7|$04:$BD97:40 1F ; Lv 15: (39000 total) 0x013DA9|$04:$BD99:F8 2A ; Lv 16: (50000 total) 0x013DAB|$04:$BD9B:98 3A ; Lv 17: (65000 total) 0x013DAD|$04:$BD9D:50 46 ; Lv 18: (83000 total) 0x013DAF|$04:$BD9F:20 4E ; Lv 19: (103000 total) 0x013DB1|$04:$BDA1:F0 55 ; Lv 20: (125000 total) 0x013DB3|$04:$BDA3:A8 61 ; Lv 21: (150000 total) 0x013DB5|$04:$BDA5:30 75 ; Lv 22: (180000 total) 0x013DB7|$04:$BDA7:40 9C ; Lv 23: (220000 total) 0x013DB9|$04:$BDA9:50 C3 ; Lv 24: (270000 total) 0x013DBB|$04:$BDAB:30 75 ; Lv 25: (300000 total) 0x013DBD|$04:$BDAD:30 75 ; Lv 26: (330000 total) 0x013DBF|$04:$BDAF:30 75 ; Lv 27: (360000 total) 0x013DC1|$04:$BDB1:40 9C ; Lv 28: (400000 total) 0x013DC3|$04:$BDB3:50 C3 ; Lv 29: (450000 total) 0x013DC5|$04:$BDB5:90 5F ; Lv 30: (540000 total, 65536 EXP pre-added) 0x013DC7|$04:$BDB7:90 5F ; Lv 31: (630000 total, 65536 EXP pre-added) 0x013DC9|$04:$BDB9:A0 86 ; Lv 32: (730000 total, 65536 EXP pre-added) 0x013DCB|$04:$BDBB:90 5F ; Lv 33: (820000 total, 65536 EXP pre-added) 0x013DCD|$04:$BDBD:90 5F ; Lv 34: (910000 total, 65536 EXP pre-added) 0x013DCF|$04:$BDBF:90 5F ; Lv 35: (1000000 total, 65536 EXP pre-added) ; starting STR ; Midenhall ; indexed data load target (from $9DDE) 0x013DD1|$04:$BDC1:05 ; starting AGI ; indexed data load target (from $9DE3) 0x013DD2|$04:$BDC2: 04 ; starting Max HP ; indexed data load target (from $9DE8) 0x013DD3|$04:$BDC3: 1C ; starting Max MP ; indexed data load target (from $9DED) 0x013DD4|$04:$BDC4: 00 ; Cannock 0x013DD5|$04:$BDC5:04 04 1F 06 ; Moonbrooke 0x013DD9|$04:$BDC9:02 16 20 1C ; level up stat nybbles (STR/AGI, HP/MP) ; indexed data load target (from $9DFD, $9E07, $9E97) 0x013DDD|$04:$BDCD:21 90 ; Midenhall Lv 2 0x013DDF|$04:$BDCF:03 36 ; Cannock Lv 2 0x013DE1|$04:$BDD1:04 00 ; Moonbrooke Lv 2 0x013DE3|$04:$BDD3:52 30 ; Midenhall Lv 3 0x013DE5|$04:$BDD5:22 14 ; Cannock Lv 3 0x013DE7|$04:$BDD7:00 57 ; Moonbrooke Lv 3 0x013DE9|$04:$BDD9:50 80 ; Midenhall Lv 4 0x013DEB|$04:$BDDB:12 32 ; Cannock Lv 4 0x013DED|$04:$BDDD:12 09 ; Moonbrooke Lv 4 0x013DEF|$04:$BDDF:15 40 ; Midenhall Lv 5 0x013DF1|$04:$BDE1:04 22 ; Cannock Lv 5 0x013DF3|$04:$BDE3:05 14 ; Moonbrooke Lv 5 0x013DF5|$04:$BDE5:26 30 ; Midenhall Lv 6 0x013DF7|$04:$BDE7:14 22 ; Cannock Lv 6 0x013DF9|$04:$BDE9:17 10 ; Moonbrooke Lv 6 0x013DFB|$04:$BDEB:93 10 ; Midenhall Lv 7 0x013DFD|$04:$BDED:12 05 ; Cannock Lv 7 0x013DFF|$04:$BDEF:12 12 ; Moonbrooke Lv 7 0x013E01|$04:$BDF1:13 20 ; Midenhall Lv 8 0x013E03|$04:$BDF3:60 25 ; Cannock Lv 8 0x013E05|$04:$BDF5:15 52 ; Moonbrooke Lv 8 0x013E07|$04:$BDF7:30 00 ; Midenhall Lv 9 0x013E09|$04:$BDF9:07 12 ; Cannock Lv 9 0x013E0B|$04:$BDFB:13 56 ; Moonbrooke Lv 9 0x013E0D|$04:$BDFD:34 20 ; Midenhall Lv 10 0x013E0F|$04:$BDFF:14 24 ; Cannock Lv 10 0x013E11|$04:$BE01:15 65 ; Moonbrooke Lv 10 0x013E13|$04:$BE03:52 20 ; Midenhall Lv 11 0x013E15|$04:$BE05:14 32 ; Cannock Lv 11 0x013E17|$04:$BE07:01 26 ; Moonbrooke Lv 111 0x013E19|$04:$BE09:33 10 ; Midenhall Lv 12 0x013E1B|$04:$BE0B:20 23 ; Cannock Lv 12 0x013E1D|$04:$BE0D:12 12 ; Moonbrooke Lv 12 0x013E1F|$04:$BE0F:54 10 ; Midenhall Lv 13 0x013E21|$04:$BE11:87 22 ; Cannock Lv 13 0x013E23|$04:$BE13:15 34 ; Moonbrooke Lv 13 0x013E25|$04:$BE15:40 10 ; Midenhall Lv 14 0x013E27|$04:$BE17:35 53 ; Cannock Lv 14 0x013E29|$04:$BE19:16 65 ; Moonbrooke Lv 14 0x013E2B|$04:$BE1B:24 30 ; Midenhall Lv 15 0x013E2D|$04:$BE1D:40 42 ; Cannock Lv 15 0x013E2F|$04:$BE1F:13 76 ; Moonbrooke Lv 15 0x013E31|$04:$BE21:36 20 ; Midenhall Lv 16 0x013E33|$04:$BE23:57 24 ; Cannock Lv 16 0x013E35|$04:$BE25:36 5C ; Moonbrooke Lv 16 0x013E37|$04:$BE27:32 50 ; Midenhall Lv 17 0x013E39|$04:$BE29:02 48 ; Cannock Lv 17 0x013E3B|$04:$BE2B:23 9C ; Moonbrooke Lv 17 0x013E3D|$04:$BE2D:50 30 ; Midenhall Lv 18 0x013E3F|$04:$BE2F:13 33 ; Cannock Lv 18 0x013E41|$04:$BE31:14 89 ; Moonbrooke Lv 18 0x013E43|$04:$BE33:33 40 ; Midenhall Lv 19 0x013E45|$04:$BE35:16 73 ; Cannock Lv 19 0x013E47|$04:$BE37:22 89 ; Moonbrooke Lv 19 0x013E49|$04:$BE39:64 D0 ; Midenhall Lv 20 0x013E4B|$04:$BE3B:23 40 ; Cannock Lv 20 0x013E4D|$04:$BE3D:09 77 ; Moonbrooke Lv 20 0x013E4F|$04:$BE3F:63 60 ; Midenhall Lv 21 0x013E51|$04:$BE41:24 48 ; Cannock Lv 21 0x013E53|$04:$BE43:34 C3 ; Moonbrooke Lv 21 0x013E55|$04:$BE45:66 90 ; Midenhall Lv 22 0x013E57|$04:$BE47:24 41 ; Cannock Lv 22 0x013E59|$04:$BE49:2A 92 ; Moonbrooke Lv 22 0x013E5B|$04:$BE4B:41 90 ; Midenhall Lv 23 0x013E5D|$04:$BE4D:12 86 ; Cannock Lv 23 0x013E5F|$04:$BE4F:47 7B ; Moonbrooke Lv 23 0x013E61|$04:$BE51:34 60 ; Midenhall Lv 24 0x013E63|$04:$BE53:23 74 ; Cannock Lv 24 0x013E65|$04:$BE55:40 57 ; Moonbrooke Lv 24 0x013E67|$04:$BE57:50 90 ; Midenhall Lv 25 0x013E69|$04:$BE59:10 74 ; Cannock Lv 25 0x013E6B|$04:$BE5B:23 15 ; Moonbrooke Lv 25 0x013E6D|$04:$BE5D:43 80 ; Midenhall Lv 26 0x013E6F|$04:$BE5F:23 C0 ; Cannock Lv 26 0x013E71|$04:$BE61:13 49 ; Moonbrooke Lv 26 0x013E73|$04:$BE63:46 B0 ; Midenhall Lv 27 0x013E75|$04:$BE65:18 D3 ; Cannock Lv 27 0x013E77|$04:$BE67:05 17 ; Moonbrooke Lv 27 0x013E79|$04:$BE69:53 A0 ; Midenhall Lv 28 0x013E7B|$04:$BE6B:40 55 ; Cannock Lv 28 0x013E7D|$04:$BE6D:14 15 ; Moonbrooke Lv 28 0x013E7F|$04:$BE6F:44 70 ; Midenhall Lv 29 0x013E81|$04:$BE71:76 96 ; Cannock Lv 29 0x013E83|$04:$BE73:33 71 ; Moonbrooke Lv 29 0x013E85|$04:$BE75:52 30 ; Midenhall Lv 30 0x013E87|$04:$BE77:31 13 ; Cannock Lv 30 0x013E89|$04:$BE79:25 15 ; Moonbrooke Lv 30 0x013E8B|$04:$BE7B:62 50 ; Midenhall Lv 31 0x013E8D|$04:$BE7D:22 64 ; Cannock Lv 31 0x013E8F|$04:$BE7F:62 61 ; Moonbrooke Lv 31 0x013E91|$04:$BE81:31 20 ; Midenhall Lv 32 0x013E93|$04:$BE83:03 13 ; Cannock Lv 32 0x013E95|$04:$BE85:43 21 ; Moonbrooke Lv 32 0x013E97|$04:$BE87:10 80 ; Midenhall Lv 33 0x013E99|$04:$BE89:A2 13 ; Cannock Lv 33 0x013E9B|$04:$BE8B:46 27 ; Moonbrooke Lv 33 0x013E9D|$04:$BE8D:22 20 ; Midenhall Lv 34 0x013E9F|$04:$BE8F:51 22 ; Cannock Lv 34 0x013EA1|$04:$BE91:43 16 ; Moonbrooke Lv 34 0x013EA3|$04:$BE93:12 20 ; Midenhall Lv 35 0x013EA5|$04:$BE95:72 25 ; Cannock Lv 35 0x013EA7|$04:$BE97:A6 95 ; Moonbrooke Lv 35 0x013EA9|$04:$BE99:21 50 ; Midenhall Lv 36 0x013EAB|$04:$BE9B:83 30 ; Cannock Lv 36 0x013EAD|$04:$BE9D:22 30 ; Midenhall Lv 37 0x013EAF|$04:$BE9F:90 33 ; Cannock Lv 37 0x013EB1|$04:$BEA1:32 10 ; Midenhall Lv 38 0x013EB3|$04:$BEA3:64 52 ; Cannock Lv 38 0x013EB5|$04:$BEA5:12 40 ; Midenhall Lv 39 0x013EB7|$04:$BEA7:03 47 ; Cannock Lv 39 0x013EB9|$04:$BEA9:13 ; base offset for equipment power list at $BEEB ; indexed data load target (from $9E5F) 0x013EBA|$04:$BEAA: 10 ; Midenhall Lv 40 0x013EBB|$04:$BEAB:50 23 ; Cannock Lv 40 0x013EBD|$04:$BEAD:22 40 ; Midenhall Lv 41 0x013EBF|$04:$BEAF:25 82 ; Cannock Lv 41 0x013EC1|$04:$BEB1:12 10 ; Midenhall Lv 42 0x013EC3|$04:$BEB3:86 03 ; Cannock Lv 42 0x013EC5|$04:$BEB5:31 40 ; Midenhall Lv 43 0x013EC7|$04:$BEB7:12 44 ; Cannock Lv 43 0x013EC9|$04:$BEB9:12 00 ; Midenhall Lv 44 0x013ECB|$04:$BEBB:45 26 ; Cannock Lv 44 0x013ECD|$04:$BEBD:03 50 ; Midenhall Lv 45 0x013ECF|$04:$BEBF:52 45 ; Cannock Lv 45 0x013ED1|$04:$BEC1:15 10 ; Midenhall Lv 46 0x013ED3|$04:$BEC3:13 10 ; Midenhall Lv 47 0x013ED5|$04:$BEC5:37 70 ; Midenhall Lv 48 0x013ED7|$04:$BEC7:12 60 ; Midenhall Lv 49 0x013ED9|$04:$BEC9:48 50 ; Midenhall Lv 50 ; levels for learning spells ; Cannock level for learning battle spells ; indexed data load target (from $9EB0) 0x013EDB|$04:$BECB:03 ; Spell ID #$01: Firebal 0x013EDC|$04:$BECC:08 ; Spell ID #$06: Stopspell 0x013EDD|$04:$BECD:12 ; Spell ID #$03: Firebane 0x013EDE|$04:$BECE:17 ; Spell ID #$04: Defeat 0x013EDF|$04:$BECF:01 ; Spell ID #$09: Heal 0x013EE0|$04:$BED0:0E ; Spell ID #$0B: Healmore 0x013EE1|$04:$BED1:14 ; Spell ID #$0A: Increase 0x013EE2|$04:$BED2:1C ; Spell ID #$0C: Sacrifice ; Cannock level for learning field spells 0x013EE3|$04:$BED3:01 ; Spell ID #$09: Heal 0x013EE4|$04:$BED4:06 ; Spell ID #$10: Antidote 0x013EE5|$04:$BED5:0A ; Spell ID #$14: Return 0x013EE6|$04:$BED6:0C ; Spell ID #$12: Outside 0x013EE7|$04:$BED7:0E ; Spell ID #$0B: Healmore 0x013EE8|$04:$BED8:11 ; Spell ID #$16: Stepguard 0x013EE9|$04:$BED9:19 ; Spell ID #$17: Revive 0x013EEA|$04:$BEDA:FF ; no spell ; Moonbrooke level for learning battle spells 0x013EEB|$04:$BEDB:02 ; Spell ID #$02: Sleep 0x013EEC|$04:$BEDC:04 ; Spell ID #$05: Infernos 0x013EED|$04:$BEDD:06 ; Spell ID #$07: Surround 0x013EEE|$04:$BEDE:13 ; Spell ID #$0E: Explodet 0x013EEF|$04:$BEDF:01 ; Spell ID #$0B: Healmore 0x013EF0|$04:$BEE0:0A ; Spell ID #$08: Defense 0x013EF1|$04:$BEE1:0F ; Spell ID #$0D: Healall 0x013EF2|$04:$BEE2:19 ; Spell ID #$0F: Chance ; Moonbrooke level for learning field spells 0x013EF3|$04:$BEE3:01 ; Spell ID #$0B: Healmore 0x013EF4|$04:$BEE4:08 ; Spell ID #$13: Repel 0x013EF5|$04:$BEE5:0C ; Spell ID #$10: Antidote 0x013EF6|$04:$BEE6:0F ; Spell ID #$0D: Healall 0x013EF7|$04:$BEE7:11 ; Spell ID #$12: Outside 0x013EF8|$04:$BEE8:15 ; Spell ID #$16: Stepguard 0x013EF9|$04:$BEE9:17 ; Spell ID #$15: Open 0x013EFA|$04:$BEEA:FF ; no spell ; equipment power list ; referenced as $BEAA 0x013EFB|$04:$BEEB:02 ; Item ID #$01: Bamboo Stick 0x013EFC|$04:$BEEC:0C ; Item ID #$02: Magic Knife 0x013EFD|$04:$BEED:08 ; Item ID #$03: Wizard’s Wand 0x013EFE|$04:$BEEE:0F ; Item ID #$04: Staff of Thunder 0x013EFF|$04:$BEEF:08 ; Item ID #$05: Club 0x013F00|$04:$BEF0:0A ; Item ID #$06: Copper Sword 0x013F01|$04:$BEF1:0F ; Item ID #$07: Chain Sickle 0x013F02|$04:$BEF2:14 ; Item ID #$08: Iron Spear 0x013F03|$04:$BEF3:05 ; Item ID #$09: Falcon Sword 0x013F04|$04:$BEF4:1E ; Item ID #$0A: Broad Sword 0x013F05|$04:$BEF5:23 ; Item ID #$0B: Giant Hammer 0x013F06|$04:$BEF6:5D ; Item ID #$0C: Sword of Destruction 0x013F07|$04:$BEF7:32 ; Item ID #$0D: Dragon Killer 0x013F08|$04:$BEF8:41 ; Item ID #$0E: Light Sword 0x013F09|$04:$BEF9:28 ; Item ID #$0F: Sword of Erdrick 0x013F0A|$04:$BEFA:50 ; Item ID #$10: Thunder Sword 0x013F0B|$04:$BEFB:02 ; Item ID #$11: Clothes 0x013F0C|$04:$BEFC:14 ; Item ID #$12: Clothes Hiding 0x013F0D|$04:$BEFD:23 ; Item ID #$13: Water Flying Cloth 0x013F0E|$04:$BEFE:1E ; Item ID #$14: Mink Coat 0x013F0F|$04:$BEFF:06 ; Item ID #$15: Leather Armor 0x013F10|$04:$BF00:0C ; Item ID #$16: Chain Mail 0x013F11|$04:$BF01:32 ; Item ID #$17: Gremlin’s Armor 0x013F12|$04:$BF02:19 ; Item ID #$18: Magic Armor 0x013F13|$04:$BF03:19 ; Item ID #$19: Full Plate Armor 0x013F14|$04:$BF04:23 ; Item ID #$1A: Armor of Gaia 0x013F15|$04:$BF05:28 ; Item ID #$1B: Armor of Erdrick 0x013F16|$04:$BF06:04 ; Item ID #$1C: Leather Shield 0x013F17|$04:$BF07:12 ; Item ID #$1D: Shield of Strength 0x013F18|$04:$BF08:0A ; Item ID #$1E: Steel Shield 0x013F19|$04:$BF09:1E ; Item ID #$1F: Evil Shield 0x013F1A|$04:$BF0A:14 ; Item ID #$20: Shield of Erdrick 0x013F1B|$04:$BF0B:04 ; Item ID #$21: Mysterious Hat 0x013F1C|$04:$BF0C:06 ; Item ID #$22: Iron Helmet 0x013F1D|$04:$BF0D:14 ; Item ID #$23: Helmet of Erdrick ; monster drop rates/items ; indexed data load target (from $97A8) 0x013F1E|$04:$BF0E:FC ; Monster ID #$01: Slime; 1/128 chance for #$3C: Medical Herb 0x013F1F|$04:$BF0F:BC ; Monster ID #$02: Big Slug; 1/32 chance for #$3C: Medical Herb 0x013F20|$04:$BF10:3C ; Monster ID #$03: Iron Ant; 1/8 chance for #$3C: Medical Herb 0x013F21|$04:$BF11:85 ; Monster ID #$04: Drakee; 1/32 chance for #$05: Club 0x013F22|$04:$BF12:3C ; Monster ID #$05: Wild Mouse; 1/8 chance for #$3C: Medical Herb 0x013F23|$04:$BF13:B3 ; Monster ID #$06: Healer; 1/32 chance for #$33: Lottery Ticket 0x013F24|$04:$BF14:51 ; Monster ID #$07: Ghost Mouse; 1/16 chance for #$11: Clothes 0x013F25|$04:$BF15:46 ; Monster ID #$08: Babble; 1/16 chance for #$06: Copper Sword 0x013F26|$04:$BF16:7C ; Monster ID #$09: Army Ant; 1/16 chance for #$3C: Medical Herb 0x013F27|$04:$BF17:01 ; Monster ID #$0A: Magician; 1/8 chance for #$01: Bamboo Stick 0x013F28|$04:$BF18:75 ; Monster ID #$0B: Big Rat; 1/16 chance for #$35: Wing of the Wyvern 0x013F29|$04:$BF19:3B ; Monster ID #$0C: Big Cobra; 1/8 chance for #$3B: Antidote Herb 0x013F2A|$04:$BF1A:33 ; Monster ID #$0D: Magic Ant; 1/8 chance for #$33: Lottery Ticket 0x013F2B|$04:$BF1B:45 ; Monster ID #$0E: Magidrakee; 1/16 chance for #$05: Club 0x013F2C|$04:$BF1C:55 ; Monster ID #$0F: Centipod; 1/16 chance for #$15: Leather Armor 0x013F2D|$04:$BF1D:B5 ; Monster ID #$10: Man O’ War; 1/32 chance for #$35: Wing of the Wyvern 0x013F2E|$04:$BF1E:33 ; Monster ID #$11: Lizard Fly; 1/8 chance for #$33: Lottery Ticket 0x013F2F|$04:$BF1F:55 ; Monster ID #$12: Zombie; 1/16 chance for #$15: Leather Armor 0x013F30|$04:$BF20:51 ; Monster ID #$13: Smoke; 1/16 chance for #$11: Clothes 0x013F31|$04:$BF21:3C ; Monster ID #$14: Ghost Rat; 1/8 chance for #$3C: Medical Herb 0x013F32|$04:$BF22:45 ; Monster ID #$15: Baboon; 1/16 chance for #$05: Club 0x013F33|$04:$BF23:73 ; Monster ID #$16: Carnivog; 1/16 chance for #$33: Lottery Ticket 0x013F34|$04:$BF24:1C ; Monster ID #$17: Megapede; 1/8 chance for #$1C: Leather Shield 0x013F35|$04:$BF25:86 ; Monster ID #$18: Sea Slug; 1/32 chance for #$06: Copper Sword 0x013F36|$04:$BF26:7B ; Monster ID #$19: Medusa Ball; 1/16 chance for #$3B: Antidote Herb 0x013F37|$04:$BF27:70 ; Monster ID #$1A: Enchanter; 1/16 chance for #$30: Dragon’s Bane 0x013F38|$04:$BF28:74 ; Monster ID #$1B: Mud Man; 1/16 chance for #$34: Fairy Water 0x013F39|$04:$BF29:7C ; Monster ID #$1C: Magic Baboon; 1/16 chance for #$3C: Medical Herb 0x013F3A|$04:$BF2A:47 ; Monster ID #$1D: Demighost; 1/16 chance for #$07: Chain Sickle 0x013F3B|$04:$BF2B:75 ; Monster ID #$1E: Gremlin; 1/16 chance for #$35: Wing of the Wyvern 0x013F3C|$04:$BF2C:7B ; Monster ID #$1F: Poison Lily; 1/16 chance for #$3B: Antidote Herb 0x013F3D|$04:$BF2D:11 ; Monster ID #$20: Mummy Man; 1/8 chance for #$11: Clothes 0x013F3E|$04:$BF2E:74 ; Monster ID #$21: Gorgon; 1/16 chance for #$34: Fairy Water 0x013F3F|$04:$BF2F:46 ; Monster ID #$22: Saber Tiger; 1/16 chance for #$06: Copper Sword 0x013F40|$04:$BF30:70 ; Monster ID #$23: Dragon Fly; 1/16 chance for #$30: Dragon’s Bane 0x013F41|$04:$BF31:83 ; Monster ID #$24: Titan Tree; 1/32 chance for #$03: Wizard’s Wand 0x013F42|$04:$BF32:73 ; Monster ID #$25: Undead; 1/16 chance for #$33: Lottery Ticket 0x013F43|$04:$BF33:74 ; Monster ID #$26: Basilisk; 1/16 chance for #$34: Fairy Water 0x013F44|$04:$BF34:FD ; Monster ID #$27: Goopi; 1/128 chance for #$3D: Wizard’s Ring 0x013F45|$04:$BF35:48 ; Monster ID #$28: Orc; 1/16 chance for #$08: Iron Spear 0x013F46|$04:$BF36:FD ; Monster ID #$29: Puppet Man; 1/128 chance for #$3D: Wizard’s Ring 0x013F47|$04:$BF37:91 ; Monster ID #$2A: Mummy; 1/32 chance for #$11: Clothes 0x013F48|$04:$BF38:34 ; Monster ID #$2B: Evil Tree; 1/8 chance for #$34: Fairy Water 0x013F49|$04:$BF39:92 ; Monster ID #$2C: Gas; 1/32 chance for #$12: Clothes Hiding 0x013F4A|$04:$BF3A:FD ; Monster ID #$2D: Hork; 1/128 chance for #$3D: Wizard’s Ring 0x013F4B|$04:$BF3B:AF ; Monster ID #$2E: Hawk Man; 1/32 chance for #$2F: Gremlin’s Tail 0x013F4C|$04:$BF3C:52 ; Monster ID #$2F: Sorcerer; 1/16 chance for #$12: Clothes Hiding 0x013F4D|$04:$BF3D:62 ; Monster ID #$30: Metal Slime; 1/16 chance for #$22: Iron Helmet 0x013F4E|$04:$BF3E:48 ; Monster ID #$31: Hunter; 1/16 chance for #$08: Iron Spear 0x013F4F|$04:$BF3F:99 ; Monster ID #$32: Evil Eye; 1/32 chance for #$19: Full Plate Armor 0x013F50|$04:$BF40:16 ; Monster ID #$33: Hibabango; 1/8 chance for #$16: Chain Mail 0x013F51|$04:$BF41:06 ; Monster ID #$34: Graboopi; 1/8 chance for #$06: Copper Sword 0x013F52|$04:$BF42:B0 ; Monster ID #$35: Gold Orc; 1/32 chance for #$30: Dragon’s Bane 0x013F53|$04:$BF43:43 ; Monster ID #$36: Evil Clown; 1/16 chance for #$03: Wizard’s Wand 0x013F54|$04:$BF44:07 ; Monster ID #$37: Ghoul; 1/8 chance for #$07: Chain Sickle 0x013F55|$04:$BF45:75 ; Monster ID #$38: Vampirus; 1/16 chance for #$35: Wing of the Wyvern 0x013F56|$04:$BF46:DF ; Monster ID #$39: Mega Knight; 1/128 chance for #$1F: Evil Shield 0x013F57|$04:$BF47:48 ; Monster ID #$3A: Saber Lion; 1/16 chance for #$08: Iron Spear 0x013F58|$04:$BF48:4A ; Monster ID #$3B: Metal Hunter; 1/16 chance for #$0A: Broad Sword 0x013F59|$04:$BF49:6F ; Monster ID #$3C: Ozwarg; 1/16 chance for #$2F: Gremlin’s Tail 0x013F5A|$04:$BF4A:9F ; Monster ID #$3D: Dark Eye; 1/32 chance for #$1F: Evil Shield 0x013F5B|$04:$BF4B:22 ; Monster ID #$3E: Gargoyle; 1/8 chance for #$22: Iron Helmet 0x013F5C|$04:$BF4C:33 ; Monster ID #$3F: Orc King; 1/8 chance for #$33: Lottery Ticket 0x013F5D|$04:$BF4D:E1 ; Monster ID #$40: Magic Vampirus; 1/128 chance for #$21: Mysterious Hat 0x013F5E|$04:$BF4E:4B ; Monster ID #$41: Berserker; 1/16 chance for #$0B: Giant Hammer 0x013F5F|$04:$BF4F:31 ; Monster ID #$42: Metal Babble; 1/8 chance for #$31: Dragon’s Potion 0x013F60|$04:$BF50:D0 ; Monster ID #$43: Hargon’s Knight; 1/128 chance for #$10: Thunder Sword 0x013F61|$04:$BF51:B0 ; Monster ID #$44: Cyclops; 1/32 chance for #$30: Dragon’s Bane 0x013F62|$04:$BF52:5E ; Monster ID #$45: Attackbot; 1/16 chance for #$1E: Steel Shield 0x013F63|$04:$BF53:8C ; Monster ID #$46: Green Dragon; 1/32 chance for #$0C: Sword of Destruction 0x013F64|$04:$BF54:84 ; Monster ID #$47: Mace Master; 1/32 chance for #$04: Staff of Thunder 0x013F65|$04:$BF55:98 ; Monster ID #$48: Flame; 1/32 chance for #$18: Magic Armor 0x013F66|$04:$BF56:4D ; Monster ID #$49: Silver Batboon; 1/16 chance for #$0D: Dragon Killer 0x013F67|$04:$BF57:43 ; Monster ID #$4A: Blizzard; 1/16 chance for #$03: Wizard’s Wand 0x013F68|$04:$BF58:0C ; Monster ID #$4B: Giant; 1/8 chance for #$0C: Sword of Destruction 0x013F69|$04:$BF59:97 ; Monster ID #$4C: Gold Batboon; 1/32 chance for #$17: Gremlin’s Armor 0x013F6A|$04:$BF5A:BD ; Monster ID #$4D: Bullwong; 1/32 chance for #$3D: Wizard’s Ring 0x013F6B|$04:$BF5B:CC ; Monster ID #$4E: Atlas; 1/128 chance for #$0C: Sword of Destruction 0x013F6C|$04:$BF5C:E1 ; Monster ID #$4F: Bazuzu; 1/128 chance for #$21: Mysterious Hat 0x013F6D|$04:$BF5D:44 ; Monster ID #$50: Zarlox; 1/16 chance for #$04: Staff of Thunder 0x013F6E|$04:$BF5E:E1 ; Monster ID #$51: Hargon; 1/128 chance for #$21: Mysterious Hat (too bad earlier code says Hargon and Malroth get no drops) 0x013F6F|$04:$BF5F:00 ; Monster ID #$52: Malroth; No Drop ; data -> free 0x013F70|$04:$BF60:FF ; ... skipping $76 FF bytes 0x013FE7|$04:$BFD7:FF ; free -> unknown 0x013FE8|$04:$BFD8:78 ; SEI 0x013FE9|$04:$BFD9:EE DF BF ; INC $BFDF 0x013FEA|$04:$BFDA:DF ; INVALID OPCODE 0x013FEB|$04:$BFDB:BF ; INVALID OPCODE 0x013FEC|$04:$BFDC:4C 86 FF ; JMP $FF86 0x013FED|$04:$BFDD:86 FF ; STX $FF 0x013FEE|$04:$BFDE:FF ; INVALID OPCODE 0x013FEF|$04:$BFDF:80 ; INVALID OPCODE 0x013FF0|$04:$BFE0:44 ; INVALID OPCODE 0x013FF1|$04:$BFE1:52 ; INVALID OPCODE 0x013FF2|$04:$BFE2:41 47 ; EOR ($47,X) 0x013FF3|$04:$BFE3:47 ; INVALID OPCODE 0x013FF4|$04:$BFE4:4F ; INVALID OPCODE 0x013FF5|$04:$BFE5:4E 20 57 ; LSR $5720 0x013FF6|$04:$BFE6:20 57 41 ; JSR $4157 0x013FF7|$04:$BFE7:57 ; INVALID OPCODE 0x013FF8|$04:$BFE8:41 52 ; EOR ($52,X) 0x013FF9|$04:$BFE9:52 ; INVALID OPCODE 0x013FFA|$04:$BFEA:52 ; INVALID OPCODE 0x013FFB|$04:$BFEB:49 4F ; EOR #$4F 0x013FFC|$04:$BFEC:4F ; INVALID OPCODE 0x013FFD|$04:$BFED:52 ; INVALID OPCODE 0x013FFE|$04:$BFEE:53 ; INVALID OPCODE 0x013FFF|$04:$BFEF:32 ; INVALID OPCODE 0x014000|$04:$BFF0:FF ; INVALID OPCODE 0x014001|$04:$BFF1:FF ; INVALID OPCODE 0x014002|$04:$BFF2:00 ; BRK 0x014003|$04:$BFF3:00 ; BRK 0x014004|$04:$BFF4:48 ; PHA 0x014005|$04:$BFF5:04 ; INVALID OPCODE 0x014006|$04:$BFF6:01 0F ; ORA ($0F,X) 0x014007|$04:$BFF7:0F ; INVALID OPCODE 0x014008|$04:$BFF8:07 ; INVALID OPCODE 0x014009|$04:$BFF9:9D D8 BF ; STA $BFD8,X 0x01400A|$04:$BFFA:D8 ; CLD 0x01400B|$04:$BFFB:BF ; INVALID OPCODE 0x01400C|$04:$BFFC:D8 ; CLD 0x01400D|$04:$BFFD:BF ; INVALID OPCODE 0x01400E|$04:$BFFE:D8 ; CLD ; unknown -> data 0x01400F|$04:$BFFF:BF