Difference between revisions of "Dragon Warrior II::ROM map/ASM bank 0F"

From Data Crystal
Jump to: navigation, search
(Created page with " ; bank 0x0F of 16 starts at file address 0x03C010 ; code bytes: $3C56 (94.27% of bytes in this ROM bank) ; data bytes: $035F (5.27% of bytes in this ROM bank) ; pcm bytes:...")
 
(No difference)

Latest revision as of 14:57, 7 July 2019

; bank 0x0F of 16 starts at file address 0x03C010
; code bytes:	$3C56 (94.27% of bytes in this ROM bank)
; data bytes:	$035F (5.27% 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:	$0023 (0.21% of bytes in this ROM bank)
; unknown bytes:	$002A (0.26% of bytes in this ROM bank)
; $003B bytes last seen in RAM bank $8000 - $BFFF (0.36% of bytes seen in this ROM bank, 0.36% of bytes in this ROM bank):
;	$002E code bytes (77.97% of bytes seen in this RAM bank, 0.28% of bytes in this ROM bank)
;	$000D data bytes (22.03% of bytes seen in this RAM bank, 0.08% of bytes in this ROM bank)
; $3F78 bytes last seen in RAM bank $C000 - $FFFF (99.64% of bytes seen in this ROM bank, 99.17% of bytes in this ROM bank):
;	$3C28 code bytes (94.78% of bytes seen in this RAM bank, 93.99% of bytes in this ROM bank)
;	$0352 data bytes (5.23% of bytes seen in this RAM bank, 5.19% of bytes in this ROM bank)

; PRG Bank 0x0F: the fixed bank, contains a little bit of everything

; [bank start] -> code
; NMI vector
; indirect control flow target (via $FFFA)
0x03C010|$0F:$C000:78      	SEI        
0x03C011|$0F:$C001:48      	PHA        
0x03C012|$0F:$C002:98      	TYA        
0x03C013|$0F:$C003:48      	PHA        
0x03C014|$0F:$C004:8A      	TXA        
0x03C015|$0F:$C005:48      	PHA        
0x03C016|$0F:$C006:AD 07 60	LDA $6007  
0x03C019|$0F:$C009:D0 0A   	BNE $C015  
0x03C01B|$0F:$C00B:A5 93   	LDA $93    	; NMI counter, decremented once per NMI until it reaches 0
0x03C01D|$0F:$C00D:F0 02   	BEQ $C011  
0x03C01F|$0F:$C00F:C6 93   	DEC $93    	; NMI counter, decremented once per NMI until it reaches 0
; control flow target (from $C00D)
0x03C021|$0F:$C011:A4 00   	LDY $00    
0x03C023|$0F:$C013:10 03   	BPL $C018  
; control flow target (from $C009)
0x03C025|$0F:$C015:4C C3 C0	JMP $C0C3  

; control flow target (from $C013)
0x03C028|$0F:$C018:AD 45 61	LDA $6145  
0x03C02B|$0F:$C01B:10 03   	BPL $C020  
0x03C02D|$0F:$C01D:4C 48 C1	JMP $C148  

; control flow target (from $C01B)
0x03C030|$0F:$C020:A4 00   	LDY $00    
0x03C032|$0F:$C022:F0 5C   	BEQ $C080  
0x03C034|$0F:$C024:88      	DEY        
0x03C035|$0F:$C025:F0 59   	BEQ $C080  
0x03C037|$0F:$C027:88      	DEY        
; control flow target (from $C07C)
0x03C038|$0F:$C028:B9 38 C1	LDA $C138,Y
0x03C03B|$0F:$C02B:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C03E|$0F:$C02E:C8      	INY        
0x03C03F|$0F:$C02F:B9 38 C1	LDA $C138,Y
0x03C042|$0F:$C032:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C045|$0F:$C035:C8      	INY        
0x03C046|$0F:$C036:A9 5F   	LDA #$5F   
0x03C048|$0F:$C038:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C04B|$0F:$C03B:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C04E|$0F:$C03E:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C051|$0F:$C041:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C054|$0F:$C044:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C057|$0F:$C047:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C05A|$0F:$C04A:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C05D|$0F:$C04D:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C060|$0F:$C050:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C063|$0F:$C053:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C066|$0F:$C056:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C069|$0F:$C059:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C06C|$0F:$C05C:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C06F|$0F:$C05F:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C072|$0F:$C062:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C075|$0F:$C065:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C078|$0F:$C068:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C07B|$0F:$C06B:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C07E|$0F:$C06E:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C081|$0F:$C071:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C084|$0F:$C074:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C087|$0F:$C077:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C08A|$0F:$C07A:C0 10   	CPY #$10   
0x03C08C|$0F:$C07C:D0 AA   	BNE $C028  
0x03C08E|$0F:$C07E:F0 31   	BEQ $C0B1  
; control flow target (from $C022, $C025)
0x03C090|$0F:$C080:AD 83 01	LDA $0183  
0x03C093|$0F:$C083:F0 03   	BEQ $C088  
0x03C095|$0F:$C085:4C A0 C1	JMP $C1A0  

; control flow target (from $C083)
0x03C098|$0F:$C088:A5 02   	LDA $02    
0x03C09A|$0F:$C08A:C9 18   	CMP #$18   
0x03C09C|$0F:$C08C:B0 05   	BCS $C093  
0x03C09E|$0F:$C08E:A9 02   	LDA #$02   
0x03C0A0|$0F:$C090:8D 14 40	STA $4014  	; Sprite DMA Register (copy $100 bytes from $100 * N)
; control flow target (from $C08C)
0x03C0A3|$0F:$C093:A2 00   	LDX #$00   
; control flow target (from $C0AE)
0x03C0A5|$0F:$C095:E4 02   	CPX $02    
0x03C0A7|$0F:$C097:F0 18   	BEQ $C0B1  
0x03C0A9|$0F:$C099:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C0AC|$0F:$C09C:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C0AF|$0F:$C09F:E8      	INX        
0x03C0B0|$0F:$C0A0:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C0B3|$0F:$C0A3:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C0B6|$0F:$C0A6:E8      	INX        
0x03C0B7|$0F:$C0A7:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C0BA|$0F:$C0AA:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C0BD|$0F:$C0AD:E8      	INX        
0x03C0BE|$0F:$C0AE:4C 95 C0	JMP $C095  

; control flow target (from $C07E, $C097, $C19D, $C1D9)
0x03C0C1|$0F:$C0B1:A9 00   	LDA #$00   
0x03C0C3|$0F:$C0B3:85 01   	STA $01    
0x03C0C5|$0F:$C0B5:85 02   	STA $02    
0x03C0C7|$0F:$C0B7:8D 83 01	STA $0183  
0x03C0CA|$0F:$C0BA:20 03 C1	JSR $C103  
0x03C0CD|$0F:$C0BD:A9 00   	LDA #$00   
0x03C0CF|$0F:$C0BF:85 00   	STA $00    
0x03C0D1|$0F:$C0C1:E6 03   	INC $03    	; game clock?
; control flow target (from $C015)
0x03C0D3|$0F:$C0C3:20 0B C6	JSR $C60B  	; initialize MMC control mode and CHR banks
0x03C0D6|$0F:$C0C6:A9 03   	LDA #$03   
0x03C0D8|$0F:$C0C8:20 D8 C3	JSR $C3D8  	; CLI and load bank specified by A
; call to code in a different bank ($03:$8000)
0x03C0DB|$0F:$C0CB:20 00 80	JSR $8000  
0x03C0DE|$0F:$C0CE:AD F6 05	LDA $05F6  	; current bank
0x03C0E1|$0F:$C0D1:20 D8 C3	JSR $C3D8  	; CLI and load bank specified by A
0x03C0E4|$0F:$C0D4:BA      	TSX        
; ummm... skipping X/Y/A on stack, if second caller is $FFC0 - $FFD4 inclusive, mess around with stack, pull X/Y/A, clobber A with current bank, and RTI
; else pull X/Y/A and RTI
0x03C0E5|$0F:$C0D5:BD 06 01	LDA $0106,X
0x03C0E8|$0F:$C0D8:C9 FF   	CMP #$FF   
0x03C0EA|$0F:$C0DA:D0 21   	BNE $C0FD  
0x03C0EC|$0F:$C0DC:BD 05 01	LDA $0105,X
0x03C0EF|$0F:$C0DF:C9 C0   	CMP #$C0   
0x03C0F1|$0F:$C0E1:90 1A   	BCC $C0FD  
0x03C0F3|$0F:$C0E3:C9 D5   	CMP #$D5   
0x03C0F5|$0F:$C0E5:B0 16   	BCS $C0FD  
0x03C0F7|$0F:$C0E7:A9 04   	LDA #$04   
0x03C0F9|$0F:$C0E9:1D 04 01	ORA $0104,X
0x03C0FC|$0F:$C0EC:9D 04 01	STA $0104,X
0x03C0FF|$0F:$C0EF:A9 C0   	LDA #$C0   
0x03C101|$0F:$C0F1:9D 05 01	STA $0105,X
0x03C104|$0F:$C0F4:68      	PLA        
0x03C105|$0F:$C0F5:AA      	TAX        
0x03C106|$0F:$C0F6:68      	PLA        
0x03C107|$0F:$C0F7:A8      	TAY        
0x03C108|$0F:$C0F8:68      	PLA        
0x03C109|$0F:$C0F9:AD F6 05	LDA $05F6  	; current bank
0x03C10C|$0F:$C0FC:40      	RTI        

; control flow target (from $C0DA, $C0E1, $C0E5)
0x03C10D|$0F:$C0FD:68      	PLA        
0x03C10E|$0F:$C0FE:AA      	TAX        
0x03C10F|$0F:$C0FF:68      	PLA        
0x03C110|$0F:$C100:A8      	TAY        
0x03C111|$0F:$C101:68      	PLA        
0x03C112|$0F:$C102:40      	RTI        

; control flow target (from $C0BA)
0x03C113|$0F:$C103:A9 3F   	LDA #$3F   
0x03C115|$0F:$C105:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C118|$0F:$C108:A9 00   	LDA #$00   
0x03C11A|$0F:$C10A:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C11D|$0F:$C10D:A5 30   	LDA $30    
0x03C11F|$0F:$C10F:29 0F   	AND #$0F   
0x03C121|$0F:$C111:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C124|$0F:$C114:A9 00   	LDA #$00   
0x03C126|$0F:$C116:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C129|$0F:$C119:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C12C|$0F:$C11C:A5 04   	LDA $04    
0x03C12E|$0F:$C11E:D0 05   	BNE $C125  
0x03C130|$0F:$C120:AD AE 61	LDA $61AE  
0x03C133|$0F:$C123:D0 03   	BNE $C128  
; control flow target (from $C11E)
0x03C135|$0F:$C125:AD AF 61	LDA $61AF  
; control flow target (from $C123)
0x03C138|$0F:$C128:09 80   	ORA #$80   
0x03C13A|$0F:$C12A:8D 00 20	STA $2000  	; PPU Control Register #1 (#$80: Execute NMI on VBlank, #$40: unused, #$20: Sprite Size [8x8/8x16], #$10: Background Pattern Table Address [$0000/$1000], #$08: Sprite Pattern Table Address [$0000/$1000], #$04: PPU Address Increment [1/32], #$03: Name Table Address [$2000/$2400/$2800/$2C00])
0x03C13D|$0F:$C12D:A5 05   	LDA $05    
0x03C13F|$0F:$C12F:8D 05 20	STA $2005  	; VRAM Address Register #1 (write twice; BG scroll)
0x03C142|$0F:$C132:A5 06   	LDA $06    
0x03C144|$0F:$C134:8D 05 20	STA $2005  	; VRAM Address Register #1 (write twice; BG scroll)
0x03C147|$0F:$C137:60      	RTS        


; code -> data
; PPU addresses
; indexed data load target (from $C028, $C02F)
0x03C148|$0F:$C138:22 65
0x03C14A|$0F:$C13A:22 85
0x03C14C|$0F:$C13C:22 A5
0x03C14E|$0F:$C13E:22 C5
0x03C150|$0F:$C140:22 E5
0x03C152|$0F:$C142:23 05
0x03C154|$0F:$C144:23 25
0x03C156|$0F:$C146:23 45

; data -> code
; control flow target (from $C01D)
0x03C158|$0F:$C148:A2 00   	LDX #$00   
0x03C15A|$0F:$C14A:A4 01   	LDY $01    
0x03C15C|$0F:$C14C:F0 4C   	BEQ $C19A  
; control flow target (from $C198)
0x03C15E|$0F:$C14E:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C161|$0F:$C151:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C164|$0F:$C154:BD 01 03	LDA $0301,X
0x03C167|$0F:$C157:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C16A|$0F:$C15A:BD 02 03	LDA $0302,X
0x03C16D|$0F:$C15D:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C170|$0F:$C160:BD 03 03	LDA $0303,X
0x03C173|$0F:$C163:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C176|$0F:$C166:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C179|$0F:$C169:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C17C|$0F:$C16C:BD 01 03	LDA $0301,X
0x03C17F|$0F:$C16F:09 20   	ORA #$20   
0x03C181|$0F:$C171:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C184|$0F:$C174:BD 04 03	LDA $0304,X
0x03C187|$0F:$C177:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C18A|$0F:$C17A:BD 05 03	LDA $0305,X
0x03C18D|$0F:$C17D:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C190|$0F:$C180:BD 06 03	LDA $0306,X
0x03C193|$0F:$C183:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C196|$0F:$C186:BD 07 03	LDA $0307,X
0x03C199|$0F:$C189:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C19C|$0F:$C18C:BD 08 03	LDA $0308,X
0x03C19F|$0F:$C18F:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C1A2|$0F:$C192:8A      	TXA        
0x03C1A3|$0F:$C193:18      	CLC        
0x03C1A4|$0F:$C194:69 09   	ADC #$09   
0x03C1A6|$0F:$C196:AA      	TAX        
0x03C1A7|$0F:$C197:88      	DEY        
0x03C1A8|$0F:$C198:D0 B4   	BNE $C14E  
; control flow target (from $C14C)
0x03C1AA|$0F:$C19A:8C 45 61	STY $6145  
0x03C1AD|$0F:$C19D:4C B1 C0	JMP $C0B1  

; control flow target (from $C085)
0x03C1B0|$0F:$C1A0:A2 00   	LDX #$00   
0x03C1B2|$0F:$C1A2:AD 02 20	LDA $2002  	; PPU Status Register (#$80: In VBlank, #$40: Sprite #0 Hit, #$20: Scanline Sprite Count > 8, #$10: Ignore VRAM Writes); after read, #$80 and $2005-$2006 are reset
0x03C1B5|$0F:$C1A5:A5 02   	LDA $02    
0x03C1B7|$0F:$C1A7:F0 26   	BEQ $C1CF  
; control flow target (from $C1CD)
0x03C1B9|$0F:$C1A9:A0 01   	LDY #$01   
0x03C1BB|$0F:$C1AB:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C1BE|$0F:$C1AE:10 04   	BPL $C1B4  
0x03C1C0|$0F:$C1B0:E8      	INX        
0x03C1C1|$0F:$C1B1:BC 00 03	LDY $0300,X	; PPU write buffer start
; control flow target (from $C1AE)
0x03C1C4|$0F:$C1B4:E8      	INX        
0x03C1C5|$0F:$C1B5:29 3F   	AND #$3F   
0x03C1C7|$0F:$C1B7:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C1CA|$0F:$C1BA:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C1CD|$0F:$C1BD:E8      	INX        
0x03C1CE|$0F:$C1BE:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
; control flow target (from $C1C9)
0x03C1D1|$0F:$C1C1:BD 00 03	LDA $0300,X	; PPU write buffer start
0x03C1D4|$0F:$C1C4:E8      	INX        
0x03C1D5|$0F:$C1C5:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C1D8|$0F:$C1C8:88      	DEY        
0x03C1D9|$0F:$C1C9:D0 F6   	BNE $C1C1  
0x03C1DB|$0F:$C1CB:C6 01   	DEC $01    
0x03C1DD|$0F:$C1CD:D0 DA   	BNE $C1A9  
; control flow target (from $C1A7)
0x03C1DF|$0F:$C1CF:AD 08 60	LDA $6008  
0x03C1E2|$0F:$C1D2:D0 05   	BNE $C1D9  
0x03C1E4|$0F:$C1D4:A9 02   	LDA #$02   
0x03C1E6|$0F:$C1D6:8D 14 40	STA $4014  	; Sprite DMA Register (copy $100 bytes from $100 * N)
; control flow target (from $C1D2)
0x03C1E9|$0F:$C1D9:4C B1 C0	JMP $C0B1  

; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $C1EE, $C22C, $C23F, $C30A, $C3E8, $C421, $C465, $C595, $C67D, $C747, $C7EC, $C975, $C9A8, $CCD9, $CFA5, $D0E2, $D13D, $D317, $D48C, $D65B, $D6EE, $D72B, $D73F, $E2B8, $E2CE, $E5EC, $E609, $E660, $E69D, $E6D6, $E6EC, $E719, $E743, $E764, $E7B7, $E7EA, $E817, $E841, $E862, $E972, $E980, $E9F9, $EB6D, $F476, $F862, $F868, $FB05, $FD08, $FD9C)
; external control flow target (from $00:$803C, $00:$807B, $00:$8328, $00:$83A4, $00:$B783, $00:$B80A, $00:$B822, $00:$B95C, $02:$AB9B, $02:$B1FA, $02:$B717, $04:$8CE9, $04:$8D9B, $04:$8DE1, $04:$8E02, $04:$8E05, $04:$8E3F, $04:$8E9A, $04:$8EAE, $04:$8EB1, $04:$8FE7, $04:$902C, $04:$909B, $04:$90B7, $04:$99F9, $04:$9A39, $06:$8048, $06:$8905, $06:$8929, $06:$895F, $06:$8988, $06:$A262, $06:$A270, $06:$A273, $06:$A617, $06:$A620, $06:$A984, $06:$AF9B, $06:$B21B, $07:$81C3, $07:$8654, $07:$86E5, $07:$8715, $07:$8908, $07:$89BD, $07:$89CF, $08:$804F, $08:$8296, $08:$832E, $09:$802D, $09:$8070, $09:$8098, $09:$80CC, $09:$80DD, $09:$82A0, $09:$82EA, $09:$82ED, $09:$8310, $09:$8313, $09:$9E19, $09:$9EFB, $09:$9F59, $09:$9F95, $09:$9FFC, $09:$A02E, $09:$A03F, $09:$A07D, $09:$A0F3, $0A:$8049, $0A:$81DF)
0x03C1EC|$0F:$C1DC:A9 00   	LDA #$00   
0x03C1EE|$0F:$C1DE:8D 07 60	STA $6007  
0x03C1F1|$0F:$C1E1:A9 01   	LDA #$01   
0x03C1F3|$0F:$C1E3:85 00   	STA $00    
; control flow target (from $C1E7)
0x03C1F5|$0F:$C1E5:A5 00   	LDA $00    
0x03C1F7|$0F:$C1E7:D0 FC   	BNE $C1E5  
0x03C1F9|$0F:$C1E9:A9 FF   	LDA #$FF   
0x03C1FB|$0F:$C1EB:85 00   	STA $00    
0x03C1FD|$0F:$C1ED:60      	RTS        

; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; control flow target (from $C1F2, $C329, $C520, $C592, $C5A5, $C6A5, $C82C, $C83B, $CAE6, $CC4A, $CD74, $CD83, $D0F9, $D5D7, $FC3A)
; external control flow target (from $00:$B7B5, $00:$B8BF, $04:$9019, $06:$824C, $06:$8A57, $06:$8B01, $06:$96AD, $06:$96C0, $06:$970E, $06:$97CB, $06:$98F5, $06:$9941, $06:$A2EB, $06:$A316, $06:$BBEC, $06:$BC3A, $06:$BC88, $06:$BD1E, $06:$BD76, $06:$BD86, $06:$BD93, $07:$81CB, $07:$81F0, $07:$81F9, $07:$85C8, $07:$863F, $07:$866D, $07:$8672, $07:$867A, $07:$867F, $07:$898F, $09:$8002, $09:$80A4, $09:$80D7, $09:$9E13, $09:$9E4C, $09:$9E5B, $09:$9E62, $09:$9F44, $09:$9FDC, $0A:$801C, $0A:$8024, $0A:$8038)
0x03C1FE|$0F:$C1EE:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C201|$0F:$C1F1:CA      	DEX        
0x03C202|$0F:$C1F2:D0 FA   	BNE $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03C204|$0F:$C1F4:60      	RTS        

; wait for battle message delay to expire
; control flow target (from $C1F7)
; external control flow target (from $04:$9A13)
0x03C205|$0F:$C1F5:A5 93   	LDA $93    	; NMI counter, decremented once per NMI until it reaches 0
0x03C207|$0F:$C1F7:D0 FC   	BNE $C1F5  	; wait for battle message delay to expire
0x03C209|$0F:$C1F9:60      	RTS        

; 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
; control flow target (from $C1FE, $C2C9, $D65E, $D661, $D66F, $D672, $DEBA, $DED7, $DEE7, $DF03, $DF14, $DF3D, $FD26, $FD99)
; external control flow target (from $00:$83AC, $00:$B95F, $02:$B74F, $04:$8D92, $04:$8DD8, $04:$8E91, $04:$909E, $04:$9A36, $06:$8996, $06:$AF73, $06:$B0A9, $07:$897A, $07:$8A90, $09:$8089, $09:$81ED)
0x03C20A|$0F:$C1FA:A6 02   	LDX $02    
0x03C20C|$0F:$C1FC:E0 C0   	CPX #$C0   
0x03C20E|$0F:$C1FE:F0 FA   	BEQ $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; wait for $02 to not be #$C0
0x03C210|$0F:$C200:A5 08   	LDA $08    	; PPU address, high byte
0x03C212|$0F:$C202:9D 00 03	STA $0300,X	; PPU write buffer start
0x03C215|$0F:$C205:E8      	INX        
0x03C216|$0F:$C206:A5 07   	LDA $07    	; PPU address, low byte
0x03C218|$0F:$C208:9D 00 03	STA $0300,X	; PPU write buffer start
0x03C21B|$0F:$C20B:E8      	INX        
0x03C21C|$0F:$C20C:A5 09   	LDA $09    	; PPU tile ID
0x03C21E|$0F:$C20E:9D 00 03	STA $0300,X	; PPU write buffer start
0x03C221|$0F:$C211:E8      	INX        
0x03C222|$0F:$C212:E6 01   	INC $01    
0x03C224|$0F:$C214:86 02   	STX $02    
0x03C226|$0F:$C216:E6 07   	INC $07    	; INC 16-bit PPU address $07-$08
0x03C228|$0F:$C218:D0 02   	BNE $C21C  
0x03C22A|$0F:$C21A:E6 08   	INC $08    
; control flow target (from $C218)
0x03C22C|$0F:$C21C:48      	PHA        
0x03C22D|$0F:$C21D:A9 00   	LDA #$00   
0x03C22F|$0F:$C21F:8D 83 01	STA $0183  
0x03C232|$0F:$C222:68      	PLA        
0x03C233|$0F:$C223:60      	RTS        

; control flow target (from $C315)
0x03C234|$0F:$C224:A9 10   	LDA #$10   
0x03C236|$0F:$C226:D0 24   	BNE $C24C  
; control flow target (from $C324)
; external control flow target (from $06:$A284, $07:$8668)
0x03C238|$0F:$C228:A9 00   	LDA #$00   
0x03C23A|$0F:$C22A:F0 20   	BEQ $C24C  
; external control flow target (from $00:$B92E, $04:$8738, $04:$90D1, $04:$90D7, $04:$A0F5, $06:$866C, $06:$8BF0, $06:$8CC5, $06:$9431, $06:$951F, $06:$95F6, $06:$A1ED, $06:$AEB4, $06:$BD53)
0x03C23C|$0F:$C22C:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C23F|$0F:$C22F:A9 00   	LDA #$00   
0x03C241|$0F:$C231:85 0C   	STA $0C    
0x03C243|$0F:$C233:A2 02   	LDX #$02   
0x03C245|$0F:$C235:20 42 C2	JSR $C242  
0x03C248|$0F:$C238:A2 00   	LDX #$00   
0x03C24A|$0F:$C23A:A9 10   	LDA #$10   
0x03C24C|$0F:$C23C:20 42 C2	JSR $C242  
0x03C24F|$0F:$C23F:4C DC C1	JMP $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF

; control flow target (from $C235, $C23C)
0x03C252|$0F:$C242:BC E7 C2	LDY $C2E7,X
0x03C255|$0F:$C245:84 0A   	STY $0A    
0x03C257|$0F:$C247:BC E8 C2	LDY $C2E8,X
0x03C25A|$0F:$C24A:84 0B   	STY $0B    
; control flow target (from $C226, $C22A)
0x03C25C|$0F:$C24C:85 07   	STA $07    
0x03C25E|$0F:$C24E:A9 3F   	LDA #$3F   
0x03C260|$0F:$C250:85 08   	STA $08    
0x03C262|$0F:$C252:A0 01   	LDY #$01   
; control flow target (from $C266)
0x03C264|$0F:$C254:A5 30   	LDA $30    
0x03C266|$0F:$C256:29 0F   	AND #$0F   
0x03C268|$0F:$C258:20 BE C2	JSR $C2BE  
0x03C26B|$0F:$C25B:20 69 C2	JSR $C269  
0x03C26E|$0F:$C25E:20 BB C2	JSR $C2BB  
0x03C271|$0F:$C261:20 BB C2	JSR $C2BB  
0x03C274|$0F:$C264:C0 0D   	CPY #$0D   
0x03C276|$0F:$C266:D0 EC   	BNE $C254  
0x03C278|$0F:$C268:60      	RTS        

; control flow target (from $C25B)
0x03C279|$0F:$C269:A5 30   	LDA $30    
0x03C27B|$0F:$C26B:30 4E   	BMI $C2BB  
0x03C27D|$0F:$C26D:A5 07   	LDA $07    
0x03C27F|$0F:$C26F:C9 01   	CMP #$01   
0x03C281|$0F:$C271:D0 48   	BNE $C2BB  
0x03C283|$0F:$C273:18      	CLC        
0x03C284|$0F:$C274:08      	PHP        
0x03C285|$0F:$C275:A2 00   	LDX #$00   
; control flow target (from $C2B1)
0x03C287|$0F:$C277:BD 2D 06	LDA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03C28A|$0F:$C27A:0A      	ASL        
0x03C28B|$0F:$C27B:29 08   	AND #$08   
0x03C28D|$0F:$C27D:F0 2B   	BEQ $C2AA  
0x03C28F|$0F:$C27F:B0 06   	BCS $C287  
0x03C291|$0F:$C281:28      	PLP        
0x03C292|$0F:$C282:A9 26   	LDA #$26   
0x03C294|$0F:$C284:4C BD C2	JMP $C2BD  

; control flow target (from $C27F)
0x03C297|$0F:$C287:BD 30 06	LDA $0630,X	; Midenhall Max HP low byte
0x03C29A|$0F:$C28A:48      	PHA        
0x03C29B|$0F:$C28B:BD 31 06	LDA $0631,X	; Midenhall Max HP high byte
0x03C29E|$0F:$C28E:4A      	LSR        
0x03C29F|$0F:$C28F:7E 30 06	ROR $0630,X	; Midenhall Max HP low byte
0x03C2A2|$0F:$C292:4A      	LSR        
0x03C2A3|$0F:$C293:7E 30 06	ROR $0630,X	; Midenhall Max HP low byte
0x03C2A6|$0F:$C296:DD 3C 06	CMP $063C,X	; Midenhall Current HP, high byte
0x03C2A9|$0F:$C299:D0 06   	BNE $C2A1  
0x03C2AB|$0F:$C29B:BD 30 06	LDA $0630,X	; Midenhall Max HP low byte
0x03C2AE|$0F:$C29E:DD 3B 06	CMP $063B,X	; Midenhall Current HP, low byte
; control flow target (from $C299)
0x03C2B1|$0F:$C2A1:68      	PLA        
0x03C2B2|$0F:$C2A2:9D 30 06	STA $0630,X	; Midenhall Max HP low byte
0x03C2B5|$0F:$C2A5:90 03   	BCC $C2AA  
0x03C2B7|$0F:$C2A7:28      	PLP        
0x03C2B8|$0F:$C2A8:38      	SEC        
0x03C2B9|$0F:$C2A9:08      	PHP        
; control flow target (from $C27D, $C2A5)
0x03C2BA|$0F:$C2AA:8A      	TXA        
0x03C2BB|$0F:$C2AB:18      	CLC        
0x03C2BC|$0F:$C2AC:69 12   	ADC #$12   
0x03C2BE|$0F:$C2AE:AA      	TAX        
0x03C2BF|$0F:$C2AF:C9 36   	CMP #$36   
0x03C2C1|$0F:$C2B1:90 C4   	BCC $C277  
0x03C2C3|$0F:$C2B3:28      	PLP        
0x03C2C4|$0F:$C2B4:90 05   	BCC $C2BB  
0x03C2C6|$0F:$C2B6:A9 37   	LDA #$37   
0x03C2C8|$0F:$C2B8:4C BD C2	JMP $C2BD  

; control flow target (from $C25E, $C261, $C26B, $C271, $C2B4)
0x03C2CB|$0F:$C2BB:B1 0A   	LDA ($0A),Y
; control flow target (from $C284, $C2B8)
0x03C2CD|$0F:$C2BD:C8      	INY        
; control flow target (from $C258)
0x03C2CE|$0F:$C2BE:38      	SEC        
0x03C2CF|$0F:$C2BF:E5 0C   	SBC $0C    
0x03C2D1|$0F:$C2C1:B0 04   	BCS $C2C7  
0x03C2D3|$0F:$C2C3:A5 30   	LDA $30    
0x03C2D5|$0F:$C2C5:29 0F   	AND #$0F   
; control flow target (from $C2C1)
0x03C2D7|$0F:$C2C7:85 09   	STA $09    
0x03C2D9|$0F:$C2C9: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
0x03C2DC|$0F:$C2CC:60      	RTS        

; control flow target (from $E32C)
; external control flow target (from $07:$8A76, $09:$815D, $0A:$8134, $0B:$8084)
0x03C2DD|$0F:$C2CD:A0 00   	LDY #$00   
; control flow target (from $C2DC)
0x03C2DF|$0F:$C2CF:B1 0E   	LDA ($0E),Y
0x03C2E1|$0F:$C2D1:99 00 05	STA $0500,Y
0x03C2E4|$0F:$C2D4:B1 10   	LDA ($10),Y
0x03C2E6|$0F:$C2D6:99 0D 05	STA $050D,Y
0x03C2E9|$0F:$C2D9:C8      	INY        
0x03C2EA|$0F:$C2DA:C0 0D   	CPY #$0D   
0x03C2EC|$0F:$C2DC:D0 F1   	BNE $C2CF  
; external control flow target (from $06:$828A)
0x03C2EE|$0F:$C2DE:A9 30   	LDA #$30   
0x03C2F0|$0F:$C2E0:85 0C   	STA $0C    
0x03C2F2|$0F:$C2E2:A9 F0   	LDA #$F0   
0x03C2F4|$0F:$C2E4:4C 09
; external indexed data load target (from $06:$827F)
0x03C2F6|$0F:$C2E6:      C3	JMP $C309  


; code -> data
; indexed data load target (from $C242, $C2FB)
0x03C2F7|$0F:$C2E7:00
; indexed data load target (from $C247)
0x03C2F8|$0F:$C2E8:   05	; $0500
; external data load target (from $06:$A276)
0x03C2F9|$0F:$C2E9:0D
; external data load target (from $06:$A27B)
0x03C2FA|$0F:$C2EA:   05	; $050D

; data -> code
; control flow target (from $C42E)
; external control flow target (from $06:$8253, $0A:$8114)
0x03C2FB|$0F:$C2EB:A5 3C   	LDA $3C    
0x03C2FD|$0F:$C2ED:C9 30   	CMP #$30   
0x03C2FF|$0F:$C2EF:D0 08   	BNE $C2F9  
0x03C301|$0F:$C2F1:A9 00   	LDA #$00   
0x03C303|$0F:$C2F3:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
; call to code in a different bank ($00:$800F)
0x03C306|$0F:$C2F6:20 0F 80	JSR $800F  
; control flow target (from $C2EF)
0x03C309|$0F:$C2F9:A2 03   	LDX #$03   
; control flow target (from $C301)
0x03C30B|$0F:$C2FB:BD E7 C2	LDA $C2E7,X
0x03C30E|$0F:$C2FE:95 0E   	STA $0E,X  
0x03C310|$0F:$C300:CA      	DEX        
0x03C311|$0F:$C301:10 F8   	BPL $C2FB  
0x03C313|$0F:$C303:A9 00   	LDA #$00   
0x03C315|$0F:$C305:85 0C   	STA $0C    
0x03C317|$0F:$C307:A9 10   	LDA #$10   
; control flow target (from $C2E4)
0x03C319|$0F:$C309:48      	PHA        
0x03C31A|$0F:$C30A:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $C335)
0x03C31D|$0F:$C30D:A5 0E   	LDA $0E    
0x03C31F|$0F:$C30F:85 0A   	STA $0A    
0x03C321|$0F:$C311:A5 0F   	LDA $0F    
0x03C323|$0F:$C313:85 0B   	STA $0B    
0x03C325|$0F:$C315:20 24 C2	JSR $C224  
0x03C328|$0F:$C318:A5 0D   	LDA $0D    
0x03C32A|$0F:$C31A:F0 0B   	BEQ $C327  
0x03C32C|$0F:$C31C:A5 10   	LDA $10    
0x03C32E|$0F:$C31E:85 0A   	STA $0A    
0x03C330|$0F:$C320:A5 11   	LDA $11    
0x03C332|$0F:$C322:85 0B   	STA $0B    
0x03C334|$0F:$C324:20 28 C2	JSR $C228  
; control flow target (from $C31A)
0x03C337|$0F:$C327:A2 04   	LDX #$04   
0x03C339|$0F:$C329:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03C33C|$0F:$C32C:68      	PLA        
0x03C33D|$0F:$C32D:48      	PHA        
0x03C33E|$0F:$C32E:18      	CLC        
0x03C33F|$0F:$C32F:65 0C   	ADC $0C    
0x03C341|$0F:$C331:85 0C   	STA $0C    
0x03C343|$0F:$C333:C9 50   	CMP #$50   
0x03C345|$0F:$C335:90 D6   	BCC $C30D  
0x03C347|$0F:$C337:68      	PLA        
0x03C348|$0F:$C338:60      	RTS        

; 16-bit multiplication: ($10-$11) = ($0C-$0D) * ($0E-$0F); consumes $0C-$0F
; control flow target (from $D692, $E19F, $E472)
; external control flow target (from $02:$B03E, $06:$86B4, $0A:$8171)
0x03C349|$0F:$C339:A9 00   	LDA #$00   
0x03C34B|$0F:$C33B:85 10   	STA $10    
0x03C34D|$0F:$C33D:85 11   	STA $11    
; control flow target (from $C35C)
0x03C34F|$0F:$C33F:A5 0C   	LDA $0C    
0x03C351|$0F:$C341:05 0D   	ORA $0D    
0x03C353|$0F:$C343:F0 1A   	BEQ $C35F  
0x03C355|$0F:$C345:46 0D   	LSR $0D    
0x03C357|$0F:$C347:66 0C   	ROR $0C    
0x03C359|$0F:$C349:90 0D   	BCC $C358  
0x03C35B|$0F:$C34B:A5 0E   	LDA $0E    
0x03C35D|$0F:$C34D:18      	CLC        
0x03C35E|$0F:$C34E:65 10   	ADC $10    
0x03C360|$0F:$C350:85 10   	STA $10    
0x03C362|$0F:$C352:A5 0F   	LDA $0F    
0x03C364|$0F:$C354:65 11   	ADC $11    
0x03C366|$0F:$C356:85 11   	STA $11    
; control flow target (from $C349)
0x03C368|$0F:$C358:06 0E   	ASL $0E    
0x03C36A|$0F:$C35A:26 0F   	ROL $0F    
0x03C36C|$0F:$C35C:4C 3F C3	JMP $C33F  

; control flow target (from $C343)
0x03C36F|$0F:$C35F:60      	RTS        

; 16-bit division: ($0C-$0D) / ($0E-$0F) = quotient in ($0C-$0D), remainder in ($10-$11)
; external control flow target (from $02:$B063)
0x03C370|$0F:$C360:A0 10   	LDY #$10   	; 16 bit logic
0x03C372|$0F:$C362:A9 00   	LDA #$00   	; initialize remainder
0x03C374|$0F:$C364:85 10   	STA $10    
0x03C376|$0F:$C366:85 11   	STA $11    
; control flow target (from $C390)
0x03C378|$0F:$C368:06 0C   	ASL $0C    	; 16-bit ASL $0C-$0D into 16-bit $10-$11
0x03C37A|$0F:$C36A:26 0D   	ROL $0D    
0x03C37C|$0F:$C36C:26 10   	ROL $10    
0x03C37E|$0F:$C36E:26 11   	ROL $11    
0x03C380|$0F:$C370:E6 0C   	INC $0C    	; assume ($10-$11) >= ($0E-$0F), INC quotient and MOD remainder
0x03C382|$0F:$C372:A5 10   	LDA $10    
0x03C384|$0F:$C374:38      	SEC        
0x03C385|$0F:$C375:E5 0E   	SBC $0E    
0x03C387|$0F:$C377:85 10   	STA $10    
0x03C389|$0F:$C379:A5 11   	LDA $11    
0x03C38B|$0F:$C37B:E5 0F   	SBC $0F    
0x03C38D|$0F:$C37D:85 11   	STA $11    
0x03C38F|$0F:$C37F:B0 0E   	BCS $C38F  	; branch if assumption was correct; otherwise undo INC/MOD
0x03C391|$0F:$C381:A5 10   	LDA $10    
0x03C393|$0F:$C383:65 0E   	ADC $0E    
0x03C395|$0F:$C385:85 10   	STA $10    
0x03C397|$0F:$C387:A5 11   	LDA $11    
0x03C399|$0F:$C389:65 0F   	ADC $0F    
0x03C39B|$0F:$C38B:85 11   	STA $11    
0x03C39D|$0F:$C38D:C6 0C   	DEC $0C    
; control flow target (from $C37F)
0x03C39F|$0F:$C38F:88      	DEY        
0x03C3A0|$0F:$C390:D0 D6   	BNE $C368  	; if more bits to divide, divide them
0x03C3A2|$0F:$C392:60      	RTS        

; control flow target (from $DF71)
0x03C3A3|$0F:$C393:A0 08   	LDY #$08   
0x03C3A5|$0F:$C395:A9 00   	LDA #$00   
; control flow target (from $C3A6)
0x03C3A7|$0F:$C397:06 0C   	ASL $0C    
0x03C3A9|$0F:$C399:2A      	ROL        
0x03C3AA|$0F:$C39A:E6 0C   	INC $0C    
0x03C3AC|$0F:$C39C:38      	SEC        
0x03C3AD|$0F:$C39D:E5 0E   	SBC $0E    
0x03C3AF|$0F:$C39F:B0 04   	BCS $C3A5  
0x03C3B1|$0F:$C3A1:65 0E   	ADC $0E    
0x03C3B3|$0F:$C3A3:C6 0C   	DEC $0C    
; control flow target (from $C39F)
0x03C3B5|$0F:$C3A5:88      	DEY        
0x03C3B6|$0F:$C3A6:D0 EF   	BNE $C397  
0x03C3B8|$0F:$C3A8:85 10   	STA $10    
0x03C3BA|$0F:$C3AA:60      	RTS        

; generate a random number and store it in $32-$33 (two passes)
; control flow target (from $C490, $D685, $D99C)
; external control flow target (from $04:$802D, $04:$80DC, $04:$824F, $04:$97CC, $04:$9880, $04:$A005, $04:$A044, $04:$AEDF, $04:$B078, $04:$B6C1, $04:$B793, $06:$846C, $06:$8744, $06:$8847, $06:$921E, $06:$9B5D, $06:$9BBE, $06:$9C41, $06:$BC6B, $06:$BCE8, $06:$BCF4, $06:$BD0E, $09:$9E5E)
0x03C3BB|$0F:$C3AB:A9 FF   	LDA #$FF   
0x03C3BD|$0F:$C3AD:85 0C   	STA $0C    
0x03C3BF|$0F:$C3AF:20 B6 C3	JSR $C3B6  	; generate a random number and store it in $32-$33 (one pass)
0x03C3C2|$0F:$C3B2:A9 FF   	LDA #$FF   
0x03C3C4|$0F:$C3B4:85 0C   	STA $0C    
; generate a random number and store it in $32-$33 (one pass)
; control flow target (from $C3AF)
; external control flow target (from $06:$ACC6)
0x03C3C6|$0F:$C3B6:A0 08   	LDY #$08   
; control flow target (from $C3D2)
0x03C3C8|$0F:$C3B8:A5 33   	LDA $33    	; RNG byte 1
0x03C3CA|$0F:$C3BA:45 0C   	EOR $0C    
0x03C3CC|$0F:$C3BC:06 32   	ASL $32    	; RNG byte 0
0x03C3CE|$0F:$C3BE:26 33   	ROL $33    	; RNG byte 1
0x03C3D0|$0F:$C3C0:06 0C   	ASL $0C    
0x03C3D2|$0F:$C3C2:0A      	ASL        
0x03C3D3|$0F:$C3C3:90 0C   	BCC $C3D1  
0x03C3D5|$0F:$C3C5:A5 32   	LDA $32    	; RNG byte 0
0x03C3D7|$0F:$C3C7:49 21   	EOR #$21   
0x03C3D9|$0F:$C3C9:85 32   	STA $32    	; RNG byte 0
0x03C3DB|$0F:$C3CB:A5 33   	LDA $33    	; RNG byte 1
0x03C3DD|$0F:$C3CD:49 10   	EOR #$10   
0x03C3DF|$0F:$C3CF:85 33   	STA $33    	; RNG byte 1
; control flow target (from $C3C3)
0x03C3E1|$0F:$C3D1:88      	DEY        
0x03C3E2|$0F:$C3D2:D0 E4   	BNE $C3B8  
0x03C3E4|$0F:$C3D4:60      	RTS        

; save A to $05F6, X to $43, and load bank specified by A
; control flow target (from $C2F3, $C3DC, $C4E8, $C4FA, $C506, $C50E, $C544, $C55E, $C569, $C574, $C57F, $C58A, $C688, $C690, $CCEE, $CFA2, $D09B, $D0E7, $D2FF, $D31C, $D34A, $F782, $F86D, $FCFA)
; external control flow target (from $02:$B205, $06:$BC85)
0x03C3E5|$0F:$C3D5:4C BB FF	JMP $FFBB  	; save A to $05F6, X to $43, and load bank specified by A

; CLI and load bank specified by A
; control flow target (from $C0C8, $C0D1)
0x03C3E8|$0F:$C3D8:58      	CLI        
0x03C3E9|$0F:$C3D9:4C C0 FF	JMP $FFC0  	; load bank specified by A

; load bank specified by A, wait for interrupt, set $6007 to #$FF, turn screen off, copy ($0C) inclusive - ($0E) exclusive to PPU at ($10), wait for interrupt, turn screen sprites and backround on
; external control flow target (from $00:$8039, $00:$80FF)
0x03C3EC|$0F:$C3DC:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03C3EF|$0F:$C3DF:20 E8 C3	JSR $C3E8  	; wait for interrupt, set $6007 to #$FF, turn screen off
0x03C3F2|$0F:$C3E2:20 F6 C3	JSR $C3F6  	; copy ($0C) inclusive - ($0E) exclusive to PPU at ($10)
0x03C3F5|$0F:$C3E5:4C 1C C4	JMP $C41C  	; wait for interrupt, turn screen sprites and backround on

; wait for interrupt, set $6007 to #$FF, turn screen off
; control flow target (from $C3DF, $C446)
; external control flow target (from $00:$803F, $00:$807E, $00:$823A, $04:$8715, $08:$801B, $0A:$8010, $0A:$80BC, $0A:$81E2, $0B:$8087)
0x03C3F8|$0F:$C3E8:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C3FB|$0F:$C3EB:A9 FF   	LDA #$FF   
0x03C3FD|$0F:$C3ED:8D 07 60	STA $6007  
0x03C400|$0F:$C3F0:A9 00   	LDA #$00   	; screen off
0x03C402|$0F:$C3F2:8D 01 20	STA $2001  	; PPU Control Register #2 (#$E0: Full Background Colour, #$01 set [None, Green, Blue, Red], #$E0: Colour Intensity, #$01 not set [None, Green, Blue, Red], #$10: Sprite Visibility, #$80: Background Visibility, #$40: No Sprite Clipping, #$20: No Background Clipping, #$01: Monochrome Display)
0x03C405|$0F:$C3F5:60      	RTS        

; copy ($0C) inclusive - ($0E) exclusive to PPU at ($10)
; control flow target (from $C3E2)
; external control flow target (from $00:$8081, $00:$80C0, $00:$8396, $04:$8A84, $0A:$81E5, $0B:$808A)
0x03C406|$0F:$C3F6:A5 11   	LDA $11    	; PPU address high byte; PPU address low byte
0x03C408|$0F:$C3F8:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C40B|$0F:$C3FB:A5 10   	LDA $10    
0x03C40D|$0F:$C3FD:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C410|$0F:$C400:A0 00   	LDY #$00   
; control flow target (from $C416, $C41A)
0x03C412|$0F:$C402:B1 0C   	LDA ($0C),Y	; CHR data
0x03C414|$0F:$C404:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C417|$0F:$C407:A5 0C   	LDA $0C    
0x03C419|$0F:$C409:C5 0E   	CMP $0E    	; CHR end address low byte (exclusive)
0x03C41B|$0F:$C40B:D0 07   	BNE $C414  	; update $0C-$0D
0x03C41D|$0F:$C40D:A5 0D   	LDA $0D    
0x03C41F|$0F:$C40F:C5 0F   	CMP $0F    	; CHR end address high byte (exclusive)
0x03C421|$0F:$C411:D0 01   	BNE $C414  	; update $0C-$0D
0x03C423|$0F:$C413:60      	RTS        

; update $0C-$0D
; control flow target (from $C40B, $C411)
0x03C424|$0F:$C414:E6 0C   	INC $0C    
0x03C426|$0F:$C416:D0 EA   	BNE $C402  
0x03C428|$0F:$C418:E6 0D   	INC $0D    
0x03C42A|$0F:$C41A:D0 E6   	BNE $C402  
; wait for interrupt, turn screen sprites and backround on
; control flow target (from $C3E5, $C462)
; external control flow target (from $00:$8078, $00:$80E2, $00:$8325, $04:$8730, $06:$A98C)
0x03C42C|$0F:$C41C:A9 00   	LDA #$00   	; useless op
0x03C42E|$0F:$C41E:8D 07 60	STA $6007  	; useless op
0x03C431|$0F:$C421:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C434|$0F:$C424:A9 18   	LDA #$18   	; turn sprites and backround on
0x03C436|$0F:$C426:8D 01 20	STA $2001  	; PPU Control Register #2 (#$E0: Full Background Colour, #$01 set [None, Green, Blue, Red], #$E0: Colour Intensity, #$01 not set [None, Green, Blue, Red], #$10: Sprite Visibility, #$80: Background Visibility, #$40: No Sprite Clipping, #$20: No Background Clipping, #$01: Monochrome Display)
0x03C439|$0F:$C429:60      	RTS        

; control flow target (from $C52D, $C6F3, $C97B, $D2B6, $D2DE, $E27E, $E287)
; external control flow target (from $04:$870F, $06:$A97E, $07:$81BD, $07:$81D6, $07:$84DD, $07:$851F, $07:$853B, $07:$85F6, $07:$88FF, $08:$8018, $09:$8005, $0A:$800D)
0x03C43A|$0F:$C42A:A9 FF   	LDA #$FF   
0x03C43C|$0F:$C42C:85 0D   	STA $0D    
0x03C43E|$0F:$C42E:20 EB C2	JSR $C2EB  
0x03C441|$0F:$C431:A2 00   	LDX #$00   
0x03C443|$0F:$C433:8A      	TXA        
; control flow target (from $C438)
0x03C444|$0F:$C434:9D 00 04	STA $0400,X	; menu-based palette overrides start
0x03C447|$0F:$C437:E8      	INX        
0x03C448|$0F:$C438:D0 FA   	BNE $C434  
0x03C44A|$0F:$C43A:A2 C0   	LDX #$C0   
; control flow target (from $C443)
0x03C44C|$0F:$C43C:9D 00 03	STA $0300,X	; PPU write buffer start
0x03C44F|$0F:$C43F:9D 00 07	STA $0700,X
0x03C452|$0F:$C442:E8      	INX        
0x03C453|$0F:$C443:D0 F7   	BNE $C43C  
0x03C455|$0F:$C445:60      	RTS        

; turn screen off, write $800 [space] tiles to PPU $2000, turn screen on
; control flow target (from $C533, $D2E1)
; external control flow target (from $04:$870C, $06:$A981, $07:$81C0, $07:$8902, $08:$801E, $09:$8008)
0x03C456|$0F:$C446:20 E8 C3	JSR $C3E8  	; wait for interrupt, set $6007 to #$FF, turn screen off
0x03C459|$0F:$C449:A9 20   	LDA #$20   
0x03C45B|$0F:$C44B:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C45E|$0F:$C44E:A9 00   	LDA #$00   
0x03C460|$0F:$C450:8D 06 20	STA $2006  	; VRAM Address Register #2 (write twice; $2007 address)
0x03C463|$0F:$C453:A9 5F   	LDA #$5F   
0x03C465|$0F:$C455:A2 08   	LDX #$08   
; control flow target (from $C460)
0x03C467|$0F:$C457:A0 00   	LDY #$00   
; control flow target (from $C45D)
0x03C469|$0F:$C459:8D 07 20	STA $2007  	; VRAM I/O Register
0x03C46C|$0F:$C45C:88      	DEY        
0x03C46D|$0F:$C45D:D0 FA   	BNE $C459  
0x03C46F|$0F:$C45F:CA      	DEX        
0x03C470|$0F:$C460:D0 F5   	BNE $C457  
0x03C472|$0F:$C462:4C 1C C4	JMP $C41C  	; wait for interrupt, turn screen sprites and backround on

; wait for interrupt and then set every 4th byte of $0200 - $02FC to #$F0
; control flow target (from $C530, $D2E4, $E281, $E28A)
; external control flow target (from $04:$86FE, $07:$8905, $09:$800B, $0A:$805C)
0x03C475|$0F:$C465:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; set every 4th byte of $0200 - $02FC to #$F0
; control flow target (from $C67A, $D8E0)
; external control flow target (from $07:$81BA, $08:$8021, $0A:$8013)
0x03C478|$0F:$C468:A2 00   	LDX #$00   
0x03C47A|$0F:$C46A:A9 F0   	LDA #$F0   
; control flow target (from $C473)
0x03C47C|$0F:$C46C:9D 00 02	STA $0200,X	; sprite buffer start
0x03C47F|$0F:$C46F:E8      	INX        
0x03C480|$0F:$C470:E8      	INX        
0x03C481|$0F:$C471:E8      	INX        
0x03C482|$0F:$C472:E8      	INX        
0x03C483|$0F:$C473:D0 F7   	BNE $C46C  
0x03C485|$0F:$C475:60      	RTS        

; read joypad 1 data into $2F
; control flow target (from $C704, $D140)
; external control flow target (from $02:$B71A, $04:$9A4D, $06:$8930, $06:$A976, $06:$AFAE, $06:$BC5D, $06:$BC74, $06:$BC7B, $08:$8299, $08:$8335, $0A:$804C)
0x03C486|$0F:$C476:A9 01   	LDA #$01   
0x03C488|$0F:$C478:8D 16 40	STA $4016  	; Joypad #1 (READ: #$10: Zapper Trigger Not Pulled, #$08: Zapper Sprite Detection, #$01: Joypad Data; WRITE: #$01: Reset Joypad Strobe, set Expansion Port Method to Read)
0x03C48B|$0F:$C47B:A9 00   	LDA #$00   
0x03C48D|$0F:$C47D:8D 16 40	STA $4016  	; Joypad #1 (READ: #$10: Zapper Trigger Not Pulled, #$08: Zapper Sprite Detection, #$01: Joypad Data; WRITE: #$01: Reset Joypad Strobe, set Expansion Port Method to Read)
0x03C490|$0F:$C480:A0 08   	LDY #$08   	; 8 bits of data to read
; control flow target (from $C48C)
0x03C492|$0F:$C482:AD 16 40	LDA $4016  	; Joypad #1 (READ: #$10: Zapper Trigger Not Pulled, #$08: Zapper Sprite Detection, #$01: Joypad Data; WRITE: #$01: Reset Joypad Strobe, set Expansion Port Method to Read)
0x03C495|$0F:$C485:29 03   	AND #$03   	; mask off the non-joypad data (should be AND #$01?)
0x03C497|$0F:$C487:C9 01   	CMP #$01   	; set C to low bit of joypad data
0x03C499|$0F:$C489:66 2F   	ROR $2F    	; joypad 1 data
0x03C49B|$0F:$C48B:88      	DEY        
0x03C49C|$0F:$C48C:D0 F4   	BNE $C482  	; loop until all 8 bits read
0x03C49E|$0F:$C48E:A6 0C   	LDX $0C    	; save value of $0C in X
0x03C4A0|$0F:$C490:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x03C4A3|$0F:$C493:86 0C   	STX $0C    	; restore value of $0C from X
0x03C4A5|$0F:$C495:60      	RTS        

; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise
; control flow target (from $C4B0, $C4B6)
0x03C4A6|$0F:$C496:86 CB   	STX $CB    	; save X for later
0x03C4A8|$0F:$C498:85 9B   	STA $9B    	; item ID
0x03C4AA|$0F:$C49A:A5 9C   	LDA $9C    	; hero ID
0x03C4AC|$0F:$C49C:0A      	ASL        	; 8 inventory slots per hero
0x03C4AD|$0F:$C49D:0A      	ASL        
0x03C4AE|$0F:$C49E:0A      	ASL        
0x03C4AF|$0F:$C49F:AA      	TAX        
0x03C4B0|$0F:$C4A0:A0 08   	LDY #$08   	; 8 inventory slots per hero
; control flow target (from $C4AC)
0x03C4B2|$0F:$C4A2:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x03C4B5|$0F:$C4A5:C5 9B   	CMP $9B    	; item ID
0x03C4B7|$0F:$C4A7:38      	SEC        
0x03C4B8|$0F:$C4A8:F0 05   	BEQ $C4AF  	; if found, RTS
0x03C4BA|$0F:$C4AA:E8      	INX        
0x03C4BB|$0F:$C4AB:88      	DEY        
0x03C4BC|$0F:$C4AC:D0 F4   	BNE $C4A2  	; if more inventory to check, check it
0x03C4BE|$0F:$C4AE:18      	CLC        	; if we get here, then hero does not posses item $9B
; control flow target (from $C4A8)
0x03C4BF|$0F:$C4AF:60      	RTS        

; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise
; external control flow target (from $04:$A4ED, $04:$A9E4, $04:$AFCF, $04:$AFE3, $04:$AFEC, $04:$B3D1, $06:$8DC0, $06:$A1C1)
0x03C4C0|$0F:$C4B0:20 96 C4	JSR $C496  	; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise
0x03C4C3|$0F:$C4B3:A6 CB   	LDX $CB    	; restore the original value of X
0x03C4C5|$0F:$C4B5:60      	RTS        

; given a hero ID in $9C and an item ID in A, remove that item from hero's inventory if present and SEC, CLC otherwise
; external control flow target (from $06:$8DC9, $06:$92CF, $06:$92DE, $06:$97A7)
0x03C4C6|$0F:$C4B6:20 96 C4	JSR $C496  	; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise
0x03C4C9|$0F:$C4B9:B0 03   	BCS $C4BE  	; given a party inventory offset in X and a number of items to be moved up in Y, move that many inventory items up
0x03C4CB|$0F:$C4BB:A6 CB   	LDX $CB    	; restore the original value of X
0x03C4CD|$0F:$C4BD:60      	RTS        

; given a party inventory offset in X and a number of items to be moved up in Y, move that many inventory items up
; control flow target (from $C4B9, $C4C8, $C4E3)
0x03C4CE|$0F:$C4BE:88      	DEY        	; number of items to move up
0x03C4CF|$0F:$C4BF:F0 0A   	BEQ $C4CB  	; if zero, then done moving items up
; copy item N+1 to item N
0x03C4D1|$0F:$C4C1:BD 01 06	LDA $0601,X	; Midenhall inventory item 2 (| #$40 if equipped)
0x03C4D4|$0F:$C4C4:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x03C4D7|$0F:$C4C7:E8      	INX        
0x03C4D8|$0F:$C4C8:4C BE C4	JMP $C4BE  	; given a party inventory offset in X and a number of items to be moved up in Y, move that many inventory items up

; control flow target (from $C4BF)
0x03C4DB|$0F:$C4CB:A9 00   	LDA #$00   	; set the final inventory slot to #$00 (no item)
0x03C4DD|$0F:$C4CD:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x03C4E0|$0F:$C4D0:A6 CB   	LDX $CB    	; restore the original value of X
0x03C4E2|$0F:$C4D2:38      	SEC        
0x03C4E3|$0F:$C4D3:60      	RTS        

; 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
; external control flow target (from $04:$A4F6, $06:$853D, $06:$95FC, $06:$9621, $06:$9706, $06:$9A1C, $06:$9AB7)
0x03C4E4|$0F:$C4D4:86 CB   	STX $CB    
0x03C4E6|$0F:$C4D6:0A      	ASL        
0x03C4E7|$0F:$C4D7:0A      	ASL        
0x03C4E8|$0F:$C4D8:0A      	ASL        
0x03C4E9|$0F:$C4D9:18      	CLC        
0x03C4EA|$0F:$C4DA:65 CB   	ADC $CB    
0x03C4EC|$0F:$C4DC:AA      	TAX        	; X = A * 8 + X, i.e. convert hero inventory offset to party inventory offset
0x03C4ED|$0F:$C4DD:A9 08   	LDA #$08   
0x03C4EF|$0F:$C4DF:38      	SEC        
0x03C4F0|$0F:$C4E0:E5 CB   	SBC $CB    
0x03C4F2|$0F:$C4E2:A8      	TAY        	; Y = number of items to bubble up
0x03C4F3|$0F:$C4E3:4C BE C4	JMP $C4BE  	; given a party inventory offset in X and a number of items to be moved up in Y, move that many inventory items up

; return 1 byte from bank 1's ($00,Y) in A, INC 16-bit $00,Y-$01,Y
; external control flow target (from $04:$8F9F)
0x03C4F6|$0F:$C4E6:A9 01   	LDA #$01   
0x03C4F8|$0F:$C4E8:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03C4FB|$0F:$C4EB:98      	TYA        
0x03C4FC|$0F:$C4EC:AA      	TAX        
0x03C4FD|$0F:$C4ED:A1 00   	LDA ($00,X)
0x03C4FF|$0F:$C4EF:F6 00   	INC $00,X  
0x03C501|$0F:$C4F1:D0 02   	BNE $C4F5  
0x03C503|$0F:$C4F3:F6 01   	INC $01,X  
; control flow target (from $C4F1)
0x03C505|$0F:$C4F5:48      	PHA        
0x03C506|$0F:$C4F6:A6 43   	LDX $43    
0x03C508|$0F:$C4F8:A9 04   	LDA #$04   
0x03C50A|$0F:$C4FA:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03C50D|$0F:$C4FD:68      	PLA        
0x03C50E|$0F:$C4FE:60      	RTS        

; external control flow target (from $00:$B798, $00:$B7B0)
0x03C50F|$0F:$C4FF:90 03   	BCC $C504  
0x03C511|$0F:$C501:20 11 C5	JSR $C511  	; flash screen 5 times
; control flow target (from $C4FF, $D328, $FF66)
0x03C514|$0F:$C504:A9 04   	LDA #$04   
0x03C516|$0F:$C506:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
; call to code in a different bank ($04:$8015)
0x03C519|$0F:$C509:20 15 80	JSR $8015  
0x03C51C|$0F:$C50C:A9 00   	LDA #$00   
0x03C51E|$0F:$C50E:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; flash screen 5 times
; control flow target (from $C501)
; external control flow target (from $06:$BD17, $06:$BD81, $06:$BD8E, $07:$84F9, $07:$8687)
0x03C521|$0F:$C511:A2 05   	LDX #$05   
0x03C523|$0F:$C513:D0 02   	BNE $C517  
; flash screen 10 times
; external control flow target (from $04:$86ED, $04:$9CA0, $06:$85AF, $06:$8606, $06:$8BC6, $06:$9172, $06:$940B, $06:$9519, $06:$96C3, $06:$9944, $06:$9947, $06:$BD3B, $06:$BD3E, $07:$8625)
0x03C525|$0F:$C515:A2 0A   	LDX #$0A   
; control flow target (from $C513, $C52A)
0x03C527|$0F:$C517:8A      	TXA        	; save X on the stack
0x03C528|$0F:$C518:48      	PHA        
0x03C529|$0F:$C519:29 01   	AND #$01   	; pick out the even/odd bit
0x03C52B|$0F:$C51B:49 19   	EOR #$19   	; enable sprites and background, toggle monochrome
0x03C52D|$0F:$C51D:48      	PHA        	; new PPU setting
0x03C52E|$0F:$C51E:A2 03   	LDX #$03   
0x03C530|$0F:$C520:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03C533|$0F:$C523:68      	PLA        	; new PPU setting
0x03C534|$0F:$C524:8D 01 20	STA $2001  	; PPU Control Register #2 (#$E0: Full Background Colour, #$01 set [None, Green, Blue, Red], #$E0: Colour Intensity, #$01 not set [None, Green, Blue, Red], #$10: Sprite Visibility, #$80: Background Visibility, #$40: No Sprite Clipping, #$20: No Background Clipping, #$01: Monochrome Display)
0x03C537|$0F:$C527:68      	PLA        	; restore X from the stack
0x03C538|$0F:$C528:AA      	TAX        
0x03C539|$0F:$C529:CA      	DEX        
0x03C53A|$0F:$C52A:D0 EB   	BNE $C517  	; loop until no more flashes left
0x03C53C|$0F:$C52C:60      	RTS        

; external control flow target (from $09:$8027)
0x03C53D|$0F:$C52D:20 2A C4	JSR $C42A  
0x03C540|$0F:$C530:20 65 C4	JSR $C465  	; wait for interrupt and then set every 4th byte of $0200 - $02FC to #$F0
0x03C543|$0F:$C533:20 46 C4	JSR $C446  	; turn screen off, write $800 [space] tiles to PPU $2000, turn screen on
0x03C546|$0F:$C536:A9 8F   	LDA #$8F   
0x03C548|$0F:$C538:85 30   	STA $30    
0x03C54A|$0F:$C53A:A9 00   	LDA #$00   
0x03C54C|$0F:$C53C:85 05   	STA $05    
0x03C54E|$0F:$C53E:85 06   	STA $06    
0x03C550|$0F:$C540:85 04   	STA $04    
0x03C552|$0F:$C542:A9 00   	LDA #$00   
0x03C554|$0F:$C544:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03C557|$0F:$C547:A9 06   	LDA #$06   
0x03C559|$0F:$C549:85 0C   	STA $0C    
; call to code in a different bank ($00:$8000)
0x03C55B|$0F:$C54B:20 00 80	JSR $8000  
0x03C55E|$0F:$C54E:A9 0E   	LDA #$0E   
0x03C560|$0F:$C550:85 0C   	STA $0C    
; call to code in a different bank ($00:$8000)
0x03C562|$0F:$C552:20 00 80	JSR $8000  
0x03C565|$0F:$C555:A9 0F   	LDA #$0F   
0x03C567|$0F:$C557:85 0C   	STA $0C    
; call to code in a different bank ($00:$8000)
0x03C569|$0F:$C559:20 00 80	JSR $8000  
0x03C56C|$0F:$C55C:A9 09   	LDA #$09   
0x03C56E|$0F:$C55E:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; control flow target (from $C58D, $C5A0, $CAD2, $CFF6, $D03D, $D0D2, $D21A, $D22E, $D4E8, $D4FE, $D53E, $D6E3, $E383, $F693, $F69C, $FD82)
; external control flow target (from $00:$B793, $00:$B7AB, $00:$B8ED, $02:$B728, $04:$86FB, $04:$8AD5, $04:$8AEA, $04:$8FE4, $04:$959A, $04:$969E, $04:$973F, $04:$980B, $04:$98FA, $04:$9B61, $04:$9B71, $04:$9C84, $04:$9C9D, $04:$9CB4, $06:$81AC, $06:$882F, $06:$89F7, $06:$8BC3, $06:$8C5A, $06:$97C6, $06:$A18C, $06:$A254, $06:$A298, $06:$A2BC, $06:$B0D3, $06:$BC17, $06:$BD08, $06:$BD27, $06:$BD6E, $06:$BD7E, $06:$BD8B, $07:$8207, $07:$8218, $07:$83F1, $07:$84DA, $07:$8512, $07:$8538, $07:$85F3, $07:$8605, $07:$8613, $07:$8618, $07:$861D, $07:$8622, $07:$862B, $07:$8635, $07:$8684, $07:$868F, $08:$81E7, $08:$81F6, $08:$820E)
0x03C571|$0F:$C561:78      	SEI        
0x03C572|$0F:$C562:AA      	TAX        
0x03C573|$0F:$C563:AD F6 05	LDA $05F6  	; current bank
0x03C576|$0F:$C566:48      	PHA        	; save current bank on the stack
0x03C577|$0F:$C567:A9 03   	LDA #$03   
0x03C579|$0F:$C569:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03C57C|$0F:$C56C:8A      	TXA        
; call to code in a different bank ($03:$8003)
0x03C57D|$0F:$C56D:20 03 80	JSR $8003  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03C580|$0F:$C570:68      	PLA        	; restore current bank from stack
0x03C581|$0F:$C571:8D F6 05	STA $05F6  	; current bank
0x03C584|$0F:$C574:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; set $6144 to #$05
; external control flow target (from $06:$AA60, $07:$81C6, $07:$81FF, $07:$83E9, $07:$84E0, $08:$8015)
0x03C587|$0F:$C577:78      	SEI        
0x03C588|$0F:$C578:AA      	TAX        
0x03C589|$0F:$C579:AD F6 05	LDA $05F6  	; current bank
0x03C58C|$0F:$C57C:48      	PHA        
0x03C58D|$0F:$C57D:A9 03   	LDA #$03   
0x03C58F|$0F:$C57F:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03C592|$0F:$C582:8A      	TXA        
; call to code in a different bank ($03:$8009)
0x03C593|$0F:$C583:20 09 80	JSR $8009  
0x03C596|$0F:$C586:68      	PLA        
0x03C597|$0F:$C587:8D F6 05	STA $05F6  	; current bank
0x03C59A|$0F:$C58A:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
; external control flow target (from $06:$8111, $06:$8258, $06:$8656, $06:$8735, $06:$8A4F, $06:$9742, $06:$998A, $06:$A956)
0x03C59D|$0F:$C58D:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03C5A0|$0F:$C590:A2 03   	LDX #$03   
0x03C5A2|$0F:$C592:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; control flow target (from $C59B)
; external control flow target (from $04:$975B, $04:$9902)
0x03C5A5|$0F:$C595:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C5A8|$0F:$C598:AD 56 01	LDA $0156  	; probably music playing flag? set to #$00 when music finishes
0x03C5AB|$0F:$C59B:D0 F8   	BNE $C595  
; control flow target (from $C5A8)
; external control flow target (from $06:$A2F5)
0x03C5AD|$0F:$C59D:AD F7 05	LDA $05F7  	; probably BGM for current area
0x03C5B0|$0F:$C5A0:4C 61 C5	JMP $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])

; external control flow target (from $04:$968F, $04:$9731)
0x03C5B3|$0F:$C5A3:A2 3C   	LDX #$3C   
0x03C5B5|$0F:$C5A5:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03C5B8|$0F:$C5A8:4C 9D C5	JMP $C59D  

; IRQ/BRK vector handler
; indirect control flow target (via $FFFE)
0x03C5BB|$0F:$C5AB:2C 15 40	BIT $4015  	; READ: pAPU Sound/Vertical Clock Signal Register (#$40: Vertical Clock Signal IRQ Availability, #$10: Delta Modulation, #$08: Noise, #$04: Triangle, #$02: Pulse #2, #$01: Pulse #1), WRITE: pAPU Channel Control (#$10: Delta Modulation, #$08: Noise, #$04: Triangle, #$02: Pulse #2, #$01: Pulse #1)
0x03C5BE|$0F:$C5AE:40      	RTI        

; reset vector handler
; control flow target (from $FFDB)
0x03C5BF|$0F:$C5AF:D8      	CLD        
; control flow target (from $C5B3)
0x03C5C0|$0F:$C5B0:AD 02 20	LDA $2002  	; PPU Status Register (#$80: In VBlank, #$40: Sprite #0 Hit, #$20: Scanline Sprite Count > 8, #$10: Ignore VRAM Writes); after read, #$80 and $2005-$2006 are reset
0x03C5C3|$0F:$C5B3:10 FB   	BPL $C5B0  	; wait for VBlank
; control flow target (from $C5B8)
0x03C5C5|$0F:$C5B5:AD 02 20	LDA $2002  	; PPU Status Register (#$80: In VBlank, #$40: Sprite #0 Hit, #$20: Scanline Sprite Count > 8, #$10: Ignore VRAM Writes); after read, #$80 and $2005-$2006 are reset
0x03C5C8|$0F:$C5B8:10 FB   	BPL $C5B5  	; wait for VBlank again
0x03C5CA|$0F:$C5BA:A9 08   	LDA #$08   
0x03C5CC|$0F:$C5BC:8D 00 20	STA $2000  	; PPU Control Register #1 (#$80: Execute NMI on VBlank, #$40: unused, #$20: Sprite Size [8x8/8x16], #$10: Background Pattern Table Address [$0000/$1000], #$08: Sprite Pattern Table Address [$0000/$1000], #$04: PPU Address Increment [1/32], #$03: Name Table Address [$2000/$2400/$2800/$2C00])
0x03C5CF|$0F:$C5BF:A9 00   	LDA #$00   
0x03C5D1|$0F:$C5C1:8D 01 20	STA $2001  	; PPU Control Register #2 (#$E0: Full Background Colour, #$01 set [None, Green, Blue, Red], #$E0: Colour Intensity, #$01 not set [None, Green, Blue, Red], #$10: Sprite Visibility, #$80: Background Visibility, #$40: No Sprite Clipping, #$20: No Background Clipping, #$01: Monochrome Display)
0x03C5D4|$0F:$C5C4:8D FF FF	STA $FFFF  	; swap in bank 0
0x03C5D7|$0F:$C5C7:8D FF FF	STA $FFFF  
0x03C5DA|$0F:$C5CA:8D FF FF	STA $FFFF  
0x03C5DD|$0F:$C5CD:8D FF FF	STA $FFFF  
0x03C5E0|$0F:$C5D0:8D FF FF	STA $FFFF  
0x03C5E3|$0F:$C5D3:8D 45 61	STA $6145  
0x03C5E6|$0F:$C5D6:8D 46 61	STA $6146  
0x03C5E9|$0F:$C5D9:A9 88   	LDA #$88   
0x03C5EB|$0F:$C5DB:8D AE 61	STA $61AE  
0x03C5EE|$0F:$C5DE:A9 89   	LDA #$89   
0x03C5F0|$0F:$C5E0:8D AF 61	STA $61AF  
0x03C5F3|$0F:$C5E3:A2 FF   	LDX #$FF   	; reset stack pointer
0x03C5F5|$0F:$C5E5:9A      	TXS        
0x03C5F6|$0F:$C5E6:A0 00   	LDY #$00   
0x03C5F8|$0F:$C5E8:84 00   	STY $00    
0x03C5FA|$0F:$C5EA:84 01   	STY $01    
0x03C5FC|$0F:$C5EC:98      	TYA        
; control flow target (from $C5F9)
0x03C5FD|$0F:$C5ED:91 00   	STA ($00),Y	; reset all $800 of system RAM to #$00
0x03C5FF|$0F:$C5EF:E6 00   	INC $00    
0x03C601|$0F:$C5F1:D0 02   	BNE $C5F5  
0x03C603|$0F:$C5F3:E6 01   	INC $01    
; control flow target (from $C5F1)
0x03C605|$0F:$C5F5:A6 01   	LDX $01    
0x03C607|$0F:$C5F7:E0 08   	CPX #$08   
0x03C609|$0F:$C5F9:D0 F2   	BNE $C5ED  
0x03C60B|$0F:$C5FB:A9 0E   	LDA #$0E   	; 8kb CHR, 16kb+fixed-last PRG, vertical mirroring
0x03C60D|$0F:$C5FD:8D 92 01	STA $0192  	; MMC1 control mode (#$10 = CHR mode [1 8k block/2 4k blocks], #$0C = PRG mode [32kb/32kb/fixed-first+16kb/16kb+fixed-last], #$03 = Mirroring [1 low/1 high/vertical/horizontal])
0x03C610|$0F:$C600:A9 00   	LDA #$00   	; CHR bank 0
0x03C612|$0F:$C602:8D 93 01	STA $0193  	; CHR bank 0
0x03C615|$0F:$C605:20 0B C6	JSR $C60B  	; initialize MMC control mode and CHR banks
0x03C618|$0F:$C608:4C 61 C6	JMP $C661  

; initialize MMC control mode and CHR banks
; control flow target (from $C0C3, $C605)
0x03C61B|$0F:$C60B:EE DE FF	INC $FFDE  	; #$80; used to reset MMC1 shift register and switch to last-fixed-bank mode
0x03C61E|$0F:$C60E:AD 92 01	LDA $0192  	; MMC1 control mode (#$10 = CHR mode [1 8k block/2 4k blocks], #$0C = PRG mode [32kb/32kb/fixed-first+16kb/16kb+fixed-last], #$03 = Mirroring [1 low/1 high/vertical/horizontal])
0x03C621|$0F:$C611:20 1F C6	JSR $C61F  	; set MMC control mode based on A
0x03C624|$0F:$C614:AD 93 01	LDA $0193  	; CHR bank 0
0x03C627|$0F:$C617:20 36 C6	JSR $C636  	; set CHR bank 0 based on A
0x03C62A|$0F:$C61A:A9 00   	LDA #$00   
0x03C62C|$0F:$C61C:4C 4D C6	JMP $C64D  	; set CHR bank 1 based on A

; set MMC control mode based on A
; control flow target (from $C611)
; external control flow target (from $07:$8917, $07:$89C2, $09:$801A)
0x03C62F|$0F:$C61F:8D 92 01	STA $0192  	; MMC1 control mode (#$10 = CHR mode [1 8k block/2 4k blocks], #$0C = PRG mode [32kb/32kb/fixed-first+16kb/16kb+fixed-last], #$03 = Mirroring [1 low/1 high/vertical/horizontal])
0x03C632|$0F:$C622:8D FF 9F	STA $9FFF  
0x03C635|$0F:$C625:4A      	LSR        
0x03C636|$0F:$C626:8D FF 9F	STA $9FFF  
0x03C639|$0F:$C629:4A      	LSR        
0x03C63A|$0F:$C62A:8D FF 9F	STA $9FFF  
0x03C63D|$0F:$C62D:4A      	LSR        
0x03C63E|$0F:$C62E:8D FF 9F	STA $9FFF  
0x03C641|$0F:$C631:4A      	LSR        
0x03C642|$0F:$C632:8D FF 9F	STA $9FFF  
0x03C645|$0F:$C635:60      	RTS        

; set CHR bank 0 based on A
; control flow target (from $C617, $D19B)
0x03C646|$0F:$C636:8D 93 01	STA $0193  	; CHR bank 0
0x03C649|$0F:$C639:8D FF BF	STA $BFFF  
0x03C64C|$0F:$C63C:4A      	LSR        
0x03C64D|$0F:$C63D:8D FF BF	STA $BFFF  
0x03C650|$0F:$C640:4A      	LSR        
0x03C651|$0F:$C641:8D FF BF	STA $BFFF  
0x03C654|$0F:$C644:4A      	LSR        
0x03C655|$0F:$C645:8D FF BF	STA $BFFF  
0x03C658|$0F:$C648:4A      	LSR        
0x03C659|$0F:$C649:8D FF BF	STA $BFFF  
0x03C65C|$0F:$C64C:60      	RTS        

; set CHR bank 1 based on A
; control flow target (from $C61C)
0x03C65D|$0F:$C64D:8D FF DF	STA $DFFF  
0x03C660|$0F:$C650:4A      	LSR        
0x03C661|$0F:$C651:8D FF DF	STA $DFFF  
0x03C664|$0F:$C654:4A      	LSR        
0x03C665|$0F:$C655:8D FF DF	STA $DFFF  
0x03C668|$0F:$C658:4A      	LSR        
0x03C669|$0F:$C659:8D FF DF	STA $DFFF  
0x03C66C|$0F:$C65C:4A      	LSR        
0x03C66D|$0F:$C65D:8D FF DF	STA $DFFF  
0x03C670|$0F:$C660:60      	RTS        

; control flow target (from $C608)
0x03C671|$0F:$C661:A9 FF   	LDA #$FF   
0x03C673|$0F:$C663:85 00   	STA $00    
0x03C675|$0F:$C665:84 01   	STY $01    	; Y is still #$00
0x03C677|$0F:$C667:A9 8F   	LDA #$8F   
0x03C679|$0F:$C669:85 30   	STA $30    
0x03C67B|$0F:$C66B:A9 00   	LDA #$00   
0x03C67D|$0F:$C66D:8D 07 60	STA $6007  
0x03C680|$0F:$C670:A9 88   	LDA #$88   
0x03C682|$0F:$C672:8D 00 20	STA $2000  	; PPU Control Register #1 (#$80: Execute NMI on VBlank, #$40: unused, #$20: Sprite Size [8x8/8x16], #$10: Background Pattern Table Address [$0000/$1000], #$08: Sprite Pattern Table Address [$0000/$1000], #$04: PPU Address Increment [1/32], #$03: Name Table Address [$2000/$2400/$2800/$2C00])
0x03C685|$0F:$C675:A9 00   	LDA #$00   
0x03C687|$0F:$C677:8D 01 20	STA $2001  	; PPU Control Register #2 (#$E0: Full Background Colour, #$01 set [None, Green, Blue, Red], #$E0: Colour Intensity, #$01 not set [None, Green, Blue, Red], #$10: Sprite Visibility, #$80: Background Visibility, #$40: No Sprite Clipping, #$20: No Background Clipping, #$01: Monochrome Display)
0x03C68A|$0F:$C67A:20 68 C4	JSR $C468  	; set every 4th byte of $0200 - $02FC to #$F0
0x03C68D|$0F:$C67D:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C690|$0F:$C680:20 75 F7	JSR $F775  	; load ROM bank #$03
; call to code in a different bank ($03:$8006)
0x03C693|$0F:$C683:20 06 80	JSR $8006  
0x03C696|$0F:$C686:A9 0A   	LDA #$0A   
0x03C698|$0F:$C688:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
; call to code in a different bank ($0A:$8000)
0x03C69B|$0F:$C68B:20 00 80	JSR $8000  
0x03C69E|$0F:$C68E:A9 0B   	LDA #$0B   
0x03C6A0|$0F:$C690:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
; call to code in a different bank ($0B:$8000)
0x03C6A3|$0F:$C693:20 00 80	JSR $8000  
0x03C6A6|$0F:$C696:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03C6A9|$0F:$C699:00	; $08:$8000

; data -> code
0x03C6AA|$0F:$C69A:A9 FF   	LDA #$FF   
0x03C6AC|$0F:$C69C:8D 08 60	STA $6008  
0x03C6AF|$0F:$C69F:A9 8F   	LDA #$8F   
0x03C6B1|$0F:$C6A1:85 30   	STA $30    
0x03C6B3|$0F:$C6A3:A2 1E   	LDX #$1E   
0x03C6B5|$0F:$C6A5:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03C6B8|$0F:$C6A8:20 5C F7	JSR $F75C  	; load ROM bank #$00
0x03C6BB|$0F:$C6AB:A9 05   	LDA #$05   
0x03C6BD|$0F:$C6AD:85 0C   	STA $0C    
; call to code in a different bank ($00:$8000)
0x03C6BF|$0F:$C6AF:20 00 80	JSR $8000  
0x03C6C2|$0F:$C6B2:20 5E C7	JSR $C75E  	; copy $C7A7-$C7AE to $053A-$0541, set $1F to #$FF
0x03C6C5|$0F:$C6B5:A2 17   	LDX #$17   
; control flow target (from $C6BE)
0x03C6C7|$0F:$C6B7:BD 8F C7	LDA $C78F,X	; hero starting equipment
0x03C6CA|$0F:$C6BA:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x03C6CD|$0F:$C6BD:CA      	DEX        
0x03C6CE|$0F:$C6BE:10 F7   	BPL $C6B7  
0x03C6D0|$0F:$C6C0:A9 FF   	LDA #$FF   
0x03C6D2|$0F:$C6C2:85 8E   	STA $8E    	; flag for in battle or not (#$FF)?
0x03C6D4|$0F:$C6C4:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03C6D7|$0F:$C6C7:C2	; $06:$8004; -> $06:$A843: display and handle main game menu

; data -> code
0x03C6D8|$0F:$C6C8:A9 00   	LDA #$00   
0x03C6DA|$0F:$C6CA:85 8E   	STA $8E    	; flag for in battle or not (#$FF)?
0x03C6DC|$0F:$C6CC:8D AD 61	STA $61AD  
0x03C6DF|$0F:$C6CF:AD 70 70	LDA $7070  	; ????, SRAM buffer
0x03C6E2|$0F:$C6D2:D0 19   	BNE $C6ED  
0x03C6E4|$0F:$C6D4:20 6C C7	JSR $C76C  
0x03C6E7|$0F:$C6D7:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03C6EA|$0F:$C6DA:CF	; $06:$801E; -> $06:$A885: copy save data from system RAM to per-game save data

; data -> code
0x03C6EB|$0F:$C6DB:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03C6EE|$0F:$C6DE:E0	; $07:$8000

; data -> code
0x03C6EF|$0F:$C6DF:A9 07   	LDA #$07   
0x03C6F1|$0F:$C6E1:85 48   	STA $48    	; last save point ID
0x03C6F3|$0F:$C6E3:20 1F C8	JSR $C81F  
0x03C6F6|$0F:$C6E6:A9 00   	LDA #$00   	; Save Point ID #$00: Midenhall 2F
0x03C6F8|$0F:$C6E8:85 48   	STA $48    	; last save point ID
0x03C6FA|$0F:$C6EA:4C 00 C7	JMP $C700  

; control flow target (from $C6D2)
0x03C6FD|$0F:$C6ED:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03C700|$0F:$C6F0:20 6C C7	JSR $C76C  
0x03C703|$0F:$C6F3:20 2A C4	JSR $C42A  
0x03C706|$0F:$C6F6:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03C709|$0F:$C6F9:C3	; $06:$8006; -> $06:$ABC7: copy save data from save data buffer at $7000 to system RAM; update Don Mahone quest status if applicable

; data -> code
0x03C70A|$0F:$C6FA:20 B9 D2	JSR $D2B9  
; call to code in a different bank ($06:$8F4E)
0x03C70D|$0F:$C6FD:20 4E 8F	JSR $8F4E  
; control flow target (from $C6EA, $C716, $C898, $C91E, $C928, $C9BD, $CA4A, $CA91, $CAB0, $CAB7, $CB39, $CB5F, $CBA2, $CBDC, $CC07, $CC5D, $CC9F, $D292)
0x03C710|$0F:$C700:A9 00   	LDA #$00   
0x03C712|$0F:$C702:85 03   	STA $03    	; game clock?
; control flow target (from $C75B)
0x03C714|$0F:$C704:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x03C717|$0F:$C707:A5 2F   	LDA $2F    	; joypad 1 data
0x03C719|$0F:$C709:4A      	LSR        
0x03C71A|$0F:$C70A:90 0D   	BCC $C719  
0x03C71C|$0F:$C70C:20 61 F7	JSR $F761  	; load ROM bank #$06
; call to code in a different bank ($06:$8048)
0x03C71F|$0F:$C70F:20 48 80	JSR $8048  
0x03C722|$0F:$C712:A9 00   	LDA #$00   
0x03C724|$0F:$C714:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03C726|$0F:$C716:4C 00 C7	JMP $C700  

; control flow target (from $C70A)
0x03C729|$0F:$C719:A5 2F   	LDA $2F    	; joypad 1 data
0x03C72B|$0F:$C71B:29 10   	AND #$10   
0x03C72D|$0F:$C71D:F0 06   	BEQ $C725  
0x03C72F|$0F:$C71F:20 97 E7	JSR $E797  
0x03C732|$0F:$C722:4C 7F C8	JMP $C87F  

; control flow target (from $C71D)
0x03C735|$0F:$C725:A5 2F   	LDA $2F    	; joypad 1 data
0x03C737|$0F:$C727:29 20   	AND #$20   
0x03C739|$0F:$C729:F0 06   	BEQ $C731  
0x03C73B|$0F:$C72B:20 B4 E6	JSR $E6B4  
0x03C73E|$0F:$C72E:4C 7F C8	JMP $C87F  

; control flow target (from $C729)
0x03C741|$0F:$C731:A5 2F   	LDA $2F    	; joypad 1 data
0x03C743|$0F:$C733:29 40   	AND #$40   
0x03C745|$0F:$C735:F0 06   	BEQ $C73D  
0x03C747|$0F:$C737:20 36 E6	JSR $E636  
0x03C74A|$0F:$C73A:4C 7F C8	JMP $C87F  

; control flow target (from $C735)
0x03C74D|$0F:$C73D:A5 2F   	LDA $2F    	; joypad 1 data
0x03C74F|$0F:$C73F:10 06   	BPL $C747  
0x03C751|$0F:$C741:20 C2 E5	JSR $E5C2  
0x03C754|$0F:$C744:4C 7F C8	JMP $C87F  

; control flow target (from $C73F, $D426, $E5CD, $E641, $E6BF, $E7A2)
0x03C757|$0F:$C747:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C75A|$0F:$C74A:A5 03   	LDA $03    	; game clock?
0x03C75C|$0F:$C74C:C9 51   	CMP #$51   
0x03C75E|$0F:$C74E:D0 08   	BNE $C758  
0x03C760|$0F:$C750:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x03C763|$0F:$C753:00	; Menu ID #$00: Mini status window, bottom

; data -> code
0x03C764|$0F:$C754:A9 51   	LDA #$51   
0x03C766|$0F:$C756:85 03   	STA $03    	; game clock?
; control flow target (from $C74E)
0x03C768|$0F:$C758:20 CB D8	JSR $D8CB  
0x03C76B|$0F:$C75B:4C 04 C7	JMP $C704  

; copy $C7A7-$C7AE to $053A-$0541, set $1F to #$FF
; control flow target (from $C6B2)
0x03C76E|$0F:$C75E:A0 07   	LDY #$07   
; control flow target (from $C767)
0x03C770|$0F:$C760:B9 A7 C7	LDA $C7A7,Y
0x03C773|$0F:$C763:99 3A 05	STA $053A,Y
0x03C776|$0F:$C766:88      	DEY        
0x03C777|$0F:$C767:10 F7   	BPL $C760  
0x03C779|$0F:$C769:84 1F   	STY $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu); $1F = #$FF
0x03C77B|$0F:$C76B:60      	RTS        

; control flow target (from $C6D4, $C6F0)
0x03C77C|$0F:$C76C:A9 84   	LDA #$84   
0x03C77E|$0F:$C76E:8D 2D 06	STA $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03C781|$0F:$C771:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$8009)
0x03C784|$0F:$C774:20 09 80	JSR $8009  	; update each hero's stats based on their current EXP
0x03C787|$0F:$C777:A9 0F   	LDA #$0F   
0x03C789|$0F:$C779:85 30   	STA $30    
; restore full HP/MP to all living party members
; control flow target (from $D2D5)
; external control flow target (from $06:$9419, $06:$BD4C)
0x03C78B|$0F:$C77B:A9 01   	LDA #$01   	; make sure each hero has at least 1 HP so that $06:$8DCC will fully heal them
0x03C78D|$0F:$C77D:8D 3B 06	STA $063B  	; Midenhall Current HP, low byte
0x03C790|$0F:$C780:8D 4D 06	STA $064D  	; Cannock Current HP, low byte
0x03C793|$0F:$C783:8D 5F 06	STA $065F  	; Moonbrooke Current HP, low byte
0x03C796|$0F:$C786:20 61 F7	JSR $F761  	; load ROM bank #$06
; call to code in a different bank ($06:$8DCC)
0x03C799|$0F:$C789:20 CC 8D	JSR $8DCC  	; restore full HP to all living party members
; call to code in a different bank ($06:$8DEC)
0x03C79C|$0F:$C78C:4C EC 8D	JMP $8DEC  	; restore full MP to all living party members


; code -> data
; hero starting equipment
; Midenhall
; indexed data load target (from $C6B7)
0x03C79F|$0F:$C78F:55	; Item ID #$55: Leather Armor (equipped)
0x03C7A0|$0F:$C790:00	; Item ID #$00: (no item)
0x03C7A1|$0F:$C791:00	; Item ID #$00: (no item)
0x03C7A2|$0F:$C792:00	; Item ID #$00: (no item)
0x03C7A3|$0F:$C793:00	; Item ID #$00: (no item)
0x03C7A4|$0F:$C794:00	; Item ID #$00: (no item)
0x03C7A5|$0F:$C795:00	; Item ID #$00: (no item)
0x03C7A6|$0F:$C796:00	; Item ID #$00: (no item)
; Cannock
0x03C7A7|$0F:$C797:45	; Item ID #$45: Club (equipped)
0x03C7A8|$0F:$C798:55	; Item ID #$55: Leather Armor (equipped)
0x03C7A9|$0F:$C799:00	; Item ID #$00: (no item)
0x03C7AA|$0F:$C79A:00	; Item ID #$00: (no item)
0x03C7AB|$0F:$C79B:00	; Item ID #$00: (no item)
0x03C7AC|$0F:$C79C:00	; Item ID #$00: (no item)
0x03C7AD|$0F:$C79D:00	; Item ID #$00: (no item)
0x03C7AE|$0F:$C79E:00	; Item ID #$00: (no item)
; Moonbrooke
0x03C7AF|$0F:$C79F:41	; Item ID #$41: Bamboo Stick (equipped)
0x03C7B0|$0F:$C7A0:51	; Item ID #$51: Clothes (equipped)
0x03C7B1|$0F:$C7A1:00	; Item ID #$00: (no item)
0x03C7B2|$0F:$C7A2:00	; Item ID #$00: (no item)
0x03C7B3|$0F:$C7A3:00	; Item ID #$00: (no item)
0x03C7B4|$0F:$C7A4:00	; Item ID #$00: (no item)
0x03C7B5|$0F:$C7A5:00	; Item ID #$00: (no item)
0x03C7B6|$0F:$C7A6:00	; Item ID #$00: (no item)
; indexed data load target (from $C760)
0x03C7B7|$0F:$C7A7:80
0x03C7B8|$0F:$C7A8:6F
0x03C7B9|$0F:$C7A9:00
0x03C7BA|$0F:$C7AA:00
0x03C7BB|$0F:$C7AB:00
0x03C7BC|$0F:$C7AC:00
0x03C7BD|$0F:$C7AD:02
0x03C7BE|$0F:$C7AE:00

; data -> code
; control flow target (from $C81F, $D2D8, $FF5A)
0x03C7BF|$0F:$C7AF:A9 FF   	LDA #$FF   
0x03C7C1|$0F:$C7B1:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03C7C3|$0F:$C7B3:A5 48   	LDA $48    	; last save point ID
0x03C7C5|$0F:$C7B5:0A      	ASL        
0x03C7C6|$0F:$C7B6:0A      	ASL        
0x03C7C7|$0F:$C7B7:A8      	TAY        
0x03C7C8|$0F:$C7B8:B9 EF C7	LDA $C7EF,Y	; save point map ID
0x03C7CB|$0F:$C7BB:85 31   	STA $31    	; current map ID
0x03C7CD|$0F:$C7BD:B9 F0 C7	LDA $C7F0,Y	; save point X-pos
0x03C7D0|$0F:$C7C0:85 16   	STA $16    	; current map X-pos (1)
0x03C7D2|$0F:$C7C2:85 28   	STA $28    	; current map X-pos (2)
0x03C7D4|$0F:$C7C4:85 2A   	STA $2A    	; current map X-pos pixel, low byte
0x03C7D6|$0F:$C7C6:B9 F1 C7	LDA $C7F1,Y	; save point Y-pos
0x03C7D9|$0F:$C7C9:85 17   	STA $17    	; current map Y-pos (1)
0x03C7DB|$0F:$C7CB:85 29   	STA $29    	; current map Y-pos (2)
0x03C7DD|$0F:$C7CD:85 2C   	STA $2C    	; current map Y-pos pixel, low byte
0x03C7DF|$0F:$C7CF:B9 F2 C7	LDA $C7F2,Y	; save point ???
0x03C7E2|$0F:$C7D2:85 45   	STA $45    
0x03C7E4|$0F:$C7D4:A9 00   	LDA #$00   
0x03C7E6|$0F:$C7D6:85 38   	STA $38    
0x03C7E8|$0F:$C7D8:85 2B   	STA $2B    	; current map X-pos pixel, high byte
0x03C7EA|$0F:$C7DA:85 2D   	STA $2D    	; current map Y-pos pixel, high byte
0x03C7EC|$0F:$C7DC:A2 04   	LDX #$04   	; convert 16x16 map positions to pixels
; control flow target (from $C7E7)
0x03C7EE|$0F:$C7DE:06 2A   	ASL $2A    	; current map X-pos pixel, low byte
0x03C7F0|$0F:$C7E0:26 2B   	ROL $2B    	; current map X-pos pixel, high byte
0x03C7F2|$0F:$C7E2:06 2C   	ASL $2C    	; current map Y-pos pixel, low byte
0x03C7F4|$0F:$C7E4:26 2D   	ROL $2D    	; current map Y-pos pixel, high byte
0x03C7F6|$0F:$C7E6:CA      	DEX        
0x03C7F7|$0F:$C7E7:D0 F5   	BNE $C7DE  
0x03C7F9|$0F:$C7E9:20 8A E2	JSR $E28A  
0x03C7FC|$0F:$C7EC:4C DC C1	JMP $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF


; code -> data
; save point map ID
; indexed data load target (from $C7B8)
0x03C7FF|$0F:$C7EF:02
; save point X-pos
; indexed data load target (from $C7BD)
0x03C800|$0F:$C7F0:   03
; save point Y-pos
; indexed data load target (from $C7C6)
0x03C801|$0F:$C7F1:      04
; save point ???
; indexed data load target (from $C7CF)
0x03C802|$0F:$C7F2:         05	; Save Point ID #$00: Midenhall 2F
; indirect data load target
0x03C803|$0F:$C7F3:06 03 05 05	; Save Point ID #$01: Cannock
0x03C807|$0F:$C7F7:0C 1B 07 05	; Save Point ID #$02: Tantegel
0x03C80B|$0F:$C7FB:0F 0E 06 05	; Save Point ID #$03: Osterfair
0x03C80F|$0F:$C7FF:15 02 02 05	; Save Point ID #$04: Beran
0x03C813|$0F:$C803:1F 04 03 05	; Save Point ID #$05: Rhone Shrine
0x03C817|$0F:$C807:07 0F 02 05	; Save Point ID #$06: Hamlin
0x03C81B|$0F:$C80B:02 06 03 00	; Map ID #$02: Midenhall 2F
0x03C81F|$0F:$C80F:09 07 0A FF	; Map ID #$09: Moonbrooke
0x03C823|$0F:$C813:03 0F 11 FF	; Map ID #$03: Midenhall 1F
0x03C827|$0F:$C817:01 63 6F FF	; Map ID #$01: World Map
0x03C82B|$0F:$C81B:01 CF 38 FF	; Map ID #$01: World Map

; data -> code
; control flow target (from $C6E3)
0x03C82F|$0F:$C81F:20 AF C7	JSR $C7AF  
0x03C832|$0F:$C822:A9 0A   	LDA #$0A   
0x03C834|$0F:$C824:8D 71 05	STA $0571  	; NPC #$06 sprite ID
0x03C837|$0F:$C827:20 CB D8	JSR $D8CB  
0x03C83A|$0F:$C82A:A2 3C   	LDX #$3C   
0x03C83C|$0F:$C82C:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03C83F|$0F:$C82F:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03C842|$0F:$C832:83
; indirect data load target
0x03C843|$0F:$C833:20
; indirect data load target
0x03C844|$0F:$C834:C1 80	; $07:$80C1; motion script for guard #2 part 9, prologue

; data -> code
0x03C846|$0F:$C836:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03C849|$0F:$C839:A2 3C   	LDX #$3C   
0x03C84B|$0F:$C83B:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03C84E|$0F:$C83E:20 EA F6	JSR $F6EA  	; open main dialogue window and display string ID specified by byte following JSR

; code -> data
; indirect data load target
0x03C851|$0F:$C841:73	; String ID #$0073: ‘Hear me, oh King[.’][wait][line]‘The army of Hargon the Sorcerer has sacked Moonbrooke Castle from whence I came[.’][wait][line]‘The evil of his magic is great and I fear he will soon rule all the world[..][..][wait][line]unless a monarch as great as thyself stands against him[.’][end-FC]

; data -> code
0x03C852|$0F:$C842:A9 FF   	LDA #$FF   
0x03C854|$0F:$C844:8D 71 05	STA $0571  	; NPC #$06 sprite ID
0x03C857|$0F:$C847:20 CB D8	JSR $D8CB  
0x03C85A|$0F:$C84A:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03C85D|$0F:$C84D:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x03C860|$0F:$C850:04	; Menu ID #$04: Dialogue window

; data -> code
0x03C861|$0F:$C851:A9 00   	LDA #$00   
0x03C863|$0F:$C853:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x03C866|$0F:$C856:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x03C869|$0F:$C859:74	; String ID #$0074: ‘[name], my heir. Thou hast heard the tale of this man[.’][wait][line]‘I am old and this task must fall to younger hands[.’][wait][line]‘Thy destiny lies on that difficult road, just as it did for Erdrick the Great,[wait][line]for thou art of the line of Erdrick, and his doom is thine[.’][wait][line]‘Come with me now if thou art ready[.’][end-FC]

; data -> code
0x03C86A|$0F:$C85A:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03C86D|$0F:$C85D:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03C870|$0F:$C860:81
; indirect data load target
0x03C871|$0F:$C861:22
; indirect data load target
0x03C872|$0F:$C862:4A 80	; $07:$804A; motion script for King Midenhall, Lighthouse Wizard part 1

; data -> code
0x03C874|$0F:$C864:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03C877|$0F:$C867:A9 03   	LDA #$03   
0x03C879|$0F:$C869:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03C87B|$0F:$C86B:A9 00   	LDA #$00   
0x03C87D|$0F:$C86D:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03C87F|$0F:$C86F:60      	RTS        


; code -> data
; Hargon's minion map ID
; indexed data load target (from $C8AF)
0x03C880|$0F:$C870:46
; Hargon's minion X-pos
; indexed data load target (from $C8B7)
; indirect data load target
0x03C881|$0F:$C871:   06
; Hargon's minion Y-pos
; indexed data load target (from $C8BF)
0x03C882|$0F:$C872:      05
; Hargon's minion $05FD value
; indexed data load target (from $C8C4)
0x03C883|$0F:$C873:         04
; Hargon's minion fixed encounter ID
; indexed data load target (from $C8CE)
0x03C884|$0F:$C874:            08	; Map ID #$46: Hargon's Castle 4F
0x03C885|$0F:$C875:47 01 01 08 09	; Map ID #$47: Hargon's Castle 5F
0x03C88A|$0F:$C87A:48 0B 03 10 0A	; Map ID #$48: Hargon's Castle 6F

; data -> code
; control flow target (from $C722, $C72E, $C73A, $C744)
0x03C88F|$0F:$C87F:20 6B D4	JSR $D46B  
0x03C892|$0F:$C882:A5 D0   	LDA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x03C894|$0F:$C884:10 15   	BPL $C89B  
0x03C896|$0F:$C886:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03C899|$0F:$C889:DD	; $06:$803A

; data -> code
0x03C89A|$0F:$C88A:A5 31   	LDA $31    	; current map ID
0x03C89C|$0F:$C88C:C9 03   	CMP #$03   	; Map ID #$03: Midenhall 1F
0x03C89E|$0F:$C88E:D0 08   	BNE $C898  
0x03C8A0|$0F:$C890:A9 06   	LDA #$06   
0x03C8A2|$0F:$C892:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03C8A4|$0F:$C894:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03C8A7|$0F:$C897:DC	; $06:$8038

; data -> code
; control flow target (from $C88E)
0x03C8A8|$0F:$C898:4C 00 C7	JMP $C700  

; control flow target (from $C884)
0x03C8AB|$0F:$C89B:20 61 F7	JSR $F761  	; load ROM bank #$06
; call to code in a different bank ($06:$A09E)
0x03C8AE|$0F:$C89E:20 9E A0	JSR $A09E  
0x03C8B1|$0F:$C8A1:EA      	NOP        
0x03C8B2|$0F:$C8A2:EA      	NOP        
0x03C8B3|$0F:$C8A3:EA      	NOP        
0x03C8B4|$0F:$C8A4:EA      	NOP        
0x03C8B5|$0F:$C8A5:EA      	NOP        
0x03C8B6|$0F:$C8A6:EA      	NOP        
0x03C8B7|$0F:$C8A7:A5 31   	LDA $31    	; current map ID
0x03C8B9|$0F:$C8A9:C9 0F   	CMP #$0F   	; Map ID #$0F: Osterfair
0x03C8BB|$0F:$C8AB:F0 5E   	BEQ $C90B  
0x03C8BD|$0F:$C8AD:A0 00   	LDY #$00   
; control flow target (from $C8EA)
0x03C8BF|$0F:$C8AF:D9 70 C8	CMP $C870,Y	; Hargon's minion map ID
0x03C8C2|$0F:$C8B2:D0 2F   	BNE $C8E3  
0x03C8C4|$0F:$C8B4:A5 16   	LDA $16    	; current map X-pos (1)
0x03C8C6|$0F:$C8B6:4A      	LSR        
0x03C8C7|$0F:$C8B7:D9 71 C8	CMP $C871,Y	; Hargon's minion X-pos
0x03C8CA|$0F:$C8BA:D0 30   	BNE $C8EC  
0x03C8CC|$0F:$C8BC:A5 17   	LDA $17    	; current map Y-pos (1)
0x03C8CE|$0F:$C8BE:4A      	LSR        
0x03C8CF|$0F:$C8BF:D9 72 C8	CMP $C872,Y	; Hargon's minion Y-pos
0x03C8D2|$0F:$C8C2:D0 28   	BNE $C8EC  
0x03C8D4|$0F:$C8C4:B9 73 C8	LDA $C873,Y	; Hargon's minion $05FD value
0x03C8D7|$0F:$C8C7:8D FD 05	STA $05FD  
0x03C8DA|$0F:$C8CA:25 D1   	AND $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03C8DC|$0F:$C8CC:D0 1E   	BNE $C8EC  	; branch if minion already dead
0x03C8DE|$0F:$C8CE:B9 74 C8	LDA $C874,Y	; Hargon's minion fixed encounter ID
0x03C8E1|$0F:$C8D1:20 5C D2	JSR $D25C  	; trigger fixed battle A
0x03C8E4|$0F:$C8D4:A5 98   	LDA $98    	; outcome of last fight?
0x03C8E6|$0F:$C8D6:C9 FC   	CMP #$FC   
0x03C8E8|$0F:$C8D8:F0 12   	BEQ $C8EC  
0x03C8EA|$0F:$C8DA:A5 D1   	LDA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03C8EC|$0F:$C8DC:0D FD 05	ORA $05FD  
0x03C8EF|$0F:$C8DF:85 D1   	STA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03C8F1|$0F:$C8E1:D0 09   	BNE $C8EC  
; control flow target (from $C8B2)
0x03C8F3|$0F:$C8E3:C8      	INY        
0x03C8F4|$0F:$C8E4:C8      	INY        
0x03C8F5|$0F:$C8E5:C8      	INY        
0x03C8F6|$0F:$C8E6:C8      	INY        
0x03C8F7|$0F:$C8E7:C8      	INY        
0x03C8F8|$0F:$C8E8:C0 0F   	CPY #$0F   
0x03C8FA|$0F:$C8EA:D0 C3   	BNE $C8AF  
; control flow target (from $C8BA, $C8C2, $C8CC, $C8D8, $C8E1)
0x03C8FC|$0F:$C8EC:20 66 F7	JSR $F766  	; load ROM bank #$04
0x03C8FF|$0F:$C8EF:A5 1D   	LDA $1D    
0x03C901|$0F:$C8F1:F0 12   	BEQ $C905  
0x03C903|$0F:$C8F3:A9 00   	LDA #$00   
0x03C905|$0F:$C8F5:AE FD 05	LDX $05FD  
0x03C908|$0F:$C8F8:8D FD 05	STA $05FD  
0x03C90B|$0F:$C8FB:E0 00   	CPX #$00   
0x03C90D|$0F:$C8FD:F0 06   	BEQ $C905  
; call to code in a different bank ($04:$8018)
0x03C90F|$0F:$C8FF:20 18 80	JSR $8018  
0x03C912|$0F:$C902:4C 08 C9	JMP $C908  

; control flow target (from $C8F1, $C8FD)
; call to code in a different bank ($04:$8000)
0x03C915|$0F:$C905:20 00 80	JSR $8000  
; control flow target (from $C902)
0x03C918|$0F:$C908:20 62 D2	JSR $D262  
; control flow target (from $C8AB)
0x03C91B|$0F:$C90B:A5 31   	LDA $31    	; current map ID
0x03C91D|$0F:$C90D:C9 29   	CMP #$29   	; Map ID #$29: Rubiss' Shrine B7
0x03C91F|$0F:$C90F:D0 10   	BNE $C921  
0x03C921|$0F:$C911:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03C924|$0F:$C914:03
; indirect data load target
0x03C925|$0F:$C915:03

; data -> code
0x03C926|$0F:$C916:D0 09   	BNE $C921  
0x03C928|$0F:$C918:20 FB D2	JSR $D2FB  	; load ROM bank 6
; call to code in a different bank ($06:$A2A7)
0x03C92B|$0F:$C91B:20 A7 A2	JSR $A2A7  
0x03C92E|$0F:$C91E:4C 00 C7	JMP $C700  

; control flow target (from $C90F, $C916)
0x03C931|$0F:$C921:A5 44   	LDA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03C933|$0F:$C923:F0 06   	BEQ $C92B  
0x03C935|$0F:$C925:4C C0 C9	JMP $C9C0  

; control flow target (from $C930)
0x03C938|$0F:$C928:4C 00 C7	JMP $C700  

; control flow target (from $C923)
0x03C93B|$0F:$C92B:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03C93E|$0F:$C92E:05
; indirect data load target
0x03C93F|$0F:$C92F:08

; data -> code
0x03C940|$0F:$C930:D0 F6   	BNE $C928  
0x03C942|$0F:$C932:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03C945|$0F:$C935:88
; indirect data load target
0x03C946|$0F:$C936:22
; indirect data load target
0x03C947|$0F:$C937:10 80	; $07:$8010; motion script for granddaughter in Lianport, part 1

; data -> code
0x03C949|$0F:$C939:A9 00   	LDA #$00   
0x03C94B|$0F:$C93B:85 98   	STA $98    	; outcome of last fight?
0x03C94D|$0F:$C93D:20 D2 CC	JSR $CCD2  	; execute scripted motion
; control flow target (from $C978)
0x03C950|$0F:$C940:20 F6 F6	JSR $F6F6  	; open main dialogue window and display string ID specified by byte following JSR + #$0200

; code -> data
; indirect data load target
0x03C953|$0F:$C943:B3	; String ID #$02B3: ‘Help! Help! Evil has come!’[end-FC]

; data -> code
0x03C954|$0F:$C944:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03C957|$0F:$C947:A5 98   	LDA $98    	; outcome of last fight?
0x03C959|$0F:$C949:D0 11   	BNE $C95C  
0x03C95B|$0F:$C94B:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03C95E|$0F:$C94E:87
; indirect data load target
0x03C95F|$0F:$C94F:20
; indirect data load target
0x03C960|$0F:$C950:1D 80	; $07:$801D; motion script for Lianport Gremlin #1

; data -> code
0x03C962|$0F:$C952:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03C965|$0F:$C955:86
; indirect data load target
0x03C966|$0F:$C956:23
; indirect data load target
0x03C967|$0F:$C957:18 80	; $07:$8018; motion script for Lianport Gremlin #2

; data -> code
0x03C969|$0F:$C959:20 D2 CC	JSR $CCD2  	; execute scripted motion
; control flow target (from $C949)
0x03C96C|$0F:$C95C:20 66 F7	JSR $F766  	; load ROM bank #$04
0x03C96F|$0F:$C95F:A9 00   	LDA #$00   	; Fixed Battle #$00: 2 Gremlins (Map ID #$0B: Lianport)
; call to code in a different bank ($04:$800F)
0x03C971|$0F:$C961:20 0F 80	JSR $800F  
0x03C974|$0F:$C964:A9 00   	LDA #$00   
0x03C976|$0F:$C966:85 8E   	STA $8E    	; flag for in battle or not (#$FF)?
0x03C978|$0F:$C968:A5 98   	LDA $98    	; outcome of last fight?
0x03C97A|$0F:$C96A:C9 FC   	CMP #$FC   
0x03C97C|$0F:$C96C:F0 04   	BEQ $C972  
0x03C97E|$0F:$C96E:C9 FF   	CMP #$FF   
0x03C980|$0F:$C970:D0 09   	BNE $C97B  
; control flow target (from $C96C)
0x03C982|$0F:$C972:20 62 D2	JSR $D262  
0x03C985|$0F:$C975:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C988|$0F:$C978:4C 40 C9	JMP $C940  

; control flow target (from $C970)
0x03C98B|$0F:$C97B:20 2A C4	JSR $C42A  
0x03C98E|$0F:$C97E:A9 FF   	LDA #$FF   
0x03C990|$0F:$C980:8D 89 05	STA $0589  	; NPC #$09 sprite ID
0x03C993|$0F:$C983:8D 91 05	STA $0591  	; NPC #$0A sprite ID
0x03C996|$0F:$C986:A9 05   	LDA #$05   
0x03C998|$0F:$C988:8D 94 05	STA $0594  	; NPC #$0B X-pos
0x03C99B|$0F:$C98B:A9 08   	LDA #$08   
0x03C99D|$0F:$C98D:8D 95 05	STA $0595  	; NPC #$0B Y-pos
0x03C9A0|$0F:$C990:A9 03   	LDA #$03   
0x03C9A2|$0F:$C992:8D 98 05	STA $0598  	; NPC #$0B motion nybble + direction nybble
0x03C9A5|$0F:$C995:A9 04   	LDA #$04   
0x03C9A7|$0F:$C997:85 16   	STA $16    	; current map X-pos (1)
0x03C9A9|$0F:$C999:85 28   	STA $28    	; current map X-pos (2)
0x03C9AB|$0F:$C99B:A9 40   	LDA #$40   
0x03C9AD|$0F:$C99D:85 2A   	STA $2A    	; current map X-pos pixel, low byte
0x03C9AF|$0F:$C99F:A9 01   	LDA #$01   	; update ship status: you beat the Gremlins
0x03C9B1|$0F:$C9A1:85 CF   	STA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03C9B3|$0F:$C9A3:A9 06   	LDA #$06   
0x03C9B5|$0F:$C9A5:20 9A D2	JSR $D29A  
0x03C9B8|$0F:$C9A8:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03C9BB|$0F:$C9AB:20 F6 F6	JSR $F6F6  	; open main dialogue window and display string ID specified by byte following JSR + #$0200

; code -> data
; indirect data load target
0x03C9BE|$0F:$C9AE:B4	; String ID #$02B4: ‘Thou hast saved me from the fiends[.’][wait][line]‘Please follow me and meet my grandfather[.’][end-FC]

; data -> code
0x03C9BF|$0F:$C9AF:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03C9C2|$0F:$C9B2:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03C9C5|$0F:$C9B5:88
; indirect data load target
0x03C9C6|$0F:$C9B6:21
; indirect data load target
0x03C9C7|$0F:$C9B7:22 80	; $07:$8022; motion script for granddaughter in Lianport, part 2

; data -> code
0x03C9C9|$0F:$C9B9:A9 01   	LDA #$01   
0x03C9CB|$0F:$C9BB:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03C9CD|$0F:$C9BD:4C 00 C7	JMP $C700  

; control flow target (from $C925)
0x03C9D0|$0F:$C9C0:C9 01   	CMP #$01   
0x03C9D2|$0F:$C9C2:F0 03   	BEQ $C9C7  
0x03C9D4|$0F:$C9C4:4C 4D CA	JMP $CA4D  

; control flow target (from $C9C2)
0x03C9D7|$0F:$C9C7:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03C9DA|$0F:$C9CA:0F
; indirect data load target
0x03C9DB|$0F:$C9CB:08

; data -> code
0x03C9DC|$0F:$C9CC:D0 04   	BNE $C9D2  
0x03C9DE|$0F:$C9CE:A9 01   	LDA #$01   
0x03C9E0|$0F:$C9D0:D0 1B   	BNE $C9ED  
; control flow target (from $C9CC)
0x03C9E2|$0F:$C9D2:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03C9E5|$0F:$C9D5:11
; indirect data load target
0x03C9E6|$0F:$C9D6:08

; data -> code
0x03C9E7|$0F:$C9D7:D0 04   	BNE $C9DD  
0x03C9E9|$0F:$C9D9:A9 03   	LDA #$03   
0x03C9EB|$0F:$C9DB:D0 10   	BNE $C9ED  
; control flow target (from $C9D7)
0x03C9ED|$0F:$C9DD:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03C9F0|$0F:$C9E0:10
; indirect data load target
0x03C9F1|$0F:$C9E1:09

; data -> code
0x03C9F2|$0F:$C9E2:D0 66   	BNE $CA4A  
0x03C9F4|$0F:$C9E4:A9 00   	LDA #$00   
0x03C9F6|$0F:$C9E6:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x03C9F9|$0F:$C9E9:A9 02   	LDA #$02   
0x03C9FB|$0F:$C9EB:D0 03   	BNE $C9F0  
; control flow target (from $C9D0, $C9DB)
0x03C9FD|$0F:$C9ED:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
; control flow target (from $C9EB)
0x03CA00|$0F:$C9F0:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CA02|$0F:$C9F2:20 F6 F6	JSR $F6F6  	; open main dialogue window and display string ID specified by byte following JSR + #$0200

; code -> data
; indirect data load target
0x03CA05|$0F:$C9F5:B5	; String ID #$02B5: ‘These good people aided me in my time of need, Grandfather[.’][FD][FD][end-FC]

; data -> code
0x03CA06|$0F:$C9F6:A5 44   	LDA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CA08|$0F:$C9F8:C9 01   	CMP #$01   
0x03CA0A|$0F:$C9FA:D0 09   	BNE $CA05  
0x03CA0C|$0F:$C9FC:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA0F|$0F:$C9FF:88
; indirect data load target
0x03CA10|$0F:$CA00:20
; indirect data load target
0x03CA11|$0F:$CA01:2F 80	; $07:$802F; motion script for granddaughter in Lianport, part 3 (from left)

; data -> code
0x03CA13|$0F:$CA03:90 07   	BCC $CA0C  
; control flow target (from $C9FA)
0x03CA15|$0F:$CA05:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA18|$0F:$CA08:88
; indirect data load target
0x03CA19|$0F:$CA09:20
; indirect data load target
0x03CA1A|$0F:$CA0A:33 80	; $07:$8033; motion script for granddaughter in Lianport, part 3 (from right)

; data -> code
; control flow target (from $CA03)
0x03CA1C|$0F:$CA0C:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CA1F|$0F:$CA0F:A5 44   	LDA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CA21|$0F:$CA11:C9 01   	CMP #$01   
0x03CA23|$0F:$CA13:D0 09   	BNE $CA1E  
0x03CA25|$0F:$CA15:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA28|$0F:$CA18:89
; indirect data load target
0x03CA29|$0F:$CA19:22
; indirect data load target
0x03CA2A|$0F:$CA1A:36 80	; $07:$8036; motion script for grandfather in Lianport, part 1 (from left or bottom)

; data -> code
0x03CA2C|$0F:$CA1C:90 14   	BCC $CA32  
; control flow target (from $CA13)
0x03CA2E|$0F:$CA1E:C9 02   	CMP #$02   
0x03CA30|$0F:$CA20:D0 09   	BNE $CA2B  
0x03CA32|$0F:$CA22:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA35|$0F:$CA25:89
; indirect data load target
0x03CA36|$0F:$CA26:22
; indirect data load target
0x03CA37|$0F:$CA27:39 80	; $07:$8039; motion script for grandfather in Lianport, part 1 (from bottom)

; data -> code
0x03CA39|$0F:$CA29:90 07   	BCC $CA32  
; control flow target (from $CA20)
0x03CA3B|$0F:$CA2B:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA3E|$0F:$CA2E:89
; indirect data load target
0x03CA3F|$0F:$CA2F:22
; indirect data load target
0x03CA40|$0F:$CA30:3C 80	; $07:$803C; motion script for grandfather in Lianport, part 1 (from right)

; data -> code
; control flow target (from $CA1C, $CA29)
0x03CA42|$0F:$CA32:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CA45|$0F:$CA35:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x03CA48|$0F:$CA38:B6	; String ID #$02B6: ‘Having gallantly aided my granddaughter,[wait][line]I shall gladly lend thee my swiftest ship[.’][end-FC]

; data -> code
0x03CA49|$0F:$CA39:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03CA4C|$0F:$CA3C:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA4F|$0F:$CA3F:89
; indirect data load target
0x03CA50|$0F:$CA40:20
; indirect data load target
0x03CA51|$0F:$CA41:3F 80	; $07:$803F; motion script for grandfather in Lianport, part 2

; data -> code
; control flow target (from $CA6D)
0x03CA53|$0F:$CA43:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CA56|$0F:$CA46:A9 FF   	LDA #$FF   
0x03CA58|$0F:$CA48:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
; control flow target (from $C9E2, $CA5D)
0x03CA5A|$0F:$CA4A:4C 00 C7	JMP $C700  

; control flow target (from $C9C4)
0x03CA5D|$0F:$CA4D:C9 02   	CMP #$02   
0x03CA5F|$0F:$CA4F:D0 1E   	BNE $CA6F  
0x03CA61|$0F:$CA51:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CA64|$0F:$CA54:03
; indirect data load target
0x03CA65|$0F:$CA55:03

; data -> code
0x03CA66|$0F:$CA56:F0 07   	BEQ $CA5F  
0x03CA68|$0F:$CA58:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CA6B|$0F:$CA5B:04
; indirect data load target
0x03CA6C|$0F:$CA5C:03

; data -> code
0x03CA6D|$0F:$CA5D:D0 EB   	BNE $CA4A  
; control flow target (from $CA56)
0x03CA6F|$0F:$CA5F:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA72|$0F:$CA62:82
; indirect data load target
0x03CA73|$0F:$CA63:23
; indirect data load target
0x03CA74|$0F:$CA64:47 80	; $07:$8047; motion script for guard #1, Shrine SW of Cannock

; data -> code
0x03CA76|$0F:$CA66:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CA79|$0F:$CA69:81
; indirect data load target
0x03CA7A|$0F:$CA6A:21
; indirect data load target
0x03CA7B|$0F:$CA6B:44 80	; $07:$8044; motion script for guard #1, Shrine SW of Cannock

; data -> code
0x03CA7D|$0F:$CA6D:90 D4   	BCC $CA43  
; control flow target (from $CA4F)
0x03CA7F|$0F:$CA6F:C9 03   	CMP #$03   
0x03CA81|$0F:$CA71:D0 21   	BNE $CA94  
0x03CA83|$0F:$CA73:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CA86|$0F:$CA76:03
; indirect data load target
0x03CA87|$0F:$CA77:06

; data -> code
0x03CA88|$0F:$CA78:F0 0E   	BEQ $CA88  
0x03CA8A|$0F:$CA7A:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CA8D|$0F:$CA7D:03
; indirect data load target
0x03CA8E|$0F:$CA7E:08

; data -> code
0x03CA8F|$0F:$CA7F:F0 07   	BEQ $CA88  
0x03CA91|$0F:$CA81:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CA94|$0F:$CA84:02
; indirect data load target
0x03CA95|$0F:$CA85:07

; data -> code
0x03CA96|$0F:$CA86:D0 09   	BNE $CA91  
; control flow target (from $CA78, $CA7F)
0x03CA98|$0F:$CA88:A9 FF   	LDA #$FF   
0x03CA9A|$0F:$CA8A:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CA9D|$0F:$CA8D:A9 04   	LDA #$04   
0x03CA9F|$0F:$CA8F:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
; control flow target (from $CA86, $CA9C, $CAA3)
0x03CAA1|$0F:$CA91:4C 00 C7	JMP $C700  

; control flow target (from $CA71)
0x03CAA4|$0F:$CA94:C9 04   	CMP #$04   
0x03CAA6|$0F:$CA96:D0 1B   	BNE $CAB3  
0x03CAA8|$0F:$CA98:A5 31   	LDA $31    	; current map ID
0x03CAAA|$0F:$CA9A:C9 03   	CMP #$03   	; Map ID #$03: Midenhall 1F
0x03CAAC|$0F:$CA9C:D0 F3   	BNE $CA91  
0x03CAAE|$0F:$CA9E:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CAB1|$0F:$CAA1:0F
; indirect data load target
0x03CAB2|$0F:$CAA2:02

; data -> code
0x03CAB3|$0F:$CAA3:D0 EC   	BNE $CA91  
0x03CAB5|$0F:$CAA5:20 EA F6	JSR $F6EA  	; open main dialogue window and display string ID specified by byte following JSR

; code -> data
; indirect data load target
0x03CAB8|$0F:$CAA8:75	; String ID #$0075: ‘Open the treasure chest and prepare for thy journey[.’][wait][line]‘Now listen closely, [name][.’][wait][line]‘Seek out worthy companions along thy road[.’][wait][line]‘In Cannock and Moonbrooke there are those who are also of Erdrick's line[.’][wait][line]‘They will surely help thee to defeat Hargon's dark plot[.’][end-FC]

; data -> code
0x03CAB9|$0F:$CAA9:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03CABC|$0F:$CAAC:A9 05   	LDA #$05   
0x03CABE|$0F:$CAAE:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CAC0|$0F:$CAB0:4C 00 C7	JMP $C700  

; control flow target (from $CA96)
0x03CAC3|$0F:$CAB3:C9 05   	CMP #$05   
0x03CAC5|$0F:$CAB5:D0 4B   	BNE $CB02  
0x03CAC7|$0F:$CAB7:4C 00 C7	JMP $C700  

; external control flow target (from $06:$91C0)
0x03CACA|$0F:$CABA:20 B4 E6	JSR $E6B4  
0x03CACD|$0F:$CABD:20 B4 E6	JSR $E6B4  
0x03CAD0|$0F:$CAC0:20 B4 E6	JSR $E6B4  
0x03CAD3|$0F:$CAC3:20 58 D0	JSR $D058  
0x03CAD6|$0F:$CAC6:A9 0A   	LDA #$0A   
0x03CAD8|$0F:$CAC8:99 2A 05	STA $052A,Y
0x03CADB|$0F:$CACB:A9 09   	LDA #$09   
0x03CADD|$0F:$CACD:99 2B 05	STA $052B,Y
0x03CAE0|$0F:$CAD0:A9 87   	LDA #$87   	; Music ID #$87: hit 2 SFX
0x03CAE2|$0F:$CAD2:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03CAE5|$0F:$CAD5:A9 F8   	LDA #$F8   
0x03CAE7|$0F:$CAD7:85 18   	STA $18    
0x03CAE9|$0F:$CAD9:A9 00   	LDA #$00   
0x03CAEB|$0F:$CADB:85 19   	STA $19    
0x03CAED|$0F:$CADD:85 1E   	STA $1E    
0x03CAEF|$0F:$CADF:85 1C   	STA $1C    
0x03CAF1|$0F:$CAE1:20 C5 DE	JSR $DEC5  
0x03CAF4|$0F:$CAE4:A2 0A   	LDX #$0A   
0x03CAF6|$0F:$CAE6:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03CAF9|$0F:$CAE9:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CAFC|$0F:$CAEC:85
; indirect data load target
0x03CAFD|$0F:$CAED:21
; indirect data load target
0x03CAFE|$0F:$CAEE:4F 80	; $07:$804F; motion script for Saber Lion, Osterfair

; data -> code
0x03CB00|$0F:$CAF0:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CB03|$0F:$CAF3:A9 FF   	LDA #$FF   
0x03CB05|$0F:$CAF5:8D 81 05	STA $0581  	; NPC #$08 sprite ID
0x03CB08|$0F:$CAF8:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CB0A|$0F:$CAFA:A9 02   	LDA #$02   	; Fixed Battle #$02: 1 Saber Lion (Map ID #$0F: Osterfair)
0x03CB0C|$0F:$CAFC:20 5C D2	JSR $D25C  	; trigger fixed battle A
0x03CB0F|$0F:$CAFF:4C FB D2	JMP $D2FB  	; load ROM bank 6

; control flow target (from $CAB5)
0x03CB12|$0F:$CB02:C9 09   	CMP #$09   
0x03CB14|$0F:$CB04:D0 36   	BNE $CB3C  
0x03CB16|$0F:$CB06:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CB19|$0F:$CB09:13
; indirect data load target
0x03CB1A|$0F:$CB0A:08

; data -> code
0x03CB1B|$0F:$CB0B:D0 09   	BNE $CB16  
0x03CB1D|$0F:$CB0D:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CB20|$0F:$CB10:85
; indirect data load target
0x03CB21|$0F:$CB11:20
; indirect data load target
0x03CB22|$0F:$CB12:55 80	; $07:$8055; motion script for Cannock and Moonbrooke, ending part 3, dog in Zahan, triggered from right

; data -> code
0x03CB24|$0F:$CB14:90 15   	BCC $CB2B  
; control flow target (from $CB0B)
0x03CB26|$0F:$CB16:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CB29|$0F:$CB19:12
; indirect data load target
0x03CB2A|$0F:$CB1A:07

; data -> code
0x03CB2B|$0F:$CB1B:F0 07   	BEQ $CB24  
0x03CB2D|$0F:$CB1D:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CB30|$0F:$CB20:11
; indirect data load target
0x03CB31|$0F:$CB21:08

; data -> code
0x03CB32|$0F:$CB22:D0 15   	BNE $CB39  
; control flow target (from $CB1B)
0x03CB34|$0F:$CB24:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CB37|$0F:$CB27:85
; indirect data load target
0x03CB38|$0F:$CB28:21
; indirect data load target
0x03CB39|$0F:$CB29:51 80	; $07:$8051; motion script for dog in Zahan, triggered from left/top

; data -> code
; control flow target (from $CB14)
0x03CB3B|$0F:$CB2B:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CB3E|$0F:$CB2E:20 F6 F6	JSR $F6F6  	; open main dialogue window and display string ID specified by byte following JSR + #$0200

; code -> data
; indirect data load target
0x03CB41|$0F:$CB31:D0	; String ID #$02D0: ‘Bow-wow-wow!’[end-FC]

; data -> code
0x03CB42|$0F:$CB32:A9 FF   	LDA #$FF   
0x03CB44|$0F:$CB34:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CB46|$0F:$CB36:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
; control flow target (from $CB22, $CB52)
0x03CB49|$0F:$CB39:4C 00 C7	JMP $C700  

; control flow target (from $CB04)
0x03CB4C|$0F:$CB3C:C9 0A   	CMP #$0A   
0x03CB4E|$0F:$CB3E:D0 22   	BNE $CB62  
0x03CB50|$0F:$CB40:A5 31   	LDA $31    	; current map ID
0x03CB52|$0F:$CB42:C9 56   	CMP #$56   	; Map ID #$56: Lighthouse 7F
0x03CB54|$0F:$CB44:D0 19   	BNE $CB5F  
0x03CB56|$0F:$CB46:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CB59|$0F:$CB49:0A
; indirect data load target
0x03CB5A|$0F:$CB4A:04

; data -> code
0x03CB5B|$0F:$CB4B:F0 07   	BEQ $CB54  
0x03CB5D|$0F:$CB4D:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CB60|$0F:$CB50:0B
; indirect data load target
0x03CB61|$0F:$CB51:04

; data -> code
0x03CB62|$0F:$CB52:D0 E5   	BNE $CB39  
; control flow target (from $CB4B)
0x03CB64|$0F:$CB54:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CB67|$0F:$CB57:81
; indirect data load target
0x03CB68|$0F:$CB58:22
; indirect data load target
0x03CB69|$0F:$CB59:4A 80	; $07:$804A; motion script for King Midenhall, Lighthouse Wizard part 1

; data -> code
0x03CB6B|$0F:$CB5B:A9 0B   	LDA #$0B   
0x03CB6D|$0F:$CB5D:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
; control flow target (from $CB44, $CB6B, $CB76, $CB80, $CB8E)
0x03CB6F|$0F:$CB5F:4C 00 C7	JMP $C700  

; control flow target (from $CB3E)
0x03CB72|$0F:$CB62:C9 0B   	CMP #$0B   
0x03CB74|$0F:$CB64:D0 12   	BNE $CB78  
0x03CB76|$0F:$CB66:AD 60 05	LDA $0560  	; NPC #$04 motion nybble + direction nybble
0x03CB79|$0F:$CB69:29 F0   	AND #$F0   
0x03CB7B|$0F:$CB6B:D0 F2   	BNE $CB5F  
0x03CB7D|$0F:$CB6D:A9 FF   	LDA #$FF   
0x03CB7F|$0F:$CB6F:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CB82|$0F:$CB72:A9 0C   	LDA #$0C   
0x03CB84|$0F:$CB74:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CB86|$0F:$CB76:D0 E7   	BNE $CB5F  
; control flow target (from $CB64)
0x03CB88|$0F:$CB78:C9 0C   	CMP #$0C   
0x03CB8A|$0F:$CB7A:D0 29   	BNE $CBA5  
0x03CB8C|$0F:$CB7C:A5 31   	LDA $31    	; current map ID
0x03CB8E|$0F:$CB7E:C9 56   	CMP #$56   	; Map ID #$56: Lighthouse 7F
0x03CB90|$0F:$CB80:D0 DD   	BNE $CB5F  
0x03CB92|$0F:$CB82:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CB95|$0F:$CB85:0E
; indirect data load target
0x03CB96|$0F:$CB86:09

; data -> code
0x03CB97|$0F:$CB87:F0 07   	BEQ $CB90  
0x03CB99|$0F:$CB89:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CB9C|$0F:$CB8C:0F
; indirect data load target
0x03CB9D|$0F:$CB8D:09

; data -> code
0x03CB9E|$0F:$CB8E:D0 CF   	BNE $CB5F  
; control flow target (from $CB87)
0x03CBA0|$0F:$CB90:20 EA F6	JSR $F6EA  	; open main dialogue window and display string ID specified by byte following JSR

; code -> data
; indirect data load target
0x03CBA3|$0F:$CB93:66	; String ID #$0066: ‘Thou need not speak for I know thy mind well[.’][wait][line]‘Come, follow me[.’][wait][line]‘I will guide thee to the place where thou shall find the Crest[.’][end-FC]

; data -> code
0x03CBA4|$0F:$CB94:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03CBA7|$0F:$CB97:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CBAA|$0F:$CB9A:80
; indirect data load target
0x03CBAB|$0F:$CB9B:22
; indirect data load target
0x03CBAC|$0F:$CB9C:59 80	; $07:$8059; motion script for Lighthouse Wizard part 2

; data -> code
0x03CBAE|$0F:$CB9E:A9 0D   	LDA #$0D   
0x03CBB0|$0F:$CBA0:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CBB2|$0F:$CBA2:4C 00 C7	JMP $C700  

; control flow target (from $CB7A)
0x03CBB5|$0F:$CBA5:A0 00   	LDY #$00   
; control flow target (from $CBE2)
0x03CBB7|$0F:$CBA7:D9 AF CC	CMP $CCAF,Y
0x03CBBA|$0F:$CBAA:D0 33   	BNE $CBDF  
0x03CBBC|$0F:$CBAC:A5 31   	LDA $31    	; current map ID
0x03CBBE|$0F:$CBAE:D9 B4 CC	CMP $CCB4,Y
0x03CBC1|$0F:$CBB1:D0 29   	BNE $CBDC  
0x03CBC3|$0F:$CBB3:A5 16   	LDA $16    	; current map X-pos (1)
0x03CBC5|$0F:$CBB5:D9 B9 CC	CMP $CCB9,Y
0x03CBC8|$0F:$CBB8:90 22   	BCC $CBDC  
0x03CBCA|$0F:$CBBA:D9 BE CC	CMP $CCBE,Y
0x03CBCD|$0F:$CBBD:B0 1D   	BCS $CBDC  
0x03CBCF|$0F:$CBBF:A5 17   	LDA $17    	; current map Y-pos (1)
0x03CBD1|$0F:$CBC1:D9 C3 CC	CMP $CCC3,Y
0x03CBD4|$0F:$CBC4:90 16   	BCC $CBDC  
0x03CBD6|$0F:$CBC6:D9 C8 CC	CMP $CCC8,Y
0x03CBD9|$0F:$CBC9:B0 11   	BCS $CBDC  
0x03CBDB|$0F:$CBCB:AD 58 05	LDA $0558  	; NPC #$03 motion nybble + direction nybble
0x03CBDE|$0F:$CBCE:29 F0   	AND #$F0   
0x03CBE0|$0F:$CBD0:D0 0A   	BNE $CBDC  
0x03CBE2|$0F:$CBD2:A9 FF   	LDA #$FF   
0x03CBE4|$0F:$CBD4:8D 59 05	STA $0559  	; NPC #$03 sprite ID
0x03CBE7|$0F:$CBD7:B9 CD CC	LDA $CCCD,Y
0x03CBEA|$0F:$CBDA:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
; control flow target (from $CBB1, $CBB8, $CBBD, $CBC4, $CBC9, $CBD0, $CBEC, $CBFA)
0x03CBEC|$0F:$CBDC:4C 00 C7	JMP $C700  

; control flow target (from $CBAA)
0x03CBEF|$0F:$CBDF:C8      	INY        
0x03CBF0|$0F:$CBE0:C0 05   	CPY #$05   
0x03CBF2|$0F:$CBE2:D0 C3   	BNE $CBA7  
0x03CBF4|$0F:$CBE4:C9 17   	CMP #$17   
0x03CBF6|$0F:$CBE6:D0 78   	BNE $CC60  
0x03CBF8|$0F:$CBE8:A5 31   	LDA $31    	; current map ID
0x03CBFA|$0F:$CBEA:C9 51   	CMP #$51   	; Map ID #$51: Lighthouse 2F
0x03CBFC|$0F:$CBEC:D0 EE   	BNE $CBDC  
0x03CBFE|$0F:$CBEE:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CC01|$0F:$CBF1:1C
; indirect data load target
0x03CC02|$0F:$CBF2:1F

; data -> code
0x03CC03|$0F:$CBF3:F0 07   	BEQ $CBFC  
0x03CC05|$0F:$CBF5:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CC08|$0F:$CBF8:1D
; indirect data load target
0x03CC09|$0F:$CBF9:1F

; data -> code
0x03CC0A|$0F:$CBFA:D0 E0   	BNE $CBDC  
; control flow target (from $CBF3)
0x03CC0C|$0F:$CBFC:20 EA F6	JSR $F6EA  	; open main dialogue window and display string ID specified by byte following JSR

; code -> data
; indirect data load target
0x03CC0F|$0F:$CBFF:67	; String ID #$0067: ‘Open now the treasure chest[.’][end-FC]

; data -> code
0x03CC10|$0F:$CC00:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03CC13|$0F:$CC03:A9 1B   	LDA #$1B   
0x03CC15|$0F:$CC05:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CC17|$0F:$CC07:4C 00 C7	JMP $C700  

; trigger Stars Crest battle
; external control flow target (from $06:$9BA0)
0x03CC1A|$0F:$CC0A:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x03CC1D|$0F:$CC0D:69	; String ID #$0069: [wait]‘Haha! Into my trap thou hast stepped! It shall be thy last[.’][end-FC]

; data -> code
0x03CC1E|$0F:$CC0E:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03CC21|$0F:$CC11:A9 05   	LDA #$05   
0x03CC23|$0F:$CC13:A0 2F   	LDY #$2F   
0x03CC25|$0F:$CC15:20 5C CD	JSR $CD5C  
0x03CC28|$0F:$CC18:A9 05   	LDA #$05   
0x03CC2A|$0F:$CC1A:A0 27   	LDY #$27   
0x03CC2C|$0F:$CC1C:20 5C CD	JSR $CD5C  
0x03CC2F|$0F:$CC1F:A9 05   	LDA #$05   
0x03CC31|$0F:$CC21:A0 37   	LDY #$37   
0x03CC33|$0F:$CC23:20 5C CD	JSR $CD5C  
0x03CC36|$0F:$CC26:A9 FF   	LDA #$FF   
0x03CC38|$0F:$CC28:8D 59 05	STA $0559  	; NPC #$03 sprite ID
0x03CC3B|$0F:$CC2B:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CC3E|$0F:$CC2E:8D 69 05	STA $0569  	; NPC #$05 sprite ID
0x03CC41|$0F:$CC31:8D 71 05	STA $0571  	; NPC #$06 sprite ID
0x03CC44|$0F:$CC34:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CC46|$0F:$CC36:A9 05   	LDA #$05   	; Fixed Battle #$05: 4 Gremlins (Map ID #$51: Lighthouse 2F)
0x03CC48|$0F:$CC38:20 5C D2	JSR $D25C  	; trigger fixed battle A
0x03CC4B|$0F:$CC3B:A5 98   	LDA $98    	; outcome of last fight?
0x03CC4D|$0F:$CC3D:C9 FC   	CMP #$FC   
0x03CC4F|$0F:$CC3F:F0 1B   	BEQ $CC5C  
0x03CC51|$0F:$CC41:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x03CC54|$0F:$CC44:29 02   	AND #$02   
0x03CC56|$0F:$CC46:D0 14   	BNE $CC5C  
0x03CC58|$0F:$CC48:A2 46   	LDX #$46   
0x03CC5A|$0F:$CC4A:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03CC5D|$0F:$CC4D:20 F6 F6	JSR $F6F6  	; open main dialogue window and display string ID specified by byte following JSR + #$0200

; code -> data
; indirect data load target
0x03CC60|$0F:$CC50:32	; String ID #$0232: Thou hast found the Stars Crest.[end-FC]

; data -> code
0x03CC61|$0F:$CC51:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x03CC64|$0F:$CC54:09 02   	ORA #$02   
0x03CC66|$0F:$CC56:8D 12 01	STA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x03CC69|$0F:$CC59:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
; control flow target (from $CC3F, $CC46)
0x03CC6C|$0F:$CC5C:60      	RTS        

; control flow target (from $CC70, $CC99)
0x03CC6D|$0F:$CC5D:4C 00 C7	JMP $C700  

; control flow target (from $CBE6)
0x03CC70|$0F:$CC60:C9 18   	CMP #$18   
0x03CC72|$0F:$CC62:D0 33   	BNE $CC97  
0x03CC74|$0F:$CC64:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CC77|$0F:$CC67:10
; indirect data load target
0x03CC78|$0F:$CC68:0C

; data -> code
0x03CC79|$0F:$CC69:F0 07   	BEQ $CC72  
0x03CC7B|$0F:$CC6B:20 26 CD	JSR $CD26  	; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes

; code -> data
; indirect data load target
0x03CC7E|$0F:$CC6E:10
; indirect data load target
0x03CC7F|$0F:$CC6F:0D

; data -> code
0x03CC80|$0F:$CC70:D0 EB   	BNE $CC5D  
; control flow target (from $CC69)
0x03CC82|$0F:$CC72:20 EA F6	JSR $F6EA  	; open main dialogue window and display string ID specified by byte following JSR

; code -> data
; indirect data load target
0x03CC85|$0F:$CC75:6C	; String ID #$006C: ‘Such rudeness in a Wizard's Home is not acceptable[.’][wait][line]‘Perhaps I should turn thee into a frog!’[end-FC]

; data -> code
0x03CC86|$0F:$CC76:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03CC89|$0F:$CC79:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CC8C|$0F:$CC7C:81
; indirect data load target
0x03CC8D|$0F:$CC7D:23
; indirect data load target
0x03CC8E|$0F:$CC7E:CB 80	; $07:$80CB; motion script for Evil Clown #1, Sea Cave B5

; data -> code
0x03CC90|$0F:$CC80:A9 05   	LDA #$05   
0x03CC92|$0F:$CC82:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CC95|$0F:$CC85:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CC98|$0F:$CC88:A9 FF   	LDA #$FF   
0x03CC9A|$0F:$CC8A:8D 59 05	STA $0559  	; NPC #$03 sprite ID
0x03CC9D|$0F:$CC8D:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CCA0|$0F:$CC90:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CCA2|$0F:$CC92:A9 06   	LDA #$06   	; Fixed Battle #$06: 2 Evil Clown (Map ID #$33: Sea Cave B5)
0x03CCA4|$0F:$CC94:20 5C D2	JSR $D25C  	; trigger fixed battle A
; control flow target (from $CC62)
0x03CCA7|$0F:$CC97:C9 64   	CMP #$64   
0x03CCA9|$0F:$CC99:D0 C2   	BNE $CC5D  
0x03CCAB|$0F:$CC9B:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03CCAE|$0F:$CC9E:A0	; $06:$8040

; data -> code
0x03CCAF|$0F:$CC9F:4C 00 C7	JMP $C700  

; external control flow target (from $06:$90C6)
0x03CCB2|$0F:$CCA2:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CCB5|$0F:$CCA5:89
; indirect data load target
0x03CCB6|$0F:$CCA6:20
; indirect data load target
0x03CCB7|$0F:$CCA7:40 80	; $07:$8040; motion script for grandfather in Lianport, part 3

; data -> code
0x03CCB9|$0F:$CCA9:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CCBC|$0F:$CCAC:4C 61 F7	JMP $F761  	; load ROM bank #$06


; code -> data
; indexed data load target (from $CBA7)
0x03CCBF|$0F:$CCAF:0D
0x03CCC0|$0F:$CCB0:0F
0x03CCC1|$0F:$CCB1:11
0x03CCC2|$0F:$CCB2:13
0x03CCC3|$0F:$CCB3:15
; indexed data load target (from $CBAE)
; indirect data load target
0x03CCC4|$0F:$CCB4:56	; Map ID #$56: Lighthouse 7F
; indirect data load target
0x03CCC5|$0F:$CCB5:55	; Map ID #$55: Lighthouse 6F
; indirect data load target
0x03CCC6|$0F:$CCB6:54	; Map ID #$54: Lighthouse 5F
; indirect data load target
0x03CCC7|$0F:$CCB7:53	; Map ID #$53: Lighthouse 4F
; indirect data load target
0x03CCC8|$0F:$CCB8:52	; Map ID #$52: Lighthouse 3F
; indexed data load target (from $CBB5)
; indirect data load target
0x03CCC9|$0F:$CCB9:00
; indirect data load target
0x03CCCA|$0F:$CCBA:10
; indirect data load target
0x03CCCB|$0F:$CCBB:1A
; indirect data load target
0x03CCCC|$0F:$CCBC:16
; indirect data load target
0x03CCCD|$0F:$CCBD:1E
; indexed data load target (from $CBBA)
; indirect data load target
0x03CCCE|$0F:$CCBE:03
; indirect data load target
0x03CCCF|$0F:$CCBF:14
; indirect data load target
0x03CCD0|$0F:$CCC0:1C
; indirect data load target
0x03CCD1|$0F:$CCC1:19
; indirect data load target
0x03CCD2|$0F:$CCC2:20
; indexed data load target (from $CBC1)
; indirect data load target
0x03CCD3|$0F:$CCC3:11
; indirect data load target
0x03CCD4|$0F:$CCC4:1A
; indirect data load target
0x03CCD5|$0F:$CCC5:0E
; indirect data load target
0x03CCD6|$0F:$CCC6:19
; indirect data load target
0x03CCD7|$0F:$CCC7:16
; indexed data load target (from $CBC6)
; indirect data load target
0x03CCD8|$0F:$CCC8:14
; indirect data load target
0x03CCD9|$0F:$CCC9:1C
; indirect data load target
0x03CCDA|$0F:$CCCA:12
; indirect data load target
0x03CCDB|$0F:$CCCB:1C
; indirect data load target
0x03CCDC|$0F:$CCCC:1A
; indexed data load target (from $CBD7)
; indirect data load target
0x03CCDD|$0F:$CCCD:0E
; indirect data load target
0x03CCDE|$0F:$CCCE:10
; indirect data load target
0x03CCDF|$0F:$CCCF:12
; indirect data load target
0x03CCE0|$0F:$CCD0:14
; indirect data load target
0x03CCE1|$0F:$CCD1:16

; data -> code
; execute scripted motion
; control flow target (from $C836, $C864, $C93D, $C959, $CA0C, $CA32, $CA43, $CAF0, $CB2B, $CC85, $CCA9, $CCE7, $FF84)
; external control flow target (from $06:$BB3A)
0x03CCE2|$0F:$CCD2:A5 35   	LDA $35    	; flag indicating whether any menu is currently open
0x03CCE4|$0F:$CCD4:48      	PHA        
0x03CCE5|$0F:$CCD5:A9 00   	LDA #$00   
0x03CCE7|$0F:$CCD7:85 35   	STA $35    	; flag indicating whether any menu is currently open
; control flow target (from $CCE1)
0x03CCE9|$0F:$CCD9:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03CCEC|$0F:$CCDC:20 CB D8	JSR $D8CB  
0x03CCEF|$0F:$CCDF:A5 38   	LDA $38    
0x03CCF1|$0F:$CCE1:30 F6   	BMI $CCD9  
0x03CCF3|$0F:$CCE3:68      	PLA        
0x03CCF4|$0F:$CCE4:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03CCF6|$0F:$CCE6:60      	RTS        

; external control flow target (from $06:$BB91, $06:$BBA5)
0x03CCF7|$0F:$CCE7:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03CCFA|$0F:$CCEA:A9 06   	LDA #$06   
0x03CCFC|$0F:$CCEC:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03CCFE|$0F:$CCEE:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)
; control flow target (from $C82F, $C85D, $C932, $C94B, $C952, $C9B2, $C9FC, $CA05, $CA15, $CA22, $CA2B, $CA3C, $CA5F, $CA66, $CAE9, $CB0D, $CB24, $CB54, $CB97, $CC79, $CCA2, $CEC2)
; external control flow target (from $06:$BACC, $06:$BAD5, $06:$BADF, $06:$BB83, $06:$BB8A, $06:$BB97, $06:$BB9E, $07:$822A, $07:$823B, $07:$8271, $07:$82CB, $07:$82EE, $07:$8329, $07:$8358, $07:$836D, $07:$837E, $07:$83F4, $07:$845C, $07:$8495, $07:$84CE, $07:$84EF, $07:$84FC, $07:$8515, $07:$852C, $07:$8559, $07:$8571, $07:$8578, $07:$85B3, $07:$85BA, $07:$85E7)
0x03CD01|$0F:$CCF1:68      	PLA        	; return address low byte
0x03CD02|$0F:$CCF2:85 0C   	STA $0C    	; return address low byte
0x03CD04|$0F:$CCF4:68      	PLA        	; return address high byte
0x03CD05|$0F:$CCF5:85 0D   	STA $0D    	; return address high byte
0x03CD07|$0F:$CCF7:A0 01   	LDY #$01   
0x03CD09|$0F:$CCF9:B1 0C   	LDA ($0C),Y	; data byte 0
0x03CD0B|$0F:$CCFB:85 38   	STA $38    
0x03CD0D|$0F:$CCFD:29 7F   	AND #$7F   	; useless op
0x03CD0F|$0F:$CCFF:0A      	ASL        
0x03CD10|$0F:$CD00:0A      	ASL        
0x03CD11|$0F:$CD01:0A      	ASL        
0x03CD12|$0F:$CD02:AA      	TAX        
0x03CD13|$0F:$CD03:C8      	INY        
0x03CD14|$0F:$CD04:B1 0C   	LDA ($0C),Y	; data byte 1
0x03CD16|$0F:$CD06:9D 58 05	STA $0558,X	; NPC #$03 motion nybble + direction nybble
0x03CD19|$0F:$CD09:C8      	INY        
0x03CD1A|$0F:$CD0A:B1 0C   	LDA ($0C),Y	; data byte 2
0x03CD1C|$0F:$CD0C:9D 52 05	STA $0552,X	; NPC #$02 scripted motion low byte
0x03CD1F|$0F:$CD0F:C8      	INY        
0x03CD20|$0F:$CD10:B1 0C   	LDA ($0C),Y	; data byte 3
0x03CD22|$0F:$CD12:9D 53 05	STA $0553,X	; NPC #$02 scripted motion high byte
0x03CD25|$0F:$CD15:A5 0C   	LDA $0C    	; return address low byte
0x03CD27|$0F:$CD17:18      	CLC        
0x03CD28|$0F:$CD18:69 04   	ADC #$04   	; 4 data bytes
0x03CD2A|$0F:$CD1A:85 0C   	STA $0C    	; return address low byte
0x03CD2C|$0F:$CD1C:A5 0D   	LDA $0D    	; return address high byte
0x03CD2E|$0F:$CD1E:69 00   	ADC #$00   	; add carry from low byte
0x03CD30|$0F:$CD20:48      	PHA        	; return address high byte
0x03CD31|$0F:$CD21:A5 0C   	LDA $0C    	; return address low byte
0x03CD33|$0F:$CD23:48      	PHA        	; return address low byte
0x03CD34|$0F:$CD24:18      	CLC        
0x03CD35|$0F:$CD25:60      	RTS        

; set Z if your current map position is the (X, Y) co-ordinates given by the next 2 bytes
; control flow target (from $C911, $C92B, $C9C7, $C9D2, $C9DD, $CA51, $CA58, $CA73, $CA7A, $CA81, $CA9E, $CB06, $CB16, $CB1D, $CB46, $CB4D, $CB82, $CB89, $CBEE, $CBF5, $CC64, $CC6B)
; external control flow target (from $06:$96B7, $06:$9793, $06:$BB3D)
0x03CD36|$0F:$CD26:68      	PLA        	; original return address, low byte
0x03CD37|$0F:$CD27:85 0C   	STA $0C    	; original return address, low byte
0x03CD39|$0F:$CD29:18      	CLC        
0x03CD3A|$0F:$CD2A:69 02   	ADC #$02   	; calls to this routine are followed by 2 bytes of data
0x03CD3C|$0F:$CD2C:85 0E   	STA $0E    	; new return address, low byte
0x03CD3E|$0F:$CD2E:68      	PLA        	; original return address, high byte
0x03CD3F|$0F:$CD2F:85 0D   	STA $0D    	; original return address, high byte
0x03CD41|$0F:$CD31:69 00   	ADC #$00   	; add carry from low address
0x03CD43|$0F:$CD33:48      	PHA        	; new return address, high byte
0x03CD44|$0F:$CD34:A5 0E   	LDA $0E    	; new return address, low byte
0x03CD46|$0F:$CD36:48      	PHA        	; new return address, low byte
0x03CD47|$0F:$CD37:A0 01   	LDY #$01   	; 1 byte after the original return address
0x03CD49|$0F:$CD39:A5 16   	LDA $16    	; current map X-pos (1)
0x03CD4B|$0F:$CD3B:D1 0C   	CMP ($0C),Y
0x03CD4D|$0F:$CD3D:D0 05   	BNE $CD44  	; not the same X-pos => Z not set
0x03CD4F|$0F:$CD3F:A5 17   	LDA $17    	; current map Y-pos (1)
0x03CD51|$0F:$CD41:C8      	INY        	; 2 bytes after the original return address
0x03CD52|$0F:$CD42:D1 0C   	CMP ($0C),Y	; set or clear Z based on whether your Y-pos matches
; control flow target (from $CD3D)
0x03CD54|$0F:$CD44:60      	RTS        

; external control flow target (from $06:$971D)
0x03CD55|$0F:$CD45:20 51 CD	JSR $CD51  
; control flow target (from $CD4E)
0x03CD58|$0F:$CD48:4C 61 F7	JMP $F761  	; load ROM bank #$06

; external control flow target (from $06:$9724)
0x03CD5B|$0F:$CD4B:20 5C CD	JSR $CD5C  
0x03CD5E|$0F:$CD4E:4C 48 CD	JMP $CD48  

; control flow target (from $CD45)
0x03CD61|$0F:$CD51:85 C9   	STA $C9    
0x03CD63|$0F:$CD53:84 97   	STY $97    	; subject hero ID $97
0x03CD65|$0F:$CD55:A9 FF   	LDA #$FF   
0x03CD67|$0F:$CD57:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x03CD69|$0F:$CD59:4C 64 CD	JMP $CD64  

; control flow target (from $CC15, $CC1C, $CC23, $CD4B)
0x03CD6C|$0F:$CD5C:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x03CD6E|$0F:$CD5E:84 97   	STY $97    	; subject hero ID $97
0x03CD70|$0F:$CD60:A9 FF   	LDA #$FF   
0x03CD72|$0F:$CD62:85 C9   	STA $C9    
; control flow target (from $CD59)
0x03CD74|$0F:$CD64:A9 01   	LDA #$01   
0x03CD76|$0F:$CD66:85 49   	STA $49    	; object hero/target/item/string ID $49
; control flow target (from $CD8C)
0x03CD78|$0F:$CD68:A5 C9   	LDA $C9    
0x03CD7A|$0F:$CD6A:A4 97   	LDY $97    	; subject hero ID $97
0x03CD7C|$0F:$CD6C:99 3A 05	STA $053A,Y
0x03CD7F|$0F:$CD6F:20 CB D8	JSR $D8CB  
0x03CD82|$0F:$CD72:A2 04   	LDX #$04   
0x03CD84|$0F:$CD74:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03CD87|$0F:$CD77:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x03CD89|$0F:$CD79:A4 97   	LDY $97    	; subject hero ID $97
0x03CD8B|$0F:$CD7B:99 3A 05	STA $053A,Y
0x03CD8E|$0F:$CD7E:20 CB D8	JSR $D8CB  
0x03CD91|$0F:$CD81:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x03CD93|$0F:$CD83:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03CD96|$0F:$CD86:E6 49   	INC $49    	; object hero/target/item/string ID $49
0x03CD98|$0F:$CD88:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x03CD9A|$0F:$CD8A:C9 08   	CMP #$08   
0x03CD9C|$0F:$CD8C:90 DA   	BCC $CD68  
0x03CD9E|$0F:$CD8E:60      	RTS        

; control flow target (from $E56C)
0x03CD9F|$0F:$CD8F:A5 31   	LDA $31    	; current map ID
0x03CDA1|$0F:$CD91:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03CDA3|$0F:$CD93:D0 05   	BNE $CD9A  
; control flow target (from $CDAA, $CDB8)
0x03CDA5|$0F:$CD95:A9 FF   	LDA #$FF   
0x03CDA7|$0F:$CD97:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CDA9|$0F:$CD99:60      	RTS        

; control flow target (from $CD93)
0x03CDAA|$0F:$CD9A:C9 0B   	CMP #$0B   	; Map ID #$0B: Lianport
0x03CDAC|$0F:$CD9C:D0 13   	BNE $CDB1  
0x03CDAE|$0F:$CD9E:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03CDB0|$0F:$CDA0:F0 0A   	BEQ $CDAC  
0x03CDB2|$0F:$CDA2:A9 FF   	LDA #$FF   
0x03CDB4|$0F:$CDA4:8D 89 05	STA $0589  	; NPC #$09 sprite ID
0x03CDB7|$0F:$CDA7:8D 91 05	STA $0591  	; NPC #$0A sprite ID
0x03CDBA|$0F:$CDAA:D0 E9   	BNE $CD95  
; control flow target (from $CDA0)
0x03CDBC|$0F:$CDAC:A9 00   	LDA #$00   
0x03CDBE|$0F:$CDAE:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CDC0|$0F:$CDB0:60      	RTS        

; control flow target (from $CD9C)
0x03CDC1|$0F:$CDB1:C9 1A   	CMP #$1A   	; Map ID #$1A: Shrine SW of Cannock
0x03CDC3|$0F:$CDB3:D0 0A   	BNE $CDBF  
0x03CDC5|$0F:$CDB5:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x03CDC8|$0F:$CDB8:D0 DB   	BNE $CD95  
0x03CDCA|$0F:$CDBA:A9 02   	LDA #$02   
0x03CDCC|$0F:$CDBC:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CDCE|$0F:$CDBE:60      	RTS        

; control flow target (from $CDB3)
0x03CDCF|$0F:$CDBF:C9 02   	CMP #$02   	; Map ID #$02: Midenhall 2F
0x03CDD1|$0F:$CDC1:D0 10   	BNE $CDD3  
0x03CDD3|$0F:$CDC3:A5 44   	LDA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CDD5|$0F:$CDC5:C9 04   	CMP #$04   
0x03CDD7|$0F:$CDC7:F0 04   	BEQ $CDCD  
0x03CDD9|$0F:$CDC9:C9 05   	CMP #$05   
0x03CDDB|$0F:$CDCB:D0 29   	BNE $CDF6  
; control flow target (from $CDC7)
0x03CDDD|$0F:$CDCD:A9 FF   	LDA #$FF   
0x03CDDF|$0F:$CDCF:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CDE2|$0F:$CDD2:60      	RTS        

; control flow target (from $CDC1)
0x03CDE3|$0F:$CDD3:C9 03   	CMP #$03   	; Map ID #$03: Midenhall 1F
0x03CDE5|$0F:$CDD5:D0 24   	BNE $CDFB  
0x03CDE7|$0F:$CDD7:A5 44   	LDA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CDE9|$0F:$CDD9:C9 04   	CMP #$04   
0x03CDEB|$0F:$CDDB:F0 18   	BEQ $CDF5  
0x03CDED|$0F:$CDDD:C9 05   	CMP #$05   
0x03CDEF|$0F:$CDDF:F0 14   	BEQ $CDF5  
0x03CDF1|$0F:$CDE1:A9 FF   	LDA #$FF   
0x03CDF3|$0F:$CDE3:8D C1 05	STA $05C1  	; NPC #$10 sprite ID
0x03CDF6|$0F:$CDE6:AD AD 61	LDA $61AD  
0x03CDF9|$0F:$CDE9:D0 0A   	BNE $CDF5  
0x03CDFB|$0F:$CDEB:A9 0E   	LDA #$0E   
0x03CDFD|$0F:$CDED:8D 1A 05	STA $051A  	; something to do with whether you've opened the chest containing the Shield of Erdrick
0x03CE00|$0F:$CDF0:A9 02   	LDA #$02   
0x03CE02|$0F:$CDF2:8D 1B 05	STA $051B  
; control flow target (from $CDDB, $CDDF, $CDE9)
0x03CE05|$0F:$CDF5:60      	RTS        

; control flow target (from $CDCB, $CE0A)
0x03CE06|$0F:$CDF6:A9 FF   	LDA #$FF   
0x03CE08|$0F:$CDF8:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CE0A|$0F:$CDFA:60      	RTS        

; control flow target (from $CDD5)
0x03CE0B|$0F:$CDFB:C9 05   	CMP #$05   	; Map ID #$05: Leftwyne
0x03CE0D|$0F:$CDFD:D0 13   	BNE $CE12  
0x03CE0F|$0F:$CDFF:AD 3F 06	LDA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03CE12|$0F:$CE02:29 04   	AND #$04   
0x03CE14|$0F:$CE04:D0 06   	BNE $CE0C  
0x03CE16|$0F:$CE06:A5 CA   	LDA $CA    	; Cannock runaround quest status (0 = start of game, 0 -> 1 = talked to King Cannock, 1 -> 2 = said YES to seeking Cannock in Spring of Bravery, 2 -> 3 = talked to King Midenhall; adding Cannock sets this to 3; some code checks for 4)
0x03CE18|$0F:$CE08:C9 02   	CMP #$02   
0x03CE1A|$0F:$CE0A:B0 EA   	BCS $CDF6  
; control flow target (from $CE04)
0x03CE1C|$0F:$CE0C:A9 FF   	LDA #$FF   
0x03CE1E|$0F:$CE0E:8D C1 05	STA $05C1  	; NPC #$10 sprite ID
0x03CE21|$0F:$CE11:60      	RTS        

; control flow target (from $CDFD)
0x03CE22|$0F:$CE12:C9 0F   	CMP #$0F   	; Map ID #$0F: Osterfair
0x03CE24|$0F:$CE14:D0 05   	BNE $CE1B  
0x03CE26|$0F:$CE16:A9 00   	LDA #$00   
0x03CE28|$0F:$CE18:85 98   	STA $98    	; outcome of last fight?
0x03CE2A|$0F:$CE1A:60      	RTS        

; control flow target (from $CE14)
0x03CE2B|$0F:$CE1B:C9 10   	CMP #$10   	; Map ID #$10: Zahan
0x03CE2D|$0F:$CE1D:D0 05   	BNE $CE24  
0x03CE2F|$0F:$CE1F:A9 09   	LDA #$09   
0x03CE31|$0F:$CE21:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CE33|$0F:$CE23:60      	RTS        

; control flow target (from $CE1D)
0x03CE34|$0F:$CE24:C9 20   	CMP #$20   	; Map ID #$20: Shrine SW of Moonbrooke
0x03CE36|$0F:$CE26:D0 18   	BNE $CE40  
0x03CE38|$0F:$CE28:A0 00   	LDY #$00   
; control flow target (from $CE38)
0x03CE3A|$0F:$CE2A:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03CE3D|$0F:$CE2D:29 04   	AND #$04   
0x03CE3F|$0F:$CE2F:F0 0E   	BEQ $CE3F  
0x03CE41|$0F:$CE31:98      	TYA        
0x03CE42|$0F:$CE32:18      	CLC        
0x03CE43|$0F:$CE33:69 12   	ADC #$12   
0x03CE45|$0F:$CE35:A8      	TAY        
0x03CE46|$0F:$CE36:C9 36   	CMP #$36   
0x03CE48|$0F:$CE38:D0 F0   	BNE $CE2A  
0x03CE4A|$0F:$CE3A:A9 06   	LDA #$06   
0x03CE4C|$0F:$CE3C:8D 54 05	STA $0554  	; NPC #$03 X-pos
; control flow target (from $CE2F)
0x03CE4F|$0F:$CE3F:60      	RTS        

; control flow target (from $CE26)
0x03CE50|$0F:$CE40:C9 57   	CMP #$57   	; Map ID #$57: Lighthouse 8F
0x03CE52|$0F:$CE42:D0 01   	BNE $CE45  
0x03CE54|$0F:$CE44:60      	RTS        

; control flow target (from $CE42)
0x03CE55|$0F:$CE45:C9 56   	CMP #$56   	; Map ID #$56: Lighthouse 7F
0x03CE57|$0F:$CE47:D0 3E   	BNE $CE87  
0x03CE59|$0F:$CE49:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x03CE5C|$0F:$CE4C:29 02   	AND #$02   
0x03CE5E|$0F:$CE4E:D0 2C   	BNE $CE7C  
0x03CE60|$0F:$CE50:A5 44   	LDA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CE62|$0F:$CE52:C9 FF   	CMP #$FF   
0x03CE64|$0F:$CE54:F0 04   	BEQ $CE5A  
0x03CE66|$0F:$CE56:C9 0A   	CMP #$0A   
0x03CE68|$0F:$CE58:D0 05   	BNE $CE5F  
; control flow target (from $CE54)
0x03CE6A|$0F:$CE5A:A9 0A   	LDA #$0A   
0x03CE6C|$0F:$CE5C:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CE6E|$0F:$CE5E:60      	RTS        

; control flow target (from $CE58)
0x03CE6F|$0F:$CE5F:C9 0B   	CMP #$0B   
0x03CE71|$0F:$CE61:F0 1E   	BEQ $CE81  
0x03CE73|$0F:$CE63:C9 0C   	CMP #$0C   
0x03CE75|$0F:$CE65:F0 1A   	BEQ $CE81  
0x03CE77|$0F:$CE67:C9 0D   	CMP #$0D   
0x03CE79|$0F:$CE69:D0 11   	BNE $CE7C  
0x03CE7B|$0F:$CE6B:A9 00   	LDA #$00   
0x03CE7D|$0F:$CE6D:8D 54 05	STA $0554  	; NPC #$03 X-pos
0x03CE80|$0F:$CE70:A9 13   	LDA #$13   
0x03CE82|$0F:$CE72:8D 55 05	STA $0555  	; NPC #$03 Y-pos
0x03CE85|$0F:$CE75:A9 01   	LDA #$01   
0x03CE87|$0F:$CE77:8D 58 05	STA $0558  	; NPC #$03 motion nybble + direction nybble
0x03CE8A|$0F:$CE7A:D0 05   	BNE $CE81  
; control flow target (from $CE4E, $CE69)
0x03CE8C|$0F:$CE7C:A9 FF   	LDA #$FF   
0x03CE8E|$0F:$CE7E:8D 59 05	STA $0559  	; NPC #$03 sprite ID
; control flow target (from $CE61, $CE65, $CE7A)
0x03CE91|$0F:$CE81:A9 FF   	LDA #$FF   
0x03CE93|$0F:$CE83:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CE96|$0F:$CE86:60      	RTS        

; control flow target (from $CE47)
0x03CE97|$0F:$CE87:A0 00   	LDY #$00   
; control flow target (from $CEE2)
0x03CE99|$0F:$CE89:D9 2C CF	CMP $CF2C,Y
0x03CE9C|$0F:$CE8C:D0 51   	BNE $CEDF  
0x03CE9E|$0F:$CE8E:A5 44   	LDA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CEA0|$0F:$CE90:D9 31 CF	CMP $CF31,Y
0x03CEA3|$0F:$CE93:D0 13   	BNE $CEA8  
0x03CEA5|$0F:$CE95:B9 36 CF	LDA $CF36,Y
0x03CEA8|$0F:$CE98:8D 54 05	STA $0554  	; NPC #$03 X-pos
0x03CEAB|$0F:$CE9B:B9 3B CF	LDA $CF3B,Y
0x03CEAE|$0F:$CE9E:8D 55 05	STA $0555  	; NPC #$03 Y-pos
0x03CEB1|$0F:$CEA1:B9 40 CF	LDA $CF40,Y
0x03CEB4|$0F:$CEA4:8D 58 05	STA $0558  	; NPC #$03 motion nybble + direction nybble
0x03CEB7|$0F:$CEA7:60      	RTS        

; control flow target (from $CE93)
0x03CEB8|$0F:$CEA8:D9 45 CF	CMP $CF45,Y
0x03CEBB|$0F:$CEAB:D0 2C   	BNE $CED9  
0x03CEBD|$0F:$CEAD:A5 16   	LDA $16    	; current map X-pos (1)
0x03CEBF|$0F:$CEAF:D9 4A CF	CMP $CF4A,Y
0x03CEC2|$0F:$CEB2:D0 25   	BNE $CED9  
0x03CEC4|$0F:$CEB4:A5 17   	LDA $17    	; current map Y-pos (1)
0x03CEC6|$0F:$CEB6:D9 4F CF	CMP $CF4F,Y
0x03CEC9|$0F:$CEB9:D0 1E   	BNE $CED9  
0x03CECB|$0F:$CEBB:B9 31 CF	LDA $CF31,Y
0x03CECE|$0F:$CEBE:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CED0|$0F:$CEC0:98      	TYA        
0x03CED1|$0F:$CEC1:48      	PHA        
0x03CED2|$0F:$CEC2:20 F1 CC	JSR $CCF1  	; set up scripted motion variables based on next 4 bytes (low 5 bits = NPC index, NPC index + 1's motion + direction byte?, 2-byte pointer to motion script)

; code -> data
; indirect data load target
0x03CED5|$0F:$CEC5:80
; indirect data load target
0x03CED6|$0F:$CEC6:22
; indirect data load target
0x03CED7|$0F:$CEC7:72 80	; $07:$8072; motion script for Lighthouse Wizard part 3

; data -> code
0x03CED9|$0F:$CEC9:68      	PLA        
0x03CEDA|$0F:$CECA:0A      	ASL        
0x03CEDB|$0F:$CECB:A8      	TAY        
0x03CEDC|$0F:$CECC:B9 54 CF	LDA $CF54,Y	; motion script pointers for Lighthouse Wizard
0x03CEDF|$0F:$CECF:8D 52 05	STA $0552  	; NPC #$02 scripted motion low byte
0x03CEE2|$0F:$CED2:B9 55 CF	LDA $CF55,Y
0x03CEE5|$0F:$CED5:8D 53 05	STA $0553  	; NPC #$02 scripted motion high byte
0x03CEE8|$0F:$CED8:60      	RTS        

; control flow target (from $CEAB, $CEB2, $CEB9)
0x03CEE9|$0F:$CED9:A9 FF   	LDA #$FF   
0x03CEEB|$0F:$CEDB:8D 59 05	STA $0559  	; NPC #$03 sprite ID
; control flow target (from $CEE6)
0x03CEEE|$0F:$CEDE:60      	RTS        

; control flow target (from $CE8C)
0x03CEEF|$0F:$CEDF:C8      	INY        
0x03CEF0|$0F:$CEE0:C0 05   	CPY #$05   
0x03CEF2|$0F:$CEE2:D0 A5   	BNE $CE89  
0x03CEF4|$0F:$CEE4:C9 50   	CMP #$50   	; Map ID #$50: Lighthouse 1F
0x03CEF6|$0F:$CEE6:F0 F6   	BEQ $CEDE  
0x03CEF8|$0F:$CEE8:C9 33   	CMP #$33   	; Map ID #$33: Sea Cave B5
0x03CEFA|$0F:$CEEA:D0 05   	BNE $CEF1  
0x03CEFC|$0F:$CEEC:A9 18   	LDA #$18   
0x03CEFE|$0F:$CEEE:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CF00|$0F:$CEF0:60      	RTS        

; control flow target (from $CEEA)
0x03CF01|$0F:$CEF1:C9 04   	CMP #$04   	; Map ID #$04: Midenhall B1
0x03CF03|$0F:$CEF3:D0 0C   	BNE $CF01  
0x03CF05|$0F:$CEF5:A5 D1   	LDA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03CF07|$0F:$CEF7:4A      	LSR        
0x03CF08|$0F:$CEF8:90 2D   	BCC $CF27  
0x03CF0A|$0F:$CEFA:A9 FF   	LDA #$FF   
0x03CF0C|$0F:$CEFC:8D 69 05	STA $0569  	; NPC #$05 sprite ID
0x03CF0F|$0F:$CEFF:D0 26   	BNE $CF27  
; control flow target (from $CEF3)
0x03CF11|$0F:$CF01:C9 07   	CMP #$07   	; Map ID #$07: Hamlin
0x03CF13|$0F:$CF03:D0 0E   	BNE $CF13  
0x03CF15|$0F:$CF05:AD 51 06	LDA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03CF18|$0F:$CF08:29 04   	AND #$04   	; In Party
0x03CF1A|$0F:$CF0A:F0 07   	BEQ $CF13  
0x03CF1C|$0F:$CF0C:A9 FF   	LDA #$FF   
0x03CF1E|$0F:$CF0E:8D 59 05	STA $0559  	; NPC #$03 sprite ID
0x03CF21|$0F:$CF11:D0 14   	BNE $CF27  
; control flow target (from $CF03, $CF0A)
0x03CF23|$0F:$CF13:C9 08   	CMP #$08   	; Map ID #$08: Hamlin Waterway
0x03CF25|$0F:$CF15:D0 10   	BNE $CF27  
0x03CF27|$0F:$CF17:A5 D1   	LDA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03CF29|$0F:$CF19:29 02   	AND #$02   
0x03CF2B|$0F:$CF1B:F0 0A   	BEQ $CF27  
0x03CF2D|$0F:$CF1D:A9 FF   	LDA #$FF   
0x03CF2F|$0F:$CF1F:8D 59 05	STA $0559  	; NPC #$03 sprite ID
0x03CF32|$0F:$CF22:8D 61 05	STA $0561  	; NPC #$04 sprite ID
0x03CF35|$0F:$CF25:D0 00   	BNE $CF27  
; control flow target (from $CEF8, $CEFF, $CF11, $CF15, $CF1B, $CF25)
0x03CF37|$0F:$CF27:A9 FF   	LDA #$FF   
0x03CF39|$0F:$CF29:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03CF3B|$0F:$CF2B:60      	RTS        


; code -> data
; indexed data load target (from $CE89)
0x03CF3C|$0F:$CF2C:55	; Map ID #$55: Lighthouse 6F
0x03CF3D|$0F:$CF2D:54	; Map ID #$54: Lighthouse 5F
0x03CF3E|$0F:$CF2E:53	; Map ID #$53: Lighthouse 4F
0x03CF3F|$0F:$CF2F:52	; Map ID #$52: Lighthouse 3F
0x03CF40|$0F:$CF30:51	; Map ID #$51: Lighthouse 2F
; indexed data load target (from $CE90, $CEBB)
; indirect data load target
0x03CF41|$0F:$CF31:0F
; indirect data load target
0x03CF42|$0F:$CF32:11
; indirect data load target
0x03CF43|$0F:$CF33:13
; indirect data load target
0x03CF44|$0F:$CF34:15
; indirect data load target
0x03CF45|$0F:$CF35:17
; indexed data load target (from $CE95)
; indirect data load target
0x03CF46|$0F:$CF36:12
; indirect data load target
0x03CF47|$0F:$CF37:1A
; indirect data load target
0x03CF48|$0F:$CF38:16
; indirect data load target
0x03CF49|$0F:$CF39:1E
; indirect data load target
0x03CF4A|$0F:$CF3A:1D
; indexed data load target (from $CE9B)
; indirect data load target
0x03CF4B|$0F:$CF3B:1B
; indirect data load target
0x03CF4C|$0F:$CF3C:0F
; indirect data load target
0x03CF4D|$0F:$CF3D:1B
; indirect data load target
0x03CF4E|$0F:$CF3E:17
; indirect data load target
0x03CF4F|$0F:$CF3F:1E
; indexed data load target (from $CEA1)
; indirect data load target
0x03CF50|$0F:$CF40:03
; indirect data load target
0x03CF51|$0F:$CF41:02
; indirect data load target
0x03CF52|$0F:$CF42:01
; indirect data load target
0x03CF53|$0F:$CF43:02
; indirect data load target
0x03CF54|$0F:$CF44:02
; indexed data load target (from $CEA8)
; indirect data load target
0x03CF55|$0F:$CF45:0E
; indirect data load target
0x03CF56|$0F:$CF46:10
; indirect data load target
0x03CF57|$0F:$CF47:12
; indirect data load target
0x03CF58|$0F:$CF48:14
; indirect data load target
0x03CF59|$0F:$CF49:16
; indexed data load target (from $CEAF)
; indirect data load target
0x03CF5A|$0F:$CF4A:01
; indirect data load target
0x03CF5B|$0F:$CF4B:19
; indirect data load target
0x03CF5C|$0F:$CF4C:1B
; indirect data load target
0x03CF5D|$0F:$CF4D:13
; indirect data load target
0x03CF5E|$0F:$CF4E:23
; indexed data load target (from $CEB6)
; indirect data load target
0x03CF5F|$0F:$CF4F:18
; indirect data load target
0x03CF60|$0F:$CF50:18
; indirect data load target
0x03CF61|$0F:$CF51:12
; indirect data load target
0x03CF62|$0F:$CF52:1E
; indirect data load target
0x03CF63|$0F:$CF53:1E
; motion script pointers for Lighthouse Wizard
; indexed data load target (from $CECC)
; indirect data load target
0x03CF64|$0F:$CF54:72
; indexed data load target (from $CED2)
0x03CF65|$0F:$CF55:   80	; $07:$8072; motion script for Lighthouse Wizard part 3
0x03CF66|$0F:$CF56:87 80	; $07:$8087; motion script for Lighthouse Wizard part 4
0x03CF68|$0F:$CF58:92 80	; $07:$8092; motion script for Lighthouse Wizard part 5
0x03CF6A|$0F:$CF5A:A0 80	; $07:$80A0; motion script for Lighthouse Wizard part 6
0x03CF6C|$0F:$CF5C:B3 80	; $07:$80B3; motion script for Lighthouse Wizard part 7

; data -> code
; external control flow target (from $02:$B1FD)
0x03CF6E|$0F:$CF5E:20 CB D8	JSR $D8CB  
0x03CF71|$0F:$CF61:4C 70 F7	JMP $F770  	; load ROM bank #$02

; external control flow target (from $06:$8053, $06:$827A, $06:$9371, $06:$A311, $06:$BBC4, $06:$BC2D)
0x03CF74|$0F:$CF64:20 CB D8	JSR $D8CB  
; load ROM bank #$06
; control flow target (from $CF6D, $CF73, $CF79)
0x03CF77|$0F:$CF67:4C 61 F7	JMP $F761  	; load ROM bank #$06

; wipe selected menu region
; external control flow target (from $06:$806F, $06:$8097, $06:$84C9, $06:$8A16, $06:$8A5C, $06:$8B09, $06:$9555, $06:$9CE0)
0x03CF7A|$0F:$CF6A:20 8C F7	JSR $F78C  	; wipe selected menu region
0x03CF7D|$0F:$CF6D:4C 67 CF	JMP $CF67  	; load ROM bank #$06

; external control flow target (from $06:$80AD, $06:$96E1)
0x03CF80|$0F:$CF70:20 87 F7	JSR $F787  
0x03CF83|$0F:$CF73:4C 67 CF	JMP $CF67  	; load ROM bank #$06

; external control flow target (from $06:$826D)
0x03CF86|$0F:$CF76:20 F7 D2	JSR $D2F7  
0x03CF89|$0F:$CF79:4C 67 CF	JMP $CF67  	; load ROM bank #$06

; external control flow target (from $06:$8C6A, $06:$8C77, $06:$8C84, $06:$9775)
0x03CF8C|$0F:$CF7C:A9 00   	LDA #$00   
0x03CF8E|$0F:$CF7E:85 49   	STA $49    	; object hero/target/item/string ID $49
0x03CF90|$0F:$CF80:20 6B D0	JSR $D06B  	; copy $16 to $0C, $17 to $0E
0x03CF93|$0F:$CF83:C6 0E   	DEC $0E    	; check up
0x03CF95|$0F:$CF85:20 A5 CF	JSR $CFA5  
0x03CF98|$0F:$CF88:20 6B D0	JSR $D06B  	; copy $16 to $0C, $17 to $0E
0x03CF9B|$0F:$CF8B:E6 0C   	INC $0C    	; check right
0x03CF9D|$0F:$CF8D:20 A5 CF	JSR $CFA5  
0x03CFA0|$0F:$CF90:20 6B D0	JSR $D06B  	; copy $16 to $0C, $17 to $0E
0x03CFA3|$0F:$CF93:E6 0E   	INC $0E    	; check down
0x03CFA5|$0F:$CF95:20 A5 CF	JSR $CFA5  
0x03CFA8|$0F:$CF98:20 6B D0	JSR $D06B  	; copy $16 to $0C, $17 to $0E
0x03CFAB|$0F:$CF9B:C6 0C   	DEC $0C    	; check left
0x03CFAD|$0F:$CF9D:20 A5 CF	JSR $CFA5  
0x03CFB0|$0F:$CFA0:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03CFB2|$0F:$CFA2:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; control flow target (from $CF85, $CF8D, $CF95, $CF9D)
0x03CFB5|$0F:$CFA5:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03CFB8|$0F:$CFA8:20 89 DF	JSR $DF89  
0x03CFBB|$0F:$CFAB:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03CFBD|$0F:$CFAD:D0 01   	BNE $CFB0  
; control flow target (from $CFB8, $CFBC, $CFCB, $D000, $D006, $D00A)
0x03CFBF|$0F:$CFAF:60      	RTS        

; control flow target (from $CFAD)
0x03CFC0|$0F:$CFB0:C9 01   	CMP #$01   
0x03CFC2|$0F:$CFB2:D0 48   	BNE $CFFC  
0x03CFC4|$0F:$CFB4:A5 0C   	LDA $0C    
0x03CFC6|$0F:$CFB6:C9 18   	CMP #$18   
0x03CFC8|$0F:$CFB8:90 F5   	BCC $CFAF  
0x03CFCA|$0F:$CFBA:C9 1B   	CMP #$1B   
0x03CFCC|$0F:$CFBC:B0 F1   	BCS $CFAF  
0x03CFCE|$0F:$CFBE:A9 01   	LDA #$01   
0x03CFD0|$0F:$CFC0:05 49   	ORA $49    	; object hero/target/item/string ID $49
0x03CFD2|$0F:$CFC2:85 49   	STA $49    	; object hero/target/item/string ID $49
0x03CFD4|$0F:$CFC4:A5 C9   	LDA $C9    
0x03CFD6|$0F:$CFC6:18      	CLC        
0x03CFD7|$0F:$CFC7:69 18   	ADC #$18   
0x03CFD9|$0F:$CFC9:C5 0C   	CMP $0C    
0x03CFDB|$0F:$CFCB:D0 E2   	BNE $CFAF  
0x03CFDD|$0F:$CFCD:20 58 D0	JSR $D058  
0x03CFE0|$0F:$CFD0:A9 FF   	LDA #$FF   
0x03CFE2|$0F:$CFD2:85 49   	STA $49    	; object hero/target/item/string ID $49
0x03CFE4|$0F:$CFD4:A5 12   	LDA $12    
0x03CFE6|$0F:$CFD6:99 2A 05	STA $052A,Y
0x03CFE9|$0F:$CFD9:A5 13   	LDA $13    
0x03CFEB|$0F:$CFDB:99 2B 05	STA $052B,Y
0x03CFEE|$0F:$CFDE:A5 12   	LDA $12    
0x03CFF0|$0F:$CFE0:38      	SEC        
0x03CFF1|$0F:$CFE1:E5 16   	SBC $16    	; current map X-pos (1)
0x03CFF3|$0F:$CFE3:0A      	ASL        
0x03CFF4|$0F:$CFE4:85 18   	STA $18    
0x03CFF6|$0F:$CFE6:A5 13   	LDA $13    
0x03CFF8|$0F:$CFE8:38      	SEC        
0x03CFF9|$0F:$CFE9:E5 17   	SBC $17    	; current map Y-pos (1)
0x03CFFB|$0F:$CFEB:0A      	ASL        
0x03CFFC|$0F:$CFEC:85 19   	STA $19    
0x03CFFE|$0F:$CFEE:A9 00   	LDA #$00   
0x03D000|$0F:$CFF0:85 1C   	STA $1C    
0x03D002|$0F:$CFF2:85 1E   	STA $1E    
0x03D004|$0F:$CFF4:A9 93   	LDA #$93   	; Music ID #$93: door open SFX
0x03D006|$0F:$CFF6:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D009|$0F:$CFF9:4C 74 D0	JMP $D074  

; control flow target (from $CFB2)
0x03D00C|$0F:$CFFC:A5 C9   	LDA $C9    
0x03D00E|$0F:$CFFE:C9 02   	CMP #$02   
0x03D010|$0F:$D000:B0 AD   	BCS $CFAF  
0x03D012|$0F:$D002:A5 0C   	LDA $0C    
0x03D014|$0F:$D004:C9 18   	CMP #$18   
0x03D016|$0F:$D006:90 A7   	BCC $CFAF  
0x03D018|$0F:$D008:C9 1C   	CMP #$1C   
0x03D01A|$0F:$D00A:B0 A3   	BCS $CFAF  
0x03D01C|$0F:$D00C:A9 01   	LDA #$01   
0x03D01E|$0F:$D00E:05 49   	ORA $49    	; object hero/target/item/string ID $49
0x03D020|$0F:$D010:85 49   	STA $49    	; object hero/target/item/string ID $49
0x03D022|$0F:$D012:20 58 D0	JSR $D058  
0x03D025|$0F:$D015:A9 FF   	LDA #$FF   
0x03D027|$0F:$D017:85 49   	STA $49    	; object hero/target/item/string ID $49
0x03D029|$0F:$D019:A5 12   	LDA $12    
0x03D02B|$0F:$D01B:99 2A 05	STA $052A,Y
0x03D02E|$0F:$D01E:A5 13   	LDA $13    
0x03D030|$0F:$D020:99 2B 05	STA $052B,Y
0x03D033|$0F:$D023:A5 12   	LDA $12    
0x03D035|$0F:$D025:0A      	ASL        
0x03D036|$0F:$D026:38      	SEC        
0x03D037|$0F:$D027:E5 16   	SBC $16    	; current map X-pos (1)
0x03D039|$0F:$D029:0A      	ASL        
0x03D03A|$0F:$D02A:85 18   	STA $18    
0x03D03C|$0F:$D02C:A5 13   	LDA $13    
0x03D03E|$0F:$D02E:0A      	ASL        
0x03D03F|$0F:$D02F:38      	SEC        
0x03D040|$0F:$D030:E5 17   	SBC $17    	; current map Y-pos (1)
0x03D042|$0F:$D032:0A      	ASL        
0x03D043|$0F:$D033:85 19   	STA $19    
0x03D045|$0F:$D035:A9 00   	LDA #$00   
0x03D047|$0F:$D037:85 1C   	STA $1C    
0x03D049|$0F:$D039:85 1E   	STA $1E    
0x03D04B|$0F:$D03B:A9 93   	LDA #$93   	; Music ID #$93: door open SFX
0x03D04D|$0F:$D03D:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D050|$0F:$D040:20 74 D0	JSR $D074  
0x03D053|$0F:$D043:E6 18   	INC $18    
0x03D055|$0F:$D045:E6 18   	INC $18    
0x03D057|$0F:$D047:20 74 D0	JSR $D074  
0x03D05A|$0F:$D04A:E6 19   	INC $19    
0x03D05C|$0F:$D04C:E6 19   	INC $19    
0x03D05E|$0F:$D04E:20 74 D0	JSR $D074  
0x03D061|$0F:$D051:C6 18   	DEC $18    
0x03D063|$0F:$D053:C6 18   	DEC $18    
0x03D065|$0F:$D055:4C 74 D0	JMP $D074  

; control flow target (from $CAC3, $CFCD, $D012)
0x03D068|$0F:$D058:A0 00   	LDY #$00   
; control flow target (from $D066)
0x03D06A|$0F:$D05A:B9 2A 05	LDA $052A,Y
0x03D06D|$0F:$D05D:19 2B 05	ORA $052B,Y
0x03D070|$0F:$D060:F0 08   	BEQ $D06A  
0x03D072|$0F:$D062:C8      	INY        
0x03D073|$0F:$D063:C8      	INY        
0x03D074|$0F:$D064:C0 10   	CPY #$10   
0x03D076|$0F:$D066:D0 F2   	BNE $D05A  
0x03D078|$0F:$D068:68      	PLA        
0x03D079|$0F:$D069:68      	PLA        
; control flow target (from $D060)
0x03D07A|$0F:$D06A:60      	RTS        

; copy $16 to $0C, $17 to $0E
; control flow target (from $CF80, $CF88, $CF90, $CF98, $D0A0)
0x03D07B|$0F:$D06B:A5 16   	LDA $16    	; current map X-pos (1)
0x03D07D|$0F:$D06D:85 0C   	STA $0C    
0x03D07F|$0F:$D06F:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D081|$0F:$D071:85 0E   	STA $0E    
0x03D083|$0F:$D073:60      	RTS        

; control flow target (from $CFF9, $D040, $D047, $D04E, $D055)
0x03D084|$0F:$D074:A5 18   	LDA $18    
0x03D086|$0F:$D076:18      	CLC        
0x03D087|$0F:$D077:69 10   	ADC #$10   
0x03D089|$0F:$D079:85 0C   	STA $0C    
0x03D08B|$0F:$D07B:A5 19   	LDA $19    
0x03D08D|$0F:$D07D:18      	CLC        
0x03D08E|$0F:$D07E:69 0E   	ADC #$0E   
0x03D090|$0F:$D080:85 0E   	STA $0E    
0x03D092|$0F:$D082:20 2D DE	JSR $DE2D  
0x03D095|$0F:$D085:A0 00   	LDY #$00   
0x03D097|$0F:$D087:B1 07   	LDA ($07),Y
0x03D099|$0F:$D089:F0 01   	BEQ $D08C  
0x03D09B|$0F:$D08B:60      	RTS        

; control flow target (from $D089)
0x03D09C|$0F:$D08C:A9 00   	LDA #$00   
0x03D09E|$0F:$D08E:85 1C   	STA $1C    
0x03D0A0|$0F:$D090:85 1E   	STA $1E    
0x03D0A2|$0F:$D092:4C C5 DE	JMP $DEC5  

; external control flow target (from $06:$9B30)
0x03D0A5|$0F:$D095:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03D0A7|$0F:$D097:D0 07   	BNE $D0A0  
; control flow target (from $D0AA, $D0BC)
0x03D0A9|$0F:$D099:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D0AB|$0F:$D09B:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03D0AE|$0F:$D09E:18      	CLC        
0x03D0AF|$0F:$D09F:60      	RTS        

; control flow target (from $D097)
0x03D0B0|$0F:$D0A0:20 6B D0	JSR $D06B  	; copy $16 to $0C, $17 to $0E
0x03D0B3|$0F:$D0A3:20 89 DF	JSR $DF89  
0x03D0B6|$0F:$D0A6:A5 0C   	LDA $0C    
0x03D0B8|$0F:$D0A8:C9 14   	CMP #$14   
0x03D0BA|$0F:$D0AA:D0 ED   	BNE $D099  
0x03D0BC|$0F:$D0AC:A0 00   	LDY #$00   
; control flow target (from $D0BA)
0x03D0BE|$0F:$D0AE:B9 1A 05	LDA $051A,Y	; something to do with whether you've opened the chest containing the Shield of Erdrick
0x03D0C1|$0F:$D0B1:19 1B 05	ORA $051B,Y
0x03D0C4|$0F:$D0B4:F0 08   	BEQ $D0BE  
0x03D0C6|$0F:$D0B6:C8      	INY        
0x03D0C7|$0F:$D0B7:C8      	INY        
0x03D0C8|$0F:$D0B8:C0 10   	CPY #$10   
0x03D0CA|$0F:$D0BA:D0 F2   	BNE $D0AE  
0x03D0CC|$0F:$D0BC:F0 DB   	BEQ $D099  
; control flow target (from $D0B4)
0x03D0CE|$0F:$D0BE:A5 12   	LDA $12    
0x03D0D0|$0F:$D0C0:99 1A 05	STA $051A,Y	; something to do with whether you've opened the chest containing the Shield of Erdrick
0x03D0D3|$0F:$D0C3:A5 13   	LDA $13    
0x03D0D5|$0F:$D0C5:99 1B 05	STA $051B,Y
0x03D0D8|$0F:$D0C8:A0 00   	LDY #$00   
0x03D0DA|$0F:$D0CA:B1 10   	LDA ($10),Y
0x03D0DC|$0F:$D0CC:29 E0   	AND #$E0   
0x03D0DE|$0F:$D0CE:91 10   	STA ($10),Y
0x03D0E0|$0F:$D0D0:A9 92   	LDA #$92   	; Music ID #$92: open chest SFX
0x03D0E2|$0F:$D0D2:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D0E5|$0F:$D0D5:A9 00   	LDA #$00   
0x03D0E7|$0F:$D0D7:85 18   	STA $18    
0x03D0E9|$0F:$D0D9:85 19   	STA $19    
0x03D0EB|$0F:$D0DB:85 1C   	STA $1C    
0x03D0ED|$0F:$D0DD:85 1E   	STA $1E    
0x03D0EF|$0F:$D0DF:20 C5 DE	JSR $DEC5  
0x03D0F2|$0F:$D0E2:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D0F5|$0F:$D0E5:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D0F7|$0F:$D0E7:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03D0FA|$0F:$D0EA:38      	SEC        
0x03D0FB|$0F:$D0EB:60      	RTS        

; update each hero's stats based on their current EXP
; control flow target (from $F5AE)
; external control flow target (from $06:$8B04)
0x03D0FC|$0F:$D0EC:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$8009)
0x03D0FF|$0F:$D0EF:20 09 80	JSR $8009  	; update each hero's stats based on their current EXP
0x03D102|$0F:$D0F2:4C 61 F7	JMP $F761  	; load ROM bank #$06

; wait for a while and then wipe menu regions #$03, #$00, and #$01
; control flow target (from $C84A, $C85A, $C944, $C9AF, $CA39, $CAA9, $CB36, $CB94, $CC00, $CC0E, $CC59, $CC76, $D1A1, $D1C6)
; external control flow target (from $06:$90C3, $06:$91B7, $06:$935C, $06:$9374, $06:$96A8, $06:$9709, $06:$979E, $06:$98F0, $06:$A1B1, $06:$A2F8, $06:$BB80, $06:$BBB3, $06:$BBD7, $07:$81FC, $07:$8227, $07:$8238, $07:$827F, $07:$82EB, $07:$8355, $07:$8366, $07:$837B, $07:$8402, $07:$84CB, $07:$8595)
0x03D105|$0F:$D0F5:8A      	TXA        	; save X on the stack; pointless since X gets overwritten before next use
0x03D106|$0F:$D0F6:48      	PHA        
0x03D107|$0F:$D0F7:A2 1E   	LDX #$1E   
0x03D109|$0F:$D0F9:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03D10C|$0F:$D0FC:68      	PLA        	; restore X from the stack
0x03D10D|$0F:$D0FD:AA      	TAX        
0x03D10E|$0F:$D0FE:AD 2C 06	LDA $062C  	; current battle message delay
0x03D111|$0F:$D101:C9 28   	CMP #$28   	; FAST uses #$82
0x03D113|$0F:$D103:F0 0C   	BEQ $D111  
0x03D115|$0F:$D105:C9 46   	CMP #$46   	; NORMAL uses #$AA
0x03D117|$0F:$D107:F0 04   	BEQ $D10D  
0x03D119|$0F:$D109:A9 E6   	LDA #$E6   	; ergo SLOW uses #$E6
0x03D11B|$0F:$D10B:D0 06   	BNE $D113  
; control flow target (from $D107)
0x03D11D|$0F:$D10D:A9 AA   	LDA #$AA   	; from NORMAL
0x03D11F|$0F:$D10F:D0 02   	BNE $D113  
; control flow target (from $D103)
0x03D121|$0F:$D111:A9 82   	LDA #$82   	; from FAST
; control flow target (from $D10B, $D10F)
0x03D123|$0F:$D113:85 93   	STA $93    	; NMI counter, decremented once per NMI until it reaches 0
; wait until battle message delay reaches zero or no buttons pressed
; control flow target (from $D11E)
0x03D125|$0F:$D115:20 3D D1	JSR $D13D  	; wait for interrupt, read joypad data into $2F and A
0x03D128|$0F:$D118:A6 93   	LDX $93    	; NMI counter, decremented once per NMI until it reaches 0
0x03D12A|$0F:$D11A:F0 0F   	BEQ $D12B  
0x03D12C|$0F:$D11C:C9 00   	CMP #$00   
0x03D12E|$0F:$D11E:D0 F5   	BNE $D115  
; wait until battle message delay reaches is zero or some button pressed
; control flow target (from $D129)
0x03D130|$0F:$D120:20 3D D1	JSR $D13D  	; wait for interrupt, read joypad data into $2F and A
0x03D133|$0F:$D123:A6 93   	LDX $93    	; NMI counter, decremented once per NMI until it reaches 0
0x03D135|$0F:$D125:F0 04   	BEQ $D12B  
0x03D137|$0F:$D127:C9 00   	CMP #$00   
0x03D139|$0F:$D129:F0 F5   	BEQ $D120  
; control flow target (from $D11A, $D125)
0x03D13B|$0F:$D12B:20 89 FA	JSR $FA89  	; useless JSR to RTS?!
0x03D13E|$0F:$D12E:A9 03   	LDA #$03   
0x03D140|$0F:$D130:20 8C F7	JSR $F78C  	; wipe selected menu region
0x03D143|$0F:$D133:A9 00   	LDA #$00   
0x03D145|$0F:$D135:20 8C F7	JSR $F78C  	; wipe selected menu region
0x03D148|$0F:$D138:A9 01   	LDA #$01   
0x03D14A|$0F:$D13A:4C 8C F7	JMP $F78C  	; wipe selected menu region

; wait for interrupt, read joypad data into $2F and A
; control flow target (from $D115, $D120)
; external control flow target (from $06:$809D, $06:$80A2)
0x03D14D|$0F:$D13D:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D150|$0F:$D140:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x03D153|$0F:$D143:A5 2F   	LDA $2F    	; joypad 1 data
0x03D155|$0F:$D145:60      	RTS        

; heal hero ID in A by random amount based on healing power in X
; external control flow target (from $06:$8BED)
0x03D156|$0F:$D146:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$8006)
0x03D159|$0F:$D149:20 06 80	JSR $8006  
0x03D15C|$0F:$D14C:4C 61 F7	JMP $F761  	; load ROM bank #$06

; control flow target (from $FF60)
; external control flow target (from $06:$A848, $06:$A98F)
0x03D15F|$0F:$D14F:A9 00   	LDA #$00   
0x03D161|$0F:$D151:85 27   	STA $27    	; map palette; offset from ($E27C)
0x03D163|$0F:$D153:20 F9 E2	JSR $E2F9  
0x03D166|$0F:$D156:4C 61 F7	JMP $F761  	; load ROM bank #$06

; external control flow target (from $06:$A35D)
0x03D169|$0F:$D159:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D16B|$0F:$D15B:48      	PHA        
0x03D16C|$0F:$D15C:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03D16F|$0F:$D15F:C4	; $06:$8008

; data -> code
0x03D170|$0F:$D160:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x03D173|$0F:$D163:7A	; String ID #$007A: ‘Then farewell and good luck!’[end-FC]

; data -> code
; control flow target (from $D172)
0x03D174|$0F:$D164:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03D177|$0F:$D167:68      	PLA        
0x03D178|$0F:$D168:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D17A|$0F:$D16A:60      	RTS        

; external control flow target (from $06:$8F20)
0x03D17B|$0F:$D16B:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D17D|$0F:$D16D:48      	PHA        
0x03D17E|$0F:$D16E:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03D181|$0F:$D171:C4	; $06:$8008

; data -> code
0x03D182|$0F:$D172:4C 64 D1	JMP $D164  

; external control flow target (from $06:$A882)
0x03D185|$0F:$D175:A9 8F   	LDA #$8F   
0x03D187|$0F:$D177:85 30   	STA $30    
0x03D189|$0F:$D179:20 DE D2	JSR $D2DE  
0x03D18C|$0F:$D17C:20 75 F7	JSR $F775  	; load ROM bank #$03
; call to code in a different bank ($03:$8006)
0x03D18F|$0F:$D17F:20 06 80	JSR $8006  
0x03D192|$0F:$D182:A9 FF   	LDA #$FF   
0x03D194|$0F:$D184:85 8E   	STA $8E    	; flag for in battle or not (#$FF)?
0x03D196|$0F:$D186:A9 04   	LDA #$04   	; Menu ID #$04: Dialogue window
0x03D198|$0F:$D188:20 89 EB	JSR $EB89  	; open menu specified by A
0x03D19B|$0F:$D18B:A9 00   	LDA #$00   
0x03D19D|$0F:$D18D:85 27   	STA $27    	; map palette; offset from ($E27C)
0x03D19F|$0F:$D18F:20 F9 E2	JSR $E2F9  
0x03D1A2|$0F:$D192:E6 8E   	INC $8E    	; flag for in battle or not (#$FF)?
0x03D1A4|$0F:$D194:A9 7B   	LDA #$7B   	; String ID #$007B: In that case, return when thou can, for Hargon does not sleep.[wait][line]In order to preserve the Imperial Scrolls of honor, please hold the REST button in while pushing the POWER button off.[wait][line]If you turn off the POWER first, you may lose the record of your great deeds, and that would be a shame.[line][FD][FD] [line][end-FC]
0x03D1A6|$0F:$D196:20 4A FA	JSR $FA4A  	; display string ID specified by A
0x03D1A9|$0F:$D199:A9 10   	LDA #$10   
0x03D1AB|$0F:$D19B:20 36 C6	JSR $C636  	; set CHR bank 0 based on A
; infinite loop
; control flow target (from $D19E)
0x03D1AE|$0F:$D19E:4C 9E D1	JMP $D19E  	; infinite loop

; handle Hamlin Waterway Gremlins fight
; external control flow target (from $06:$906E)
0x03D1B1|$0F:$D1A1:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03D1B4|$0F:$D1A4:20 66 F7	JSR $F766  	; load ROM bank #$04
0x03D1B7|$0F:$D1A7:A9 03   	LDA #$03   	; Fixed Battle #$03: 2 Ozwargs (Map ID #$08: Hamlin Waterway)
; call to code in a different bank ($04:$800F)
0x03D1B9|$0F:$D1A9:20 0F 80	JSR $800F  
0x03D1BC|$0F:$D1AC:A5 98   	LDA $98    	; outcome of last fight?
0x03D1BE|$0F:$D1AE:C9 FC   	CMP #$FC   
0x03D1C0|$0F:$D1B0:F0 0E   	BEQ $D1C0  
0x03D1C2|$0F:$D1B2:A9 02   	LDA #$02   
0x03D1C4|$0F:$D1B4:05 D1   	ORA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03D1C6|$0F:$D1B6:85 D1   	STA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03D1C8|$0F:$D1B8:A9 FF   	LDA #$FF   
0x03D1CA|$0F:$D1BA:8D 59 05	STA $0559  	; NPC #$03 sprite ID
0x03D1CD|$0F:$D1BD:8D 61 05	STA $0561  	; NPC #$04 sprite ID
; control flow target (from $D1B0)
0x03D1D0|$0F:$D1C0:20 62 D2	JSR $D262  
0x03D1D3|$0F:$D1C3:4C FB D2	JMP $D2FB  	; load ROM bank 6

; external control flow target (from $06:$9342)
0x03D1D6|$0F:$D1C6:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x03D1D9|$0F:$D1C9:20 66 F7	JSR $F766  	; load ROM bank #$04
0x03D1DC|$0F:$D1CC:A9 04   	LDA #$04   	; Fixed Battle #$04: 2 Gold Batboons (Map ID #$16: Hargon's Castle 1F)
; call to code in a different bank ($04:$800F)
0x03D1DE|$0F:$D1CE:20 0F 80	JSR $800F  
0x03D1E1|$0F:$D1D1:A5 98   	LDA $98    	; outcome of last fight?
0x03D1E3|$0F:$D1D3:C9 FC   	CMP #$FC   
0x03D1E5|$0F:$D1D5:F0 08   	BEQ $D1DF  
0x03D1E7|$0F:$D1D7:A9 FF   	LDA #$FF   
0x03D1E9|$0F:$D1D9:8D 81 05	STA $0581  	; NPC #$08 sprite ID
0x03D1EC|$0F:$D1DC:8D 89 05	STA $0589  	; NPC #$09 sprite ID
; control flow target (from $D1D5)
0x03D1EF|$0F:$D1DF:20 62 D2	JSR $D262  
0x03D1F2|$0F:$D1E2:4C FB D2	JMP $D2FB  	; load ROM bank 6

; trigger Fixed Battle #$01: 1 Evil Clown (Map ID #$04: Midenhall B1)
; external control flow target (from $06:$80E5)
0x03D1F5|$0F:$D1E5:A9 FF   	LDA #$FF   
0x03D1F7|$0F:$D1E7:8D 69 05	STA $0569  	; NPC #$05 sprite ID
0x03D1FA|$0F:$D1EA:A9 01   	LDA #$01   	; Fixed Battle #$01: 1 Evil Clown (Map ID #$04: Midenhall B1)
0x03D1FC|$0F:$D1EC:20 5C D2	JSR $D25C  	; trigger fixed battle A
0x03D1FF|$0F:$D1EF:A9 01   	LDA #$01   
0x03D201|$0F:$D1F1:05 D1   	ORA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03D203|$0F:$D1F3:85 D1   	STA $D1    	; fixed battle status bits (#$10 = Zarlox, #$08 = Bazuzu, #$04 = Atlas, #$02 = Hamlin Waterway Gremlins, #$01 = Evil Clown)
0x03D205|$0F:$D1F5:4C FB D2	JMP $D2FB  	; load ROM bank 6

; trigger Fixed Battle #$0B: 1 Hargon (Map ID #$17: Hargon's Castle 7F)
; external control flow target (from $06:$935F)
0x03D208|$0F:$D1F8:A9 0B   	LDA #$0B   	; Fixed Battle #$0B: 1 Hargon (Map ID #$17: Hargon's Castle 7F)
0x03D20A|$0F:$D1FA:20 5C D2	JSR $D25C  	; trigger fixed battle A
0x03D20D|$0F:$D1FD:4C FB D2	JMP $D2FB  	; load ROM bank 6

; external control flow target (from $06:$BD2A)
0x03D210|$0F:$D200:20 66 F7	JSR $F766  	; load ROM bank #$04
0x03D213|$0F:$D203:A9 0C   	LDA #$0C   	; Fixed Battle #$0C: 1 Malroth (Map ID #$17: Hargon's Castle 7F)
; call to code in a different bank ($04:$800F)
0x03D215|$0F:$D205:20 0F 80	JSR $800F  
0x03D218|$0F:$D208:A9 FF   	LDA #$FF   
0x03D21A|$0F:$D20A:85 44   	STA $44    	; non-saved event status (#$00 = event start, #$01 = Lianport Gremlins defeated, #$02 = met with Lianport grandfather/have no friends at Shrine SW of Cannock, #$03 = King Midenhall moved to stairs, #$04 = King Midenhall moved down stairs, #$05 = King Midenhall spoke on Midenhall 1F, #$0B = Lighthouse Wizard 7F, #$1B Lighthouse Wizard 2F spoke, #$64 = Hargon dead, #$FF = event end)
0x03D21C|$0F:$D20C:A5 98   	LDA $98    	; outcome of last fight?
0x03D21E|$0F:$D20E:C9 FF   	CMP #$FF   
0x03D220|$0F:$D210:D0 03   	BNE $D215  
0x03D222|$0F:$D212:4C 67 D2	JMP $D267  

; control flow target (from $D210)
0x03D225|$0F:$D215:4C 61 F7	JMP $F761  	; load ROM bank #$06

; open path to Sea Cave
; external control flow target (from $06:$98FD)
0x03D228|$0F:$D218:A9 97   	LDA #$97   	; Music ID #$97: shoals submerging SFX
0x03D22A|$0F:$D21A:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D22D|$0F:$D21D:20 5C F7	JSR $F75C  	; load ROM bank #$00
0x03D230|$0F:$D220:A9 00   	LDA #$00   
; call to code in a different bank ($00:$8006)
0x03D232|$0F:$D222:20 06 80	JSR $8006  
0x03D235|$0F:$D225:A9 32   	LDA #$32   
0x03D237|$0F:$D227:85 41   	STA $41    
0x03D239|$0F:$D229:20 38 E9	JSR $E938  
0x03D23C|$0F:$D22C:A9 97   	LDA #$97   	; Music ID #$97: shoals submerging SFX
0x03D23E|$0F:$D22E:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D241|$0F:$D231:20 5C F7	JSR $F75C  	; load ROM bank #$00
0x03D244|$0F:$D234:A9 FF   	LDA #$FF   
; call to code in a different bank ($00:$8006)
0x03D246|$0F:$D236:20 06 80	JSR $8006  
0x03D249|$0F:$D239:68      	PLA        
0x03D24A|$0F:$D23A:68      	PLA        
0x03D24B|$0F:$D23B:4C 61 F7	JMP $F761  	; load ROM bank #$06

; external control flow target (from $06:$96B0)
0x03D24E|$0F:$D23E:20 5C F7	JSR $F75C  	; load ROM bank #$00
; call to code in a different bank ($00:$8009)
0x03D251|$0F:$D241:20 09 80	JSR $8009  
0x03D254|$0F:$D244:A9 01   	LDA #$01   
0x03D256|$0F:$D246:8D F9 05	STA $05F9  	; flag for Cave to Rhone open
0x03D259|$0F:$D249:A9 32   	LDA #$32   
0x03D25B|$0F:$D24B:85 41   	STA $41    
0x03D25D|$0F:$D24D:20 38 E9	JSR $E938  
0x03D260|$0F:$D250:20 5C F7	JSR $F75C  	; load ROM bank #$00
; call to code in a different bank ($00:$800C)
0x03D263|$0F:$D253:4C 0C 80	JMP $800C  

; external control flow target (from $06:$97BA, $06:$97C1)
0x03D266|$0F:$D256:20 C5 DE	JSR $DEC5  
0x03D269|$0F:$D259:4C 61 F7	JMP $F761  	; load ROM bank #$06

; trigger fixed battle A
; control flow target (from $C8D1, $CAFC, $CC38, $CC94, $D1EC, $D1FA)
0x03D26C|$0F:$D25C:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$800F)
0x03D26F|$0F:$D25F:20 0F 80	JSR $800F  
; control flow target (from $C908, $C972, $D1C0, $D1DF)
0x03D272|$0F:$D262:A5 98   	LDA $98    	; outcome of last fight?
0x03D274|$0F:$D264:D0 01   	BNE $D267  
0x03D276|$0F:$D266:60      	RTS        

; control flow target (from $D212, $D264)
0x03D277|$0F:$D267:A9 00   	LDA #$00   
0x03D279|$0F:$D269:85 8E   	STA $8E    	; flag for in battle or not (#$FF)?
0x03D27B|$0F:$D26B:A5 98   	LDA $98    	; outcome of last fight?
0x03D27D|$0F:$D26D:C9 FF   	CMP #$FF   
0x03D27F|$0F:$D26F:D0 24   	BNE $D295  
; external control flow target (from $06:$A25A)
0x03D281|$0F:$D271:A9 26   	LDA #$26   
0x03D283|$0F:$D273:8D 0E 05	STA $050E  
0x03D286|$0F:$D276:20 DE D2	JSR $D2DE  
0x03D289|$0F:$D279:A9 84   	LDA #$84   
0x03D28B|$0F:$D27B:8D 2D 06	STA $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03D28E|$0F:$D27E:A2 FF   	LDX #$FF   
0x03D290|$0F:$D280:9A      	TXS        
0x03D291|$0F:$D281:A9 01   	LDA #$01   
0x03D293|$0F:$D283:8D 3B 06	STA $063B  	; Midenhall Current HP, low byte
0x03D296|$0F:$D286:20 FB D2	JSR $D2FB  	; load ROM bank 6
; call to code in a different bank ($06:$8DCC)
0x03D299|$0F:$D289:20 CC 8D	JSR $8DCC  	; restore full HP to all living party members
0x03D29C|$0F:$D28C:20 B9 D2	JSR $D2B9  
; call to code in a different bank ($06:$8F39)
0x03D29F|$0F:$D28F:20 39 8F	JSR $8F39  
0x03D2A2|$0F:$D292:4C 00 C7	JMP $C700  

; control flow target (from $D26F)
0x03D2A5|$0F:$D295:20 DE D2	JSR $D2DE  
0x03D2A8|$0F:$D298:A9 FF   	LDA #$FF   
; control flow target (from $C9A5)
0x03D2AA|$0F:$D29A:85 45   	STA $45    
0x03D2AC|$0F:$D29C:20 5C F7	JSR $F75C  	; load ROM bank #$00
0x03D2AF|$0F:$D29F:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03D2B1|$0F:$D2A1:85 0C   	STA $0C    
; call to code in a different bank ($00:$8000)
0x03D2B3|$0F:$D2A3:20 00 80	JSR $8000  
0x03D2B6|$0F:$D2A6:20 F7 D2	JSR $D2F7  
0x03D2B9|$0F:$D2A9:20 5C F7	JSR $F75C  	; load ROM bank #$00
0x03D2BC|$0F:$D2AC:A9 04   	LDA #$04   
0x03D2BE|$0F:$D2AE:85 0C   	STA $0C    
; call to code in a different bank ($00:$8000)
0x03D2C0|$0F:$D2B0:20 00 80	JSR $8000  
0x03D2C3|$0F:$D2B3:4C 81 E2	JMP $E281  

0x03D2C6|$0F:$D2B6:20 2A C4	JSR $C42A  
; control flow target (from $C6FA, $D28C)
0x03D2C9|$0F:$D2B9:20 FB D2	JSR $D2FB  	; load ROM bank 6
0x03D2CC|$0F:$D2BC:20 A2 E5	JSR $E5A2  
0x03D2CF|$0F:$D2BF:A2 03   	LDX #$03   
0x03D2D1|$0F:$D2C1:20 E7 D2	JSR $D2E7  	; X = 1 => CLC and update $0C-$0D to warp point data to use if Outside allowed from current map, SEC otherwise, X = 2 => CLC and update $0C-$0D to warp point data to use if Return allowed from current map, SEC otherwise, X = 3 => disembark from ship and update ship position based on last save point ID $48
0x03D2D4|$0F:$D2C4:A5 48   	LDA $48    	; last save point ID
0x03D2D6|$0F:$D2C6:C9 05   	CMP #$05   	; Save Point ID #$05: Rhone Shrine
0x03D2D8|$0F:$D2C8:D0 0E   	BNE $D2D8  
0x03D2DA|$0F:$D2CA:A9 84   	LDA #$84   
0x03D2DC|$0F:$D2CC:8D 2D 06	STA $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03D2DF|$0F:$D2CF:8D 3F 06	STA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03D2E2|$0F:$D2D2:8D 51 06	STA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03D2E5|$0F:$D2D5:20 7B C7	JSR $C77B  	; restore full HP/MP to all living party members
; control flow target (from $D2C8)
0x03D2E8|$0F:$D2D8:20 AF C7	JSR $C7AF  
0x03D2EB|$0F:$D2DB:4C FB D2	JMP $D2FB  	; load ROM bank 6

; control flow target (from $D179, $D276, $D295)
0x03D2EE|$0F:$D2DE:20 2A C4	JSR $C42A  
0x03D2F1|$0F:$D2E1:20 46 C4	JSR $C446  	; turn screen off, write $800 [space] tiles to PPU $2000, turn screen on
0x03D2F4|$0F:$D2E4:4C 65 C4	JMP $C465  	; wait for interrupt and then set every 4th byte of $0200 - $02FC to #$F0

; X = 1 => CLC and update $0C-$0D to warp point data to use if Outside allowed from current map, SEC otherwise, X = 2 => CLC and update $0C-$0D to warp point data to use if Return allowed from current map, SEC otherwise, X = 3 => disembark from ship and update ship position based on last save point ID $48
; control flow target (from $D2C1, $D2F1)
; external control flow target (from $06:$8C53, $06:$8CD6)
0x03D2F7|$0F:$D2E7:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03D2FA|$0F:$D2EA:A3	; $06:$8046; -> $06:$BEED: X = 1 => CLC and update $0C-$0D to warp point data to use if Outside allowed from current map, SEC otherwise, X = 2 => CLC and update $0C-$0D to warp point data to use if Return allowed from current map, SEC otherwise, X = 3 => disembark from ship and update ship position based on last save point ID $48

; data -> code
0x03D2FB|$0F:$D2EB:08      	PHP        
0x03D2FC|$0F:$D2EC:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03D2FF|$0F:$D2EF:28      	PLP        
0x03D300|$0F:$D2F0:60      	RTS        

; external control flow target (from $06:$BD62)
0x03D301|$0F:$D2F1:20 E7 D2	JSR $D2E7  	; X = 1 => CLC and update $0C-$0D to warp point data to use if Outside allowed from current map, SEC otherwise, X = 2 => CLC and update $0C-$0D to warp point data to use if Return allowed from current map, SEC otherwise, X = 3 => disembark from ship and update ship position based on last save point ID $48
0x03D304|$0F:$D2F4:4C 61 F7	JMP $F761  	; load ROM bank #$06

; control flow target (from $CF76, $D2A6, $D311, $D3C2, $D4A6, $E4BE, $E9B7)
0x03D307|$0F:$D2F7:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03D30A|$0F:$D2FA:A2	; $06:$8044

; data -> code
; load ROM bank 6
; control flow target (from $C918, $CAFF, $D1C3, $D1E2, $D1F5, $D1FD, $D286, $D2B9, $D2DB, $D340)
0x03D30B|$0F:$D2FB:A9 06   	LDA #$06   
0x03D30D|$0F:$D2FD:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D30F|$0F:$D2FF:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; external control flow target (from $06:$8669, $06:$8CC2, $06:$9420, $06:$9427, $06:$942E, $06:$A225)
0x03D312|$0F:$D302:20 5C F7	JSR $F75C  	; load ROM bank #$00
0x03D315|$0F:$D305:A4 97   	LDY $97    	; subject hero ID $97
0x03D317|$0F:$D307:B9 1F D3	LDA $D31F,Y
; call to code in a different bank ($00:$8003)
0x03D31A|$0F:$D30A:20 03 80	JSR $8003  
0x03D31D|$0F:$D30D:A9 FF   	LDA #$FF   
0x03D31F|$0F:$D30F:85 45   	STA $45    
0x03D321|$0F:$D311:20 F7 D2	JSR $D2F7  
0x03D324|$0F:$D314:20 CB D8	JSR $D8CB  
0x03D327|$0F:$D317:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D32A|$0F:$D31A:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D32C|$0F:$D31C:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A


; code -> data
; indexed data load target (from $D307)
; indirect data load target
0x03D32F|$0F:$D31F:5C
; indirect data load target
0x03D330|$0F:$D320:61
; indirect data load target
0x03D331|$0F:$D321:66
; indirect data load target
0x03D332|$0F:$D322:58
0x03D333|$0F:$D323:59
; indirect data load target
0x03D334|$0F:$D324:5A

; data -> code
; external control flow target (from $06:$BD0B)
0x03D335|$0F:$D325:20 C5 DE	JSR $DEC5  
0x03D338|$0F:$D328:20 04 C5	JSR $C504  
; control flow target (from $D331)
0x03D33B|$0F:$D32B:4C 61 F7	JMP $F761  	; load ROM bank #$06

; external control flow target (from $06:$BD71)
0x03D33E|$0F:$D32E:20 CB D8	JSR $D8CB  
0x03D341|$0F:$D331:4C 2B D3	JMP $D32B  

; post-Malroth dialogue
; external control flow target (from $06:$80B9)
0x03D344|$0F:$D334:20 5C F7	JSR $F75C  	; load ROM bank #$00
; call to code in a different bank ($00:$8012)
0x03D347|$0F:$D337:20 12 80	JSR $8012  	; return value for $0D for post-Malroth dialogue
0x03D34A|$0F:$D33A:85 0D   	STA $0D    
0x03D34C|$0F:$D33C:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03D34F|$0F:$D33F:43	; $02:$8006; -> $02:$B292: looks like this determines NPC's post-Malroth text

; data -> code
0x03D350|$0F:$D340:4C FB D2	JMP $D2FB  	; load ROM bank 6

; external control flow target (from $06:$BC2A)
0x03D353|$0F:$D343:EA      	NOP        
0x03D354|$0F:$D344:EA      	NOP        
0x03D355|$0F:$D345:EA      	NOP        
0x03D356|$0F:$D346:A9 09   	LDA #$09   
0x03D358|$0F:$D348:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03D35A|$0F:$D34A:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
; call to code in a different bank ($09:$8000)
0x03D35D|$0F:$D34D:20 00 80	JSR $8000  
; control flow target (from $D353)
0x03D360|$0F:$D350:AD 56 01	LDA $0156  	; probably music playing flag? set to #$00 when music finishes
0x03D363|$0F:$D353:D0 FB   	BNE $D350  
0x03D365|$0F:$D355:78      	SEI        
0x03D366|$0F:$D356:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03D369|$0F:$D359:DF	; $06:$803E

; data -> code
0x03D36A|$0F:$D35A:60      	RTS        

; control flow target (from $E5E1, $E655, $E6D3, $E7B4)
0x03D36B|$0F:$D35B:A5 28   	LDA $28    	; current map X-pos (2)
0x03D36D|$0F:$D35D:85 0C   	STA $0C    
0x03D36F|$0F:$D35F:A5 29   	LDA $29    	; current map Y-pos (2)
0x03D371|$0F:$D361:85 0E   	STA $0E    
0x03D373|$0F:$D363:20 89 DF	JSR $DF89  
0x03D376|$0F:$D366:20 4A DF	JSR $DF4A  
0x03D379|$0F:$D369:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03D37C|$0F:$D36C:A0 04   	LDY #$04   
0x03D37E|$0F:$D36E:B1 10   	LDA ($10),Y
0x03D380|$0F:$D370:29 FC   	AND #$FC   
0x03D382|$0F:$D372:85 3B   	STA $3B    	; high nybble = terrain ID
0x03D384|$0F:$D374:AD AD 61	LDA $61AD  
0x03D387|$0F:$D377:F0 01   	BEQ $D37A  
0x03D389|$0F:$D379:60      	RTS        

; control flow target (from $D377)
0x03D38A|$0F:$D37A:AD BA FF	LDA $FFBA  
0x03D38D|$0F:$D37D:D0 09   	BNE $D388  
0x03D38F|$0F:$D37F:A5 2F   	LDA $2F    	; joypad 1 data
0x03D391|$0F:$D381:29 02   	AND #$02   
0x03D393|$0F:$D383:F0 03   	BEQ $D388  
0x03D395|$0F:$D385:4C 29 D4	JMP $D429  

; control flow target (from $D37D, $D383)
0x03D398|$0F:$D388:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03D39A|$0F:$D38A:29 04   	AND #$04   
0x03D39C|$0F:$D38C:F0 41   	BEQ $D3CF  
0x03D39E|$0F:$D38E:A5 3B   	LDA $3B    	; high nybble = terrain ID
0x03D3A0|$0F:$D390:29 F0   	AND #$F0   
0x03D3A2|$0F:$D392:C9 40   	CMP #$40   
0x03D3A4|$0F:$D394:D0 03   	BNE $D399  
0x03D3A6|$0F:$D396:4C 29 D4	JMP $D429  

; control flow target (from $D394)
0x03D3A9|$0F:$D399:C9 A0   	CMP #$A0   
0x03D3AB|$0F:$D39B:B0 77   	BCS $D414  
0x03D3AD|$0F:$D39D:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03D3AF|$0F:$D39F:29 FB   	AND #$FB   
0x03D3B1|$0F:$D3A1:85 CF   	STA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03D3B3|$0F:$D3A3:A5 16   	LDA $16    	; current map X-pos (1)
0x03D3B5|$0F:$D3A5:85 D2   	STA $D2    	; ship X-pos (when you aren't on it)
0x03D3B7|$0F:$D3A7:8D D4 05	STA $05D4  	; NPC #$13 X-pos
0x03D3BA|$0F:$D3AA:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D3BC|$0F:$D3AC:85 D3   	STA $D3    	; ship Y-pos (when you aren't on it)
0x03D3BE|$0F:$D3AE:8D D5 05	STA $05D5  	; NPC #$13 Y-pos
0x03D3C1|$0F:$D3B1:A9 05   	LDA #$05   
0x03D3C3|$0F:$D3B3:8D D9 05	STA $05D9  	; NPC #$13 sprite ID
0x03D3C6|$0F:$D3B6:AD 40 05	LDA $0540  	; NPC #$00 ? + direction nybble
0x03D3C9|$0F:$D3B9:29 03   	AND #$03   
0x03D3CB|$0F:$D3BB:8D D8 05	STA $05D8  	; NPC #$13 motion nybble + direction nybble
0x03D3CE|$0F:$D3BE:A9 01   	LDA #$01   
0x03D3D0|$0F:$D3C0:85 45   	STA $45    
0x03D3D2|$0F:$D3C2:20 F7 D2	JSR $D2F7  
0x03D3D5|$0F:$D3C5:20 2F E3	JSR $E32F  
0x03D3D8|$0F:$D3C8:A9 00   	LDA #$00   
0x03D3DA|$0F:$D3CA:85 38   	STA $38    
0x03D3DC|$0F:$D3CC:4C 29 D4	JMP $D429  

; control flow target (from $D38C)
0x03D3DF|$0F:$D3CF:A5 3B   	LDA $3B    	; high nybble = terrain ID
0x03D3E1|$0F:$D3D1:29 F0   	AND #$F0   
0x03D3E3|$0F:$D3D3:C9 40   	CMP #$40   
0x03D3E5|$0F:$D3D5:D0 21   	BNE $D3F8  
0x03D3E7|$0F:$D3D7:A5 31   	LDA $31    	; current map ID
0x03D3E9|$0F:$D3D9:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03D3EB|$0F:$D3DB:F0 04   	BEQ $D3E1  
0x03D3ED|$0F:$D3DD:C9 0B   	CMP #$0B   	; Map ID #$0B: Lianport
0x03D3EF|$0F:$D3DF:D0 33   	BNE $D414  
; control flow target (from $D3DB)
0x03D3F1|$0F:$D3E1:AD D4 05	LDA $05D4  	; NPC #$13 X-pos
0x03D3F4|$0F:$D3E4:C5 28   	CMP $28    	; current map X-pos (2)
0x03D3F6|$0F:$D3E6:D0 2C   	BNE $D414  
0x03D3F8|$0F:$D3E8:AD D5 05	LDA $05D5  	; NPC #$13 Y-pos
0x03D3FB|$0F:$D3EB:C5 29   	CMP $29    	; current map Y-pos (2)
0x03D3FD|$0F:$D3ED:D0 25   	BNE $D414  
0x03D3FF|$0F:$D3EF:AD D9 05	LDA $05D9  	; NPC #$13 sprite ID
0x03D402|$0F:$D3F2:C9 FF   	CMP #$FF   
0x03D404|$0F:$D3F4:F0 1E   	BEQ $D414  
0x03D406|$0F:$D3F6:D0 51   	BNE $D449  
; control flow target (from $D3D5)
0x03D408|$0F:$D3F8:A5 3B   	LDA $3B    	; high nybble = terrain ID
0x03D40A|$0F:$D3FA:29 F0   	AND #$F0   
0x03D40C|$0F:$D3FC:C9 A0   	CMP #$A0   
0x03D40E|$0F:$D3FE:D0 10   	BNE $D410  
0x03D410|$0F:$D400:A5 31   	LDA $31    	; current map ID
0x03D412|$0F:$D402:C9 2C   	CMP #$2C   	; Map ID #$2C: Lake Cave B1
0x03D414|$0F:$D404:F0 0E   	BEQ $D414  
0x03D416|$0F:$D406:C9 2D   	CMP #$2D   	; Map ID #$2D: Lake Cave B2
0x03D418|$0F:$D408:F0 0A   	BEQ $D414  
0x03D41A|$0F:$D40A:C9 40   	CMP #$40   
0x03D41C|$0F:$D40C:F0 06   	BEQ $D414  
0x03D41E|$0F:$D40E:D0 19   	BNE $D429  
; control flow target (from $D3FE)
0x03D420|$0F:$D410:C9 B0   	CMP #$B0   
0x03D422|$0F:$D412:90 15   	BCC $D429  
; control flow target (from $D39B, $D3DF, $D3E6, $D3ED, $D3F4, $D404, $D408, $D40C, $D43E)
0x03D424|$0F:$D414:A5 16   	LDA $16    	; current map X-pos (1)
0x03D426|$0F:$D416:85 28   	STA $28    	; current map X-pos (2)
0x03D428|$0F:$D418:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D42A|$0F:$D41A:85 29   	STA $29    	; current map Y-pos (2)
0x03D42C|$0F:$D41C:68      	PLA        
0x03D42D|$0F:$D41D:68      	PLA        
0x03D42E|$0F:$D41E:68      	PLA        
0x03D42F|$0F:$D41F:68      	PLA        
0x03D430|$0F:$D420:A9 00   	LDA #$00   
0x03D432|$0F:$D422:85 03   	STA $03    	; game clock?
0x03D434|$0F:$D424:85 3B   	STA $3B    	; high nybble = terrain ID
0x03D436|$0F:$D426:4C 47 C7	JMP $C747  

; control flow target (from $D385, $D396, $D3CC, $D40E, $D412)
0x03D439|$0F:$D429:A0 18   	LDY #$18   
; control flow target (from $D447)
0x03D43B|$0F:$D42B:B9 41 05	LDA $0541,Y	; NPC #$00 sprite ID
0x03D43E|$0F:$D42E:C9 FF   	CMP #$FF   
0x03D440|$0F:$D430:F0 0E   	BEQ $D440  
0x03D442|$0F:$D432:B9 3C 05	LDA $053C,Y	; NPC #$00 ?
0x03D445|$0F:$D435:C5 28   	CMP $28    	; current map X-pos (2)
0x03D447|$0F:$D437:D0 07   	BNE $D440  
0x03D449|$0F:$D439:B9 3D 05	LDA $053D,Y	; NPC #$00 ?
0x03D44C|$0F:$D43C:C5 29   	CMP $29    	; current map Y-pos (2)
0x03D44E|$0F:$D43E:F0 D4   	BEQ $D414  
; control flow target (from $D430, $D437)
0x03D450|$0F:$D440:98      	TYA        
0x03D451|$0F:$D441:18      	CLC        
0x03D452|$0F:$D442:69 08   	ADC #$08   
0x03D454|$0F:$D444:A8      	TAY        
0x03D455|$0F:$D445:C9 B8   	CMP #$B8   
0x03D457|$0F:$D447:D0 E2   	BNE $D42B  
; control flow target (from $D3F6)
0x03D459|$0F:$D449:A0 00   	LDY #$00   
0x03D45B|$0F:$D44B:20 50 D4	JSR $D450  
0x03D45E|$0F:$D44E:A0 08   	LDY #$08   
; control flow target (from $D44B)
0x03D460|$0F:$D450:B9 42 05	LDA $0542,Y	; NPC #$00 ?
0x03D463|$0F:$D453:19 43 05	ORA $0543,Y	; NPC #$00 ?
0x03D466|$0F:$D456:D0 01   	BNE $D459  
0x03D468|$0F:$D458:60      	RTS        

; control flow target (from $D456)
0x03D469|$0F:$D459:AD 3C 05	LDA $053C  	; NPC #$00 ?
0x03D46C|$0F:$D45C:20 63 D4	JSR $D463  
0x03D46F|$0F:$D45F:C8      	INY        
0x03D470|$0F:$D460:AD 3D 05	LDA $053D  	; NPC #$00 ?
; control flow target (from $D45C)
0x03D473|$0F:$D463:38      	SEC        
0x03D474|$0F:$D464:F9 44 05	SBC $0544,Y	; NPC #$01 ?
0x03D477|$0F:$D467:99 46 05	STA $0546,Y	; NPC #$01 ?
0x03D47A|$0F:$D46A:60      	RTS        

; control flow target (from $C87F)
0x03D47B|$0F:$D46B:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03D47D|$0F:$D46D:29 04   	AND #$04   
0x03D47F|$0F:$D46F:D0 40   	BNE $D4B1  
0x03D481|$0F:$D471:A5 31   	LDA $31    	; current map ID
0x03D483|$0F:$D473:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03D485|$0F:$D475:F0 04   	BEQ $D47B  
0x03D487|$0F:$D477:C9 0B   	CMP #$0B   	; Map ID #$0B: Lianport
0x03D489|$0F:$D479:D0 36   	BNE $D4B1  
; control flow target (from $D475)
0x03D48B|$0F:$D47B:AD D4 05	LDA $05D4  	; NPC #$13 X-pos
0x03D48E|$0F:$D47E:C5 16   	CMP $16    	; current map X-pos (1)
0x03D490|$0F:$D480:D0 2F   	BNE $D4B1  
0x03D492|$0F:$D482:AD D5 05	LDA $05D5  	; NPC #$13 Y-pos
0x03D495|$0F:$D485:C5 17   	CMP $17    	; current map Y-pos (1)
0x03D497|$0F:$D487:D0 28   	BNE $D4B1  
0x03D499|$0F:$D489:20 DA D6	JSR $D6DA  
0x03D49C|$0F:$D48C:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D49F|$0F:$D48F:A9 FF   	LDA #$FF   
0x03D4A1|$0F:$D491:8D D9 05	STA $05D9  	; NPC #$13 sprite ID
0x03D4A4|$0F:$D494:20 5C F7	JSR $F75C  	; load ROM bank #$00
0x03D4A7|$0F:$D497:A9 6B   	LDA #$6B   
; call to code in a different bank ($00:$8003)
0x03D4A9|$0F:$D499:20 03 80	JSR $8003  
0x03D4AC|$0F:$D49C:A9 06   	LDA #$06   
0x03D4AE|$0F:$D49E:05 CF   	ORA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03D4B0|$0F:$D4A0:85 CF   	STA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03D4B2|$0F:$D4A2:A9 FF   	LDA #$FF   
0x03D4B4|$0F:$D4A4:85 45   	STA $45    
0x03D4B6|$0F:$D4A6:20 F7 D2	JSR $D2F7  
0x03D4B9|$0F:$D4A9:20 2F E3	JSR $E32F  
0x03D4BC|$0F:$D4AC:A9 00   	LDA #$00   
0x03D4BE|$0F:$D4AE:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03D4C0|$0F:$D4B0:60      	RTS        

; control flow target (from $D46F, $D479, $D480, $D487)
0x03D4C1|$0F:$D4B1:A5 31   	LDA $31    	; current map ID
0x03D4C3|$0F:$D4B3:C9 0B   	CMP #$0B   	; Map ID #$0B: Lianport
0x03D4C5|$0F:$D4B5:D0 1B   	BNE $D4D2  
0x03D4C7|$0F:$D4B7:A5 16   	LDA $16    	; current map X-pos (1)
0x03D4C9|$0F:$D4B9:C9 19   	CMP #$19   
0x03D4CB|$0F:$D4BB:D0 15   	BNE $D4D2  
0x03D4CD|$0F:$D4BD:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D4CF|$0F:$D4BF:C9 01   	CMP #$01   
0x03D4D1|$0F:$D4C1:D0 0F   	BNE $D4D2  
0x03D4D3|$0F:$D4C3:AD B0 D6	LDA $D6B0  
0x03D4D6|$0F:$D4C6:85 0C   	STA $0C    
0x03D4D8|$0F:$D4C8:AD B1 D6	LDA $D6B1  
0x03D4DB|$0F:$D4CB:85 0D   	STA $0D    
0x03D4DD|$0F:$D4CD:A9 FF   	LDA #$FF   
0x03D4DF|$0F:$D4CF:4C 8F D8	JMP $D88F  	; warp to warp point given by ($0C)

; control flow target (from $D4B5, $D4BB, $D4C1)
0x03D4E2|$0F:$D4D2:A6 3C   	LDX $3C    
0x03D4E4|$0F:$D4D4:A5 3B   	LDA $3B    	; high nybble = terrain ID
0x03D4E6|$0F:$D4D6:29 F0   	AND #$F0   
0x03D4E8|$0F:$D4D8:85 3C   	STA $3C    
0x03D4EA|$0F:$D4DA:A4 31   	LDY $31    	; current map ID
0x03D4EC|$0F:$D4DC:F0 26   	BEQ $D504  	; Map ID #$00: Fake Midenhall
0x03D4EE|$0F:$D4DE:E0 10   	CPX #$10   
0x03D4F0|$0F:$D4E0:F0 0C   	BEQ $D4EE  
0x03D4F2|$0F:$D4E2:C9 10   	CMP #$10   
0x03D4F4|$0F:$D4E4:D0 08   	BNE $D4EE  
0x03D4F6|$0F:$D4E6:A9 82   	LDA #$82   	; Music ID #$82: Stairs SFX
0x03D4F8|$0F:$D4E8:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D4FB|$0F:$D4EB:4C EE D7	JMP $D7EE  

; control flow target (from $D4E0, $D4E4)
0x03D4FE|$0F:$D4EE:C9 20   	CMP #$20   
0x03D500|$0F:$D4F0:F0 0A   	BEQ $D4FC  
0x03D502|$0F:$D4F2:C9 30   	CMP #$30   
0x03D504|$0F:$D4F4:D0 0E   	BNE $D504  
0x03D506|$0F:$D4F6:20 A2 E5	JSR $E5A2  
0x03D509|$0F:$D4F9:4C A6 D7	JMP $D7A6  

; control flow target (from $D4F0)
0x03D50C|$0F:$D4FC:A9 82   	LDA #$82   	; Music ID #$82: Stairs SFX
0x03D50E|$0F:$D4FE:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D511|$0F:$D501:4C A6 D7	JMP $D7A6  

; control flow target (from $D4DC, $D4F4)
0x03D514|$0F:$D504:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03D516|$0F:$D506:C9 02   	CMP #$02   
0x03D518|$0F:$D508:B0 3A   	BCS $D544  
0x03D51A|$0F:$D50A:A5 21   	LDA $21    	; map width
0x03D51C|$0F:$D50C:C5 16   	CMP $16    	; current map X-pos (1)
0x03D51E|$0F:$D50E:90 07   	BCC $D517  
0x03D520|$0F:$D510:A5 22   	LDA $22    	; map height
0x03D522|$0F:$D512:C5 17   	CMP $17    	; current map Y-pos (1)
0x03D524|$0F:$D514:90 01   	BCC $D517  
0x03D526|$0F:$D516:60      	RTS        

; control flow target (from $D50E, $D514, $D55E)
0x03D527|$0F:$D517:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03D52A|$0F:$D51A:AD EC D7	LDA $D7EC  	; -> $03:$BD13: warp points (map ID, X-pos, Y-pos); other end is same index in $02:$A27E
0x03D52D|$0F:$D51D:85 0C   	STA $0C    
0x03D52F|$0F:$D51F:AD ED D7	LDA $D7ED  
0x03D532|$0F:$D522:85 0D   	STA $0D    
0x03D534|$0F:$D524:A0 00   	LDY #$00   
; control flow target (from $D535, $D539)
0x03D536|$0F:$D526:B1 0C   	LDA ($0C),Y
0x03D538|$0F:$D528:29 7F   	AND #$7F   
0x03D53A|$0F:$D52A:C5 31   	CMP $31    	; current map ID
0x03D53C|$0F:$D52C:F0 0E   	BEQ $D53C  
0x03D53E|$0F:$D52E:A5 0C   	LDA $0C    
0x03D540|$0F:$D530:18      	CLC        
0x03D541|$0F:$D531:69 03   	ADC #$03   
0x03D543|$0F:$D533:85 0C   	STA $0C    
0x03D545|$0F:$D535:90 EF   	BCC $D526  
0x03D547|$0F:$D537:E6 0D   	INC $0D    
0x03D549|$0F:$D539:D0 EB   	BNE $D526  
0x03D54B|$0F:$D53B:60      	RTS        

; control flow target (from $D52C)
0x03D54C|$0F:$D53C:A9 82   	LDA #$82   	; Music ID #$82: Stairs SFX
0x03D54E|$0F:$D53E:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D551|$0F:$D541:4C B6 D7	JMP $D7B6  

; control flow target (from $D508)
0x03D554|$0F:$D544:A5 16   	LDA $16    	; current map X-pos (1)
0x03D556|$0F:$D546:4A      	LSR        
0x03D557|$0F:$D547:18      	CLC        
0x03D558|$0F:$D548:E5 21   	SBC $21    	; map width
0x03D55A|$0F:$D54A:B0 0B   	BCS $D557  
0x03D55C|$0F:$D54C:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D55E|$0F:$D54E:4A      	LSR        
0x03D55F|$0F:$D54F:18      	CLC        
0x03D560|$0F:$D550:E5 22   	SBC $22    	; map height
0x03D562|$0F:$D552:B0 03   	BCS $D557  
0x03D564|$0F:$D554:4C E9 D5	JMP $D5E9  

; control flow target (from $D54A, $D552)
0x03D567|$0F:$D557:A5 31   	LDA $31    	; current map ID
0x03D569|$0F:$D559:A0 05   	LDY #$05   
; control flow target (from $D561)
0x03D56B|$0F:$D55B:D9 9B D6	CMP $D69B,Y
0x03D56E|$0F:$D55E:F0 B7   	BEQ $D517  
0x03D570|$0F:$D560:88      	DEY        
0x03D571|$0F:$D561:10 F8   	BPL $D55B  
0x03D573|$0F:$D563:AD 40 05	LDA $0540  	; NPC #$00 ? + direction nybble
0x03D576|$0F:$D566:29 03   	AND #$03   
0x03D578|$0F:$D568:AA      	TAX        
0x03D579|$0F:$D569:0A      	ASL        
0x03D57A|$0F:$D56A:A8      	TAY        
0x03D57B|$0F:$D56B:BD A9 D6	LDA $D6A9,X
0x03D57E|$0F:$D56E:85 0F   	STA $0F    
0x03D580|$0F:$D570:B9 A1 D6	LDA $D6A1,Y
0x03D583|$0F:$D573:85 12   	STA $12    
0x03D585|$0F:$D575:85 10   	STA $10    
0x03D587|$0F:$D577:B9 A2 D6	LDA $D6A2,Y
0x03D58A|$0F:$D57A:85 13   	STA $13    
0x03D58C|$0F:$D57C:85 11   	STA $11    
0x03D58E|$0F:$D57E:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03D591|$0F:$D581:A5 0F   	LDA $0F    
0x03D593|$0F:$D583:48      	PHA        
0x03D594|$0F:$D584:A5 10   	LDA $10    
0x03D596|$0F:$D586:48      	PHA        
0x03D597|$0F:$D587:A9 6E   	LDA #$6E   
; call to code in a different bank ($06:$A369)
0x03D599|$0F:$D589:20 69 A3	JSR $A369  	; check for item A in party inventory, returning inventory index of item in A/X if found, #$FF if not
0x03D59C|$0F:$D58C:AA      	TAX        
0x03D59D|$0F:$D58D:68      	PLA        
0x03D59E|$0F:$D58E:85 10   	STA $10    
0x03D5A0|$0F:$D590:68      	PLA        
0x03D5A1|$0F:$D591:85 0F   	STA $0F    
0x03D5A3|$0F:$D593:E0 FF   	CPX #$FF   
0x03D5A5|$0F:$D595:D0 06   	BNE $D59D  
; call to code in a different bank ($06:$8CD4)
0x03D5A7|$0F:$D597:20 D4 8C	JSR $8CD4  	; handler for Outside spell effect
0x03D5AA|$0F:$D59A:4C B6 D5	JMP $D5B6  

; control flow target (from $D595)
; call to code in a different bank ($06:$8CD4)
0x03D5AD|$0F:$D59D:20 D4 8C	JSR $8CD4  	; handler for Outside spell effect
0x03D5B0|$0F:$D5A0:46 0E   	LSR $0E    
0x03D5B2|$0F:$D5A2:F0 12   	BEQ $D5B6  
; control flow target (from $D5B4)
0x03D5B4|$0F:$D5A4:A5 10   	LDA $10    
0x03D5B6|$0F:$D5A6:18      	CLC        
0x03D5B7|$0F:$D5A7:65 12   	ADC $12    
0x03D5B9|$0F:$D5A9:85 12   	STA $12    
0x03D5BB|$0F:$D5AB:A5 11   	LDA $11    
0x03D5BD|$0F:$D5AD:18      	CLC        
0x03D5BE|$0F:$D5AE:65 13   	ADC $13    
0x03D5C0|$0F:$D5B0:85 13   	STA $13    
0x03D5C2|$0F:$D5B2:C6 0E   	DEC $0E    
0x03D5C4|$0F:$D5B4:D0 EE   	BNE $D5A4  
; control flow target (from $D59A, $D5A2)
0x03D5C6|$0F:$D5B6:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03D5C9|$0F:$D5B9:A0 00   	LDY #$00   
0x03D5CB|$0F:$D5BB:B1 0C   	LDA ($0C),Y
0x03D5CD|$0F:$D5BD:85 5A   	STA $5A    	; Crest/direction name write buffer start
0x03D5CF|$0F:$D5BF:C8      	INY        
0x03D5D0|$0F:$D5C0:B1 0C   	LDA ($0C),Y
0x03D5D2|$0F:$D5C2:18      	CLC        
0x03D5D3|$0F:$D5C3:65 12   	ADC $12    
0x03D5D5|$0F:$D5C5:85 5B   	STA $5B    
0x03D5D7|$0F:$D5C7:C8      	INY        
0x03D5D8|$0F:$D5C8:B1 0C   	LDA ($0C),Y
0x03D5DA|$0F:$D5CA:18      	CLC        
0x03D5DB|$0F:$D5CB:65 13   	ADC $13    
0x03D5DD|$0F:$D5CD:85 5C   	STA $5C    
; control flow target (from $D617)
0x03D5DF|$0F:$D5CF:A5 0F   	LDA $0F    
0x03D5E1|$0F:$D5D1:48      	PHA        
0x03D5E2|$0F:$D5D2:20 E1 D6	JSR $D6E1  
0x03D5E5|$0F:$D5D5:A2 28   	LDX #$28   
0x03D5E7|$0F:$D5D7:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03D5EA|$0F:$D5DA:AD 99 D6	LDA $D699  
0x03D5ED|$0F:$D5DD:85 0C   	STA $0C    
0x03D5EF|$0F:$D5DF:AD 9A D6	LDA $D69A  
0x03D5F2|$0F:$D5E2:85 0D   	STA $0D    
0x03D5F4|$0F:$D5E4:68      	PLA        
0x03D5F5|$0F:$D5E5:4C 8F D8	JMP $D88F  	; warp to warp point given by ($0C)

; control flow target (from $D5ED, $D5FA, $D5FE, $D61C, $D620, $D629)
0x03D5F8|$0F:$D5E8:60      	RTS        

; control flow target (from $D554)
0x03D5F9|$0F:$D5E9:A5 31   	LDA $31    	; current map ID
0x03D5FB|$0F:$D5EB:C9 65   	CMP #$65   	; Map ID #$65: Dragon Horn South 6F
0x03D5FD|$0F:$D5ED:B0 F9   	BCS $D5E8  
0x03D5FF|$0F:$D5EF:C9 61   	CMP #$61   	; Map ID #$61: Dragon Horn South 2F
0x03D601|$0F:$D5F1:90 27   	BCC $D61A  
0x03D603|$0F:$D5F3:20 78 D6	JSR $D678  
0x03D606|$0F:$D5F6:A5 0C   	LDA $0C    
0x03D608|$0F:$D5F8:C9 08   	CMP #$08   
0x03D60A|$0F:$D5FA:B0 EC   	BCS $D5E8  
0x03D60C|$0F:$D5FC:C9 04   	CMP #$04   
0x03D60E|$0F:$D5FE:90 E8   	BCC $D5E8  
0x03D610|$0F:$D600:A9 60   	LDA #$60   
0x03D612|$0F:$D602:85 5A   	STA $5A    	; Crest/direction name write buffer start
0x03D614|$0F:$D604:A5 16   	LDA $16    	; current map X-pos (1)
0x03D616|$0F:$D606:85 5B   	STA $5B    
0x03D618|$0F:$D608:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D61A|$0F:$D60A:85 5C   	STA $5C    
; control flow target (from $D675)
0x03D61C|$0F:$D60C:AD 40 05	LDA $0540  	; NPC #$00 ? + direction nybble
0x03D61F|$0F:$D60F:29 03   	AND #$03   
0x03D621|$0F:$D611:A8      	TAY        
0x03D622|$0F:$D612:B9 A9 D6	LDA $D6A9,Y
0x03D625|$0F:$D615:85 0F   	STA $0F    
0x03D627|$0F:$D617:4C CF D5	JMP $D5CF  

; control flow target (from $D5F1)
0x03D62A|$0F:$D61A:C9 40   	CMP #$40   	; Map ID #$40: Spring of Bravery
0x03D62C|$0F:$D61C:B0 CA   	BCS $D5E8  
0x03D62E|$0F:$D61E:C9 38   	CMP #$38   	; Map ID #$38: Cave to Rhone 1F
0x03D630|$0F:$D620:90 C6   	BCC $D5E8  
0x03D632|$0F:$D622:20 78 D6	JSR $D678  
0x03D635|$0F:$D625:A5 0C   	LDA $0C    
0x03D637|$0F:$D627:C9 05   	CMP #$05   
0x03D639|$0F:$D629:D0 BD   	BNE $D5E8  
0x03D63B|$0F:$D62B:A5 31   	LDA $31    	; current map ID
0x03D63D|$0F:$D62D:38      	SEC        
0x03D63E|$0F:$D62E:E9 38   	SBC #$38   	; Map ID #$38: Cave to Rhone 1F
0x03D640|$0F:$D630:AA      	TAX        
0x03D641|$0F:$D631:BD B2 D6	LDA $D6B2,X
0x03D644|$0F:$D634:85 5A   	STA $5A    	; Crest/direction name write buffer start
0x03D646|$0F:$D636:BD BA D6	LDA $D6BA,X
0x03D649|$0F:$D639:20 83 D6	JSR $D683  
0x03D64C|$0F:$D63C:7D CA D6	ADC $D6CA,X
0x03D64F|$0F:$D63F:85 5B   	STA $5B    
0x03D651|$0F:$D641:BD C2 D6	LDA $D6C2,X
0x03D654|$0F:$D644:20 83 D6	JSR $D683  
0x03D657|$0F:$D647:7D D2 D6	ADC $D6D2,X
0x03D65A|$0F:$D64A:85 5C   	STA $5C    
0x03D65C|$0F:$D64C:A5 14   	LDA $14    
0x03D65E|$0F:$D64E:85 0C   	STA $0C    
0x03D660|$0F:$D650:A5 15   	LDA $15    
0x03D662|$0F:$D652:85 0E   	STA $0E    
0x03D664|$0F:$D654:20 FC DD	JSR $DDFC  
0x03D667|$0F:$D657:A9 5F   	LDA #$5F   
0x03D669|$0F:$D659:85 09   	STA $09    
0x03D66B|$0F:$D65B:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D66E|$0F:$D65E: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
0x03D671|$0F:$D661: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
0x03D674|$0F:$D664:A5 07   	LDA $07    
0x03D676|$0F:$D666:18      	CLC        
0x03D677|$0F:$D667:69 1E   	ADC #$1E   
0x03D679|$0F:$D669:85 07   	STA $07    
0x03D67B|$0F:$D66B:90 02   	BCC $D66F  
0x03D67D|$0F:$D66D:E6 08   	INC $08    
; control flow target (from $D66B)
0x03D67F|$0F:$D66F: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
0x03D682|$0F:$D672: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
0x03D685|$0F:$D675:4C 0C D6	JMP $D60C  

; control flow target (from $D5F3, $D622)
0x03D688|$0F:$D678:A5 16   	LDA $16    	; current map X-pos (1)
0x03D68A|$0F:$D67A:85 0C   	STA $0C    
0x03D68C|$0F:$D67C:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D68E|$0F:$D67E:85 0E   	STA $0E    
0x03D690|$0F:$D680:4C 89 DF	JMP $DF89  

; control flow target (from $D639, $D644)
0x03D693|$0F:$D683:85 0E   	STA $0E    
0x03D695|$0F:$D685:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x03D698|$0F:$D688:A5 32   	LDA $32    	; RNG byte 0
0x03D69A|$0F:$D68A:85 0C   	STA $0C    
0x03D69C|$0F:$D68C:A9 00   	LDA #$00   
0x03D69E|$0F:$D68E:85 0D   	STA $0D    
0x03D6A0|$0F:$D690:85 0F   	STA $0F    
0x03D6A2|$0F:$D692:20 39 C3	JSR $C339  	; 16-bit multiplication: ($10-$11) = ($0C-$0D) * ($0E-$0F); consumes $0C-$0F
0x03D6A5|$0F:$D695:A5 11   	LDA $11    
0x03D6A7|$0F:$D697:0A      	ASL        
0x03D6A8|$0F:$D698:60      	RTS        


; code -> data
; data load target (from $D5DA)
; indirect data load target
0x03D6A9|$0F:$D699:5A
; data load target (from $D5DF)
; indirect data load target
0x03D6AA|$0F:$D69A:00
; indexed data load target (from $D55B)
; indirect data load target
0x03D6AB|$0F:$D69B:38	; Map ID #$38: Cave to Rhone 1F
; indirect data load target
0x03D6AC|$0F:$D69C:49	; Map ID #$49: Moon Tower 1F
; indirect data load target
0x03D6AD|$0F:$D69D:50	; Map ID #$50: Lighthouse 1F
; indirect data load target
0x03D6AE|$0F:$D69E:58	; Map ID #$58: Wind Tower 1F
; indirect data load target
0x03D6AF|$0F:$D69F:60	; Map ID #$60: Dragon Horn South 1F
; indirect data load target
0x03D6B0|$0F:$D6A0:66	; Map ID #$66: Dragon Horn North 1F
; indexed data load target (from $D570)
; indirect data load target
0x03D6B1|$0F:$D6A1:00
; indexed data load target (from $D577)
; indirect data load target
0x03D6B2|$0F:$D6A2:FF
; indirect data load target
0x03D6B3|$0F:$D6A3:01
; indirect data load target
0x03D6B4|$0F:$D6A4:00
; indirect data load target
0x03D6B5|$0F:$D6A5:00
; indirect data load target
0x03D6B6|$0F:$D6A6:01
; indirect data load target
0x03D6B7|$0F:$D6A7:FF
; indirect data load target
0x03D6B8|$0F:$D6A8:00
; indexed data load target (from $D56B, $D612)
; indirect data load target
0x03D6B9|$0F:$D6A9:09
; indirect data load target
0x03D6BA|$0F:$D6AA:04
; indirect data load target
0x03D6BB|$0F:$D6AB:0A
; indirect data load target
0x03D6BC|$0F:$D6AC:03
; indirect data load target
0x03D6BD|$0F:$D6AD:01
; indirect data load target
0x03D6BE|$0F:$D6AE:1E
; indirect data load target
0x03D6BF|$0F:$D6AF:38
; data load target (from $D4C3)
; indirect data load target
0x03D6C0|$0F:$D6B0:AD
; data load target (from $D4C8)
; indirect data load target
0x03D6C1|$0F:$D6B1:D6
; indexed data load target (from $D631)
; indirect data load target
0x03D6C2|$0F:$D6B2:37
; indirect data load target
0x03D6C3|$0F:$D6B3:38
; indirect data load target
0x03D6C4|$0F:$D6B4:38
; indirect data load target
0x03D6C5|$0F:$D6B5:38
; indirect data load target
0x03D6C6|$0F:$D6B6:3B
; indirect data load target
0x03D6C7|$0F:$D6B7:3C
; indirect data load target
0x03D6C8|$0F:$D6B8:3D
; indirect data load target
0x03D6C9|$0F:$D6B9:3E
; indexed data load target (from $D636)
; indirect data load target
0x03D6CA|$0F:$D6BA:08
; indirect data load target
0x03D6CB|$0F:$D6BB:02
; indirect data load target
0x03D6CC|$0F:$D6BC:02
; indirect data load target
0x03D6CD|$0F:$D6BD:02
; indirect data load target
0x03D6CE|$0F:$D6BE:02
; indirect data load target
0x03D6CF|$0F:$D6BF:02
; indirect data load target
0x03D6D0|$0F:$D6C0:08
; indirect data load target
0x03D6D1|$0F:$D6C1:08
; indexed data load target (from $D641)
; indirect data load target
0x03D6D2|$0F:$D6C2:07
; indirect data load target
0x03D6D3|$0F:$D6C3:02
; indirect data load target
0x03D6D4|$0F:$D6C4:02
; indirect data load target
0x03D6D5|$0F:$D6C5:02
; indirect data load target
0x03D6D6|$0F:$D6C6:04
; indirect data load target
0x03D6D7|$0F:$D6C7:03
; indirect data load target
0x03D6D8|$0F:$D6C8:08
; indirect data load target
0x03D6D9|$0F:$D6C9:03
; indexed data load target (from $D63C)
; indirect data load target
0x03D6DA|$0F:$D6CA:02
; indirect data load target
0x03D6DB|$0F:$D6CB:06
; indirect data load target
0x03D6DC|$0F:$D6CC:06
; indirect data load target
0x03D6DD|$0F:$D6CD:06
; indirect data load target
0x03D6DE|$0F:$D6CE:0E
; indirect data load target
0x03D6DF|$0F:$D6CF:0C
; indirect data load target
0x03D6E0|$0F:$D6D0:08
; indirect data load target
0x03D6E1|$0F:$D6D1:12
; indexed data load target (from $D647)
; indirect data load target
0x03D6E2|$0F:$D6D2:02
; indirect data load target
0x03D6E3|$0F:$D6D3:0E
; indirect data load target
0x03D6E4|$0F:$D6D4:0E
; indirect data load target
0x03D6E5|$0F:$D6D5:0E
; indirect data load target
0x03D6E6|$0F:$D6D6:0A
; indirect data load target
0x03D6E7|$0F:$D6D7:30
; indirect data load target
0x03D6E8|$0F:$D6D8:08
; indirect data load target
0x03D6E9|$0F:$D6D9:02

; data -> code
; control flow target (from $D489)
0x03D6EA|$0F:$D6DA:20 CC E3	JSR $E3CC  
0x03D6ED|$0F:$D6DD:A9 10   	LDA #$10   
0x03D6EF|$0F:$D6DF:D0 07   	BNE $D6E8  
; control flow target (from $D5D2)
0x03D6F1|$0F:$D6E1:A9 98   	LDA #$98   	; Music ID #$98: more Watergate? SFX
0x03D6F3|$0F:$D6E3:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03D6F6|$0F:$D6E6:A9 08   	LDA #$08   
; control flow target (from $D6DF)
0x03D6F8|$0F:$D6E8:85 97   	STA $97    	; subject hero ID $97
0x03D6FA|$0F:$D6EA:A9 FF   	LDA #$FF   
0x03D6FC|$0F:$D6EC:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03D6FE|$0F:$D6EE:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D701|$0F:$D6F1:A9 00   	LDA #$00   
0x03D703|$0F:$D6F3:8D 3A 05	STA $053A  
0x03D706|$0F:$D6F6:8D 3B 05	STA $053B  
0x03D709|$0F:$D6F9:20 CB D8	JSR $D8CB  
0x03D70C|$0F:$D6FC:AD 49 05	LDA $0549  	; NPC #$01 sprite ID
0x03D70F|$0F:$D6FF:48      	PHA        
0x03D710|$0F:$D700:AD 51 05	LDA $0551  	; NPC #$02 sprite ID
0x03D713|$0F:$D703:48      	PHA        
0x03D714|$0F:$D704:20 1D D7	JSR $D71D  
0x03D717|$0F:$D707:20 1D D7	JSR $D71D  
0x03D71A|$0F:$D70A:A9 80   	LDA #$80   
0x03D71C|$0F:$D70C:8D 3A 05	STA $053A  
0x03D71F|$0F:$D70F:A9 6F   	LDA #$6F   
0x03D721|$0F:$D711:8D 3B 05	STA $053B  
0x03D724|$0F:$D714:68      	PLA        
0x03D725|$0F:$D715:8D 51 05	STA $0551  	; NPC #$02 sprite ID
0x03D728|$0F:$D718:68      	PLA        
0x03D729|$0F:$D719:8D 49 05	STA $0549  	; NPC #$01 sprite ID
0x03D72C|$0F:$D71C:60      	RTS        

; control flow target (from $D704, $D707)
0x03D72D|$0F:$D71D:A5 97   	LDA $97    	; subject hero ID $97
0x03D72F|$0F:$D71F:85 49   	STA $49    	; object hero/target/item/string ID $49
; control flow target (from $D733)
0x03D731|$0F:$D721:A0 08   	LDY #$08   
0x03D733|$0F:$D723:20 69 D7	JSR $D769  
0x03D736|$0F:$D726:A0 10   	LDY #$10   
0x03D738|$0F:$D728:20 69 D7	JSR $D769  
0x03D73B|$0F:$D72B:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D73E|$0F:$D72E:20 CB D8	JSR $D8CB  
0x03D741|$0F:$D731:C6 49   	DEC $49    	; object hero/target/item/string ID $49
0x03D743|$0F:$D733:D0 EC   	BNE $D721  
0x03D745|$0F:$D735:A0 10   	LDY #$10   
0x03D747|$0F:$D737:20 77 D7	JSR $D777  
0x03D74A|$0F:$D73A:A0 08   	LDY #$08   
0x03D74C|$0F:$D73C:20 77 D7	JSR $D777  
0x03D74F|$0F:$D73F:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03D752|$0F:$D742:4C CB D8	JMP $D8CB  

; control flow target (from $D770, $D773)
0x03D755|$0F:$D745:B9 3A 05	LDA $053A,Y
0x03D758|$0F:$D748:38      	SEC        
0x03D759|$0F:$D749:F9 3C 05	SBC $053C,Y	; NPC #$00 ?
0x03D75C|$0F:$D74C:99 3A 05	STA $053A,Y
0x03D75F|$0F:$D74F:A5 97   	LDA $97    	; subject hero ID $97
0x03D761|$0F:$D751:C9 10   	CMP #$10   
0x03D763|$0F:$D753:F0 0A   	BEQ $D75F  
0x03D765|$0F:$D755:B9 3A 05	LDA $053A,Y
0x03D768|$0F:$D758:38      	SEC        
0x03D769|$0F:$D759:F9 3C 05	SBC $053C,Y	; NPC #$00 ?
0x03D76C|$0F:$D75C:99 3A 05	STA $053A,Y
; control flow target (from $D753)
0x03D76F|$0F:$D75F:C8      	INY        
0x03D770|$0F:$D760:60      	RTS        

; control flow target (from $D7A0, $D7A3)
0x03D771|$0F:$D761:B9 34 05	LDA $0534,Y
0x03D774|$0F:$D764:99 3C 05	STA $053C,Y	; NPC #$00 ?
0x03D777|$0F:$D767:C8      	INY        
0x03D778|$0F:$D768:60      	RTS        

; control flow target (from $D723, $D728)
0x03D779|$0F:$D769:B9 41 05	LDA $0541,Y	; NPC #$00 sprite ID
0x03D77C|$0F:$D76C:C9 FF   	CMP #$FF   
0x03D77E|$0F:$D76E:F0 06   	BEQ $D776  
0x03D780|$0F:$D770:20 45 D7	JSR $D745  
0x03D783|$0F:$D773:20 45 D7	JSR $D745  
; control flow target (from $D76E, $D77C)
0x03D786|$0F:$D776:60      	RTS        

; control flow target (from $D737, $D73C)
0x03D787|$0F:$D777:B9 41 05	LDA $0541,Y	; NPC #$00 sprite ID
0x03D78A|$0F:$D77A:C9 FF   	CMP #$FF   
0x03D78C|$0F:$D77C:F0 F8   	BEQ $D776  
0x03D78E|$0F:$D77E:B9 3A 05	LDA $053A,Y
0x03D791|$0F:$D781:C9 80   	CMP #$80   
0x03D793|$0F:$D783:D0 15   	BNE $D79A  
0x03D795|$0F:$D785:B9 3B 05	LDA $053B,Y
0x03D798|$0F:$D788:C9 6F   	CMP #$6F   
0x03D79A|$0F:$D78A:D0 0E   	BNE $D79A  
0x03D79C|$0F:$D78C:A9 FF   	LDA #$FF   
0x03D79E|$0F:$D78E:99 41 05	STA $0541,Y	; NPC #$00 sprite ID
0x03D7A1|$0F:$D791:A9 00   	LDA #$00   
0x03D7A3|$0F:$D793:99 3A 05	STA $053A,Y
0x03D7A6|$0F:$D796:99 3B 05	STA $053B,Y
0x03D7A9|$0F:$D799:60      	RTS        

; control flow target (from $D783, $D78A)
0x03D7AA|$0F:$D79A:B9 38 05	LDA $0538,Y
0x03D7AD|$0F:$D79D:99 40 05	STA $0540,Y	; NPC #$00 ? + direction nybble
0x03D7B0|$0F:$D7A0:20 61 D7	JSR $D761  
0x03D7B3|$0F:$D7A3:4C 61 D7	JMP $D761  

; control flow target (from $D4F9, $D501)
; external control flow target (from $06:$96C6)
0x03D7B6|$0F:$D7A6:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03D7B9|$0F:$D7A9:AD EC D7	LDA $D7EC  	; -> $03:$BD13: warp points (map ID, X-pos, Y-pos); other end is same index in $02:$A27E
0x03D7BC|$0F:$D7AC:85 0C   	STA $0C    
0x03D7BE|$0F:$D7AE:AD ED D7	LDA $D7ED  
0x03D7C1|$0F:$D7B1:85 0D   	STA $0D    
0x03D7C3|$0F:$D7B3:20 69 D8	JSR $D869  	; scan through warp point list (not sure what stops this from scanning through entire ROM...), updating $0C-$0D to address of the relevant warp point
; control flow target (from $D541)
0x03D7C6|$0F:$D7B6:A5 0C   	LDA $0C    
0x03D7C8|$0F:$D7B8:38      	SEC        
0x03D7C9|$0F:$D7B9:ED EC D7	SBC $D7EC  	; -> $03:$BD13: warp points (map ID, X-pos, Y-pos); other end is same index in $02:$A27E
0x03D7CC|$0F:$D7BC:85 0C   	STA $0C    
0x03D7CE|$0F:$D7BE:A5 0D   	LDA $0D    
0x03D7D0|$0F:$D7C0:ED ED D7	SBC $D7ED  
0x03D7D3|$0F:$D7C3:85 0D   	STA $0D    
0x03D7D5|$0F:$D7C5:A5 0C   	LDA $0C    
0x03D7D7|$0F:$D7C7:18      	CLC        
0x03D7D8|$0F:$D7C8:6D EA D7	ADC $D7EA  	; -> $02:$A27E: warp points (map ID, X-pos, Y-pos); other end is same index in $03:$BD13
0x03D7DB|$0F:$D7CB:85 0C   	STA $0C    
0x03D7DD|$0F:$D7CD:A5 0D   	LDA $0D    
0x03D7DF|$0F:$D7CF:6D EB D7	ADC $D7EB  
0x03D7E2|$0F:$D7D2:85 0D   	STA $0D    
0x03D7E4|$0F:$D7D4:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03D7E7|$0F:$D7D7:A0 00   	LDY #$00   
0x03D7E9|$0F:$D7D9:B1 0C   	LDA ($0C),Y
0x03D7EB|$0F:$D7DB:10 03   	BPL $D7E0  
0x03D7ED|$0F:$D7DD:98      	TYA        
0x03D7EE|$0F:$D7DE:F0 57   	BEQ $D837  
; control flow target (from $D7DB)
0x03D7F0|$0F:$D7E0:B1 0C   	LDA ($0C),Y
0x03D7F2|$0F:$D7E2:29 7F   	AND #$7F   
0x03D7F4|$0F:$D7E4:C9 2B   	CMP #$2B   
0x03D7F6|$0F:$D7E6:B0 49   	BCS $D831  
0x03D7F8|$0F:$D7E8:90 4B   	BCC $D835  

; code -> data
; -> $02:$A27E: warp points (map ID, X-pos, Y-pos); other end is same index in $03:$BD13
; data load target (from $D7C8, $D7F1, $D801)
0x03D7FA|$0F:$D7EA:7E
; data load target (from $D7CF, $D7F6, $D808)
0x03D7FB|$0F:$D7EB:   A2	; $02:$A27E; warp points (map ID, X-pos, Y-pos); other end is same index in $03:$BD13
; -> $03:$BD13: warp points (map ID, X-pos, Y-pos); other end is same index in $02:$A27E
; data load target (from $D51A, $D7A9, $D7B9, $D810)
0x03D7FC|$0F:$D7EC:13
; data load target (from $D51F, $D7AE, $D7C0, $D817)
0x03D7FD|$0F:$D7ED:   BD	; $03:$BD13; warp points (map ID, X-pos, Y-pos); other end is same index in $02:$A27E

; data -> code
; control flow target (from $D4EB)
0x03D7FE|$0F:$D7EE:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03D801|$0F:$D7F1:AD EA D7	LDA $D7EA  	; -> $02:$A27E: warp points (map ID, X-pos, Y-pos); other end is same index in $03:$BD13; set $0C-$0D to the bank 2 end of the warp point data
0x03D804|$0F:$D7F4:85 0C   	STA $0C    
0x03D806|$0F:$D7F6:AD EB D7	LDA $D7EB  
0x03D809|$0F:$D7F9:85 0D   	STA $0D    
0x03D80B|$0F:$D7FB:20 69 D8	JSR $D869  	; scan through warp point list (not sure what stops this from scanning through entire ROM...), updating $0C-$0D to address of the relevant warp point
0x03D80E|$0F:$D7FE:A5 0C   	LDA $0C    	; now that we have the warp point address in $0C-$0D, subtract the original pointer to get the relative offset
0x03D810|$0F:$D800:38      	SEC        
0x03D811|$0F:$D801:ED EA D7	SBC $D7EA  	; -> $02:$A27E: warp points (map ID, X-pos, Y-pos); other end is same index in $03:$BD13
0x03D814|$0F:$D804:85 0C   	STA $0C    
0x03D816|$0F:$D806:A5 0D   	LDA $0D    
0x03D818|$0F:$D808:ED EB D7	SBC $D7EB  
0x03D81B|$0F:$D80B:85 0D   	STA $0D    
0x03D81D|$0F:$D80D:A5 0C   	LDA $0C    	; and then add the bank 3 pointer to get the corresponding bank 3 end of the warp point data
0x03D81F|$0F:$D80F:18      	CLC        
0x03D820|$0F:$D810:6D EC D7	ADC $D7EC  	; -> $03:$BD13: warp points (map ID, X-pos, Y-pos); other end is same index in $02:$A27E
0x03D823|$0F:$D813:85 0C   	STA $0C    
0x03D825|$0F:$D815:A5 0D   	LDA $0D    
0x03D827|$0F:$D817:6D ED D7	ADC $D7ED  
0x03D82A|$0F:$D81A:85 0D   	STA $0D    
; external control flow target (from $06:$9956)
0x03D82C|$0F:$D81C:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03D82F|$0F:$D81F:A0 00   	LDY #$00   
0x03D831|$0F:$D821:B1 0C   	LDA ($0C),Y	; map ID
0x03D833|$0F:$D823:10 04   	BPL $D829  
0x03D835|$0F:$D825:A9 02   	LDA #$02   
0x03D837|$0F:$D827:D0 0E   	BNE $D837  
; control flow target (from $D823)
0x03D839|$0F:$D829:B1 0C   	LDA ($0C),Y	; useless op; A hasn't changed since the last LDA
0x03D83B|$0F:$D82B:29 7F   	AND #$7F   	; useless op; we got here from BPL
0x03D83D|$0F:$D82D:C9 2B   	CMP #$2B   
0x03D83F|$0F:$D82F:B0 04   	BCS $D835  
; control flow target (from $D7E6)
0x03D841|$0F:$D831:A9 04   	LDA #$04   
0x03D843|$0F:$D833:D0 02   	BNE $D837  
; control flow target (from $D7E8, $D82F)
0x03D845|$0F:$D835:A9 03   	LDA #$03   
; control flow target (from $D7DE, $D827, $D833, $D894)
0x03D847|$0F:$D837:85 45   	STA $45    
0x03D849|$0F:$D839:A0 00   	LDY #$00   
0x03D84B|$0F:$D83B:B1 0C   	LDA ($0C),Y	; warp destination map ID
0x03D84D|$0F:$D83D:29 7F   	AND #$7F   
0x03D84F|$0F:$D83F:85 31   	STA $31    	; current map ID
0x03D851|$0F:$D841:C8      	INY        
0x03D852|$0F:$D842:B1 0C   	LDA ($0C),Y	; warp destination X-pos
0x03D854|$0F:$D844:85 16   	STA $16    	; current map X-pos (1)
0x03D856|$0F:$D846:85 28   	STA $28    	; current map X-pos (2)
0x03D858|$0F:$D848:85 2A   	STA $2A    	; current map X-pos pixel, low byte
0x03D85A|$0F:$D84A:C8      	INY        
0x03D85B|$0F:$D84B:B1 0C   	LDA ($0C),Y	; warp destination Y-pos
0x03D85D|$0F:$D84D:85 17   	STA $17    	; current map Y-pos (1)
0x03D85F|$0F:$D84F:85 29   	STA $29    	; current map Y-pos (2)
0x03D861|$0F:$D851:85 2C   	STA $2C    	; current map Y-pos pixel, low byte
0x03D863|$0F:$D853:A9 00   	LDA #$00   
0x03D865|$0F:$D855:85 2B   	STA $2B    	; current map X-pos pixel, high byte
0x03D867|$0F:$D857:85 2D   	STA $2D    	; current map Y-pos pixel, high byte
0x03D869|$0F:$D859:A2 04   	LDX #$04   	; convert 16x16 map positions to pixels
; control flow target (from $D864)
0x03D86B|$0F:$D85B:06 2A   	ASL $2A    	; current map X-pos pixel, low byte
0x03D86D|$0F:$D85D:26 2B   	ROL $2B    	; current map X-pos pixel, high byte
0x03D86F|$0F:$D85F:06 2C   	ASL $2C    	; current map Y-pos pixel, low byte
0x03D871|$0F:$D861:26 2D   	ROL $2D    	; current map Y-pos pixel, high byte
0x03D873|$0F:$D863:CA      	DEX        
0x03D874|$0F:$D864:D0 F5   	BNE $D85B  
0x03D876|$0F:$D866:4C 87 E2	JMP $E287  

; scan through warp point list (not sure what stops this from scanning through entire ROM...), updating $0C-$0D to address of the relevant warp point
; control flow target (from $D7B3, $D7FB, $D889, $D88D)
0x03D879|$0F:$D869:A0 00   	LDY #$00   
0x03D87B|$0F:$D86B:B1 0C   	LDA ($0C),Y	; Map ID
0x03D87D|$0F:$D86D:29 7F   	AND #$7F   
0x03D87F|$0F:$D86F:C5 31   	CMP $31    	; current map ID
0x03D881|$0F:$D871:D0 0F   	BNE $D882  	; if different map/pos, update $0C-$0D to next index
0x03D883|$0F:$D873:C8      	INY        
0x03D884|$0F:$D874:A5 16   	LDA $16    	; current map X-pos (1)
0x03D886|$0F:$D876:D1 0C   	CMP ($0C),Y
0x03D888|$0F:$D878:D0 08   	BNE $D882  	; if different map/pos, update $0C-$0D to next index
0x03D88A|$0F:$D87A:C8      	INY        
0x03D88B|$0F:$D87B:A5 17   	LDA $17    	; current map Y-pos (1)
0x03D88D|$0F:$D87D:D1 0C   	CMP ($0C),Y
0x03D88F|$0F:$D87F:D0 01   	BNE $D882  	; if different map/pos, update $0C-$0D to next index
0x03D891|$0F:$D881:60      	RTS        

; if different map/pos, update $0C-$0D to next index
; control flow target (from $D871, $D878, $D87F)
0x03D892|$0F:$D882:A5 0C   	LDA $0C    
0x03D894|$0F:$D884:18      	CLC        
0x03D895|$0F:$D885:69 03   	ADC #$03   	; warp data is 3 bytes each
0x03D897|$0F:$D887:85 0C   	STA $0C    
0x03D899|$0F:$D889:90 DE   	BCC $D869  	; scan through warp point list (not sure what stops this from scanning through entire ROM...), updating $0C-$0D to address of the relevant warp point
0x03D89B|$0F:$D88B:E6 0D   	INC $0D    
0x03D89D|$0F:$D88D:D0 DA   	BNE $D869  	; scan through warp point list (not sure what stops this from scanning through entire ROM...), updating $0C-$0D to address of the relevant warp point
; warp to warp point given by ($0C)
; control flow target (from $D4CF, $D5E5)
; external control flow target (from $06:$8C39, $06:$8C5F, $06:$BD69)
0x03D89F|$0F:$D88F:48      	PHA        
0x03D8A0|$0F:$D890:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03D8A3|$0F:$D893:68      	PLA        
0x03D8A4|$0F:$D894:4C 37 D8	JMP $D837  

; control flow target (from $E600, $E630, $E694, $E6AE, $E6DD, $E704, $E72E, $E75B, $E791, $E7DB, $E802, $E82C, $E859, $E877)
0x03D8A7|$0F:$D897:A0 08   	LDY #$08   
0x03D8A9|$0F:$D899:20 D1 DB	JSR $DBD1  
0x03D8AC|$0F:$D89C:A0 10   	LDY #$10   
0x03D8AE|$0F:$D89E:20 D1 DB	JSR $DBD1  
0x03D8B1|$0F:$D8A1:A5 03   	LDA $03    	; game clock?
0x03D8B3|$0F:$D8A3:29 0F   	AND #$0F   
0x03D8B5|$0F:$D8A5:D0 24   	BNE $D8CB  
0x03D8B7|$0F:$D8A7:A0 00   	LDY #$00   
0x03D8B9|$0F:$D8A9:B9 49 05	LDA $0549,Y	; NPC #$01 sprite ID
0x03D8BC|$0F:$D8AC:C9 FF   	CMP #$FF   
0x03D8BE|$0F:$D8AE:F0 03   	BEQ $D8B3  
0x03D8C0|$0F:$D8B0:20 E0 DB	JSR $DBE0  
; control flow target (from $D8AE)
0x03D8C3|$0F:$D8B3:A0 08   	LDY #$08   
0x03D8C5|$0F:$D8B5:B9 49 05	LDA $0549,Y	; NPC #$01 sprite ID
0x03D8C8|$0F:$D8B8:C9 FF   	CMP #$FF   
0x03D8CA|$0F:$D8BA:F0 03   	BEQ $D8BF  
0x03D8CC|$0F:$D8BC:20 E0 DB	JSR $DBE0  
; control flow target (from $D8BA)
0x03D8CF|$0F:$D8BF:AD 48 05	LDA $0548  	; NPC #$01 ? + direction nybble
0x03D8D2|$0F:$D8C2:8D 50 05	STA $0550  	; NPC #$02 ? + direction nybble
0x03D8D5|$0F:$D8C5:AD 40 05	LDA $0540  	; NPC #$00 ? + direction nybble
0x03D8D8|$0F:$D8C8:8D 48 05	STA $0548  	; NPC #$01 ? + direction nybble
; control flow target (from $C758, $C827, $C847, $CCDC, $CD6F, $CD7E, $CF5E, $CF64, $D314, $D32E, $D6F9, $D72E, $D742, $D8A5, $E2F2, $E979, $F470, $F865, $FF8A)
0x03D8DB|$0F:$D8CB:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x03D8DD|$0F:$D8CD:F0 01   	BEQ $D8D0  
0x03D8DF|$0F:$D8CF:60      	RTS        

; control flow target (from $D8CD)
0x03D8E0|$0F:$D8D0:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03D8E3|$0F:$D8D3:A5 03   	LDA $03    	; game clock?
0x03D8E5|$0F:$D8D5:29 0F   	AND #$0F   
0x03D8E7|$0F:$D8D7:D0 07   	BNE $D8E0  
0x03D8E9|$0F:$D8D9:A5 36   	LDA $36    
0x03D8EB|$0F:$D8DB:18      	CLC        
0x03D8EC|$0F:$D8DC:69 08   	ADC #$08   
0x03D8EE|$0F:$D8DE:85 36   	STA $36    
; control flow target (from $D8D7)
0x03D8F0|$0F:$D8E0:20 68 C4	JSR $C468  	; set every 4th byte of $0200 - $02FC to #$F0
0x03D8F3|$0F:$D8E3:A2 00   	LDX #$00   
0x03D8F5|$0F:$D8E5:A0 00   	LDY #$00   
0x03D8F7|$0F:$D8E7:84 37   	STY $37    
0x03D8F9|$0F:$D8E9:20 9A DC	JSR $DC9A  
0x03D8FC|$0F:$D8EC:A0 08   	LDY #$08   
0x03D8FE|$0F:$D8EE:A2 50   	LDX #$50   
0x03D900|$0F:$D8F0:20 9A DC	JSR $DC9A  
0x03D903|$0F:$D8F3:A0 10   	LDY #$10   
0x03D905|$0F:$D8F5:A2 B0   	LDX #$B0   
0x03D907|$0F:$D8F7:20 9A DC	JSR $DC9A  
0x03D90A|$0F:$D8FA:A5 38   	LDA $38    
0x03D90C|$0F:$D8FC:C9 FF   	CMP #$FF   
0x03D90E|$0F:$D8FE:D0 03   	BNE $D903  
0x03D910|$0F:$D900:4C B6 DB	JMP $DBB6  

; control flow target (from $D8FE)
0x03D913|$0F:$D903:A5 35   	LDA $35    	; flag indicating whether any menu is currently open
0x03D915|$0F:$D905:F0 03   	BEQ $D90A  
0x03D917|$0F:$D907:4C 35 DB	JMP $DB35  

; control flow target (from $D905)
0x03D91A|$0F:$D90A:A5 38   	LDA $38    
0x03D91C|$0F:$D90C:10 02   	BPL $D910  
0x03D91E|$0F:$D90E:29 7F   	AND #$7F   
; control flow target (from $D90C)
0x03D920|$0F:$D910:0A      	ASL        
0x03D921|$0F:$D911:0A      	ASL        
0x03D922|$0F:$D912:0A      	ASL        
0x03D923|$0F:$D913:69 18   	ADC #$18   
0x03D925|$0F:$D915:AA      	TAX        
0x03D926|$0F:$D916:A9 02   	LDA #$02   
0x03D928|$0F:$D918:85 34   	STA $34    
; control flow target (from $DB32)
0x03D92A|$0F:$D91A:BD 41 05	LDA $0541,X	; NPC #$00 sprite ID
0x03D92D|$0F:$D91D:C9 FF   	CMP #$FF   
0x03D92F|$0F:$D91F:D0 03   	BNE $D924  
0x03D931|$0F:$D921:4C 29 DB	JMP $DB29  

; control flow target (from $D91F)
0x03D934|$0F:$D924:A5 03   	LDA $03    	; game clock?
0x03D936|$0F:$D926:29 0F   	AND #$0F   
0x03D938|$0F:$D928:C9 01   	CMP #$01   
0x03D93A|$0F:$D92A:F0 03   	BEQ $D92F  
0x03D93C|$0F:$D92C:4C C4 DA	JMP $DAC4  

; control flow target (from $D92A)
0x03D93F|$0F:$D92F:A5 35   	LDA $35    	; flag indicating whether any menu is currently open
0x03D941|$0F:$D931:F0 1C   	BEQ $D94F  
; control flow target (from $D95C, $D9F9)
0x03D943|$0F:$D933:A5 38   	LDA $38    
0x03D945|$0F:$D935:10 0D   	BPL $D944  
0x03D947|$0F:$D937:DE 3A 05	DEC $053A,X
0x03D94A|$0F:$D93A:BD 3A 05	LDA $053A,X
0x03D94D|$0F:$D93D:C9 FF   	CMP #$FF   
0x03D94F|$0F:$D93F:D0 03   	BNE $D944  
0x03D951|$0F:$D941:DE 3B 05	DEC $053B,X
; control flow target (from $D935, $D93F, $D997)
0x03D954|$0F:$D944:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03D957|$0F:$D947:29 F3   	AND #$F3   
0x03D959|$0F:$D949:9D 40 05	STA $0540,X	; NPC #$00 ? + direction nybble
0x03D95C|$0F:$D94C:4C 29 DB	JMP $DB29  

; control flow target (from $D931)
0x03D95F|$0F:$D94F:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03D962|$0F:$D952:29 F0   	AND #$F0   
0x03D964|$0F:$D954:C9 10   	CMP #$10   
0x03D966|$0F:$D956:F0 44   	BEQ $D99C  
0x03D968|$0F:$D958:C9 20   	CMP #$20   
0x03D96A|$0F:$D95A:F0 03   	BEQ $D95F  
0x03D96C|$0F:$D95C:4C 33 D9	JMP $D933  

; control flow target (from $D95A)
0x03D96F|$0F:$D95F:BD 3A 05	LDA $053A,X
0x03D972|$0F:$D962:85 0C   	STA $0C    
0x03D974|$0F:$D964:BD 3B 05	LDA $053B,X
0x03D977|$0F:$D967:85 0D   	STA $0D    
0x03D979|$0F:$D969:20 7A F7	JSR $F77A  	; load ROM bank #$07
0x03D97C|$0F:$D96C:A0 00   	LDY #$00   
0x03D97E|$0F:$D96E:B1 0C   	LDA ($0C),Y
0x03D980|$0F:$D970:10 11   	BPL $D983  
0x03D982|$0F:$D972:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03D985|$0F:$D975:29 03   	AND #$03   
0x03D987|$0F:$D977:9D 40 05	STA $0540,X	; NPC #$00 ? + direction nybble
0x03D98A|$0F:$D97A:A5 38   	LDA $38    
0x03D98C|$0F:$D97C:29 7F   	AND #$7F   
0x03D98E|$0F:$D97E:85 38   	STA $38    
0x03D990|$0F:$D980:4C 29 DB	JMP $DB29  

; control flow target (from $D970)
0x03D993|$0F:$D983:FE 3A 05	INC $053A,X
0x03D996|$0F:$D986:D0 03   	BNE $D98B  
0x03D998|$0F:$D988:FE 3B 05	INC $053B,X
; control flow target (from $D986)
0x03D99B|$0F:$D98B:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03D99E|$0F:$D98E:29 F0   	AND #$F0   
0x03D9A0|$0F:$D990:11 0C   	ORA ($0C),Y
0x03D9A2|$0F:$D992:9D 40 05	STA $0540,X	; NPC #$00 ? + direction nybble
0x03D9A5|$0F:$D995:29 08   	AND #$08   
0x03D9A7|$0F:$D997:D0 AB   	BNE $D944  
0x03D9A9|$0F:$D999:4C BC DA	JMP $DABC  

; control flow target (from $D956)
0x03D9AC|$0F:$D99C:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x03D9AF|$0F:$D99F:A5 32   	LDA $32    	; RNG byte 0
0x03D9B1|$0F:$D9A1:29 03   	AND #$03   
0x03D9B3|$0F:$D9A3:85 0C   	STA $0C    
0x03D9B5|$0F:$D9A5:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03D9B8|$0F:$D9A8:29 F0   	AND #$F0   
0x03D9BA|$0F:$D9AA:05 0C   	ORA $0C    
0x03D9BC|$0F:$D9AC:9D 40 05	STA $0540,X	; NPC #$00 ? + direction nybble
0x03D9BF|$0F:$D9AF:20 F8 DB	JSR $DBF8  
0x03D9C2|$0F:$D9B2:20 03 DC	JSR $DC03  
0x03D9C5|$0F:$D9B5:A5 11   	LDA $11    
0x03D9C7|$0F:$D9B7:F0 04   	BEQ $D9BD  
0x03D9C9|$0F:$D9B9:A5 10   	LDA $10    
0x03D9CB|$0F:$D9BB:D0 3C   	BNE $D9F9  
; control flow target (from $D9B7)
0x03D9CD|$0F:$D9BD:20 18 E2	JSR $E218  
0x03D9D0|$0F:$D9C0:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03D9D3|$0F:$D9C3:29 03   	AND #$03   
0x03D9D5|$0F:$D9C5:D0 05   	BNE $D9CC  
0x03D9D7|$0F:$D9C7:C6 13   	DEC $13    
0x03D9D9|$0F:$D9C9:4C E0 D9	JMP $D9E0  

; control flow target (from $D9C5)
0x03D9DC|$0F:$D9CC:C9 01   	CMP #$01   
0x03D9DE|$0F:$D9CE:D0 05   	BNE $D9D5  
0x03D9E0|$0F:$D9D0:E6 12   	INC $12    
0x03D9E2|$0F:$D9D2:4C E0 D9	JMP $D9E0  

; control flow target (from $D9CE)
0x03D9E5|$0F:$D9D5:C9 02   	CMP #$02   
0x03D9E7|$0F:$D9D7:D0 05   	BNE $D9DE  
0x03D9E9|$0F:$D9D9:E6 13   	INC $13    
0x03D9EB|$0F:$D9DB:4C E0 D9	JMP $D9E0  

; control flow target (from $D9D7)
0x03D9EE|$0F:$D9DE:C6 12   	DEC $12    
; control flow target (from $D9C9, $D9D2, $D9DB)
0x03D9F0|$0F:$D9E0:A5 38   	LDA $38    
0x03D9F2|$0F:$D9E2:30 32   	BMI $DA16  
0x03D9F4|$0F:$D9E4:A0 0C   	LDY #$0C   
; control flow target (from $D9EE)
0x03D9F6|$0F:$D9E6:A5 31   	LDA $31    	; current map ID
0x03D9F8|$0F:$D9E8:D9 FC D9	CMP $D9FC,Y
0x03D9FB|$0F:$D9EB:F0 05   	BEQ $D9F2  
; control flow target (from $D9F7)
0x03D9FD|$0F:$D9ED:88      	DEY        
0x03D9FE|$0F:$D9EE:10 F6   	BPL $D9E6  
0x03DA00|$0F:$D9F0:30 24   	BMI $DA16  
; control flow target (from $D9EB)
0x03DA02|$0F:$D9F2:A5 13   	LDA $13    
0x03DA04|$0F:$D9F4:D9 09 DA	CMP $DA09,Y
0x03DA07|$0F:$D9F7:D0 F4   	BNE $D9ED  
; control flow target (from $D9BB, $DA1A, $DA20, $DA2B, $DA37)
0x03DA09|$0F:$D9F9:4C 33 D9	JMP $D933  


; code -> data
; indexed data load target (from $D9E8)
0x03DA0C|$0F:$D9FC:15	; Map ID #$15: Beran
0x03DA0D|$0F:$D9FD:0B	; Map ID #$0B: Lianport
0x03DA0E|$0F:$D9FE:0F	; Map ID #$0F: Osterfair
0x03DA0F|$0F:$D9FF:1A	; Map ID #$1A: Shrine SW of Cannock
0x03DA10|$0F:$DA00:10	; Map ID #$10: Zahan
0x03DA11|$0F:$DA01:03	; Map ID #$03: Midenhall 1F
0x03DA12|$0F:$DA02:05	; Map ID #$05: Leftwyne
0x03DA13|$0F:$DA03:06	; Map ID #$06: Cannock
0x03DA14|$0F:$DA04:07	; Map ID #$07: Hamlin
0x03DA15|$0F:$DA05:0B	; Map ID #$0B: Lianport
0x03DA16|$0F:$DA06:0C	; Map ID #$0C: Tantegel
0x03DA17|$0F:$DA07:11	; Map ID #$11: Tuhn
0x03DA18|$0F:$DA08:14	; Map ID #$14: Wellgarth Underground
; indexed data load target (from $D9F4)
; indirect data load target
0x03DA19|$0F:$DA09:10
; indirect data load target
0x03DA1A|$0F:$DA0A:08
; indirect data load target
0x03DA1B|$0F:$DA0B:0D
0x03DA1C|$0F:$DA0C:04
; indirect data load target
0x03DA1D|$0F:$DA0D:08
0x03DA1E|$0F:$DA0E:13
0x03DA1F|$0F:$DA0F:0D
0x03DA20|$0F:$DA10:0F
0x03DA21|$0F:$DA11:0F
; indirect data load target
0x03DA22|$0F:$DA12:14
; indirect data load target
0x03DA23|$0F:$DA13:0C
; indirect data load target
0x03DA24|$0F:$DA14:0E
; indirect data load target
0x03DA25|$0F:$DA15:12

; data -> code
; control flow target (from $D9E2, $D9F0)
0x03DA26|$0F:$DA16:A5 22   	LDA $22    	; map height
0x03DA28|$0F:$DA18:C5 13   	CMP $13    
0x03DA2A|$0F:$DA1A:90 DD   	BCC $D9F9  
0x03DA2C|$0F:$DA1C:A5 21   	LDA $21    	; map width
0x03DA2E|$0F:$DA1E:C5 12   	CMP $12    
0x03DA30|$0F:$DA20:90 D7   	BCC $D9F9  
0x03DA32|$0F:$DA22:20 03 DC	JSR $DC03  
0x03DA35|$0F:$DA25:A5 11   	LDA $11    
0x03DA37|$0F:$DA27:F0 04   	BEQ $DA2D  
0x03DA39|$0F:$DA29:A5 10   	LDA $10    
; control flow target (from $DAA7)
0x03DA3B|$0F:$DA2B:D0 CC   	BNE $D9F9  
; control flow target (from $DA27)
0x03DA3D|$0F:$DA2D:A5 12   	LDA $12    
0x03DA3F|$0F:$DA2F:C5 16   	CMP $16    	; current map X-pos (1)
0x03DA41|$0F:$DA31:D0 06   	BNE $DA39  
0x03DA43|$0F:$DA33:A5 13   	LDA $13    
0x03DA45|$0F:$DA35:C5 17   	CMP $17    	; current map Y-pos (1)
; control flow target (from $DA43, $DA5D, $DA71, $DA88)
0x03DA47|$0F:$DA37:F0 C0   	BEQ $D9F9  
; control flow target (from $DA31)
0x03DA49|$0F:$DA39:A5 12   	LDA $12    
0x03DA4B|$0F:$DA3B:C5 28   	CMP $28    	; current map X-pos (2)
0x03DA4D|$0F:$DA3D:D0 06   	BNE $DA45  
0x03DA4F|$0F:$DA3F:A5 13   	LDA $13    
0x03DA51|$0F:$DA41:C5 29   	CMP $29    	; current map Y-pos (2)
0x03DA53|$0F:$DA43:F0 F2   	BEQ $DA37  
; control flow target (from $DA3D)
0x03DA55|$0F:$DA45:A5 17   	LDA $17    	; current map Y-pos (1)
0x03DA57|$0F:$DA47:18      	CLC        
0x03DA58|$0F:$DA48:6D 45 05	ADC $0545  	; NPC #$01 ?
0x03DA5B|$0F:$DA4B:85 0F   	STA $0F    
0x03DA5D|$0F:$DA4D:A5 16   	LDA $16    	; current map X-pos (1)
0x03DA5F|$0F:$DA4F:18      	CLC        
0x03DA60|$0F:$DA50:6D 44 05	ADC $0544  	; NPC #$01 ?
0x03DA63|$0F:$DA53:85 0E   	STA $0E    
0x03DA65|$0F:$DA55:C5 12   	CMP $12    
0x03DA67|$0F:$DA57:D0 06   	BNE $DA5F  
0x03DA69|$0F:$DA59:A5 0F   	LDA $0F    
0x03DA6B|$0F:$DA5B:C5 13   	CMP $13    
0x03DA6D|$0F:$DA5D:F0 D8   	BEQ $DA37  
; control flow target (from $DA57)
0x03DA6F|$0F:$DA5F:A5 0E   	LDA $0E    
0x03DA71|$0F:$DA61:18      	CLC        
0x03DA72|$0F:$DA62:6D 4C 05	ADC $054C  	; NPC #$02 ?
0x03DA75|$0F:$DA65:C5 12   	CMP $12    
0x03DA77|$0F:$DA67:D0 0A   	BNE $DA73  
0x03DA79|$0F:$DA69:A5 0F   	LDA $0F    
0x03DA7B|$0F:$DA6B:18      	CLC        
0x03DA7C|$0F:$DA6C:6D 4D 05	ADC $054D  	; NPC #$02 ?
0x03DA7F|$0F:$DA6F:C5 13   	CMP $13    
0x03DA81|$0F:$DA71:F0 C4   	BEQ $DA37  
; control flow target (from $DA67)
0x03DA83|$0F:$DA73:A0 18   	LDY #$18   
; control flow target (from $DA91)
0x03DA85|$0F:$DA75:B9 41 05	LDA $0541,Y	; NPC #$00 sprite ID
0x03DA88|$0F:$DA78:C9 FF   	CMP #$FF   
0x03DA8A|$0F:$DA7A:F0 0E   	BEQ $DA8A  
0x03DA8C|$0F:$DA7C:B9 3C 05	LDA $053C,Y	; NPC #$00 ?
0x03DA8F|$0F:$DA7F:C5 12   	CMP $12    
0x03DA91|$0F:$DA81:D0 07   	BNE $DA8A  
0x03DA93|$0F:$DA83:B9 3D 05	LDA $053D,Y	; NPC #$00 ?
0x03DA96|$0F:$DA86:C5 13   	CMP $13    
0x03DA98|$0F:$DA88:F0 AD   	BEQ $DA37  
; control flow target (from $DA7A, $DA81)
0x03DA9A|$0F:$DA8A:98      	TYA        
0x03DA9B|$0F:$DA8B:18      	CLC        
0x03DA9C|$0F:$DA8C:69 08   	ADC #$08   
0x03DA9E|$0F:$DA8E:A8      	TAY        
0x03DA9F|$0F:$DA8F:C9 B8   	CMP #$B8   
0x03DAA1|$0F:$DA91:D0 E2   	BNE $DA75  
0x03DAA3|$0F:$DA93:A5 0D   	LDA $0D    
0x03DAA5|$0F:$DA95:48      	PHA        
0x03DAA6|$0F:$DA96:A5 12   	LDA $12    
0x03DAA8|$0F:$DA98:85 0C   	STA $0C    
0x03DAAA|$0F:$DA9A:A5 13   	LDA $13    
0x03DAAC|$0F:$DA9C:85 0E   	STA $0E    
0x03DAAE|$0F:$DA9E:20 89 DF	JSR $DF89  
0x03DAB1|$0F:$DAA1:20 22 E2	JSR $E222  
0x03DAB4|$0F:$DAA4:68      	PLA        
0x03DAB5|$0F:$DAA5:C5 0D   	CMP $0D    
; control flow target (from $DABA)
0x03DAB7|$0F:$DAA7:D0 82   	BNE $DA2B  
0x03DAB9|$0F:$DAA9:20 4A DF	JSR $DF4A  
0x03DABC|$0F:$DAAC:A0 04   	LDY #$04   
0x03DABE|$0F:$DAAE:B1 10   	LDA ($10),Y
0x03DAC0|$0F:$DAB0:29 F0   	AND #$F0   
0x03DAC2|$0F:$DAB2:F0 08   	BEQ $DABC  
0x03DAC4|$0F:$DAB4:C9 10   	CMP #$10   
0x03DAC6|$0F:$DAB6:F0 04   	BEQ $DABC  
0x03DAC8|$0F:$DAB8:C9 20   	CMP #$20   
0x03DACA|$0F:$DABA:D0 EB   	BNE $DAA7  
; control flow target (from $D999, $DAB2, $DAB6)
0x03DACC|$0F:$DABC:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03DACF|$0F:$DABF:09 08   	ORA #$08   
0x03DAD1|$0F:$DAC1:9D 40 05	STA $0540,X	; NPC #$00 ? + direction nybble
; control flow target (from $D92C)
0x03DAD4|$0F:$DAC4:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03DAD7|$0F:$DAC7:29 08   	AND #$08   
0x03DAD9|$0F:$DAC9:F0 5E   	BEQ $DB29  
0x03DADB|$0F:$DACB:A5 35   	LDA $35    	; flag indicating whether any menu is currently open
0x03DADD|$0F:$DACD:D0 5A   	BNE $DB29  
0x03DADF|$0F:$DACF:BD 40 05	LDA $0540,X	; NPC #$00 ? + direction nybble
0x03DAE2|$0F:$DAD2:29 03   	AND #$03   
0x03DAE4|$0F:$DAD4:D0 15   	BNE $DAEB  
0x03DAE6|$0F:$DAD6:BD 3F 05	LDA $053F,X	; NPC #$00 ?
0x03DAE9|$0F:$DAD9:38      	SEC        
0x03DAEA|$0F:$DADA:E9 01   	SBC #$01   
0x03DAEC|$0F:$DADC:29 0F   	AND #$0F   
0x03DAEE|$0F:$DADE:9D 3F 05	STA $053F,X	; NPC #$00 ?
0x03DAF1|$0F:$DAE1:C9 0F   	CMP #$0F   
0x03DAF3|$0F:$DAE3:D0 44   	BNE $DB29  
0x03DAF5|$0F:$DAE5:DE 3D 05	DEC $053D,X	; NPC #$00 ?
0x03DAF8|$0F:$DAE8:4C 29 DB	JMP $DB29  

; control flow target (from $DAD4)
0x03DAFB|$0F:$DAEB:C9 01   	CMP #$01   
0x03DAFD|$0F:$DAED:D0 12   	BNE $DB01  
0x03DAFF|$0F:$DAEF:BD 3E 05	LDA $053E,X	; NPC #$00 ?
0x03DB02|$0F:$DAF2:18      	CLC        
0x03DB03|$0F:$DAF3:69 01   	ADC #$01   
0x03DB05|$0F:$DAF5:29 0F   	AND #$0F   
0x03DB07|$0F:$DAF7:9D 3E 05	STA $053E,X	; NPC #$00 ?
0x03DB0A|$0F:$DAFA:D0 2D   	BNE $DB29  
0x03DB0C|$0F:$DAFC:FE 3C 05	INC $053C,X	; NPC #$00 ?
0x03DB0F|$0F:$DAFF:D0 28   	BNE $DB29  
; control flow target (from $DAED)
0x03DB11|$0F:$DB01:C9 02   	CMP #$02   
0x03DB13|$0F:$DB03:D0 12   	BNE $DB17  
0x03DB15|$0F:$DB05:BD 3F 05	LDA $053F,X	; NPC #$00 ?
0x03DB18|$0F:$DB08:18      	CLC        
0x03DB19|$0F:$DB09:69 01   	ADC #$01   
0x03DB1B|$0F:$DB0B:29 0F   	AND #$0F   
0x03DB1D|$0F:$DB0D:9D 3F 05	STA $053F,X	; NPC #$00 ?
0x03DB20|$0F:$DB10:D0 17   	BNE $DB29  
0x03DB22|$0F:$DB12:FE 3D 05	INC $053D,X	; NPC #$00 ?
0x03DB25|$0F:$DB15:D0 12   	BNE $DB29  
; control flow target (from $DB03)
0x03DB27|$0F:$DB17:BD 3E 05	LDA $053E,X	; NPC #$00 ?
0x03DB2A|$0F:$DB1A:38      	SEC        
0x03DB2B|$0F:$DB1B:E9 01   	SBC #$01   
0x03DB2D|$0F:$DB1D:29 0F   	AND #$0F   
0x03DB2F|$0F:$DB1F:9D 3E 05	STA $053E,X	; NPC #$00 ?
0x03DB32|$0F:$DB22:C9 0F   	CMP #$0F   
0x03DB34|$0F:$DB24:D0 03   	BNE $DB29  
0x03DB36|$0F:$DB26:DE 3C 05	DEC $053C,X	; NPC #$00 ?
; control flow target (from $D921, $D94C, $D980, $DAC9, $DACD, $DAE3, $DAE8, $DAFA, $DAFF, $DB10, $DB15, $DB24)
0x03DB39|$0F:$DB29:8A      	TXA        
0x03DB3A|$0F:$DB2A:18      	CLC        
0x03DB3B|$0F:$DB2B:69 08   	ADC #$08   
0x03DB3D|$0F:$DB2D:AA      	TAX        
0x03DB3E|$0F:$DB2E:C6 34   	DEC $34    
0x03DB40|$0F:$DB30:F0 03   	BEQ $DB35  
0x03DB42|$0F:$DB32:4C 1A D9	JMP $D91A  

; control flow target (from $D907, $DB30)
0x03DB45|$0F:$DB35:A6 3A   	LDX $3A    
; control flow target (from $DBB3)
0x03DB47|$0F:$DB37:BD 41 05	LDA $0541,X	; NPC #$00 sprite ID
0x03DB4A|$0F:$DB3A:C9 FF   	CMP #$FF   
0x03DB4C|$0F:$DB3C:F0 60   	BEQ $DB9E  
0x03DB4E|$0F:$DB3E:20 33 DC	JSR $DC33  
0x03DB51|$0F:$DB41:A5 0E   	LDA $0E    
0x03DB53|$0F:$DB43:18      	CLC        
0x03DB54|$0F:$DB44:69 07   	ADC #$07   
0x03DB56|$0F:$DB46:85 0E   	STA $0E    
0x03DB58|$0F:$DB48:A5 0F   	LDA $0F    
0x03DB5A|$0F:$DB4A:69 00   	ADC #$00   
0x03DB5C|$0F:$DB4C:F0 0A   	BEQ $DB58  
0x03DB5E|$0F:$DB4E:C9 01   	CMP #$01   
0x03DB60|$0F:$DB50:D0 4C   	BNE $DB9E  
0x03DB62|$0F:$DB52:A5 0E   	LDA $0E    
0x03DB64|$0F:$DB54:C9 07   	CMP #$07   
0x03DB66|$0F:$DB56:B0 46   	BCS $DB9E  
; control flow target (from $DB4C)
0x03DB68|$0F:$DB58:20 65 DC	JSR $DC65  
0x03DB6B|$0F:$DB5B:A5 10   	LDA $10    
0x03DB6D|$0F:$DB5D:18      	CLC        
0x03DB6E|$0F:$DB5E:69 0D   	ADC #$0D   
0x03DB70|$0F:$DB60:A5 11   	LDA $11    
0x03DB72|$0F:$DB62:69 00   	ADC #$00   
0x03DB74|$0F:$DB64:D0 38   	BNE $DB9E  
0x03DB76|$0F:$DB66:20 F8 DB	JSR $DBF8  
0x03DB79|$0F:$DB69:20 03 DC	JSR $DC03  
0x03DB7C|$0F:$DB6C:A5 11   	LDA $11    
0x03DB7E|$0F:$DB6E:F0 04   	BEQ $DB74  
0x03DB80|$0F:$DB70:A5 10   	LDA $10    
0x03DB82|$0F:$DB72:D0 2A   	BNE $DB9E  
; control flow target (from $DB6E)
0x03DB84|$0F:$DB74:20 18 E2	JSR $E218  
0x03DB87|$0F:$DB77:A5 0D   	LDA $0D    
0x03DB89|$0F:$DB79:C5 1D   	CMP $1D    
0x03DB8B|$0F:$DB7B:D0 21   	BNE $DB9E  
0x03DB8D|$0F:$DB7D:AD 48 61	LDA $6148  
0x03DB90|$0F:$DB80:85 0E   	STA $0E    
0x03DB92|$0F:$DB82:AD 49 61	LDA $6149  
0x03DB95|$0F:$DB85:85 0F   	STA $0F    
0x03DB97|$0F:$DB87:AD 4A 61	LDA $614A  
0x03DB9A|$0F:$DB8A:85 10   	STA $10    
0x03DB9C|$0F:$DB8C:AD 4B 61	LDA $614B  
0x03DB9F|$0F:$DB8F:85 11   	STA $11    
0x03DBA1|$0F:$DB91:8A      	TXA        
0x03DBA2|$0F:$DB92:A8      	TAY        
0x03DBA3|$0F:$DB93:20 CB DD	JSR $DDCB  
0x03DBA6|$0F:$DB96:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03DBA9|$0F:$DB99:20 DD DC	JSR $DCDD  
0x03DBAC|$0F:$DB9C:98      	TYA        
0x03DBAD|$0F:$DB9D:AA      	TAX        
; control flow target (from $DB3C, $DB50, $DB56, $DB64, $DB72, $DB7B)
0x03DBAE|$0F:$DB9E:8A      	TXA        
0x03DBAF|$0F:$DB9F:18      	CLC        
0x03DBB0|$0F:$DBA0:69 08   	ADC #$08   
0x03DBB2|$0F:$DBA2:AA      	TAX        
0x03DBB3|$0F:$DBA3:E0 B8   	CPX #$B8   
0x03DBB5|$0F:$DBA5:D0 02   	BNE $DBA9  
0x03DBB7|$0F:$DBA7:A2 18   	LDX #$18   
; control flow target (from $DBA5)
0x03DBB9|$0F:$DBA9:E4 3A   	CPX $3A    
0x03DBBB|$0F:$DBAB:F0 09   	BEQ $DBB6  
0x03DBBD|$0F:$DBAD:A5 37   	LDA $37    
0x03DBBF|$0F:$DBAF:C9 0D   	CMP #$0D   
0x03DBC1|$0F:$DBB1:F0 03   	BEQ $DBB6  
0x03DBC3|$0F:$DBB3:4C 37 DB	JMP $DB37  

; control flow target (from $D900, $DBAB, $DBB1)
0x03DBC6|$0F:$DBB6:86 3A   	STX $3A    
0x03DBC8|$0F:$DBB8:A5 03   	LDA $03    	; game clock?
0x03DBCA|$0F:$DBBA:29 0F   	AND #$0F   
0x03DBCC|$0F:$DBBC:D0 12   	BNE $DBD0  
0x03DBCE|$0F:$DBBE:A5 38   	LDA $38    
0x03DBD0|$0F:$DBC0:30 0E   	BMI $DBD0  
0x03DBD2|$0F:$DBC2:E6 38   	INC $38    
0x03DBD4|$0F:$DBC4:E6 38   	INC $38    
0x03DBD6|$0F:$DBC6:A5 38   	LDA $38    
0x03DBD8|$0F:$DBC8:C9 0A   	CMP #$0A   
0x03DBDA|$0F:$DBCA:90 04   	BCC $DBD0  
0x03DBDC|$0F:$DBCC:A9 00   	LDA #$00   
0x03DBDE|$0F:$DBCE:85 38   	STA $38    
; control flow target (from $DBBC, $DBC0, $DBCA)
0x03DBE0|$0F:$DBD0:60      	RTS        

; control flow target (from $D899, $D89E)
0x03DBE1|$0F:$DBD1:20 D4 DB	JSR $DBD4  
; control flow target (from $DBD1)
0x03DBE4|$0F:$DBD4:B9 3A 05	LDA $053A,Y
0x03DBE7|$0F:$DBD7:18      	CLC        
0x03DBE8|$0F:$DBD8:79 3E 05	ADC $053E,Y	; NPC #$00 ?
0x03DBEB|$0F:$DBDB:99 3A 05	STA $053A,Y
0x03DBEE|$0F:$DBDE:C8      	INY        
0x03DBEF|$0F:$DBDF:60      	RTS        

; control flow target (from $D8B0, $D8BC)
0x03DBF0|$0F:$DBE0:20 E3 DB	JSR $DBE3  
; control flow target (from $DBE0)
0x03DBF3|$0F:$DBE3:B9 46 05	LDA $0546,Y	; NPC #$01 ?
0x03DBF6|$0F:$DBE6:38      	SEC        
0x03DBF7|$0F:$DBE7:F9 3E 05	SBC $053E,Y	; NPC #$00 ?
0x03DBFA|$0F:$DBEA:18      	CLC        
0x03DBFB|$0F:$DBEB:79 44 05	ADC $0544,Y	; NPC #$01 ?
0x03DBFE|$0F:$DBEE:99 44 05	STA $0544,Y	; NPC #$01 ?
0x03DC01|$0F:$DBF1:A9 00   	LDA #$00   
0x03DC03|$0F:$DBF3:99 3E 05	STA $053E,Y	; NPC #$00 ?
0x03DC06|$0F:$DBF6:C8      	INY        
0x03DC07|$0F:$DBF7:60      	RTS        

; control flow target (from $D9AF, $DB66)
0x03DC08|$0F:$DBF8:BD 3C 05	LDA $053C,X	; NPC #$00 ?
0x03DC0B|$0F:$DBFB:85 12   	STA $12    
0x03DC0D|$0F:$DBFD:BD 3D 05	LDA $053D,X	; NPC #$00 ?
0x03DC10|$0F:$DC00:85 13   	STA $13    
0x03DC12|$0F:$DC02:60      	RTS        

; control flow target (from $D9B2, $DA22, $DB69)
0x03DC13|$0F:$DC03:A9 00   	LDA #$00   
0x03DC15|$0F:$DC05:85 11   	STA $11    
0x03DC17|$0F:$DC07:A5 12   	LDA $12    
0x03DC19|$0F:$DC09:38      	SEC        
0x03DC1A|$0F:$DC0A:E5 16   	SBC $16    	; current map X-pos (1)
0x03DC1C|$0F:$DC0C:18      	CLC        
0x03DC1D|$0F:$DC0D:69 08   	ADC #$08   
0x03DC1F|$0F:$DC0F:85 0C   	STA $0C    
0x03DC21|$0F:$DC11:C9 10   	CMP #$10   
0x03DC23|$0F:$DC13:90 01   	BCC $DC16  
0x03DC25|$0F:$DC15:60      	RTS        

; control flow target (from $DC13)
0x03DC26|$0F:$DC16:A5 13   	LDA $13    
0x03DC28|$0F:$DC18:38      	SEC        
0x03DC29|$0F:$DC19:E5 17   	SBC $17    	; current map Y-pos (1)
0x03DC2B|$0F:$DC1B:18      	CLC        
0x03DC2C|$0F:$DC1C:69 07   	ADC #$07   
0x03DC2E|$0F:$DC1E:85 0E   	STA $0E    
0x03DC30|$0F:$DC20:C9 0F   	CMP #$0F   
0x03DC32|$0F:$DC22:90 01   	BCC $DC25  
0x03DC34|$0F:$DC24:60      	RTS        

; control flow target (from $DC22)
0x03DC35|$0F:$DC25:20 31 DE	JSR $DE31  
0x03DC38|$0F:$DC28:A0 00   	LDY #$00   
0x03DC3A|$0F:$DC2A:B1 07   	LDA ($07),Y
0x03DC3C|$0F:$DC2C:85 10   	STA $10    
0x03DC3E|$0F:$DC2E:A9 FF   	LDA #$FF   
0x03DC40|$0F:$DC30:85 11   	STA $11    
0x03DC42|$0F:$DC32:60      	RTS        

; control flow target (from $DB3E)
0x03DC43|$0F:$DC33:BD 3C 05	LDA $053C,X	; NPC #$00 ?
0x03DC46|$0F:$DC36:85 0F   	STA $0F    
0x03DC48|$0F:$DC38:A9 00   	LDA #$00   
0x03DC4A|$0F:$DC3A:46 0F   	LSR $0F    
0x03DC4C|$0F:$DC3C:6A      	ROR        
0x03DC4D|$0F:$DC3D:46 0F   	LSR $0F    
0x03DC4F|$0F:$DC3F:6A      	ROR        
0x03DC50|$0F:$DC40:46 0F   	LSR $0F    
0x03DC52|$0F:$DC42:6A      	ROR        
0x03DC53|$0F:$DC43:46 0F   	LSR $0F    
0x03DC55|$0F:$DC45:6A      	ROR        
0x03DC56|$0F:$DC46:1D 3E 05	ORA $053E,X	; NPC #$00 ?
0x03DC59|$0F:$DC49:38      	SEC        
0x03DC5A|$0F:$DC4A:E5 2A   	SBC $2A    	; current map X-pos pixel, low byte
0x03DC5C|$0F:$DC4C:49 80   	EOR #$80   
0x03DC5E|$0F:$DC4E:85 0E   	STA $0E    
0x03DC60|$0F:$DC50:A5 0F   	LDA $0F    
0x03DC62|$0F:$DC52:E5 2B   	SBC $2B    	; current map X-pos pixel, high byte
0x03DC64|$0F:$DC54:85 0F   	STA $0F    
0x03DC66|$0F:$DC56:A5 0E   	LDA $0E    
0x03DC68|$0F:$DC58:8D 48 61	STA $6148  
0x03DC6B|$0F:$DC5B:30 02   	BMI $DC5F  
0x03DC6D|$0F:$DC5D:E6 0F   	INC $0F    
; control flow target (from $DC5B)
0x03DC6F|$0F:$DC5F:A5 0F   	LDA $0F    
0x03DC71|$0F:$DC61:8D 49 61	STA $6149  
0x03DC74|$0F:$DC64:60      	RTS        

; control flow target (from $DB58)
0x03DC75|$0F:$DC65:BD 3D 05	LDA $053D,X	; NPC #$00 ?
0x03DC78|$0F:$DC68:85 11   	STA $11    
0x03DC7A|$0F:$DC6A:A9 00   	LDA #$00   
0x03DC7C|$0F:$DC6C:46 11   	LSR $11    
0x03DC7E|$0F:$DC6E:6A      	ROR        
0x03DC7F|$0F:$DC6F:46 11   	LSR $11    
0x03DC81|$0F:$DC71:6A      	ROR        
0x03DC82|$0F:$DC72:46 11   	LSR $11    
0x03DC84|$0F:$DC74:6A      	ROR        
0x03DC85|$0F:$DC75:46 11   	LSR $11    
0x03DC87|$0F:$DC77:6A      	ROR        
0x03DC88|$0F:$DC78:1D 3F 05	ORA $053F,X	; NPC #$00 ?
0x03DC8B|$0F:$DC7B:38      	SEC        
0x03DC8C|$0F:$DC7C:E5 2C   	SBC $2C    	; current map Y-pos pixel, low byte
0x03DC8E|$0F:$DC7E:85 10   	STA $10    
0x03DC90|$0F:$DC80:A5 11   	LDA $11    
0x03DC92|$0F:$DC82:E5 2D   	SBC $2D    	; current map Y-pos pixel, high byte
0x03DC94|$0F:$DC84:85 11   	STA $11    
0x03DC96|$0F:$DC86:A5 10   	LDA $10    
0x03DC98|$0F:$DC88:18      	CLC        
0x03DC99|$0F:$DC89:69 6F   	ADC #$6F   
0x03DC9B|$0F:$DC8B:85 10   	STA $10    
0x03DC9D|$0F:$DC8D:8D 4A 61	STA $614A  
0x03DCA0|$0F:$DC90:90 02   	BCC $DC94  
0x03DCA2|$0F:$DC92:E6 11   	INC $11    
; control flow target (from $DC90)
0x03DCA4|$0F:$DC94:A5 11   	LDA $11    
0x03DCA6|$0F:$DC96:8D 4B 61	STA $614B  
0x03DCA9|$0F:$DC99:60      	RTS        

; control flow target (from $D8E9, $D8F0, $D8F7)
0x03DCAA|$0F:$DC9A:8A      	TXA        
0x03DCAB|$0F:$DC9B:48      	PHA        
0x03DCAC|$0F:$DC9C:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03DCAF|$0F:$DC9F:68      	PLA        
0x03DCB0|$0F:$DCA0:AA      	TAX        
0x03DCB1|$0F:$DCA1:B9 3A 05	LDA $053A,Y
0x03DCB4|$0F:$DCA4:19 3B 05	ORA $053B,Y
0x03DCB7|$0F:$DCA7:F0 23   	BEQ $DCCC  
0x03DCB9|$0F:$DCA9:B9 3A 05	LDA $053A,Y
0x03DCBC|$0F:$DCAC:4A      	LSR        
0x03DCBD|$0F:$DCAD:4A      	LSR        
0x03DCBE|$0F:$DCAE:4A      	LSR        
0x03DCBF|$0F:$DCAF:4A      	LSR        
0x03DCC0|$0F:$DCB0:85 0C   	STA $0C    
0x03DCC2|$0F:$DCB2:B9 3B 05	LDA $053B,Y
0x03DCC5|$0F:$DCB5:4A      	LSR        
0x03DCC6|$0F:$DCB6:4A      	LSR        
0x03DCC7|$0F:$DCB7:4A      	LSR        
0x03DCC8|$0F:$DCB8:4A      	LSR        
0x03DCC9|$0F:$DCB9:85 0E   	STA $0E    
0x03DCCB|$0F:$DCBB:E6 0E   	INC $0E    
0x03DCCD|$0F:$DCBD:20 31 DE	JSR $DE31  
0x03DCD0|$0F:$DCC0:84 0C   	STY $0C    
0x03DCD2|$0F:$DCC2:A0 00   	LDY #$00   
0x03DCD4|$0F:$DCC4:B1 07   	LDA ($07),Y
0x03DCD6|$0F:$DCC6:A4 0C   	LDY $0C    
0x03DCD8|$0F:$DCC8:C9 00   	CMP #$00   
0x03DCDA|$0F:$DCCA:F0 01   	BEQ $DCCD  
; control flow target (from $DCA7)
0x03DCDC|$0F:$DCCC:60      	RTS        

; control flow target (from $DCCA)
0x03DCDD|$0F:$DCCD:B9 3A 05	LDA $053A,Y
0x03DCE0|$0F:$DCD0:85 0E   	STA $0E    
0x03DCE2|$0F:$DCD2:B9 3B 05	LDA $053B,Y
0x03DCE5|$0F:$DCD5:85 10   	STA $10    
0x03DCE7|$0F:$DCD7:A9 00   	LDA #$00   
0x03DCE9|$0F:$DCD9:85 0F   	STA $0F    
0x03DCEB|$0F:$DCDB:85 11   	STA $11    
; control flow target (from $DB99)
0x03DCED|$0F:$DCDD:20 3F DD	JSR $DD3F  
0x03DCF0|$0F:$DCE0:98      	TYA        
0x03DCF1|$0F:$DCE1:48      	PHA        
0x03DCF2|$0F:$DCE2:A9 00   	LDA #$00   
0x03DCF4|$0F:$DCE4:A8      	TAY        
0x03DCF5|$0F:$DCE5:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03DCF7|$0F:$DCE7:F0 02   	BEQ $DCEB  
0x03DCF9|$0F:$DCE9:A9 FC   	LDA #$FC   
; control flow target (from $DCE7)
0x03DCFB|$0F:$DCEB:85 0C   	STA $0C    
; control flow target (from $DD38)
0x03DCFD|$0F:$DCED:A9 00   	LDA #$00   
0x03DCFF|$0F:$DCEF:85 0D   	STA $0D    
; control flow target (from $DD2D)
0x03DD01|$0F:$DCF1:A5 0E   	LDA $0E    
0x03DD03|$0F:$DCF3:18      	CLC        
0x03DD04|$0F:$DCF4:65 0D   	ADC $0D    
0x03DD06|$0F:$DCF6:9D 03 02	STA $0203,X
0x03DD09|$0F:$DCF9:A5 0F   	LDA $0F    
0x03DD0B|$0F:$DCFB:69 00   	ADC #$00   
0x03DD0D|$0F:$DCFD:D0 23   	BNE $DD22  
0x03DD0F|$0F:$DCFF:A5 10   	LDA $10    
0x03DD11|$0F:$DD01:18      	CLC        
0x03DD12|$0F:$DD02:65 0C   	ADC $0C    
0x03DD14|$0F:$DD04:9D 00 02	STA $0200,X	; sprite buffer start
0x03DD17|$0F:$DD07:B1 12   	LDA ($12),Y
0x03DD19|$0F:$DD09:9D 01 02	STA $0201,X
0x03DD1C|$0F:$DD0C:C8      	INY        
0x03DD1D|$0F:$DD0D:A5 6D   	LDA $6D    
0x03DD1F|$0F:$DD0F:C9 03   	CMP #$03   
0x03DD21|$0F:$DD11:B0 05   	BCS $DD18  
0x03DD23|$0F:$DD13:20 75 DD	JSR $DD75  
0x03DD26|$0F:$DD16:B0 02   	BCS $DD1A  
; control flow target (from $DD11)
0x03DD28|$0F:$DD18:B1 12   	LDA ($12),Y
; control flow target (from $DD16)
0x03DD2A|$0F:$DD1A:88      	DEY        
0x03DD2B|$0F:$DD1B:9D 02 02	STA $0202,X
0x03DD2E|$0F:$DD1E:E8      	INX        
0x03DD2F|$0F:$DD1F:E8      	INX        
0x03DD30|$0F:$DD20:E8      	INX        
0x03DD31|$0F:$DD21:E8      	INX        
; control flow target (from $DCFD)
0x03DD32|$0F:$DD22:C8      	INY        
0x03DD33|$0F:$DD23:C8      	INY        
0x03DD34|$0F:$DD24:A5 0D   	LDA $0D    
0x03DD36|$0F:$DD26:18      	CLC        
0x03DD37|$0F:$DD27:69 08   	ADC #$08   
0x03DD39|$0F:$DD29:85 0D   	STA $0D    
0x03DD3B|$0F:$DD2B:C9 10   	CMP #$10   
0x03DD3D|$0F:$DD2D:D0 C2   	BNE $DCF1  
0x03DD3F|$0F:$DD2F:A5 0C   	LDA $0C    
0x03DD41|$0F:$DD31:18      	CLC        
0x03DD42|$0F:$DD32:69 08   	ADC #$08   
0x03DD44|$0F:$DD34:85 0C   	STA $0C    
0x03DD46|$0F:$DD36:C9 0C   	CMP #$0C   
0x03DD48|$0F:$DD38:90 B3   	BCC $DCED  
0x03DD4A|$0F:$DD3A:68      	PLA        
0x03DD4B|$0F:$DD3B:A8      	TAY        
0x03DD4C|$0F:$DD3C:60      	RTS        


; code -> data
; data load target (from $DD65)
0x03DD4D|$0F:$DD3D:F7
; data load target (from $DD6D)
0x03DD4E|$0F:$DD3E:   B8	; $03:$B8F7

; data -> code
; control flow target (from $DCDD)
0x03DD4F|$0F:$DD3F:A9 00   	LDA #$00   
0x03DD51|$0F:$DD41:85 13   	STA $13    
0x03DD53|$0F:$DD43:B9 40 05	LDA $0540,Y	; NPC #$00 ? + direction nybble
0x03DD56|$0F:$DD46:29 03   	AND #$03   
0x03DD58|$0F:$DD48:85 12   	STA $12    
0x03DD5A|$0F:$DD4A:B9 41 05	LDA $0541,Y	; NPC #$00 sprite ID
0x03DD5D|$0F:$DD4D:85 6D   	STA $6D    
0x03DD5F|$0F:$DD4F:0A      	ASL        
0x03DD60|$0F:$DD50:0A      	ASL        
0x03DD61|$0F:$DD51:05 12   	ORA $12    
0x03DD63|$0F:$DD53:0A      	ASL        
0x03DD64|$0F:$DD54:0A      	ASL        
0x03DD65|$0F:$DD55:0A      	ASL        
0x03DD66|$0F:$DD56:26 13   	ROL $13    
0x03DD68|$0F:$DD58:0A      	ASL        
0x03DD69|$0F:$DD59:26 13   	ROL $13    
0x03DD6B|$0F:$DD5B:85 12   	STA $12    
0x03DD6D|$0F:$DD5D:A5 36   	LDA $36    
0x03DD6F|$0F:$DD5F:29 08   	AND #$08   
0x03DD71|$0F:$DD61:05 12   	ORA $12    
0x03DD73|$0F:$DD63:85 12   	STA $12    
0x03DD75|$0F:$DD65:AD 3D DD	LDA $DD3D  
0x03DD78|$0F:$DD68:18      	CLC        
0x03DD79|$0F:$DD69:65 12   	ADC $12    
0x03DD7B|$0F:$DD6B:85 12   	STA $12    
0x03DD7D|$0F:$DD6D:AD 3E DD	LDA $DD3E  
0x03DD80|$0F:$DD70:65 13   	ADC $13    
0x03DD82|$0F:$DD72:85 13   	STA $13    
0x03DD84|$0F:$DD74:60      	RTS        

; control flow target (from $DD13)
0x03DD85|$0F:$DD75:48      	PHA        
0x03DD86|$0F:$DD76:AD AD 61	LDA $61AD  
0x03DD89|$0F:$DD79:D0 45   	BNE $DDC0  
0x03DD8B|$0F:$DD7B:68      	PLA        
0x03DD8C|$0F:$DD7C:D0 0E   	BNE $DD8C  
0x03DD8E|$0F:$DD7E:AD 2D 06	LDA $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03DD91|$0F:$DD81:29 04   	AND #$04   
0x03DD93|$0F:$DD83:F0 25   	BEQ $DDAA  
0x03DD95|$0F:$DD85:AD 2D 06	LDA $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03DD98|$0F:$DD88:10 22   	BPL $DDAC  
0x03DD9A|$0F:$DD8A:18      	CLC        
0x03DD9B|$0F:$DD8B:60      	RTS        

; control flow target (from $DD7C)
0x03DD9C|$0F:$DD8C:C9 02   	CMP #$02   
0x03DD9E|$0F:$DD8E:F0 0E   	BEQ $DD9E  
0x03DDA0|$0F:$DD90:AD 3F 06	LDA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03DDA3|$0F:$DD93:29 04   	AND #$04   
0x03DDA5|$0F:$DD95:F0 13   	BEQ $DDAA  
0x03DDA7|$0F:$DD97:AD 3F 06	LDA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03DDAA|$0F:$DD9A:10 10   	BPL $DDAC  
0x03DDAC|$0F:$DD9C:18      	CLC        
0x03DDAD|$0F:$DD9D:60      	RTS        

; control flow target (from $DD8E)
0x03DDAE|$0F:$DD9E:AD 51 06	LDA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03DDB1|$0F:$DDA1:29 04   	AND #$04   
0x03DDB3|$0F:$DDA3:F0 05   	BEQ $DDAA  
0x03DDB5|$0F:$DDA5:AD 51 06	LDA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03DDB8|$0F:$DDA8:10 02   	BPL $DDAC  
; control flow target (from $DD83, $DD95, $DDA3, $DDC5)
0x03DDBA|$0F:$DDAA:18      	CLC        
0x03DDBB|$0F:$DDAB:60      	RTS        

; control flow target (from $DD88, $DD9A, $DDA8)
0x03DDBC|$0F:$DDAC:A5 27   	LDA $27    	; map palette; offset from ($E27C)
0x03DDBE|$0F:$DDAE:C9 68   	CMP #$68   
0x03DDC0|$0F:$DDB0:F0 06   	BEQ $DDB8  
0x03DDC2|$0F:$DDB2:B1 12   	LDA ($12),Y
0x03DDC4|$0F:$DDB4:29 FC   	AND #$FC   
0x03DDC6|$0F:$DDB6:38      	SEC        
0x03DDC7|$0F:$DDB7:60      	RTS        

; control flow target (from $DDB0)
0x03DDC8|$0F:$DDB8:B1 12   	LDA ($12),Y
0x03DDCA|$0F:$DDBA:29 FC   	AND #$FC   
0x03DDCC|$0F:$DDBC:09 03   	ORA #$03   
0x03DDCE|$0F:$DDBE:38      	SEC        
0x03DDCF|$0F:$DDBF:60      	RTS        

; control flow target (from $DD79)
0x03DDD0|$0F:$DDC0:68      	PLA        
0x03DDD1|$0F:$DDC1:F0 04   	BEQ $DDC7  
0x03DDD3|$0F:$DDC3:C9 01   	CMP #$01   
0x03DDD5|$0F:$DDC5:D0 E3   	BNE $DDAA  
; control flow target (from $DDC1)
0x03DDD7|$0F:$DDC7:A9 03   	LDA #$03   
0x03DDD9|$0F:$DDC9:38      	SEC        
0x03DDDA|$0F:$DDCA:60      	RTS        

; control flow target (from $DB93)
0x03DDDB|$0F:$DDCB:E6 39   	INC $39    
0x03DDDD|$0F:$DDCD:A5 39   	LDA $39    
0x03DDDF|$0F:$DDCF:C9 0D   	CMP #$0D   
0x03DDE1|$0F:$DDD1:90 04   	BCC $DDD7  
0x03DDE3|$0F:$DDD3:A9 00   	LDA #$00   
0x03DDE5|$0F:$DDD5:85 39   	STA $39    
; control flow target (from $DDD1)
0x03DDE7|$0F:$DDD7:18      	CLC        
0x03DDE8|$0F:$DDD8:65 37   	ADC $37    
0x03DDEA|$0F:$DDDA:AA      	TAX        
0x03DDEB|$0F:$DDDB:BD E2 DD	LDA $DDE2,X
0x03DDEE|$0F:$DDDE:AA      	TAX        
0x03DDEF|$0F:$DDDF:E6 37   	INC $37    
0x03DDF1|$0F:$DDE1:60      	RTS        


; code -> data
; indexed data load target (from $DDDB)
0x03DDF2|$0F:$DDE2:90
0x03DDF3|$0F:$DDE3:40
0x03DDF4|$0F:$DDE4:E0
0x03DDF5|$0F:$DDE5:30
0x03DDF6|$0F:$DDE6:80
0x03DDF7|$0F:$DDE7:D0
0x03DDF8|$0F:$DDE8:10
0x03DDF9|$0F:$DDE9:C0
0x03DDFA|$0F:$DDEA:70
0x03DDFB|$0F:$DDEB:20
0x03DDFC|$0F:$DDEC:F0
0x03DDFD|$0F:$DDED:60
0x03DDFE|$0F:$DDEE:A0
0x03DDFF|$0F:$DDEF:90
0x03DE00|$0F:$DDF0:40
0x03DE01|$0F:$DDF1:E0
0x03DE02|$0F:$DDF2:30
0x03DE03|$0F:$DDF3:80
0x03DE04|$0F:$DDF4:D0
0x03DE05|$0F:$DDF5:10
0x03DE06|$0F:$DDF6:C0
0x03DE07|$0F:$DDF7:70
0x03DE08|$0F:$DDF8:20
0x03DE09|$0F:$DDF9:F0
; indirect data load target
0x03DE0A|$0F:$DDFA:60
; indirect data load target
0x03DE0B|$0F:$DDFB:A0

; data -> code
; control flow target (from $D654)
0x03DE0C|$0F:$DDFC:06 0C   	ASL $0C    
0x03DE0E|$0F:$DDFE:06 0E   	ASL $0E    
; control flow target (from $EB07)
; external control flow target (from $02:$B119)
0x03DE10|$0F:$DE00:A5 0E   	LDA $0E    
0x03DE12|$0F:$DE02:85 08   	STA $08    
0x03DE14|$0F:$DE04:A9 00   	LDA #$00   
0x03DE16|$0F:$DE06:46 08   	LSR $08    
0x03DE18|$0F:$DE08:6A      	ROR        
0x03DE19|$0F:$DE09:46 08   	LSR $08    
0x03DE1B|$0F:$DE0B:6A      	ROR        
0x03DE1C|$0F:$DE0C:46 08   	LSR $08    
0x03DE1E|$0F:$DE0E:6A      	ROR        
0x03DE1F|$0F:$DE0F:85 07   	STA $07    
0x03DE21|$0F:$DE11:A5 0C   	LDA $0C    
0x03DE23|$0F:$DE13:29 1F   	AND #$1F   
0x03DE25|$0F:$DE15:18      	CLC        
0x03DE26|$0F:$DE16:65 07   	ADC $07    
0x03DE28|$0F:$DE18:85 07   	STA $07    
0x03DE2A|$0F:$DE1A:08      	PHP        
0x03DE2B|$0F:$DE1B:A5 0C   	LDA $0C    
0x03DE2D|$0F:$DE1D:29 20   	AND #$20   
0x03DE2F|$0F:$DE1F:D0 04   	BNE $DE25  
0x03DE31|$0F:$DE21:A9 20   	LDA #$20   
0x03DE33|$0F:$DE23:D0 02   	BNE $DE27  
; control flow target (from $DE1F)
0x03DE35|$0F:$DE25:A9 24   	LDA #$24   
; control flow target (from $DE23)
0x03DE37|$0F:$DE27:28      	PLP        
0x03DE38|$0F:$DE28:65 08   	ADC $08    
0x03DE3A|$0F:$DE2A:85 08   	STA $08    
0x03DE3C|$0F:$DE2C:60      	RTS        

; control flow target (from $D082, $F441)
0x03DE3D|$0F:$DE2D:46 0C   	LSR $0C    
0x03DE3F|$0F:$DE2F:46 0E   	LSR $0E    
; control flow target (from $DC25, $DCBD, $F7E3)
0x03DE41|$0F:$DE31:A5 0E   	LDA $0E    
0x03DE43|$0F:$DE33:0A      	ASL        
0x03DE44|$0F:$DE34:0A      	ASL        
0x03DE45|$0F:$DE35:0A      	ASL        
0x03DE46|$0F:$DE36:0A      	ASL        
0x03DE47|$0F:$DE37:65 0C   	ADC $0C    
0x03DE49|$0F:$DE39:85 07   	STA $07    
0x03DE4B|$0F:$DE3B:A9 04   	LDA #$04   
0x03DE4D|$0F:$DE3D:85 08   	STA $08    
0x03DE4F|$0F:$DE3F:60      	RTS        

; control flow target (from $DE68, $DEA0)
0x03DE50|$0F:$DE40:06 0C   	ASL $0C    
0x03DE52|$0F:$DE42:06 0E   	ASL $0E    
; control flow target (from $DE6E, $DEA6)
0x03DE54|$0F:$DE44:A5 0E   	LDA $0E    
0x03DE56|$0F:$DE46:29 FC   	AND #$FC   
0x03DE58|$0F:$DE48:0A      	ASL        
0x03DE59|$0F:$DE49:85 07   	STA $07    
0x03DE5B|$0F:$DE4B:A5 0C   	LDA $0C    
0x03DE5D|$0F:$DE4D:29 1F   	AND #$1F   
0x03DE5F|$0F:$DE4F:4A      	LSR        
0x03DE60|$0F:$DE50:4A      	LSR        
0x03DE61|$0F:$DE51:18      	CLC        
0x03DE62|$0F:$DE52:65 07   	ADC $07    
0x03DE64|$0F:$DE54:18      	CLC        
0x03DE65|$0F:$DE55:69 C0   	ADC #$C0   
0x03DE67|$0F:$DE57:85 07   	STA $07    
0x03DE69|$0F:$DE59:A5 0C   	LDA $0C    
0x03DE6B|$0F:$DE5B:29 20   	AND #$20   
0x03DE6D|$0F:$DE5D:D0 04   	BNE $DE63  
0x03DE6F|$0F:$DE5F:A9 03   	LDA #$03   
0x03DE71|$0F:$DE61:D0 02   	BNE $DE65  
; control flow target (from $DE5D)
0x03DE73|$0F:$DE63:A9 07   	LDA #$07   
; control flow target (from $DE61)
0x03DE75|$0F:$DE65:85 08   	STA $08    
0x03DE77|$0F:$DE67:60      	RTS        

0x03DE78|$0F:$DE68:20 40 DE	JSR $DE40  
0x03DE7B|$0F:$DE6B:4C 71 DE	JMP $DE71  

; control flow target (from $DF2F, $EADF)
; external control flow target (from $04:$8D88)
0x03DE7E|$0F:$DE6E:20 44 DE	JSR $DE44  
; control flow target (from $DE6B)
0x03DE81|$0F:$DE71:98      	TYA        
0x03DE82|$0F:$DE72:48      	PHA        
0x03DE83|$0F:$DE73:A5 0E   	LDA $0E    
0x03DE85|$0F:$DE75:29 02   	AND #$02   
0x03DE87|$0F:$DE77:0A      	ASL        
0x03DE88|$0F:$DE78:85 0D   	STA $0D    
0x03DE8A|$0F:$DE7A:A5 0C   	LDA $0C    
0x03DE8C|$0F:$DE7C:29 02   	AND #$02   
0x03DE8E|$0F:$DE7E:18      	CLC        
0x03DE8F|$0F:$DE7F:65 0D   	ADC $0D    
0x03DE91|$0F:$DE81:A8      	TAY        
0x03DE92|$0F:$DE82:A9 FC   	LDA #$FC   
0x03DE94|$0F:$DE84:C0 00   	CPY #$00   
0x03DE96|$0F:$DE86:F0 07   	BEQ $DE8F  
; control flow target (from $DE8D)
0x03DE98|$0F:$DE88:38      	SEC        
0x03DE99|$0F:$DE89:2A      	ROL        
0x03DE9A|$0F:$DE8A:06 09   	ASL $09    
0x03DE9C|$0F:$DE8C:88      	DEY        
0x03DE9D|$0F:$DE8D:D0 F9   	BNE $DE88  
; control flow target (from $DE86)
0x03DE9F|$0F:$DE8F:31 07   	AND ($07),Y
0x03DEA1|$0F:$DE91:05 09   	ORA $09    
0x03DEA3|$0F:$DE93:91 07   	STA ($07),Y
0x03DEA5|$0F:$DE95:85 09   	STA $09    
0x03DEA7|$0F:$DE97:68      	PLA        
0x03DEA8|$0F:$DE98:A8      	TAY        
0x03DEA9|$0F:$DE99:60      	RTS        

; control flow target (from $E71C, $E81A)
0x03DEAA|$0F:$DE9A:20 62 DF	JSR $DF62  
0x03DEAD|$0F:$DE9D:4C A6 DE	JMP $DEA6  

0x03DEB0|$0F:$DEA0:20 40 DE	JSR $DE40  
0x03DEB3|$0F:$DEA3:4C A9 DE	JMP $DEA9  

; control flow target (from $DE9D)
0x03DEB6|$0F:$DEA6:20 44 DE	JSR $DE44  
; control flow target (from $DEA3)
0x03DEB9|$0F:$DEA9:98      	TYA        
0x03DEBA|$0F:$DEAA:48      	PHA        
0x03DEBB|$0F:$DEAB:A0 00   	LDY #$00   
0x03DEBD|$0F:$DEAD:B1 07   	LDA ($07),Y
0x03DEBF|$0F:$DEAF:85 09   	STA $09    
0x03DEC1|$0F:$DEB1:68      	PLA        
0x03DEC2|$0F:$DEB2:A8      	TAY        
0x03DEC3|$0F:$DEB3:A5 08   	LDA $08    
0x03DEC5|$0F:$DEB5:18      	CLC        
0x03DEC6|$0F:$DEB6:69 20   	ADC #$20   
0x03DEC8|$0F:$DEB8:85 08   	STA $08    
0x03DECA|$0F:$DEBA:4C FA C1	JMP $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


; code -> data
; indexed data load target (from $DF54, $DF5A, $E951, $E957)
0x03DECD|$0F:$DEBD:CB 83	; $02:$83CB
0x03DECF|$0F:$DEBF:6B 84	; $02:$846B
0x03DED1|$0F:$DEC1:33 85	; $02:$8533
; indirect data load target
0x03DED3|$0F:$DEC3:FB 85	; $02:$85FB

; data -> code
; control flow target (from $CAE1, $D092, $D0DF, $D256, $D325, $E2C5, $E2D7, $E5F5, $E669, $E6F5, $E74C, $E7F3, $E84A)
0x03DED5|$0F:$DEC5:20 FC EA	JSR $EAFC  
0x03DED8|$0F:$DEC8:90 01   	BCC $DECB  
0x03DEDA|$0F:$DECA:60      	RTS        

; control flow target (from $DEC8)
0x03DEDB|$0F:$DECB:20 4A DF	JSR $DF4A  
0x03DEDE|$0F:$DECE:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03DEE1|$0F:$DED1:A0 00   	LDY #$00   
0x03DEE3|$0F:$DED3:B1 10   	LDA ($10),Y
0x03DEE5|$0F:$DED5:85 09   	STA $09    
0x03DEE7|$0F:$DED7: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
0x03DEEA|$0F:$DEDA:A5 1C   	LDA $1C    
0x03DEEC|$0F:$DEDC:4A      	LSR        
0x03DEED|$0F:$DEDD:90 03   	BCC $DEE2  
0x03DEEF|$0F:$DEDF:20 41 DF	JSR $DF41  
; control flow target (from $DEDD)
0x03DEF2|$0F:$DEE2:C8      	INY        
0x03DEF3|$0F:$DEE3:B1 10   	LDA ($10),Y
0x03DEF5|$0F:$DEE5:85 09   	STA $09    
0x03DEF7|$0F:$DEE7: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
0x03DEFA|$0F:$DEEA:A5 1C   	LDA $1C    
0x03DEFC|$0F:$DEEC:29 02   	AND #$02   
0x03DEFE|$0F:$DEEE:F0 03   	BEQ $DEF3  
0x03DF00|$0F:$DEF0:20 41 DF	JSR $DF41  
; control flow target (from $DEEE)
0x03DF03|$0F:$DEF3:C8      	INY        
0x03DF04|$0F:$DEF4:A5 07   	LDA $07    
0x03DF06|$0F:$DEF6:18      	CLC        
0x03DF07|$0F:$DEF7:69 1E   	ADC #$1E   
0x03DF09|$0F:$DEF9:85 07   	STA $07    
0x03DF0B|$0F:$DEFB:90 02   	BCC $DEFF  
0x03DF0D|$0F:$DEFD:E6 08   	INC $08    
; control flow target (from $DEFB)
0x03DF0F|$0F:$DEFF:B1 10   	LDA ($10),Y
0x03DF11|$0F:$DF01:85 09   	STA $09    
0x03DF13|$0F:$DF03: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
0x03DF16|$0F:$DF06:A5 1C   	LDA $1C    
0x03DF18|$0F:$DF08:29 04   	AND #$04   
0x03DF1A|$0F:$DF0A:F0 03   	BEQ $DF0F  
0x03DF1C|$0F:$DF0C:20 41 DF	JSR $DF41  
; control flow target (from $DF0A)
0x03DF1F|$0F:$DF0F:C8      	INY        
0x03DF20|$0F:$DF10:B1 10   	LDA ($10),Y
0x03DF22|$0F:$DF12:85 09   	STA $09    
0x03DF24|$0F:$DF14: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
0x03DF27|$0F:$DF17:A5 1C   	LDA $1C    
0x03DF29|$0F:$DF19:29 08   	AND #$08   
0x03DF2B|$0F:$DF1B:F0 03   	BEQ $DF20  
0x03DF2D|$0F:$DF1D:20 41 DF	JSR $DF41  
; control flow target (from $DF1B)
0x03DF30|$0F:$DF20:C8      	INY        
0x03DF31|$0F:$DF21:B1 10   	LDA ($10),Y
0x03DF33|$0F:$DF23:29 03   	AND #$03   
0x03DF35|$0F:$DF25:85 09   	STA $09    
0x03DF37|$0F:$DF27:A5 1A   	LDA $1A    
0x03DF39|$0F:$DF29:85 0C   	STA $0C    
0x03DF3B|$0F:$DF2B:A5 1B   	LDA $1B    
0x03DF3D|$0F:$DF2D:85 0E   	STA $0E    
0x03DF3F|$0F:$DF2F:20 6E DE	JSR $DE6E  
0x03DF42|$0F:$DF32:A5 1E   	LDA $1E    
0x03DF44|$0F:$DF34:D0 0A   	BNE $DF40  
0x03DF46|$0F:$DF36:A5 08   	LDA $08    
0x03DF48|$0F:$DF38:18      	CLC        
0x03DF49|$0F:$DF39:69 20   	ADC #$20   
0x03DF4B|$0F:$DF3B:85 08   	STA $08    
0x03DF4D|$0F:$DF3D: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
; control flow target (from $DF34)
0x03DF50|$0F:$DF40:60      	RTS        

; control flow target (from $DEDF, $DEF0, $DF0C, $DF1D)
0x03DF51|$0F:$DF41:C6 02   	DEC $02    
0x03DF53|$0F:$DF43:C6 02   	DEC $02    
0x03DF55|$0F:$DF45:C6 02   	DEC $02    
0x03DF57|$0F:$DF47:C6 01   	DEC $01    
0x03DF59|$0F:$DF49:60      	RTS        

; control flow target (from $D366, $DAA9, $DECB, $E3E5)
0x03DF5A|$0F:$DF4A:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03DF5C|$0F:$DF4C:0A      	ASL        
0x03DF5D|$0F:$DF4D:A8      	TAY        
0x03DF5E|$0F:$DF4E:A5 0C   	LDA $0C    
0x03DF60|$0F:$DF50:0A      	ASL        
0x03DF61|$0F:$DF51:0A      	ASL        
0x03DF62|$0F:$DF52:65 0C   	ADC $0C    
0x03DF64|$0F:$DF54:79 BD DE	ADC $DEBD,Y
0x03DF67|$0F:$DF57:85 10   	STA $10    
0x03DF69|$0F:$DF59:C8      	INY        
0x03DF6A|$0F:$DF5A:B9 BD DE	LDA $DEBD,Y
0x03DF6D|$0F:$DF5D:69 00   	ADC #$00   
0x03DF6F|$0F:$DF5F:85 11   	STA $11    
0x03DF71|$0F:$DF61:60      	RTS        

; control flow target (from $DE9A, $EAFC)
; external control flow target (from $02:$B116)
0x03DF72|$0F:$DF62:A5 15   	LDA $15    
0x03DF74|$0F:$DF64:0A      	ASL        
0x03DF75|$0F:$DF65:18      	CLC        
0x03DF76|$0F:$DF66:65 19   	ADC $19    
0x03DF78|$0F:$DF68:18      	CLC        
0x03DF79|$0F:$DF69:69 1E   	ADC #$1E   
0x03DF7B|$0F:$DF6B:85 0C   	STA $0C    
0x03DF7D|$0F:$DF6D:A9 1E   	LDA #$1E   
0x03DF7F|$0F:$DF6F:85 0E   	STA $0E    
0x03DF81|$0F:$DF71:20 93 C3	JSR $C393  
0x03DF84|$0F:$DF74:85 0E   	STA $0E    
0x03DF86|$0F:$DF76:A5 14   	LDA $14    
0x03DF88|$0F:$DF78:0A      	ASL        
0x03DF89|$0F:$DF79:18      	CLC        
0x03DF8A|$0F:$DF7A:65 18   	ADC $18    
0x03DF8C|$0F:$DF7C:29 3F   	AND #$3F   
0x03DF8E|$0F:$DF7E:85 0C   	STA $0C    
0x03DF90|$0F:$DF80:60      	RTS        


; code -> data
; data load target (from $E0CB)
0x03DF91|$0F:$DF81:95
; data load target (from $E0D2)
0x03DF92|$0F:$DF82:   9D	; $03:$9D95

; data -> code
; external control flow target (from $02:$B266)
0x03DF93|$0F:$DF83:20 89 DF	JSR $DF89  
0x03DF96|$0F:$DF86:4C 70 F7	JMP $F770  	; load ROM bank #$02

; control flow target (from $CFA8, $D0A3, $D363, $D680, $DA9E, $DF83, $E3E2, $EB20, $F95D)
0x03DF99|$0F:$DF89:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03DF9B|$0F:$DF8B:C9 02   	CMP #$02   
0x03DF9D|$0F:$DF8D:90 18   	BCC $DFA7  
0x03DF9F|$0F:$DF8F:A5 0E   	LDA $0E    
0x03DFA1|$0F:$DF91:48      	PHA        
0x03DFA2|$0F:$DF92:A5 0C   	LDA $0C    
0x03DFA4|$0F:$DF94:48      	PHA        
0x03DFA5|$0F:$DF95:46 0C   	LSR $0C    
0x03DFA7|$0F:$DF97:46 0E   	LSR $0E    
0x03DFA9|$0F:$DF99:20 A7 DF	JSR $DFA7  
0x03DFAC|$0F:$DF9C:68      	PLA        
0x03DFAD|$0F:$DF9D:4A      	LSR        
0x03DFAE|$0F:$DF9E:68      	PLA        
0x03DFAF|$0F:$DF9F:2A      	ROL        
0x03DFB0|$0F:$DFA0:29 03   	AND #$03   
0x03DFB2|$0F:$DFA2:05 0C   	ORA $0C    
0x03DFB4|$0F:$DFA4:85 0C   	STA $0C    
0x03DFB6|$0F:$DFA6:60      	RTS        

; control flow target (from $DF8D, $DF99)
0x03DFB7|$0F:$DFA7:A5 0C   	LDA $0C    
0x03DFB9|$0F:$DFA9:85 12   	STA $12    
0x03DFBB|$0F:$DFAB:A5 0E   	LDA $0E    
0x03DFBD|$0F:$DFAD:85 13   	STA $13    
0x03DFBF|$0F:$DFAF:A5 21   	LDA $21    	; map width
0x03DFC1|$0F:$DFB1:C5 0C   	CMP $0C    
0x03DFC3|$0F:$DFB3:B0 05   	BCS $DFBA  
; control flow target (from $DFBE)
0x03DFC5|$0F:$DFB5:A5 20   	LDA $20    	; map exterior border tile ID (#$00 = Road, #$01 = Grass, #$02 = Sand, #$03 = Tree, #$04 = Water, #$05 = Vertical Wall, #$06 = Shrub, #$07 = Horizontal Wall, #$08 = Swamp, ..., #$20 = Ceiling Alternating?, #$21 = Ceiling Down?, #$24 = Black?, #$28 = Blue?)
0x03DFC7|$0F:$DFB7:85 0C   	STA $0C    
0x03DFC9|$0F:$DFB9:60      	RTS        

; control flow target (from $DFB3)
0x03DFCA|$0F:$DFBA:A5 22   	LDA $22    	; map height
0x03DFCC|$0F:$DFBC:C5 0E   	CMP $0E    
0x03DFCE|$0F:$DFBE:90 F5   	BCC $DFB5  
0x03DFD0|$0F:$DFC0:98      	TYA        
0x03DFD1|$0F:$DFC1:48      	PHA        
0x03DFD2|$0F:$DFC2:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03DFD4|$0F:$DFC4:F0 03   	BEQ $DFC9  
0x03DFD6|$0F:$DFC6:4C 69 E1	JMP $E169  

; control flow target (from $DFC4)
0x03DFD9|$0F:$DFC9:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03DFDC|$0F:$DFCC:A5 D0   	LDA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x03DFDE|$0F:$DFCE:F0 19   	BEQ $DFE9  
0x03DFE0|$0F:$DFD0:A5 12   	LDA $12    
0x03DFE2|$0F:$DFD2:C9 5E   	CMP #$5E   
0x03DFE4|$0F:$DFD4:90 13   	BCC $DFE9  
0x03DFE6|$0F:$DFD6:C9 60   	CMP #$60   
0x03DFE8|$0F:$DFD8:B0 0F   	BCS $DFE9  
0x03DFEA|$0F:$DFDA:A5 13   	LDA $13    
0x03DFEC|$0F:$DFDC:C9 A4   	CMP #$A4   
0x03DFEE|$0F:$DFDE:90 09   	BCC $DFE9  
0x03DFF0|$0F:$DFE0:C9 A6   	CMP #$A6   
0x03DFF2|$0F:$DFE2:B0 05   	BCS $DFE9  
0x03DFF4|$0F:$DFE4:A9 02   	LDA #$02   
0x03DFF6|$0F:$DFE6:4C 87 E0	JMP $E087  

; control flow target (from $DFCE, $DFD4, $DFD8, $DFDE, $DFE2)
0x03DFF9|$0F:$DFE9:A5 CE   	LDA $CE    	; Tuhn Watergate open flag (#$00 = closed, #$01 = open)
0x03DFFB|$0F:$DFEB:F0 13   	BEQ $E000  
0x03DFFD|$0F:$DFED:A5 12   	LDA $12    
0x03DFFF|$0F:$DFEF:C9 44   	CMP #$44   
0x03E001|$0F:$DFF1:D0 0D   	BNE $E000  
0x03E003|$0F:$DFF3:A5 13   	LDA $13    
0x03E005|$0F:$DFF5:C9 86   	CMP #$86   
0x03E007|$0F:$DFF7:90 07   	BCC $E000  
0x03E009|$0F:$DFF9:C9 89   	CMP #$89   
0x03E00B|$0F:$DFFB:B0 03   	BCS $E000  
0x03E00D|$0F:$DFFD:4C 85 E0	JMP $E085  

; control flow target (from $DFEB, $DFF1, $DFF7, $DFFB)
0x03E010|$0F:$E000:AD F9 05	LDA $05F9  	; flag for Cave to Rhone open
0x03E013|$0F:$E003:D0 10   	BNE $E015  
0x03E015|$0F:$E005:A5 12   	LDA $12    
0x03E017|$0F:$E007:C9 73   	CMP #$73   
0x03E019|$0F:$E009:D0 0A   	BNE $E015  
0x03E01B|$0F:$E00B:A5 13   	LDA $13    
0x03E01D|$0F:$E00D:C9 C5   	CMP #$C5   
0x03E01F|$0F:$E00F:D0 04   	BNE $E015  
0x03E021|$0F:$E011:A9 05   	LDA #$05   
0x03E023|$0F:$E013:D0 72   	BNE $E087  
; control flow target (from $E003, $E009, $E00F)
0x03E025|$0F:$E015:20 C0 E0	JSR $E0C0  
0x03E028|$0F:$E018:C9 04   	CMP #$04   
0x03E02A|$0F:$E01A:F0 03   	BEQ $E01F  
0x03E02C|$0F:$E01C:68      	PLA        
0x03E02D|$0F:$E01D:A8      	TAY        
0x03E02E|$0F:$E01E:60      	RTS        

; control flow target (from $E01A)
0x03E02F|$0F:$E01F:A0 00   	LDY #$00   
0x03E031|$0F:$E021:84 D4   	STY $D4    
0x03E033|$0F:$E023:8C F4 05	STY $05F4  
; control flow target (from $E057)
0x03E036|$0F:$E026:B9 B4 E0	LDA $E0B4,Y
0x03E039|$0F:$E029:18      	CLC        
0x03E03A|$0F:$E02A:65 12   	ADC $12    
0x03E03C|$0F:$E02C:85 0C   	STA $0C    
0x03E03E|$0F:$E02E:B9 B8 E0	LDA $E0B8,Y
0x03E041|$0F:$E031:18      	CLC        
0x03E042|$0F:$E032:65 13   	ADC $13    
0x03E044|$0F:$E034:85 0E   	STA $0E    
0x03E046|$0F:$E036:20 C0 E0	JSR $E0C0  
0x03E049|$0F:$E039:C9 04   	CMP #$04   
0x03E04B|$0F:$E03B:F0 12   	BEQ $E04F  
0x03E04D|$0F:$E03D:C9 09   	CMP #$09   
0x03E04F|$0F:$E03F:F0 0E   	BEQ $E04F  
0x03E051|$0F:$E041:C9 0D   	CMP #$0D   
0x03E053|$0F:$E043:F0 0A   	BEQ $E04F  
0x03E055|$0F:$E045:AC F4 05	LDY $05F4  
0x03E058|$0F:$E048:B9 BC E0	LDA $E0BC,Y
0x03E05B|$0F:$E04B:05 D4   	ORA $D4    
0x03E05D|$0F:$E04D:85 D4   	STA $D4    
; control flow target (from $E03B, $E03F, $E043)
0x03E05F|$0F:$E04F:EE F4 05	INC $05F4  
0x03E062|$0F:$E052:AC F4 05	LDY $05F4  
0x03E065|$0F:$E055:C0 04   	CPY #$04   
0x03E067|$0F:$E057:D0 CD   	BNE $E026  
0x03E069|$0F:$E059:A4 D4   	LDY $D4    
0x03E06B|$0F:$E05B:B9 8C E0	LDA $E08C,Y
0x03E06E|$0F:$E05E:85 D4   	STA $D4    
0x03E070|$0F:$E060:30 23   	BMI $E085  
0x03E072|$0F:$E062:C9 15   	CMP #$15   
0x03E074|$0F:$E064:B0 21   	BCS $E087  
0x03E076|$0F:$E066:A8      	TAY        
0x03E077|$0F:$E067:B9 9C E0	LDA $E09C,Y
0x03E07A|$0F:$E06A:18      	CLC        
0x03E07B|$0F:$E06B:65 12   	ADC $12    
0x03E07D|$0F:$E06D:85 0C   	STA $0C    
0x03E07F|$0F:$E06F:B9 A4 E0	LDA $E0A4,Y
0x03E082|$0F:$E072:18      	CLC        
0x03E083|$0F:$E073:65 13   	ADC $13    
0x03E085|$0F:$E075:85 0E   	STA $0E    
0x03E087|$0F:$E077:20 C0 E0	JSR $E0C0  
0x03E08A|$0F:$E07A:C9 04   	CMP #$04   
0x03E08C|$0F:$E07C:D0 07   	BNE $E085  
0x03E08E|$0F:$E07E:A4 D4   	LDY $D4    
0x03E090|$0F:$E080:B9 AC E0	LDA $E0AC,Y
0x03E093|$0F:$E083:D0 02   	BNE $E087  
; control flow target (from $DFFD, $E060, $E07C, $E191)
0x03E095|$0F:$E085:A9 04   	LDA #$04   
; control flow target (from $DFE6, $E013, $E064, $E083, $E174)
0x03E097|$0F:$E087:85 0C   	STA $0C    
0x03E099|$0F:$E089:68      	PLA        
0x03E09A|$0F:$E08A:A8      	TAY        
0x03E09B|$0F:$E08B:60      	RTS        


; code -> data
; indexed data load target (from $E05B)
0x03E09C|$0F:$E08C:FF
0x03E09D|$0F:$E08D:04
0x03E09E|$0F:$E08E:05
0x03E09F|$0F:$E08F:00
0x03E0A0|$0F:$E090:06
0x03E0A1|$0F:$E091:FF
0x03E0A2|$0F:$E092:01
0x03E0A3|$0F:$E093:FF
0x03E0A4|$0F:$E094:07
0x03E0A5|$0F:$E095:02
0x03E0A6|$0F:$E096:FF
; indirect data load target
0x03E0A7|$0F:$E097:FF
0x03E0A8|$0F:$E098:03
0x03E0A9|$0F:$E099:FF
0x03E0AA|$0F:$E09A:FF
; indirect data load target
0x03E0AB|$0F:$E09B:FF
; indexed data load target (from $E067)
0x03E0AC|$0F:$E09C:FF
0x03E0AD|$0F:$E09D:FF
0x03E0AE|$0F:$E09E:01
0x03E0AF|$0F:$E09F:01
0x03E0B0|$0F:$E0A0:01
0x03E0B1|$0F:$E0A1:FF
0x03E0B2|$0F:$E0A2:FF
0x03E0B3|$0F:$E0A3:01
; indexed data load target (from $E06F)
0x03E0B4|$0F:$E0A4:01
0x03E0B5|$0F:$E0A5:FF
0x03E0B6|$0F:$E0A6:01
0x03E0B7|$0F:$E0A7:FF
0x03E0B8|$0F:$E0A8:01
0x03E0B9|$0F:$E0A9:01
0x03E0BA|$0F:$E0AA:FF
0x03E0BB|$0F:$E0AB:FF
; indexed data load target (from $E080)
0x03E0BC|$0F:$E0AC:16
0x03E0BD|$0F:$E0AD:1B
0x03E0BE|$0F:$E0AE:14
0x03E0BF|$0F:$E0AF:19
0x03E0C0|$0F:$E0B0:15
0x03E0C1|$0F:$E0B1:18
0x03E0C2|$0F:$E0B2:1A
0x03E0C3|$0F:$E0B3:17
; indexed data load target (from $E026)
0x03E0C4|$0F:$E0B4:00
0x03E0C5|$0F:$E0B5:01
0x03E0C6|$0F:$E0B6:00
0x03E0C7|$0F:$E0B7:FF
; indexed data load target (from $E02E)
0x03E0C8|$0F:$E0B8:FF
0x03E0C9|$0F:$E0B9:00
0x03E0CA|$0F:$E0BA:01
0x03E0CB|$0F:$E0BB:00
; indexed data load target (from $E048)
0x03E0CC|$0F:$E0BC:01
0x03E0CD|$0F:$E0BD:02
0x03E0CE|$0F:$E0BE:04
0x03E0CF|$0F:$E0BF:08

; data -> code
; control flow target (from $E015, $E036, $E077)
; indirect data load target
; WARNING! $E0C0 was also seen as data
0x03E0D0|$0F:$E0C0:A9   
; WARNING! $E0C1 was also seen as data
0x03E0D1|$0F:$E0C1:   00   	LDA #$00   
0x03E0D2|$0F:$E0C2:85 0F   	STA $0F    
0x03E0D4|$0F:$E0C4:06 0E   	ASL $0E    
0x03E0D6|$0F:$E0C6:26 0F   	ROL $0F    
0x03E0D8|$0F:$E0C8:A5 0E   	LDA $0E    
0x03E0DA|$0F:$E0CA:18      	CLC        
0x03E0DB|$0F:$E0CB:6D 81 DF	ADC $DF81  
0x03E0DE|$0F:$E0CE:85 0E   	STA $0E    
0x03E0E0|$0F:$E0D0:A5 0F   	LDA $0F    
0x03E0E2|$0F:$E0D2:6D 82 DF	ADC $DF82  
0x03E0E5|$0F:$E0D5:85 0F   	STA $0F    
0x03E0E7|$0F:$E0D7:A0 00   	LDY #$00   
0x03E0E9|$0F:$E0D9:B1 0E   	LDA ($0E),Y
0x03E0EB|$0F:$E0DB:85 10   	STA $10    
0x03E0ED|$0F:$E0DD:C8      	INY        
0x03E0EE|$0F:$E0DE:B1 0E   	LDA ($0E),Y
0x03E0F0|$0F:$E0E0:85 11   	STA $11    
0x03E0F2|$0F:$E0E2:A5 0C   	LDA $0C    
0x03E0F4|$0F:$E0E4:C9 80   	CMP #$80   
0x03E0F6|$0F:$E0E6:90 2A   	BCC $E112  
0x03E0F8|$0F:$E0E8:49 FF   	EOR #$FF   
0x03E0FA|$0F:$E0EA:85 0C   	STA $0C    
0x03E0FC|$0F:$E0EC:C8      	INY        
0x03E0FD|$0F:$E0ED:B1 0E   	LDA ($0E),Y
0x03E0FF|$0F:$E0EF:18      	CLC        
0x03E100|$0F:$E0F0:E5 10   	SBC $10    
0x03E102|$0F:$E0F2:A8      	TAY        
0x03E103|$0F:$E0F3:A9 00   	LDA #$00   
0x03E105|$0F:$E0F5:85 0D   	STA $0D    
; control flow target (from $E10F)
0x03E107|$0F:$E0F7:B1 10   	LDA ($10),Y
0x03E109|$0F:$E0F9:E6 0D   	INC $0D    
0x03E10B|$0F:$E0FB:29 E0   	AND #$E0   
0x03E10D|$0F:$E0FD:F0 09   	BEQ $E108  
0x03E10F|$0F:$E0FF:B1 10   	LDA ($10),Y
0x03E111|$0F:$E101:29 1F   	AND #$1F   
0x03E113|$0F:$E103:18      	CLC        
0x03E114|$0F:$E104:65 0D   	ADC $0D    
0x03E116|$0F:$E106:85 0D   	STA $0D    
; control flow target (from $E0FD)
0x03E118|$0F:$E108:A5 0C   	LDA $0C    
0x03E11A|$0F:$E10A:C5 0D   	CMP $0D    
0x03E11C|$0F:$E10C:90 22   	BCC $E130  
0x03E11E|$0F:$E10E:88      	DEY        
0x03E11F|$0F:$E10F:4C F7 E0	JMP $E0F7  

; control flow target (from $E0E6)
0x03E122|$0F:$E112:88      	DEY        
0x03E123|$0F:$E113:84 0D   	STY $0D    
; control flow target (from $E12D)
0x03E125|$0F:$E115:B1 10   	LDA ($10),Y
0x03E127|$0F:$E117:E6 0D   	INC $0D    
0x03E129|$0F:$E119:29 E0   	AND #$E0   
0x03E12B|$0F:$E11B:F0 09   	BEQ $E126  
0x03E12D|$0F:$E11D:B1 10   	LDA ($10),Y
0x03E12F|$0F:$E11F:29 1F   	AND #$1F   
0x03E131|$0F:$E121:18      	CLC        
0x03E132|$0F:$E122:65 0D   	ADC $0D    
0x03E134|$0F:$E124:85 0D   	STA $0D    
; control flow target (from $E11B)
0x03E136|$0F:$E126:A5 0C   	LDA $0C    
0x03E138|$0F:$E128:C5 0D   	CMP $0D    
0x03E13A|$0F:$E12A:90 04   	BCC $E130  
0x03E13C|$0F:$E12C:C8      	INY        
0x03E13D|$0F:$E12D:4C 15 E1	JMP $E115  

; control flow target (from $E10C, $E12A)
0x03E140|$0F:$E130:B1 10   	LDA ($10),Y
0x03E142|$0F:$E132:29 E0   	AND #$E0   
0x03E144|$0F:$E134:D0 2C   	BNE $E162  
0x03E146|$0F:$E136:B1 10   	LDA ($10),Y
0x03E148|$0F:$E138:29 1F   	AND #$1F   
; control flow target (from $E167)
0x03E14A|$0F:$E13A:85 0C   	STA $0C    
0x03E14C|$0F:$E13C:AD F8 05	LDA $05F8  	; Sea Cave shoal status (#$00 = shoals up, others = shoals down)
0x03E14F|$0F:$E13F:F0 1E   	BEQ $E15F  
0x03E151|$0F:$E141:A5 12   	LDA $12    
0x03E153|$0F:$E143:C9 B2   	CMP #$B2   
0x03E155|$0F:$E145:90 18   	BCC $E15F  
0x03E157|$0F:$E147:C9 B9   	CMP #$B9   
0x03E159|$0F:$E149:B0 14   	BCS $E15F  
0x03E15B|$0F:$E14B:A5 13   	LDA $13    
0x03E15D|$0F:$E14D:C9 A3   	CMP #$A3   
0x03E15F|$0F:$E14F:90 0E   	BCC $E15F  
0x03E161|$0F:$E151:C9 AC   	CMP #$AC   
0x03E163|$0F:$E153:B0 0A   	BCS $E15F  
0x03E165|$0F:$E155:A5 0C   	LDA $0C    
0x03E167|$0F:$E157:C9 13   	CMP #$13   
0x03E169|$0F:$E159:90 04   	BCC $E15F  
0x03E16B|$0F:$E15B:A9 04   	LDA #$04   
0x03E16D|$0F:$E15D:85 0C   	STA $0C    
; control flow target (from $E13F, $E145, $E149, $E14F, $E153, $E159)
0x03E16F|$0F:$E15F:A5 0C   	LDA $0C    
0x03E171|$0F:$E161:60      	RTS        

; control flow target (from $E134)
0x03E172|$0F:$E162:4A      	LSR        
0x03E173|$0F:$E163:4A      	LSR        
0x03E174|$0F:$E164:4A      	LSR        
0x03E175|$0F:$E165:4A      	LSR        
0x03E176|$0F:$E166:4A      	LSR        
0x03E177|$0F:$E167:90 D1   	BCC $E13A  
; control flow target (from $DFC6)
0x03E179|$0F:$E169:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03E17C|$0F:$E16C:A5 D0   	LDA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x03E17E|$0F:$E16E:30 07   	BMI $E177  
0x03E180|$0F:$E170:F0 05   	BEQ $E177  
0x03E182|$0F:$E172:A9 17   	LDA #$17   
0x03E184|$0F:$E174:4C 87 E0	JMP $E087  

; control flow target (from $E16E, $E170)
0x03E187|$0F:$E177:A5 31   	LDA $31    	; current map ID
0x03E189|$0F:$E179:C9 12   	CMP #$12   	; Map ID #$12: Tuhn Watergate
0x03E18B|$0F:$E17B:D0 17   	BNE $E194  
0x03E18D|$0F:$E17D:A5 CE   	LDA $CE    	; Tuhn Watergate open flag (#$00 = closed, #$01 = open)
0x03E18F|$0F:$E17F:F0 13   	BEQ $E194  
0x03E191|$0F:$E181:A5 13   	LDA $13    
0x03E193|$0F:$E183:C9 05   	CMP #$05   
0x03E195|$0F:$E185:D0 0D   	BNE $E194  
0x03E197|$0F:$E187:A5 12   	LDA $12    
0x03E199|$0F:$E189:C9 02   	CMP #$02   
0x03E19B|$0F:$E18B:F0 04   	BEQ $E191  
0x03E19D|$0F:$E18D:C9 03   	CMP #$03   
0x03E19F|$0F:$E18F:D0 03   	BNE $E194  
; control flow target (from $E18B)
0x03E1A1|$0F:$E191:4C 85 E0	JMP $E085  

; control flow target (from $E17B, $E17F, $E185, $E18F)
0x03E1A4|$0F:$E194:A9 00   	LDA #$00   
0x03E1A6|$0F:$E196:85 0D   	STA $0D    
0x03E1A8|$0F:$E198:85 0F   	STA $0F    
0x03E1AA|$0F:$E19A:A4 21   	LDY $21    	; map width
0x03E1AC|$0F:$E19C:C8      	INY        
0x03E1AD|$0F:$E19D:84 0C   	STY $0C    
0x03E1AF|$0F:$E19F:20 39 C3	JSR $C339  	; 16-bit multiplication: ($10-$11) = ($0C-$0D) * ($0E-$0F); consumes $0C-$0F
0x03E1B2|$0F:$E1A2:A5 12   	LDA $12    
0x03E1B4|$0F:$E1A4:18      	CLC        
0x03E1B5|$0F:$E1A5:65 10   	ADC $10    
0x03E1B7|$0F:$E1A7:85 10   	STA $10    
0x03E1B9|$0F:$E1A9:85 0E   	STA $0E    
0x03E1BB|$0F:$E1AB:A5 11   	LDA $11    
0x03E1BD|$0F:$E1AD:69 00   	ADC #$00   
0x03E1BF|$0F:$E1AF:85 0F   	STA $0F    
0x03E1C1|$0F:$E1B1:18      	CLC        
0x03E1C2|$0F:$E1B2:69 78   	ADC #$78   
0x03E1C4|$0F:$E1B4:85 11   	STA $11    
0x03E1C6|$0F:$E1B6:A0 00   	LDY #$00   
0x03E1C8|$0F:$E1B8:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E1CA|$0F:$E1BA:C9 02   	CMP #$02   
0x03E1CC|$0F:$E1BC:B0 07   	BCS $E1C5  
0x03E1CE|$0F:$E1BE:B1 10   	LDA ($10),Y
0x03E1D0|$0F:$E1C0:29 1F   	AND #$1F   
0x03E1D2|$0F:$E1C2:4C CB E1	JMP $E1CB  

; control flow target (from $E1BC)
0x03E1D5|$0F:$E1C5:B1 10   	LDA ($10),Y
0x03E1D7|$0F:$E1C7:29 1F   	AND #$1F   
0x03E1D9|$0F:$E1C9:0A      	ASL        
0x03E1DA|$0F:$E1CA:0A      	ASL        
; control flow target (from $E1C2)
0x03E1DB|$0F:$E1CB:85 0C   	STA $0C    
0x03E1DD|$0F:$E1CD:C9 14   	CMP #$14   
0x03E1DF|$0F:$E1CF:D0 1E   	BNE $E1EF  
0x03E1E1|$0F:$E1D1:A0 00   	LDY #$00   
; control flow target (from $E1ED)
0x03E1E3|$0F:$E1D3:A5 12   	LDA $12    
0x03E1E5|$0F:$E1D5:D9 1A 05	CMP $051A,Y	; something to do with whether you've opened the chest containing the Shield of Erdrick
0x03E1E8|$0F:$E1D8:D0 0F   	BNE $E1E9  
0x03E1EA|$0F:$E1DA:C8      	INY        
0x03E1EB|$0F:$E1DB:A5 13   	LDA $13    
0x03E1ED|$0F:$E1DD:D9 1A 05	CMP $051A,Y	; something to do with whether you've opened the chest containing the Shield of Erdrick
0x03E1F0|$0F:$E1E0:D0 08   	BNE $E1EA  
; control flow target (from $E20E)
0x03E1F2|$0F:$E1E2:A9 00   	LDA #$00   
0x03E1F4|$0F:$E1E4:85 0C   	STA $0C    
; control flow target (from $E1FB, $E216)
0x03E1F6|$0F:$E1E6:68      	PLA        
0x03E1F7|$0F:$E1E7:A8      	TAY        
0x03E1F8|$0F:$E1E8:60      	RTS        

; control flow target (from $E1D8)
0x03E1F9|$0F:$E1E9:C8      	INY        
; control flow target (from $E1E0)
0x03E1FA|$0F:$E1EA:C8      	INY        
0x03E1FB|$0F:$E1EB:C0 10   	CPY #$10   
0x03E1FD|$0F:$E1ED:D0 E4   	BNE $E1D3  
; control flow target (from $E1CF)
0x03E1FF|$0F:$E1EF:A5 0C   	LDA $0C    
0x03E201|$0F:$E1F1:C9 18   	CMP #$18   
0x03E203|$0F:$E1F3:F0 08   	BEQ $E1FD  
0x03E205|$0F:$E1F5:C9 19   	CMP #$19   
0x03E207|$0F:$E1F7:F0 04   	BEQ $E1FD  
0x03E209|$0F:$E1F9:C9 1A   	CMP #$1A   
0x03E20B|$0F:$E1FB:D0 E9   	BNE $E1E6  
; control flow target (from $E1F3, $E1F7)
0x03E20D|$0F:$E1FD:A0 00   	LDY #$00   
; control flow target (from $E214)
0x03E20F|$0F:$E1FF:A5 12   	LDA $12    
0x03E211|$0F:$E201:D9 2A 05	CMP $052A,Y
0x03E214|$0F:$E204:D0 0A   	BNE $E210  
0x03E216|$0F:$E206:C8      	INY        
0x03E217|$0F:$E207:A5 13   	LDA $13    
0x03E219|$0F:$E209:D9 2A 05	CMP $052A,Y
0x03E21C|$0F:$E20C:D0 03   	BNE $E211  
0x03E21E|$0F:$E20E:F0 D2   	BEQ $E1E2  
; control flow target (from $E204)
0x03E220|$0F:$E210:C8      	INY        
; control flow target (from $E20C)
0x03E221|$0F:$E211:C8      	INY        
0x03E222|$0F:$E212:C0 10   	CPY #$10   
0x03E224|$0F:$E214:D0 E9   	BNE $E1FF  
0x03E226|$0F:$E216:F0 CE   	BEQ $E1E6  
; control flow target (from $D9BD, $DB74, $E882, $E92D)
0x03E228|$0F:$E218:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E22A|$0F:$E21A:C9 02   	CMP #$02   
0x03E22C|$0F:$E21C:90 04   	BCC $E222  
0x03E22E|$0F:$E21E:46 12   	LSR $12    
0x03E230|$0F:$E220:46 13   	LSR $13    
; control flow target (from $DAA1, $E21C, $E3F3, $EB23, $F960)
0x03E232|$0F:$E222:A5 25   	LDA $25    	; map header byte 5
0x03E234|$0F:$E224:05 26   	ORA $26    	; map header byte 6, always #$00
0x03E236|$0F:$E226:D0 05   	BNE $E22D  
; control flow target (from $E231, $E237)
0x03E238|$0F:$E228:A9 00   	LDA #$00   
0x03E23A|$0F:$E22A:85 0D   	STA $0D    
0x03E23C|$0F:$E22C:60      	RTS        

; control flow target (from $E226)
0x03E23D|$0F:$E22D:A5 21   	LDA $21    	; map width
0x03E23F|$0F:$E22F:C5 12   	CMP $12    
0x03E241|$0F:$E231:90 F5   	BCC $E228  
0x03E243|$0F:$E233:A5 22   	LDA $22    	; map height
0x03E245|$0F:$E235:C5 13   	CMP $13    
0x03E247|$0F:$E237:90 EF   	BCC $E228  
0x03E249|$0F:$E239:98      	TYA        
0x03E24A|$0F:$E23A:48      	PHA        
0x03E24B|$0F:$E23B:8A      	TXA        
0x03E24C|$0F:$E23C:48      	PHA        
0x03E24D|$0F:$E23D:A6 21   	LDX $21    	; map width
0x03E24F|$0F:$E23F:E8      	INX        
0x03E250|$0F:$E240:86 74   	STX $74    
0x03E252|$0F:$E242:A9 00   	LDA #$00   
0x03E254|$0F:$E244:85 72   	STA $72    
0x03E256|$0F:$E246:A2 78   	LDX #$78   
0x03E258|$0F:$E248:A4 13   	LDY $13    
0x03E25A|$0F:$E24A:F0 0D   	BEQ $E259  
; control flow target (from $E257)
0x03E25C|$0F:$E24C:A5 72   	LDA $72    
0x03E25E|$0F:$E24E:18      	CLC        
0x03E25F|$0F:$E24F:65 74   	ADC $74    
0x03E261|$0F:$E251:85 72   	STA $72    
0x03E263|$0F:$E253:90 01   	BCC $E256  
0x03E265|$0F:$E255:E8      	INX        
; control flow target (from $E253)
0x03E266|$0F:$E256:88      	DEY        
0x03E267|$0F:$E257:D0 F3   	BNE $E24C  
; control flow target (from $E24A)
0x03E269|$0F:$E259:86 73   	STX $73    
0x03E26B|$0F:$E25B:A4 12   	LDY $12    
0x03E26D|$0F:$E25D:B1 72   	LDA ($72),Y
0x03E26F|$0F:$E25F:4A      	LSR        
0x03E270|$0F:$E260:4A      	LSR        
0x03E271|$0F:$E261:4A      	LSR        
0x03E272|$0F:$E262:4A      	LSR        
0x03E273|$0F:$E263:4A      	LSR        
0x03E274|$0F:$E264:85 0D   	STA $0D    
0x03E276|$0F:$E266:68      	PLA        
0x03E277|$0F:$E267:AA      	TAX        
0x03E278|$0F:$E268:68      	PLA        
0x03E279|$0F:$E269:A8      	TAY        
0x03E27A|$0F:$E26A:60      	RTS        


; code -> data
; indirect data load target (via $E278)
0x03E27B|$0F:$E26B:0F
; indirect data load target
0x03E27C|$0F:$E26C:36
; indirect data load target
0x03E27D|$0F:$E26D:30
; indirect data load target
0x03E27E|$0F:$E26E:11
; indirect data load target
0x03E27F|$0F:$E26F:36
; indirect data load target
0x03E280|$0F:$E270:19
; indirect data load target
0x03E281|$0F:$E271:16
; indirect data load target
0x03E282|$0F:$E272:36
; indirect data load target
0x03E283|$0F:$E273:30
; indirect data load target
0x03E284|$0F:$E274:13
; indirect data load target
0x03E285|$0F:$E275:01
; indirect data load target
0x03E286|$0F:$E276:01
; indirect data load target
0x03E287|$0F:$E277:01
; data load target (from $E30D)
0x03E288|$0F:$E278:6B
; data load target (from $E312)
0x03E289|$0F:$E279:   E2	; $0F:$E26B
; data load target (from $E302)
0x03E28A|$0F:$E27A:84
; data load target (from $E307)
0x03E28B|$0F:$E27B:   BC	; $03:$BC84
; data load target (from $E319)
0x03E28C|$0F:$E27C:91
; data load target (from $E321)
0x03E28D|$0F:$E27D:   BC	; $03:$BC91

; data -> code
0x03E28E|$0F:$E27E:20 2A C4	JSR $C42A  
; control flow target (from $D2B3)
0x03E291|$0F:$E281:20 65 C4	JSR $C465  	; wait for interrupt and then set every 4th byte of $0200 - $02FC to #$F0
0x03E294|$0F:$E284:4C 90 E2	JMP $E290  

; control flow target (from $D866)
0x03E297|$0F:$E287:20 2A C4	JSR $C42A  
; control flow target (from $C7E9)
0x03E29A|$0F:$E28A:20 65 C4	JSR $C465  	; wait for interrupt and then set every 4th byte of $0200 - $02FC to #$F0
0x03E29D|$0F:$E28D:20 FD E3	JSR $E3FD  
; control flow target (from $E284)
0x03E2A0|$0F:$E290:20 CC E3	JSR $E3CC  
0x03E2A3|$0F:$E293:A5 31   	LDA $31    	; current map ID
0x03E2A5|$0F:$E295:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03E2A7|$0F:$E297:D0 18   	BNE $E2B1  
0x03E2A9|$0F:$E299:A5 16   	LDA $16    	; current map X-pos (1)
0x03E2AB|$0F:$E29B:C9 54   	CMP #$54   	; Rhone region is from #$54 <= X-pos < #$90
0x03E2AD|$0F:$E29D:90 12   	BCC $E2B1  
0x03E2AF|$0F:$E29F:C9 90   	CMP #$90   
0x03E2B1|$0F:$E2A1:B0 0E   	BCS $E2B1  
0x03E2B3|$0F:$E2A3:A5 17   	LDA $17    	; current map Y-pos (1)
0x03E2B5|$0F:$E2A5:C9 91   	CMP #$91   	; Rhone region is from #$91 <= Y-pos < #$BA
0x03E2B7|$0F:$E2A7:90 08   	BCC $E2B1  
0x03E2B9|$0F:$E2A9:C9 BA   	CMP #$BA   
0x03E2BB|$0F:$E2AB:B0 04   	BCS $E2B1  
0x03E2BD|$0F:$E2AD:A9 68   	LDA #$68   	; palette for Rhone region of Wolrd Map
0x03E2BF|$0F:$E2AF:85 27   	STA $27    	; map palette; offset from ($E27C)
; control flow target (from $E297, $E29D, $E2A1, $E2A7, $E2AB)
0x03E2C1|$0F:$E2B1:20 DA E3	JSR $E3DA  
0x03E2C4|$0F:$E2B4:A9 F2   	LDA #$F2   
0x03E2C6|$0F:$E2B6:85 19   	STA $19    
; control flow target (from $E2EC)
0x03E2C8|$0F:$E2B8:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E2CB|$0F:$E2BB:A9 EE   	LDA #$EE   
0x03E2CD|$0F:$E2BD:85 18   	STA $18    
; control flow target (from $E2CC)
0x03E2CF|$0F:$E2BF:A9 00   	LDA #$00   
0x03E2D1|$0F:$E2C1:85 1C   	STA $1C    
0x03E2D3|$0F:$E2C3:85 1E   	STA $1E    
0x03E2D5|$0F:$E2C5:20 C5 DE	JSR $DEC5  
0x03E2D8|$0F:$E2C8:E6 18   	INC $18    
0x03E2DA|$0F:$E2CA:E6 18   	INC $18    
0x03E2DC|$0F:$E2CC:D0 F1   	BNE $E2BF  
0x03E2DE|$0F:$E2CE:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $E2E2)
0x03E2E1|$0F:$E2D1:A9 00   	LDA #$00   
0x03E2E3|$0F:$E2D3:85 1C   	STA $1C    
0x03E2E5|$0F:$E2D5:85 1E   	STA $1E    
0x03E2E7|$0F:$E2D7:20 C5 DE	JSR $DEC5  
0x03E2EA|$0F:$E2DA:E6 18   	INC $18    
0x03E2EC|$0F:$E2DC:E6 18   	INC $18    
0x03E2EE|$0F:$E2DE:A5 18   	LDA $18    
0x03E2F0|$0F:$E2E0:C9 12   	CMP #$12   
0x03E2F2|$0F:$E2E2:D0 ED   	BNE $E2D1  
0x03E2F4|$0F:$E2E4:E6 19   	INC $19    
0x03E2F6|$0F:$E2E6:E6 19   	INC $19    
0x03E2F8|$0F:$E2E8:A5 19   	LDA $19    
0x03E2FA|$0F:$E2EA:C9 10   	CMP #$10   
0x03E2FC|$0F:$E2EC:D0 CA   	BNE $E2B8  
0x03E2FE|$0F:$E2EE:A9 FF   	LDA #$FF   
0x03E300|$0F:$E2F0:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03E302|$0F:$E2F2:20 CB D8	JSR $D8CB  
0x03E305|$0F:$E2F5:A9 00   	LDA #$00   
0x03E307|$0F:$E2F7:85 35   	STA $35    	; flag indicating whether any menu is currently open
; control flow target (from $D153, $D18F)
0x03E309|$0F:$E2F9:20 75 F7	JSR $F775  	; load ROM bank #$03
0x03E30C|$0F:$E2FC:A5 27   	LDA $27    	; map palette; offset from ($E27C)
0x03E30E|$0F:$E2FE:C9 68   	CMP #$68   
0x03E310|$0F:$E300:F0 0B   	BEQ $E30D  
0x03E312|$0F:$E302:AD 7A E2	LDA $E27A  
0x03E315|$0F:$E305:85 0E   	STA $0E    
0x03E317|$0F:$E307:AD 7B E2	LDA $E27B  
0x03E31A|$0F:$E30A:4C 17 E3	JMP $E317  

; control flow target (from $E300)
0x03E31D|$0F:$E30D:AD 78 E2	LDA $E278  
0x03E320|$0F:$E310:85 0E   	STA $0E    
0x03E322|$0F:$E312:AD 79 E2	LDA $E279  
0x03E325|$0F:$E315:85 0F   	STA $0F    	; useless op
; control flow target (from $E30A)
0x03E327|$0F:$E317:85 0F   	STA $0F    
0x03E329|$0F:$E319:AD 7C E2	LDA $E27C  
0x03E32C|$0F:$E31C:18      	CLC        
0x03E32D|$0F:$E31D:65 27   	ADC $27    	; map palette; offset from ($E27C)
0x03E32F|$0F:$E31F:85 10   	STA $10    
0x03E331|$0F:$E321:AD 7D E2	LDA $E27D  
0x03E334|$0F:$E324:69 00   	ADC #$00   
0x03E336|$0F:$E326:85 11   	STA $11    
0x03E338|$0F:$E328:A9 FF   	LDA #$FF   
0x03E33A|$0F:$E32A:85 0D   	STA $0D    
0x03E33C|$0F:$E32C:20 CD C2	JSR $C2CD  
; control flow target (from $D3C5, $D4A9)
0x03E33F|$0F:$E32F:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E341|$0F:$E331:10 04   	BPL $E337  
0x03E343|$0F:$E333:A9 0C   	LDA #$0C   	; Music ID #$0C: game menu / Wellgarth singer BGM
0x03E345|$0F:$E335:D0 44   	BNE $E37B  
; control flow target (from $E331)
0x03E347|$0F:$E337:D0 4E   	BNE $E387  
0x03E349|$0F:$E339:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03E34B|$0F:$E33B:29 04   	AND #$04   
0x03E34D|$0F:$E33D:F0 04   	BEQ $E343  
0x03E34F|$0F:$E33F:A9 16   	LDA #$16   	; Music ID #$16: sea BGM
0x03E351|$0F:$E341:D0 38   	BNE $E37B  
; control flow target (from $E33D)
0x03E353|$0F:$E343:A5 16   	LDA $16    	; current map X-pos (1)
0x03E355|$0F:$E345:C9 20   	CMP #$20   
0x03E357|$0F:$E347:90 12   	BCC $E35B  
0x03E359|$0F:$E349:C9 57   	CMP #$57   
0x03E35B|$0F:$E34B:B0 0E   	BCS $E35B  
0x03E35D|$0F:$E34D:A5 17   	LDA $17    	; current map Y-pos (1)
0x03E35F|$0F:$E34F:C9 17   	CMP #$17   
0x03E361|$0F:$E351:90 08   	BCC $E35B  
0x03E363|$0F:$E353:C9 56   	CMP #$56   
0x03E365|$0F:$E355:B0 04   	BCS $E35B  
0x03E367|$0F:$E357:A9 0D   	LDA #$0D   	; Music ID #$0D: Tantegel BGM
0x03E369|$0F:$E359:D0 20   	BNE $E37B  
; control flow target (from $E347, $E34B, $E351, $E355)
0x03E36B|$0F:$E35B:A0 00   	LDY #$00   
0x03E36D|$0F:$E35D:84 0C   	STY $0C    
; control flow target (from $E36D)
0x03E36F|$0F:$E35F:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03E372|$0F:$E362:10 02   	BPL $E366  
0x03E374|$0F:$E364:E6 0C   	INC $0C    
; control flow target (from $E362)
0x03E376|$0F:$E366:98      	TYA        
0x03E377|$0F:$E367:18      	CLC        
0x03E378|$0F:$E368:69 12   	ADC #$12   
0x03E37A|$0F:$E36A:A8      	TAY        
0x03E37B|$0F:$E36B:C9 36   	CMP #$36   
0x03E37D|$0F:$E36D:90 F0   	BCC $E35F  
0x03E37F|$0F:$E36F:A5 0C   	LDA $0C    
0x03E381|$0F:$E371:C9 03   	CMP #$03   
0x03E383|$0F:$E373:F0 04   	BEQ $E379  
0x03E385|$0F:$E375:A9 15   	LDA #$15   	; Music ID #$15: small party BGM
0x03E387|$0F:$E377:D0 02   	BNE $E37B  
; control flow target (from $E373)
0x03E389|$0F:$E379:A9 14   	LDA #$14   	; Music ID #$14: full party BGM
; control flow target (from $E335, $E341, $E359, $E377, $E38D, $E395, $E3A4, $E3AC, $E3B1)
0x03E38B|$0F:$E37B:CD F7 05	CMP $05F7  	; probably BGM for current area
0x03E38E|$0F:$E37E:F0 06   	BEQ $E386  
0x03E390|$0F:$E380:8D F7 05	STA $05F7  	; probably BGM for current area
0x03E393|$0F:$E383:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; control flow target (from $E37E)
0x03E396|$0F:$E386:60      	RTS        

; control flow target (from $E337)
0x03E397|$0F:$E387:C9 03   	CMP #$03   
0x03E399|$0F:$E389:D0 04   	BNE $E38F  
0x03E39B|$0F:$E38B:A9 11   	LDA #$11   	; Music ID #$11: tower BGM
0x03E39D|$0F:$E38D:D0 EC   	BNE $E37B  
; control flow target (from $E389)
0x03E39F|$0F:$E38F:C9 02   	CMP #$02   
0x03E3A1|$0F:$E391:D0 04   	BNE $E397  
0x03E3A3|$0F:$E393:A9 10   	LDA #$10   	; Music ID #$10: cave BGM
0x03E3A5|$0F:$E395:D0 E4   	BNE $E37B  
; control flow target (from $E391)
0x03E3A7|$0F:$E397:A6 31   	LDX $31    	; current map ID
0x03E3A9|$0F:$E399:E0 09   	CPX #$09   	; Map ID #$09: Moonbrooke
0x03E3AB|$0F:$E39B:D0 09   	BNE $E3A6  
0x03E3AD|$0F:$E39D:AD AD 61	LDA $61AD  
0x03E3B0|$0F:$E3A0:F0 04   	BEQ $E3A6  
0x03E3B2|$0F:$E3A2:A9 0E   	LDA #$0E   	; Music ID #$0E: town music 1 BGM
0x03E3B4|$0F:$E3A4:D0 D5   	BNE $E37B  
; control flow target (from $E39B, $E3A0)
0x03E3B6|$0F:$E3A6:E0 19   	CPX #$19   	; Map ID #$19: Shrine NW of Midenhall
0x03E3B8|$0F:$E3A8:90 04   	BCC $E3AE  
0x03E3BA|$0F:$E3AA:A9 13   	LDA #$13   	; Music ID #$13: shrine BGM
0x03E3BC|$0F:$E3AC:D0 CD   	BNE $E37B  
; control flow target (from $E3A8)
0x03E3BE|$0F:$E3AE:BD B3 E3	LDA $E3B3,X	; map BGM
0x03E3C1|$0F:$E3B1:D0 C8   	BNE $E37B  

; code -> data
; map BGM
; indexed data load target (from $E3AE)
0x03E3C3|$0F:$E3B3:0E	; Map ID #$00: Fake Midenhall; Music ID #$0E: town music 1 BGM
0x03E3C4|$0F:$E3B4:0E	; Map ID #$01: World Map; Music ID #$0E: town music 1 BGM
0x03E3C5|$0F:$E3B5:0E	; Map ID #$02: Midenhall 2F; Music ID #$0E: town music 1 BGM
0x03E3C6|$0F:$E3B6:0E	; Map ID #$03: Midenhall 1F; Music ID #$0E: town music 1 BGM
0x03E3C7|$0F:$E3B7:0E	; Map ID #$04: Midenhall B1; Music ID #$0E: town music 1 BGM
0x03E3C8|$0F:$E3B8:0F	; Map ID #$05: Leftwyne; Music ID #$0F: town music 2 BGM
0x03E3C9|$0F:$E3B9:0E	; Map ID #$06: Cannock; Music ID #$0E: town music 1 BGM
0x03E3CA|$0F:$E3BA:0F	; Map ID #$07: Hamlin; Music ID #$0F: town music 2 BGM
0x03E3CB|$0F:$E3BB:0F	; Map ID #$08: Hamlin Waterway; Music ID #$0F: town music 2 BGM
0x03E3CC|$0F:$E3BC:10	; Map ID #$09: Moonbrooke; Music ID #$10: cave BGM
0x03E3CD|$0F:$E3BD:10	; Map ID #$0A: Moonbrooke B1; Music ID #$10: cave BGM
0x03E3CE|$0F:$E3BE:0F	; Map ID #$0B: Lianport; Music ID #$0F: town music 2 BGM
0x03E3CF|$0F:$E3BF:0E	; Map ID #$0C: Tantegel; Music ID #$0E: town music 1 BGM
0x03E3D0|$0F:$E3C0:0E	; Map ID #$0D: Tantegel Town 2F; Music ID #$0E: town music 1 BGM
0x03E3D1|$0F:$E3C1:0E	; Map ID #$0E: Tantegel Castle 2F; Music ID #$0E: town music 1 BGM
0x03E3D2|$0F:$E3C2:0E	; Map ID #$0F: Osterfair; Music ID #$0E: town music 1 BGM
0x03E3D3|$0F:$E3C3:0F	; Map ID #$10: Zahan; Music ID #$0F: town music 2 BGM
0x03E3D4|$0F:$E3C4:0F	; Map ID #$11: Tuhn; Music ID #$0F: town music 2 BGM
0x03E3D5|$0F:$E3C5:0F	; Map ID #$12: Tuhn Watergate; Music ID #$0F: town music 2 BGM
0x03E3D6|$0F:$E3C6:0F	; Map ID #$13: Wellgarth; Music ID #$0F: town music 2 BGM
0x03E3D7|$0F:$E3C7:0F	; Map ID #$14: Wellgarth Underground; Music ID #$0F: town music 2 BGM
0x03E3D8|$0F:$E3C8:0F	; Map ID #$15: Beran; Music ID #$0F: town music 2 BGM
0x03E3D9|$0F:$E3C9:10	; Map ID #$16: Hargon's Castle 1F; Music ID #$10: cave BGM
0x03E3DA|$0F:$E3CA:11	; Map ID #$17: Hargon's Castle 7F; Music ID #$11: tower BGM
0x03E3DB|$0F:$E3CB:10	; Map ID #$18: Charlock Castle B8; Music ID #$10: cave BGM

; data -> code
; control flow target (from $D6DA, $E290)
0x03E3DC|$0F:$E3CC:A9 00   	LDA #$00   
0x03E3DE|$0F:$E3CE:85 3B   	STA $3B    	; high nybble = terrain ID
0x03E3E0|$0F:$E3D0:8D 59 01	STA $0159  
0x03E3E3|$0F:$E3D3:8D 5A 01	STA $015A  
0x03E3E6|$0F:$E3D6:8D 5B 01	STA $015B  
0x03E3E9|$0F:$E3D9:60      	RTS        

; control flow target (from $E2B1)
0x03E3EA|$0F:$E3DA:A5 16   	LDA $16    	; current map X-pos (1)
0x03E3EC|$0F:$E3DC:85 0C   	STA $0C    
0x03E3EE|$0F:$E3DE:A5 17   	LDA $17    	; current map Y-pos (1)
0x03E3F0|$0F:$E3E0:85 0E   	STA $0E    
0x03E3F2|$0F:$E3E2:20 89 DF	JSR $DF89  
0x03E3F5|$0F:$E3E5:20 4A DF	JSR $DF4A  
0x03E3F8|$0F:$E3E8:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03E3FB|$0F:$E3EB:A0 04   	LDY #$04   
0x03E3FD|$0F:$E3ED:B1 10   	LDA ($10),Y
0x03E3FF|$0F:$E3EF:29 F0   	AND #$F0   
0x03E401|$0F:$E3F1:85 3C   	STA $3C    
0x03E403|$0F:$E3F3:20 22 E2	JSR $E222  
0x03E406|$0F:$E3F6:A5 0D   	LDA $0D    
0x03E408|$0F:$E3F8:85 1D   	STA $1D    
0x03E40A|$0F:$E3FA:60      	RTS        


; code -> data
; -> $02:$8018: map header info (exterior border tile ID, width, height, pointer low byte, pointer high byte, ?, ?, palette)
; data load target (from $E475)
0x03E40B|$0F:$E3FB:18
; data load target (from $E47D)
0x03E40C|$0F:$E3FC:   80	; $02:$8018; map header info (exterior border tile ID, width, height, pointer low byte, pointer high byte, ?, ?, palette)

; data -> code
; control flow target (from $E28D)
0x03E40D|$0F:$E3FD:A5 31   	LDA $31    	; current map ID
0x03E40F|$0F:$E3FF:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03E411|$0F:$E401:D0 04   	BNE $E407  
0x03E413|$0F:$E403:A9 00   	LDA #$00   	; World Map uses #$00
0x03E415|$0F:$E405:F0 12   	BEQ $E419  
; control flow target (from $E401)
0x03E417|$0F:$E407:C9 2B   	CMP #$2B   	; Map ID #$2B: Cave to Hamlin
0x03E419|$0F:$E409:B0 04   	BCS $E40F  
0x03E41B|$0F:$E40B:A9 01   	LDA #$01   	; other non-dungeon maps use #$01
0x03E41D|$0F:$E40D:D0 0A   	BNE $E419  
; control flow target (from $E409)
0x03E41F|$0F:$E40F:C9 44   	CMP #$44   	; Map ID #$44: Hargon's Castle 2F
0x03E421|$0F:$E411:B0 04   	BCS $E417  
0x03E423|$0F:$E413:A9 02   	LDA #$02   	; other maps up to #$44 use #$02
0x03E425|$0F:$E415:D0 02   	BNE $E419  
; control flow target (from $E411)
0x03E427|$0F:$E417:A9 03   	LDA #$03   	; maps >= #$44 use #$03
; control flow target (from $E405, $E40D, $E415)
0x03E429|$0F:$E419:85 1F   	STA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E42B|$0F:$E41B:85 0C   	STA $0C    
0x03E42D|$0F:$E41D:20 5C F7	JSR $F75C  	; load ROM bank #$00
; call to code in a different bank ($00:$8000)
0x03E430|$0F:$E420:20 00 80	JSR $8000  
0x03E433|$0F:$E423:A5 31   	LDA $31    	; current map ID
0x03E435|$0F:$E425:D0 04   	BNE $E42B  	; Map ID #$00: Fake Midenhall
0x03E437|$0F:$E427:A9 FF   	LDA #$FF   
0x03E439|$0F:$E429:D0 07   	BNE $E432  
; control flow target (from $E425)
0x03E43B|$0F:$E42B:AD FC 05	LDA $05FC  
0x03E43E|$0F:$E42E:F0 0B   	BEQ $E43B  
0x03E440|$0F:$E430:A9 00   	LDA #$00   
; control flow target (from $E429)
0x03E442|$0F:$E432:8D FC 05	STA $05FC  
0x03E445|$0F:$E435:20 61 F7	JSR $F761  	; load ROM bank #$06
; call to code in a different bank ($06:$A319)
0x03E448|$0F:$E438:20 19 A3	JSR $A319  	; if $05FC is #$00, copy battle stats at $015D,Y to field stats at $0600,X, otherwise copy field stats at $0600,X to battle stats at $015D,Y
; control flow target (from $E42E)
0x03E44B|$0F:$E43B:A9 04   	LDA #$04   
0x03E44D|$0F:$E43D:85 0C   	STA $0C    
0x03E44F|$0F:$E43F:20 5C F7	JSR $F75C  	; load ROM bank #$00
; call to code in a different bank ($00:$8000)
0x03E452|$0F:$E442:20 00 80	JSR $8000  
0x03E455|$0F:$E445:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03E458|$0F:$E448:A5 31   	LDA $31    	; current map ID
0x03E45A|$0F:$E44A:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03E45C|$0F:$E44C:D0 03   	BNE $E451  
0x03E45E|$0F:$E44E:20 A2 E5	JSR $E5A2  
; control flow target (from $E44C)
0x03E461|$0F:$E451:A9 08   	LDA #$08   
0x03E463|$0F:$E453:85 14   	STA $14    
0x03E465|$0F:$E455:A9 07   	LDA #$07   
0x03E467|$0F:$E457:85 15   	STA $15    
0x03E469|$0F:$E459:A9 00   	LDA #$00   
0x03E46B|$0F:$E45B:85 05   	STA $05    
0x03E46D|$0F:$E45D:85 06   	STA $06    
0x03E46F|$0F:$E45F:85 04   	STA $04    
; control flow target (from $E92A)
0x03E471|$0F:$E461:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03E474|$0F:$E464:A9 00   	LDA #$00   
0x03E476|$0F:$E466:85 0D   	STA $0D    	; multiplication high byte
0x03E478|$0F:$E468:85 0F   	STA $0F    	; multiplication high byte
0x03E47A|$0F:$E46A:A5 31   	LDA $31    	; current map ID
0x03E47C|$0F:$E46C:85 0C   	STA $0C    	; multiplication low byte
0x03E47E|$0F:$E46E:A9 08   	LDA #$08   
0x03E480|$0F:$E470:85 0E   	STA $0E    	; multiplication low byte
0x03E482|$0F:$E472:20 39 C3	JSR $C339  	; 16-bit multiplication: ($10-$11) = ($0C-$0D) * ($0E-$0F); consumes $0C-$0F
0x03E485|$0F:$E475:AD FB E3	LDA $E3FB  	; -> $02:$8018: map header info (exterior border tile ID, width, height, pointer low byte, pointer high byte, ?, ?, palette)
0x03E488|$0F:$E478:18      	CLC        
0x03E489|$0F:$E479:65 10   	ADC $10    	; add low byte of map ID * 8
0x03E48B|$0F:$E47B:85 10   	STA $10    
0x03E48D|$0F:$E47D:AD FC E3	LDA $E3FC  
0x03E490|$0F:$E480:65 11   	ADC $11    	; add high byte of map ID * 8
0x03E492|$0F:$E482:85 11   	STA $11    
0x03E494|$0F:$E484:A0 00   	LDY #$00   
; control flow target (from $E48E)
0x03E496|$0F:$E486:B1 10   	LDA ($10),Y
0x03E498|$0F:$E488:99 20 00	STA $0020,Y	; map exterior border tile ID (#$00 = Road, #$01 = Grass, #$02 = Sand, #$03 = Tree, #$04 = Water, #$05 = Vertical Wall, #$06 = Shrub, #$07 = Horizontal Wall, #$08 = Swamp, ..., #$20 = Ceiling Alternating?, #$21 = Ceiling Down?, #$24 = Black?, #$28 = Blue?)
0x03E49B|$0F:$E48B:C8      	INY        
0x03E49C|$0F:$E48C:C0 08   	CPY #$08   	; copy 8 byte map header to $20
0x03E49E|$0F:$E48E:D0 F6   	BNE $E486  
0x03E4A0|$0F:$E490:AD AD 61	LDA $61AD  
0x03E4A3|$0F:$E493:F0 14   	BEQ $E4A9  
0x03E4A5|$0F:$E495:A5 31   	LDA $31    	; current map ID
0x03E4A7|$0F:$E497:C9 09   	CMP #$09   	; Map ID #$09: Moonbrooke
0x03E4A9|$0F:$E499:D0 0E   	BNE $E4A9  
0x03E4AB|$0F:$E49B:AD D7 86	LDA $86D7  	; -> $02:$A201: Map ID #$6D: Moonbrooke (prologue)
0x03E4AE|$0F:$E49E:85 23   	STA $23    	; map pointer, low byte
0x03E4B0|$0F:$E4A0:AD D8 86	LDA $86D8  
0x03E4B3|$0F:$E4A3:85 24   	STA $24    	; map pointer, high byte
0x03E4B5|$0F:$E4A5:A9 02   	LDA #$02   
0x03E4B7|$0F:$E4A7:85 20   	STA $20    	; map exterior border tile ID (#$00 = Road, #$01 = Grass, #$02 = Sand, #$03 = Tree, #$04 = Water, #$05 = Vertical Wall, #$06 = Shrub, #$07 = Horizontal Wall, #$08 = Swamp, ..., #$20 = Ceiling Alternating?, #$21 = Ceiling Down?, #$24 = Black?, #$28 = Blue?)
; control flow target (from $E493, $E499)
0x03E4B9|$0F:$E4A9:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E4BB|$0F:$E4AB:F0 03   	BEQ $E4B0  
; call to code in a different bank ($02:$AB89)
0x03E4BD|$0F:$E4AD:20 89 AB	JSR $AB89  
; control flow target (from $E4AB)
0x03E4C0|$0F:$E4B0:A5 31   	LDA $31    	; current map ID
0x03E4C2|$0F:$E4B2:C9 12   	CMP #$12   	; Map ID #$12: Tuhn Watergate
0x03E4C4|$0F:$E4B4:D0 08   	BNE $E4BE  
0x03E4C6|$0F:$E4B6:A5 CE   	LDA $CE    	; Tuhn Watergate open flag (#$00 = closed, #$01 = open)
0x03E4C8|$0F:$E4B8:F0 04   	BEQ $E4BE  
0x03E4CA|$0F:$E4BA:A9 04   	LDA #$04   
0x03E4CC|$0F:$E4BC:85 20   	STA $20    	; map exterior border tile ID (#$00 = Road, #$01 = Grass, #$02 = Sand, #$03 = Tree, #$04 = Water, #$05 = Vertical Wall, #$06 = Shrub, #$07 = Horizontal Wall, #$08 = Swamp, ..., #$20 = Ceiling Alternating?, #$21 = Ceiling Down?, #$24 = Black?, #$28 = Blue?)
; control flow target (from $E4B4, $E4B8)
0x03E4CE|$0F:$E4BE:20 F7 D2	JSR $D2F7  
0x03E4D1|$0F:$E4C1:A9 00   	LDA #$00   
0x03E4D3|$0F:$E4C3:85 39   	STA $39    
0x03E4D5|$0F:$E4C5:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03E4D7|$0F:$E4C7:85 36   	STA $36    
0x03E4D9|$0F:$E4C9:85 03   	STA $03    	; game clock?
0x03E4DB|$0F:$E4CB:A9 18   	LDA #$18   
0x03E4DD|$0F:$E4CD:85 3A   	STA $3A    
0x03E4DF|$0F:$E4CF:A0 18   	LDY #$18   
; control flow target (from $E4DD)
0x03E4E1|$0F:$E4D1:A9 FF   	LDA #$FF   
0x03E4E3|$0F:$E4D3:99 41 05	STA $0541,Y	; NPC #$00 sprite ID
0x03E4E6|$0F:$E4D6:98      	TYA        
0x03E4E7|$0F:$E4D7:18      	CLC        
0x03E4E8|$0F:$E4D8:69 08   	ADC #$08   
0x03E4EA|$0F:$E4DA:A8      	TAY        
0x03E4EB|$0F:$E4DB:C9 B8   	CMP #$B8   
0x03E4ED|$0F:$E4DD:D0 F2   	BNE $E4D1  
0x03E4EF|$0F:$E4DF:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03E4F2|$0F:$E4E2:A5 D0   	LDA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x03E4F4|$0F:$E4E4:10 19   	BPL $E4FF  
0x03E4F6|$0F:$E4E6:A5 31   	LDA $31    	; current map ID
0x03E4F8|$0F:$E4E8:C9 03   	CMP #$03   	; Map ID #$03: Midenhall 1F
0x03E4FA|$0F:$E4EA:D0 13   	BNE $E4FF  
0x03E4FC|$0F:$E4EC:20 DA FE	JSR $FEDA  	; parse byte following JSR for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank

; code -> data
; indirect data load target
0x03E4FF|$0F:$E4EF:49	; $02:$8012; -> $02:$B351: looks like more NPC data?

; data -> code
0x03E500|$0F:$E4F0:A5 D6   	LDA $D6    
0x03E502|$0F:$E4F2:85 0C   	STA $0C    
0x03E504|$0F:$E4F4:A5 D7   	LDA $D7    
0x03E506|$0F:$E4F6:85 0D   	STA $0D    
0x03E508|$0F:$E4F8:20 FA FE	JSR $FEFA  	; increment JSR's return address, read byte following JSR, parse it for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank

; code -> data
; indirect data load target
0x03E50B|$0F:$E4FB:49	; $02:$8012; -> $02:$B351: looks like more NPC data?

; data -> code
0x03E50C|$0F:$E4FC:4C 70 E5	JMP $E570  

; control flow target (from $E4E4, $E4EA)
0x03E50F|$0F:$E4FF:AD AD 61	LDA $61AD  
0x03E512|$0F:$E502:F0 1F   	BEQ $E523  
0x03E514|$0F:$E504:A5 31   	LDA $31    	; current map ID
0x03E516|$0F:$E506:C9 09   	CMP #$09   	; Map ID #$09: Moonbrooke
0x03E518|$0F:$E508:F0 08   	BEQ $E512  
0x03E51A|$0F:$E50A:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03E51C|$0F:$E50C:F0 08   	BEQ $E516  
0x03E51E|$0F:$E50E:A9 6E   	LDA #$6E   
0x03E520|$0F:$E510:D0 13   	BNE $E525  
; control flow target (from $E508)
0x03E522|$0F:$E512:A9 6D   	LDA #$6D   
0x03E524|$0F:$E514:D0 0F   	BNE $E525  
; control flow target (from $E50C)
0x03E526|$0F:$E516:A0 6F   	LDY #$6F   
0x03E528|$0F:$E518:AD AD 61	LDA $61AD  
0x03E52B|$0F:$E51B:C9 FE   	CMP #$FE   
0x03E52D|$0F:$E51D:D0 01   	BNE $E520  
0x03E52F|$0F:$E51F:C8      	INY        
; control flow target (from $E51D)
0x03E530|$0F:$E520:98      	TYA        
0x03E531|$0F:$E521:D0 02   	BNE $E525  
; control flow target (from $E502)
0x03E533|$0F:$E523:A5 31   	LDA $31    	; current map ID
; control flow target (from $E510, $E514, $E521)
0x03E535|$0F:$E525:0A      	ASL        
0x03E536|$0F:$E526:A8      	TAY        
0x03E537|$0F:$E527:B9 39 A5	LDA $A539,Y	; pointers to per-map NPC setup (X-pos, Y-pos, ???, sprite ID, dialogue [not string] ID)
0x03E53A|$0F:$E52A:85 0C   	STA $0C    
0x03E53C|$0F:$E52C:B9 3A A5	LDA $A53A,Y
0x03E53F|$0F:$E52F:85 0D   	STA $0D    
0x03E541|$0F:$E531:05 0C   	ORA $0C    
0x03E543|$0F:$E533:D0 3B   	BNE $E570  	; zero pointer => no NPCs
0x03E545|$0F:$E535:A5 31   	LDA $31    	; current map ID
0x03E547|$0F:$E537:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x03E549|$0F:$E539:D0 2D   	BNE $E568  	; if we're on the world map, check to see if we need to add the ship sprite
0x03E54B|$0F:$E53B:AD AD 61	LDA $61AD  
0x03E54E|$0F:$E53E:D0 12   	BNE $E552  
0x03E550|$0F:$E540:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x03E552|$0F:$E542:29 06   	AND #$06   
0x03E554|$0F:$E544:C9 02   	CMP #$02   
0x03E556|$0F:$E546:D0 20   	BNE $E568  
0x03E558|$0F:$E548:A5 D2   	LDA $D2    	; ship X-pos (when you aren't on it)
0x03E55A|$0F:$E54A:8D D4 05	STA $05D4  	; NPC #$13 X-pos
0x03E55D|$0F:$E54D:A5 D3   	LDA $D3    	; ship Y-pos (when you aren't on it)
0x03E55F|$0F:$E54F:8D D5 05	STA $05D5  	; NPC #$13 Y-pos
; control flow target (from $E53E)
0x03E562|$0F:$E552:A9 00   	LDA #$00   
0x03E564|$0F:$E554:8D D6 05	STA $05D6  	; NPC #$13 ?
0x03E567|$0F:$E557:8D D7 05	STA $05D7  	; NPC #$13 ?
0x03E56A|$0F:$E55A:85 38   	STA $38    
0x03E56C|$0F:$E55C:A9 01   	LDA #$01   
0x03E56E|$0F:$E55E:8D D8 05	STA $05D8  	; NPC #$13 motion nybble + direction nybble
0x03E571|$0F:$E561:A9 05   	LDA #$05   
0x03E573|$0F:$E563:8D D9 05	STA $05D9  	; NPC #$13 sprite ID
0x03E576|$0F:$E566:D0 04   	BNE $E56C  
; control flow target (from $E539, $E546)
0x03E578|$0F:$E568:A9 FF   	LDA #$FF   
0x03E57A|$0F:$E56A:85 38   	STA $38    
; control flow target (from $E566, $E57A)
0x03E57C|$0F:$E56C:20 8F CD	JSR $CD8F  
0x03E57F|$0F:$E56F:60      	RTS        

; control flow target (from $E4FC, $E533)
0x03E580|$0F:$E570:A0 00   	LDY #$00   
0x03E582|$0F:$E572:84 38   	STY $38    
0x03E584|$0F:$E574:A2 18   	LDX #$18   
; control flow target (from $E5A0)
0x03E586|$0F:$E576:B1 0C   	LDA ($0C),Y
0x03E588|$0F:$E578:C9 FF   	CMP #$FF   
0x03E58A|$0F:$E57A:F0 F0   	BEQ $E56C  
0x03E58C|$0F:$E57C:9D 3C 05	STA $053C,X	; NPC #$00 ?
0x03E58F|$0F:$E57F:C8      	INY        
0x03E590|$0F:$E580:B1 0C   	LDA ($0C),Y
0x03E592|$0F:$E582:9D 3D 05	STA $053D,X	; NPC #$00 ?
0x03E595|$0F:$E585:C8      	INY        
0x03E596|$0F:$E586:A9 00   	LDA #$00   
0x03E598|$0F:$E588:9D 3E 05	STA $053E,X	; NPC #$00 ?
0x03E59B|$0F:$E58B:9D 3F 05	STA $053F,X	; NPC #$00 ?
0x03E59E|$0F:$E58E:B1 0C   	LDA ($0C),Y
0x03E5A0|$0F:$E590:9D 40 05	STA $0540,X	; NPC #$00 ? + direction nybble
0x03E5A3|$0F:$E593:C8      	INY        
0x03E5A4|$0F:$E594:B1 0C   	LDA ($0C),Y
0x03E5A6|$0F:$E596:9D 41 05	STA $0541,X	; NPC #$00 sprite ID
0x03E5A9|$0F:$E599:C8      	INY        
0x03E5AA|$0F:$E59A:C8      	INY        
0x03E5AB|$0F:$E59B:8A      	TXA        
0x03E5AC|$0F:$E59C:18      	CLC        
0x03E5AD|$0F:$E59D:69 08   	ADC #$08   
0x03E5AF|$0F:$E59F:AA      	TAX        
0x03E5B0|$0F:$E5A0:D0 D4   	BNE $E576  
; control flow target (from $D2BC, $D4F6, $E44E)
0x03E5B2|$0F:$E5A2:A2 00   	LDX #$00   
0x03E5B4|$0F:$E5A4:8A      	TXA        
; control flow target (from $E5AB)
0x03E5B5|$0F:$E5A5:9D 1A 05	STA $051A,X	; something to do with whether you've opened the chest containing the Shield of Erdrick
0x03E5B8|$0F:$E5A8:E8      	INX        
0x03E5B9|$0F:$E5A9:E0 20   	CPX #$20   
0x03E5BB|$0F:$E5AB:D0 F8   	BNE $E5A5  
0x03E5BD|$0F:$E5AD:60      	RTS        

; control flow target (from $E5C2, $E636, $E6B4, $E797)
0x03E5BE|$0F:$E5AE:AD C5 04	LDA $04C5  
0x03E5C1|$0F:$E5B1:D0 01   	BNE $E5B4  
0x03E5C3|$0F:$E5B3:60      	RTS        

; control flow target (from $E5B1)
0x03E5C4|$0F:$E5B4:A5 03   	LDA $03    	; game clock?
0x03E5C6|$0F:$E5B6:48      	PHA        
0x03E5C7|$0F:$E5B7:A9 00   	LDA #$00   
0x03E5C9|$0F:$E5B9:85 0C   	STA $0C    
0x03E5CB|$0F:$E5BB:20 8C F7	JSR $F78C  	; wipe selected menu region
0x03E5CE|$0F:$E5BE:68      	PLA        
0x03E5CF|$0F:$E5BF:85 03   	STA $03    	; game clock?
0x03E5D1|$0F:$E5C1:60      	RTS        

; control flow target (from $C741, $FF6C)
0x03E5D2|$0F:$E5C2:20 AE E5	JSR $E5AE  
0x03E5D5|$0F:$E5C5:A5 03   	LDA $03    	; game clock?
0x03E5D7|$0F:$E5C7:29 0F   	AND #$0F   
0x03E5D9|$0F:$E5C9:F0 05   	BEQ $E5D0  
0x03E5DB|$0F:$E5CB:68      	PLA        
0x03E5DC|$0F:$E5CC:68      	PLA        
0x03E5DD|$0F:$E5CD:4C 47 C7	JMP $C747  

; control flow target (from $E5C9)
0x03E5E0|$0F:$E5D0:E6 28   	INC $28    	; current map X-pos (2)
0x03E5E2|$0F:$E5D2:A9 FF   	LDA #$FF   
0x03E5E4|$0F:$E5D4:8D 3C 05	STA $053C  	; NPC #$00 ?
0x03E5E7|$0F:$E5D7:A9 00   	LDA #$00   
0x03E5E9|$0F:$E5D9:8D 3D 05	STA $053D  	; NPC #$00 ?
0x03E5EC|$0F:$E5DC:A9 01   	LDA #$01   
0x03E5EE|$0F:$E5DE:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x03E5F1|$0F:$E5E1:20 5B D3	JSR $D35B  
0x03E5F4|$0F:$E5E4:A9 12   	LDA #$12   
0x03E5F6|$0F:$E5E6:85 18   	STA $18    
0x03E5F8|$0F:$E5E8:A9 F2   	LDA #$F2   
0x03E5FA|$0F:$E5EA:85 19   	STA $19    
; control flow target (from $E607)
0x03E5FC|$0F:$E5EC:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E5FF|$0F:$E5EF:A9 00   	LDA #$00   
0x03E601|$0F:$E5F1:85 1C   	STA $1C    
0x03E603|$0F:$E5F3:85 1E   	STA $1E    
0x03E605|$0F:$E5F5:20 C5 DE	JSR $DEC5  
0x03E608|$0F:$E5F8:E6 19   	INC $19    
0x03E60A|$0F:$E5FA:E6 19   	INC $19    
0x03E60C|$0F:$E5FC:E6 05   	INC $05    
0x03E60E|$0F:$E5FE:E6 2A   	INC $2A    	; current map X-pos pixel, low byte
0x03E610|$0F:$E600:20 97 D8	JSR $D897  
0x03E613|$0F:$E603:A5 19   	LDA $19    
0x03E615|$0F:$E605:C9 10   	CMP #$10   
0x03E617|$0F:$E607:D0 E3   	BNE $E5EC  
0x03E619|$0F:$E609:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E61C|$0F:$E60C:E6 05   	INC $05    
0x03E61E|$0F:$E60E:D0 06   	BNE $E616  
0x03E620|$0F:$E610:A5 04   	LDA $04    
0x03E622|$0F:$E612:49 01   	EOR #$01   
0x03E624|$0F:$E614:85 04   	STA $04    
; control flow target (from $E60E)
0x03E626|$0F:$E616:E6 14   	INC $14    
0x03E628|$0F:$E618:A9 1F   	LDA #$1F   
0x03E62A|$0F:$E61A:25 14   	AND $14    
0x03E62C|$0F:$E61C:85 14   	STA $14    
0x03E62E|$0F:$E61E:E6 16   	INC $16    	; current map X-pos (1)
0x03E630|$0F:$E620:E6 2A   	INC $2A    	; current map X-pos pixel, low byte
0x03E632|$0F:$E622:D0 0C   	BNE $E630  
0x03E634|$0F:$E624:E6 2B   	INC $2B    	; current map X-pos pixel, high byte
0x03E636|$0F:$E626:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E638|$0F:$E628:D0 06   	BNE $E630  
0x03E63A|$0F:$E62A:A5 2B   	LDA $2B    	; current map X-pos pixel, high byte
0x03E63C|$0F:$E62C:29 0F   	AND #$0F   
0x03E63E|$0F:$E62E:85 2B   	STA $2B    	; current map X-pos pixel, high byte
; control flow target (from $E622, $E628)
0x03E640|$0F:$E630:20 97 D8	JSR $D897  
0x03E643|$0F:$E633:4C 7A E8	JMP $E87A  

; control flow target (from $C737, $FF72)
0x03E646|$0F:$E636:20 AE E5	JSR $E5AE  
0x03E649|$0F:$E639:A5 03   	LDA $03    	; game clock?
0x03E64B|$0F:$E63B:29 0F   	AND #$0F   
0x03E64D|$0F:$E63D:F0 05   	BEQ $E644  
0x03E64F|$0F:$E63F:68      	PLA        
0x03E650|$0F:$E640:68      	PLA        
0x03E651|$0F:$E641:4C 47 C7	JMP $C747  

; control flow target (from $E63D)
0x03E654|$0F:$E644:C6 28   	DEC $28    	; current map X-pos (2)
0x03E656|$0F:$E646:A9 01   	LDA #$01   
0x03E658|$0F:$E648:8D 3C 05	STA $053C  	; NPC #$00 ?
0x03E65B|$0F:$E64B:A9 00   	LDA #$00   
0x03E65D|$0F:$E64D:8D 3D 05	STA $053D  	; NPC #$00 ?
0x03E660|$0F:$E650:A9 03   	LDA #$03   
0x03E662|$0F:$E652:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x03E665|$0F:$E655:20 5B D3	JSR $D35B  
0x03E668|$0F:$E658:A9 EC   	LDA #$EC   
0x03E66A|$0F:$E65A:85 18   	STA $18    
0x03E66C|$0F:$E65C:A9 F2   	LDA #$F2   
0x03E66E|$0F:$E65E:85 19   	STA $19    
; control flow target (from $E69B)
0x03E670|$0F:$E660:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E673|$0F:$E663:A9 00   	LDA #$00   
0x03E675|$0F:$E665:85 1C   	STA $1C    
0x03E677|$0F:$E667:85 1E   	STA $1E    
0x03E679|$0F:$E669:20 C5 DE	JSR $DEC5  
0x03E67C|$0F:$E66C:E6 19   	INC $19    
0x03E67E|$0F:$E66E:E6 19   	INC $19    
0x03E680|$0F:$E670:A5 05   	LDA $05    
0x03E682|$0F:$E672:38      	SEC        
0x03E683|$0F:$E673:E9 01   	SBC #$01   
0x03E685|$0F:$E675:85 05   	STA $05    
0x03E687|$0F:$E677:B0 06   	BCS $E67F  
0x03E689|$0F:$E679:A5 04   	LDA $04    
0x03E68B|$0F:$E67B:49 01   	EOR #$01   
0x03E68D|$0F:$E67D:85 04   	STA $04    
; control flow target (from $E677)
0x03E68F|$0F:$E67F:A5 2A   	LDA $2A    	; current map X-pos pixel, low byte
0x03E691|$0F:$E681:38      	SEC        
0x03E692|$0F:$E682:E9 01   	SBC #$01   
0x03E694|$0F:$E684:85 2A   	STA $2A    	; current map X-pos pixel, low byte
0x03E696|$0F:$E686:B0 0C   	BCS $E694  
0x03E698|$0F:$E688:C6 2B   	DEC $2B    	; current map X-pos pixel, high byte
0x03E69A|$0F:$E68A:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E69C|$0F:$E68C:D0 06   	BNE $E694  
0x03E69E|$0F:$E68E:A5 2B   	LDA $2B    	; current map X-pos pixel, high byte
0x03E6A0|$0F:$E690:29 0F   	AND #$0F   
0x03E6A2|$0F:$E692:85 2B   	STA $2B    	; current map X-pos pixel, high byte
; control flow target (from $E686, $E68C)
0x03E6A4|$0F:$E694:20 97 D8	JSR $D897  
0x03E6A7|$0F:$E697:A5 19   	LDA $19    
0x03E6A9|$0F:$E699:C9 10   	CMP #$10   
0x03E6AB|$0F:$E69B:D0 C3   	BNE $E660  
0x03E6AD|$0F:$E69D:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E6B0|$0F:$E6A0:C6 05   	DEC $05    
0x03E6B2|$0F:$E6A2:C6 14   	DEC $14    
0x03E6B4|$0F:$E6A4:A9 1F   	LDA #$1F   
0x03E6B6|$0F:$E6A6:25 14   	AND $14    
0x03E6B8|$0F:$E6A8:85 14   	STA $14    
0x03E6BA|$0F:$E6AA:C6 16   	DEC $16    	; current map X-pos (1)
0x03E6BC|$0F:$E6AC:C6 2A   	DEC $2A    	; current map X-pos pixel, low byte
0x03E6BE|$0F:$E6AE:20 97 D8	JSR $D897  
0x03E6C1|$0F:$E6B1:4C 7A E8	JMP $E87A  

; control flow target (from $C72B, $CABA, $CABD, $CAC0, $FF7E)
0x03E6C4|$0F:$E6B4:20 AE E5	JSR $E5AE  
0x03E6C7|$0F:$E6B7:A5 03   	LDA $03    	; game clock?
0x03E6C9|$0F:$E6B9:29 0F   	AND #$0F   
0x03E6CB|$0F:$E6BB:F0 05   	BEQ $E6C2  
0x03E6CD|$0F:$E6BD:68      	PLA        
0x03E6CE|$0F:$E6BE:68      	PLA        
0x03E6CF|$0F:$E6BF:4C 47 C7	JMP $C747  

; control flow target (from $E6BB)
0x03E6D2|$0F:$E6C2:E6 29   	INC $29    	; current map Y-pos (2)
0x03E6D4|$0F:$E6C4:A9 00   	LDA #$00   
0x03E6D6|$0F:$E6C6:8D 3C 05	STA $053C  	; NPC #$00 ?
0x03E6D9|$0F:$E6C9:A9 FF   	LDA #$FF   
0x03E6DB|$0F:$E6CB:8D 3D 05	STA $053D  	; NPC #$00 ?
0x03E6DE|$0F:$E6CE:A9 02   	LDA #$02   
0x03E6E0|$0F:$E6D0:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x03E6E3|$0F:$E6D3:20 5B D3	JSR $D35B  
0x03E6E6|$0F:$E6D6:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E6E9|$0F:$E6D9:E6 06   	INC $06    
0x03E6EB|$0F:$E6DB:E6 2C   	INC $2C    	; current map Y-pos pixel, low byte
0x03E6ED|$0F:$E6DD:20 97 D8	JSR $D897  
0x03E6F0|$0F:$E6E0:A9 10   	LDA #$10   
0x03E6F2|$0F:$E6E2:85 19   	STA $19    
0x03E6F4|$0F:$E6E4:A9 EE   	LDA #$EE   
0x03E6F6|$0F:$E6E6:85 18   	STA $18    
; control flow target (from $E70B)
0x03E6F8|$0F:$E6E8:A9 03   	LDA #$03   
0x03E6FA|$0F:$E6EA:85 2E   	STA $2E    
0x03E6FC|$0F:$E6EC:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $E6FE)
0x03E6FF|$0F:$E6EF:A9 0C   	LDA #$0C   
0x03E701|$0F:$E6F1:85 1C   	STA $1C    
0x03E703|$0F:$E6F3:85 1E   	STA $1E    
0x03E705|$0F:$E6F5:20 C5 DE	JSR $DEC5  
0x03E708|$0F:$E6F8:E6 18   	INC $18    
0x03E70A|$0F:$E6FA:E6 18   	INC $18    
0x03E70C|$0F:$E6FC:C6 2E   	DEC $2E    
0x03E70E|$0F:$E6FE:D0 EF   	BNE $E6EF  
0x03E710|$0F:$E700:E6 06   	INC $06    
0x03E712|$0F:$E702:E6 2C   	INC $2C    	; current map Y-pos pixel, low byte
0x03E714|$0F:$E704:20 97 D8	JSR $D897  
0x03E717|$0F:$E707:A5 18   	LDA $18    
0x03E719|$0F:$E709:C9 12   	CMP #$12   
0x03E71B|$0F:$E70B:D0 DB   	BNE $E6E8  
0x03E71D|$0F:$E70D:A9 10   	LDA #$10   
0x03E71F|$0F:$E70F:85 19   	STA $19    
0x03E721|$0F:$E711:A9 EC   	LDA #$EC   
0x03E723|$0F:$E713:85 18   	STA $18    
; control flow target (from $E735)
0x03E725|$0F:$E715:A9 05   	LDA #$05   
0x03E727|$0F:$E717:85 2E   	STA $2E    
0x03E729|$0F:$E719:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $E728)
0x03E72C|$0F:$E71C:20 9A DE	JSR $DE9A  
0x03E72F|$0F:$E71F:A5 18   	LDA $18    
0x03E731|$0F:$E721:18      	CLC        
0x03E732|$0F:$E722:69 04   	ADC #$04   
0x03E734|$0F:$E724:85 18   	STA $18    
0x03E736|$0F:$E726:C6 2E   	DEC $2E    
0x03E738|$0F:$E728:D0 F2   	BNE $E71C  
0x03E73A|$0F:$E72A:E6 06   	INC $06    
0x03E73C|$0F:$E72C:E6 2C   	INC $2C    	; current map Y-pos pixel, low byte
0x03E73E|$0F:$E72E:20 97 D8	JSR $D897  
0x03E741|$0F:$E731:A5 18   	LDA $18    
0x03E743|$0F:$E733:C9 14   	CMP #$14   
0x03E745|$0F:$E735:D0 DE   	BNE $E715  
0x03E747|$0F:$E737:A9 10   	LDA #$10   
0x03E749|$0F:$E739:85 19   	STA $19    
0x03E74B|$0F:$E73B:A9 EE   	LDA #$EE   
0x03E74D|$0F:$E73D:85 18   	STA $18    
; control flow target (from $E762)
0x03E74F|$0F:$E73F:A9 03   	LDA #$03   
0x03E751|$0F:$E741:85 2E   	STA $2E    
0x03E753|$0F:$E743:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $E755)
0x03E756|$0F:$E746:A9 03   	LDA #$03   
0x03E758|$0F:$E748:85 1C   	STA $1C    
0x03E75A|$0F:$E74A:85 1E   	STA $1E    
0x03E75C|$0F:$E74C:20 C5 DE	JSR $DEC5  
0x03E75F|$0F:$E74F:E6 18   	INC $18    
0x03E761|$0F:$E751:E6 18   	INC $18    
0x03E763|$0F:$E753:C6 2E   	DEC $2E    
0x03E765|$0F:$E755:D0 EF   	BNE $E746  
0x03E767|$0F:$E757:E6 06   	INC $06    
0x03E769|$0F:$E759:E6 2C   	INC $2C    	; current map Y-pos pixel, low byte
0x03E76B|$0F:$E75B:20 97 D8	JSR $D897  
0x03E76E|$0F:$E75E:A5 18   	LDA $18    
0x03E770|$0F:$E760:C9 12   	CMP #$12   
0x03E772|$0F:$E762:D0 DB   	BNE $E73F  
0x03E774|$0F:$E764:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E777|$0F:$E767:E6 06   	INC $06    
0x03E779|$0F:$E769:A5 06   	LDA $06    
0x03E77B|$0F:$E76B:C9 F0   	CMP #$F0   
0x03E77D|$0F:$E76D:D0 04   	BNE $E773  
0x03E77F|$0F:$E76F:A9 00   	LDA #$00   
0x03E781|$0F:$E771:85 06   	STA $06    
; control flow target (from $E76D)
0x03E783|$0F:$E773:E6 15   	INC $15    
0x03E785|$0F:$E775:A5 15   	LDA $15    
0x03E787|$0F:$E777:C9 0F   	CMP #$0F   
0x03E789|$0F:$E779:D0 04   	BNE $E77F  
0x03E78B|$0F:$E77B:A9 00   	LDA #$00   
0x03E78D|$0F:$E77D:85 15   	STA $15    
; control flow target (from $E779)
0x03E78F|$0F:$E77F:E6 17   	INC $17    	; current map Y-pos (1)
0x03E791|$0F:$E781:E6 2C   	INC $2C    	; current map Y-pos pixel, low byte
0x03E793|$0F:$E783:D0 0C   	BNE $E791  
0x03E795|$0F:$E785:E6 2D   	INC $2D    	; current map Y-pos pixel, high byte
0x03E797|$0F:$E787:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E799|$0F:$E789:D0 06   	BNE $E791  
0x03E79B|$0F:$E78B:A5 2D   	LDA $2D    	; current map Y-pos pixel, high byte
0x03E79D|$0F:$E78D:29 0F   	AND #$0F   
0x03E79F|$0F:$E78F:85 2D   	STA $2D    	; current map Y-pos pixel, high byte
; control flow target (from $E783, $E789)
0x03E7A1|$0F:$E791:20 97 D8	JSR $D897  
0x03E7A4|$0F:$E794:4C 7A E8	JMP $E87A  

; control flow target (from $C71F, $FF78)
0x03E7A7|$0F:$E797:20 AE E5	JSR $E5AE  
0x03E7AA|$0F:$E79A:A5 03   	LDA $03    	; game clock?
0x03E7AC|$0F:$E79C:29 0F   	AND #$0F   
0x03E7AE|$0F:$E79E:F0 05   	BEQ $E7A5  
0x03E7B0|$0F:$E7A0:68      	PLA        
0x03E7B1|$0F:$E7A1:68      	PLA        
0x03E7B2|$0F:$E7A2:4C 47 C7	JMP $C747  

; control flow target (from $E79E)
0x03E7B5|$0F:$E7A5:C6 29   	DEC $29    	; current map Y-pos (2)
0x03E7B7|$0F:$E7A7:A9 00   	LDA #$00   
0x03E7B9|$0F:$E7A9:8D 3C 05	STA $053C  	; NPC #$00 ?
0x03E7BC|$0F:$E7AC:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x03E7BF|$0F:$E7AF:A9 01   	LDA #$01   
0x03E7C1|$0F:$E7B1:8D 3D 05	STA $053D  	; NPC #$00 ?
0x03E7C4|$0F:$E7B4:20 5B D3	JSR $D35B  
0x03E7C7|$0F:$E7B7:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E7CA|$0F:$E7BA:C6 06   	DEC $06    
0x03E7CC|$0F:$E7BC:A5 06   	LDA $06    
0x03E7CE|$0F:$E7BE:C9 FF   	CMP #$FF   
0x03E7D0|$0F:$E7C0:D0 04   	BNE $E7C6  
0x03E7D2|$0F:$E7C2:A9 EF   	LDA #$EF   
0x03E7D4|$0F:$E7C4:85 06   	STA $06    
; control flow target (from $E7C0)
0x03E7D6|$0F:$E7C6:A5 2C   	LDA $2C    	; current map Y-pos pixel, low byte
0x03E7D8|$0F:$E7C8:38      	SEC        
0x03E7D9|$0F:$E7C9:E9 01   	SBC #$01   
0x03E7DB|$0F:$E7CB:85 2C   	STA $2C    	; current map Y-pos pixel, low byte
0x03E7DD|$0F:$E7CD:B0 0C   	BCS $E7DB  
0x03E7DF|$0F:$E7CF:C6 2D   	DEC $2D    	; current map Y-pos pixel, high byte
0x03E7E1|$0F:$E7D1:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E7E3|$0F:$E7D3:D0 06   	BNE $E7DB  
0x03E7E5|$0F:$E7D5:A5 2D   	LDA $2D    	; current map Y-pos pixel, high byte
0x03E7E7|$0F:$E7D7:29 0F   	AND #$0F   
0x03E7E9|$0F:$E7D9:85 2D   	STA $2D    	; current map Y-pos pixel, high byte
; control flow target (from $E7CD, $E7D3)
0x03E7EB|$0F:$E7DB:20 97 D8	JSR $D897  
0x03E7EE|$0F:$E7DE:A9 F0   	LDA #$F0   
0x03E7F0|$0F:$E7E0:85 19   	STA $19    
0x03E7F2|$0F:$E7E2:A9 EE   	LDA #$EE   
0x03E7F4|$0F:$E7E4:85 18   	STA $18    
; control flow target (from $E809)
0x03E7F6|$0F:$E7E6:A9 03   	LDA #$03   
0x03E7F8|$0F:$E7E8:85 2E   	STA $2E    
0x03E7FA|$0F:$E7EA:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $E7FC)
0x03E7FD|$0F:$E7ED:A9 03   	LDA #$03   
0x03E7FF|$0F:$E7EF:85 1C   	STA $1C    
0x03E801|$0F:$E7F1:85 1E   	STA $1E    
0x03E803|$0F:$E7F3:20 C5 DE	JSR $DEC5  
0x03E806|$0F:$E7F6:E6 18   	INC $18    
0x03E808|$0F:$E7F8:E6 18   	INC $18    
0x03E80A|$0F:$E7FA:C6 2E   	DEC $2E    
0x03E80C|$0F:$E7FC:D0 EF   	BNE $E7ED  
0x03E80E|$0F:$E7FE:C6 06   	DEC $06    
0x03E810|$0F:$E800:C6 2C   	DEC $2C    	; current map Y-pos pixel, low byte
0x03E812|$0F:$E802:20 97 D8	JSR $D897  
0x03E815|$0F:$E805:A5 18   	LDA $18    
0x03E817|$0F:$E807:C9 12   	CMP #$12   
0x03E819|$0F:$E809:D0 DB   	BNE $E7E6  
0x03E81B|$0F:$E80B:A9 F0   	LDA #$F0   
0x03E81D|$0F:$E80D:85 19   	STA $19    
0x03E81F|$0F:$E80F:A9 EC   	LDA #$EC   
0x03E821|$0F:$E811:85 18   	STA $18    
; control flow target (from $E833)
0x03E823|$0F:$E813:A9 05   	LDA #$05   
0x03E825|$0F:$E815:85 2E   	STA $2E    
0x03E827|$0F:$E817:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $E826)
0x03E82A|$0F:$E81A:20 9A DE	JSR $DE9A  
0x03E82D|$0F:$E81D:A5 18   	LDA $18    
0x03E82F|$0F:$E81F:18      	CLC        
0x03E830|$0F:$E820:69 04   	ADC #$04   
0x03E832|$0F:$E822:85 18   	STA $18    
0x03E834|$0F:$E824:C6 2E   	DEC $2E    
0x03E836|$0F:$E826:D0 F2   	BNE $E81A  
0x03E838|$0F:$E828:C6 06   	DEC $06    
0x03E83A|$0F:$E82A:C6 2C   	DEC $2C    	; current map Y-pos pixel, low byte
0x03E83C|$0F:$E82C:20 97 D8	JSR $D897  
0x03E83F|$0F:$E82F:A5 18   	LDA $18    
0x03E841|$0F:$E831:C9 14   	CMP #$14   
0x03E843|$0F:$E833:D0 DE   	BNE $E813  
0x03E845|$0F:$E835:A9 F0   	LDA #$F0   
0x03E847|$0F:$E837:85 19   	STA $19    
0x03E849|$0F:$E839:A9 EE   	LDA #$EE   
0x03E84B|$0F:$E83B:85 18   	STA $18    
; control flow target (from $E860)
0x03E84D|$0F:$E83D:A9 03   	LDA #$03   
0x03E84F|$0F:$E83F:85 2E   	STA $2E    
0x03E851|$0F:$E841:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $E853)
0x03E854|$0F:$E844:A9 0C   	LDA #$0C   
0x03E856|$0F:$E846:85 1C   	STA $1C    
0x03E858|$0F:$E848:85 1E   	STA $1E    
0x03E85A|$0F:$E84A:20 C5 DE	JSR $DEC5  
0x03E85D|$0F:$E84D:E6 18   	INC $18    
0x03E85F|$0F:$E84F:E6 18   	INC $18    
0x03E861|$0F:$E851:C6 2E   	DEC $2E    
0x03E863|$0F:$E853:D0 EF   	BNE $E844  
0x03E865|$0F:$E855:C6 06   	DEC $06    
0x03E867|$0F:$E857:C6 2C   	DEC $2C    	; current map Y-pos pixel, low byte
0x03E869|$0F:$E859:20 97 D8	JSR $D897  
0x03E86C|$0F:$E85C:A5 18   	LDA $18    
0x03E86E|$0F:$E85E:C9 12   	CMP #$12   
0x03E870|$0F:$E860:D0 DB   	BNE $E83D  
0x03E872|$0F:$E862:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E875|$0F:$E865:C6 06   	DEC $06    
0x03E877|$0F:$E867:C6 15   	DEC $15    
0x03E879|$0F:$E869:A5 15   	LDA $15    
0x03E87B|$0F:$E86B:C9 FF   	CMP #$FF   
0x03E87D|$0F:$E86D:D0 04   	BNE $E873  
0x03E87F|$0F:$E86F:A9 0E   	LDA #$0E   
0x03E881|$0F:$E871:85 15   	STA $15    
; control flow target (from $E86D)
0x03E883|$0F:$E873:C6 17   	DEC $17    	; current map Y-pos (1)
0x03E885|$0F:$E875:C6 2C   	DEC $2C    	; current map Y-pos pixel, low byte
0x03E887|$0F:$E877:20 97 D8	JSR $D897  
; control flow target (from $E633, $E6B1, $E794)
0x03E88A|$0F:$E87A:A5 16   	LDA $16    	; current map X-pos (1)
0x03E88C|$0F:$E87C:85 12   	STA $12    
0x03E88E|$0F:$E87E:A5 17   	LDA $17    	; current map Y-pos (1)
0x03E890|$0F:$E880:85 13   	STA $13    
0x03E892|$0F:$E882:20 18 E2	JSR $E218  
0x03E895|$0F:$E885:A5 0D   	LDA $0D    
0x03E897|$0F:$E887:C5 1D   	CMP $1D    
0x03E899|$0F:$E889:D0 17   	BNE $E8A2  
0x03E89B|$0F:$E88B:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E89D|$0F:$E88D:C9 02   	CMP #$02   
0x03E89F|$0F:$E88F:D0 10   	BNE $E8A1  
0x03E8A1|$0F:$E891:A5 16   	LDA $16    	; current map X-pos (1)
0x03E8A3|$0F:$E893:4A      	LSR        
0x03E8A4|$0F:$E894:18      	CLC        
0x03E8A5|$0F:$E895:E5 21   	SBC $21    	; map width
0x03E8A7|$0F:$E897:B0 10   	BCS $E8A9  
0x03E8A9|$0F:$E899:A5 17   	LDA $17    	; current map Y-pos (1)
0x03E8AB|$0F:$E89B:4A      	LSR        
0x03E8AC|$0F:$E89C:18      	CLC        
0x03E8AD|$0F:$E89D:E5 22   	SBC $22    	; map height
0x03E8AF|$0F:$E89F:B0 08   	BCS $E8A9  
; control flow target (from $E88F)
0x03E8B1|$0F:$E8A1:60      	RTS        

; control flow target (from $E889)
0x03E8B2|$0F:$E8A2:85 1D   	STA $1D    
0x03E8B4|$0F:$E8A4:A9 FF   	LDA #$FF   
0x03E8B6|$0F:$E8A6:8D FD 05	STA $05FD  
; control flow target (from $E897, $E89F)
0x03E8B9|$0F:$E8A9:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E8BB|$0F:$E8AB:C9 02   	CMP #$02   
0x03E8BD|$0F:$E8AD:F0 03   	BEQ $E8B2  
0x03E8BF|$0F:$E8AF:4C 34 E9	JMP $E934  

; control flow target (from $E8AD)
0x03E8C2|$0F:$E8B2:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03E8C5|$0F:$E8B5:A5 31   	LDA $31    	; current map ID
0x03E8C7|$0F:$E8B7:38      	SEC        
0x03E8C8|$0F:$E8B8:E9 2B   	SBC #$2B   	; only maps between #$2B and #$47 inclusive are checked for irregularities
0x03E8CA|$0F:$E8BA:0A      	ASL        
0x03E8CB|$0F:$E8BB:A8      	TAY        
0x03E8CC|$0F:$E8BC:B9 E1 A3	LDA $A3E1,Y	; pointers to warp spaces for irregularly-shaped maps
0x03E8CF|$0F:$E8BF:85 10   	STA $10    
0x03E8D1|$0F:$E8C1:B9 E2 A3	LDA $A3E2,Y
0x03E8D4|$0F:$E8C4:85 11   	STA $11    
0x03E8D6|$0F:$E8C6:05 10   	ORA $10    
0x03E8D8|$0F:$E8C8:F0 6A   	BEQ $E934  	; no irregularity => skip over handling irregularities
0x03E8DA|$0F:$E8CA:A5 16   	LDA $16    	; current map X-pos (1)
0x03E8DC|$0F:$E8CC:29 FE   	AND #$FE   	; maps are designed with 2-tile wide transitions between visible segments, so ignore the low bit of map position to cover a 2-tile-wide space
0x03E8DE|$0F:$E8CE:85 0C   	STA $0C    	; current X-pos, 2-tile granularity
0x03E8E0|$0F:$E8D0:A5 17   	LDA $17    	; current map Y-pos (1)
0x03E8E2|$0F:$E8D2:29 FE   	AND #$FE   	; maps are designed with 2-tile high transitions between visible segments, so ignore the low bit of map position to cover a 2-tile-high space
0x03E8E4|$0F:$E8D4:85 0E   	STA $0E    	; current Y-pos, 2-tile granularity
0x03E8E6|$0F:$E8D6:A0 FF   	LDY #$FF   	; initialize index to -1 so that when we INY we'll be at #$00
; control flow target (from $E8E7, $E8ED)
0x03E8E8|$0F:$E8D8:C8      	INY        	; offset for destination map ID
0x03E8E9|$0F:$E8D9:B1 10   	LDA ($10),Y	; destination map ID
0x03E8EB|$0F:$E8DB:C9 FF   	CMP #$FF   	; #$FF => end of list
0x03E8ED|$0F:$E8DD:F0 55   	BEQ $E934  
0x03E8EF|$0F:$E8DF:C8      	INY        	; offset for destination X-pos
0x03E8F0|$0F:$E8E0:C8      	INY        	; offset for destination Y-pos
0x03E8F1|$0F:$E8E1:C8      	INY        	; offset for transition X-pos
0x03E8F2|$0F:$E8E2:B1 10   	LDA ($10),Y	; transition X-pos
0x03E8F4|$0F:$E8E4:C8      	INY        
0x03E8F5|$0F:$E8E5:C5 0C   	CMP $0C    	; current X-pos, 2-tile granularity
0x03E8F7|$0F:$E8E7:D0 EF   	BNE $E8D8  	; not the right X-pos space => loop to next irregularity
0x03E8F9|$0F:$E8E9:B1 10   	LDA ($10),Y	; transition Y-pos
0x03E8FB|$0F:$E8EB:C5 0E   	CMP $0E    	; current Y-pos, 2-tile granularity
0x03E8FD|$0F:$E8ED:D0 E9   	BNE $E8D8  	; not the right X-pos space => loop to next irregularity
0x03E8FF|$0F:$E8EF:88      	DEY        	; offset for transition X-pos
0x03E900|$0F:$E8F0:88      	DEY        	; offset for destination Y-pos
0x03E901|$0F:$E8F1:A5 17   	LDA $17    	; current map Y-pos (1)
0x03E903|$0F:$E8F3:29 01   	AND #$01   	; pick out difference between real position and 2-tile granularity
0x03E905|$0F:$E8F5:11 10   	ORA ($10),Y	; set low bit of destination Y-pos
0x03E907|$0F:$E8F7:85 17   	STA $17    	; current map Y-pos (1)
0x03E909|$0F:$E8F9:85 29   	STA $29    	; current map Y-pos (2)
0x03E90B|$0F:$E8FB:85 13   	STA $13    
0x03E90D|$0F:$E8FD:85 2C   	STA $2C    	; current map Y-pos pixel, low byte
0x03E90F|$0F:$E8FF:88      	DEY        	; offset for destination X-pos
0x03E910|$0F:$E900:A5 16   	LDA $16    	; current map X-pos (1)
0x03E912|$0F:$E902:29 01   	AND #$01   	; pick out difference between real position and 2-tile granularity
0x03E914|$0F:$E904:11 10   	ORA ($10),Y	; set low bit of destination X-pos
0x03E916|$0F:$E906:85 16   	STA $16    	; current map X-pos (1)
0x03E918|$0F:$E908:85 28   	STA $28    	; current map X-pos (2)
0x03E91A|$0F:$E90A:85 12   	STA $12    
0x03E91C|$0F:$E90C:85 2A   	STA $2A    	; current map X-pos pixel, low byte
0x03E91E|$0F:$E90E:88      	DEY        	; offset for destination map ID
0x03E91F|$0F:$E90F:B1 10   	LDA ($10),Y
0x03E921|$0F:$E911:85 31   	STA $31    	; current map ID
0x03E923|$0F:$E913:A9 00   	LDA #$00   
0x03E925|$0F:$E915:85 2B   	STA $2B    	; current map X-pos pixel, high byte
0x03E927|$0F:$E917:85 2D   	STA $2D    	; current map Y-pos pixel, high byte
0x03E929|$0F:$E919:A2 04   	LDX #$04   	; shift 16x16 map position into pixel position variables
; control flow target (from $E924)
0x03E92B|$0F:$E91B:06 2A   	ASL $2A    	; current map X-pos pixel, low byte
0x03E92D|$0F:$E91D:26 2B   	ROL $2B    	; current map X-pos pixel, high byte
0x03E92F|$0F:$E91F:06 2C   	ASL $2C    	; current map Y-pos pixel, low byte
0x03E931|$0F:$E921:26 2D   	ROL $2D    	; current map Y-pos pixel, high byte
0x03E933|$0F:$E923:CA      	DEX        
0x03E934|$0F:$E924:D0 F5   	BNE $E91B  
0x03E936|$0F:$E926:A9 FF   	LDA #$FF   
0x03E938|$0F:$E928:85 45   	STA $45    
0x03E93A|$0F:$E92A:20 61 E4	JSR $E461  
0x03E93D|$0F:$E92D:20 18 E2	JSR $E218  
0x03E940|$0F:$E930:A5 0D   	LDA $0D    
0x03E942|$0F:$E932:85 1D   	STA $1D    
; control flow target (from $E8AF, $E8C8, $E8DD)
0x03E944|$0F:$E934:A9 FF   	LDA #$FF   
0x03E946|$0F:$E936:85 41   	STA $41    
; control flow target (from $D229, $D24D)
; external control flow target (from $06:$97D2)
0x03E948|$0F:$E938:A9 00   	LDA #$00   
0x03E94A|$0F:$E93A:85 18   	STA $18    
0x03E94C|$0F:$E93C:85 19   	STA $19    
0x03E94E|$0F:$E93E:85 42   	STA $42    
0x03E950|$0F:$E940:A9 FE   	LDA #$FE   
0x03E952|$0F:$E942:85 3D   	STA $3D    
0x03E954|$0F:$E944:85 3F   	STA $3F    
0x03E956|$0F:$E946:85 3E   	STA $3E    
0x03E958|$0F:$E948:85 40   	STA $40    
0x03E95A|$0F:$E94A:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03E95D|$0F:$E94D:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E95F|$0F:$E94F:0A      	ASL        
0x03E960|$0F:$E950:A8      	TAY        
0x03E961|$0F:$E951:B9 BD DE	LDA $DEBD,Y
0x03E964|$0F:$E954:85 6F   	STA $6F    
0x03E966|$0F:$E956:C8      	INY        
0x03E967|$0F:$E957:B9 BD DE	LDA $DEBD,Y
0x03E96A|$0F:$E95A:85 70   	STA $70    
0x03E96C|$0F:$E95C:A0 00   	LDY #$00   
; control flow target (from $E964)
0x03E96E|$0F:$E95E:B1 6F   	LDA ($6F),Y
0x03E970|$0F:$E960:99 00 6E	STA $6E00,Y
0x03E973|$0F:$E963:88      	DEY        
0x03E974|$0F:$E964:D0 F8   	BNE $E95E  
0x03E976|$0F:$E966:20 6D EB	JSR $EB6D  
0x03E979|$0F:$E969:20 FC E9	JSR $E9FC  
0x03E97C|$0F:$E96C:A5 41   	LDA $41    
0x03E97E|$0F:$E96E:C9 32   	CMP #$32   
0x03E980|$0F:$E970:F0 48   	BEQ $E9BA  
0x03E982|$0F:$E972:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E985|$0F:$E975:A9 FF   	LDA #$FF   
0x03E987|$0F:$E977:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03E989|$0F:$E979:20 CB D8	JSR $D8CB  
0x03E98C|$0F:$E97C:A9 00   	LDA #$00   
0x03E98E|$0F:$E97E:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03E990|$0F:$E980:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03E993|$0F:$E983:A9 F2   	LDA #$F2   
0x03E995|$0F:$E985:85 19   	STA $19    
0x03E997|$0F:$E987:A9 F0   	LDA #$F0   
0x03E999|$0F:$E989:85 18   	STA $18    
0x03E99B|$0F:$E98B:A9 02   	LDA #$02   
0x03E99D|$0F:$E98D:85 3D   	STA $3D    
0x03E99F|$0F:$E98F:85 3E   	STA $3E    
0x03E9A1|$0F:$E991:A9 0E   	LDA #$0E   
0x03E9A3|$0F:$E993:85 3F   	STA $3F    
0x03E9A5|$0F:$E995:85 40   	STA $40    
0x03E9A7|$0F:$E997:A9 00   	LDA #$00   
0x03E9A9|$0F:$E999:85 41   	STA $41    
0x03E9AB|$0F:$E99B:A2 FF   	LDX #$FF   
0x03E9AD|$0F:$E99D:8E 45 61	STX $6145  
0x03E9B0|$0F:$E9A0:20 38 EA	JSR $EA38  
0x03E9B3|$0F:$E9A3:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E9B5|$0F:$E9A5:C9 03   	CMP #$03   
0x03E9B7|$0F:$E9A7:F0 0A   	BEQ $E9B3  
0x03E9B9|$0F:$E9A9:A5 1D   	LDA $1D    
0x03E9BB|$0F:$E9AB:D0 0D   	BNE $E9BA  
0x03E9BD|$0F:$E9AD:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03E9BF|$0F:$E9AF:C9 02   	CMP #$02   
0x03E9C1|$0F:$E9B1:F0 07   	BEQ $E9BA  
; control flow target (from $E9A7)
0x03E9C3|$0F:$E9B3:A9 01   	LDA #$01   
0x03E9C5|$0F:$E9B5:85 45   	STA $45    
0x03E9C7|$0F:$E9B7:20 F7 D2	JSR $D2F7  
; control flow target (from $E970, $E9AB, $E9B1)
0x03E9CA|$0F:$E9BA:A9 EE   	LDA #$EE   
0x03E9CC|$0F:$E9BC:85 18   	STA $18    
; control flow target (from $E9F7)
0x03E9CE|$0F:$E9BE:20 6D EB	JSR $EB6D  
0x03E9D1|$0F:$E9C1:A9 F2   	LDA #$F2   
0x03E9D3|$0F:$E9C3:85 19   	STA $19    
; control flow target (from $E9D6)
0x03E9D5|$0F:$E9C5:A9 00   	LDA #$00   
0x03E9D7|$0F:$E9C7:85 1C   	STA $1C    
0x03E9D9|$0F:$E9C9:85 1E   	STA $1E    
0x03E9DB|$0F:$E9CB:20 9F EA	JSR $EA9F  
0x03E9DE|$0F:$E9CE:E6 19   	INC $19    
0x03E9E0|$0F:$E9D0:E6 19   	INC $19    
0x03E9E2|$0F:$E9D2:A5 19   	LDA $19    
0x03E9E4|$0F:$E9D4:C9 02   	CMP #$02   
0x03E9E6|$0F:$E9D6:D0 ED   	BNE $E9C5  
0x03E9E8|$0F:$E9D8:20 6D EB	JSR $EB6D  
; control flow target (from $E9EC)
0x03E9EB|$0F:$E9DB:A9 00   	LDA #$00   
0x03E9ED|$0F:$E9DD:85 1C   	STA $1C    
0x03E9EF|$0F:$E9DF:85 1E   	STA $1E    
0x03E9F1|$0F:$E9E1:20 9F EA	JSR $EA9F  
0x03E9F4|$0F:$E9E4:E6 19   	INC $19    
0x03E9F6|$0F:$E9E6:E6 19   	INC $19    
0x03E9F8|$0F:$E9E8:A5 19   	LDA $19    
0x03E9FA|$0F:$E9EA:C9 10   	CMP #$10   
0x03E9FC|$0F:$E9EC:D0 ED   	BNE $E9DB  
0x03E9FE|$0F:$E9EE:A5 18   	LDA $18    
0x03EA00|$0F:$E9F0:18      	CLC        
0x03EA01|$0F:$E9F1:69 22   	ADC #$22   
0x03EA03|$0F:$E9F3:85 18   	STA $18    
0x03EA05|$0F:$E9F5:C9 32   	CMP #$32   
0x03EA07|$0F:$E9F7:D0 C5   	BNE $E9BE  
0x03EA09|$0F:$E9F9:4C DC C1	JMP $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF

; control flow target (from $E969, $EA08, $EA6D, $EA73)
0x03EA0C|$0F:$E9FC:20 76 EA	JSR $EA76  
0x03EA0F|$0F:$E9FF:A5 18   	LDA $18    
0x03EA11|$0F:$EA01:18      	CLC        
0x03EA12|$0F:$EA02:65 3D   	ADC $3D    
0x03EA14|$0F:$EA04:85 18   	STA $18    
0x03EA16|$0F:$EA06:C5 3F   	CMP $3F    
0x03EA18|$0F:$EA08:D0 F2   	BNE $E9FC  
0x03EA1A|$0F:$EA0A:A5 3D   	LDA $3D    
0x03EA1C|$0F:$EA0C:49 FF   	EOR #$FF   
0x03EA1E|$0F:$EA0E:85 3D   	STA $3D    
0x03EA20|$0F:$EA10:E6 3D   	INC $3D    
0x03EA22|$0F:$EA12:A5 3F   	LDA $3F    
0x03EA24|$0F:$EA14:49 FF   	EOR #$FF   
0x03EA26|$0F:$EA16:85 3F   	STA $3F    
0x03EA28|$0F:$EA18:E6 3F   	INC $3F    
0x03EA2A|$0F:$EA1A:10 0B   	BPL $EA27  
0x03EA2C|$0F:$EA1C:A5 41   	LDA $41    
0x03EA2E|$0F:$EA1E:F0 0F   	BEQ $EA2F  
0x03EA30|$0F:$EA20:C6 3F   	DEC $3F    
0x03EA32|$0F:$EA22:C6 3F   	DEC $3F    
0x03EA34|$0F:$EA24:4C 2F EA	JMP $EA2F  

; control flow target (from $EA1A)
0x03EA37|$0F:$EA27:A5 41   	LDA $41    
0x03EA39|$0F:$EA29:D0 04   	BNE $EA2F  
0x03EA3B|$0F:$EA2B:C6 3F   	DEC $3F    
0x03EA3D|$0F:$EA2D:C6 3F   	DEC $3F    
; control flow target (from $EA1E, $EA24, $EA29)
0x03EA3F|$0F:$EA2F:A5 41   	LDA $41    
0x03EA41|$0F:$EA31:D0 05   	BNE $EA38  
0x03EA43|$0F:$EA33:A5 19   	LDA $19    
0x03EA45|$0F:$EA35:D0 01   	BNE $EA38  
0x03EA47|$0F:$EA37:60      	RTS        

; control flow target (from $E9A0, $EA31, $EA35, $EA44)
0x03EA48|$0F:$EA38:20 76 EA	JSR $EA76  
0x03EA4B|$0F:$EA3B:A5 19   	LDA $19    
0x03EA4D|$0F:$EA3D:18      	CLC        
0x03EA4E|$0F:$EA3E:65 3E   	ADC $3E    
0x03EA50|$0F:$EA40:85 19   	STA $19    
0x03EA52|$0F:$EA42:C5 40   	CMP $40    
0x03EA54|$0F:$EA44:D0 F2   	BNE $EA38  
0x03EA56|$0F:$EA46:A5 3E   	LDA $3E    
0x03EA58|$0F:$EA48:49 FF   	EOR #$FF   
0x03EA5A|$0F:$EA4A:85 3E   	STA $3E    
0x03EA5C|$0F:$EA4C:E6 3E   	INC $3E    
0x03EA5E|$0F:$EA4E:A5 40   	LDA $40    
0x03EA60|$0F:$EA50:49 FF   	EOR #$FF   
0x03EA62|$0F:$EA52:85 40   	STA $40    
0x03EA64|$0F:$EA54:E6 40   	INC $40    
0x03EA66|$0F:$EA56:10 0B   	BPL $EA63  
0x03EA68|$0F:$EA58:A5 41   	LDA $41    
0x03EA6A|$0F:$EA5A:F0 0F   	BEQ $EA6B  
0x03EA6C|$0F:$EA5C:C6 40   	DEC $40    
0x03EA6E|$0F:$EA5E:C6 40   	DEC $40    
0x03EA70|$0F:$EA60:4C 6B EA	JMP $EA6B  

; control flow target (from $EA56)
0x03EA73|$0F:$EA63:A5 41   	LDA $41    
0x03EA75|$0F:$EA65:D0 04   	BNE $EA6B  
0x03EA77|$0F:$EA67:C6 40   	DEC $40    
0x03EA79|$0F:$EA69:C6 40   	DEC $40    
; control flow target (from $EA5A, $EA60, $EA65)
0x03EA7B|$0F:$EA6B:A5 41   	LDA $41    
0x03EA7D|$0F:$EA6D:F0 8D   	BEQ $E9FC  
0x03EA7F|$0F:$EA6F:A5 40   	LDA $40    
0x03EA81|$0F:$EA71:C9 10   	CMP #$10   
0x03EA83|$0F:$EA73:D0 87   	BNE $E9FC  
0x03EA85|$0F:$EA75:60      	RTS        

; control flow target (from $E9FC, $EA38)
0x03EA86|$0F:$EA76:A9 00   	LDA #$00   
0x03EA88|$0F:$EA78:85 1E   	STA $1E    
0x03EA8A|$0F:$EA7A:A5 41   	LDA $41    
0x03EA8C|$0F:$EA7C:F0 04   	BEQ $EA82  
0x03EA8E|$0F:$EA7E:A9 FF   	LDA #$FF   
0x03EA90|$0F:$EA80:D0 02   	BNE $EA84  
; control flow target (from $EA7C)
0x03EA92|$0F:$EA82:A9 FE   	LDA #$FE   
; control flow target (from $EA80)
0x03EA94|$0F:$EA84:85 1C   	STA $1C    
0x03EA96|$0F:$EA86:20 9F EA	JSR $EA9F  
0x03EA99|$0F:$EA89:E6 42   	INC $42    
0x03EA9B|$0F:$EA8B:A5 42   	LDA $42    
0x03EA9D|$0F:$EA8D:C9 1E   	CMP #$1E   
0x03EA9F|$0F:$EA8F:F0 06   	BEQ $EA97  
0x03EAA1|$0F:$EA91:A5 01   	LDA $01    
0x03EAA3|$0F:$EA93:C9 12   	CMP #$12   
0x03EAA5|$0F:$EA95:90 07   	BCC $EA9E  
; control flow target (from $EA8F)
0x03EAA7|$0F:$EA97:20 6D EB	JSR $EB6D  
0x03EAAA|$0F:$EA9A:A9 00   	LDA #$00   
0x03EAAC|$0F:$EA9C:85 42   	STA $42    
; control flow target (from $EA95)
0x03EAAE|$0F:$EA9E:60      	RTS        

; control flow target (from $E9CB, $E9E1, $EA86)
0x03EAAF|$0F:$EA9F:20 FC EA	JSR $EAFC  
0x03EAB2|$0F:$EAA2:90 01   	BCC $EAA5  
0x03EAB4|$0F:$EAA4:60      	RTS        

; control flow target (from $EAA2)
0x03EAB5|$0F:$EAA5:A5 0C   	LDA $0C    
0x03EAB7|$0F:$EAA7:0A      	ASL        
0x03EAB8|$0F:$EAA8:0A      	ASL        
0x03EAB9|$0F:$EAA9:65 0C   	ADC $0C    
0x03EABB|$0F:$EAAB:A8      	TAY        
0x03EABC|$0F:$EAAC:A6 02   	LDX $02    
0x03EABE|$0F:$EAAE:A5 08   	LDA $08    
0x03EAC0|$0F:$EAB0:9D 00 03	STA $0300,X	; PPU write buffer start
0x03EAC3|$0F:$EAB3:A5 07   	LDA $07    
0x03EAC5|$0F:$EAB5:9D 01 03	STA $0301,X
0x03EAC8|$0F:$EAB8:B9 00 6E	LDA $6E00,Y
0x03EACB|$0F:$EABB:9D 02 03	STA $0302,X
0x03EACE|$0F:$EABE:B9 01 6E	LDA $6E01,Y
0x03EAD1|$0F:$EAC1:9D 03 03	STA $0303,X
0x03EAD4|$0F:$EAC4:B9 02 6E	LDA $6E02,Y
0x03EAD7|$0F:$EAC7:9D 04 03	STA $0304,X
0x03EADA|$0F:$EACA:B9 03 6E	LDA $6E03,Y
0x03EADD|$0F:$EACD:9D 05 03	STA $0305,X
0x03EAE0|$0F:$EAD0:B9 04 6E	LDA $6E04,Y
0x03EAE3|$0F:$EAD3:29 03   	AND #$03   
0x03EAE5|$0F:$EAD5:85 09   	STA $09    
0x03EAE7|$0F:$EAD7:A5 1A   	LDA $1A    
0x03EAE9|$0F:$EAD9:85 0C   	STA $0C    
0x03EAEB|$0F:$EADB:A5 1B   	LDA $1B    
0x03EAED|$0F:$EADD:85 0E   	STA $0E    
0x03EAEF|$0F:$EADF:20 6E DE	JSR $DE6E  
0x03EAF2|$0F:$EAE2:A5 08   	LDA $08    
0x03EAF4|$0F:$EAE4:09 20   	ORA #$20   
0x03EAF6|$0F:$EAE6:9D 06 03	STA $0306,X
0x03EAF9|$0F:$EAE9:A5 07   	LDA $07    
0x03EAFB|$0F:$EAEB:9D 07 03	STA $0307,X
0x03EAFE|$0F:$EAEE:A5 09   	LDA $09    
0x03EB00|$0F:$EAF0:9D 08 03	STA $0308,X
0x03EB03|$0F:$EAF3:8A      	TXA        
0x03EB04|$0F:$EAF4:18      	CLC        
0x03EB05|$0F:$EAF5:69 09   	ADC #$09   
0x03EB07|$0F:$EAF7:85 02   	STA $02    
0x03EB09|$0F:$EAF9:E6 01   	INC $01    
0x03EB0B|$0F:$EAFB:60      	RTS        

; control flow target (from $DEC5, $EA9F)
0x03EB0C|$0F:$EAFC:20 62 DF	JSR $DF62  
0x03EB0F|$0F:$EAFF:A5 0C   	LDA $0C    
0x03EB11|$0F:$EB01:85 1A   	STA $1A    
0x03EB13|$0F:$EB03:A5 0E   	LDA $0E    
0x03EB15|$0F:$EB05:85 1B   	STA $1B    
0x03EB17|$0F:$EB07:20 00 DE	JSR $DE00  
0x03EB1A|$0F:$EB0A:A5 18   	LDA $18    
0x03EB1C|$0F:$EB0C:0A      	ASL        
0x03EB1D|$0F:$EB0D:A5 18   	LDA $18    
0x03EB1F|$0F:$EB0F:6A      	ROR        
0x03EB20|$0F:$EB10:18      	CLC        
0x03EB21|$0F:$EB11:65 16   	ADC $16    	; current map X-pos (1)
0x03EB23|$0F:$EB13:85 0C   	STA $0C    
0x03EB25|$0F:$EB15:A5 19   	LDA $19    
0x03EB27|$0F:$EB17:0A      	ASL        
0x03EB28|$0F:$EB18:A5 19   	LDA $19    
0x03EB2A|$0F:$EB1A:6A      	ROR        
0x03EB2B|$0F:$EB1B:18      	CLC        
0x03EB2C|$0F:$EB1C:65 17   	ADC $17    	; current map Y-pos (1)
0x03EB2E|$0F:$EB1E:85 0E   	STA $0E    
0x03EB30|$0F:$EB20:20 89 DF	JSR $DF89  
0x03EB33|$0F:$EB23:20 22 E2	JSR $E222  
0x03EB36|$0F:$EB26:A5 1D   	LDA $1D    
0x03EB38|$0F:$EB28:C5 0D   	CMP $0D    
0x03EB3A|$0F:$EB2A:F0 22   	BEQ $EB4E  
0x03EB3C|$0F:$EB2C:A5 0C   	LDA $0C    
0x03EB3E|$0F:$EB2E:C9 28   	CMP #$28   
0x03EB40|$0F:$EB30:B0 1C   	BCS $EB4E  
0x03EB42|$0F:$EB32:A5 1D   	LDA $1D    
0x03EB44|$0F:$EB34:D0 14   	BNE $EB4A  
0x03EB46|$0F:$EB36:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03EB48|$0F:$EB38:C9 01   	CMP #$01   
0x03EB4A|$0F:$EB3A:F0 0A   	BEQ $EB46  
0x03EB4C|$0F:$EB3C:A5 0C   	LDA $0C    
0x03EB4E|$0F:$EB3E:C9 08   	CMP #$08   
0x03EB50|$0F:$EB40:90 04   	BCC $EB46  
0x03EB52|$0F:$EB42:C9 0C   	CMP #$0C   
0x03EB54|$0F:$EB44:90 08   	BCC $EB4E  
; control flow target (from $EB3A, $EB40)
0x03EB56|$0F:$EB46:A9 20   	LDA #$20   
0x03EB58|$0F:$EB48:D0 02   	BNE $EB4C  
; control flow target (from $EB34)
0x03EB5A|$0F:$EB4A:A9 24   	LDA #$24   
; control flow target (from $EB48)
0x03EB5C|$0F:$EB4C:85 0C   	STA $0C    
; control flow target (from $EB2A, $EB30, $EB44)
0x03EB5E|$0F:$EB4E:A5 1C   	LDA $1C    
0x03EB60|$0F:$EB50:C9 FF   	CMP #$FF   
0x03EB62|$0F:$EB52:D0 07   	BNE $EB5B  
0x03EB64|$0F:$EB54:A5 0C   	LDA $0C    
0x03EB66|$0F:$EB56:C9 20   	CMP #$20   
0x03EB68|$0F:$EB58:90 0D   	BCC $EB67  
0x03EB6A|$0F:$EB5A:60      	RTS        

; control flow target (from $EB52)
0x03EB6B|$0F:$EB5B:C9 FE   	CMP #$FE   
0x03EB6D|$0F:$EB5D:D0 0C   	BNE $EB6B  
0x03EB6F|$0F:$EB5F:A5 0C   	LDA $0C    
0x03EB71|$0F:$EB61:C9 20   	CMP #$20   
0x03EB73|$0F:$EB63:B0 02   	BCS $EB67  
0x03EB75|$0F:$EB65:38      	SEC        
0x03EB76|$0F:$EB66:60      	RTS        

; control flow target (from $EB58, $EB63)
0x03EB77|$0F:$EB67:A9 00   	LDA #$00   
0x03EB79|$0F:$EB69:85 1C   	STA $1C    
; control flow target (from $EB5D)
0x03EB7B|$0F:$EB6B:18      	CLC        
0x03EB7C|$0F:$EB6C:60      	RTS        

; control flow target (from $E966, $E9BE, $E9D8, $EA97)
0x03EB7D|$0F:$EB6D:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03EB80|$0F:$EB70:A9 FF   	LDA #$FF   
0x03EB82|$0F:$EB72:8D 45 61	STA $6145  
0x03EB85|$0F:$EB75:60      	RTS        

; open menu specified by next byte
; control flow target (from $C750, $C84D, $F6FC)
; external control flow target (from $02:$B29D, $06:$8061, $06:$8065, $06:$8232, $06:$8242, $06:$8374, $06:$83A3, $06:$8455, $06:$84BB, $06:$8540, $06:$855B, $06:$867D, $06:$868D, $06:$8BFC, $06:$8C29, $06:$9584, $06:$95FF, $06:$9ACB, $06:$9AD0, $06:$9B17, $06:$A0CA, $06:$A204, $06:$BB4E, $06:$BB5F, $06:$BBAB, $06:$BBCA, $06:$BC22, $06:$BD4F)
0x03EB86|$0F:$EB76:68      	PLA        	; low byte of return address
0x03EB87|$0F:$EB77:18      	CLC        
0x03EB88|$0F:$EB78:69 01   	ADC #$01   	; increment it (byte following the JSR is data)
0x03EB8A|$0F:$EB7A:85 0E   	STA $0E    	; store to $0E
0x03EB8C|$0F:$EB7C:68      	PLA        	; high byte of return address
0x03EB8D|$0F:$EB7D:69 00   	ADC #$00   	; add carry from incrementing low byte
0x03EB8F|$0F:$EB7F:85 0F   	STA $0F    	; store to $0F
0x03EB91|$0F:$EB81:48      	PHA        	; push the new return address's high byte
0x03EB92|$0F:$EB82:A5 0E   	LDA $0E    
0x03EB94|$0F:$EB84:48      	PHA        	; push the new return address's low byte
0x03EB95|$0F:$EB85:A0 00   	LDY #$00   
0x03EB97|$0F:$EB87:B1 0E   	LDA ($0E),Y	; read the byte following the original JSR
; open menu specified by A
; control flow target (from $D188, $F494, $F49B, $F4A2, $F4BE, $F514, $F521, $F526, $F531, $F53F, $F54F, $F565, $F573, $F581, $F58F, $F59D, $F5CF, $F5D8, $F5DC, $F5F0, $F60C, $F620, $F625, $F63F, $F648, $F652, $F657)
; external control flow target (from $04:$9AB1, $04:$9AC4, $06:$A997, $06:$AEAC, $06:$AEB1)
0x03EB99|$0F:$EB89:20 6E F6	JSR $F66E  	; do special effects for certain menus; sets A to menu ID
0x03EB9C|$0F:$EB8C:90 03   	BCC $EB91  	; all $F66E code paths end with SEC, so this branch is never taken
0x03EB9E|$0F:$EB8E:20 98 EB	JSR $EB98  
; control flow target (from $EB8C)
0x03EBA1|$0F:$EB91:48      	PHA        
0x03EBA2|$0F:$EB92:AD 94 00	LDA $0094  	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03EBA5|$0F:$EB95:4C 82 F7	JMP $F782  	; load bank specified by A then PLA

; control flow target (from $EB8E)
0x03EBA8|$0F:$EB98:85 59   	STA $59    	; menu ID
0x03EBAA|$0F:$EB9A:A9 01   	LDA #$01   
0x03EBAC|$0F:$EB9C:8D B4 60	STA $60B4  	; menu phase (1 = first, 0 = second)
0x03EBAF|$0F:$EB9F:20 A8 EB	JSR $EBA8  
0x03EBB2|$0F:$EBA2:20 35 F4	JSR $F435  
0x03EBB5|$0F:$EBA5:CE B4 60	DEC $60B4  	; menu phase (1 = first, 0 = second)
; control flow target (from $EB9F)
0x03EBB8|$0F:$EBA8:20 B2 EB	JSR $EBB2  	; given menu ID in $59, set $55-$56 to start of menu data
0x03EBBB|$0F:$EBAB:20 C5 EB	JSR $EBC5  	; parse menu setup header
0x03EBBE|$0F:$EBAE:20 11 EC	JSR $EC11  
0x03EBC1|$0F:$EBB1:60      	RTS        

; given menu ID in $59, set $55-$56 to start of menu data
; control flow target (from $EBA8)
0x03EBC2|$0F:$EBB2:A9 20   	LDA #$20   	; menu pointer table
0x03EBC4|$0F:$EBB4:20 E2 F3	JSR $F3E2  	; parse bank/pointer indices from A, load desired bank, set $57-$58 to desired pointer value
0x03EBC7|$0F:$EBB7:A5 59   	LDA $59    	; menu ID
0x03EBC9|$0F:$EBB9:0A      	ASL        	; 2 bytes per pointer
0x03EBCA|$0F:$EBBA:A8      	TAY        
0x03EBCB|$0F:$EBBB:B1 57   	LDA ($57),Y	; pointer to start of main pointer table, low byte; copy menu pointer to $55-$56
0x03EBCD|$0F:$EBBD:85 55   	STA $55    	; pointer to start of sub pointer data, low byte
0x03EBCF|$0F:$EBBF:C8      	INY        
0x03EBD0|$0F:$EBC0:B1 57   	LDA ($57),Y	; pointer to start of main pointer table, low byte
0x03EBD2|$0F:$EBC2:85 56   	STA $56    	; pointer to start of sub pointer data, high byte
0x03EBD4|$0F:$EBC4:60      	RTS        

; parse menu setup header
; control flow target (from $EBAB)
0x03EBD5|$0F:$EBC5:A0 00   	LDY #$00   	; start at the start
0x03EBD7|$0F:$EBC7:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03EBD9|$0F:$EBC9:8D AA 60	STA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03EBDC|$0F:$EBCC:C8      	INY        
0x03EBDD|$0F:$EBCD:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03EBDF|$0F:$EBCF:8D A2 60	STA $60A2  	; menu window height (from ROM)
0x03EBE2|$0F:$EBD2:0A      	ASL        
0x03EBE3|$0F:$EBD3:8D A3 60	STA $60A3  	; menu window height (ROM value * 2)
0x03EBE6|$0F:$EBD6:C8      	INY        
0x03EBE7|$0F:$EBD7:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03EBE9|$0F:$EBD9:8D A1 60	STA $60A1  	; menu window width
0x03EBEC|$0F:$EBDC:C8      	INY        
0x03EBED|$0F:$EBDD:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03EBEF|$0F:$EBDF:8D A4 60	STA $60A4  	; menu window position (from ROM; X-pos = low nybble * 2, Y-pos = high nybble * 2)
0x03EBF2|$0F:$EBE2:48      	PHA        
0x03EBF3|$0F:$EBE3:29 0F   	AND #$0F   
0x03EBF5|$0F:$EBE5:0A      	ASL        
0x03EBF6|$0F:$EBE6:85 4D   	STA $4D    	; menu window X-pos
0x03EBF8|$0F:$EBE8:68      	PLA        
0x03EBF9|$0F:$EBE9:29 F0   	AND #$F0   
0x03EBFB|$0F:$EBEB:4A      	LSR        
0x03EBFC|$0F:$EBEC:4A      	LSR        
0x03EBFD|$0F:$EBED:4A      	LSR        
0x03EBFE|$0F:$EBEE:85 4E   	STA $4E    	; menu window Y-pos
0x03EC00|$0F:$EBF0:C8      	INY        
0x03EC01|$0F:$EBF1:AD AA 60	LDA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03EC04|$0F:$EBF4:10 0C   	BPL $EC02  	; if no cursor, skip ahead
0x03EC06|$0F:$EBF6:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03EC08|$0F:$EBF8:8D A5 60	STA $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x03EC0B|$0F:$EBFB:C8      	INY        
0x03EC0C|$0F:$EBFC:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03EC0E|$0F:$EBFE:8D A9 60	STA $60A9  	; menu cursor initial position (from ROM; X-pos = low nybble, Y-pos = high nybble)
0x03EC11|$0F:$EC01:C8      	INY        
; control flow target (from $EBF4)
0x03EC12|$0F:$EC02:2C AA 60	BIT $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03EC15|$0F:$EC05:50 06   	BVC $EC0D  	; if menu is not linked, skip ahead
0x03EC17|$0F:$EC07:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03EC19|$0F:$EC09:8D AE 60	STA $60AE  	; menu link ID
0x03EC1C|$0F:$EC0C:C8      	INY        
; control flow target (from $EC05)
0x03EC1D|$0F:$EC0D:8C A6 60	STY $60A6  	; current menu read index
0x03EC20|$0F:$EC10:60      	RTS        

; control flow target (from $EBAE)
0x03EC21|$0F:$EC11:20 29 EC	JSR $EC29  	; initialize menu vars, remove battle item menu link if not enough items
; control flow target (from $EC23, $ECEE)
0x03EC24|$0F:$EC14:20 78 EC	JSR $EC78  	; set menu text $609B to [space] or the appropriate border tile
0x03EC27|$0F:$EC17:20 C5 EC	JSR $ECC5  	; tweak dynamic list height if necessary, otherwise set menu function index and parameter
0x03EC2A|$0F:$EC1A:20 1C ED	JSR $ED1C  	; given menu function index in $609C, set $57-$58 to corresponding function address and execute it
0x03EC2D|$0F:$EC1D:20 2B F0	JSR $F02B  
0x03EC30|$0F:$EC20:20 57 F0	JSR $F057  	; CLC if more menu rows to display, SEC otherwise
0x03EC33|$0F:$EC23:90 EF   	BCC $EC14  
0x03EC35|$0F:$EC25:20 B7 F0	JSR $F0B7  
0x03EC38|$0F:$EC28:60      	RTS        

; initialize menu vars, remove battle item menu link if not enough items
; control flow target (from $EC11)
0x03EC39|$0F:$EC29:20 C1 F0	JSR $F0C1  	; write [space] to $600B-$6046
0x03EC3C|$0F:$EC2C:A9 FF   	LDA #$FF   
0x03EC3E|$0F:$EC2E:8D B9 60	STA $60B9  
0x03EC41|$0F:$EC31:A9 00   	LDA #$00   
0x03EC43|$0F:$EC33:8D 9E 60	STA $609E  	; menu current column
0x03EC46|$0F:$EC36:8D 9F 60	STA $609F  	; menu current row
0x03EC49|$0F:$EC39:8D AC 60	STA $60AC  	; menu list index
0x03EC4C|$0F:$EC3C:8D AB 60	STA $60AB  	; which list segment we're dealing with
0x03EC4F|$0F:$EC3F:8D A8 60	STA $60A8  	; remaining number of rows for dynamic menu lists
0x03EC52|$0F:$EC42:85 10   	STA $10    
0x03EC54|$0F:$EC44:85 11   	STA $11    
0x03EC56|$0F:$EC46:85 12   	STA $12    
0x03EC58|$0F:$EC48:A5 59   	LDA $59    	; menu ID
0x03EC5A|$0F:$EC4A:C9 22   	CMP #$22   	; Menu ID #$22: Battle menu: item list window 2
0x03EC5C|$0F:$EC4C:D0 05   	BNE $EC53  
0x03EC5E|$0F:$EC4E:A9 04   	LDA #$04   
0x03EC60|$0F:$EC50:8D AC 60	STA $60AC  	; menu list index
; control flow target (from $EC4C)
0x03EC63|$0F:$EC53:A5 59   	LDA $59    	; menu ID
0x03EC65|$0F:$EC55:C9 08   	CMP #$08   	; Menu ID #$08: Battle menu: item list window 1
0x03EC67|$0F:$EC57:D0 14   	BNE $EC6D  
0x03EC69|$0F:$EC59:A9 04   	LDA #$04   	; count all items
0x03EC6B|$0F:$EC5B:8D 9D 60	STA $609D  	; menu function parameter
0x03EC6E|$0F:$EC5E:20 B7 F1	JSR $F1B7  	; given hero ID in $4A and item type in $609D, set A = number of items of desired type in hero's inventory
0x03EC71|$0F:$EC61:C9 05   	CMP #$05   	; max 4 items per screen
0x03EC73|$0F:$EC63:B0 08   	BCS $EC6D  	; if < 5 items, disable menu link
0x03EC75|$0F:$EC65:AD AA 60	LDA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03EC78|$0F:$EC68:29 BF   	AND #$BF   	; clear bit 6
0x03EC7A|$0F:$EC6A:8D AA 60	STA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
; control flow target (from $EC57, $EC63)
0x03EC7D|$0F:$EC6D:A9 00   	LDA #$00   	; write #$00 to $606B-$607A
0x03EC7F|$0F:$EC6F:A2 0F   	LDX #$0F   
; control flow target (from $EC75)
0x03EC81|$0F:$EC71:9D 6B 60	STA $606B,X
0x03EC84|$0F:$EC74:CA      	DEX        
0x03EC85|$0F:$EC75:10 FA   	BPL $EC71  
0x03EC87|$0F:$EC77:60      	RTS        

; set menu text $609B to [space] or the appropriate border tile
; control flow target (from $EC14)
0x03EC88|$0F:$EC78:A9 5F   	LDA #$5F   	; [space]
0x03EC8A|$0F:$EC7A:8D 9B 60	STA $609B  	; menu text
0x03EC8D|$0F:$EC7D:AE 9E 60	LDX $609E  	; menu current column
0x03EC90|$0F:$EC80:F0 1D   	BEQ $EC9F  	; if we're at column 0, branch to figure out what kind of left border to draw
0x03EC92|$0F:$EC82:E8      	INX        
0x03EC93|$0F:$EC83:EC A1 60	CPX $60A1  	; menu window width
0x03EC96|$0F:$EC86:D0 2E   	BNE $ECB6  	; if we're not at width - 1, branch over figuring out what kind of right border to draw
0x03EC98|$0F:$EC88:AE 9F 60	LDX $609F  	; menu current row
0x03EC9B|$0F:$EC8B:F0 0A   	BEQ $EC97  	; if we're on row 0, use a [top-right border]
0x03EC9D|$0F:$EC8D:E8      	INX        
0x03EC9E|$0F:$EC8E:EC A3 60	CPX $60A3  	; menu window height (ROM value * 2)
0x03ECA1|$0F:$EC91:F0 08   	BEQ $EC9B  	; if we're on the last row, use a [bottom-right border], otherwise we're in between, so use a plain [right border]
0x03ECA3|$0F:$EC93:A9 7B   	LDA #$7B   	; [right border]
0x03ECA5|$0F:$EC95:D0 2A   	BNE $ECC1  
; control flow target (from $EC8B)
0x03ECA7|$0F:$EC97:A9 7C   	LDA #$7C   	; [top-right border]
0x03ECA9|$0F:$EC99:D0 26   	BNE $ECC1  
; control flow target (from $EC91)
0x03ECAB|$0F:$EC9B:A9 7E   	LDA #$7E   	; [bottom-right border]
0x03ECAD|$0F:$EC9D:D0 22   	BNE $ECC1  
; control flow target (from $EC80)
0x03ECAF|$0F:$EC9F:AE 9F 60	LDX $609F  	; menu current row
0x03ECB2|$0F:$ECA2:F0 0A   	BEQ $ECAE  	; if we're on row 0, use a [top-left border]
0x03ECB4|$0F:$ECA4:E8      	INX        
0x03ECB5|$0F:$ECA5:EC A3 60	CPX $60A3  	; menu window height (ROM value * 2)
0x03ECB8|$0F:$ECA8:F0 08   	BEQ $ECB2  	; if we're on the last row, use a [bottom-left border], otherwise we're in between, so use a plain [left border]
0x03ECBA|$0F:$ECAA:A9 76   	LDA #$76   	; [left border]
0x03ECBC|$0F:$ECAC:D0 13   	BNE $ECC1  
; control flow target (from $ECA2)
0x03ECBE|$0F:$ECAE:A9 79   	LDA #$79   	; [top-left border]
0x03ECC0|$0F:$ECB0:D0 0F   	BNE $ECC1  
; control flow target (from $ECA8)
0x03ECC2|$0F:$ECB2:A9 7A   	LDA #$7A   	; [bottom-left border]
0x03ECC4|$0F:$ECB4:D0 0B   	BNE $ECC1  
; control flow target (from $EC86)
0x03ECC6|$0F:$ECB6:AE 9F 60	LDX $609F  	; menu current row
0x03ECC9|$0F:$ECB9:E8      	INX        
0x03ECCA|$0F:$ECBA:EC A3 60	CPX $60A3  	; menu window height (ROM value * 2)
0x03ECCD|$0F:$ECBD:D0 05   	BNE $ECC4  	; if we're on the last row, use a [bottom border], otherwise keep that [space] we started with
0x03ECCF|$0F:$ECBF:A9 7D   	LDA #$7D   	; [bottom border]
; control flow target (from $EC95, $EC99, $EC9D, $ECAC, $ECB0, $ECB4)
0x03ECD1|$0F:$ECC1:8D 9B 60	STA $609B  	; menu text
; control flow target (from $ECBD)
0x03ECD4|$0F:$ECC4:60      	RTS        

; tweak dynamic list height if necessary, otherwise set menu function index and parameter
; control flow target (from $EC17)
0x03ECD5|$0F:$ECC5:AD 9B 60	LDA $609B  	; menu text
0x03ECD8|$0F:$ECC8:C9 5F   	CMP #$5F   	; [space]
0x03ECDA|$0F:$ECCA:D0 4A   	BNE $ED16  	; if menu text is not a [space], set menu function index to #$10 (print one byte of menu text) and RTS
0x03ECDC|$0F:$ECCC:AD AA 60	LDA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03ECDF|$0F:$ECCF:29 20   	AND #$20   	; pick out the single-spaced bit
0x03ECE1|$0F:$ECD1:D0 22   	BNE $ECF5  	; read current menu byte and set menu function index and parameter; branch if single-spaced
0x03ECE3|$0F:$ECD3:AD 9F 60	LDA $609F  	; menu current row
0x03ECE6|$0F:$ECD6:4A      	LSR        
0x03ECE7|$0F:$ECD7:90 1C   	BCC $ECF5  	; read current menu byte and set menu function index and parameter; branch if even row
0x03ECE9|$0F:$ECD9:AD A8 60	LDA $60A8  	; remaining number of rows for dynamic menu lists
0x03ECEC|$0F:$ECDC:C9 01   	CMP #$01   
0x03ECEE|$0F:$ECDE:D0 11   	BNE $ECF1  	; set menu function index and parameter to #$00 (i.e. setup for newline function)
0x03ECF0|$0F:$ECE0:A9 00   	LDA #$00   	; reset menu current column
0x03ECF2|$0F:$ECE2:8D 9E 60	STA $609E  	; menu current column
0x03ECF5|$0F:$ECE5:AE 9F 60	LDX $609F  	; menu current row
0x03ECF8|$0F:$ECE8:E8      	INX        
0x03ECF9|$0F:$ECE9:8E A3 60	STX $60A3  	; menu window height (ROM value * 2)
0x03ECFC|$0F:$ECEC:68      	PLA        	; skip over the next few menu processing functions
0x03ECFD|$0F:$ECED:68      	PLA        
0x03ECFE|$0F:$ECEE:4C 14 EC	JMP $EC14  

; set menu function index and parameter to #$00 (i.e. setup for newline function)
; control flow target (from $ECDE)
0x03ED01|$0F:$ECF1:A9 00   	LDA #$00   
0x03ED03|$0F:$ECF3:F0 0E   	BEQ $ED03  	; split A into menu function index and parameter and save them
; read current menu byte and set menu function index and parameter
; control flow target (from $ECD1, $ECD7)
0x03ED05|$0F:$ECF5:AC A6 60	LDY $60A6  	; current menu read index
0x03ED08|$0F:$ECF8:EE A6 60	INC $60A6  	; current menu read index
0x03ED0B|$0F:$ECFB:20 FA FE	JSR $FEFA  	; increment JSR's return address, read byte following JSR, parse it for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank

; code -> data
; indirect data load target
0x03ED0E|$0F:$ECFE:20	; $01:$8000; -> $01:$B642: menu pointer table

; data -> code
0x03ED0F|$0F:$ECFF:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03ED11|$0F:$ED01:10 10   	BPL $ED13  	; high bit determines whether byte is function (set) or text (clear)
; split A into menu function index and parameter and save them
; control flow target (from $ECF3)
0x03ED13|$0F:$ED03:29 7F   	AND #$7F   	; clear function bit
0x03ED15|$0F:$ED05:48      	PHA        
0x03ED16|$0F:$ED06:29 07   	AND #$07   	; menu function parameter is 3 bits wide
0x03ED18|$0F:$ED08:8D 9D 60	STA $609D  	; menu function parameter
0x03ED1B|$0F:$ED0B:68      	PLA        
0x03ED1C|$0F:$ED0C:4A      	LSR        	; menu function index is 4 bits wide
0x03ED1D|$0F:$ED0D:4A      	LSR        
0x03ED1E|$0F:$ED0E:4A      	LSR        
0x03ED1F|$0F:$ED0F:8D 9C 60	STA $609C  	; menu function index
0x03ED22|$0F:$ED12:60      	RTS        

; control flow target (from $ED01)
0x03ED23|$0F:$ED13:8D 9B 60	STA $609B  	; menu text
; control flow target (from $ECCA)
0x03ED26|$0F:$ED16:A9 10   	LDA #$10   
0x03ED28|$0F:$ED18:8D 9C 60	STA $609C  	; menu function index
0x03ED2B|$0F:$ED1B:60      	RTS        

; given menu function index in $609C, set $57-$58 to corresponding function address and execute it
; control flow target (from $EC1A)
0x03ED2C|$0F:$ED1C:AD 9C 60	LDA $609C  	; menu function index
0x03ED2F|$0F:$ED1F:0A      	ASL        
0x03ED30|$0F:$ED20:AA      	TAX        
0x03ED31|$0F:$ED21:BD CC F0	LDA $F0CC,X	; menu control code jump table low byte
0x03ED34|$0F:$ED24:85 57   	STA $57    	; pointer to start of main pointer table, low byte
0x03ED36|$0F:$ED26:BD CD F0	LDA $F0CD,X	; menu control code jump table high byte
0x03ED39|$0F:$ED29:85 58   	STA $58    	; pointer to start of main pointer table, high byte
0x03ED3B|$0F:$ED2B:6C 57 00	JMP ($0057)	; pointer to start of main pointer table, low byte

; menu control code #$80-#$87 handler: print number of spaces specified by $609D (or rest of line if $609D is #$00) to current menu position
; control flow target (from $EF8A)
; indirect control flow target (via $F0CC)
0x03ED3E|$0F:$ED2E:A9 5F   	LDA #$5F   	; Tile ID #$5F: [space]
0x03ED40|$0F:$ED30:8D 9B 60	STA $609B  	; menu text
0x03ED43|$0F:$ED33:20 5E F0	JSR $F05E  	; set $60A0 based on menu function parameter $609D and number of remaining tiles in the current line
; control flow target (from $ED3C)
0x03ED46|$0F:$ED36:20 13 F0	JSR $F013  	; update menu current column and row
0x03ED49|$0F:$ED39:CE A0 60	DEC $60A0  	; maximum string length
0x03ED4C|$0F:$ED3C:D0 F8   	BNE $ED36  	; if more tiles to print, print them
0x03ED4E|$0F:$ED3E:60      	RTS        

; menu control code #$88-#$8F handler: print number of top border tiles specified by $609D (or rest of line if $609D is #$00) to current menu position, accounting for possible linked menu
; indirect control flow target (via $F0CE)
0x03ED4F|$0F:$ED3F:2C AA 60	BIT $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03ED52|$0F:$ED42:50 10   	BVC $ED54  	; if not linked, skip ahead
0x03ED54|$0F:$ED44:A9 5F   	LDA #$5F   	; Tile ID #$5F: [space]
0x03ED56|$0F:$ED46:8D 9B 60	STA $609B  	; menu text
0x03ED59|$0F:$ED49:20 E4 EF	JSR $EFE4  	; print one byte of menu text
0x03ED5C|$0F:$ED4C:A9 63   	LDA #$63   	; Tile ID #$63: [right arrow]
0x03ED5E|$0F:$ED4E:8D 9B 60	STA $609B  	; menu text
0x03ED61|$0F:$ED51:20 E4 EF	JSR $EFE4  	; print one byte of menu text
; control flow target (from $ED42)
0x03ED64|$0F:$ED54:A9 77   	LDA #$77   	; Tile ID #$77: [top border]
0x03ED66|$0F:$ED56:8D 9B 60	STA $609B  	; menu text
0x03ED69|$0F:$ED59:20 5E F0	JSR $F05E  	; set $60A0 based on menu function parameter $609D and number of remaining tiles in the current line
; control flow target (from $ED62)
0x03ED6C|$0F:$ED5C:20 E4 EF	JSR $EFE4  	; print one byte of menu text
0x03ED6F|$0F:$ED5F:CE A0 60	DEC $60A0  	; maximum string length
0x03ED72|$0F:$ED62:D0 F8   	BNE $ED5C  	; if more tiles to print, print them
0x03ED74|$0F:$ED64:60      	RTS        

; menu control code #$90-#$97 handler: print selected hero's current HP or MP
; indirect control flow target (via $F0D0)
0x03ED75|$0F:$ED65:A9 03   	LDA #$03   
0x03ED77|$0F:$ED67:20 7A F0	JSR $F07A  	; set maximum string length $60A0 to A and update menu function parameter $609D: if its bits 0-1 are both set, use $4A | bit 2 of $609D, else use the low 3 bits of $609D
0x03ED7A|$0F:$ED6A:A2 0E   	LDX #$0E   	; offset for current HP
0x03ED7C|$0F:$ED6C:AD 9D 60	LDA $609D  	; menu function parameter
0x03ED7F|$0F:$ED6F:29 04   	AND #$04   	; MP control codes set bit 2
0x03ED81|$0F:$ED71:F0 02   	BEQ $ED75  
0x03ED83|$0F:$ED73:A2 10   	LDX #$10   	; offset for current MP
; control flow target (from $ED71)
0x03ED85|$0F:$ED75:A0 01   	LDY #$01   	; print one byte (ignores 2nd byte of current HP)
0x03ED87|$0F:$ED77:4C 96 F0	JMP $F096  	; given hero ID in ID $609D, stat offset in X, and stat byte size in Y (max of #$03), print that stat in base 10 to current menu position, replacing leading zeroes with spaces

; menu control code #$98-#$9F handler: print party gold or crests or "ADVENTURE LOG"
; indirect control flow target (via $F0D2)
0x03ED8A|$0F:$ED7A:A9 05   	LDA #$05   	; start by assuming crests
0x03ED8C|$0F:$ED7C:8D A0 60	STA $60A0  	; maximum string length
0x03ED8F|$0F:$ED7F:AD 9D 60	LDA $609D  	; menu function parameter
0x03ED92|$0F:$ED82:F0 23   	BEQ $EDA7  	; menu control code #$98 handler: print party gold
0x03ED94|$0F:$ED84:C9 01   	CMP #$01   
0x03ED96|$0F:$ED86:D0 25   	BNE $EDAD  	; menu control code #$9A-#$9F handler: print "ADVENTURE LOG"
; menu control code #$99 handler: print obtained crests
0x03ED98|$0F:$ED88:20 9F F1	JSR $F19F  	; initialize string buffer $0100-$010C with [space]s
0x03ED9B|$0F:$ED8B:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x03ED9E|$0F:$ED8E:29 1F   	AND #$1F   	; pretty sure nothing writes to the high 3 bits, but better safe than sorry
0x03EDA0|$0F:$ED90:85 10   	STA $10    	; crests found
0x03EDA2|$0F:$ED92:A2 04   	LDX #$04   	; maximum of 5 crests
0x03EDA4|$0F:$ED94:A0 5A   	LDY #$5A   	; Tile ID #$5A: [sun]
; control flow target (from $EDA2)
0x03EDA6|$0F:$ED96:46 10   	LSR $10    	; shift crest bit into C
0x03EDA8|$0F:$ED98:90 05   	BCC $ED9F  	; branch if crest not found
0x03EDAA|$0F:$ED9A:98      	TYA        
0x03EDAB|$0F:$ED9B:9D 00 01	STA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x03EDAE|$0F:$ED9E:CA      	DEX        
; control flow target (from $ED98)
0x03EDAF|$0F:$ED9F:C8      	INY        	; crest tile ID
0x03EDB0|$0F:$EDA0:A5 10   	LDA $10    	; remaining crests
0x03EDB2|$0F:$EDA2:D0 F2   	BNE $ED96  	; if more crests to copy, copy them
0x03EDB4|$0F:$EDA4:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$98 handler: print party gold
; control flow target (from $ED82)
0x03EDB7|$0F:$EDA7:20 79 F4	JSR $F479  	; print party gold to $0100 in decimal in reverse, replacing leading (now trailing) zeroes with spaces, leaving X at most significant digit
0x03EDBA|$0F:$EDAA:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$9A-#$9F handler: print "ADVENTURE LOG"
; 9B-9F are unused
; control flow target (from $ED86)
0x03EDBD|$0F:$EDAD:A9 0D   	LDA #$0D   	; length of "ADVENTRUE LOG"
0x03EDBF|$0F:$EDAF:8D A0 60	STA $60A0  	; maximum string length
0x03EDC2|$0F:$EDB2:AA      	TAX        
; control flow target (from $EDBA)
0x03EDC3|$0F:$EDB3:BD BE ED	LDA $EDBE,X	; built-in offset from $EDBF: "GOL ERUTNEVDA", i.e. "ADVENTRUE LOG" backwards
0x03EDC6|$0F:$EDB6:9D FF 00	STA $00FF,X	; built-in offset from string copy buffer start at $0100
0x03EDC9|$0F:$EDB9:CA      	DEX        
0x03EDCA|$0F:$EDBA:D0 F7   	BNE $EDB3  
0x03EDCC|$0F:$EDBC:4C A5
; built-in offset from $EDBF: "GOL ERUTNEVDA", i.e. "ADVENTRUE LOG" backwards
; indexed data load target (from $EDB3)
0x03EDCE|$0F:$EDBE:      F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position


; code -> data
; "GOL ERUTNEVDA", i.e. "ADVENTRUE LOG" backwards
0x03EDCF|$0F:$EDBF:2A 32 2F 5F 28 35 38 37 31 28 39 27 24

; data -> code
; menu control code #$A0-#$A7 handler: print level of selected hero or Midenhall's level in current save file
; indirect control flow target (via $F0D4)
0x03EDDC|$0F:$EDCC:AD 9D 60	LDA $609D  	; menu function parameter
0x03EDDF|$0F:$EDCF:C9 04   	CMP #$04   
0x03EDE1|$0F:$EDD1:F0 2E   	BEQ $EE01  	; menu control code #$A4 handler: print Midenhall's level in current save file
0x03EDE3|$0F:$EDD3:A9 02   	LDA #$02   
0x03EDE5|$0F:$EDD5:20 7A F0	JSR $F07A  	; set maximum string length $60A0 to A and update menu function parameter $609D: if its bits 0-1 are both set, use $4A | bit 2 of $609D, else use the low 3 bits of $609D
0x03EDE8|$0F:$EDD8:A2 00   	LDX #$00   	; offset for hero status
0x03EDEA|$0F:$EDDA:A0 01   	LDY #$01   	; which is one byte long
0x03EDEC|$0F:$EDDC:20 4A F1	JSR $F14A  	; given stat offset in X and stat byte size in Y (max of #$03), copy that many bytes of hero ID $609D's stats to $10-$12
0x03EDEF|$0F:$EDDF:A5 10   	LDA $10    	; hero status
0x03EDF1|$0F:$EDE1:10 0B   	BPL $EDEE  	; dead hero
0x03EDF3|$0F:$EDE3:29 20   	AND #$20   	; pick out the poison bit
0x03EDF5|$0F:$EDE5:D0 0D   	BNE $EDF4  	; poisoned hero
0x03EDF7|$0F:$EDE7:A2 11   	LDX #$11   	; offset for level
0x03EDF9|$0F:$EDE9:A0 01   	LDY #$01   	; which is one byte long
0x03EDFB|$0F:$EDEB:4C 96 F0	JMP $F096  	; given hero ID in ID $609D, stat offset in X, and stat byte size in Y (max of #$03), print that stat in base 10 to current menu position, replacing leading zeroes with spaces

; dead hero
; control flow target (from $EDE1)
0x03EDFE|$0F:$EDEE:A9 27   	LDA #$27   	; Tile ID #$27: D
0x03EE00|$0F:$EDF0:A2 28   	LDX #$28   	; Tile ID #$28: E
0x03EE02|$0F:$EDF2:D0 04   	BNE $EDF8  
; poisoned hero
; control flow target (from $EDE5)
0x03EE04|$0F:$EDF4:A9 33   	LDA #$33   	; Tile ID #$33: P
0x03EE06|$0F:$EDF6:A2 32   	LDX #$32   	; Tile ID #$32: O
; control flow target (from $EDF2)
0x03EE08|$0F:$EDF8:8D 01 01	STA $0101  
0x03EE0B|$0F:$EDFB:8E 00 01	STX $0100  	; string copy buffer start (often referenced as $00FF,X)
0x03EE0E|$0F:$EDFE:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$A4 handler: print Midenhall's level in current save file
; control flow target (from $EDD1)
0x03EE11|$0F:$EE01:A9 02   	LDA #$02   
0x03EE13|$0F:$EE03:8D A0 60	STA $60A0  	; maximum string length
0x03EE16|$0F:$EE06:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03EE19|$0F:$EE09:C6	; $06:$800C; -> $06:$A8AA: given current game save slot in $75DB, return Midenhall's level in that save game in A/$0E

; data -> code
0x03EE1A|$0F:$EE0A:A5 0E   	LDA $0E    	; useless op
0x03EE1C|$0F:$EE0C:85 10   	STA $10    
0x03EE1E|$0F:$EE0E:A9 00   	LDA #$00   
0x03EE20|$0F:$EE10:85 11   	STA $11    	; this is either useless if we're relying on $11 still being #$00 from the earlier call to $EC29 or a bug since we aren't setting $12
0x03EE22|$0F:$EE12:20 9F F0	JSR $F09F  	; given a 24-bit number N in $10-$12, print its base 10 digits in reverse to $0100 up to maximum string length $60A0, replacing leading (trailing in reverse) zeroes with spaces
0x03EE25|$0F:$EE15:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$A8-#$AF handler: print selected hero's current EXP
; indirect control flow target (via $F0D6)
0x03EE28|$0F:$EE18:A9 07   	LDA #$07   
0x03EE2A|$0F:$EE1A:20 7A F0	JSR $F07A  	; set maximum string length $60A0 to A and update menu function parameter $609D: if its bits 0-1 are both set, use $4A | bit 2 of $609D, else use the low 3 bits of $609D
0x03EE2D|$0F:$EE1D:A2 06   	LDX #$06   	; offset for current EXP
0x03EE2F|$0F:$EE1F:A0 03   	LDY #$03   	; which is 3 bytes long
0x03EE31|$0F:$EE21:4C 96 F0	JMP $F096  	; given hero ID in ID $609D, stat offset in X, and stat byte size in Y (max of #$03), print that stat in base 10 to current menu position, replacing leading zeroes with spaces

; menu control code #$B0-#$B7 handler: print selected hero's short name, current hero's full name, or Midenhall's short name from selected save game
; indirect control flow target (via $F0D8)
0x03EE34|$0F:$EE24:AD 9D 60	LDA $609D  	; menu function parameter
0x03EE37|$0F:$EE27:C9 04   	CMP #$04   
0x03EE39|$0F:$EE29:F0 22   	BEQ $EE4D  	; menu control code #$B4 handler: print current hero's full name
0x03EE3B|$0F:$EE2B:C9 05   	CMP #$05   
0x03EE3D|$0F:$EE2D:B0 41   	BCS $EE70  	; menu control code #$B5-#$B7 handler: print short save name
; menu control code #$B0-#$B3 handler: print short name of hero ID in $609D
; control flow target (from $EE52)
0x03EE3F|$0F:$EE2F:A9 04   	LDA #$04   
0x03EE41|$0F:$EE31:20 7A F0	JSR $F07A  	; set maximum string length $60A0 to A and update menu function parameter $609D: if its bits 0-1 are both set, use $4A | bit 2 of $609D, else use the low 3 bits of $609D; for #$B3, set hero ID = $4A
0x03EE44|$0F:$EE34:AD 9D 60	LDA $609D  	; menu function parameter
0x03EE47|$0F:$EE37:0A      	ASL        
0x03EE48|$0F:$EE38:0A      	ASL        
0x03EE49|$0F:$EE39:6D 9D 60	ADC $609D  	; menu function parameter; A = hero ID * 5
0x03EE4C|$0F:$EE3C:AA      	TAX        
0x03EE4D|$0F:$EE3D:AC A0 60	LDY $60A0  	; maximum string length
; control flow target (from $EE48)
0x03EE50|$0F:$EE40:BD 13 01	LDA $0113,X	; Midenhall name bytes 0-3 + terminator
0x03EE53|$0F:$EE43:99 FF 00	STA $00FF,Y	; built-in offset from string copy buffer start at $0100
0x03EE56|$0F:$EE46:E8      	INX        	; read index
0x03EE57|$0F:$EE47:88      	DEY        	; write index
0x03EE58|$0F:$EE48:D0 F6   	BNE $EE40  	; if more tiles to print, print them
0x03EE5A|$0F:$EE4A:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$B4 handler: print current hero's full name
; control flow target (from $EE29)
0x03EE5D|$0F:$EE4D:A9 03   	LDA #$03   	; start by printing selected hero's short name
0x03EE5F|$0F:$EE4F:8D 9D 60	STA $609D  	; menu function parameter
0x03EE62|$0F:$EE52:20 2F EE	JSR $EE2F  	; menu control code #$B0-#$B3 handler: print short name of hero ID in $609D
0x03EE65|$0F:$EE55:A9 04   	LDA #$04   
0x03EE67|$0F:$EE57:8D A0 60	STA $60A0  	; maximum string length
0x03EE6A|$0F:$EE5A:AD 9D 60	LDA $609D  	; menu function parameter
0x03EE6D|$0F:$EE5D:0A      	ASL        
0x03EE6E|$0F:$EE5E:0A      	ASL        
0x03EE6F|$0F:$EE5F:AA      	TAX        	; A = hero ID * 4
0x03EE70|$0F:$EE60:AC A0 60	LDY $60A0  	; maximum string length
; control flow target (from $EE6B)
0x03EE73|$0F:$EE63:BD 86 01	LDA $0186,X	; Midenhall name bytes 4-7
0x03EE76|$0F:$EE66:99 FF 00	STA $00FF,Y	; built-in offset from string copy buffer start at $0100
0x03EE79|$0F:$EE69:E8      	INX        	; read index
0x03EE7A|$0F:$EE6A:88      	DEY        	; write index
0x03EE7B|$0F:$EE6B:D0 F6   	BNE $EE63  	; if more tiles to print, print them
0x03EE7D|$0F:$EE6D:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$B5-#$B7 handler: print short save name
; control flow target (from $EE2D)
0x03EE80|$0F:$EE70:A9 04   	LDA #$04   
0x03EE82|$0F:$EE72:8D A0 60	STA $60A0  	; maximum string length
0x03EE85|$0F:$EE75:AD 9D 60	LDA $609D  	; menu function parameter
0x03EE88|$0F:$EE78:38      	SEC        
0x03EE89|$0F:$EE79:E9 05   	SBC #$05   	; #$05-#$07 -> #$00-#$02
0x03EE8B|$0F:$EE7B:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03EE8E|$0F:$EE7E:CE	; $06:$801C; -> $06:$A88F: copy Midenhall's short name from save slot in A to $0100 in reverse

; data -> code
0x03EE8F|$0F:$EE7F:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$B8-#$BF handler: print various item names based on menu format
; indirect control flow target (via $F0DA)
0x03EE92|$0F:$EE82:A9 0D   	LDA #$0D   
0x03EE94|$0F:$EE84:8D A0 60	STA $60A0  	; maximum string length
0x03EE97|$0F:$EE87:AD AA 60	LDA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03EE9A|$0F:$EE8A:29 02   	AND #$02   
0x03EE9C|$0F:$EE8C:F0 05   	BEQ $EE93  	; if this menu only displays equipped items (i.e. it's Menu ID #$1C: Main menu: status screen equipped items), set menu list index $60AC = #$00
0x03EE9E|$0F:$EE8E:A9 00   	LDA #$00   
0x03EEA0|$0F:$EE90:8D AC 60	STA $60AC  	; menu list index
; control flow target (from $EE8C)
0x03EEA3|$0F:$EE93:AD 9D 60	LDA $609D  	; menu function parameter
0x03EEA6|$0F:$EE96:C9 05   	CMP #$05   
0x03EEA8|$0F:$EE98:B0 0C   	BCS $EEA6  	; menu control code #$BD-#$BF handler: given shop ID in $60AF and menu list index in $60AC, print name of the corresponding item ID or #$00 if it's the Jailor's Key to $0100; depending on settings, possibly update menu's [left border] to [left border, equipped], then toggle list segment $60AB; if list segment becomes #$01, INC menu list index $60AC
0x03EEAA|$0F:$EE9A:20 19 F2	JSR $F219  	; return the $60AC'th item of item type $609D in A and the party inventory index of that item in X, or #$00 in A and #$FF in X if no such item exists; also sets $60BA,X to #$FF if found and #$00 otherwise
0x03EEAD|$0F:$EE9D:20 9D F2	JSR $F29D  	; given party inventory offset in X, print name of that item ID to $0100 in reverse; depending on settings, possibly update menu's [left border] to [left border, equipped]
; print string at $0100 in reverse to current menu position and toggle list segment $60AB; if list segment becomes #$01, INC menu list index $60AC
; control flow target (from $EEAC)
0x03EEB0|$0F:$EEA0:20 A5 F0	JSR $F0A5  	; print string at $0100 in reverse to current menu position
0x03EEB3|$0F:$EEA3:4C 21 F3	JMP $F321  	; toggle list segment $60AB; if list segment becomes #$01, INC menu list index $60AC

; menu control code #$BD-#$BF handler: given shop ID in $60AF and menu list index in $60AC, print name of the corresponding item ID or #$00 if it's the Jailor's Key to $0100; depending on settings, possibly update menu's [left border] to [left border, equipped], then toggle list segment $60AB; if list segment becomes #$01, INC menu list index $60AC
; control flow target (from $EE98)
0x03EEB6|$0F:$EEA6:20 7F F2	JSR $F27F  	; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID or #$00 if it's the Jailor's Key
0x03EEB9|$0F:$EEA9:20 A7 F2	JSR $F2A7  	; print name of item ID in A to $0100 in reverse; depending on settings, possibly update menu's [left border] to [left border, equipped]
0x03EEBC|$0F:$EEAC:4C A0 EE	JMP $EEA0  	; print string at $0100 in reverse to current menu position and toggle list segment $60AB; if list segment becomes #$01, INC menu list index $60AC

; menu control code #$C0-#$C7 handler: draw spell name stuff
; indirect control flow target (via $F0DC)
0x03EEBF|$0F:$EEAF:A9 09   	LDA #$09   
0x03EEC1|$0F:$EEB1:8D A0 60	STA $60A0  	; maximum string length
0x03EEC4|$0F:$EEB4:20 35 F3	JSR $F335  
0x03EEC7|$0F:$EEB7:20 9F F3	JSR $F39F  	; given spell name index in A, print spell name to $0100 in reverse, set Y to length of string copied, then load bank specified by $60D7 (set by last call to $F3E2)
0x03EECA|$0F:$EEBA:20 A5 F0	JSR $F0A5  	; print string at $0100 in reverse to current menu position
0x03EECD|$0F:$EEBD:EE AC 60	INC $60AC  	; menu list index
0x03EED0|$0F:$EEC0:60      	RTS        

; menu control code #$C8-#$CF handler: draw item price stuff
; indirect control flow target (via $F0DE)
0x03EED1|$0F:$EEC1:20 9F F1	JSR $F19F  	; initialize string buffer $0100-$010C with [space]s
0x03EED4|$0F:$EEC4:A9 05   	LDA #$05   
0x03EED6|$0F:$EEC6:8D A0 60	STA $60A0  	; maximum string length
0x03EED9|$0F:$EEC9:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03EEDC|$0F:$EECC:AD AD 60	LDA $60AD  	; item ID
0x03EEDF|$0F:$EECF:F0 13   	BEQ $EEE4  
0x03EEE1|$0F:$EED1:0A      	ASL        
0x03EEE2|$0F:$EED2:AA      	TAX        
0x03EEE3|$0F:$EED3:BD FC 9F	LDA $9FFC,X	; Item Prices, low byte
0x03EEE6|$0F:$EED6:85 10   	STA $10    
0x03EEE8|$0F:$EED8:BD FD 9F	LDA $9FFD,X	; Item Prices, high byte
0x03EEEB|$0F:$EEDB:85 11   	STA $11    
0x03EEED|$0F:$EEDD:A9 00   	LDA #$00   
0x03EEEF|$0F:$EEDF:85 12   	STA $12    
0x03EEF1|$0F:$EEE1:20 9F F0	JSR $F09F  	; given a 24-bit number N in $10-$12, print its base 10 digits in reverse to $0100 up to maximum string length $60A0, replacing leading (trailing in reverse) zeroes with spaces
; control flow target (from $EECF)
0x03EEF4|$0F:$EEE4:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$D0-#$D7 handler: start lists
; indirect control flow target (via $F0E0)
0x03EEF7|$0F:$EEE7:AD 9D 60	LDA $609D  	; menu function parameter
0x03EEFA|$0F:$EEEA:C9 06   	CMP #$06   
0x03EEFC|$0F:$EEEC:F0 25   	BEQ $EF13  	; menu control code #$D6 handler: start field spell list
0x03EEFE|$0F:$EEEE:C9 07   	CMP #$07   
0x03EF00|$0F:$EEF0:F0 33   	BEQ $EF25  	; menu control code #$D7 handler: start monster list
0x03EF02|$0F:$EEF2:C9 05   	CMP #$05   
0x03EF04|$0F:$EEF4:D0 06   	BNE $EEFC  	; menu control code #$D0-#$D4 handler: start item lists
; menu control code #$D5 handler: start shop item list
0x03EF06|$0F:$EEF6:20 55 F2	JSR $F255  	; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID and X to the number of items in the shop
0x03EF09|$0F:$EEF9:8A      	TXA        
0x03EF0A|$0F:$EEFA:D0 0D   	BNE $EF09  	; set remaining number of rows for dynamic menu lists to A, set menu read index for start of repeating lists to current menu read index
; menu control code #$D0-#$D4 handler: start item lists
; control flow target (from $EEF4)
0x03EF0C|$0F:$EEFC:A9 00   	LDA #$00   
0x03EF0E|$0F:$EEFE:8D AC 60	STA $60AC  	; menu list index
0x03EF11|$0F:$EF01:A9 00   	LDA #$00   
0x03EF13|$0F:$EF03:8D AB 60	STA $60AB  	; which list segment we're dealing with
0x03EF16|$0F:$EF06:20 B7 F1	JSR $F1B7  	; given hero ID in $4A and item type in $609D, set A = number of items of desired type in hero's inventory
; set remaining number of rows for dynamic menu lists to A, set menu read index for start of repeating lists to current menu read index
; control flow target (from $EEFA, $EF22, $EF34)
0x03EF19|$0F:$EF09:8D A8 60	STA $60A8  	; remaining number of rows for dynamic menu lists
0x03EF1C|$0F:$EF0C:AD A6 60	LDA $60A6  	; current menu read index
0x03EF1F|$0F:$EF0F:8D A7 60	STA $60A7  	; menu read index for start of repeating lists
0x03EF22|$0F:$EF12:60      	RTS        

; menu control code #$D6 handler: start field spell list
; control flow target (from $EEEC)
0x03EF23|$0F:$EF13:A0 00   	LDY #$00   	; number of learned spells
0x03EF25|$0F:$EF15:A6 4A   	LDX $4A    	; hero ID
0x03EF27|$0F:$EF17:BD 1A 06	LDA $061A,X	; Cannock's learned field spell list
; control flow target (from $EF1F)
0x03EF2A|$0F:$EF1A:0A      	ASL        
0x03EF2B|$0F:$EF1B:90 02   	BCC $EF1F  	; branch if spell not learned
0x03EF2D|$0F:$EF1D:C8      	INY        	; number of learned spells
0x03EF2E|$0F:$EF1E:AA      	TAX        	; set Z (updated by INY) back to A
; control flow target (from $EF1B)
0x03EF2F|$0F:$EF1F:D0 F9   	BNE $EF1A  
0x03EF31|$0F:$EF21:98      	TYA        	; number of learned spells
0x03EF32|$0F:$EF22:4C 09 EF	JMP $EF09  	; set remaining number of rows for dynamic menu lists to A, set menu read index for start of repeating lists to current menu read index

; menu control code #$D7 handler: start monster list
; control flow target (from $EEF0)
0x03EF35|$0F:$EF25:A2 00   	LDX #$00   	; number of monster groups
; control flow target (from $EF30)
0x03EF37|$0F:$EF27:BD 1C 06	LDA $061C,X	; monster group 1 monster ID
0x03EF3A|$0F:$EF2A:F0 06   	BEQ $EF32  
0x03EF3C|$0F:$EF2C:E8      	INX        	; this part of monster group data is 2 bytes each
0x03EF3D|$0F:$EF2D:E8      	INX        
0x03EF3E|$0F:$EF2E:E0 08   	CPX #$08   	; maximum 4 groups * 2 bytes each = 8 bytes
0x03EF40|$0F:$EF30:D0 F5   	BNE $EF27  
; control flow target (from $EF2A)
0x03EF42|$0F:$EF32:8A      	TXA        
0x03EF43|$0F:$EF33:4A      	LSR        	; 2 bytes per group, so divide by 2
0x03EF44|$0F:$EF34:4C 09 EF	JMP $EF09  	; set remaining number of rows for dynamic menu lists to A, set menu read index for start of repeating lists to current menu read index

; menu control code #$E8-#$EF handler: repeat/end list and full save name handlers
; indirect control flow target (via $F0E6)
0x03EF47|$0F:$EF37:AD 9D 60	LDA $609D  	; menu function parameter
0x03EF4A|$0F:$EF3A:C9 02   	CMP #$02   
0x03EF4C|$0F:$EF3C:F0 15   	BEQ $EF53  	; menu control code #$EA handler: print Midenhall's full name from save slot in $75DB
0x03EF4E|$0F:$EF3E:29 03   	AND #$03   
0x03EF50|$0F:$EF40:D0 1D   	BNE $EF5F  	; menu control code #$E9 handler: end current repeating list
; menu control code #$E8 handler: update remaining number of rows for dynamic menu lists, reset current menu read index if applicable
0x03EF52|$0F:$EF42:AD A8 60	LDA $60A8  	; remaining number of rows for dynamic menu lists
0x03EF55|$0F:$EF45:F0 0B   	BEQ $EF52  
0x03EF57|$0F:$EF47:CE A8 60	DEC $60A8  	; remaining number of rows for dynamic menu lists
0x03EF5A|$0F:$EF4A:F0 06   	BEQ $EF52  
0x03EF5C|$0F:$EF4C:AD A7 60	LDA $60A7  	; menu read index for start of repeating lists
0x03EF5F|$0F:$EF4F:8D A6 60	STA $60A6  	; current menu read index
; control flow target (from $EF45, $EF4A)
0x03EF62|$0F:$EF52:60      	RTS        

; menu control code #$EA handler: print Midenhall's full name from save slot in $75DB
; control flow target (from $EF3C)
0x03EF63|$0F:$EF53:A9 08   	LDA #$08   
0x03EF65|$0F:$EF55:8D A0 60	STA $60A0  	; maximum string length
0x03EF68|$0F:$EF58:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03EF6B|$0F:$EF5B:C5	; $06:$800A; -> $06:$A896: copy Midenhall's full name from save slot in $75DB to $0100 in reverse

; data -> code
0x03EF6C|$0F:$EF5C:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$E9 handler: end current repeating list
; control flow target (from $EF40)
0x03EF6F|$0F:$EF5F:A9 00   	LDA #$00   
0x03EF71|$0F:$EF61:8D 9E 60	STA $609E  	; menu current column
0x03EF74|$0F:$EF64:8D 9D 60	STA $609D  	; menu function parameter
0x03EF77|$0F:$EF67:AD 9F 60	LDA $609F  	; menu current row
0x03EF7A|$0F:$EF6A:29 01   	AND #$01   
0x03EF7C|$0F:$EF6C:49 01   	EOR #$01   
0x03EF7E|$0F:$EF6E:18      	CLC        
0x03EF7F|$0F:$EF6F:69 01   	ADC #$01   
0x03EF81|$0F:$EF71:6D 9F 60	ADC $609F  	; menu current row
0x03EF84|$0F:$EF74:8D A3 60	STA $60A3  	; menu window height (ROM value * 2); height = number of rows + 1 if odd, + 2 if even
0x03EF87|$0F:$EF77:4A      	LSR        
0x03EF88|$0F:$EF78:8D A2 60	STA $60A2  	; menu window height (from ROM)
0x03EF8B|$0F:$EF7B:AD 9F 60	LDA $609F  	; menu current row
0x03EF8E|$0F:$EF7E:29 01   	AND #$01   
0x03EF90|$0F:$EF80:D0 0B   	BNE $EF8D  
0x03EF92|$0F:$EF82:A9 76   	LDA #$76   	; Tile ID #$76: [left border]
0x03EF94|$0F:$EF84:8D 9B 60	STA $609B  	; menu text
0x03EF97|$0F:$EF87:20 E4 EF	JSR $EFE4  	; print one byte of menu text
0x03EF9A|$0F:$EF8A:4C 2E ED	JMP $ED2E  	; menu control code #$80-#$87 handler: print number of spaces specified by $609D (or rest of line if $609D is #$00) to current menu position

; control flow target (from $EF80)
0x03EF9D|$0F:$EF8D:60      	RTS        

; menu control code #$D8-#$DF handler: print selected stat
; indirect control flow target (via $F0E2)
0x03EF9E|$0F:$EF8E:AE 9D 60	LDX $609D  	; menu function parameter
0x03EFA1|$0F:$EF91:BD EE F0	LDA $F0EE,X	; stat offsets
0x03EFA4|$0F:$EF94:48      	PHA        	; stat offset
0x03EFA5|$0F:$EF95:A9 03   	LDA #$03   
0x03EFA7|$0F:$EF97:8D 9D 60	STA $609D  	; menu function parameter
0x03EFAA|$0F:$EF9A:20 7A F0	JSR $F07A  	; set maximum string length $60A0 to A and update menu function parameter $609D: if its bits 0-1 are both set, use $4A | bit 2 of $609D, else use the low 3 bits of $609D
0x03EFAD|$0F:$EF9D:68      	PLA        	; stat offset
0x03EFAE|$0F:$EF9E:AA      	TAX        	; stat offset
0x03EFAF|$0F:$EF9F:A0 01   	LDY #$01   	; number of bytes
0x03EFB1|$0F:$EFA1:4C 96 F0	JMP $F096  	; given hero ID in ID $609D, stat offset in X, and stat byte size in Y (max of #$03), print that stat in base 10 to current menu position, replacing leading zeroes with spaces

; menu control code #$E0-#$E7 handler: draw monster text stuff
; indirect control flow target (via $F0E4)
0x03EFB4|$0F:$EFA4:AD 9D 60	LDA $609D  	; menu function parameter
0x03EFB7|$0F:$EFA7:D0 23   	BNE $EFCC  
0x03EFB9|$0F:$EFA9:A9 0B   	LDA #$0B   
0x03EFBB|$0F:$EFAB:8D A0 60	STA $60A0  	; maximum string length
0x03EFBE|$0F:$EFAE:AD AB 60	LDA $60AB  	; which list segment we're dealing with
0x03EFC1|$0F:$EFB1:4A      	LSR        
0x03EFC2|$0F:$EFB2:90 05   	BCC $EFB9  
0x03EFC4|$0F:$EFB4:A9 09   	LDA #$09   
0x03EFC6|$0F:$EFB6:8D A0 60	STA $60A0  	; maximum string length
; control flow target (from $EFB2)
0x03EFC9|$0F:$EFB9:AD AC 60	LDA $60AC  	; menu list index
0x03EFCC|$0F:$EFBC:0A      	ASL        
0x03EFCD|$0F:$EFBD:AA      	TAX        
0x03EFCE|$0F:$EFBE:BD 1C 06	LDA $061C,X	; monster group 1 monster ID
0x03EFD1|$0F:$EFC1:A2 00   	LDX #$00   
0x03EFD3|$0F:$EFC3:20 B7 F3	JSR $F3B7  	; given monster ID in A, copy monster name segment to $0100 in reverse
0x03EFD6|$0F:$EFC6:20 A5 F0	JSR $F0A5  	; print string at $0100 in reverse to current menu position
0x03EFD9|$0F:$EFC9:4C 21 F3	JMP $F321  	; toggle list segment $60AB; if list segment becomes #$01, INC menu list index $60AC

; control flow target (from $EFA7)
0x03EFDC|$0F:$EFCC:A9 01   	LDA #$01   
0x03EFDE|$0F:$EFCE:8D A0 60	STA $60A0  	; maximum string length
0x03EFE1|$0F:$EFD1:AD AC 60	LDA $60AC  	; menu list index
0x03EFE4|$0F:$EFD4:0A      	ASL        
0x03EFE5|$0F:$EFD5:AA      	TAX        
0x03EFE6|$0F:$EFD6:BD 1D 06	LDA $061D,X	; monster group 1 monster count
0x03EFE9|$0F:$EFD9:85 10   	STA $10    
0x03EFEB|$0F:$EFDB:20 7C F1	JSR $F17C  	; given a 24-bit number N in $10-$12, print its base 10 digits in reverse to $0100 up to maximum string length $60A0
0x03EFEE|$0F:$EFDE:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; menu control code #$F0-#$FF + text handler: print one byte of menu text to current position
; indirect control flow target (via $F0E8, $F0EA, $F0EC)
0x03EFF1|$0F:$EFE1:4C E4 EF	JMP $EFE4  	; print one byte of menu text

; print one byte of menu text
; control flow target (from $ED49, $ED51, $ED5C, $EF87, $EFE1, $F0AE, $F332)
0x03EFF4|$0F:$EFE4:AD B4 60	LDA $60B4  	; menu phase (1 = first, 0 = second)
0x03EFF7|$0F:$EFE7:D0 2A   	BNE $F013  	; update menu current column and row; if it's first phase, skip ahead
0x03EFF9|$0F:$EFE9:AD 9F 60	LDA $609F  	; menu current row
0x03EFFC|$0F:$EFEC:29 01   	AND #$01   
0x03EFFE|$0F:$EFEE:F0 03   	BEQ $EFF3  
0x03F000|$0F:$EFF0:AD A1 60	LDA $60A1  	; menu window width
; control flow target (from $EFEE)
0x03F003|$0F:$EFF3:18      	CLC        
0x03F004|$0F:$EFF4:6D 9E 60	ADC $609E  	; menu current column
0x03F007|$0F:$EFF7:AA      	TAX        
0x03F008|$0F:$EFF8:AD 9B 60	LDA $609B  	; menu text
0x03F00B|$0F:$EFFB:9D 0B 60	STA $600B,X
0x03F00E|$0F:$EFFE:C9 76   	CMP #$76   	; [left border]
0x03F010|$0F:$F000:B0 11   	BCS $F013  	; update menu current column and row
0x03F012|$0F:$F002:BD 0A 60	LDA $600A,X
0x03F015|$0F:$F005:C9 77   	CMP #$77   	; [top border]
0x03F017|$0F:$F007:D0 0A   	BNE $F013  	; update menu current column and row
0x03F019|$0F:$F009:AD 9E 60	LDA $609E  	; menu current column
0x03F01C|$0F:$F00C:F0 05   	BEQ $F013  	; update menu current column and row
0x03F01E|$0F:$F00E:A9 78   	LDA #$78   	; [top border short]
0x03F020|$0F:$F010:9D 0A 60	STA $600A,X
; update menu current column and row
; control flow target (from $ED36, $EFE7, $F000, $F007, $F00C)
0x03F023|$0F:$F013:EE 9E 60	INC $609E  	; menu current column
0x03F026|$0F:$F016:AD 9E 60	LDA $609E  	; menu current column
0x03F029|$0F:$F019:CD A1 60	CMP $60A1  	; menu window width
0x03F02C|$0F:$F01C:90 0C   	BCC $F02A  	; if current column < window width, nothing else to do here
0x03F02E|$0F:$F01E:A2 01   	LDX #$01   	; otherwise set string length to #$01 (for the left border of the next row)
0x03F030|$0F:$F020:8E A0 60	STX $60A0  	; maximum string length
0x03F033|$0F:$F023:CA      	DEX        	; and reset the current column to #$00
0x03F034|$0F:$F024:8E 9E 60	STX $609E  	; menu current column
0x03F037|$0F:$F027:EE 9F 60	INC $609F  	; menu current row
; control flow target (from $F01C)
0x03F03A|$0F:$F02A:60      	RTS        

; control flow target (from $EC1D)
0x03F03B|$0F:$F02B:AD 9F 60	LDA $609F  	; menu current row
0x03F03E|$0F:$F02E:29 01   	AND #$01   
0x03F040|$0F:$F030:0D 9E 60	ORA $609E  	; menu current column
0x03F043|$0F:$F033:D0 21   	BNE $F056  
0x03F045|$0F:$F035:AD B4 60	LDA $60B4  	; menu phase (1 = first, 0 = second)
0x03F048|$0F:$F038:D0 1C   	BNE $F056  
0x03F04A|$0F:$F03A:AD A1 60	LDA $60A1  	; menu window width
0x03F04D|$0F:$F03D:4A      	LSR        
0x03F04E|$0F:$F03E:09 10   	ORA #$10   
0x03F050|$0F:$F040:8D 7B 60	STA $607B  
0x03F053|$0F:$F043:AD A4 60	LDA $60A4  	; menu window position (from ROM; X-pos = low nybble * 2, Y-pos = high nybble * 2)
0x03F056|$0F:$F046:8D 7C 60	STA $607C  
0x03F059|$0F:$F049:18      	CLC        
0x03F05A|$0F:$F04A:69 10   	ADC #$10   
0x03F05C|$0F:$F04C:8D A4 60	STA $60A4  	; menu window position (from ROM; X-pos = low nybble * 2, Y-pos = high nybble * 2)
0x03F05F|$0F:$F04F:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F062|$0F:$F052:C0	; $06:$8000

; data -> code
0x03F063|$0F:$F053:20 C1 F0	JSR $F0C1  	; write [space] to $600B-$6046
; control flow target (from $F033, $F038)
0x03F066|$0F:$F056:60      	RTS        

; CLC if more menu rows to display, SEC otherwise
; control flow target (from $EC20)
0x03F067|$0F:$F057:AD 9F 60	LDA $609F  	; menu current row
0x03F06A|$0F:$F05A:CD A3 60	CMP $60A3  	; menu window height (ROM value * 2)
0x03F06D|$0F:$F05D:60      	RTS        

; set $60A0 based on menu function parameter $609D and number of remaining tiles in the current line
; control flow target (from $ED33, $ED59)
0x03F06E|$0F:$F05E:AD 9D 60	LDA $609D  	; menu function parameter
0x03F071|$0F:$F061:D0 02   	BNE $F065  	; control codes #$80 and #$88 fill out the rest of the line, so default length to #$FF
0x03F073|$0F:$F063:A9 FF   	LDA #$FF   
; control flow target (from $F061)
0x03F075|$0F:$F065:8D A0 60	STA $60A0  	; maximum string length
0x03F078|$0F:$F068:18      	CLC        
0x03F079|$0F:$F069:AD A1 60	LDA $60A1  	; menu window width
0x03F07C|$0F:$F06C:ED 9E 60	SBC $609E  	; menu current column
0x03F07F|$0F:$F06F:90 08   	BCC $F079  	; branch if we're already done this line
0x03F081|$0F:$F071:CD A0 60	CMP $60A0  	; maximum string length
0x03F084|$0F:$F074:B0 03   	BCS $F079  	; if number of tiles remaining is less than string length, update string length
0x03F086|$0F:$F076:8D A0 60	STA $60A0  	; maximum string length
; control flow target (from $F06F, $F074)
0x03F089|$0F:$F079:60      	RTS        

; set maximum string length $60A0 to A and update menu function parameter $609D: if its bits 0-1 are both set, use $4A | bit 2 of $609D, else use the low 3 bits of $609D
; control flow target (from $ED67, $EDD5, $EE1A, $EE31, $EF9A)
0x03F08A|$0F:$F07A:8D A0 60	STA $60A0  	; maximum string length
0x03F08D|$0F:$F07D:AD 9D 60	LDA $609D  	; menu function parameter
0x03F090|$0F:$F080:48      	PHA        
0x03F091|$0F:$F081:29 03   	AND #$03   
0x03F093|$0F:$F083:C9 03   	CMP #$03   
0x03F095|$0F:$F085:D0 02   	BNE $F089  
0x03F097|$0F:$F087:A5 4A   	LDA $4A    
; control flow target (from $F085)
0x03F099|$0F:$F089:8D 9D 60	STA $609D  	; menu function parameter
0x03F09C|$0F:$F08C:68      	PLA        
0x03F09D|$0F:$F08D:29 04   	AND #$04   
0x03F09F|$0F:$F08F:0D 9D 60	ORA $609D  	; menu function parameter
0x03F0A2|$0F:$F092:8D 9D 60	STA $609D  	; menu function parameter
0x03F0A5|$0F:$F095:60      	RTS        

; given hero ID in ID $609D, stat offset in X, and stat byte size in Y (max of #$03), print that stat in base 10 to current menu position, replacing leading zeroes with spaces
; control flow target (from $ED77, $EDEB, $EE21, $EFA1)
0x03F0A6|$0F:$F096:20 9C F0	JSR $F09C  	; given hero ID in ID $609D, stat offset in X, and stat byte size in Y (max of #$03), print that stat's base 10 digits in reverse to $0100 up to maximum string length $60A0, replacing leading (trailing in reverse) zeroes with spaces
0x03F0A9|$0F:$F099:4C A5 F0	JMP $F0A5  	; print string at $0100 in reverse to current menu position

; given hero ID in ID $609D, stat offset in X, and stat byte size in Y (max of #$03), print that stat's base 10 digits in reverse to $0100 up to maximum string length $60A0, replacing leading (trailing in reverse) zeroes with spaces
; control flow target (from $F096)
0x03F0AC|$0F:$F09C:20 4A F1	JSR $F14A  	; given stat offset in X and stat byte size in Y (max of #$03), copy that many bytes of hero ID $609D's stats to $10-$12
; given a 24-bit number N in $10-$12, print its base 10 digits in reverse to $0100 up to maximum string length $60A0, replacing leading (trailing in reverse) zeroes with spaces
; control flow target (from $EE12, $EEE1)
0x03F0AF|$0F:$F09F:20 7C F1	JSR $F17C  	; given a 24-bit number N in $10-$12, print its base 10 digits in reverse to $0100 up to maximum string length $60A0
0x03F0B2|$0F:$F0A2:4C 8D F1	JMP $F18D  	; scan through $0100 + maximum string length $60A0 in reverse, replacing zeroes with spaces until the first non-zero or $0100 is reached; leaves X at most significant digit

; print string at $0100 in reverse to current menu position
; control flow target (from $EDA4, $EDAA, $EDBC, $EDFE, $EE15, $EE4A, $EE6D, $EE7F, $EEA0, $EEBA, $EEE4, $EF5C, $EFC6, $EFDE, $F099, $F0B4)
0x03F0B5|$0F:$F0A5:AE A0 60	LDX $60A0  	; maximum string length
0x03F0B8|$0F:$F0A8:BD FF 00	LDA $00FF,X	; built-in offset from string copy buffer start at $0100
0x03F0BB|$0F:$F0AB:8D 9B 60	STA $609B  	; menu text
0x03F0BE|$0F:$F0AE:20 E4 EF	JSR $EFE4  	; print one byte of menu text
0x03F0C1|$0F:$F0B1:CE A0 60	DEC $60A0  	; maximum string length
0x03F0C4|$0F:$F0B4:D0 EF   	BNE $F0A5  	; print string at $0100 in reverse to current menu position
0x03F0C6|$0F:$F0B6:60      	RTS        

; control flow target (from $EC25)
0x03F0C7|$0F:$F0B7:AD AA 60	LDA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03F0CA|$0F:$F0BA:10 04   	BPL $F0C0  
0x03F0CC|$0F:$F0BC:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F0CF|$0F:$F0BF:CC	; $06:$8018

; data -> code
; control flow target (from $F0BA)
0x03F0D0|$0F:$F0C0:60      	RTS        

; write [space] to $600B-$6046
; control flow target (from $EC29, $F053)
0x03F0D1|$0F:$F0C1:A9 5F   	LDA #$5F   
0x03F0D3|$0F:$F0C3:A2 3B   	LDX #$3B   
; control flow target (from $F0C9)
0x03F0D5|$0F:$F0C5:9D 0B 60	STA $600B,X
0x03F0D8|$0F:$F0C8:CA      	DEX        
0x03F0D9|$0F:$F0C9:10 FA   	BPL $F0C5  
0x03F0DB|$0F:$F0CB:60      	RTS        


; code -> data
; menu control code jump table low byte
; indexed data load target (from $ED21)
0x03F0DC|$0F:$F0CC:2E
; menu control code jump table high byte
; indexed data load target (from $ED26)
0x03F0DD|$0F:$F0CD:   ED	; $0F:$ED2E; menu control code #$80-#$87 handler: print number of spaces specified by $609D (or rest of line if $609D is #$00) to current menu position
0x03F0DE|$0F:$F0CE:3F ED	; $0F:$ED3F; menu control code #$88-#$8F handler: print number of top border tiles specified by $609D (or rest of line if $609D is #$00) to current menu position, accounting for possible linked menu
0x03F0E0|$0F:$F0D0:65 ED	; $0F:$ED65; menu control code #$90-#$97 handler: print selected hero's current HP or MP
0x03F0E2|$0F:$F0D2:7A ED	; $0F:$ED7A; menu control code #$98-#$9F handler: print party gold or crests or "ADVENTURE LOG"
0x03F0E4|$0F:$F0D4:CC ED	; $0F:$EDCC; menu control code #$A0-#$A7 handler: print level of selected hero or Midenhall's level in current save file
0x03F0E6|$0F:$F0D6:18 EE	; $0F:$EE18; menu control code #$A8-#$AF handler: print selected hero's current EXP
0x03F0E8|$0F:$F0D8:24 EE	; $0F:$EE24; menu control code #$B0-#$B7 handler: print selected hero's short name, current hero's full name, or Midenhall's short name from selected save game
0x03F0EA|$0F:$F0DA:82 EE	; $0F:$EE82; menu control code #$B8-#$BF handler: print various item names based on menu format
0x03F0EC|$0F:$F0DC:AF EE	; $0F:$EEAF; menu control code #$C0-#$C7 handler: draw spell name stuff
0x03F0EE|$0F:$F0DE:C1 EE	; $0F:$EEC1; menu control code #$C8-#$CF handler: draw item price stuff
0x03F0F0|$0F:$F0E0:E7 EE	; $0F:$EEE7; menu control code #$D0-#$D7 handler: start lists
0x03F0F2|$0F:$F0E2:8E EF	; $0F:$EF8E; menu control code #$D8-#$DF handler: print selected stat
0x03F0F4|$0F:$F0E4:A4 EF	; $0F:$EFA4; menu control code #$E0-#$E7 handler: draw monster text stuff
0x03F0F6|$0F:$F0E6:37 EF	; $0F:$EF37; menu control code #$E8-#$EF handler: repeat/end list and full save name handlers
0x03F0F8|$0F:$F0E8:E1 EF	; $0F:$EFE1; menu control code #$F0-#$FF + text handler: print one byte of menu text to current position
0x03F0FA|$0F:$F0EA:E1 EF	; $0F:$EFE1; menu control code #$F0-#$FF + text handler: print one byte of menu text to current position
0x03F0FC|$0F:$F0EC:E1 EF	; $0F:$EFE1; menu control code #$F0-#$FF + text handler: print one byte of menu text to current position
; stat offsets
; indexed data load target (from $EF91)
0x03F0FE|$0F:$F0EE:09	; Strength
0x03F0FF|$0F:$F0EF:0A	; Agility
0x03F100|$0F:$F0F0:0B	; Attack Power
0x03F101|$0F:$F0F1:0C	; Defence Power
0x03F102|$0F:$F0F2:03	; Max HP, low byte
0x03F103|$0F:$F0F3:05	; Max MP

; data -> code
; 16-bit multiplication: set 16-bit ($00,X-$01,X) = ($00,X-$01,X) * A
; control flow target (from $FDAC)
; external control flow target (from $06:$B2A8)
0x03F104|$0F:$F0F4:8D 84 60	STA $6084  
0x03F107|$0F:$F0F7:A9 00   	LDA #$00   
0x03F109|$0F:$F0F9:8D 85 60	STA $6085  
0x03F10C|$0F:$F0FC:8D 86 60	STA $6086  
; control flow target (from $F11C)
0x03F10F|$0F:$F0FF:4E 84 60	LSR $6084  
0x03F112|$0F:$F102:90 11   	BCC $F115  
0x03F114|$0F:$F104:B5 00   	LDA $00,X  
0x03F116|$0F:$F106:18      	CLC        
0x03F117|$0F:$F107:6D 85 60	ADC $6085  
0x03F11A|$0F:$F10A:8D 85 60	STA $6085  
0x03F11D|$0F:$F10D:B5 01   	LDA $01,X  
0x03F11F|$0F:$F10F:6D 86 60	ADC $6086  
0x03F122|$0F:$F112:8D 86 60	STA $6086  
; control flow target (from $F102)
0x03F125|$0F:$F115:16 00   	ASL $00,X  
0x03F127|$0F:$F117:36 01   	ROL $01,X  
0x03F129|$0F:$F119:AD 84 60	LDA $6084  
0x03F12C|$0F:$F11C:D0 E1   	BNE $F0FF  
0x03F12E|$0F:$F11E:AD 85 60	LDA $6085  
0x03F131|$0F:$F121:95 00   	STA $00,X  
0x03F133|$0F:$F123:AD 86 60	LDA $6086  
0x03F136|$0F:$F126:95 01   	STA $01,X  
0x03F138|$0F:$F128:60      	RTS        

; given a 24-bit number N in $10-$12, set $10-$12 to quotient of N / 10 and $13 to the remainder of N / 10, i.e. for base 10 N, $13 = the low digit, $10-$12 = the high digits
; control flow target (from $F17E)
0x03F139|$0F:$F129:8A      	TXA        	; save X on the stack
0x03F13A|$0F:$F12A:48      	PHA        
0x03F13B|$0F:$F12B:A9 00   	LDA #$00   
0x03F13D|$0F:$F12D:85 13   	STA $13    	; initialize remainder to #$00
0x03F13F|$0F:$F12F:A2 18   	LDX #$18   	; we're wokring with 24-bit input
; control flow target (from $F145)
0x03F141|$0F:$F131:06 10   	ASL $10    	; ASL 24-bit value into $13
0x03F143|$0F:$F133:26 11   	ROL $11    
0x03F145|$0F:$F135:26 12   	ROL $12    
0x03F147|$0F:$F137:26 13   	ROL $13    
0x03F149|$0F:$F139:38      	SEC        
0x03F14A|$0F:$F13A:A5 13   	LDA $13    
0x03F14C|$0F:$F13C:E9 0A   	SBC #$0A   	; converting to base 10
0x03F14E|$0F:$F13E:90 04   	BCC $F144  	; if remainder < 10, nothing else to do
0x03F150|$0F:$F140:85 13   	STA $13    	; reduce remainder by 10
0x03F152|$0F:$F142:E6 10   	INC $10    	; set quotient bit for next call to $F129
; control flow target (from $F13E)
0x03F154|$0F:$F144:CA      	DEX        
0x03F155|$0F:$F145:D0 EA   	BNE $F131  	; keep looping until we've gone through all 24 original bits
0x03F157|$0F:$F147:68      	PLA        	; restore X from the stack
0x03F158|$0F:$F148:AA      	TAX        
0x03F159|$0F:$F149:60      	RTS        

; given stat offset in X and stat byte size in Y (max of #$03), copy that many bytes of hero ID $609D's stats to $10-$12
; control flow target (from $EDDC, $F09C)
0x03F15A|$0F:$F14A:86 10   	STX $10    
0x03F15C|$0F:$F14C:8C 84 60	STY $6084  
0x03F15F|$0F:$F14F:A9 00   	LDA #$00   	; useless op
0x03F161|$0F:$F151:AD 9D 60	LDA $609D  	; menu function parameter
0x03F164|$0F:$F154:29 03   	AND #$03   	; hero ID
0x03F166|$0F:$F156:AA      	TAX        
0x03F167|$0F:$F157:F0 08   	BEQ $F161  	; if Midenhall, no need to adjust offsets
0x03F169|$0F:$F159:A9 00   	LDA #$00   	; update offset into hero data based on hero ID
; control flow target (from $F15F)
0x03F16B|$0F:$F15B:18      	CLC        
0x03F16C|$0F:$F15C:69 12   	ADC #$12   	; hero data is #$12 bytes each
0x03F16E|$0F:$F15E:CA      	DEX        
0x03F16F|$0F:$F15F:D0 FA   	BNE $F15B  
; control flow target (from $F157)
0x03F171|$0F:$F161:18      	CLC        
0x03F172|$0F:$F162:65 10   	ADC $10    	; desired stat offset
0x03F174|$0F:$F164:AA      	TAX        
0x03F175|$0F:$F165:A9 00   	LDA #$00   	; initialize $10-$12 and Y to #$00
0x03F177|$0F:$F167:85 10   	STA $10    
0x03F179|$0F:$F169:85 11   	STA $11    
0x03F17B|$0F:$F16B:85 12   	STA $12    
0x03F17D|$0F:$F16D:A8      	TAY        
; control flow target (from $F179)
0x03F17E|$0F:$F16E:BD 2D 06	LDA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03F181|$0F:$F171:99 10 00	STA $0010,Y
0x03F184|$0F:$F174:E8      	INX        
0x03F185|$0F:$F175:C8      	INY        
0x03F186|$0F:$F176:CC 84 60	CPY $6084  
0x03F189|$0F:$F179:D0 F3   	BNE $F16E  
0x03F18B|$0F:$F17B:60      	RTS        

; given a 24-bit number N in $10-$12, print its base 10 digits in reverse to $0100 up to maximum string length $60A0
; control flow target (from $EFDB, $F09F, $F48C)
; external control flow target (from $02:$BE4A)
0x03F18C|$0F:$F17C:A0 00   	LDY #$00   
; control flow target (from $F18A)
0x03F18E|$0F:$F17E:20 29 F1	JSR $F129  	; given a 24-bit number N in $10-$12, set $10-$12 to quotient of N / 10 and $13 to the remainder of N / 10, i.e. for base 10 N, $13 = the low digit, $10-$12 = the high digits
0x03F191|$0F:$F181:A5 13   	LDA $13    	; remainder
0x03F193|$0F:$F183:99 00 01	STA $0100,Y	; string copy buffer start (often referenced as $00FF,X)
0x03F196|$0F:$F186:C8      	INY        
0x03F197|$0F:$F187:CC A0 60	CPY $60A0  	; maximum string length
0x03F19A|$0F:$F18A:D0 F2   	BNE $F17E  	; if more digits to print, keep printing
0x03F19C|$0F:$F18C:60      	RTS        

; scan through $0100 + maximum string length $60A0 in reverse, replacing zeroes with spaces until the first non-zero or $0100 is reached; leaves X at most significant digit
; control flow target (from $F0A2, $F48F)
; external control flow target (from $02:$BE4D)
0x03F19D|$0F:$F18D:AE A0 60	LDX $60A0  	; maximum string length
0x03F1A0|$0F:$F190:CA      	DEX        
; control flow target (from $F19C)
0x03F1A1|$0F:$F191:BD 00 01	LDA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x03F1A4|$0F:$F194:D0 08   	BNE $F19E  
0x03F1A6|$0F:$F196:A9 5F   	LDA #$5F   
0x03F1A8|$0F:$F198:9D 00 01	STA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x03F1AB|$0F:$F19B:CA      	DEX        
0x03F1AC|$0F:$F19C:D0 F3   	BNE $F191  
; control flow target (from $F194)
0x03F1AE|$0F:$F19E:60      	RTS        

; initialize string buffer $0100-$010C with [space]s
; control flow target (from $ED88, $EEC1, $F2F0, $F3A0, $F3D7)
0x03F1AF|$0F:$F19F:48      	PHA        
0x03F1B0|$0F:$F1A0:8A      	TXA        
0x03F1B1|$0F:$F1A1:48      	PHA        
0x03F1B2|$0F:$F1A2:A2 0C   	LDX #$0C   
0x03F1B4|$0F:$F1A4:A9 5F   	LDA #$5F   	; [space]
; control flow target (from $F1AA)
0x03F1B6|$0F:$F1A6:9D 00 01	STA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x03F1B9|$0F:$F1A9:CA      	DEX        
0x03F1BA|$0F:$F1AA:10 FA   	BPL $F1A6  
0x03F1BC|$0F:$F1AC:68      	PLA        
0x03F1BD|$0F:$F1AD:AA      	TAX        
0x03F1BE|$0F:$F1AE:68      	PLA        
0x03F1BF|$0F:$F1AF:60      	RTS        

; given a hero ID in $4A, set A and X to hero ID * 8, a.k.a. offset for start of hero's inventory
; control flow target (from $F1B7, $F22D)
; external control flow target (from $06:$AE05)
0x03F1C0|$0F:$F1B0:A5 4A   	LDA $4A    
0x03F1C2|$0F:$F1B2:0A      	ASL        
0x03F1C3|$0F:$F1B3:0A      	ASL        
0x03F1C4|$0F:$F1B4:0A      	ASL        
0x03F1C5|$0F:$F1B5:AA      	TAX        
0x03F1C6|$0F:$F1B6:60      	RTS        

; given hero ID in $4A and item type in $609D, set A = number of items of desired type in hero's inventory
; control flow target (from $EC5E, $EF06, $F4B7, $F5C3, $F605)
0x03F1C7|$0F:$F1B7:20 B0 F1	JSR $F1B0  	; given a hero ID in $4A, set A and X to hero ID * 8, a.k.a. offset for start of hero's inventory
0x03F1CA|$0F:$F1BA:A0 00   	LDY #$00   
0x03F1CC|$0F:$F1BC:84 10   	STY $10    	; number of items in hero's inventory
; control flow target (from $F1D1)
0x03F1CE|$0F:$F1BE:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x03F1D1|$0F:$F1C1:F0 0A   	BEQ $F1CD  	; branch if no item
0x03F1D3|$0F:$F1C3:20 D6 F1	JSR $F1D6  	; determine item type (#$00 = weapon, #$01 = armour, #$02 = shield, #$03 = helmet, #$04 = menu function wants all items or item is non-equipment, #$05 = menu format wants equipped items only and item not equipped)
0x03F1D6|$0F:$F1C6:CD 9D 60	CMP $609D  	; menu function parameter
0x03F1D9|$0F:$F1C9:D0 02   	BNE $F1CD  	; branch if wrong type of item
0x03F1DB|$0F:$F1CB:E6 10   	INC $10    	; number of items of desired type in hero's inventory
; control flow target (from $F1C1, $F1C9)
0x03F1DD|$0F:$F1CD:E8      	INX        	; increment total inventory offset
0x03F1DE|$0F:$F1CE:C8      	INY        	; increment hero inventory offset
0x03F1DF|$0F:$F1CF:C0 08   	CPY #$08   	; 8 inventory slots per hero
0x03F1E1|$0F:$F1D1:D0 EB   	BNE $F1BE  	; if more inventory to check, check it
0x03F1E3|$0F:$F1D3:A5 10   	LDA $10    	; number of items of desired type in hero's inventory
0x03F1E5|$0F:$F1D5:60      	RTS        

; determine item type (#$00 = weapon, #$01 = armour, #$02 = shield, #$03 = helmet, #$04 = menu function wants all items or item is non-equipment, #$05 = menu format wants equipped items only and item not equipped)
; control flow target (from $F1C3, $F235)
; external control flow target (from $06:$AE10)
0x03F1E6|$0F:$F1D6:48      	PHA        	; item ID
0x03F1E7|$0F:$F1D7:AD AA 60	LDA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03F1EA|$0F:$F1DA:29 02   	AND #$02   
0x03F1EC|$0F:$F1DC:F0 06   	BEQ $F1E4  
0x03F1EE|$0F:$F1DE:68      	PLA        	; item ID
0x03F1EF|$0F:$F1DF:48      	PHA        	; item ID
0x03F1F0|$0F:$F1E0:29 40   	AND #$40   	; #$40 => equipped
0x03F1F2|$0F:$F1E2:F0 21   	BEQ $F205  	; item is not equipped
; control flow target (from $F1DC)
0x03F1F4|$0F:$F1E4:AD 9D 60	LDA $609D  	; menu function parameter
0x03F1F7|$0F:$F1E7:C9 04   	CMP #$04   	; #$04 => count all items as non-equipment
0x03F1F9|$0F:$F1E9:F0 2A   	BEQ $F215  	; item is non-equipment
0x03F1FB|$0F:$F1EB:68      	PLA        	; item ID
0x03F1FC|$0F:$F1EC:29 3F   	AND #$3F   	; strip off equipped bit
0x03F1FE|$0F:$F1EE:C9 00   	CMP #$00   	; no item
0x03F200|$0F:$F1F0:F0 24   	BEQ $F216  
0x03F202|$0F:$F1F2:C9 11   	CMP #$11   	; first armour ID
0x03F204|$0F:$F1F4:90 13   	BCC $F209  	; item is a weapon
0x03F206|$0F:$F1F6:C9 1C   	CMP #$1C   	; first shield ID
0x03F208|$0F:$F1F8:90 12   	BCC $F20C  	; item is an armour
0x03F20A|$0F:$F1FA:C9 21   	CMP #$21   	; first helmet ID
0x03F20C|$0F:$F1FC:90 11   	BCC $F20F  	; item is a shield
0x03F20E|$0F:$F1FE:C9 24   	CMP #$24   	; first non-equipment item ID
0x03F210|$0F:$F200:90 10   	BCC $F212  	; item is a helmet
0x03F212|$0F:$F202:A9 04   	LDA #$04   	; item is non-equipment
0x03F214|$0F:$F204:60      	RTS        

; item is not equipped
; control flow target (from $F1E2)
0x03F215|$0F:$F205:68      	PLA        
0x03F216|$0F:$F206:A9 05   	LDA #$05   
0x03F218|$0F:$F208:60      	RTS        

; item is a weapon
; control flow target (from $F1F4)
0x03F219|$0F:$F209:A9 00   	LDA #$00   
0x03F21B|$0F:$F20B:60      	RTS        

; item is an armour
; control flow target (from $F1F8)
0x03F21C|$0F:$F20C:A9 01   	LDA #$01   
0x03F21E|$0F:$F20E:60      	RTS        

; item is a shield
; control flow target (from $F1FC)
0x03F21F|$0F:$F20F:A9 02   	LDA #$02   
0x03F221|$0F:$F211:60      	RTS        

; item is a helmet
; control flow target (from $F200)
0x03F222|$0F:$F212:A9 03   	LDA #$03   
0x03F224|$0F:$F214:60      	RTS        

; item is non-equipment
; control flow target (from $F1E9)
0x03F225|$0F:$F215:68      	PLA        
; control flow target (from $F1F0)
0x03F226|$0F:$F216:A9 04   	LDA #$04   
0x03F228|$0F:$F218:60      	RTS        

; return the $60AC'th item of item type $609D in A and the party inventory index of that item in X, or #$00 in A and #$FF in X if no such item exists; also sets $60BA,X to #$FF if found and #$00 otherwise
; control flow target (from $EE9A)
0x03F229|$0F:$F219:AD AC 60	LDA $60AC  	; menu list index
0x03F22C|$0F:$F21C:29 03   	AND #$03   
0x03F22E|$0F:$F21E:AA      	TAX        
0x03F22F|$0F:$F21F:A9 FF   	LDA #$FF   
0x03F231|$0F:$F221:9D BA 60	STA $60BA,X
0x03F234|$0F:$F224:AD AC 60	LDA $60AC  	; menu list index
0x03F237|$0F:$F227:29 07   	AND #$07   
0x03F239|$0F:$F229:85 10   	STA $10    
0x03F23B|$0F:$F22B:E6 10   	INC $10    
0x03F23D|$0F:$F22D:20 B0 F1	JSR $F1B0  	; given a hero ID in $4A, set A and X to hero ID * 8, a.k.a. offset for start of hero's inventory
; control flow target (from $F245)
0x03F240|$0F:$F230:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x03F243|$0F:$F233:F0 12   	BEQ $F247  
0x03F245|$0F:$F235:20 D6 F1	JSR $F1D6  	; determine item type (#$00 = weapon, #$01 = armour, #$02 = shield, #$03 = helmet, #$04 = menu function wants all items or item is non-equipment, #$05 = menu format wants equipped items only and item not equipped)
0x03F248|$0F:$F238:CD 9D 60	CMP $609D  	; menu function parameter
0x03F24B|$0F:$F23B:D0 04   	BNE $F241  
0x03F24D|$0F:$F23D:C6 10   	DEC $10    
0x03F24F|$0F:$F23F:F0 13   	BEQ $F254  
; control flow target (from $F23B)
0x03F251|$0F:$F241:E8      	INX        
0x03F252|$0F:$F242:8A      	TXA        
0x03F253|$0F:$F243:29 07   	AND #$07   
0x03F255|$0F:$F245:D0 E9   	BNE $F230  
; control flow target (from $F233)
0x03F257|$0F:$F247:AD AC 60	LDA $60AC  	; menu list index
0x03F25A|$0F:$F24A:29 03   	AND #$03   
0x03F25C|$0F:$F24C:AA      	TAX        
0x03F25D|$0F:$F24D:A9 00   	LDA #$00   
0x03F25F|$0F:$F24F:9D BA 60	STA $60BA,X
0x03F262|$0F:$F252:A2 FF   	LDX #$FF   
; control flow target (from $F23F)
0x03F264|$0F:$F254:60      	RTS        

; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID and X to the number of items in the shop
; control flow target (from $EEF6)
0x03F265|$0F:$F255:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03F268|$0F:$F258:AD AF 60	LDA $60AF  	; shop ID
0x03F26B|$0F:$F25B:0A      	ASL        
0x03F26C|$0F:$F25C:85 10   	STA $10    
0x03F26E|$0F:$F25E:0A      	ASL        
0x03F26F|$0F:$F25F:65 10   	ADC $10    	; A = A * 6; 6 items per shop
0x03F271|$0F:$F261:A8      	TAY        
0x03F272|$0F:$F262:84 10   	STY $10    	; start of shop's inventory list
0x03F274|$0F:$F264:A2 00   	LDX #$00   	; number of items in shop
; control flow target (from $F26F)
0x03F276|$0F:$F266:B9 8A 9F	LDA $9F8A,Y	; Weapon Shop inventories
0x03F279|$0F:$F269:F0 06   	BEQ $F271  	; #$00 marks the end of shop's item list
0x03F27B|$0F:$F26B:E8      	INX        
0x03F27C|$0F:$F26C:C8      	INY        
0x03F27D|$0F:$F26D:E0 06   	CPX #$06   	; 6 items per shop
0x03F27F|$0F:$F26F:D0 F5   	BNE $F266  	; if more items to check, check them
; control flow target (from $F269)
0x03F281|$0F:$F271:AD AC 60	LDA $60AC  	; menu list index
0x03F284|$0F:$F274:18      	CLC        
0x03F285|$0F:$F275:65 10   	ADC $10    	; start of shop's inventory list
0x03F287|$0F:$F277:A8      	TAY        	; selected item
0x03F288|$0F:$F278:B9 8A 9F	LDA $9F8A,Y	; Weapon Shop inventories
0x03F28B|$0F:$F27B:60      	RTS        

; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID
; control flow target (from $F62F)
0x03F28C|$0F:$F27C:4C 89 F2	JMP $F289  	; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID

; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID or #$00 if it's the Jailor's Key
; control flow target (from $EEA6)
0x03F28F|$0F:$F27F:20 89 F2	JSR $F289  	; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID
0x03F292|$0F:$F282:C9 39   	CMP #$39   	; Item ID #$39: Jailor’s Key
0x03F294|$0F:$F284:D0 02   	BNE $F288  	; if Jailor's Key, display [blank] instead
0x03F296|$0F:$F286:A9 00   	LDA #$00   
; control flow target (from $F284)
0x03F298|$0F:$F288:60      	RTS        

; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID
; control flow target (from $F27C, $F27F)
0x03F299|$0F:$F289:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03F29C|$0F:$F28C:AD AF 60	LDA $60AF  	; shop ID
0x03F29F|$0F:$F28F:0A      	ASL        
0x03F2A0|$0F:$F290:85 10   	STA $10    
0x03F2A2|$0F:$F292:0A      	ASL        
0x03F2A3|$0F:$F293:65 10   	ADC $10    	; A = A * 6; 6 items per shop
0x03F2A5|$0F:$F295:6D AC 60	ADC $60AC  	; menu list index
0x03F2A8|$0F:$F298:AA      	TAX        
0x03F2A9|$0F:$F299:BD 8A 9F	LDA $9F8A,X	; Weapon Shop inventories
0x03F2AC|$0F:$F29C:60      	RTS        

; given party inventory offset in X, print name of that item ID to $0100 in reverse; depending on settings, possibly update menu's [left border] to [left border, equipped]
; control flow target (from $EE9D)
0x03F2AD|$0F:$F29D:20 F0 F2	JSR $F2F0  	; initialize string buffer $0100-$010C with [space]s, set maximum string length to #$0B if we're dealing with the second segment
0x03F2B0|$0F:$F2A0:E0 FF   	CPX #$FF   
0x03F2B2|$0F:$F2A2:F0 4B   	BEQ $F2EF  
0x03F2B4|$0F:$F2A4:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
; print name of item ID in A to $0100 in reverse; depending on settings, possibly update menu's [left border] to [left border, equipped]
; control flow target (from $EEA9)
; external control flow target (from $02:$BE95)
0x03F2B7|$0F:$F2A7:8D AD 60	STA $60AD  	; item ID
0x03F2BA|$0F:$F2AA:29 40   	AND #$40   	; pick out the equipped bit
0x03F2BC|$0F:$F2AC:F0 06   	BEQ $F2B4  	; skip ahead if item is not equipped
0x03F2BE|$0F:$F2AE:AD AC 60	LDA $60AC  	; menu list index
0x03F2C1|$0F:$F2B1:8D B9 60	STA $60B9  
; control flow target (from $F2AC)
0x03F2C4|$0F:$F2B4:20 F0 F2	JSR $F2F0  	; initialize string buffer $0100-$010C with [space]s, set maximum string length to #$0B if we're dealing with the second segment
0x03F2C7|$0F:$F2B7:AD AB 60	LDA $60AB  	; which list segment we're dealing with
0x03F2CA|$0F:$F2BA:29 01   	AND #$01   	; pretty sure the only options are 0 and 1, so this seems useless
0x03F2CC|$0F:$F2BC:F0 02   	BEQ $F2C0  	; if 0, use 0
0x03F2CE|$0F:$F2BE:A9 01   	LDA #$01   	; else use 1 (... but it already was 1)
; control flow target (from $F2BC)
0x03F2D0|$0F:$F2C0:A8      	TAY        	; set item pointer list index
0x03F2D1|$0F:$F2C1:AD AD 60	LDA $60AD  	; item ID
0x03F2D4|$0F:$F2C4:48      	PHA        	; item ID
0x03F2D5|$0F:$F2C5:29 40   	AND #$40   	; pick out the equipped bit
0x03F2D7|$0F:$F2C7:F0 1B   	BEQ $F2E4  	; if not equipped, skip ahead
0x03F2D9|$0F:$F2C9:AD AA 60	LDA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03F2DC|$0F:$F2CC:4A      	LSR        
0x03F2DD|$0F:$F2CD:90 15   	BCC $F2E4  	; if not replacing [left border] with [left border, equipped], skip ahead
0x03F2DF|$0F:$F2CF:AD AB 60	LDA $60AB  	; which list segment we're dealing with
0x03F2E2|$0F:$F2D2:4A      	LSR        
0x03F2E3|$0F:$F2D3:B0 0F   	BCS $F2E4  	; if not dealing with list segmetn 1, skip ahead
0x03F2E5|$0F:$F2D5:A9 00   	LDA #$00   	; otherwise reset current column
0x03F2E7|$0F:$F2D7:8D 9E 60	STA $609E  	; menu current column
0x03F2EA|$0F:$F2DA:A9 8B   	LDA #$8B   	; [left border, equipped]
0x03F2EC|$0F:$F2DC:20 2F F3	JSR $F32F  	; print A to menu
0x03F2EF|$0F:$F2DF:A9 5F   	LDA #$5F   	; [space]
0x03F2F1|$0F:$F2E1:20 2F F3	JSR $F32F  	; print A to menu
; control flow target (from $F2C7, $F2CD, $F2D3)
0x03F2F4|$0F:$F2E4:68      	PLA        	; item ID
0x03F2F5|$0F:$F2E5:29 3F   	AND #$3F   	; strip off the equipped bit
0x03F2F7|$0F:$F2E7:8D AD 60	STA $60AD  	; item ID
0x03F2FA|$0F:$F2EA:F0 03   	BEQ $F2EF  	; if no item, just RTS
0x03F2FC|$0F:$F2EC:20 FF F2	JSR $F2FF  	; given item ID in A, print name of item to $0100 in reverse
; control flow target (from $F2A2, $F2EA)
0x03F2FF|$0F:$F2EF:60      	RTS        

; initialize string buffer $0100-$010C with [space]s, set maximum string length to #$0B if we're dealing with the second segment
; control flow target (from $F29D, $F2B4)
0x03F300|$0F:$F2F0:20 9F F1	JSR $F19F  	; initialize string buffer $0100-$010C with [space]s
0x03F303|$0F:$F2F3:AD AB 60	LDA $60AB  	; which list segment we're dealing with
0x03F306|$0F:$F2F6:4A      	LSR        
0x03F307|$0F:$F2F7:90 05   	BCC $F2FE  	; if first segment, skip ahead
0x03F309|$0F:$F2F9:A9 0B   	LDA #$0B   	; max length of second segment
0x03F30B|$0F:$F2FB:8D A0 60	STA $60A0  	; maximum string length
; control flow target (from $F2F7)
0x03F30E|$0F:$F2FE:60      	RTS        

; given item ID in A, print name of item to $0100 in reverse
; control flow target (from $F2EC)
0x03F30F|$0F:$F2FF:48      	PHA        	; item ID
0x03F310|$0F:$F300:C9 21   	CMP #$21   	; split point for item list pointers
0x03F312|$0F:$F302:90 06   	BCC $F30A  	; if < #$21, use the first set of pointers
0x03F314|$0F:$F304:68      	PLA        	; item ID
0x03F315|$0F:$F305:E9 20   	SBC #$20   	; adjust item ID for second set of pointers; note that C is set since we got here by not taking BCC
0x03F317|$0F:$F307:C8      	INY        	; pointer address += 2
0x03F318|$0F:$F308:C8      	INY        
0x03F319|$0F:$F309:48      	PHA        	; item ID within list segment
; control flow target (from $F302)
0x03F31A|$0F:$F30A:B9 16 F3	LDA $F316,Y	; item list bank/pointers
0x03F31D|$0F:$F30D:20 E2 F3	JSR $F3E2  	; parse bank/pointer indices from A, load desired bank, set $57-$58 to desired pointer value
0x03F320|$0F:$F310:68      	PLA        	; item ID within list segment
0x03F321|$0F:$F311:F0 07   	BEQ $F31A  	; load bank specified by $60D7 (set by last call to $F3E2)
0x03F323|$0F:$F313:4C F8 F3	JMP $F3F8  	; find desired list item A (one-based) in ($57), copy it to $0100 (referenced as $00FF,X) in reverse; set Y to length of string copied, then load bank specified by $60D7 (set by last call to $F3E2)


; code -> data
; item list bank/pointers
; indexed data load target (from $F30A)
0x03F326|$0F:$F316:D1	; $06:$8022; -> $06:$B2CA: Item list part 1, line 1
0x03F327|$0F:$F317:D2	; $06:$8024; -> $06:$B4B2: Item list part 1, line 2
0x03F328|$0F:$F318:D8	; $06:$8030; -> $06:$B3BE: Item list part 2, line 1
0x03F329|$0F:$F319:D9	; $06:$8032; -> $06:$B57C: Item list part 2, line 2

; data -> code
; load bank specified by $60D7 (set by last call to $F3E2)
; control flow target (from $F311, $F3FB)
0x03F32A|$0F:$F31A:48      	PHA        
0x03F32B|$0F:$F31B:AD D7 60	LDA $60D7  	; backup copy of current bank set by calls to $F3E2; used by $F31A
0x03F32E|$0F:$F31E:4C 82 F7	JMP $F782  	; load bank specified by A then PLA

; toggle list segment $60AB; if list segment becomes #$01, INC menu list index $60AC
; control flow target (from $EEA3, $EFC9)
0x03F331|$0F:$F321:AD AB 60	LDA $60AB  	; which list segment we're dealing with
0x03F334|$0F:$F324:49 01   	EOR #$01   
0x03F336|$0F:$F326:D0 03   	BNE $F32B  
0x03F338|$0F:$F328:EE AC 60	INC $60AC  	; menu list index
; control flow target (from $F326)
0x03F33B|$0F:$F32B:8D AB 60	STA $60AB  	; which list segment we're dealing with
0x03F33E|$0F:$F32E:60      	RTS        

; print A to menu
; control flow target (from $F2DC, $F2E1)
0x03F33F|$0F:$F32F:8D 9B 60	STA $609B  	; menu text
0x03F342|$0F:$F332:4C E4 EF	JMP $EFE4  	; print one byte of menu text

; control flow target (from $EEB4)
0x03F345|$0F:$F335:AE AC 60	LDX $60AC  	; menu list index
0x03F348|$0F:$F338:A9 FF   	LDA #$FF   
0x03F34A|$0F:$F33A:9D BA 60	STA $60BA,X
0x03F34D|$0F:$F33D:AD 9D 60	LDA $609D  	; menu function parameter
0x03F350|$0F:$F340:0A      	ASL        	; A is either #$00 (battle spells) or #$01 (field spells), so this is either #$00 or #$02
0x03F351|$0F:$F341:65 4A   	ADC $4A    	; hero ID - 1
0x03F353|$0F:$F343:AA      	TAX        
0x03F354|$0F:$F344:BD 18 06	LDA $0618,X	; Cannock's learned battle spell list
0x03F357|$0F:$F347:85 10   	STA $10    	; selected hero's learned spell list
0x03F359|$0F:$F349:A9 80   	LDA #$80   
0x03F35B|$0F:$F34B:85 11   	STA $11    
0x03F35D|$0F:$F34D:AD AC 60	LDA $60AC  	; menu list index
0x03F360|$0F:$F350:AE 9D 60	LDX $609D  	; menu function parameter
0x03F363|$0F:$F353:D0 05   	BNE $F35A  	; branch if field spells
0x03F365|$0F:$F355:4A      	LSR        
0x03F366|$0F:$F356:A2 88   	LDX #$88   
0x03F368|$0F:$F358:86 11   	STX $11    
; control flow target (from $F353)
0x03F36A|$0F:$F35A:AA      	TAX        
; control flow target (from $F360)
0x03F36B|$0F:$F35B:CA      	DEX        
0x03F36C|$0F:$F35C:30 04   	BMI $F362  
0x03F36E|$0F:$F35E:46 11   	LSR $11    
0x03F370|$0F:$F360:90 F9   	BCC $F35B  
; control flow target (from $F35C)
0x03F372|$0F:$F362:AD 9D 60	LDA $609D  	; menu function parameter
0x03F375|$0F:$F365:29 01   	AND #$01   
0x03F377|$0F:$F367:D0 0D   	BNE $F376  	; branch if field spells
0x03F379|$0F:$F369:AD AC 60	LDA $60AC  	; menu list index
0x03F37C|$0F:$F36C:29 01   	AND #$01   
0x03F37E|$0F:$F36E:AA      	TAX        
0x03F37F|$0F:$F36F:BD 9D F3	LDA $F39D,X
0x03F382|$0F:$F372:25 11   	AND $11    
0x03F384|$0F:$F374:85 11   	STA $11    
; control flow target (from $F367)
0x03F386|$0F:$F376:A5 10   	LDA $10    	; selected hero's learned spell list
0x03F388|$0F:$F378:25 11   	AND $11    
0x03F38A|$0F:$F37A:F0 16   	BEQ $F392  
0x03F38C|$0F:$F37C:A5 4A   	LDA $4A    	; hero ID - 1
0x03F38E|$0F:$F37E:0A      	ASL        
0x03F38F|$0F:$F37F:0A      	ASL        
0x03F390|$0F:$F380:0A      	ASL        
0x03F391|$0F:$F381:0A      	ASL        
0x03F392|$0F:$F382:48      	PHA        
0x03F393|$0F:$F383:AD 9D 60	LDA $609D  	; menu function parameter
0x03F396|$0F:$F386:0A      	ASL        
0x03F397|$0F:$F387:0A      	ASL        
0x03F398|$0F:$F388:0A      	ASL        
0x03F399|$0F:$F389:85 12   	STA $12    
0x03F39B|$0F:$F38B:68      	PLA        
0x03F39C|$0F:$F38C:65 12   	ADC $12    
0x03F39E|$0F:$F38E:6D AC 60	ADC $60AC  	; menu list index
0x03F3A1|$0F:$F391:60      	RTS        

; control flow target (from $F37A)
0x03F3A2|$0F:$F392:A9 00   	LDA #$00   
0x03F3A4|$0F:$F394:AE AC 60	LDX $60AC  	; menu list index
0x03F3A7|$0F:$F397:9D BA 60	STA $60BA,X
0x03F3AA|$0F:$F39A:A9 FF   	LDA #$FF   
0x03F3AC|$0F:$F39C:60      	RTS        


; code -> data
; indexed data load target (from $F36F)
0x03F3AD|$0F:$F39D:F0
0x03F3AE|$0F:$F39E:0F

; data -> code
; given spell name index in A, print spell name to $0100 in reverse, set Y to length of string copied, then load bank specified by $60D7 (set by last call to $F3E2)
; control flow target (from $EEB7)
; external control flow target (from $02:$BEA5)
0x03F3AF|$0F:$F39F:48      	PHA        	; spell name index
0x03F3B0|$0F:$F3A0:20 9F F1	JSR $F19F  	; initialize string buffer $0100-$010C with [space]s
0x03F3B3|$0F:$F3A3:68      	PLA        	; spell name index
0x03F3B4|$0F:$F3A4:85 10   	STA $10    	; spell name index
0x03F3B6|$0F:$F3A6:C9 FF   	CMP #$FF   
0x03F3B8|$0F:$F3A8:F0 0C   	BEQ $F3B6  	; #$FF => not a real spell
0x03F3BA|$0F:$F3AA:A9 D3   	LDA #$D3   	; spell list bank/pointer
0x03F3BC|$0F:$F3AC:20 E2 F3	JSR $F3E2  	; parse bank/pointer indices from A, load desired bank, set $57-$58 to desired pointer value
0x03F3BF|$0F:$F3AF:A6 10   	LDX $10    	; spell name index
0x03F3C1|$0F:$F3B1:E8      	INX        	; $F3F8 is one-based, so convert from zero-based
0x03F3C2|$0F:$F3B2:8A      	TXA        
0x03F3C3|$0F:$F3B3:20 F8 F3	JSR $F3F8  	; find desired list item A (one-based) in ($57), copy it to $0100 (referenced as $00FF,X) in reverse; set Y to length of string copied, then load bank specified by $60D7 (set by last call to $F3E2)
; control flow target (from $F3A8)
0x03F3C6|$0F:$F3B6:60      	RTS        

; given monster ID in A, copy monster name segment to $0100 in reverse
; control flow target (from $EFC3, $FC98, $FCB5)
0x03F3C7|$0F:$F3B7:85 10   	STA $10    	; save desired monster index for later (both here and in calling code)
0x03F3C9|$0F:$F3B9:86 11   	STX $11    	; pointless?
0x03F3CB|$0F:$F3BB:A0 00   	LDY #$00   	; start by assuming we're dealing with Monsters 1 Line 1 (LDY $60AB would save 6 bytes?)
0x03F3CD|$0F:$F3BD:AD AB 60	LDA $60AB  	; which list segment we're dealing with
0x03F3D0|$0F:$F3C0:4A      	LSR        	; shift low bit to C
0x03F3D1|$0F:$F3C1:90 01   	BCC $F3C4  	; C = 0 => first segment, so keep Y at #$00
0x03F3D3|$0F:$F3C3:C8      	INY        	; otherwise it's the second segment, so set Y = #$01
; control flow target (from $F3C1)
0x03F3D4|$0F:$F3C4:A5 10   	LDA $10    	; restore monster index
0x03F3D6|$0F:$F3C6:48      	PHA        	; save monster index
0x03F3D7|$0F:$F3C7:C9 33   	CMP #$33   	; is monster index < 51?
0x03F3D9|$0F:$F3C9:90 06   	BCC $F3D1  	; if monster index < 51, skip ahead
0x03F3DB|$0F:$F3CB:68      	PLA        	; pop old monster index
0x03F3DC|$0F:$F3CC:E9 32   	SBC #$32   	; otherwise subtract 50
0x03F3DE|$0F:$F3CE:C8      	INY        	; and use the second half of the pointer list
0x03F3DF|$0F:$F3CF:C8      	INY        
0x03F3E0|$0F:$F3D0:48      	PHA        	; push new monster index
; control flow target (from $F3C9)
0x03F3E1|$0F:$F3D1:B9 DE F3	LDA $F3DE,Y	; monster list bank/pointers
0x03F3E4|$0F:$F3D4:20 E2 F3	JSR $F3E2  	; parse bank/pointer indices from A, load desired bank, set $57-$58 to desired pointer value
0x03F3E7|$0F:$F3D7:20 9F F1	JSR $F19F  	; initialize string buffer $0100-$010C with [space]s
0x03F3EA|$0F:$F3DA:68      	PLA        	; monster index
0x03F3EB|$0F:$F3DB:4C F8 F3	JMP $F3F8  	; find desired list item A (one-based) in ($57), copy it to $0100 (referenced as $00FF,X) in reverse; set Y to length of string copied, then load bank specified by $60D7 (set by last call to $F3E2)


; code -> data
; monster list bank/pointers
; indexed data load target (from $F3D1)
0x03F3EE|$0F:$F3DE:D4	; $06:$8028; -> $06:$B718: Monster list part 1, line 1
0x03F3EF|$0F:$F3DF:D5	; $06:$802A; -> $06:$B945: Monster list part 1, line 2
0x03F3F0|$0F:$F3E0:DA	; $06:$8034; -> $06:$B85E: Monster list part 2, line 1
0x03F3F1|$0F:$F3E1:DB	; $06:$8036; -> $06:$B9D5: Monster list part 2, line 2

; data -> code
; parse bank/pointer indices from A, load desired bank, set $57-$58 to desired pointer value
; control flow target (from $EBB4, $F30D, $F3AC, $F3D4)
0x03F3F2|$0F:$F3E2:48      	PHA        
0x03F3F3|$0F:$F3E3:AD F6 05	LDA $05F6  	; current bank
0x03F3F6|$0F:$F3E6:8D D7 60	STA $60D7  	; backup copy of current bank set by calls to $F3E2; used by $F31A
0x03F3F9|$0F:$F3E9:68      	PLA        
0x03F3FA|$0F:$F3EA:20 33 FF	JSR $FF33  	; parse A into bank and pointer indices and load specified bank
0x03F3FD|$0F:$F3ED:BD 00 80	LDA $8000,X
0x03F400|$0F:$F3F0:85 57   	STA $57    	; pointer to start of main pointer table, low byte
0x03F402|$0F:$F3F2:BD 01 80	LDA $8001,X
0x03F405|$0F:$F3F5:85 58   	STA $58    	; pointer to start of main pointer table, high byte
0x03F407|$0F:$F3F7:60      	RTS        

; find desired list item A (one-based) in ($57), copy it to $0100 (referenced as $00FF,X) in reverse; set Y to length of string copied, then load bank specified by $60D7 (set by last call to $F3E2)
; control flow target (from $F313, $F3B3, $F3DB)
0x03F408|$0F:$F3F8:20 FE F3	JSR $F3FE  	; find desired list item A (one-based) in ($57), copy it to $0100 (referenced as $00FF,X) in reverse; set Y to length of string copied
0x03F40B|$0F:$F3FB:4C 1A F3	JMP $F31A  	; load bank specified by $60D7 (set by last call to $F3E2)

; find desired list item A (one-based) in ($57), copy it to $0100 (referenced as $00FF,X) in reverse; set Y to length of string copied
; control flow target (from $F3F8)
0x03F40E|$0F:$F3FE:AA      	TAX        
0x03F40F|$0F:$F3FF:A0 00   	LDY #$00   
; control flow target (from $F412, $F416)
0x03F411|$0F:$F401:CA      	DEX        
0x03F412|$0F:$F402:F0 14   	BEQ $F418  
; control flow target (from $F40B, $F40F)
0x03F414|$0F:$F404:B1 57   	LDA ($57),Y	; pointer to start of main pointer table, low byte; scan through ($57),Y, counting #$FF bytes until we've reached the right list item
0x03F416|$0F:$F406:C9 FF   	CMP #$FF   
0x03F418|$0F:$F408:F0 07   	BEQ $F411  
0x03F41A|$0F:$F40A:C8      	INY        
0x03F41B|$0F:$F40B:D0 F7   	BNE $F404  
0x03F41D|$0F:$F40D:E6 58   	INC $58    	; pointer to start of main pointer table, high byte
0x03F41F|$0F:$F40F:D0 F3   	BNE $F404  
; control flow target (from $F408)
0x03F421|$0F:$F411:C8      	INY        
0x03F422|$0F:$F412:D0 ED   	BNE $F401  
0x03F424|$0F:$F414:E6 58   	INC $58    	; pointer to start of main pointer table, high byte
0x03F426|$0F:$F416:D0 E9   	BNE $F401  
; control flow target (from $F402)
0x03F428|$0F:$F418:98      	TYA        
0x03F429|$0F:$F419:18      	CLC        
0x03F42A|$0F:$F41A:65 57   	ADC $57    	; pointer to start of main pointer table, low byte
0x03F42C|$0F:$F41C:85 57   	STA $57    	; pointer to start of main pointer table, low byte
0x03F42E|$0F:$F41E:90 02   	BCC $F422  
0x03F430|$0F:$F420:E6 58   	INC $58    	; pointer to start of main pointer table, high byte
; control flow target (from $F41E)
0x03F432|$0F:$F422:A0 00   	LDY #$00   
0x03F434|$0F:$F424:AE A0 60	LDX $60A0  	; maximum string length
; control flow target (from $F432)
0x03F437|$0F:$F427:B1 57   	LDA ($57),Y	; pointer to start of main pointer table, low byte
0x03F439|$0F:$F429:C9 FF   	CMP #$FF   
0x03F43B|$0F:$F42B:F0 07   	BEQ $F434  
0x03F43D|$0F:$F42D:9D FF 00	STA $00FF,X	; built-in offset from string copy buffer start at $0100
0x03F440|$0F:$F430:C8      	INY        
0x03F441|$0F:$F431:CA      	DEX        
0x03F442|$0F:$F432:D0 F3   	BNE $F427  
; control flow target (from $F42B, $F437)
0x03F444|$0F:$F434:60      	RTS        

; control flow target (from $EBA2)
0x03F445|$0F:$F435:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x03F447|$0F:$F437:D0 FB   	BNE $F434  
0x03F449|$0F:$F439:A5 4D   	LDA $4D    
0x03F44B|$0F:$F43B:85 0C   	STA $0C    
0x03F44D|$0F:$F43D:A5 4E   	LDA $4E    
0x03F44F|$0F:$F43F:85 0E   	STA $0E    
0x03F451|$0F:$F441:20 2D DE	JSR $DE2D  
0x03F454|$0F:$F444:A0 00   	LDY #$00   
0x03F456|$0F:$F446:84 12   	STY $12    
0x03F458|$0F:$F448:AD A3 60	LDA $60A3  	; menu window height (ROM value * 2)
0x03F45B|$0F:$F44B:4A      	LSR        
0x03F45C|$0F:$F44C:85 10   	STA $10    
; control flow target (from $F467)
0x03F45E|$0F:$F44E:AD A1 60	LDA $60A1  	; menu window width
0x03F461|$0F:$F451:4A      	LSR        
0x03F462|$0F:$F452:85 11   	STA $11    
0x03F464|$0F:$F454:A9 01   	LDA #$01   
; control flow target (from $F45B)
0x03F466|$0F:$F456:91 07   	STA ($07),Y	; mark menu open
0x03F468|$0F:$F458:C8      	INY        
0x03F469|$0F:$F459:C6 11   	DEC $11    
0x03F46B|$0F:$F45B:D0 F9   	BNE $F456  
0x03F46D|$0F:$F45D:A5 12   	LDA $12    
0x03F46F|$0F:$F45F:18      	CLC        
0x03F470|$0F:$F460:69 10   	ADC #$10   
0x03F472|$0F:$F462:85 12   	STA $12    
0x03F474|$0F:$F464:A8      	TAY        
0x03F475|$0F:$F465:C6 10   	DEC $10    
0x03F477|$0F:$F467:D0 E5   	BNE $F44E  
0x03F479|$0F:$F469:A5 35   	LDA $35    	; flag indicating whether any menu is currently open
0x03F47B|$0F:$F46B:48      	PHA        
0x03F47C|$0F:$F46C:A9 FF   	LDA #$FF   
0x03F47E|$0F:$F46E:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03F480|$0F:$F470:20 CB D8	JSR $D8CB  
0x03F483|$0F:$F473:68      	PLA        
0x03F484|$0F:$F474:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x03F486|$0F:$F476:4C DC C1	JMP $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF

; print party gold to $0100 in decimal in reverse, replacing leading (now trailing) zeroes with spaces, leaving X at most significant digit
; control flow target (from $EDA7)
0x03F489|$0F:$F479:A9 05   	LDA #$05   
0x03F48B|$0F:$F47B:8D A0 60	STA $60A0  	; maximum string length
0x03F48E|$0F:$F47E:AD 24 06	LDA $0624  	; party gold, low byte
0x03F491|$0F:$F481:85 10   	STA $10    
0x03F493|$0F:$F483:AD 25 06	LDA $0625  	; party gold, high byte
0x03F496|$0F:$F486:85 11   	STA $11    
0x03F498|$0F:$F488:A9 00   	LDA #$00   
0x03F49A|$0F:$F48A:85 12   	STA $12    
0x03F49C|$0F:$F48C:20 7C F1	JSR $F17C  	; given a 24-bit number N in $10-$12, print its base 10 digits in reverse to $0100 up to maximum string length $60A0
0x03F49F|$0F:$F48F:4C 8D F1	JMP $F18D  	; scan through $0100 + maximum string length $60A0 in reverse, replacing zeroes with spaces until the first non-zero or $0100 is reached; leaves X at most significant digit

; display Menu ID #$02: Main menu: gold/crests
; external control flow target (from $06:$89DC)
0x03F4A2|$0F:$F492:A9 02   	LDA #$02   	; Menu ID #$02: Main menu: gold/crests
0x03F4A4|$0F:$F494:4C 89 EB	JMP $EB89  	; open menu specified by A

; display Menu ID #$03: Main menu: selected hero's status
; external control flow target (from $06:$89D6)
0x03F4A7|$0F:$F497:85 4A   	STA $4A    
0x03F4A9|$0F:$F499:A9 03   	LDA #$03   	; Menu ID #$03: Main menu: selected hero's status
0x03F4AB|$0F:$F49B:4C 89 EB	JMP $EB89  	; open menu specified by A

; external control flow target (from $04:$B5D8)
0x03F4AE|$0F:$F49E:85 4A   	STA $4A    
0x03F4B0|$0F:$F4A0:A9 07   	LDA #$07   	; Menu ID #$07: Battle menu: spell list
0x03F4B2|$0F:$F4A2:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F4B5|$0F:$F4A5:C9 FF   	CMP #$FF   
0x03F4B7|$0F:$F4A7:F0 04   	BEQ $F4AD  
0x03F4B9|$0F:$F4A9:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F4BC|$0F:$F4AC:CA	; $06:$8014; -> $06:$AE3D: given hero ID - 1 in $4A and battle spell menu selection index in A, return spell ID in A

; data -> code
; control flow target (from $F4A7)
0x03F4BD|$0F:$F4AD:4C C2 F6	JMP $F6C2  	; load bank specified by $94

; given hero ID in A, display that hero's battle item list window and return the selected item ID in A
; external control flow target (from $04:$B5E1)
0x03F4C0|$0F:$F4B0:85 4A   	STA $4A    	; hero ID
0x03F4C2|$0F:$F4B2:A9 04   	LDA #$04   	; count all items
0x03F4C4|$0F:$F4B4:8D 9D 60	STA $609D  	; menu function parameter
0x03F4C7|$0F:$F4B7:20 B7 F1	JSR $F1B7  	; given hero ID in $4A and item type in $609D, set A = number of items of desired type in hero's inventory
0x03F4CA|$0F:$F4BA:F0 30   	BEQ $F4EC  	; no items => set A = #$FE and RTS
0x03F4CC|$0F:$F4BC:A9 08   	LDA #$08   	; Menu ID #$08: Battle menu: item list window 1
; control flow target (from $F4CD)
0x03F4CE|$0F:$F4BE:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F4D1|$0F:$F4C1:AE B1 60	LDX $60B1  
0x03F4D4|$0F:$F4C4:D0 09   	BNE $F4CF  
0x03F4D6|$0F:$F4C6:C9 FF   	CMP #$FF   
0x03F4D8|$0F:$F4C8:F0 1F   	BEQ $F4E9  
0x03F4DA|$0F:$F4CA:AD AE 60	LDA $60AE  	; menu link ID
0x03F4DD|$0F:$F4CD:D0 EF   	BNE $F4BE  
; control flow target (from $F4C4)
0x03F4DF|$0F:$F4CF:AE AE 60	LDX $60AE  	; menu link ID
0x03F4E2|$0F:$F4D2:E0 08   	CPX #$08   	; Menu ID #$08: Battle menu: item list window 1
0x03F4E4|$0F:$F4D4:D0 07   	BNE $F4DD  	; menu link ID != #$08 => we're currently in Menu ID #$08: Battle menu: item list window 1, so no need to adjust A
0x03F4E6|$0F:$F4D6:C9 FF   	CMP #$FF   	; #$FF stays #$FF
0x03F4E8|$0F:$F4D8:F0 0F   	BEQ $F4E9  
0x03F4EA|$0F:$F4DA:18      	CLC        	; otherwise, we're in Menu ID #$22: Battle menu: item list window 2; menu displays 4 items per page, so add 4 to the selected item index
0x03F4EB|$0F:$F4DB:69 04   	ADC #$04   
; control flow target (from $F4D4)
0x03F4ED|$0F:$F4DD:A2 04   	LDX #$04   	; count all items
0x03F4EF|$0F:$F4DF:C9 FE   	CMP #$FE   
0x03F4F1|$0F:$F4E1:B0 06   	BCS $F4E9  
0x03F4F3|$0F:$F4E3:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F4F6|$0F:$F4E6:C8	; $06:$8010; -> $06:$ADFC: given a selected list index in A, an item type in X, and a hero ID in $4A, set A to the A'th item of type X in hero $4A's inventory

; data -> code
0x03F4F7|$0F:$F4E7:29 3F   	AND #$3F   	; strip off the equipped bit
; control flow target (from $F4C8, $F4D8, $F4E1)
0x03F4F9|$0F:$F4E9:4C C2 F6	JMP $F6C2  	; load bank specified by $94

; control flow target (from $F4BA)
0x03F4FC|$0F:$F4EC:A9 FE   	LDA #$FE   
0x03F4FE|$0F:$F4EE:60      	RTS        

; open battle command menu for hero A
; external control flow target (from $04:$B56E)
0x03F4FF|$0F:$F4EF:85 4A   	STA $4A    
0x03F501|$0F:$F4F1:AA      	TAX        
0x03F502|$0F:$F4F2:F0 1D   	BEQ $F511  	; if it's Midenhall, just display Midenhall's command menu
0x03F504|$0F:$F4F4:E0 01   	CPX #$01   
0x03F506|$0F:$F4F6:D0 07   	BNE $F4FF  	; branch if not Cannock
0x03F508|$0F:$F4F8:2C 2D 06	BIT $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03F50B|$0F:$F4FB:10 10   	BPL $F50D  	; Cannock: if Midenhall is dead, display alternate Cannock command menu
0x03F50D|$0F:$F4FD:70 0E   	BVS $F50D  	; Cannock: if Midenhall is asleep, display alternate Cannock command menu
; control flow target (from $F4F6)
0x03F50F|$0F:$F4FF:2C 2D 06	BIT $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03F512|$0F:$F502:10 02   	BPL $F506  	; Cannock would have taken the earlier BPL, so this is just Moonbrooke: if Midenhall is dead, check Cannock
0x03F514|$0F:$F504:50 0B   	BVC $F511  	; Cannock/Moonbrooke: if Midenhall is awake, display normal Cannock/Moonbrooke command menu
; control flow target (from $F502)
0x03F516|$0F:$F506:2C 3F 06	BIT $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03F519|$0F:$F509:10 02   	BPL $F50D  	; Cannock must have taken one of the earlier BPL/BVS/BVC, so this is just Moonbrooke: if Cannock is dead, display alternate Moonbrooke command menu
0x03F51B|$0F:$F50B:50 04   	BVC $F511  	; Cannock must have taken one of the earlier BPL/BVS/BVC, so this is just Moonbrooke: if Cannock is awake, display normal Moonbrooke command menu
; control flow target (from $F4FB, $F4FD, $F509)
0x03F51D|$0F:$F50D:A2 03   	LDX #$03   	; index for alternate command menu
0x03F51F|$0F:$F50F:D0 00   	BNE $F511  	; useless op
; control flow target (from $F4F2, $F504, $F50B, $F50F)
0x03F521|$0F:$F511:BD 17 F5	LDA $F517,X	; Battle command menus
0x03F524|$0F:$F514:4C 89 EB	JMP $EB89  	; open menu specified by A


; code -> data
; Battle command menus
; indexed data load target (from $F511)
0x03F527|$0F:$F517:09	; Menu ID #$09: Battle menu: Midenhall's command options
0x03F528|$0F:$F518:23	; Menu ID #$23: Battle menu: Cannock/Moonbrooke's command options
0x03F529|$0F:$F519:23	; Menu ID #$23: Battle menu: Cannock/Moonbrooke's command options
0x03F52A|$0F:$F51A:49	; Menu ID #$49: Battle menu: Leader's command options when Midenhall asleep/dead

; data -> code
; display appropriate battle menu monster list
; external control flow target (from $04:$B5A9)
0x03F52B|$0F:$F51B:A5 4B   	LDA $4B    	; flag for whether to display the selectable or non-selectable monster list
0x03F52D|$0F:$F51D:D0 05   	BNE $F524  	; display Menu ID #$05: Battle menu: monster list, non-selectable
0x03F52F|$0F:$F51F:A9 0A   	LDA #$0A   	; Menu ID #$0A: Battle menu: monster list, selectable
0x03F531|$0F:$F521:4C 89 EB	JMP $EB89  	; open menu specified by A

; display Menu ID #$05: Battle menu: monster list, non-selectable
; control flow target (from $F51D)
0x03F534|$0F:$F524:A9 05   	LDA #$05   	; Menu ID #$05: Battle menu: monster list, non-selectable
0x03F536|$0F:$F526:4C 89 EB	JMP $EB89  	; open menu specified by A

; display appropriate battle menu item/spell target
; external control flow target (from $04:$B5E8)
0x03F539|$0F:$F529:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F53C|$0F:$F52C:F0 06   	BEQ $F534  	; if just Midenhall, no need to display hero select menu
0x03F53E|$0F:$F52E:BD 34 F5	LDA $F534,X
0x03F541|$0F:$F531:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F52C)
; indexed data load target (from $F52E)
0x03F544|$0F:$F534:60      	RTS        


; code -> data
; Battle item/spell target menus
0x03F545|$0F:$F535:0B	; Menu ID #$0B: Battle menu: Midenhall + Cannock item/spell target
0x03F546|$0F:$F536:24	; Menu ID #$24: Battle menu: Midenhall + Cannock + Moonbrooke item/spell target

; data -> code
; display hero select STATUS menu if necessary
; external control flow target (from $06:$89CA)
0x03F547|$0F:$F537:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F54A|$0F:$F53A:F0 06   	BEQ $F542  	; if just Midenhall, no need to display hero select menu
0x03F54C|$0F:$F53C:BD 42 F5	LDA $F542,X
0x03F54F|$0F:$F53F:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F53A)
; indexed data load target (from $F53C)
0x03F552|$0F:$F542:60      	RTS        


; code -> data
; main STATUS hero select menus
0x03F553|$0F:$F543:0C	; Menu ID #$0C: Main menu: STATUS with Midenhall + Cannock
0x03F554|$0F:$F544:25	; Menu ID #$25: Main menu: STATUS with Midenhall + Cannock + Moonbrooke

; data -> code
; depending on number of casters in party, maybe open caster select menu
; external control flow target (from $06:$8B36)
0x03F555|$0F:$F545:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F558|$0F:$F548:F0 10   	BEQ $F55A  	; if just Midenhall, no need to display hero select menu
0x03F55A|$0F:$F54A:CA      	DEX        
0x03F55B|$0F:$F54B:F0 0A   	BEQ $F557  	; if only 2 party members, Midenhall can't use magic, so no need to display menu
0x03F55D|$0F:$F54D:A9 0D   	LDA #$0D   	; Menu ID #$0D: Main menu: SPELL with Cannock + Moonbrooke
0x03F55F|$0F:$F54F:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F562|$0F:$F552:C9 FF   	CMP #$FF   
0x03F564|$0F:$F554:F0 03   	BEQ $F559  	; this is never true?
0x03F566|$0F:$F556:AA      	TAX        
; control flow target (from $F54B)
0x03F567|$0F:$F557:E8      	INX        
0x03F568|$0F:$F558:8A      	TXA        
; control flow target (from $F554)
0x03F569|$0F:$F559:60      	RTS        

; control flow target (from $F548)
0x03F56A|$0F:$F55A:A9 FE   	LDA #$FE   
0x03F56C|$0F:$F55C:60      	RTS        

; display appropriate main ITEM hero select menu
; external control flow target (from $06:$955B, $06:$9CC9)
0x03F56D|$0F:$F55D:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F570|$0F:$F560:F0 06   	BEQ $F568  	; if just Midenhall, no need to display hero select menu
0x03F572|$0F:$F562:BD 68 F5	LDA $F568,X
0x03F575|$0F:$F565:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F560)
; indexed data load target (from $F562)
0x03F578|$0F:$F568:60      	RTS        


; code -> data
; main ITEM hero select menus
0x03F579|$0F:$F569:0E	; Menu ID #$0E: Main menu: ITEM with Midenhall + Cannock
0x03F57A|$0F:$F56A:26	; Menu ID #$26: Main menu: ITEM with Midenhall + Cannock + Moonbrooke

; data -> code
; display appropriate main EQUIP hero select menu
; external control flow target (from $06:$8A02)
0x03F57B|$0F:$F56B:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F57E|$0F:$F56E:F0 06   	BEQ $F576  	; if just Midenhall, no need to display hero select menu
0x03F580|$0F:$F570:BD 76 F5	LDA $F576,X
0x03F583|$0F:$F573:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F56E)
; indexed data load target (from $F570)
0x03F586|$0F:$F576:60      	RTS        


; code -> data
; main EQUIP hero select menus
0x03F587|$0F:$F577:0F	; Menu ID #$0F: Main menu: EQUIP with Midenhall + Cannock
0x03F588|$0F:$F578:27	; Menu ID #$27: Main menu: EQUIP with Midenhall + Cannock + Moonbrooke

; data -> code
; display appropriate main SPELL target menu
; external control flow target (from $06:$8B98)
0x03F589|$0F:$F579:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F58C|$0F:$F57C:F0 06   	BEQ $F584  	; if just Midenhall, no need to display hero select menu
0x03F58E|$0F:$F57E:BD 84 F5	LDA $F584,X
0x03F591|$0F:$F581:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F57C)
; indexed data load target (from $F57E)
0x03F594|$0F:$F584:60      	RTS        


; code -> data
; main COMMAND menu SPELL target menus
0x03F595|$0F:$F585:10	; Menu ID #$10: Main menu: SPELL target, Midenhall + Cannock
0x03F596|$0F:$F586:28	; Menu ID #$28: Main menu: SPELL target, Midenhall + Cannock + Moonbrooke

; data -> code
; display appropriate main ITEM target menu
; external control flow target (from $06:$95B1, $06:$9629, $06:$99C1)
0x03F597|$0F:$F587:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F59A|$0F:$F58A:F0 06   	BEQ $F592  	; if just Midenhall, no need to display hero select menu
0x03F59C|$0F:$F58C:BD 92 F5	LDA $F592,X
0x03F59F|$0F:$F58F:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F58A)
; indexed data load target (from $F58C)
0x03F5A2|$0F:$F592:60      	RTS        


; code -> data
; main COMMAND menu ITEM target menus
0x03F5A3|$0F:$F593:11	; Menu ID #$11: Main menu: ITEM target, Midenhall + Cannock
0x03F5A4|$0F:$F594:29	; Menu ID #$29: Main menu: ITEM target, Midenhall + Cannock + Moonbrooke

; data -> code
; display appropriate shop BUY/SELL hero select menu
; external control flow target (from $06:$830E, $06:$8427, $06:$8490, $06:$8589, $06:$85D2, $06:$862B)
0x03F5A5|$0F:$F595:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F5A8|$0F:$F598:F0 06   	BEQ $F5A0  	; if just Midenhall, no need to display hero select menu
0x03F5AA|$0F:$F59A:BD A0 F5	LDA $F5A0,X
0x03F5AD|$0F:$F59D:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F598)
; indexed data load target (from $F59A)
0x03F5B0|$0F:$F5A0:60      	RTS        


; code -> data
; shop menu BUY/SELL hero select menus
0x03F5B1|$0F:$F5A1:12	; Menu ID #$12: Shop menu: buy/sell target, Midenhall + Cannock
0x03F5B2|$0F:$F5A2:2A	; Menu ID #$2A: Shop menu: buy/sell target, Midenhall + Cannock + Moonbrooke

; data -> code
; given a hero ID in A and an item type in X, display the EQUIP sub-menu for hero A and item type X, returning the selected item ID in A
; ##>hero ID
; external control flow target (from $06:$8A1D, $06:$8A2E)
0x03F5B3|$0F:$F5A3:85 4A   	STA $4A    
0x03F5B5|$0F:$F5A5:86 96   	STX $96    	; temp storage for item/spell/type/etc. IDs; item type
0x03F5B7|$0F:$F5A7:BD E8 F5	LDA $F5E8,X	; EQUIP sub-menu IDs
0x03F5BA|$0F:$F5AA:48      	PHA        	; EQUIP sub-menu ID
0x03F5BB|$0F:$F5AB:A5 A5   	LDA $A5    
0x03F5BD|$0F:$F5AD:48      	PHA        
0x03F5BE|$0F:$F5AE:20 EC D0	JSR $D0EC  	; update each hero's stats based on their current EXP
0x03F5C1|$0F:$F5B1:68      	PLA        
0x03F5C2|$0F:$F5B2:85 A5   	STA $A5    
0x03F5C4|$0F:$F5B4:A9 07   	LDA #$07   
0x03F5C6|$0F:$F5B6:20 8C F7	JSR $F78C  	; wipe selected menu region
0x03F5C9|$0F:$F5B9:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item type
0x03F5CB|$0F:$F5BB:8D 9D 60	STA $609D  	; menu function parameter
0x03F5CE|$0F:$F5BE:A9 00   	LDA #$00   
0x03F5D0|$0F:$F5C0:8D AA 60	STA $60AA  	; menu format (#$80 = has cursor, #$40 = is linked, #$20 = is single spaced, #$02 = only display equipped items, #$01 = display [left border, equipped] if equipped)
0x03F5D3|$0F:$F5C3:20 B7 F1	JSR $F1B7  	; given hero ID in $4A and item type in $609D, set A = number of items of desired type in hero's inventory
0x03F5D6|$0F:$F5C6:D0 0E   	BNE $F5D6  	; if hero has items of this type, branch to display the EQUIP sub-menu
0x03F5D8|$0F:$F5C8:68      	PLA        	; EQUIP sub-menu ID
0x03F5D9|$0F:$F5C9:C9 2F   	CMP #$2F   	; Menu ID #$2F: Main menu: equip helmet
0x03F5DB|$0F:$F5CB:D0 05   	BNE $F5D2  	; if we're processing the final EQUIP sub-menu but hero has no helmets, leave the current Attack/Defense menu on the screen for a bit
0x03F5DD|$0F:$F5CD:A9 48   	LDA #$48   	; Menu ID #$48: Main menu: Equip menu's current Attack/Defense
0x03F5DF|$0F:$F5CF:20 89 EB	JSR $EB89  	; open menu specified by A
; control flow target (from $F5CB)
0x03F5E2|$0F:$F5D2:A9 FE   	LDA #$FE   
0x03F5E4|$0F:$F5D4:D0 0F   	BNE $F5E5  	; load bank specified by $94
; control flow target (from $F5C6)
0x03F5E6|$0F:$F5D6:A9 48   	LDA #$48   	; Menu ID #$48: Main menu: Equip menu's current Attack/Defense
0x03F5E8|$0F:$F5D8:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F5EB|$0F:$F5DB:68      	PLA        	; EQUIP sub-menu
0x03F5EC|$0F:$F5DC:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F5EF|$0F:$F5DF:A6 96   	LDX $96    	; temp storage for item/spell/type/etc. IDs; item type
0x03F5F1|$0F:$F5E1:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F5F4|$0F:$F5E4:C8	; $06:$8010; -> $06:$ADFC: given a selected list index in A, an item type in X, and a hero ID in $4A, set A to the A'th item of type X in hero $4A's inventory

; data -> code
; load bank specified by $94
; control flow target (from $F5D4, $F5F5)
0x03F5F5|$0F:$F5E5:4C C2 F6	JMP $F6C2  	; load bank specified by $94


; code -> data
; EQUIP sub-menu IDs
; indexed data load target (from $F5A7)
0x03F5F8|$0F:$F5E8:13	; Menu ID #$13: Main menu: equip weapon
0x03F5F9|$0F:$F5E9:2D	; Menu ID #$2D: Main menu: equip armour
0x03F5FA|$0F:$F5EA:2E	; Menu ID #$2E: Main menu: equip shield
0x03F5FB|$0F:$F5EB:2F	; Menu ID #$2F: Main menu: equip helmet

; data -> code
; given hero ID - 1 in A, open hero's spell list and return selected spell ID in A
; external control flow target (from $06:$8B6E)
0x03F5FC|$0F:$F5EC:85 4A   	STA $4A    	; hero ID - 1
0x03F5FE|$0F:$F5EE:A9 14   	LDA #$14   	; Menu ID #$14: Main menu: spell list
0x03F600|$0F:$F5F0:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F603|$0F:$F5F3:C9 FF   	CMP #$FF   
0x03F605|$0F:$F5F5:F0 EE   	BEQ $F5E5  	; load bank specified by $94
0x03F607|$0F:$F5F7:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F60A|$0F:$F5FA:C9	; $06:$8012; -> $06:$AE30: given hero ID - 1 in $4A and field spell menu selection index in A, return spell ID in A

; data -> code
0x03F60B|$0F:$F5FB:4C C2 F6	JMP $F6C2  	; load bank specified by $94

; given a hero ID in A, open hero's item list and return selected item ID (or #$FE if they have no items)
; external control flow target (from $06:$84C1, $06:$9564, $06:$9CD8)
0x03F60E|$0F:$F5FE:85 4A   	STA $4A    	; hero ID
0x03F610|$0F:$F600:A9 04   	LDA #$04   	; count all items
0x03F612|$0F:$F602:8D 9D 60	STA $609D  	; menu function parameter
0x03F615|$0F:$F605:20 B7 F1	JSR $F1B7  	; given hero ID in $4A and item type in $609D, set A = number of items of desired type in hero's inventory
0x03F618|$0F:$F608:F0 0E   	BEQ $F618  	; if no items, don't open the item list
0x03F61A|$0F:$F60A:A9 15   	LDA #$15   	; Menu ID #$15: Main menu: item list
0x03F61C|$0F:$F60C:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F61F|$0F:$F60F:A2 04   	LDX #$04   	; parameter for $06:$ADFC: count all items
0x03F621|$0F:$F611:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F624|$0F:$F614:C8	; $06:$8010; -> $06:$ADFC: given a selected list index in A, an item type in X, and a hero ID in $4A, set A to the A'th item of type X in hero $4A's inventory

; data -> code
0x03F625|$0F:$F615:4C C2 F6	JMP $F6C2  	; load bank specified by $94

; control flow target (from $F608)
0x03F628|$0F:$F618:A9 FE   	LDA #$FE   
0x03F62A|$0F:$F61A:60      	RTS        

; display shop menu item list for shop ID given in A, returning selected item (with Jailor's Key replaced by blank) in A
; external control flow target (from $06:$82DE, $06:$83CA)
0x03F62B|$0F:$F61B:8D AF 60	STA $60AF  	; shop ID
0x03F62E|$0F:$F61E:A9 1B   	LDA #$1B   	; Menu ID #$1B: Shop menu: current gold
0x03F630|$0F:$F620:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F633|$0F:$F623:A9 16   	LDA #$16   	; Menu ID #$16: Shop menu: Item BUY list
0x03F635|$0F:$F625:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F638|$0F:$F628:C9 FF   	CMP #$FF   
0x03F63A|$0F:$F62A:F0 0C   	BEQ $F638  
0x03F63C|$0F:$F62C:8D AC 60	STA $60AC  	; menu list index
0x03F63F|$0F:$F62F:20 7C F2	JSR $F27C  	; given shop ID in $60AF and menu list index in $60AC, set A to the corresponding item ID
0x03F642|$0F:$F632:C9 39   	CMP #$39   	; Item ID #$39: Jailor’s Key
0x03F644|$0F:$F634:D0 02   	BNE $F638  
0x03F646|$0F:$F636:A9 00   	LDA #$00   
; control flow target (from $F62A, $F634)
0x03F648|$0F:$F638:4C C2 F6	JMP $F6C2  	; load bank specified by $94

; display Menu ID #$1C: Main menu: status screen equipped items
; external control flow target (from $06:$89E1)
0x03F64B|$0F:$F63B:85 4A   	STA $4A    
0x03F64D|$0F:$F63D:A9 1C   	LDA #$1C   	; Menu ID #$1C: Main menu: status screen equipped items
0x03F64F|$0F:$F63F:4C 89 EB	JMP $EB89  	; open menu specified by A

; display appropriate battle EXP + Gold menu
; external control flow target (from $04:$9940)
0x03F652|$0F:$F642:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F655|$0F:$F645:BD 4B F6	LDA $F64B,X	; Battle menu EXP + Gold
0x03F658|$0F:$F648:4C 89 EB	JMP $EB89  	; open menu specified by A


; code -> data
; Battle menu EXP + Gold
; indexed data load target (from $F645)
0x03F65B|$0F:$F64B:1D	; Menu ID #$1D: Battle menu: Midenhall EXP + Gold
0x03F65C|$0F:$F64C:2B	; Menu ID #$2B: Battle menu: Midenhall + Cannock EXP + Gold
0x03F65D|$0F:$F64D:2C	; Menu ID #$2C: Battle menu: Midenhall + Cannock + Moonbrooke EXP + Gold

; data -> code
; display spell lists
; external control flow target (from $06:$89FC)
0x03F65E|$0F:$F64E:85 4A   	STA $4A    
0x03F660|$0F:$F650:A9 30   	LDA #$30   	; Menu ID #$30: Main menu: out-of-battle spell list
0x03F662|$0F:$F652:20 89 EB	JSR $EB89  	; open menu specified by A
0x03F665|$0F:$F655:A9 31   	LDA #$31   	; Menu ID #$31: Main menu: battle spell list
0x03F667|$0F:$F657:4C 89 EB	JMP $EB89  	; open menu specified by A

; set A and X to the current number of party members
; control flow target (from $F529, $F537, $F545, $F55D, $F56B, $F579, $F587, $F595, $F642, $F685)
0x03F66A|$0F:$F65A:A2 00   	LDX #$00   	; you always have Midenhall
0x03F66C|$0F:$F65C:AD 3F 06	LDA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03F66F|$0F:$F65F:29 04   	AND #$04   	; pick out the In Party bit
0x03F671|$0F:$F661:F0 01   	BEQ $F664  	; if Cannock not in party, don't INX; no Cannock => no Moonbrooke, so BEQ $F66C would be faster
0x03F673|$0F:$F663:E8      	INX        
; control flow target (from $F661)
0x03F674|$0F:$F664:AD 51 06	LDA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03F677|$0F:$F667:29 04   	AND #$04   	; pick out the In Party bit
0x03F679|$0F:$F669:F0 01   	BEQ $F66C  	; if Moonbrooke not in party, don't INX
0x03F67B|$0F:$F66B:E8      	INX        
; control flow target (from $F669)
0x03F67C|$0F:$F66C:8A      	TXA        
0x03F67D|$0F:$F66D:60      	RTS        

; do special effects for certain menus; sets A to menu ID
; control flow target (from $EB89)
0x03F67E|$0F:$F66E:C9 19   	CMP #$19   	; Menu ID #$19: General menu: YES/NO
0x03F680|$0F:$F670:F0 1F   	BEQ $F691  	; YES/NO menu extra: play double beep SFX
0x03F682|$0F:$F672:C9 04   	CMP #$04   	; Menu ID #$04: Dialogue window
0x03F684|$0F:$F674:F0 2D   	BEQ $F6A3  	; initialize main dialogue window
0x03F686|$0F:$F676:C9 06   	CMP #$06   	; Menu ID #$06: Map menu: main COMMAND menu
0x03F688|$0F:$F678:F0 20   	BEQ $F69A  	; COMMAND menu extra: play single beep SFX
0x03F68A|$0F:$F67A:C9 02   	CMP #$02   	; Menu ID #$02: Main menu: gold/crests
0x03F68C|$0F:$F67C:B0 11   	BCS $F68F  	; anything else > 1 just does SEC and RTS
0x03F68E|$0F:$F67E:85 10   	STA $10    	; at this point A is either Menu ID #$00: Mini status window, bottom or Menu ID #$01: Mini status window, top and C is clear
0x03F690|$0F:$F680:0A      	ASL        
0x03F691|$0F:$F681:65 10   	ADC $10    
0x03F693|$0F:$F683:85 10   	STA $10    	; A = A * 3; 3 versions of each menu
0x03F695|$0F:$F685:20 5A F6	JSR $F65A  	; set A and X to the current number of party members
0x03F698|$0F:$F688:18      	CLC        
0x03F699|$0F:$F689:65 10   	ADC $10    	; add number of party members to menu type offset
0x03F69B|$0F:$F68B:AA      	TAX        
0x03F69C|$0F:$F68C:BD C8 F6	LDA $F6C8,X	; mini status menu IDs
; control flow target (from $F67C)
0x03F69F|$0F:$F68F:38      	SEC        
0x03F6A0|$0F:$F690:60      	RTS        

; YES/NO menu extra: play double beep SFX
; control flow target (from $F670)
0x03F6A1|$0F:$F691:A9 86   	LDA #$86   	; Music ID #$86: double beep SFX
0x03F6A3|$0F:$F693:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03F6A6|$0F:$F696:A9 19   	LDA #$19   
0x03F6A8|$0F:$F698:38      	SEC        
0x03F6A9|$0F:$F699:60      	RTS        

; COMMAND menu extra: play single beep SFX
; control flow target (from $F678)
0x03F6AA|$0F:$F69A:A9 85   	LDA #$85   	; Music ID #$85: single beep SFX
0x03F6AC|$0F:$F69C:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x03F6AF|$0F:$F69F:A9 06   	LDA #$06   
0x03F6B1|$0F:$F6A1:38      	SEC        
0x03F6B2|$0F:$F6A2:60      	RTS        

; initialize main dialogue window
; control flow target (from $F674)
0x03F6B3|$0F:$F6A3:A9 00   	LDA #$00   
0x03F6B5|$0F:$F6A5:8D D0 60	STA $60D0  
0x03F6B8|$0F:$F6A8:8D D1 60	STA $60D1  
0x03F6BB|$0F:$F6AB:A2 B0   	LDX #$B0   	; write #$B0 [space] to $06F8-$07A7, a.k.a. blank out the main dialogue window
0x03F6BD|$0F:$F6AD:A9 5F   	LDA #$5F   
; control flow target (from $F6B3)
0x03F6BF|$0F:$F6AF:9D F7 06	STA $06F7,X
0x03F6C2|$0F:$F6B2:CA      	DEX        
0x03F6C3|$0F:$F6B3:D0 FA   	BNE $F6AF  
0x03F6C5|$0F:$F6B5:A9 00   	LDA #$00   
0x03F6C7|$0F:$F6B7:85 7C   	STA $7C    
0x03F6C9|$0F:$F6B9:85 7D   	STA $7D    
0x03F6CB|$0F:$F6BB:8D C8 60	STA $60C8  	; speech sound effect / auto-indent flag
0x03F6CE|$0F:$F6BE:A9 04   	LDA #$04   
0x03F6D0|$0F:$F6C0:38      	SEC        
0x03F6D1|$0F:$F6C1:60      	RTS        

; load bank specified by $94
; control flow target (from $F4AD, $F4E9, $F5E5, $F5FB, $F615, $F638, $FA65, $FC85, $FF94)
0x03F6D2|$0F:$F6C2:48      	PHA        
0x03F6D3|$0F:$F6C3:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03F6D5|$0F:$F6C5:4C 82 F7	JMP $F782  	; load bank specified by A then PLA


; code -> data
; mini status menu IDs
; indexed data load target (from $F68C)
0x03F6D8|$0F:$F6C8:00	; Mini status window, bottom, Midenhall only
0x03F6D9|$0F:$F6C9:1E	; Mini status window, bottom, Midenhall + Cannock
0x03F6DA|$0F:$F6CA:1F	; Mini status window, bottom, Midenhall + Cannock + Moonbrooke
0x03F6DB|$0F:$F6CB:01	; Mini status window, top, Midenhall only
0x03F6DC|$0F:$F6CC:20	; Mini status window, top, Midenhall + Cannock
0x03F6DD|$0F:$F6CD:21	; Mini status window, top, Midenhall + Cannock + Moonbrooke

; data -> code
; return number of party members - 1 in A/X
; control flow target (from $CDB5)
; external control flow target (from $06:$8223, $06:$82F1, $06:$83EE, $06:$8485, $06:$857E, $06:$85C7, $06:$8620, $06:$8FD2, $06:$9023, $06:$93A3, $06:$99AF, $06:$9C80, $06:$A241)
0x03F6DE|$0F:$F6CE:A0 00   	LDY #$00   	; status index
0x03F6E0|$0F:$F6D0:A2 00   	LDX #$00   	; party member counter
0x03F6E2|$0F:$F6D2:A9 03   	LDA #$03   	; maximum number of party members
0x03F6E4|$0F:$F6D4:85 0C   	STA $0C    	; remaining party members to check
; control flow target (from $F6E5)
0x03F6E6|$0F:$F6D6:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x03F6E9|$0F:$F6D9:29 04   	AND #$04   	; pick out the "In Party" bit
0x03F6EB|$0F:$F6DB:F0 01   	BEQ $F6DE  	; if member is in party, increment party member counter
0x03F6ED|$0F:$F6DD:E8      	INX        
; control flow target (from $F6DB)
0x03F6EE|$0F:$F6DE:98      	TYA        	; update status index for next party member
0x03F6EF|$0F:$F6DF:18      	CLC        
0x03F6F0|$0F:$F6E0:69 12   	ADC #$12   	; hero data is #$12 bytes long
0x03F6F2|$0F:$F6E2:A8      	TAY        
0x03F6F3|$0F:$F6E3:C6 0C   	DEC $0C    	; remaining party members to check
0x03F6F5|$0F:$F6E5:D0 EF   	BNE $F6D6  	; if more members to check, check them
0x03F6F7|$0F:$F6E7:CA      	DEX        
0x03F6F8|$0F:$F6E8:8A      	TXA        
0x03F6F9|$0F:$F6E9:60      	RTS        

; open main dialogue window and display string ID specified by byte following JSR
; control flow target (from $C83E, $CAA5, $CB90, $CBFC, $CC72)
; external control flow target (from $06:$80EF, $06:$8B83, $07:$81F3, $07:$8223, $07:$8234, $07:$827B, $07:$82E7, $07:$8351, $07:$8362, $07:$8369, $07:$83FE, $07:$84C7, $07:$8582)
0x03F6FA|$0F:$F6EA:20 FC F6	JSR $F6FC  	; open main dialogue window, set A to string ID specified by byte following second JSR
0x03F6FD|$0F:$F6ED:4C 4A FA	JMP $FA4A  	; display string ID specified by A

; open main dialogue window and display string ID specified by byte following JSR + #$0100
; external control flow target (from $06:$80C3, $06:$822E, $06:$82C3, $06:$839F, $06:$8553, $06:$86C0, $06:$8A49)
0x03F700|$0F:$F6F0:20 FC F6	JSR $F6FC  	; open main dialogue window, set A to string ID specified by byte following second JSR
0x03F703|$0F:$F6F3:4C 4E FA	JMP $FA4E  	; display string ID specified by A + #$0100

; open main dialogue window and display string ID specified by byte following JSR + #$0200
; control flow target (from $C940, $C9AB, $C9F2, $CB2E, $CC4D)
; external control flow target (from $06:$80E1, $06:$81A6, $06:$82BC, $06:$9368, $06:$A2C6)
0x03F706|$0F:$F6F6:20 FC F6	JSR $F6FC  	; open main dialogue window, set A to string ID specified by byte following second JSR
0x03F709|$0F:$F6F9:4C 52 FA	JMP $FA52  	; display string ID specified by A + #$0200

; open main dialogue window, set A to string ID specified by byte following second JSR
; control flow target (from $F6EA, $F6F0, $F6F6)
0x03F70C|$0F:$F6FC:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x03F70F|$0F:$F6FF:04	; Menu ID #$04: Dialogue window

; data -> code
0x03F710|$0F:$F700:68      	PLA        	; first JSR's return address, low byte
0x03F711|$0F:$F701:85 0C   	STA $0C    	; first JSR's return address, low byte
0x03F713|$0F:$F703:68      	PLA        	; first JSR's return address, high byte
0x03F714|$0F:$F704:85 0D   	STA $0D    	; first JSR's return address, high byte
0x03F716|$0F:$F706:68      	PLA        	; second JSR's return address, low byte
0x03F717|$0F:$F707:18      	CLC        
0x03F718|$0F:$F708:69 01   	ADC #$01   	; byte following second JSR is data
0x03F71A|$0F:$F70A:85 0E   	STA $0E    	; second JSR's new return address, low byte
0x03F71C|$0F:$F70C:68      	PLA        	; second JSR's return address, high byte
0x03F71D|$0F:$F70D:69 00   	ADC #$00   	; add carry from incrementing low byte
0x03F71F|$0F:$F70F:85 0F   	STA $0F    
0x03F721|$0F:$F711:48      	PHA        	; second JSR's new return address, high byte
0x03F722|$0F:$F712:A5 0E   	LDA $0E    	; second JSR's new return address, low byte
0x03F724|$0F:$F714:48      	PHA        	; second JSR's new return address, low byte
0x03F725|$0F:$F715:A0 00   	LDY #$00   
0x03F727|$0F:$F717:B1 0E   	LDA ($0E),Y	; read byte following second JSR
0x03F729|$0F:$F719:A8      	TAY        	; stash in Y for now
0x03F72A|$0F:$F71A:A5 0D   	LDA $0D    	; first JSR's return address, high byte
0x03F72C|$0F:$F71C:48      	PHA        	; first JSR's return address, high byte
0x03F72D|$0F:$F71D:A5 0C   	LDA $0C    	; first JSR's return address, low byte
0x03F72F|$0F:$F71F:48      	PHA        	; first JSR's return address, low byte
0x03F730|$0F:$F720:98      	TYA        	; copy desired menu ID to A
0x03F731|$0F:$F721:60      	RTS        

; 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 $06:$97FE)
0x03F732|$0F:$F722:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$8003)
0x03F735|$0F:$F725:20 03 80	JSR $8003  	; 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
0x03F738|$0F:$F728:4C 61 F7	JMP $F761  	; load ROM bank #$06

; heal hero ID in A by random amount based on healing power in X
; identical to $0F:$D146
; external control flow target (from $06:$95F3)
0x03F73B|$0F:$F72B:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$8006)
0x03F73E|$0F:$F72E:20 06 80	JSR $8006  
0x03F741|$0F:$F731:4C 61 F7	JMP $F761  	; load ROM bank #$06

; set $8F-$90 to EXP required to reach next level
; external control flow target (from $06:$9473)
0x03F744|$0F:$F734:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$800C)
0x03F747|$0F:$F737:20 0C 80	JSR $800C  	; set $8F-$90 to EXP required to reach next level
0x03F74A|$0F:$F73A:4C 61 F7	JMP $F761  	; load ROM bank #$06

; calls $04:$99E6
; external control flow target (from $06:$9900, $06:$990C, $06:$995B, $06:$99A0)
0x03F74D|$0F:$F73D:20 66 F7	JSR $F766  	; load ROM bank #$04
; call to code in a different bank ($04:$8012)
0x03F750|$0F:$F740:20 12 80	JSR $8012  
0x03F753|$0F:$F743:4C 61 F7	JMP $F761  	; load ROM bank #$06

; external control flow target (from $04:$A176)
0x03F756|$0F:$F746:20 61 F7	JSR $F761  	; load ROM bank #$06
0x03F759|$0F:$F749:A0 06   	LDY #$06   
0x03F75B|$0F:$F74B:84 94   	STY $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
; call to code in a different bank ($06:$9829)
0x03F75D|$0F:$F74D:20 29 98	JSR $9829  
0x03F760|$0F:$F750:A0 04   	LDY #$04   
0x03F762|$0F:$F752:84 94   	STY $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03F764|$0F:$F754:4C 66 F7	JMP $F766  	; load ROM bank #$04


; code -> data
; table of first item IDs for each item type
; external indexed data load target (from $06:$8A68)
0x03F767|$0F:$F757:01	; Weapons
; external indexed data load target (from $06:$8A6D)
0x03F768|$0F:$F758:11	; Armour
0x03F769|$0F:$F759:1C	; Helmets
0x03F76A|$0F:$F75A:21	; Shields
0x03F76B|$0F:$F75B:24	; non-EQUIP items

; data -> code
; load ROM bank #$00
; control flow target (from $C6A8, $D21D, $D231, $D23E, $D250, $D29C, $D2A9, $D302, $D334, $D494, $E41D, $E43F)
0x03F76C|$0F:$F75C:48      	PHA        
0x03F76D|$0F:$F75D:A9 00   	LDA #$00   
0x03F76F|$0F:$F75F:F0 21   	BEQ $F782  	; load bank specified by A then PLA
; load ROM bank #$06
; control flow target (from $C6ED, $C70C, $C786, $C89B, $CCAC, $CD48, $CF67, $D0F2, $D14C, $D156, $D164, $D215, $D23B, $D259, $D2EC, $D2F4, $D32B, $D57E, $E435, $E8B2, $EEC9, $F255, $F289, $F728, $F731, $F73A, $F743, $F746)
0x03F771|$0F:$F761:48      	PHA        
0x03F772|$0F:$F762:A9 06   	LDA #$06   
0x03F774|$0F:$F764:D0 1C   	BNE $F782  	; load bank specified by A then PLA
; load ROM bank #$04
; control flow target (from $C771, $C8EC, $C95C, $D0EC, $D146, $D1A4, $D1C9, $D200, $D25C, $F722, $F72B, $F734, $F73D, $F754)
0x03F776|$0F:$F766:48      	PHA        
0x03F777|$0F:$F767:A9 04   	LDA #$04   
0x03F779|$0F:$F769:D0 17   	BNE $F782  	; load bank specified by A then PLA
; laod ROM bank #$01
0x03F77B|$0F:$F76B:48      	PHA        
0x03F77C|$0F:$F76C:A9 01   	LDA #$01   
0x03F77E|$0F:$F76E:D0 12   	BNE $F782  	; load bank specified by A then PLA
; load ROM bank #$02
; control flow target (from $CF61, $D369, $D5B6, $D7D4, $D7EE, $D890, $DECE, $DF86, $E169, $E3E8, $E445, $E461, $E4DF, $E94A, $F9AA, $FA8A, $FE3A)
0x03F780|$0F:$F770:48      	PHA        
0x03F781|$0F:$F771:A9 02   	LDA #$02   
0x03F783|$0F:$F773:D0 0D   	BNE $F782  	; load bank specified by A then PLA
; load ROM bank #$03
; control flow target (from $C680, $D17C, $D517, $D7A6, $D81C, $D8D0, $DB96, $DC9C, $DFC9, $E2F9)
0x03F785|$0F:$F775:48      	PHA        
0x03F786|$0F:$F776:A9 03   	LDA #$03   
0x03F788|$0F:$F778:D0 08   	BNE $F782  	; load bank specified by A then PLA
; load ROM bank #$07
; control flow target (from $D969)
0x03F78A|$0F:$F77A:48      	PHA        
0x03F78B|$0F:$F77B:A9 07   	LDA #$07   
0x03F78D|$0F:$F77D:D0 03   	BNE $F782  	; load bank specified by A then PLA
; load ROM bank #$05
0x03F78F|$0F:$F77F:48      	PHA        
0x03F790|$0F:$F780:A9 05   	LDA #$05   
; load bank specified by A then PLA
; control flow target (from $EB95, $F31E, $F6C5, $F75F, $F764, $F769, $F76E, $F773, $F778, $F77D)
0x03F792|$0F:$F782:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03F795|$0F:$F785:68      	PLA        
0x03F796|$0F:$F786:60      	RTS        

; control flow target (from $CF70)
0x03F797|$0F:$F787:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F79A|$0F:$F78A:41	; $02:$8002

; data -> code
0x03F79B|$0F:$F78B:60      	RTS        

; wipe selected menu region
; control flow target (from $CF6A, $D130, $D135, $D13A, $E5BB, $F5B6)
; external control flow target (from $04:$9ACC)
0x03F79C|$0F:$F78C:85 0C   	STA $0C    	; A values of #$00, #$01, #$02, and #$05 wipe all menus; #$03, #$04, #$06, and #$07 do not
0x03F79E|$0F:$F78E:C9 05   	CMP #$05   
0x03F7A0|$0F:$F790:F0 04   	BEQ $F796  
0x03F7A2|$0F:$F792:C9 03   	CMP #$03   
0x03F7A4|$0F:$F794:B0 02   	BCS $F798  
; control flow target (from $F790)
0x03F7A6|$0F:$F796:A9 00   	LDA #$00   
; control flow target (from $F794)
0x03F7A8|$0F:$F798:85 2E   	STA $2E    	; whether to wipe all menus (#$00) or not
0x03F7AA|$0F:$F79A:A5 0C   	LDA $0C    
0x03F7AC|$0F:$F79C:0A      	ASL        
0x03F7AD|$0F:$F79D:0A      	ASL        
0x03F7AE|$0F:$F79E:A8      	TAY        
0x03F7AF|$0F:$F79F:B9 DB F8	LDA $F8DB,Y
0x03F7B2|$0F:$F7A2:29 0F   	AND #$0F   
0x03F7B4|$0F:$F7A4:85 0C   	STA $0C    
0x03F7B6|$0F:$F7A6:38      	SEC        
0x03F7B7|$0F:$F7A7:E9 08   	SBC #$08   
0x03F7B9|$0F:$F7A9:0A      	ASL        
0x03F7BA|$0F:$F7AA:85 18   	STA $18    
0x03F7BC|$0F:$F7AC:B9 DC F8	LDA $F8DC,Y
0x03F7BF|$0F:$F7AF:85 0E   	STA $0E    
0x03F7C1|$0F:$F7B1:48      	PHA        
0x03F7C2|$0F:$F7B2:0A      	ASL        
0x03F7C3|$0F:$F7B3:0A      	ASL        
0x03F7C4|$0F:$F7B4:0A      	ASL        
0x03F7C5|$0F:$F7B5:0A      	ASL        
0x03F7C6|$0F:$F7B6:05 0C   	ORA $0C    
0x03F7C8|$0F:$F7B8:8D 7C 60	STA $607C  
0x03F7CB|$0F:$F7BB:68      	PLA        
0x03F7CC|$0F:$F7BC:38      	SEC        
0x03F7CD|$0F:$F7BD:E9 07   	SBC #$07   
0x03F7CF|$0F:$F7BF:0A      	ASL        
0x03F7D0|$0F:$F7C0:85 19   	STA $19    
0x03F7D2|$0F:$F7C2:B9 DD F8	LDA $F8DD,Y
0x03F7D5|$0F:$F7C5:85 53   	STA $53    
0x03F7D7|$0F:$F7C7:85 4E   	STA $4E    
0x03F7D9|$0F:$F7C9:B9 DE F8	LDA $F8DE,Y
0x03F7DC|$0F:$F7CC:85 54   	STA $54    
0x03F7DE|$0F:$F7CE:A5 53   	LDA $53    
0x03F7E0|$0F:$F7D0:0A      	ASL        
0x03F7E1|$0F:$F7D1:65 18   	ADC $18    
0x03F7E3|$0F:$F7D3:85 18   	STA $18    
0x03F7E5|$0F:$F7D5:85 4D   	STA $4D    
0x03F7E7|$0F:$F7D7:A5 4E   	LDA $4E    
0x03F7E9|$0F:$F7D9:29 0F   	AND #$0F   
0x03F7EB|$0F:$F7DB:18      	CLC        
0x03F7EC|$0F:$F7DC:69 01   	ADC #$01   
0x03F7EE|$0F:$F7DE:09 10   	ORA #$10   
0x03F7F0|$0F:$F7E0:8D 7B 60	STA $607B  
0x03F7F3|$0F:$F7E3:20 31 DE	JSR $DE31  
0x03F7F6|$0F:$F7E6:A5 07   	LDA $07    
0x03F7F8|$0F:$F7E8:85 4F   	STA $4F    
0x03F7FA|$0F:$F7EA:A5 08   	LDA $08    
0x03F7FC|$0F:$F7EC:85 50   	STA $50    
; control flow target (from $F85C)
0x03F7FE|$0F:$F7EE:A5 4E   	LDA $4E    
0x03F800|$0F:$F7F0:0A      	ASL        
0x03F801|$0F:$F7F1:8D 9E 60	STA $609E  	; menu current column
; control flow target (from $F838)
0x03F804|$0F:$F7F4:A4 53   	LDY $53    
0x03F806|$0F:$F7F6:A5 2E   	LDA $2E    	; whether to wipe all menus (#$00) or not
0x03F808|$0F:$F7F8:F0 2B   	BEQ $F825  	; display background tiles
0x03F80A|$0F:$F7FA:C9 03   	CMP #$03   
0x03F80C|$0F:$F7FC:F0 0A   	BEQ $F808  
0x03F80E|$0F:$F7FE:C9 07   	CMP #$07   
0x03F810|$0F:$F800:F0 06   	BEQ $F808  
0x03F812|$0F:$F802:A9 10   	LDA #$10   
0x03F814|$0F:$F804:85 1E   	STA $1E    
0x03F816|$0F:$F806:D0 0E   	BNE $F816  
; control flow target (from $F7FC, $F800)
0x03F818|$0F:$F808:A9 00   	LDA #$00   
0x03F81A|$0F:$F80A:85 1E   	STA $1E    
0x03F81C|$0F:$F80C:B1 4F   	LDA ($4F),Y	; screen map of background vs. menu tile
0x03F81E|$0F:$F80E:F0 15   	BEQ $F825  	; display background tiles
0x03F820|$0F:$F810:C9 FF   	CMP #$FF   
0x03F822|$0F:$F812:F0 11   	BEQ $F825  	; display background tiles
0x03F824|$0F:$F814:A9 00   	LDA #$00   
; control flow target (from $F806)
0x03F826|$0F:$F816:20 70 F8	JSR $F870  
0x03F829|$0F:$F819:90 0A   	BCC $F825  	; display background tiles
0x03F82B|$0F:$F81B:A9 00   	LDA #$00   
0x03F82D|$0F:$F81D:85 1C   	STA $1C    
0x03F82F|$0F:$F81F:20 AA F9	JSR $F9AA  	; display menu tiles
0x03F832|$0F:$F822:4C 32 F8	JMP $F832  

; control flow target (from $F7F8, $F80E, $F812, $F819)
0x03F835|$0F:$F825:A9 00   	LDA #$00   
0x03F837|$0F:$F827:A4 53   	LDY $53    
0x03F839|$0F:$F829:91 4F   	STA ($4F),Y	; update screen map to show background tiles
0x03F83B|$0F:$F82B:85 1C   	STA $1C    
0x03F83D|$0F:$F82D:85 1E   	STA $1E    
0x03F83F|$0F:$F82F:20 47 F9	JSR $F947  
; menu and background code paths rejoin here
; control flow target (from $F822)
0x03F842|$0F:$F832:C6 18   	DEC $18    
0x03F844|$0F:$F834:C6 18   	DEC $18    
0x03F846|$0F:$F836:C6 53   	DEC $53    
0x03F848|$0F:$F838:10 BA   	BPL $F7F4  
0x03F84A|$0F:$F83A:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03F84D|$0F:$F83D:C0	; $06:$8000

; data -> code
0x03F84E|$0F:$F83E:AD 7C 60	LDA $607C  
0x03F851|$0F:$F841:38      	SEC        
0x03F852|$0F:$F842:E9 10   	SBC #$10   
0x03F854|$0F:$F844:8D 7C 60	STA $607C  
0x03F857|$0F:$F847:A5 4F   	LDA $4F    
0x03F859|$0F:$F849:38      	SEC        
0x03F85A|$0F:$F84A:E9 10   	SBC #$10   
0x03F85C|$0F:$F84C:85 4F   	STA $4F    
0x03F85E|$0F:$F84E:A5 4D   	LDA $4D    
0x03F860|$0F:$F850:85 18   	STA $18    
0x03F862|$0F:$F852:A5 4E   	LDA $4E    
0x03F864|$0F:$F854:85 53   	STA $53    
0x03F866|$0F:$F856:C6 19   	DEC $19    
0x03F868|$0F:$F858:C6 19   	DEC $19    
0x03F86A|$0F:$F85A:C6 54   	DEC $54    
0x03F86C|$0F:$F85C:10 90   	BPL $F7EE  
0x03F86E|$0F:$F85E:A5 35   	LDA $35    	; flag indicating whether any menu is currently open
0x03F870|$0F:$F860:F0 09   	BEQ $F86B  
0x03F872|$0F:$F862:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03F875|$0F:$F865:20 CB D8	JSR $D8CB  
0x03F878|$0F:$F868:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $F860)
0x03F87B|$0F:$F86B:A5 94   	LDA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03F87D|$0F:$F86D:4C D5 C3	JMP $C3D5  	; save A to $05F6, X to $43, and load bank specified by A

; control flow target (from $F816)
0x03F880|$0F:$F870:A8      	TAY        
0x03F881|$0F:$F871:D0 17   	BNE $F88A  
0x03F883|$0F:$F873:A5 54   	LDA $54    
0x03F885|$0F:$F875:AE 9E 60	LDX $609E  	; menu current column
0x03F888|$0F:$F878:C9 04   	CMP #$04   
0x03F88A|$0F:$F87A:B0 1F   	BCS $F89B  
0x03F88C|$0F:$F87C:E0 08   	CPX #$08   
0x03F88E|$0F:$F87E:B0 1B   	BCS $F89B  
0x03F890|$0F:$F880:0A      	ASL        
0x03F891|$0F:$F881:0A      	ASL        
0x03F892|$0F:$F882:0A      	ASL        
0x03F893|$0F:$F883:0A      	ASL        
0x03F894|$0F:$F884:85 10   	STA $10    
0x03F896|$0F:$F886:8A      	TXA        
0x03F897|$0F:$F887:0A      	ASL        
0x03F898|$0F:$F888:65 10   	ADC $10    
; control flow target (from $F871)
0x03F89A|$0F:$F88A:18      	CLC        
0x03F89B|$0F:$F88B:6D FD F8	ADC $F8FD  
0x03F89E|$0F:$F88E:85 10   	STA $10    
0x03F8A0|$0F:$F890:A9 00   	LDA #$00   
0x03F8A2|$0F:$F892:6D FE F8	ADC $F8FE  
0x03F8A5|$0F:$F895:85 11   	STA $11    
0x03F8A7|$0F:$F897:85 1E   	STA $1E    
0x03F8A9|$0F:$F899:D0 3C   	BNE $F8D7  
; control flow target (from $F87A, $F87E)
0x03F8AB|$0F:$F89B:C9 08   	CMP #$08   
0x03F8AD|$0F:$F89D:D0 3A   	BNE $F8D9  
0x03F8AF|$0F:$F89F:AD 92 04	LDA $0492  
0x03F8B2|$0F:$F8A2:F0 35   	BEQ $F8D9  
0x03F8B4|$0F:$F8A4:AD FB F8	LDA $F8FB  
0x03F8B7|$0F:$F8A7:85 10   	STA $10    
0x03F8B9|$0F:$F8A9:AD FC F8	LDA $F8FC  
0x03F8BC|$0F:$F8AC:85 11   	STA $11    
0x03F8BE|$0F:$F8AE:A9 77   	LDA #$77   
0x03F8C0|$0F:$F8B0:8D B5 60	STA $60B5  
0x03F8C3|$0F:$F8B3:8D B6 60	STA $60B6  
0x03F8C6|$0F:$F8B6:85 1E   	STA $1E    
0x03F8C8|$0F:$F8B8:8A      	TXA        
0x03F8C9|$0F:$F8B9:18      	CLC        
0x03F8CA|$0F:$F8BA:69 07   	ADC #$07   
0x03F8CC|$0F:$F8BC:AA      	TAX        
0x03F8CD|$0F:$F8BD:BD F8 06	LDA $06F8,X	; start of main dialogue window
0x03F8D0|$0F:$F8C0:8D B7 60	STA $60B7  
0x03F8D3|$0F:$F8C3:BD F9 06	LDA $06F9,X
0x03F8D6|$0F:$F8C6:8D B8 60	STA $60B8  
0x03F8D9|$0F:$F8C9:E0 15   	CPX #$15   
0x03F8DB|$0F:$F8CB:D0 0A   	BNE $F8D7  
0x03F8DD|$0F:$F8CD:A9 7C   	LDA #$7C   
0x03F8DF|$0F:$F8CF:8D B6 60	STA $60B6  
0x03F8E2|$0F:$F8D2:A9 7B   	LDA #$7B   
0x03F8E4|$0F:$F8D4:8D B8 60	STA $60B8  
; control flow target (from $F899, $F8CB)
0x03F8E7|$0F:$F8D7:38      	SEC        
0x03F8E8|$0F:$F8D8:60      	RTS        

; control flow target (from $F89D, $F8A2)
0x03F8E9|$0F:$F8D9:18      	CLC        
0x03F8EA|$0F:$F8DA:60      	RTS        


; code -> data
; byte 1 sets $0C and ((byte 1) - #$08) << 1 sets $18
; byte 2 sets $0E, ((byte 2) << 4) | (byte 1) sets $607C, ((byte 2) - #$07) << 1 sets $19
; byte 3 sets $53 and $4E
; byte 4 sets $54 and stuff: $18, $4D, $607B
; maybe (X start, Y start, width, height)?
; indexed data load target (from $F79F)
0x03F8EB|$0F:$F8DB:02
; indexed data load target (from $F7AC)
0x03F8EC|$0F:$F8DC:   0D
; indexed data load target (from $F7C2)
0x03F8ED|$0F:$F8DD:      0C
; indexed data load target (from $F7C9)
0x03F8EE|$0F:$F8DE:         03	; anything in the dialogue window area, including the mini-status menu and bottom of the full status menu
0x03F8EF|$0F:$F8DF:02 09 0C 08	; anything in the top area, including main COMMAND/STATUS/SPELL menu
0x03F8F3|$0F:$F8E3:0A 06 03 03	; YES/NO menu
0x03F8F7|$0F:$F8E7:06 09 07 08	; item list in SELL menu
0x03F8FB|$0F:$F8EB:02 0D 0B 04	; bottom battle menu region
0x03F8FF|$0F:$F8EF:02 0D 0B 04	; ???
0x03F903|$0F:$F8F3:02 0D 03 04	; ???
0x03F907|$0F:$F8F7:06 0A 07 09	; EQUIP sub-menu
; data load target (from $F8A4)
0x03F90B|$0F:$F8FB:B5
; data load target (from $F8A9)
0x03F90C|$0F:$F8FC:60
; data load target (from $F88B)
0x03F90D|$0F:$F8FD:FF
; data load target (from $F892)
0x03F90E|$0F:$F8FE:F8
; tiles for redrawing the part of the main COMMAND menu obscured by the EQUIP sub-menu when the EQUIP sub-menu is closed; (only?) read outside of battle
; indirect data load target
0x03F90F|$0F:$F8FF:24 31 5F 5F
0x03F913|$0F:$F903:27 77 5F 5F
0x03F917|$0F:$F907:77 77 5F 5F
0x03F91B|$0F:$F90B:77 7C 5F 7B
0x03F91F|$0F:$F90F:5F 5F 5F 5F
0x03F923|$0F:$F913:36 33 5F 5F
0x03F927|$0F:$F917:28 2F 5F 5F
0x03F92B|$0F:$F91B:2F 7B 5F 7B
0x03F92F|$0F:$F91F:5F 5F 5F 5F
0x03F933|$0F:$F923:2C 37 5F 5F
0x03F937|$0F:$F927:28 30 5F 5F
0x03F93B|$0F:$F92B:5F 7B 5F 7B
0x03F93F|$0F:$F92F:5F 5F 7D 7D
0x03F943|$0F:$F933:28 34 7D 7D
0x03F947|$0F:$F937:38 2C 7D 7D
0x03F94B|$0F:$F93B:33 7B 7D 7E
; indexed data load target (from $FA00, $FA06)
0x03F94F|$0F:$F93F:CB 83	; $02:$83CB
0x03F951|$0F:$F941:6B 84	; $02:$846B
0x03F953|$0F:$F943:33 85	; $02:$8533
0x03F955|$0F:$F945:FB 85	; $02:$85FB

; data -> code
; control flow target (from $F82F)
0x03F957|$0F:$F947:A5 18   	LDA $18    
0x03F959|$0F:$F949:0A      	ASL        
0x03F95A|$0F:$F94A:A5 18   	LDA $18    
0x03F95C|$0F:$F94C:6A      	ROR        
0x03F95D|$0F:$F94D:18      	CLC        
0x03F95E|$0F:$F94E:65 16   	ADC $16    	; current map X-pos (1)
0x03F960|$0F:$F950:85 0C   	STA $0C    
0x03F962|$0F:$F952:A5 19   	LDA $19    
0x03F964|$0F:$F954:0A      	ASL        
0x03F965|$0F:$F955:A5 19   	LDA $19    
0x03F967|$0F:$F957:6A      	ROR        
0x03F968|$0F:$F958:18      	CLC        
0x03F969|$0F:$F959:65 17   	ADC $17    	; current map Y-pos (1)
0x03F96B|$0F:$F95B:85 0E   	STA $0E    
0x03F96D|$0F:$F95D:20 89 DF	JSR $DF89  
0x03F970|$0F:$F960:20 22 E2	JSR $E222  
0x03F973|$0F:$F963:A5 1D   	LDA $1D    
0x03F975|$0F:$F965:C5 0D   	CMP $0D    
0x03F977|$0F:$F967:F0 22   	BEQ $F98B  
0x03F979|$0F:$F969:A5 0C   	LDA $0C    
0x03F97B|$0F:$F96B:C9 28   	CMP #$28   
0x03F97D|$0F:$F96D:B0 1C   	BCS $F98B  
0x03F97F|$0F:$F96F:A5 1D   	LDA $1D    
0x03F981|$0F:$F971:D0 14   	BNE $F987  
0x03F983|$0F:$F973:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03F985|$0F:$F975:C9 01   	CMP #$01   
0x03F987|$0F:$F977:F0 0A   	BEQ $F983  
0x03F989|$0F:$F979:A5 0C   	LDA $0C    
0x03F98B|$0F:$F97B:C9 08   	CMP #$08   
0x03F98D|$0F:$F97D:90 04   	BCC $F983  
0x03F98F|$0F:$F97F:C9 0C   	CMP #$0C   
0x03F991|$0F:$F981:90 08   	BCC $F98B  
; control flow target (from $F977, $F97D)
0x03F993|$0F:$F983:A9 20   	LDA #$20   
0x03F995|$0F:$F985:D0 02   	BNE $F989  
; control flow target (from $F971)
0x03F997|$0F:$F987:A9 24   	LDA #$24   
; control flow target (from $F985)
0x03F999|$0F:$F989:85 0C   	STA $0C    
; control flow target (from $F967, $F96D, $F981)
0x03F99B|$0F:$F98B:A5 1C   	LDA $1C    
0x03F99D|$0F:$F98D:C9 FF   	CMP #$FF   
0x03F99F|$0F:$F98F:D0 07   	BNE $F998  
0x03F9A1|$0F:$F991:A5 0C   	LDA $0C    
0x03F9A3|$0F:$F993:C9 20   	CMP #$20   
0x03F9A5|$0F:$F995:90 0C   	BCC $F9A3  
0x03F9A7|$0F:$F997:60      	RTS        

; control flow target (from $F98F)
0x03F9A8|$0F:$F998:C9 FE   	CMP #$FE   
0x03F9AA|$0F:$F99A:D0 0B   	BNE $F9A7  
0x03F9AC|$0F:$F99C:A5 0C   	LDA $0C    
0x03F9AE|$0F:$F99E:C9 20   	CMP #$20   
0x03F9B0|$0F:$F9A0:B0 01   	BCS $F9A3  
0x03F9B2|$0F:$F9A2:60      	RTS        

; control flow target (from $F995, $F9A0)
0x03F9B3|$0F:$F9A3:A9 00   	LDA #$00   
0x03F9B5|$0F:$F9A5:85 1C   	STA $1C    
; control flow target (from $F99A)
0x03F9B7|$0F:$F9A7:20 F6 F9	JSR $F9F6  
; control flow target (from $F81F)
0x03F9BA|$0F:$F9AA:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03F9BD|$0F:$F9AD:A0 00   	LDY #$00   
0x03F9BF|$0F:$F9AF:8C 9F 60	STY $609F  	; menu current row
0x03F9C2|$0F:$F9B2:B1 10   	LDA ($10),Y
0x03F9C4|$0F:$F9B4:20 0E FA	JSR $FA0E  
0x03F9C7|$0F:$F9B7:C8      	INY        
0x03F9C8|$0F:$F9B8:B1 10   	LDA ($10),Y
0x03F9CA|$0F:$F9BA:20 0E FA	JSR $FA0E  
0x03F9CD|$0F:$F9BD:C8      	INY        
0x03F9CE|$0F:$F9BE:CE 9E 60	DEC $609E  	; menu current column
0x03F9D1|$0F:$F9C1:CE 9E 60	DEC $609E  	; menu current column
0x03F9D4|$0F:$F9C4:A9 01   	LDA #$01   
0x03F9D6|$0F:$F9C6:8D 9F 60	STA $609F  	; menu current row
0x03F9D9|$0F:$F9C9:B1 10   	LDA ($10),Y
0x03F9DB|$0F:$F9CB:20 0E FA	JSR $FA0E  
0x03F9DE|$0F:$F9CE:C8      	INY        
0x03F9DF|$0F:$F9CF:B1 10   	LDA ($10),Y
0x03F9E1|$0F:$F9D1:20 0E FA	JSR $FA0E  
0x03F9E4|$0F:$F9D4:C8      	INY        
0x03F9E5|$0F:$F9D5:A9 00   	LDA #$00   
0x03F9E7|$0F:$F9D7:A6 1E   	LDX $1E    
0x03F9E9|$0F:$F9D9:D0 04   	BNE $F9DF  
0x03F9EB|$0F:$F9DB:B1 10   	LDA ($10),Y
0x03F9ED|$0F:$F9DD:29 03   	AND #$03   
; control flow target (from $F9D9)
0x03F9EF|$0F:$F9DF:48      	PHA        
0x03F9F0|$0F:$F9E0:AD 9E 60	LDA $609E  	; menu current column
0x03F9F3|$0F:$F9E3:38      	SEC        
0x03F9F4|$0F:$F9E4:E9 02   	SBC #$02   
0x03F9F6|$0F:$F9E6:4A      	LSR        
0x03F9F7|$0F:$F9E7:AA      	TAX        
0x03F9F8|$0F:$F9E8:68      	PLA        
0x03F9F9|$0F:$F9E9:9D 6B 60	STA $606B,X
0x03F9FC|$0F:$F9EC:AD 9E 60	LDA $609E  	; menu current column
0x03F9FF|$0F:$F9EF:38      	SEC        
0x03FA00|$0F:$F9F0:E9 04   	SBC #$04   
0x03FA02|$0F:$F9F2:8D 9E 60	STA $609E  	; menu current column
0x03FA05|$0F:$F9F5:60      	RTS        

; control flow target (from $F9A7)
0x03FA06|$0F:$F9F6:A5 1F   	LDA $1F    	; some kind of map type (#$00: World Map, #$01: other non-dungeon maps, #$02: maps #$2B - #$43 inclusive, #$03: maps >= #$44, #$FF => game menu)
0x03FA08|$0F:$F9F8:0A      	ASL        
0x03FA09|$0F:$F9F9:A8      	TAY        
0x03FA0A|$0F:$F9FA:A5 0C   	LDA $0C    
0x03FA0C|$0F:$F9FC:0A      	ASL        
0x03FA0D|$0F:$F9FD:0A      	ASL        
0x03FA0E|$0F:$F9FE:65 0C   	ADC $0C    
0x03FA10|$0F:$FA00:79 3F F9	ADC $F93F,Y
0x03FA13|$0F:$FA03:85 10   	STA $10    
0x03FA15|$0F:$FA05:C8      	INY        
0x03FA16|$0F:$FA06:B9 3F F9	LDA $F93F,Y
0x03FA19|$0F:$FA09:69 00   	ADC #$00   
0x03FA1B|$0F:$FA0B:85 11   	STA $11    
0x03FA1D|$0F:$FA0D:60      	RTS        

; control flow target (from $F9B4, $F9BA, $F9CB, $F9D1)
0x03FA1E|$0F:$FA0E:48      	PHA        
0x03FA1F|$0F:$FA0F:A2 00   	LDX #$00   
0x03FA21|$0F:$FA11:AD 9F 60	LDA $609F  	; menu current row
0x03FA24|$0F:$FA14:F0 06   	BEQ $FA1C  
0x03FA26|$0F:$FA16:A5 4E   	LDA $4E    
0x03FA28|$0F:$FA18:0A      	ASL        
0x03FA29|$0F:$FA19:69 02   	ADC #$02   
0x03FA2B|$0F:$FA1B:AA      	TAX        
; control flow target (from $FA14)
0x03FA2C|$0F:$FA1C:8A      	TXA        
0x03FA2D|$0F:$FA1D:18      	CLC        
0x03FA2E|$0F:$FA1E:6D 9E 60	ADC $609E  	; menu current column
0x03FA31|$0F:$FA21:AA      	TAX        
0x03FA32|$0F:$FA22:68      	PLA        
0x03FA33|$0F:$FA23:9D 0B 60	STA $600B,X
0x03FA36|$0F:$FA26:EE 9E 60	INC $609E  	; menu current column
0x03FA39|$0F:$FA29:60      	RTS        

; display string ID specified by next byte
; control flow target (from $C856, $CC0A, $D160)
; external control flow target (from $06:$80D6, $06:$8BBD, $06:$8BF8, $06:$8C18, $06:$8CCD, $06:$947F, $06:$94ED, $06:$94FB, $06:$950E, $06:$9515, $06:$9534, $06:$9538, $06:$9BEB, $06:$9C5B, $06:$A228, $07:$8377, $07:$8591)
0x03FA3A|$0F:$FA2A:A2 00   	LDX #$00   
0x03FA3C|$0F:$FA2C:F0 06   	BEQ $FA34  
; display string ID specified by next byte + #$0100
; external control flow target (from $02:$B2D2, $06:$8102, $06:$810B, $06:$8246, $06:$828D, $06:$8291, $06:$8298, $06:$829C, $06:$82CE, $06:$82D5, $06:$82EA, $06:$82FF, $06:$830A, $06:$8327, $06:$8341, $06:$8348, $06:$8358, $06:$835C, $06:$837C, $06:$83B2, $06:$83B9, $06:$83C4, $06:$83E7, $06:$83FF, $06:$840D, $06:$8423, $06:$843B, $06:$843F, $06:$844A, $06:$8451, $06:$8465, $06:$847E, $06:$848C, $06:$84B0, $06:$84B7, $06:$84FE, $06:$8502, $06:$8514, $06:$851F, $06:$8532, $06:$8547, $06:$8557, $06:$8563, $06:$856A, $06:$8585, $06:$859C, $06:$85AB, $06:$85CE, $06:$85F3, $06:$8602, $06:$8627, $06:$8641, $06:$8650, $06:$8672, $06:$8679, $06:$8694, $06:$869D, $06:$86CB, $06:$86DE, $06:$86EA, $06:$86F5, $06:$86FC, $06:$8707, $06:$871F, $06:$8738, $06:$8AB6, $06:$8ADC, $06:$8AF8, $06:$8B4E, $06:$8B62, $06:$8C3C, $06:$8C8D, $06:$91DC, $06:$9529, $06:$9577, $06:$95A0, $06:$95C9, $06:$963D, $06:$9647, $06:$965A, $06:$9668, $06:$9673, $06:$9685, $06:$96C9, $06:$96D7, $06:$96F2, $06:$96FE, $06:$973C, $06:$9750, $06:$979A, $06:$97ED, $06:$97F8, $06:$9805, $06:$9813, $06:$981E, $06:$988E, $06:$98CB, $06:$9903, $06:$9908, $06:$990F, $06:$992F, $06:$993B, $06:$995E, $06:$9963, $06:$999C, $06:$99A3, $06:$99BA, $06:$99E8, $06:$99F5, $06:$99F9, $06:$9A10, $06:$9A29, $06:$9A5B, $06:$9A62, $06:$9A72, $06:$9A7D, $06:$9AA2, $06:$9AAF, $06:$9ABD, $06:$9AC4, $06:$9AF4, $06:$9B7D, $06:$9B8A, $06:$9B92, $06:$9BAF, $06:$9BB3, $06:$9BBA, $06:$9BFE, $06:$9C30, $06:$9C62, $06:$9CAA, $06:$9CBA, $06:$9CC5, $06:$9CD2, $06:$9CF9, $06:$9D0E, $06:$9D30, $06:$9D3F, $06:$A24B, $06:$BB57, $06:$BB5B, $06:$BB67, $06:$BB73, $06:$BB7C, $06:$BBAF, $06:$BBD3, $06:$BC26)
0x03FA3E|$0F:$FA2E:A2 20   	LDX #$20   
0x03FA40|$0F:$FA30:D0 02   	BNE $FA34  
; display string ID specified by next byte + #$0200
; control flow target (from $CA35)
; external control flow target (from $02:$B2EB, $06:$8163, $06:$83D5, $06:$841A, $06:$8E39, $06:$8E3D, $06:$8ED5, $06:$8EF6, $06:$8EFA, $06:$8F05, $06:$8F11, $06:$8F1C, $06:$8F29, $06:$8F32, $06:$8F47, $06:$8F58, $06:$8F63, $06:$8F94, $06:$8FB1, $06:$8FD7, $06:$8FEF, $06:$8FFE, $06:$9002, $06:$9012, $06:$9028, $06:$9055, $06:$905E, $06:$9065, $06:$907C, $06:$908E, $06:$909A, $06:$90A1, $06:$90BF, $06:$9102, $06:$910B, $06:$9117, $06:$916E, $06:$917E, $06:$9185, $06:$9190, $06:$91A8, $06:$91B3, $06:$91D0, $06:$91E6, $06:$91ED, $06:$91FA, $06:$9201, $06:$920C, $06:$9213, $06:$928B, $06:$9292, $06:$92E7, $06:$930B, $06:$933E, $06:$9348, $06:$9384, $06:$93EB, $06:$93F2, $06:$93F9, $06:$9407, $06:$9437, $06:$9446, $06:$9458, $06:$945F, $06:$9486, $06:$9817, $06:$A2E5, $06:$BD37, $06:$BD56)
0x03FA42|$0F:$FA32:A2 40   	LDX #$40   
; control flow target (from $FA2C, $FA30)
0x03FA44|$0F:$FA34:68      	PLA        	; low byte of return address
0x03FA45|$0F:$FA35:18      	CLC        
0x03FA46|$0F:$FA36:69 01   	ADC #$01   	; increment it (byte following the JSR is data)
0x03FA48|$0F:$FA38:85 0E   	STA $0E    	; store to $0E
0x03FA4A|$0F:$FA3A:68      	PLA        	; high byte of return address
0x03FA4B|$0F:$FA3B:69 00   	ADC #$00   	; add carry from incrementing low byte
0x03FA4D|$0F:$FA3D:85 0F   	STA $0F    	; store to $0F
0x03FA4F|$0F:$FA3F:48      	PHA        	; push the new return address's high byte
0x03FA50|$0F:$FA40:A5 0E   	LDA $0E    
0x03FA52|$0F:$FA42:48      	PHA        	; push the new return address's low byte
0x03FA53|$0F:$FA43:A0 00   	LDY #$00   
0x03FA55|$0F:$FA45:B1 0E   	LDA ($0E),Y	; load the byte following the original JSR
0x03FA57|$0F:$FA47:4C 54 FA	JMP $FA54  

; display string ID specified by A
; control flow target (from $D196, $F6ED)
; external control flow target (from $04:$97F4, $04:$98C3, $04:$9CC7, $06:$94B8, $06:$94CB, $06:$94DE, $06:$A99F)
0x03FA5A|$0F:$FA4A:A2 00   	LDX #$00   
0x03FA5C|$0F:$FA4C:F0 06   	BEQ $FA54  
; display string ID specified by A + #$0100
; control flow target (from $F6F3)
; external control flow target (from $02:$B334, $04:$9CC4, $06:$95D8, $06:$97E3, $06:$98AC, $06:$98C7, $06:$992B, $06:$9A41, $06:$9B2D, $06:$9D49, $06:$A0CF)
0x03FA5E|$0F:$FA4E:A2 20   	LDX #$20   
0x03FA60|$0F:$FA50:D0 02   	BNE $FA54  
; display string ID specified by A + #$0200
; control flow target (from $F6F9)
; external control flow target (from $06:$8E30, $06:$8E51, $06:$8E64, $06:$8F7F, $06:$8FA6, $06:$8FC6, $06:$9039, $06:$90B9, $06:$90E9, $06:$90FC, $06:$9147, $06:$9168, $06:$9248, $06:$92F8, $06:$9326, $06:$9338, $06:$9359, $06:$9395, $06:$93B8, $06:$93DB)
0x03FA62|$0F:$FA52:A2 40   	LDX #$40   
; control flow target (from $FA47, $FA4C, $FA50)
0x03FA64|$0F:$FA54:20 68 FA	JSR $FA68  	; figure out which bank the string is in, scan to start of string
0x03FA67|$0F:$FA57:20 A7 FA	JSR $FAA7  	; initialize text engine variables
; control flow target (from $FA63)
0x03FA6A|$0F:$FA5A:20 24 FB	JSR $FB24  
0x03FA6D|$0F:$FA5D:20 63 FB	JSR $FB63  
0x03FA70|$0F:$FA60:20 C8 FA	JSR $FAC8  	; CLC if we've read an end token, otherwise (probably?) print word to screen and SEC
0x03FA73|$0F:$FA63:90 F5   	BCC $FA5A  
0x03FA75|$0F:$FA65:4C C2 F6	JMP $F6C2  	; load bank specified by $94

; figure out which bank the string is in, scan to start of string
; control flow target (from $FA54)
0x03FA78|$0F:$FA68:20 6E FA	JSR $FA6E  	; text engine: determine which ROM bank to load based on string index
0x03FA7B|$0F:$FA6B:4C 8A FA	JMP $FA8A  	; given a string ID in X (high, << 5) + A (low), scan to start of string

; text engine: determine which ROM bank to load based on string index
; IN:
; A = low byte of string index
; X = high byte of string index << 5 (for easy adding later)
; Y and C irrelevant
;  
; OUT: no change to A or X
; Y = index of ROM bank to swap in to read the string from
; C not used, but does indicate whether we ended up choosing bank 5 (clear) or 2 (set)
; control flow target (from $FA68)
0x03FA7E|$0F:$FA6E:A0 05   	LDY #$05   	; default to bank 5
0x03FA80|$0F:$FA70:48      	PHA        	; save the original string index in A
0x03FA81|$0F:$FA71:29 F0   	AND #$F0   	; useless op
0x03FA83|$0F:$FA73:4A      	LSR        
0x03FA84|$0F:$FA74:4A      	LSR        
0x03FA85|$0F:$FA75:4A      	LSR        
0x03FA86|$0F:$FA76:4A      	LSR        
0x03FA87|$0F:$FA77:85 10   	STA $10    	; 16 strings per pointer, so low byte of string index >> 4 = low nybble of pointer index
0x03FA89|$0F:$FA79:8A      	TXA        
0x03FA8A|$0F:$FA7A:29 E0   	AND #$E0   
0x03FA8C|$0F:$FA7C:4A      	LSR        	; A = high nybble of pointer index
0x03FA8D|$0F:$FA7D:05 10   	ORA $10    	; glue the high and low nybbles of the pointer index together into a single byte
0x03FA8F|$0F:$FA7F:C9 2E   	CMP #$2E   
0x03FA91|$0F:$FA81:90 02   	BCC $FA85  	; if the pointer index < #$2E, keep the bank 5 default
0x03FA93|$0F:$FA83:A0 02   	LDY #$02   	; if the pointer index >= #$2E, load bank 2 instead
; control flow target (from $FA81)
0x03FA95|$0F:$FA85:8C C6 60	STY $60C6  	; ROM bank containing the desired text string
0x03FA98|$0F:$FA88:68      	PLA        	; restore the original string index in A
; control flow target (from $D12B)
; external control flow target (from $06:$9542, $06:$9550)
0x03FA99|$0F:$FA89:60      	RTS        

; given a string ID in X (high, << 5) + A (low), scan to start of string
; control flow target (from $FA6B)
0x03FA9A|$0F:$FA8A:20 70 F7	JSR $F770  	; load ROM bank #$02
0x03FA9D|$0F:$FA8D:86 11   	STX $11    	; save high byte of string index to $11
0x03FA9F|$0F:$FA8F:85 10   	STA $10    	; save low byte of string index to $10
0x03FAA1|$0F:$FA91:4A      	LSR        	; 16 strings per 2-byte pointer = >> 4 + << 1 a.k.a. >> 3 + & #$1E
0x03FAA2|$0F:$FA92:4A      	LSR        
0x03FAA3|$0F:$FA93:4A      	LSR        
0x03FAA4|$0F:$FA94:29 1E   	AND #$1E   
0x03FAA6|$0F:$FA96:18      	CLC        
0x03FAA7|$0F:$FA97:65 11   	ADC $11    	; add high byte of string index to get pointer index
0x03FAA9|$0F:$FA99:A8      	TAY        
0x03FAAA|$0F:$FA9A:B9 52 B7	LDA $B752,Y	; -> $05:$8000: main script strings, part 1
0x03FAAD|$0F:$FA9D:85 55   	STA $55    	; pointer to start of sub pointer data, low byte
0x03FAAF|$0F:$FA9F:B9 53 B7	LDA $B753,Y
0x03FAB2|$0F:$FAA2:85 56   	STA $56    	; pointer to start of sub pointer data, high byte
0x03FAB4|$0F:$FAA4:4C B3 FD	JMP $FDB3  	; scan through group of strings until we find the start of the desired string

; initialize text engine variables
; control flow target (from $FA57)
0x03FAB7|$0F:$FAA7:A9 00   	LDA #$00   
0x03FAB9|$0F:$FAA9:8D C8 60	STA $60C8  	; speech sound effect / auto-indent flag
0x03FABC|$0F:$FAAC:8D CA 60	STA $60CA  	; unused text engine variable
0x03FABF|$0F:$FAAF:8D CC 60	STA $60CC  	; text engine end token flag
0x03FAC2|$0F:$FAB2:8D C9 60	STA $60C9  	; count (only used as flag) of interpolated variable bytes read from $60F1
0x03FAC5|$0F:$FAB5:8D D2 60	STA $60D2  	; read index within current dictionary entry
0x03FAC8|$0F:$FAB8:A9 08   	LDA #$08   
0x03FACA|$0F:$FABA:8D C7 60	STA $60C7  
0x03FACD|$0F:$FABD:A5 7C   	LDA $7C    
0x03FACF|$0F:$FABF:8D CE 60	STA $60CE  
0x03FAD2|$0F:$FAC2:A5 7D   	LDA $7D    
0x03FAD4|$0F:$FAC4:8D CF 60	STA $60CF  
0x03FAD7|$0F:$FAC7:60      	RTS        

; CLC if we've read an end token, otherwise (probably?) print word to screen and SEC
; control flow target (from $FA60)
0x03FAD8|$0F:$FAC8:AD CC 60	LDA $60CC  	; text engine end token flag
0x03FADB|$0F:$FACB:D0 02   	BNE $FACF  
0x03FADD|$0F:$FACD:18      	CLC        
0x03FADE|$0F:$FACE:60      	RTS        

; control flow target (from $FACB)
0x03FADF|$0F:$FACF:A6 7D   	LDX $7D    
0x03FAE1|$0F:$FAD1:AD D0 60	LDA $60D0  
0x03FAE4|$0F:$FAD4:D0 03   	BNE $FAD9  
0x03FAE6|$0F:$FAD6:8E D0 60	STX $60D0  
; control flow target (from $FAD4)
0x03FAE9|$0F:$FAD9:AD D1 60	LDA $60D1  
0x03FAEC|$0F:$FADC:D0 03   	BNE $FAE1  
0x03FAEE|$0F:$FADE:8E D1 60	STX $60D1  
; control flow target (from $FADC)
0x03FAF1|$0F:$FAE1:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x03FAF3|$0F:$FAE3:10 26   	BPL $FB0B  
0x03FAF5|$0F:$FAE5:A5 7D   	LDA $7D    
0x03FAF7|$0F:$FAE7:C9 01   	CMP #$01   
0x03FAF9|$0F:$FAE9:F0 01   	BEQ $FAEC  
0x03FAFB|$0F:$FAEB:4A      	LSR        
; control flow target (from $FAE9)
0x03FAFC|$0F:$FAEC:18      	CLC        
0x03FAFD|$0F:$FAED:69 01   	ADC #$01   
0x03FAFF|$0F:$FAEF:85 9C   	STA $9C    
; control flow target (from $FB08)
0x03FB01|$0F:$FAF1:38      	SEC        
0x03FB02|$0F:$FAF2:A5 7D   	LDA $7D    
0x03FB04|$0F:$FAF4:ED CF 60	SBC $60CF  
0x03FB07|$0F:$FAF7:90 12   	BCC $FB0B  
0x03FB09|$0F:$FAF9:F0 10   	BEQ $FB0B  
0x03FB0B|$0F:$FAFB:C9 01   	CMP #$01   
0x03FB0D|$0F:$FAFD:F0 03   	BEQ $FB02  
0x03FB0F|$0F:$FAFF:20 0D FB	JSR $FB0D  
; control flow target (from $FAFD)
0x03FB12|$0F:$FB02:20 0D FB	JSR $FB0D  
0x03FB15|$0F:$FB05:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03FB18|$0F:$FB08:4C F1 FA	JMP $FAF1  

; control flow target (from $FAE3, $FAF7, $FAF9)
0x03FB1B|$0F:$FB0B:38      	SEC        
0x03FB1C|$0F:$FB0C:60      	RTS        

; control flow target (from $FAFF, $FB02)
0x03FB1D|$0F:$FB0D:AD CF 60	LDA $60CF  
0x03FB20|$0F:$FB10:48      	PHA        
0x03FB21|$0F:$FB11:EE CF 60	INC $60CF  
0x03FB24|$0F:$FB14:20 A2 FD	JSR $FDA2  	; 16-bit multiplication: set 16-bit ($10-$11) = A * #$16; returns low byte in A and clears C
0x03FB27|$0F:$FB17:8D 85 60	STA $6085  
0x03FB2A|$0F:$FB1A:68      	PLA        
0x03FB2B|$0F:$FB1B:18      	CLC        
0x03FB2C|$0F:$FB1C:69 13   	ADC #$13   
0x03FB2E|$0F:$FB1E:8D 84 60	STA $6084  
0x03FB31|$0F:$FB21:4C 0F FD	JMP $FD0F  

; control flow target (from $FA5A)
0x03FB34|$0F:$FB24:20 B8 FB	JSR $FBB8  	; read a main script word into word buffer $60D9
0x03FB37|$0F:$FB27:2C CA 60	BIT $60CA  	; unused text engine variable
0x03FB3A|$0F:$FB2A:30 36   	BMI $FB62  
0x03FB3C|$0F:$FB2C:A5 7C   	LDA $7C    
0x03FB3E|$0F:$FB2E:8D 9E 60	STA $609E  	; menu current column
0x03FB41|$0F:$FB31:A9 00   	LDA #$00   
0x03FB43|$0F:$FB33:8D 89 60	STA $6089  	; string word buffer index 2
; control flow target (from $FB4E)
0x03FB46|$0F:$FB36:AE 89 60	LDX $6089  	; string word buffer index 2
0x03FB49|$0F:$FB39:BD D9 60	LDA $60D9,X	; start of string word buffer
0x03FB4C|$0F:$FB3C:EE 89 60	INC $6089  	; string word buffer index 2
0x03FB4F|$0F:$FB3F:C9 5F   	CMP #$5F   	; [space]
0x03FB51|$0F:$FB41:F0 0D   	BEQ $FB50  
0x03FB53|$0F:$FB43:C9 FA   	CMP #$FA   	; [end-FA]
0x03FB55|$0F:$FB45:B0 09   	BCS $FB50  
0x03FB57|$0F:$FB47:EE 9E 60	INC $609E  	; menu current column
0x03FB5A|$0F:$FB4A:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FB5D|$0F:$FB4D:45	; $02:$800A; -> $02:$B677: CLC if end of word, SEC otherwise

; data -> code
0x03FB5E|$0F:$FB4E:B0 E6   	BCS $FB36  
; control flow target (from $FB41, $FB45)
0x03FB60|$0F:$FB50:CE 9E 60	DEC $609E  	; menu current column
0x03FB63|$0F:$FB53:AD 9E 60	LDA $609E  	; menu current column
0x03FB66|$0F:$FB56:10 06   	BPL $FB5E  
0x03FB68|$0F:$FB58:AD C8 60	LDA $60C8  	; speech sound effect / auto-indent flag
0x03FB6B|$0F:$FB5B:8D 9E 60	STA $609E  	; menu current column
; control flow target (from $FB56)
0x03FB6E|$0F:$FB5E:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FB71|$0F:$FB61:47	; $02:$800E; -> $02:$B687: if menu current column < #$16, CLC and RTS, otherwise do stuff

; data -> code
; control flow target (from $FB2A)
0x03FB72|$0F:$FB62:60      	RTS        

; control flow target (from $FA5D)
0x03FB73|$0F:$FB63:A2 00   	LDX #$00   
0x03FB75|$0F:$FB65:8E CB 60	STX $60CB  	; string word buffer index 1
; control flow target (from $FB7E)
0x03FB78|$0F:$FB68:AE CB 60	LDX $60CB  	; string word buffer index 1
0x03FB7B|$0F:$FB6B:BD D9 60	LDA $60D9,X	; start of string word buffer
0x03FB7E|$0F:$FB6E:EE CB 60	INC $60CB  	; string word buffer index 1
0x03FB81|$0F:$FB71:C9 FA   	CMP #$FA   
0x03FB83|$0F:$FB73:B0 0C   	BCS $FB81  
0x03FB85|$0F:$FB75:48      	PHA        
0x03FB86|$0F:$FB76:20 37 FD	JSR $FD37  
0x03FB89|$0F:$FB79:68      	PLA        
0x03FB8A|$0F:$FB7A:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FB8D|$0F:$FB7D:45	; $02:$800A; -> $02:$B677: CLC if end of word, SEC otherwise

; data -> code
0x03FB8E|$0F:$FB7E:B0 E8   	BCS $FB68  
0x03FB90|$0F:$FB80:60      	RTS        

; control flow target (from $FB73)
0x03FB91|$0F:$FB81:C9 FB   	CMP #$FB   	; [wait]; implies [line]
0x03FB93|$0F:$FB83:F0 12   	BEQ $FB97  
0x03FB95|$0F:$FB85:C9 FC   	CMP #$FC   	; [end-FC]
0x03FB97|$0F:$FB87:F0 24   	BEQ $FBAD  
0x03FB99|$0F:$FB89:C9 FD   	CMP #$FD   
0x03FB9B|$0F:$FB8B:F0 1B   	BEQ $FBA8  
0x03FB9D|$0F:$FB8D:C9 FE   	CMP #$FE   	; [line]
0x03FB9F|$0F:$FB8F:F0 12   	BEQ $FBA3  
; set text engine end token flag $60CC and RTS
; FA/FF handler + end of FC handler
; control flow target (from $FBB5)
0x03FBA1|$0F:$FB91:A9 FF   	LDA #$FF   
0x03FBA3|$0F:$FB93:8D CC 60	STA $60CC  	; text engine end token flag
0x03FBA6|$0F:$FB96:60      	RTS        

; FB handler: [wait]
; control flow target (from $FB83)
0x03FBA7|$0F:$FB97:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x03FBA9|$0F:$FB99:30 0C   	BMI $FBA7  
0x03FBAB|$0F:$FB9B:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FBAE|$0F:$FB9E:46	; $02:$800C

; data -> code
0x03FBAF|$0F:$FB9F:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FBB2|$0F:$FBA2:48	; $02:$8010

; data -> code
; FE handler: [line]
; control flow target (from $FB8F)
0x03FBB3|$0F:$FBA3:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FBB6|$0F:$FBA6:46	; $02:$800C

; data -> code
; control flow target (from $FB99)
0x03FBB7|$0F:$FBA7:60      	RTS        

; FD handler
; control flow target (from $FB8B)
0x03FBB8|$0F:$FBA8:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FBBB|$0F:$FBAB:40	; $02:$8000; -> $02:$B68F: handler for control code #$FD

; data -> code
0x03FBBC|$0F:$FBAC:60      	RTS        

; FC handler: [end-FC]
; control flow target (from $FB87)
0x03FBBD|$0F:$FBAD:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FBC0|$0F:$FBB0:46	; $02:$800C

; data -> code
0x03FBC1|$0F:$FBB1:A9 00   	LDA #$00   
0x03FBC3|$0F:$FBB3:85 7C   	STA $7C    
0x03FBC5|$0F:$FBB5:4C 91 FB	JMP $FB91  	; set text engine end token flag $60CC and RTS

; read a main script word into word buffer $60D9
; control flow target (from $FB24)
0x03FBC8|$0F:$FBB8:A9 00   	LDA #$00   
0x03FBCA|$0F:$FBBA:8D CB 60	STA $60CB  	; string word buffer index 1
; control flow target (from $FBDA)
0x03FBCD|$0F:$FBBD:20 DD FB	JSR $FBDD  	; return next byte of string in A
0x03FBD0|$0F:$FBC0:C9 FE   	CMP #$FE   	; useless op
0x03FBD2|$0F:$FBC2:D0 00   	BNE $FBC4  	; useless op
; control flow target (from $FBC2)
0x03FBD4|$0F:$FBC4:C9 65   	CMP #$65   	; "‘"
0x03FBD6|$0F:$FBC6:D0 05   	BNE $FBCD  	; "‘" enables speech sound effect
0x03FBD8|$0F:$FBC8:A2 01   	LDX #$01   
0x03FBDA|$0F:$FBCA:8E C8 60	STX $60C8  	; speech sound effect / auto-indent flag
; control flow target (from $FBC6)
0x03FBDD|$0F:$FBCD:AE CB 60	LDX $60CB  	; string word buffer index 1
0x03FBE0|$0F:$FBD0:9D D9 60	STA $60D9,X	; start of string word buffer
0x03FBE3|$0F:$FBD3:EE CB 60	INC $60CB  	; string word buffer index 1
0x03FBE6|$0F:$FBD6:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FBE9|$0F:$FBD9:45	; $02:$800A; -> $02:$B677: CLC if end of word, SEC otherwise

; data -> code
0x03FBEA|$0F:$FBDA:B0 E1   	BCS $FBBD  	; if not end of word, keep reading more string bytes
0x03FBEC|$0F:$FBDC:60      	RTS        

; return next byte of string in A
; control flow target (from $FBBD)
0x03FBED|$0F:$FBDD:AE C9 60	LDX $60C9  	; count (only used as flag) of interpolated variable bytes read from $60F1
0x03FBF0|$0F:$FBE0:F0 12   	BEQ $FBF4  	; if we're not in "read from $60F1" mode, read next string byte from ROM
; control flow target (from $FBFC)
0x03FBF2|$0F:$FBE2:BD F1 60	LDA $60F1,X	; start of text variable buffer
0x03FBF5|$0F:$FBE5:EE C9 60	INC $60C9  	; count (only used as flag) of interpolated variable bytes read from $60F1
0x03FBF8|$0F:$FBE8:C9 FA   	CMP #$FA   	; [end-FA]
0x03FBFA|$0F:$FBEA:D0 07   	BNE $FBF3  	; if not [end-FA], use it
0x03FBFC|$0F:$FBEC:A2 00   	LDX #$00   	; otherwise reset read index and "read from $60F1" flag
0x03FBFE|$0F:$FBEE:8E C9 60	STX $60C9  	; count (only used as flag) of interpolated variable bytes read from $60F1
0x03FC01|$0F:$FBF1:F0 01   	BEQ $FBF4  	; and read next string token from ROM
; control flow target (from $FBEA, $FBF8)
0x03FC03|$0F:$FBF3:60      	RTS        

; control flow target (from $FBE0, $FBF1)
0x03FC04|$0F:$FBF4:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FC07|$0F:$FBF7:4A	; $02:$8014; -> $02:$BE00: read the next text token and interpolate any variable control codes; SEC to trigger read of [end-FA]-terminated string from $60F1, CLC to use A

; data -> code
0x03FC08|$0F:$FBF8:90 F9   	BCC $FBF3  	; CLC means to use value in A, so RTS
0x03FC0A|$0F:$FBFA:A2 00   	LDX #$00   	; else, SEC means to read from $60F1, so initialize read index to #$00
0x03FC0C|$0F:$FBFC:4C E2 FB	JMP $FBE2  	; and start reading

; external control flow target (from $04:$9ADB, $04:$9B46)
0x03FC0F|$0F:$FBFF:29 0F   	AND #$0F   
0x03FC11|$0F:$FC01:C9 0F   	CMP #$0F   
0x03FC13|$0F:$FC03:F0 0E   	BEQ $FC13  
0x03FC15|$0F:$FC05:C9 0E   	CMP #$0E   
0x03FC17|$0F:$FC07:F0 14   	BEQ $FC1D  
0x03FC19|$0F:$FC09:C9 0C   	CMP #$0C   
0x03FC1B|$0F:$FC0B:D0 06   	BNE $FC13  
0x03FC1D|$0F:$FC0D:AD D1 60	LDA $60D1  
0x03FC20|$0F:$FC10:4C 25 FC	JMP $FC25  

; control flow target (from $FC03, $FC0B)
0x03FC23|$0F:$FC13:A9 00   	LDA #$00   
0x03FC25|$0F:$FC15:8D D0 60	STA $60D0  
0x03FC28|$0F:$FC18:8D D1 60	STA $60D1  
0x03FC2B|$0F:$FC1B:F0 08   	BEQ $FC25  
; control flow target (from $FC07)
0x03FC2D|$0F:$FC1D:A9 00   	LDA #$00   
0x03FC2F|$0F:$FC1F:8D D1 60	STA $60D1  
0x03FC32|$0F:$FC22:AD D0 60	LDA $60D0  
; control flow target (from $FC10, $FC1B)
0x03FC35|$0F:$FC25:85 7D   	STA $7D    
0x03FC37|$0F:$FC27:0A      	ASL        
0x03FC38|$0F:$FC28:69 02   	ADC #$02   
0x03FC3A|$0F:$FC2A:85 00   	STA $00    
0x03FC3C|$0F:$FC2C:A9 00   	LDA #$00   
0x03FC3E|$0F:$FC2E:85 7C   	STA $7C    
; control flow target (from $FC32)
0x03FC40|$0F:$FC30:A5 00   	LDA $00    
0x03FC42|$0F:$FC32:D0 FC   	BNE $FC30  
0x03FC44|$0F:$FC34:A9 FF   	LDA #$FF   
0x03FC46|$0F:$FC36:85 00   	STA $00    
0x03FC48|$0F:$FC38:A2 08   	LDX #$08   
0x03FC4A|$0F:$FC3A:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x03FC4D|$0F:$FC3D:A5 7D   	LDA $7D    
0x03FC4F|$0F:$FC3F:20 A2 FD	JSR $FDA2  	; 16-bit multiplication: set 16-bit ($10-$11) = A * #$16; returns low byte in A and clears C
0x03FC52|$0F:$FC42:65 7C   	ADC $7C    
0x03FC54|$0F:$FC44:AA      	TAX        
0x03FC55|$0F:$FC45:A9 5F   	LDA #$5F   
; control flow target (from $FC4D)
0x03FC57|$0F:$FC47:9D F8 06	STA $06F8,X	; start of main dialogue window
0x03FC5A|$0F:$FC4A:E8      	INX        
0x03FC5B|$0F:$FC4B:E0 B0   	CPX #$B0   
0x03FC5D|$0F:$FC4D:D0 F8   	BNE $FC47  
0x03FC5F|$0F:$FC4F:60      	RTS        

; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; control flow target (from $C853)
; external control flow target (from $02:$B2CF, $02:$B2E8, $02:$B330, $04:$9CD3, $06:$80D3, $06:$80FF, $06:$8108, $06:$8B4B, $06:$8BF5, $06:$8C15, $06:$8CCA, $06:$8D27, $06:$8E11, $06:$8E2C, $06:$8ED2, $06:$8EDE, $06:$8F0E, $06:$8F2F, $06:$8F44, $06:$8F55, $06:$8F60, $06:$8F6C, $06:$8F87, $06:$8FCF, $06:$8FE0, $06:$900F, $06:$9079, $06:$908B, $06:$91F7, $06:$9381, $06:$93E8, $06:$9404, $06:$9443, $06:$9574, $06:$95CF, $06:$9644, $06:$96FB, $06:$9739, $06:$9CA7, $06:$A21B, $06:$A248, $06:$BB54, $06:$BB70, $06:$BB79, $06:$BBD0, $07:$82E4)
0x03FC60|$0F:$FC50:48      	PHA        
0x03FC61|$0F:$FC51:29 03   	AND #$03   
0x03FC63|$0F:$FC53:85 10   	STA $10    
0x03FC65|$0F:$FC55:0A      	ASL        
0x03FC66|$0F:$FC56:0A      	ASL        
0x03FC67|$0F:$FC57:85 12   	STA $12    	; A & #$03 * 4
0x03FC69|$0F:$FC59:65 10   	ADC $10    
0x03FC6B|$0F:$FC5B:85 11   	STA $11    	; A & #$03 * 5
0x03FC6D|$0F:$FC5D:A0 00   	LDY #$00   
; control flow target (from $FC76)
0x03FC6F|$0F:$FC5F:A6 11   	LDX $11    
0x03FC71|$0F:$FC61:BD 13 01	LDA $0113,X	; Midenhall name bytes 0-3 + terminator
0x03FC74|$0F:$FC64:99 19 61	STA $6119,Y	; start of buffer for [monster(s)], [name], maybe more
0x03FC77|$0F:$FC67:A6 12   	LDX $12    
0x03FC79|$0F:$FC69:BD 86 01	LDA $0186,X	; Midenhall name bytes 4-7
0x03FC7C|$0F:$FC6C:99 1D 61	STA $611D,Y
0x03FC7F|$0F:$FC6F:E6 11   	INC $11    
0x03FC81|$0F:$FC71:E6 12   	INC $12    
0x03FC83|$0F:$FC73:C8      	INY        
0x03FC84|$0F:$FC74:C0 04   	CPY #$04   
0x03FC86|$0F:$FC76:D0 E7   	BNE $FC5F  
0x03FC88|$0F:$FC78:A0 08   	LDY #$08   
0x03FC8A|$0F:$FC7A:20 D7 FC	JSR $FCD7  	; update write index to trim trailing spaces
0x03FC8D|$0F:$FC7D:68      	PLA        
0x03FC8E|$0F:$FC7E:10 00   	BPL $FC80  	; append [end-FA] to string and swap return bank $94 back in; useless op
; append [end-FA] to string and swap return bank $94 back in
; control flow target (from $FC7E, $FCC3, $FCC5, $FCD5)
0x03FC90|$0F:$FC80:A9 FA   	LDA #$FA   	; [end-FA]
0x03FC92|$0F:$FC82:99 19 61	STA $6119,Y	; start of buffer for [monster(s)], [name], maybe more
0x03FC95|$0F:$FC85:20 C2 F6	JSR $F6C2  	; load bank specified by $94
0x03FC98|$0F:$FC88:60      	RTS        

; write monster name in A (+ monster number within its group in X, if > 0) to $6119
; external control flow target (from $04:$9CD9)
0x03FC99|$0F:$FC89:8E 8B 60	STX $608B  	; monster number within its group
0x03FC9C|$0F:$FC8C:48      	PHA        	; monster ID
0x03FC9D|$0F:$FC8D:A9 00   	LDA #$00   	; start with the first segment
0x03FC9F|$0F:$FC8F:8D AB 60	STA $60AB  	; which list segment we're dealing with
0x03FCA2|$0F:$FC92:A9 0B   	LDA #$0B   	; max length of first segment
0x03FCA4|$0F:$FC94:8D A0 60	STA $60A0  	; maximum string length; max segment length
0x03FCA7|$0F:$FC97:68      	PLA        	; monster ID
0x03FCA8|$0F:$FC98:20 B7 F3	JSR $F3B7  	; given monster ID in A, copy monster name segment to $0100 in reverse
0x03FCAB|$0F:$FC9B:A0 00   	LDY #$00   	; initialize write index to #$00
0x03FCAD|$0F:$FC9D:20 E8 FC	JSR $FCE8  	; copy $60A0 bytes of data from $00FF to $6119
0x03FCB0|$0F:$FCA0:20 D7 FC	JSR $FCD7  	; update write index to trim trailing spaces
0x03FCB3|$0F:$FCA3:A9 5F   	LDA #$5F   	; [space]
0x03FCB5|$0F:$FCA5:99 19 61	STA $6119,Y	; start of buffer for [monster(s)], [name], maybe more; write [space] to $6119,Y
0x03FCB8|$0F:$FCA8:C8      	INY        	; increment write index
0x03FCB9|$0F:$FCA9:98      	TYA        
0x03FCBA|$0F:$FCAA:48      	PHA        	; save write index for later
0x03FCBB|$0F:$FCAB:EE AB 60	INC $60AB  	; which list segment we're dealing with
0x03FCBE|$0F:$FCAE:A9 09   	LDA #$09   	; max length of second segment
0x03FCC0|$0F:$FCB0:8D A0 60	STA $60A0  	; maximum string length; max segment length
0x03FCC3|$0F:$FCB3:A5 10   	LDA $10    	; monster ID, set by previous call to $F3B7
0x03FCC5|$0F:$FCB5:20 B7 F3	JSR $F3B7  	; given monster ID in A, copy monster name segment to $0100 in reverse
0x03FCC8|$0F:$FCB8:68      	PLA        	; pull write index back into Y
0x03FCC9|$0F:$FCB9:A8      	TAY        
0x03FCCA|$0F:$FCBA:20 E8 FC	JSR $FCE8  	; copy $60A0 bytes of data from $00FF to $6119
0x03FCCD|$0F:$FCBD:20 D7 FC	JSR $FCD7  	; update write index to trim trailing spaces
0x03FCD0|$0F:$FCC0:AE 8B 60	LDX $608B  	; monster number within its group
0x03FCD3|$0F:$FCC3:F0 BB   	BEQ $FC80  	; append [end-FA] to string and swap return bank $94 back in
0x03FCD5|$0F:$FCC5:30 B9   	BMI $FC80  	; append [end-FA] to string and swap return bank $94 back in
0x03FCD7|$0F:$FCC7:A9 6A   	LDA #$6A   	; "-"
0x03FCD9|$0F:$FCC9:99 19 61	STA $6119,Y	; start of buffer for [monster(s)], [name], maybe more
0x03FCDC|$0F:$FCCC:C8      	INY        
0x03FCDD|$0F:$FCCD:8A      	TXA        	; monster number within its group
0x03FCDE|$0F:$FCCE:18      	CLC        
0x03FCDF|$0F:$FCCF:69 23   	ADC #$23   	; #$23 == "z" and A > 0, so this is the uppercase letter corresponding to the monster number within its group; net effect is e.g. "-A", "-B", etc.
0x03FCE1|$0F:$FCD1:99 19 61	STA $6119,Y	; start of buffer for [monster(s)], [name], maybe more
0x03FCE4|$0F:$FCD4:C8      	INY        
0x03FCE5|$0F:$FCD5:D0 A9   	BNE $FC80  	; append [end-FA] to string and swap return bank $94 back in
; update write index to trim trailing spaces
; control flow target (from $FC7A, $FCA0, $FCBD, $FCE5)
0x03FCE7|$0F:$FCD7:B9 18 61	LDA $6118,Y	; last byte written
0x03FCEA|$0F:$FCDA:C9 60   	CMP #$60   	; [no voice]
0x03FCEC|$0F:$FCDC:F0 04   	BEQ $FCE2  
0x03FCEE|$0F:$FCDE:C9 5F   	CMP #$5F   	; [space]
0x03FCF0|$0F:$FCE0:D0 05   	BNE $FCE7  
; control flow target (from $FCDC)
0x03FCF2|$0F:$FCE2:88      	DEY        	; if it's some kind of whitespace, decrement the write index
0x03FCF3|$0F:$FCE3:30 02   	BMI $FCE7  	; if Y became negative (oops - string is now 0 bytes), stop
0x03FCF5|$0F:$FCE5:D0 F0   	BNE $FCD7  	; update write index to trim trailing spaces
; control flow target (from $FCE0, $FCE3)
0x03FCF7|$0F:$FCE7:60      	RTS        

; copy $60A0 bytes of data from $00FF to $6119
; X is used as a read index, Y as a write index
; data gets copied in reverse order
; IN:
; A/X/C = irrelevant
; Y = current write index
; OUT:
; A = last byte copied (but calling code doesn't care)
; X = 0
; Y = current write index; this is important since the calling code needs to remember the write index from the first segment when dealing with the second segment
; C = unchanged
; control flow target (from $FC9D, $FCBA)
0x03FCF8|$0F:$FCE8:AE A0 60	LDX $60A0  	; maximum string length; initialize the read index to the value of $60A0
; control flow target (from $FCF3)
0x03FCFB|$0F:$FCEB:BD FF 00	LDA $00FF,X	; built-in offset from string copy buffer start at $0100
0x03FCFE|$0F:$FCEE:99 19 61	STA $6119,Y	; start of buffer for [monster(s)], [name], maybe more; write data to $6119,Y
0x03FD01|$0F:$FCF1:C8      	INY        	; increment write index
0x03FD02|$0F:$FCF2:CA      	DEX        	; decrement read index
0x03FD03|$0F:$FCF3:D0 F6   	BNE $FCEB  	; if the read index is not 0, loop back to $FCEB
0x03FD05|$0F:$FCF5:60      	RTS        	; otherwise the read index is 0, so we're done

; text engine: load bank specified by $60C6 (bank containing the desired text string)
; control flow target (from $FDD3, $FE16, $FE34)
0x03FD06|$0F:$FCF6:48      	PHA        
0x03FD07|$0F:$FCF7:AD C6 60	LDA $60C6  	; ROM bank containing the desired text string
0x03FD0A|$0F:$FCFA:20 D5 C3	JSR $C3D5  	; save A to $05F6, X to $43, and load bank specified by A
0x03FD0D|$0F:$FCFD:68      	PLA        
0x03FD0E|$0F:$FCFE:60      	RTS        

; external control flow target (from $02:$B6DB)
0x03FD0F|$0F:$FCFF:20 0F FD	JSR $FD0F  
0x03FD12|$0F:$FD02:EE 84 60	INC $6084  
0x03FD15|$0F:$FD05:20 0F FD	JSR $FD0F  
0x03FD18|$0F:$FD08:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x03FD1B|$0F:$FD0B:EE 84 60	INC $6084  
0x03FD1E|$0F:$FD0E:60      	RTS        

; control flow target (from $FB21, $FCFF, $FD05)
0x03FD1F|$0F:$FD0F:AD 84 60	LDA $6084  
0x03FD22|$0F:$FD12:8D 8C 60	STA $608C  
0x03FD25|$0F:$FD15:A9 05   	LDA #$05   
0x03FD27|$0F:$FD17:8D 8B 60	STA $608B  
; control flow target (from $FD34)
0x03FD2A|$0F:$FD1A:AE 85 60	LDX $6085  
0x03FD2D|$0F:$FD1D:BD F8 06	LDA $06F8,X	; start of main dialogue window
0x03FD30|$0F:$FD20:85 09   	STA $09    
0x03FD32|$0F:$FD22:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FD35|$0F:$FD25:C1	; $06:$8002

; data -> code
0x03FD36|$0F:$FD26: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
0x03FD39|$0F:$FD29:EE 85 60	INC $6085  
0x03FD3C|$0F:$FD2C:EE 8B 60	INC $608B  
0x03FD3F|$0F:$FD2F:AD 8B 60	LDA $608B  
0x03FD42|$0F:$FD32:C9 1B   	CMP #$1B   
0x03FD44|$0F:$FD34:D0 E4   	BNE $FD1A  
0x03FD46|$0F:$FD36:60      	RTS        

; control flow target (from $FB76)
0x03FD47|$0F:$FD37:48      	PHA        
0x03FD48|$0F:$FD38:A5 7C   	LDA $7C    
0x03FD4A|$0F:$FD3A:8D 9E 60	STA $609E  	; menu current column
0x03FD4D|$0F:$FD3D:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FD50|$0F:$FD40:47	; $02:$800E; -> $02:$B687: if menu current column < #$16, CLC and RTS, otherwise do stuff

; data -> code
0x03FD51|$0F:$FD41:A5 7D   	LDA $7D    
0x03FD53|$0F:$FD43:20 A2 FD	JSR $FDA2  	; 16-bit multiplication: set 16-bit ($10-$11) = A * #$16; returns low byte in A and clears C
0x03FD56|$0F:$FD46:65 7C   	ADC $7C    
0x03FD58|$0F:$FD48:AA      	TAX        
0x03FD59|$0F:$FD49:68      	PLA        
0x03FD5A|$0F:$FD4A:C9 5F   	CMP #$5F   
0x03FD5C|$0F:$FD4C:F0 11   	BEQ $FD5F  
0x03FD5E|$0F:$FD4E:C9 65   	CMP #$65   
0x03FD60|$0F:$FD50:D0 14   	BNE $FD66  
0x03FD62|$0F:$FD52:A4 7C   	LDY $7C    
0x03FD64|$0F:$FD54:C0 01   	CPY #$01   
0x03FD66|$0F:$FD56:D0 0E   	BNE $FD66  
0x03FD68|$0F:$FD58:88      	DEY        
0x03FD69|$0F:$FD59:84 7C   	STY $7C    
0x03FD6B|$0F:$FD5B:CA      	DEX        
0x03FD6C|$0F:$FD5C:4C 66 FD	JMP $FD66  

; control flow target (from $FD4C)
0x03FD6F|$0F:$FD5F:A4 7C   	LDY $7C    
0x03FD71|$0F:$FD61:CC C8 60	CPY $60C8  	; speech sound effect / auto-indent flag
0x03FD74|$0F:$FD64:F0 3B   	BEQ $FDA1  
; control flow target (from $FD50, $FD56, $FD5C)
0x03FD76|$0F:$FD66:48      	PHA        
0x03FD77|$0F:$FD67:BD F8 06	LDA $06F8,X	; start of main dialogue window
0x03FD7A|$0F:$FD6A:85 09   	STA $09    
0x03FD7C|$0F:$FD6C:A8      	TAY        
0x03FD7D|$0F:$FD6D:68      	PLA        
0x03FD7E|$0F:$FD6E:C0 5F   	CPY #$5F   
0x03FD80|$0F:$FD70:D0 05   	BNE $FD77  
0x03FD82|$0F:$FD72:9D F8 06	STA $06F8,X	; start of main dialogue window
0x03FD85|$0F:$FD75:85 09   	STA $09    
; control flow target (from $FD70)
0x03FD87|$0F:$FD77:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x03FD89|$0F:$FD79:30 24   	BMI $FD9F  
0x03FD8B|$0F:$FD7B:AD C8 60	LDA $60C8  	; speech sound effect / auto-indent flag
0x03FD8E|$0F:$FD7E:F0 05   	BEQ $FD85  
0x03FD90|$0F:$FD80:A9 8F   	LDA #$8F   	; Music ID #$8F: speech SFX
0x03FD92|$0F:$FD82:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; control flow target (from $FD7E)
0x03FD95|$0F:$FD85:A5 7C   	LDA $7C    
0x03FD97|$0F:$FD87:18      	CLC        
0x03FD98|$0F:$FD88:69 05   	ADC #$05   
0x03FD9A|$0F:$FD8A:8D 8B 60	STA $608B  
0x03FD9D|$0F:$FD8D:A5 7D   	LDA $7D    
0x03FD9F|$0F:$FD8F:18      	CLC        
0x03FDA0|$0F:$FD90:69 13   	ADC #$13   
0x03FDA2|$0F:$FD92:8D 8C 60	STA $608C  
0x03FDA5|$0F:$FD95:20 97 FE	JSR $FE97  	; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank

; code -> data
; indirect data load target
0x03FDA8|$0F:$FD98:C1	; $06:$8002

; data -> code
0x03FDA9|$0F:$FD99: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
0x03FDAC|$0F:$FD9C:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $FD79)
0x03FDAF|$0F:$FD9F:E6 7C   	INC $7C    
; control flow target (from $FD64)
0x03FDB1|$0F:$FDA1:60      	RTS        

; 16-bit multiplication: set 16-bit ($10-$11) = A * #$16; returns low byte in A and clears C
; control flow target (from $FB14, $FC3F, $FD43)
0x03FDB2|$0F:$FDA2:85 10   	STA $10    
0x03FDB4|$0F:$FDA4:A9 00   	LDA #$00   
0x03FDB6|$0F:$FDA6:85 11   	STA $11    
0x03FDB8|$0F:$FDA8:A2 10   	LDX #$10   
0x03FDBA|$0F:$FDAA:A9 16   	LDA #$16   
0x03FDBC|$0F:$FDAC:20 F4 F0	JSR $F0F4  	; 16-bit multiplication: set 16-bit ($00,X-$01,X) = ($00,X-$01,X) * A
0x03FDBF|$0F:$FDAF:A5 10   	LDA $10    
0x03FDC1|$0F:$FDB1:18      	CLC        
0x03FDC2|$0F:$FDB2:60      	RTS        

; scan through group of strings until we find the start of the desired string
; control flow target (from $FAA4)
0x03FDC3|$0F:$FDB3:A9 00   	LDA #$00   
0x03FDC5|$0F:$FDB5:8D D6 60	STA $60D6  	; bit index into the byte containing the 5-bit text token currently being processed
0x03FDC8|$0F:$FDB8:8D D2 60	STA $60D2  	; read index within current dictionary entry
0x03FDCB|$0F:$FDBB:A5 10   	LDA $10    	; low byte of string index
0x03FDCD|$0F:$FDBD:29 0F   	AND #$0F   	; chop it down to index within the current pointer
0x03FDCF|$0F:$FDBF:AA      	TAX        
0x03FDD0|$0F:$FDC0:F0 06   	BEQ $FDC8  	; if we want the first string in the pointer, nothing more to do here, so RTS
; otherwise scan through the pointer data to find the start of the desired string
; control flow target (from $FDC6)
0x03FDD2|$0F:$FDC2:20 C9 FD	JSR $FDC9  	; scan through current string pointer to find the start of the next string
0x03FDD5|$0F:$FDC5:CA      	DEX        
0x03FDD6|$0F:$FDC6:D0 FA   	BNE $FDC2  
; control flow target (from $FDC0)
0x03FDD8|$0F:$FDC8:60      	RTS        

; scan through current string pointer to find the start of the next string
; control flow target (from $FDC2)
0x03FDD9|$0F:$FDC9:8A      	TXA        
0x03FDDA|$0F:$FDCA:48      	PHA        
0x03FDDB|$0F:$FDCB:20 D3 FD	JSR $FDD3  	; scan through string until we reach an end token; updates read address in $55-$56
0x03FDDE|$0F:$FDCE:68      	PLA        
0x03FDDF|$0F:$FDCF:AA      	TAX        
0x03FDE0|$0F:$FDD0:A5 6D   	LDA $6D    
0x03FDE2|$0F:$FDD2:60      	RTS        

; scan through string until we reach an end token; updates read address in $55-$56
; control flow target (from $FDCB, $FDF0)
0x03FDE3|$0F:$FDD3:20 F6 FC	JSR $FCF6  	; text engine: load bank specified by $60C6 (bank containing the desired text string)
0x03FDE6|$0F:$FDD6:A9 00   	LDA #$00   
0x03FDE8|$0F:$FDD8:8D D3 60	STA $60D3  	; secondary text table offset for C0 - C3 tables
; control flow target (from $FDE8)
0x03FDEB|$0F:$FDDB:20 3D FE	JSR $FE3D  	; set A to the current text dictionary index
0x03FDEE|$0F:$FDDE:20 F7 FD	JSR $FDF7  	; after reading a text token, update the read address in $55-$56 and bit index in $60D6
0x03FDF1|$0F:$FDE1:C9 1C   	CMP #$1C   	; #$1C - #$1F are the C0 - C3 table switch tokens
0x03FDF3|$0F:$FDE3:90 06   	BCC $FDEB  	; if token >= #$1C, we know it's a switch token and the next token is not an end token, so skip over the next token
0x03FDF5|$0F:$FDE5:20 F7 FD	JSR $FDF7  	; after reading a text token, update the read address in $55-$56 and bit index in $60D6
0x03FDF8|$0F:$FDE8:4C DB FD	JMP $FDDB  	; loop to read the next token

; control flow target (from $FDE3)
0x03FDFB|$0F:$FDEB:AD 8B 60	LDA $608B  	; text engine: $608B = dictionary index
0x03FDFE|$0F:$FDEE:C9 05   	CMP #$05   	; the text tokens 0 - 4 are end tokens
0x03FE00|$0F:$FDF0:B0 E1   	BCS $FDD3  	; scan through string until we reach an end token; updates read address in $55-$56; if not an end token, keep scanning
0x03FE02|$0F:$FDF2:A9 FC   	LDA #$FC   	; if end token, set A and $6D to #$FC and RTS
0x03FE04|$0F:$FDF4:85 6D   	STA $6D    	; stash #$FC in $6A since caller needs to pop stuff off the stack
0x03FE06|$0F:$FDF6:60      	RTS        

; after reading a text token, update the read address in $55-$56 and bit index in $60D6
; control flow target (from $FDDE, $FDE5)
; external control flow target (from $02:$B3C6, $02:$B3E3)
0x03FE07|$0F:$FDF7:48      	PHA        
0x03FE08|$0F:$FDF8:AD D6 60	LDA $60D6  	; bit index into the byte containing the 5-bit text token currently being processed
0x03FE0B|$0F:$FDFB:C9 03   	CMP #$03   	; if all 5 bits we need are already in A, keep using it, otherwise update read position in $55-$56
0x03FE0D|$0F:$FDFD:90 26   	BCC $FE25  	; $FE29 would be a better target :p
0x03FE0F|$0F:$FDFF:E6 55   	INC $55    	; pointer to start of sub pointer data, low byte
0x03FE11|$0F:$FE01:D0 02   	BNE $FE05  
0x03FE13|$0F:$FE03:E6 56   	INC $56    	; pointer to start of sub pointer data, high byte
; control flow target (from $FE01)
0x03FE15|$0F:$FE05:A5 55   	LDA $55    	; pointer to start of sub pointer data, low byte; check for $55-$56 == $BFD7; if yes, switch to bank #$02, if no, keep using current address
0x03FE17|$0F:$FE07:C9 D7   	CMP #$D7   
0x03FE19|$0F:$FE09:D0 1A   	BNE $FE25  
0x03FE1B|$0F:$FE0B:A5 56   	LDA $56    	; pointer to start of sub pointer data, high byte
0x03FE1D|$0F:$FE0D:C9 BF   	CMP #$BF   
0x03FE1F|$0F:$FE0F:D0 14   	BNE $FE25  
0x03FE21|$0F:$FE11:A9 02   	LDA #$02   
0x03FE23|$0F:$FE13:8D C6 60	STA $60C6  	; ROM bank containing the desired text string
0x03FE26|$0F:$FE16:20 F6 FC	JSR $FCF6  	; text engine: load bank specified by $60C6 (bank containing the desired text string)
0x03FE29|$0F:$FE19:A9 2E   	LDA #$2E   	; useless
0x03FE2B|$0F:$FE1B:AD 32 FE	LDA $FE32  	; set $55-$56 to new address in bank #$02
0x03FE2E|$0F:$FE1E:85 55   	STA $55    	; pointer to start of sub pointer data, low byte
0x03FE30|$0F:$FE20:AD 33 FE	LDA $FE33  
0x03FE33|$0F:$FE23:85 56   	STA $56    	; pointer to start of sub pointer data, high byte
; control flow target (from $FDFD, $FE09, $FE0F)
0x03FE35|$0F:$FE25:AD D6 60	LDA $60D6  	; bit index into the byte containing the 5-bit text token currently being processed
0x03FE38|$0F:$FE28:18      	CLC        
0x03FE39|$0F:$FE29:69 05   	ADC #$05   	; we read 5 bits, so update the bit index
0x03FE3B|$0F:$FE2B:29 07   	AND #$07   
0x03FE3D|$0F:$FE2D:8D D6 60	STA $60D6  	; bit index into the byte containing the 5-bit text token currently being processed
0x03FE40|$0F:$FE30:68      	PLA        
0x03FE41|$0F:$FE31:60      	RTS        


; code -> data
; data load target (from $FE1B)
0x03FE42|$0F:$FE32:B2
; data load target (from $FE20)
0x03FE43|$0F:$FE33:   B7	; $02:$B7B2

; data -> code
; swap in the right text bank, set A to the current dictionary index, swap in bank #$02
; external control flow target (from $02:$B3AB)
0x03FE44|$0F:$FE34:20 F6 FC	JSR $FCF6  	; text engine: load bank specified by $60C6 (bank containing the desired text string)
0x03FE47|$0F:$FE37:20 3D FE	JSR $FE3D  	; set A to the current text dictionary index
0x03FE4A|$0F:$FE3A:4C 70 F7	JMP $F770  	; load ROM bank #$02

; set A to the current text dictionary index
; control flow target (from $FDDB, $FE37)
0x03FE4D|$0F:$FE3D:AD D6 60	LDA $60D6  	; bit index into the byte containing the 5-bit text token currently being processed
0x03FE50|$0F:$FE40:0A      	ASL        
0x03FE51|$0F:$FE41:A8      	TAY        
0x03FE52|$0F:$FE42:B9 5C FE	LDA $FE5C,Y	; jump table for functions to convert the current 5-bit text token into a dictionary index in A
0x03FE55|$0F:$FE45:85 57   	STA $57    	; pointer to start of main pointer table, low byte
0x03FE57|$0F:$FE47:B9 5D FE	LDA $FE5D,Y
0x03FE5A|$0F:$FE4A:85 58   	STA $58    	; pointer to start of main pointer table, high byte
; BUG: this reads the first 2 bytes of ($55) *before* the code for checking whether the read position needs to jump to bank 2 runs
0x03FE5C|$0F:$FE4C:A0 01   	LDY #$01   
0x03FE5E|$0F:$FE4E:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03FE60|$0F:$FE50:8D 8C 60	STA $608C  	; text engine: $608C = string byte #2
0x03FE63|$0F:$FE53:88      	DEY        
0x03FE64|$0F:$FE54:B1 55   	LDA ($55),Y	; pointer to start of sub pointer data, low byte
0x03FE66|$0F:$FE56:8D 8B 60	STA $608B  	; text engine: $608B = string byte #1
0x03FE69|$0F:$FE59:6C 57 00	JMP ($0057)	; pointer to start of main pointer table, low byte; convert the current 5-bit text token into a dictionary index in A


; code -> data
; jump table for functions to convert the current 5-bit text token into a dictionary index in A
; indexed data load target (from $FE42)
0x03FE6C|$0F:$FE5C:6C
; indexed data load target (from $FE47)
0x03FE6D|$0F:$FE5D:   FE	; $0F:$FE6C; token is in bits 7-3 of A
0x03FE6E|$0F:$FE5E:6D FE	; $0F:$FE6D; token is in bits 6-2 of A
0x03FE70|$0F:$FE60:6E FE	; $0F:$FE6E; token is in bits 5-1 of A
0x03FE72|$0F:$FE62:8D FE	; $0F:$FE8D; token is in bits 4-0 of A (yay)
0x03FE74|$0F:$FE64:84 FE	; $0F:$FE84; token is in bits 3-0 of A + bit 7 of $608C
0x03FE76|$0F:$FE66:7E FE	; $0F:$FE7E; token is in bits 2-0 of A + bits 7-6 of $608C
0x03FE78|$0F:$FE68:78 FE	; $0F:$FE78; token is in bits 1-0 of A + bits 7-5 of $608C
0x03FE7A|$0F:$FE6A:72 FE	; $0F:$FE72; token is in bit 0 of A + bits 7-4 of $608C

; data -> code
; token is in bits 7-3 of A
; indirect control flow target (via $FE5C)
0x03FE7C|$0F:$FE6C:4A      	LSR        
; token is in bits 6-2 of A
; indirect control flow target (via $FE5E)
0x03FE7D|$0F:$FE6D:4A      	LSR        
; token is in bits 5-1 of A
; indirect control flow target (via $FE60)
0x03FE7E|$0F:$FE6E:4A      	LSR        
0x03FE7F|$0F:$FE6F:4C 8D FE	JMP $FE8D  	; token is in bits 4-0 of A (yay)

; token is in bit 0 of A + bits 7-4 of $608C
; indirect control flow target (via $FE6A)
0x03FE82|$0F:$FE72:0E 8C 60	ASL $608C  	; string byte #2
0x03FE85|$0F:$FE75:2E 8B 60	ROL $608B  	; text engine: $608B = string byte #1
; token is in bits 1-0 of A + bits 7-5 of $608C
; indirect control flow target (via $FE68)
0x03FE88|$0F:$FE78:0E 8C 60	ASL $608C  	; string byte #2
0x03FE8B|$0F:$FE7B:2E 8B 60	ROL $608B  	; text engine: $608B = string byte #1
; token is in bits 2-0 of A + bits 7-6 of $608C
; indirect control flow target (via $FE66)
0x03FE8E|$0F:$FE7E:0E 8C 60	ASL $608C  	; string byte #2
0x03FE91|$0F:$FE81:2E 8B 60	ROL $608B  	; text engine: $608B = string byte #1
; token is in bits 3-0 of A + bit 7 of $608C
; indirect control flow target (via $FE64)
0x03FE94|$0F:$FE84:0E 8C 60	ASL $608C  	; string byte #2
0x03FE97|$0F:$FE87:2E 8B 60	ROL $608B  	; text engine: $608B = string byte #1
0x03FE9A|$0F:$FE8A:AD 8B 60	LDA $608B  	; text engine: $608B = string byte #1
; token is in bits 4-0 of A (yay)
; control flow target (from $FE6F)
; indirect control flow target (via $FE62)
0x03FE9D|$0F:$FE8D:29 1F   	AND #$1F   
0x03FE9F|$0F:$FE8F:18      	CLC        
0x03FEA0|$0F:$FE90:6D D3 60	ADC $60D3  	; secondary text table offset for C0 - C3 tables
0x03FEA3|$0F:$FE93:8D 8B 60	STA $608B  	; text engine: $608B = dictionary index
0x03FEA6|$0F:$FE96:60      	RTS        

; read byte following JSR, parse it for bank and pointer index, execute ($8000,X) in selected bank, swap back in original bank
; BUG: does LDA before PHP, so status of N and Z flags are lost
; control flow target (from $C696, $C6C4, $C6D7, $C6DB, $C6F6, $C886, $C894, $CC9B, $D15C, $D16E, $D2E7, $D2F7, $D33C, $D356, $EE06, $EE7B, $EF58, $F04F, $F0BC, $F4A9, $F4E3, $F5E1, $F5F7, $F611, $F787, $F83A, $FB4A, $FB5E, $FB7A, $FB9B, $FB9F, $FBA3, $FBA8, $FBAD, $FBD6, $FBF4, $FD22, $FD3D, $FD95)
; external control flow target (from $02:$B74B, $02:$BE00, $02:$BE2C, $02:$BE34, $02:$BEA1, $06:$B0A5, $07:$87F1, $08:$80C9, $0A:$80F2, $0A:$813B)
0x03FEA7|$0F:$FE97:8D 94 01	STA $0194  
0x03FEAA|$0F:$FE9A:8E 95 01	STX $0195  
0x03FEAD|$0F:$FE9D:8C 96 01	STY $0196  
0x03FEB0|$0F:$FEA0:AD F6 05	LDA $05F6  	; current bank
0x03FEB3|$0F:$FEA3:48      	PHA        
0x03FEB4|$0F:$FEA4:08      	PHP        
0x03FEB5|$0F:$FEA5:20 0E FF	JSR $FF0E  	; from the perspective of the caller (which always pushes 2 extra bytes to the stack before calling us), increment JSR's return address, read byte following JSR, parse it for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank
0x03FEB8|$0F:$FEA8:28      	PLP        
0x03FEB9|$0F:$FEA9:AC 96 01	LDY $0196  
0x03FEBC|$0F:$FEAC:AE 95 01	LDX $0195  
0x03FEBF|$0F:$FEAF:AD 94 01	LDA $0194  
0x03FEC2|$0F:$FEB2:20 C8 FE	JSR $FEC8  	; execute ($D6)
0x03FEC5|$0F:$FEB5:08      	PHP        
0x03FEC6|$0F:$FEB6:8D 94 01	STA $0194  
0x03FEC9|$0F:$FEB9:68      	PLA        
0x03FECA|$0F:$FEBA:85 D6   	STA $D6    
0x03FECC|$0F:$FEBC:68      	PLA        	; original value of $05F6 (current bank)
0x03FECD|$0F:$FEBD:20 BB FF	JSR $FFBB  	; save A to $05F6, X to $43, and load bank specified by A
0x03FED0|$0F:$FEC0:A5 D6   	LDA $D6    	; P
0x03FED2|$0F:$FEC2:48      	PHA        
0x03FED3|$0F:$FEC3:AD 94 01	LDA $0194  
0x03FED6|$0F:$FEC6:28      	PLP        
0x03FED7|$0F:$FEC7:60      	RTS        

; execute ($D6)
; control flow target (from $FEB2)
0x03FED8|$0F:$FEC8:6C D6 00	JMP ($00D6)


; code -> unknown
; must be unused since it's invalid
0x03FEDB|$0F:$FECB:20 DA FE	; JSR $FEDA  
0x03FEDC|$0F:$FECC:DA      	; INVALID OPCODE
0x03FEDD|$0F:$FECD:FE A5 D6	; INC $D6A5,X
0x03FEDE|$0F:$FECE:A5 D6   	; LDA $D6    
0x03FEDF|$0F:$FECF:D6 95   	; DEC $95,X  
0x03FEE0|$0F:$FED0:95 00   	; STA $00,X  
0x03FEE1|$0F:$FED1:00      	; BRK        
0x03FEE2|$0F:$FED2:A5 D7   	; LDA $D7    
0x03FEE3|$0F:$FED3:D7      	; INVALID OPCODE
0x03FEE4|$0F:$FED4:95 01   	; STA $01,X  
0x03FEE5|$0F:$FED5:01 AD   	; ORA ($AD,X)
0x03FEE6|$0F:$FED6:AD 94 01	; LDA $0194  
0x03FEE7|$0F:$FED7:94 01   	; STY $01,X  
0x03FEE8|$0F:$FED8:01 60   	; ORA ($60,X)
0x03FEE9|$0F:$FED9:60      	; RTS        

; unknown -> code
; parse byte following JSR for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank
; control flow target (from $E4EC)
; external control flow target (from $02:$B1C0)
0x03FEEA|$0F:$FEDA:8D 94 01	STA $0194  
0x03FEED|$0F:$FEDD:8E 95 01	STX $0195  
0x03FEF0|$0F:$FEE0:8C 96 01	STY $0196  
0x03FEF3|$0F:$FEE3:AD F6 05	LDA $05F6  	; current bank
0x03FEF6|$0F:$FEE6:48      	PHA        
0x03FEF7|$0F:$FEE7:48      	PHA        
0x03FEF8|$0F:$FEE8:20 0E FF	JSR $FF0E  	; from the perspective of the caller (which always pushes 2 extra bytes to the stack before calling us), increment JSR's return address, read byte following JSR, parse it for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank
0x03FEFB|$0F:$FEEB:68      	PLA        
0x03FEFC|$0F:$FEEC:68      	PLA        
0x03FEFD|$0F:$FEED:20 BB FF	JSR $FFBB  	; save A to $05F6, X to $43, and load bank specified by A
0x03FF00|$0F:$FEF0:AC 96 01	LDY $0196  
0x03FF03|$0F:$FEF3:AE 95 01	LDX $0195  
0x03FF06|$0F:$FEF6:AD 94 01	LDA $0194  
0x03FF09|$0F:$FEF9:60      	RTS        

; increment JSR's return address, read byte following JSR, parse it for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank
; control flow target (from $E4F8, $ECFB)
0x03FF0A|$0F:$FEFA:08      	PHP        
0x03FF0B|$0F:$FEFB:48      	PHA        
0x03FF0C|$0F:$FEFC:8E 95 01	STX $0195  
0x03FF0F|$0F:$FEFF:8C 96 01	STY $0196  
0x03FF12|$0F:$FF02:20 0E FF	JSR $FF0E  	; from the perspective of the caller (which always pushes 2 extra bytes to the stack before calling us), increment JSR's return address, read byte following JSR, parse it for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank
0x03FF15|$0F:$FF05:AC 96 01	LDY $0196  
0x03FF18|$0F:$FF08:AE 95 01	LDX $0195  
0x03FF1B|$0F:$FF0B:68      	PLA        
0x03FF1C|$0F:$FF0C:28      	PLP        
0x03FF1D|$0F:$FF0D:60      	RTS        

; from the perspective of the caller (which always pushes 2 extra bytes to the stack before calling us), increment JSR's return address, read byte following JSR, parse it for bank and pointer index, set $D6-$D7 to $8000,X-$8001,X in selected bank
; control flow target (from $FEA5, $FEE8, $FF02)
0x03FF1E|$0F:$FF0E:BA      	TSX        
0x03FF1F|$0F:$FF0F:FE 05 01	INC $0105,X
0x03FF22|$0F:$FF12:D0 03   	BNE $FF17  
0x03FF24|$0F:$FF14:FE 06 01	INC $0106,X
; control flow target (from $FF12)
0x03FF27|$0F:$FF17:BD 05 01	LDA $0105,X
0x03FF2A|$0F:$FF1A:85 D6   	STA $D6    
0x03FF2C|$0F:$FF1C:BD 06 01	LDA $0106,X
0x03FF2F|$0F:$FF1F:85 D7   	STA $D7    
0x03FF31|$0F:$FF21:A0 00   	LDY #$00   
0x03FF33|$0F:$FF23:B1 D6   	LDA ($D6),Y
0x03FF35|$0F:$FF25:20 33 FF	JSR $FF33  	; parse A into bank and pointer indices and load specified bank
0x03FF38|$0F:$FF28:BD 00 80	LDA $8000,X
0x03FF3B|$0F:$FF2B:85 D6   	STA $D6    
0x03FF3D|$0F:$FF2D:BD 01 80	LDA $8001,X
0x03FF40|$0F:$FF30:85 D7   	STA $D7    
0x03FF42|$0F:$FF32:60      	RTS        

; parse A into bank and pointer indices and load specified bank
; bank is high 3 bits of A (but 8 if 0 and 6 if 5), pointer is low 5 bits of A (but low 6 if bank is 6)
; control flow target (from $F3EA, $FF25)
0x03FF43|$0F:$FF33:48      	PHA        
0x03FF44|$0F:$FF34:2A      	ROL        
0x03FF45|$0F:$FF35:2A      	ROL        
0x03FF46|$0F:$FF36:2A      	ROL        
0x03FF47|$0F:$FF37:2A      	ROL        
0x03FF48|$0F:$FF38:29 07   	AND #$07   
0x03FF4A|$0F:$FF3A:D0 04   	BNE $FF40  
0x03FF4C|$0F:$FF3C:A9 08   	LDA #$08   
0x03FF4E|$0F:$FF3E:D0 06   	BNE $FF46  
; control flow target (from $FF3A)
0x03FF50|$0F:$FF40:C9 05   	CMP #$05   
0x03FF52|$0F:$FF42:D0 02   	BNE $FF46  
0x03FF54|$0F:$FF44:A9 06   	LDA #$06   
; control flow target (from $FF3E, $FF42)
0x03FF56|$0F:$FF46:20 BB FF	JSR $FFBB  	; save A to $05F6, X to $43, and load bank specified by A
0x03FF59|$0F:$FF49:68      	PLA        
0x03FF5A|$0F:$FF4A:48      	PHA        
0x03FF5B|$0F:$FF4B:29 E0   	AND #$E0   
0x03FF5D|$0F:$FF4D:AA      	TAX        
0x03FF5E|$0F:$FF4E:68      	PLA        
0x03FF5F|$0F:$FF4F:29 3F   	AND #$3F   
0x03FF61|$0F:$FF51:E0 A0   	CPX #$A0   
0x03FF63|$0F:$FF53:F0 02   	BEQ $FF57  
0x03FF65|$0F:$FF55:29 1F   	AND #$1F   
; control flow target (from $FF53)
0x03FF67|$0F:$FF57:0A      	ASL        
0x03FF68|$0F:$FF58:AA      	TAX        
0x03FF69|$0F:$FF59:60      	RTS        

; external control flow target (from $07:$81E7, $07:$84EC, $07:$8529, $07:$8556)
0x03FF6A|$0F:$FF5A:20 AF C7	JSR $C7AF  
0x03FF6D|$0F:$FF5D:4C 90 FF	JMP $FF90  	; load bank 7

; external control flow target (from $07:$81CE)
0x03FF70|$0F:$FF60:20 4F D1	JSR $D14F  
0x03FF73|$0F:$FF63:4C 90 FF	JMP $FF90  	; load bank 7

; external control flow target (from $07:$8692)
0x03FF76|$0F:$FF66:20 04 C5	JSR $C504  
0x03FF79|$0F:$FF69:4C 90 FF	JMP $FF90  	; load bank 7

; external indirect control flow target (via $07:$8798)
; indirect control flow target
0x03FF7C|$0F:$FF6C:20 C2 E5	JSR $E5C2  
0x03FF7F|$0F:$FF6F:4C 90 FF	JMP $FF90  	; load bank 7

; external indirect control flow target (via $07:$879C)
; indirect control flow target
0x03FF82|$0F:$FF72:20 36 E6	JSR $E636  
0x03FF85|$0F:$FF75:4C 90 FF	JMP $FF90  	; load bank 7

; external indirect control flow target (via $07:$8796)
; indirect control flow target
0x03FF88|$0F:$FF78:20 97 E7	JSR $E797  
0x03FF8B|$0F:$FF7B:4C 90 FF	JMP $FF90  	; load bank 7

; external indirect control flow target (via $07:$879A)
; indirect control flow target
0x03FF8E|$0F:$FF7E:20 B4 E6	JSR $E6B4  
0x03FF91|$0F:$FF81:4C 90 FF	JMP $FF90  	; load bank 7

; external control flow target (from $07:$8231, $07:$8242, $07:$8278, $07:$8330, $07:$835F, $07:$8374, $07:$8385, $07:$83FB, $07:$849C, $07:$84D5, $07:$84F6, $07:$8503, $07:$851C, $07:$8533, $07:$8560, $07:$857F, $07:$85EE, $07:$8776)
0x03FF94|$0F:$FF84:20 D2 CC	JSR $CCD2  	; execute scripted motion
0x03FF97|$0F:$FF87:4C 90 FF	JMP $FF90  	; load bank 7

; external control flow target (from $07:$8291, $07:$82B1, $07:$82DC, $07:$856B, $07:$85AC, $07:$85E4, $07:$8651, $07:$8675, $07:$86E2, $07:$8712)
0x03FF9A|$0F:$FF8A:20 CB D8	JSR $D8CB  
0x03FF9D|$0F:$FF8D:4C 90 FF	JMP $FF90  	; load bank 7

; load bank 7
; control flow target (from $FF5D, $FF63, $FF69, $FF6F, $FF75, $FF7B, $FF81, $FF87, $FF8D)
0x03FFA0|$0F:$FF90:A9 07   	LDA #$07   
0x03FFA2|$0F:$FF92:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x03FFA4|$0F:$FF94:4C C2 F6	JMP $F6C2  	; load bank specified by $94


; code -> free
0x03FFA7|$0F:$FF97:FF
; ... skipping $21 FF bytes
0x03FFC9|$0F:$FFB9:FF

; free -> data
; data load target (from $D37A)
0x03FFCA|$0F:$FFBA:FF

; data -> code
; save A to $05F6, X to $43, and load bank specified by A
; control flow target (from $C3D5, $FEBD, $FEED, $FF46)
0x03FFCB|$0F:$FFBB:8D F6 05	STA $05F6  	; current bank
0x03FFCE|$0F:$FFBE:86 43   	STX $43    
; load bank specified by A
; control flow target (from $C3D9)
0x03FFD0|$0F:$FFC0:78      	SEI        
0x03FFD1|$0F:$FFC1:8D FF FF	STA $FFFF  
0x03FFD4|$0F:$FFC4:4A      	LSR        
0x03FFD5|$0F:$FFC5:8D FF FF	STA $FFFF  
0x03FFD8|$0F:$FFC8:4A      	LSR        
0x03FFD9|$0F:$FFC9:8D FF FF	STA $FFFF  
0x03FFDC|$0F:$FFCC:4A      	LSR        
0x03FFDD|$0F:$FFCD:8D FF FF	STA $FFFF  
0x03FFE0|$0F:$FFD0:4A      	LSR        
0x03FFE1|$0F:$FFD1:8D FF FF	STA $FFFF  
0x03FFE4|$0F:$FFD4:EA      	NOP        
0x03FFE5|$0F:$FFD5:EA      	NOP        
0x03FFE6|$0F:$FFD6:60      	RTS        

; reset vector
; indirect control flow target (via $FFFC)
0x03FFE7|$0F:$FFD7:78      	SEI        
0x03FFE8|$0F:$FFD8:EE DE FF	INC $FFDE  	; #$80; used to reset MMC1 shift register and switch to last-fixed-bank mode
0x03FFEB|$0F:$FFDB:4C AF C5	JMP $C5AF  	; reset vector handler


; code -> data
; #$80; used to reset MMC1 shift register and switch to last-fixed-bank mode
; data load target (from $C60B, $FFD8)
0x03FFEE|$0F:$FFDE:80

; data -> unknown
0x03FFEF|$0F:$FFDF:44      	; INVALID OPCODE
0x03FFF0|$0F:$FFE0:52      	; INVALID OPCODE
0x03FFF1|$0F:$FFE1:41 47   	; EOR ($47,X)
0x03FFF2|$0F:$FFE2:47      	; INVALID OPCODE
0x03FFF3|$0F:$FFE3:4F      	; INVALID OPCODE
0x03FFF4|$0F:$FFE4:4E 20 57	; LSR $5720  
0x03FFF5|$0F:$FFE5:20 57 41	; JSR $4157  
0x03FFF6|$0F:$FFE6:57      	; INVALID OPCODE
0x03FFF7|$0F:$FFE7:41 52   	; EOR ($52,X)
0x03FFF8|$0F:$FFE8:52      	; INVALID OPCODE
0x03FFF9|$0F:$FFE9:52      	; INVALID OPCODE
0x03FFFA|$0F:$FFEA:49 4F   	; EOR #$4F   
0x03FFFB|$0F:$FFEB:4F      	; INVALID OPCODE
0x03FFFC|$0F:$FFEC:52      	; INVALID OPCODE
0x03FFFD|$0F:$FFED:20 49 49	; JSR $4949  
0x03FFFE|$0F:$FFEE:49 49   	; EOR #$49   
0x03FFFF|$0F:$FFEF:49 C7   	; EOR #$C7   
0x040000|$0F:$FFF0:C7      	; INVALID OPCODE
0x040001|$0F:$FFF1:AA      	; TAX        
0x040002|$0F:$FFF2:00      	; BRK        
0x040003|$0F:$FFF3:00      	; BRK        
0x040004|$0F:$FFF4:48      	; PHA        
0x040005|$0F:$FFF5:04      	; INVALID OPCODE
0x040006|$0F:$FFF6:01 0F   	; ORA ($0F,X)
0x040007|$0F:$FFF7:0F      	; INVALID OPCODE
0x040008|$0F:$FFF8:07      	; INVALID OPCODE
0x040009|$0F:$FFF9:9D 00 C0	; STA $C000,X

; unknown -> data
0x04000A|$0F:$FFFA:00 C0	; $0F:$C000; NMI vector
0x04000C|$0F:$FFFC:D7 FF	; $0F:$FFD7; reset vector
0x04000E|$0F:$FFFE:AB C5	; $0F:$C5AB; IRQ/BRK vector handler