Dragon Warrior II (NES)/ROM map/ASM bank 06: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(No difference)

Revision as of 21:09, 28 January 2024

This is a sub-page of Dragon Warrior II (NES)/ROM map.

bank 0x06 of 16 starts at file address 0x018010
; code bytes:	$2F06 (73.47% of bytes in this ROM bank)
; data bytes:	$10B1 (26.08% 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:	$0021 (0.20% of bytes in this ROM bank)
; unknown bytes:	$0028 (0.24% of bytes in this ROM bank)
; $3FB7 bytes last seen in RAM bank $8000 - $BFFF (100.00% of bytes seen in this ROM bank, 99.55% of bytes in this ROM bank):
;	$2F06 code bytes (73.80% of bytes seen in this RAM bank, 73.47% of bytes in this ROM bank)
;	$10B1 data bytes (26.20% of bytes seen in this RAM bank, 26.08% of bytes in this ROM bank)

; PRG Bank 0x06: handlers for main COMMAND menu options (TALK, SPELL, STATUS, ITEM, SEARCH, and EQUIP) including pretty much anything that is required input to or happens as a result of those commands; also includes code and data for gluing together irregularly shaped dungeon maps, starting and saving a game, text for items/spells/monster names, and the ending sequence

; [bank start] -> data
; possible external indexed data load target (from $0F:$F3ED, $0F:$FF28)
; external indirect data load target (via $08:$80CC, $0A:$80F5, $0A:$813E, $0F:$F052, $0F:$F83D)
0x018010|$06:$8000:12
; possible external indexed data load target (from $0F:$F3F2, $0F:$FF2D)
0x018011|$06:$8001:   A6	; $06:$A612
; indirect data load target (via $B0A8)
; external indirect data load target (via $02:$B74E, $0F:$FD25, $0F:$FD98)
0x018012|$06:$8002:09 A8	; $06:$A809
; -> $06:$A843: display and handle main game menu
; external indirect data load target (via $0F:$C6C7)
0x018014|$06:$8004:43 A8	; $06:$A843; display and handle main game menu
; -> $06:$ABC7: copy save data from save data buffer at $7000 to system RAM; update Don Mahone quest status if applicable
; external indirect data load target (via $0F:$C6F9)
0x018016|$06:$8006:C7 AB	; $06:$ABC7; copy save data from save data buffer at $7000 to system RAM; update Don Mahone quest status if applicable
; external indirect data load target (via $0F:$D15F, $0F:$D171)
0x018018|$06:$8008:5F A8	; $06:$A85F
; -> $06:$A896: copy Midenhall's full name from save slot in $75DB to $0100 in reverse
; external indirect data load target (via $0F:$EF5B)
0x01801A|$06:$800A:96 A8	; $06:$A896; copy Midenhall's full name from save slot in $75DB to $0100 in reverse
; -> $06:$A8AA: given current game save slot in $75DB, return Midenhall's level in that save game in A/$0E
; external indirect data load target (via $0F:$EE09)
0x01801C|$06:$800C:AA A8	; $06:$A8AA; given current game save slot in $75DB, return Midenhall's level in that save game in A/$0E
0x01801E|$06:$800E:B7 A8	; $06:$A8B7
; -> $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
; external indirect data load target (via $0F:$F4E6, $0F:$F5E4, $0F:$F614)
0x018020|$06:$8010:FC AD	; $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
; -> $06:$AE30: given hero ID - 1 in $4A and field spell menu selection index in A, return spell ID in A
; external indirect data load target (via $0F:$F5FA)
0x018022|$06:$8012:30 AE	; $06:$AE30; given hero ID - 1 in $4A and field spell menu selection index in A, return spell ID in A
; -> $06:$AE3D: given hero ID - 1 in $4A and battle spell menu selection index in A, return spell ID in A
; external indirect data load target (via $0F:$F4AC)
0x018024|$06:$8014:3D AE	; $06:$AE3D; given hero ID - 1 in $4A and battle spell menu selection index in A, return spell ID in A
0x018026|$06:$8016:86 AE	; $06:$AE86
; external indirect data load target (via $0F:$F0BF)
0x018028|$06:$8018:7F AF	; $06:$AF7F
0x01802A|$06:$801A:8E AF	; $06:$AF8E
; -> $06:$A88F: copy Midenhall's short name from save slot in A to $0100 in reverse
; external indirect data load target (via $0F:$EE7E)
0x01802C|$06:$801C:8F A8	; $06:$A88F; copy Midenhall's short name from save slot in A to $0100 in reverse
; -> $06:$A885: copy save data from system RAM to per-game save data
; external indirect data load target (via $0F:$C6DA)
0x01802E|$06:$801E:85 A8	; $06:$A885; copy save data from system RAM to per-game save data
; -> $06:$AE4A: given spell ID in A, set A to spell name index
; external indirect data load target (via $02:$BEA4)
0x018030|$06:$8020:4A AE	; $06:$AE4A; given spell ID in A, set A to spell name index
; -> $06:$B2CA: Item list part 1, line 1
; external indirect data load target (via $0F:$F316)
0x018032|$06:$8022:CA B2	; $06:$B2CA; Item list part 1, line 1
; -> $06:$B4B2: Item list part 1, line 2
; external indirect data load target (via $0F:$F317)
0x018034|$06:$8024:B2 B4	; $06:$B4B2; Item list part 1, line 2
; -> $06:$B624: Spell name list
; data load target (from $F3AB)
0x018036|$06:$8026:24 B6	; $06:$B624; Spell name list
; -> $06:$B718: Monster list part 1, line 1
; external indirect data load target (via $0F:$F3DE)
0x018038|$06:$8028:18 B7	; $06:$B718; Monster list part 1, line 1
; -> $06:$B945: Monster list part 1, line 2
; external indirect data load target (via $0F:$F3DF)
0x01803A|$06:$802A:45 B9	; $06:$B945; Monster list part 1, line 2
0x01803C|$06:$802C:43 BA	; $06:$BA43; 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 during battle where there is no main COMMAND menu
0x01803E|$06:$802E:83 BA	; $06:$BA83
; -> $06:$B3BE: Item list part 2, line 1
; external indirect data load target (via $0F:$F318)
0x018040|$06:$8030:BE B3	; $06:$B3BE; Item list part 2, line 1
; -> $06:$B57C: Item list part 2, line 2
; external indirect data load target (via $0F:$F319)
0x018042|$06:$8032:7C B5	; $06:$B57C; Item list part 2, line 2
; -> $06:$B85E: Monster list part 2, line 1
; external indirect data load target (via $0F:$F3E0)
0x018044|$06:$8034:5E B8	; $06:$B85E; Monster list part 2, line 1
; -> $06:$B9D5: Monster list part 2, line 2
; external indirect data load target (via $0F:$F3E1)
0x018046|$06:$8036:D5 B9	; $06:$B9D5; Monster list part 2, line 2
; external indirect data load target (via $0F:$C897)
0x018048|$06:$8038:3D BB	; $06:$BB3D
; external indirect data load target (via $0F:$C889)
0x01804A|$06:$803A:A3 BA	; $06:$BAA3
0x01804C|$06:$803C:1A A6	; $06:$A61A
; external indirect data load target (via $0F:$D359)
0x01804E|$06:$803E:3D BC	; $06:$BC3D
; external indirect data load target (via $0F:$CC9E)
0x018050|$06:$8040:8D BC	; $06:$BC8D
0x018052|$06:$8042:E1 A3	; $06:$A3E1; pointers to warp spaces for irregularly-shaped maps
; external indirect data load target (via $0F:$D2FA)
0x018054|$06:$8044:96 BD	; $06:$BD96
; -> $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
; external indirect data load target (via $0F:$D2EA)
0x018056|$06:$8046:ED BE	; $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
; control flow target (from $8056)
; external control flow target (from $0F:$C70F)
; call to code in a different bank ($0F:$C1DC)
0x018058|$06:$8048:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x01805B|$06:$804B:A5 03   	LDA $03    	; game clock?
0x01805D|$06:$804D:29 0F   	AND #$0F   
0x01805F|$06:$804F:C9 01   	CMP #$01   
0x018061|$06:$8051:F0 06   	BEQ $8059  
; call to code in a different bank ($0F:$CF64)
0x018063|$06:$8053:20 64 CF	JSR $CF64  
0x018066|$06:$8056:4C 48 80	JMP $8048  

; control flow target (from $8051)
0x018069|$06:$8059:A9 FF   	LDA #$FF   
0x01806B|$06:$805B:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x01806D|$06:$805D:A9 06   	LDA #$06   
0x01806F|$06:$805F:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
; call to code in a different bank ($0F:$EB76)
0x018071|$06:$8061:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018074|$06:$8064:00	; Menu ID #$00: Mini status window, bottom

; data -> code
; call to code in a different bank ($0F:$EB76)
0x018075|$06:$8065:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018078|$06:$8068:06	; Menu ID #$06: Map menu: main COMMAND menu

; data -> code
0x018079|$06:$8069:C9 FF   	CMP #$FF   
0x01807B|$06:$806B:D0 0A   	BNE $8077  	; given a main COMMAND menu selection index in A, execute the handler for that menu function
; exit COMMAND menu
; control flow target (from $809A, $89D1, $8A09, $8B0C, $8B3D, $8B9F, $9545, $9558)
0x01807D|$06:$806D:A9 01   	LDA #$01   
; call to code in a different bank ($0F:$CF6A)
0x01807F|$06:$806F:20 6A CF	JSR $CF6A  	; wipe selected menu region
0x018082|$06:$8072:A9 00   	LDA #$00   
0x018084|$06:$8074:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x018086|$06:$8076:60      	RTS        

; given a main COMMAND menu selection index in A, execute the handler for that menu function
; control flow target (from $806B)
0x018087|$06:$8077:0A      	ASL        
0x018088|$06:$8078:A8      	TAY        
0x018089|$06:$8079:B9 86 80	LDA $8086,Y	; COMMAND menu command handler pointers
0x01808C|$06:$807C:85 0C   	STA $0C    
0x01808E|$06:$807E:B9 87 80	LDA $8087,Y
0x018091|$06:$8081:85 0D   	STA $0D    
0x018093|$06:$8083:6C 0C 00	JMP ($000C)


; code -> data
; COMMAND menu command handler pointers
; indexed data load target (from $8079)
0x018096|$06:$8086:A8
; indexed data load target (from $807E)
0x018097|$06:$8087:   80	; $06:$80A8; COMMAND menu TALK command handler
0x018098|$06:$8088:36 8B	; $06:$8B36; COMMAND menu SPELL command handler
0x01809A|$06:$808A:CA 89	; $06:$89CA; COMMAND menu STATUS command handler
0x01809C|$06:$808C:5B 95	; $06:$955B; COMMAND menu ITEM command handler
0x01809E|$06:$808E:17 9B	; $06:$9B17; COMMAND menu SEARCH handler
0x0180A0|$06:$8090:02 8A	; $06:$8A02; COMMAND menu EQUIP handler

; data -> code
; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu
; control flow target (from $80BC, $80C7, $80DA, $80F3, $8139, $816F, $81AF, $8295, $82A0, $82C0, $82D2, $8385, $83B6, $8567, $86D2, $89FF, $8AFC, $8B52, $8B66, $8B87, $8C00, $8C2D, $8C91, $8C9C, $8F4B, $8F67)
0x0180A2|$06:$8092:20 9D 80	JSR $809D  	; wait until all joypad buttons are released and then some button pressed
; wipe menus and exit COMMAND menu
; control flow target (from $80E8, $9071, $90C9, $91C3, $9345)
0x0180A5|$06:$8095:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$CF6A)
0x0180A7|$06:$8097:20 6A CF	JSR $CF6A  	; wipe selected menu region
0x0180AA|$06:$809A:4C 6D 80	JMP $806D  	; exit COMMAND menu

; wait until all joypad buttons are released and then some button pressed
; control flow target (from $8092, $80A0, $89D9, $89F2, $954D, $A257)
; call to code in a different bank ($0F:$D13D)
0x0180AD|$06:$809D:20 3D D1	JSR $D13D  	; wait for interrupt, read joypad data into $2F and A
0x0180B0|$06:$80A0:D0 FB   	BNE $809D  	; wait until all joypad buttons are released and then some button pressed; loop until no buttons pressed
; control flow target (from $80A5)
; call to code in a different bank ($0F:$D13D)
0x0180B2|$06:$80A2:20 3D D1	JSR $D13D  	; wait for interrupt, read joypad data into $2F and A
0x0180B5|$06:$80A5:F0 FB   	BEQ $80A2  	; loop until some button pressed
0x0180B7|$06:$80A7:60      	RTS        

; COMMAND menu TALK command handler
; indirect control flow target (via $8086)
0x0180B8|$06:$80A8:AD 40 05	LDA $0540  	; NPC #$00 ? + direction nybble
0x0180BB|$06:$80AB:29 03   	AND #$03   
; call to code in a different bank ($0F:$CF70)
0x0180BD|$06:$80AD:20 70 CF	JSR $CF70  	; -> $02:$B141
0x0180C0|$06:$80B0:A5 D0   	LDA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x0180C2|$06:$80B2:10 0B   	BPL $80BF  	; pre-Malroth dialogue
0x0180C4|$06:$80B4:AD F3 05	LDA $05F3  	; target NPC sprite ID; post-Malroth, most dialogue becomes based on NPC sprite ID
0x0180C7|$06:$80B7:F0 0A   	BEQ $80C3  	; no sprite ID => nobody to talk to
; call to code in a different bank ($0F:$D334)
0x0180C9|$06:$80B9:20 34 D3	JSR $D334  	; post-Malroth dialogue
0x0180CC|$06:$80BC:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; pre-Malroth dialogue
; control flow target (from $80B2)
0x0180CF|$06:$80BF:A5 0C   	LDA $0C    	; dialogue ID
0x0180D1|$06:$80C1:D0 07   	BNE $80CA  	; #$00 => nobody to talk to
; control flow target (from $80B7, $8216)
; call to code in a different bank ($0F:$F6F0)
0x0180D3|$06:$80C3:20 F0 F6	JSR $F6F0  	; open main dialogue window and display string ID specified by byte following JSR + #$0100

; code -> data
; indirect data load target
0x0180D6|$06:$80C6:00	; String ID #$0100: No one is in that direction.[end-FC]

; data -> code
0x0180D7|$06:$80C7:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $80C1)
0x0180DA|$06:$80CA:C9 D7   	CMP #$D7   
0x0180DC|$06:$80CC:D0 0F   	BNE $80DD  
0x0180DE|$06:$80CE:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0180E1|$06:$80D1:A9 00   	LDA #$00   	; Midenhall; useless since string doesn't use [name] control code
; call to code in a different bank ($0F:$FC50)
0x0180E3|$06:$80D3:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2A)
0x0180E6|$06:$80D6:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x0180E9|$06:$80D9:76	; String ID #$0076: ‘Go now, my heir! Our fate is now in thy hands[.’][end-FC]

; data -> code
0x0180EA|$06:$80DA:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $80CC)
0x0180ED|$06:$80DD:C9 D9   	CMP #$D9   
0x0180EF|$06:$80DF:D0 0A   	BNE $80EB  
; call to code in a different bank ($0F:$F6F6)
0x0180F1|$06:$80E1: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
0x0180F4|$06:$80E4:9A	; String ID #$029A: ‘Would thou allow me to escape and tell Hargon many tidings?’[wait][line]‘Oh, but thou art such a fool[.’][wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$D1E5)
0x0180F5|$06:$80E5:20 E5 D1	JSR $D1E5  	; trigger Fixed Battle #$01: 1 Evil Clown (Map ID #$04: Midenhall B1)
0x0180F8|$06:$80E8:4C 95 80	JMP $8095  	; wipe menus and exit COMMAND menu

; control flow target (from $80DF)
0x0180FB|$06:$80EB:C9 D8   	CMP #$D8   
0x0180FD|$06:$80ED:D0 07   	BNE $80F6  
; call to code in a different bank ($0F:$F6EA)
0x0180FF|$06:$80EF:20 EA F6	JSR $F6EA  	; open main dialogue window and display string ID specified by byte following JSR

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

; data -> code
0x018103|$06:$80F3:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $80ED)
0x018106|$06:$80F6:C9 01   	CMP #$01   
0x018108|$06:$80F8:D0 62   	BNE $815C  
0x01810A|$06:$80FA:20 CB 9A	JSR $9ACB  	; open dialogue window
0x01810D|$06:$80FD:A9 01   	LDA #$01   	; Cannock; useless since string doesn't use [name] control code
; call to code in a different bank ($0F:$FC50)
0x01810F|$06:$80FF:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018112|$06:$8102:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018115|$06:$8105:55	; String ID #$0155: ‘Hail, friend! I am Prince [name] of Cannock[.’][wait][end-FC]

; data -> code
0x018116|$06:$8106:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$FC50)
0x018118|$06:$8108:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01811B|$06:$810B:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01811E|$06:$810E:56	; String ID #$0156: ‘Art thou my cousin from Midenhall? Ah, it is as I guessed[.’][wait][line]‘I have been seeking thee so that together we may oppose Hargon[.’][wait][line]‘Come, let us go forth[.’][end-FC]

; data -> code
0x01811F|$06:$810F:A9 07   	LDA #$07   	; Music ID #$07: add party member BGM
; call to code in a different bank ($0F:$C58D)
0x018121|$06:$8111:20 8D C5	JSR $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
0x018124|$06:$8114:AD C0 05	LDA $05C0  	; NPC #$10 motion nybble + direction nybble
0x018127|$06:$8117:29 03   	AND #$03   
0x018129|$06:$8119:0A      	ASL        
0x01812A|$06:$811A:0A      	ASL        
0x01812B|$06:$811B:0A      	ASL        
0x01812C|$06:$811C:AA      	TAX        
0x01812D|$06:$811D:A0 00   	LDY #$00   
; control flow target (from $8129)
0x01812F|$06:$811F:BD 3C 81	LDA $813C,X
0x018132|$06:$8122:99 42 05	STA $0542,Y	; NPC #$00 ?
0x018135|$06:$8125:C8      	INY        
0x018136|$06:$8126:E8      	INX        
0x018137|$06:$8127:C0 08   	CPY #$08   
0x018139|$06:$8129:D0 F4   	BNE $811F  
0x01813B|$06:$812B:A9 84   	LDA #$84   	; add Cannock to party
0x01813D|$06:$812D:8D 3F 06	STA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018140|$06:$8130:A9 FF   	LDA #$FF   
0x018142|$06:$8132:8D C1 05	STA $05C1  	; NPC #$10 sprite ID
0x018145|$06:$8135:A9 03   	LDA #$03   
0x018147|$06:$8137:85 CA   	STA $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)
0x018149|$06:$8139:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu


; code -> data
; indexed data load target (from $811F, $817D)
0x01814C|$06:$813C:80 7F 00 01 00 00 00 01
0x018154|$06:$8144:70 6F FF 00 00 00 01 01
0x01815C|$06:$814C:80 5F 00 FF 00 00 02 01
0x018164|$06:$8154:90 6F 01 00 00 00 03 01

; data -> code
; control flow target (from $80F8)
0x01816C|$06:$815C:C9 02   	CMP #$02   
0x01816E|$06:$815E:D0 42   	BNE $81A2  
0x018170|$06:$8160:20 CB 9A	JSR $9ACB  	; open dialogue window
; call to code in a different bank ($0F:$FA32)
0x018173|$06:$8163:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018176|$06:$8166:A8	; String ID #$02A8: ‘Woof-woof!’[end-FC]

; data -> code
0x018177|$06:$8167:20 72 81	JSR $8172  
0x01817A|$06:$816A:A9 09   	LDA #$09   	; Sprite ID $#09: Dog
0x01817C|$06:$816C:8D 51 05	STA $0551  	; NPC #$02 sprite ID
0x01817F|$06:$816F:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $8167, $9727)
0x018182|$06:$8172:AD 58 05	LDA $0558  	; NPC #$03 motion nybble + direction nybble
0x018185|$06:$8175:29 03   	AND #$03   
0x018187|$06:$8177:0A      	ASL        
0x018188|$06:$8178:0A      	ASL        
0x018189|$06:$8179:0A      	ASL        
0x01818A|$06:$817A:AA      	TAX        
0x01818B|$06:$817B:A0 00   	LDY #$00   
; control flow target (from $8187)
0x01818D|$06:$817D:BD 3C 81	LDA $813C,X
0x018190|$06:$8180:99 4A 05	STA $054A,Y	; NPC #$01 scripted motion low byte
0x018193|$06:$8183:C8      	INY        
0x018194|$06:$8184:E8      	INX        
0x018195|$06:$8185:C0 08   	CPY #$08   
0x018197|$06:$8187:D0 F4   	BNE $817D  
0x018199|$06:$8189:A9 FF   	LDA #$FF   
0x01819B|$06:$818B:8D 59 05	STA $0559  	; NPC #$03 sprite ID
0x01819E|$06:$818E:A0 08   	LDY #$08   
0x0181A0|$06:$8190:4C 93 81	JMP $8193  	; useless op

; control flow target (from $8190)
0x0181A3|$06:$8193:20 97 81	JSR $8197  
0x0181A6|$06:$8196:C8      	INY        
; control flow target (from $8193)
0x0181A7|$06:$8197:B9 44 05	LDA $0544,Y	; NPC #$01 ?
0x0181AA|$06:$819A:38      	SEC        
0x0181AB|$06:$819B:F9 3C 05	SBC $053C,Y	; NPC #$00 ?
0x0181AE|$06:$819E:99 44 05	STA $0544,Y	; NPC #$01 ?
0x0181B1|$06:$81A1:60      	RTS        

; control flow target (from $815E)
0x0181B2|$06:$81A2:C9 03   	CMP #$03   
0x0181B4|$06:$81A4:D0 0C   	BNE $81B2  
; call to code in a different bank ($0F:$F6F6)
0x0181B6|$06:$81A6: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
0x0181B9|$06:$81A9:4D	; String ID #$024D: ‘I bid thee welcome to Wellgarth Town[.’][wait][line]‘I shall sing for thee[.’][end-FC]

; data -> code
0x0181BA|$06:$81AA:A9 0C   	LDA #$0C   	; Music ID #$0C: game menu / Wellgarth singer BGM
; call to code in a different bank ($0F:$C561)
0x0181BC|$06:$81AC:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x0181BF|$06:$81AF:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $81A4)
0x0181C2|$06:$81B2:C9 04   	CMP #$04   
0x0181C4|$06:$81B4:D0 03   	BNE $81B9  
0x0181C6|$06:$81B6:4C 34 97	JMP $9734  	; unused since no NPC has dialogue ID #$04

; control flow target (from $81B4)
0x0181C9|$06:$81B9:C9 05   	CMP #$05   
0x0181CB|$06:$81BB:D0 08   	BNE $81C5  
0x0181CD|$06:$81BD:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0181D0|$06:$81C0:A9 06   	LDA #$06   	; Save Point ID #$06: Hamlin
0x0181D2|$06:$81C2:4C E3 93	JMP $93E3  	; update save point $48 to A, run through the whole save point sequence

; control flow target (from $81BB)
0x0181D5|$06:$81C5:C9 0A   	CMP #$0A   	; useless op
0x0181D7|$06:$81C7:B0 00   	BCS $81C9  	; useless op
; control flow target (from $81C7)
0x0181D9|$06:$81C9:C9 14   	CMP #$14   
0x0181DB|$06:$81CB:B0 03   	BCS $81D0  
0x0181DD|$06:$81CD:4C 19 82	JMP $8219  	; handler for dialogue IDs #$0A-#$13 (Innkeepers)

; control flow target (from $81CB)
0x0181E0|$06:$81D0:C9 1C   	CMP #$1C   
0x0181E2|$06:$81D2:B0 03   	BCS $81D7  
0x0181E4|$06:$81D4:4C AD 82	JMP $82AD  	; handler for dialogue IDs #$14-#$1B (Weapon Shops)

; control flow target (from $81D2)
0x0181E7|$06:$81D7:C9 27   	CMP #$27   
0x0181E9|$06:$81D9:B0 03   	BCS $81DE  
0x0181EB|$06:$81DB:4C 9A 83	JMP $839A  	; handler for dialogue IDs #$1C-#$26 (Item Shops)

; control flow target (from $81D9)
0x0181EE|$06:$81DE:C9 28   	CMP #$28   
0x0181F0|$06:$81E0:B0 03   	BCS $81E5  
0x0181F2|$06:$81E2:4C 4E 85	JMP $854E  	; handler for dialogue ID #$27 (House of Healing)

; control flow target (from $81E0)
0x0181F5|$06:$81E5:C9 29   	CMP #$29   
0x0181F7|$06:$81E7:B0 03   	BCS $81EC  
0x0181F9|$06:$81E9:4C C0 86	JMP $86C0  	; handler for dialogue ID #$28 (Lottery)

; control flow target (from $81E7)
0x0181FC|$06:$81EC:C9 95   	CMP #$95   
0x0181FE|$06:$81EE:B0 03   	BCS $81F3  
0x018200|$06:$81F0:4C 06 8E	JMP $8E06  	; handler for dialogue IDs #$29-#$94 (open dialogue window and display string specified by A + #$1D7, i.e. String IDs #$0200-#$026B)

; control flow target (from $81EE)
0x018203|$06:$81F3:C9 9D   	CMP #$9D   
0x018205|$06:$81F5:B0 03   	BCS $81FA  
0x018207|$06:$81F7:4C 44 8E	JMP $8E44  	; handler for dialogue IDs #$95-#$9C (open dialogue window, display string specified by A + #$1D9, display YES/NO menu, and display string corresponding to selected option)

; control flow target (from $81F5)
0x01820A|$06:$81FA:C9 C3   	CMP #$C3   
0x01820C|$06:$81FC:B0 03   	BCS $8201  
0x01820E|$06:$81FE:4C 6A 8E	JMP $8E6A  	; handler for dialogue IDs #$9D-#$C2 (town NPCs with complex logic)

; control flow target (from $81FC)
0x018211|$06:$8201:C9 CD   	CMP #$CD   
0x018213|$06:$8203:B0 03   	BCS $8208  
0x018215|$06:$8205:4C B0 94	JMP $94B0  	; handler for dialogue IDs #$C3-#$CC (open dialogue window and display string specified by A - #$73)

; control flow target (from $8203)
0x018218|$06:$8208:C9 D0   	CMP #$D0   
0x01821A|$06:$820A:B0 03   	BCS $820F  
0x01821C|$06:$820C:4C BE 94	JMP $94BE  	; handler for dialogue IDs #$CD-#$CF (open dialogue window, display string specified by A - #$73, display YES/NO menu, and display string corresponding to selected option)

; control flow target (from $820A)
0x01821F|$06:$820F:C9 D9   	CMP #$D9   
0x018221|$06:$8211:B0 03   	BCS $8216  
0x018223|$06:$8213:4C E4 94	JMP $94E4  	; handler for dialogue IDs #$D0-#$D8 (dungeon NPCs with complex logic)

; control flow target (from $8211)
0x018226|$06:$8216:4C C3 80	JMP $80C3  	; unused since #$D9 was handled earlier and no NPC has dialogue ID > #$D9

; handler for dialogue IDs #$0A-#$13 (Innkeepers)
; control flow target (from $81CD)
0x018229|$06:$8219:38      	SEC        
0x01822A|$06:$821A:E9 0A   	SBC #$0A   	; convert to zero-based
0x01822C|$06:$821C:85 49   	STA $49    	; object hero/target/item/string ID $49
0x01822E|$06:$821E:A8      	TAY        
0x01822F|$06:$821F:B9 80 9F	LDA $9F80,Y	; Inn prices per party member
0x018232|$06:$8222:48      	PHA        	; Inn price per party member
; call to code in a different bank ($0F:$F6CE)
0x018233|$06:$8223:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x018236|$06:$8226:85 0C   	STA $0C    	; number of party members - 1
0x018238|$06:$8228:E6 0C   	INC $0C    	; number of party members
0x01823A|$06:$822A:68      	PLA        	; Inn price per party member
0x01823B|$06:$822B:20 AC 86	JSR $86AC  	; multiply A by $0C, store results in ($10-$11) and ($8F-$90); consumes $0C
; call to code in a different bank ($0F:$F6F0)
0x01823E|$06:$822E:20 F0 F6	JSR $F6F0  	; open main dialogue window and display string ID specified by byte following JSR + #$0100

; code -> data
; indirect data load target
0x018241|$06:$8231:7B	; String ID #$017B: ‘Welcome to the Village Inn[.’][wait][line]‘It's only [number] piece[(s)] of gold for the night.[line]Dost thou want a room?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$EB76)
0x018242|$06:$8232:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018245|$06:$8235:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
0x018246|$06:$8236:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018249|$06:$8239:C9 00   	CMP #$00   	; YES
0x01824B|$06:$823B:D0 5F   	BNE $829C  
0x01824D|$06:$823D:20 31 8D	JSR $8D31  	; given gold amount in $8F-$90, decrease party gold by that amount and SEC if possible, CLC otherwise
0x018250|$06:$8240:90 56   	BCC $8298  
; call to code in a different bank ($0F:$EB76)
0x018252|$06:$8242:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018255|$06:$8245:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
; call to code in a different bank ($0F:$FA2E)
0x018256|$06:$8246:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018259|$06:$8249:7E	; String ID #$017E: ‘Sleep well[.’][FD][FD][end-FC]

; data -> code
0x01825A|$06:$824A:A2 14   	LDX #$14   
; call to code in a different bank ($0F:$C1EE)
0x01825C|$06:$824C:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x01825F|$06:$824F:A9 FF   	LDA #$FF   
0x018261|$06:$8251:85 0D   	STA $0D    
; call to code in a different bank ($0F:$C2EB)
0x018263|$06:$8253:20 EB C2	JSR $C2EB  
0x018266|$06:$8256:A9 01   	LDA #$01   	; Music ID #$01: Inn BGM
; call to code in a different bank ($0F:$C58D)
0x018268|$06:$8258:20 8D C5	JSR $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
0x01826B|$06:$825B:20 CC 8D	JSR $8DCC  	; restore full HP to all living party members
0x01826E|$06:$825E:20 EC 8D	JSR $8DEC  	; restore full MP to all living party members
0x018271|$06:$8261:A4 49   	LDY $49    	; object hero/target/item/string ID $49
0x018273|$06:$8263:B9 A3 82	LDA $82A3,Y	; party direction after sleeping at inn (bits 0-1 = Cannock and Moonbrooke direction, 2-3 = Midenhall direction)
0x018276|$06:$8266:29 03   	AND #$03   
0x018278|$06:$8268:18      	CLC        
0x018279|$06:$8269:69 05   	ADC #$05   
0x01827B|$06:$826B:85 45   	STA $45    
; call to code in a different bank ($0F:$CF76)
0x01827D|$06:$826D:20 76 CF	JSR $CF76  
0x018280|$06:$8270:A4 49   	LDY $49    	; object hero/target/item/string ID $49
0x018282|$06:$8272:B9 A3 82	LDA $82A3,Y	; party direction after sleeping at inn (bits 0-1 = Cannock and Moonbrooke direction, 2-3 = Midenhall direction)
0x018285|$06:$8275:4A      	LSR        
0x018286|$06:$8276:4A      	LSR        
0x018287|$06:$8277:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
; call to code in a different bank ($0F:$CF64)
0x01828A|$06:$827A:20 64 CF	JSR $CF64  
0x01828D|$06:$827D:A0 00   	LDY #$00   
; control flow target (from $8288)
0x01828F|$06:$827F:B9 E6 C2	LDA $C2E6,Y
0x018292|$06:$8282:99 0D 00	STA $000D,Y
0x018295|$06:$8285:C8      	INY        
0x018296|$06:$8286:C0 05   	CPY #$05   
0x018298|$06:$8288:D0 F5   	BNE $827F  
; call to code in a different bank ($0F:$C2DE)
0x01829A|$06:$828A:20 DE C2	JSR $C2DE  
; call to code in a different bank ($0F:$FA2E)
0x01829D|$06:$828D:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0182A0|$06:$8290:7F	; String ID #$017F: ‘Ah, good morning.[line]I trust thou art well rested[.’][wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$FA2E)
0x0182A1|$06:$8291:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0182A4|$06:$8294:80	; String ID #$0180: ‘Goodbye[.’][end-FC]

; data -> code
0x0182A5|$06:$8295:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $8240)
; call to code in a different bank ($0F:$FA2E)
0x0182A8|$06:$8298:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0182AB|$06:$829B:7D	; String ID #$017D: ‘Sorry, thou hasn't enough gold[.’][wait][end-FC]

; data -> code
; control flow target (from $823B)
; call to code in a different bank ($0F:$FA2E)
0x0182AC|$06:$829C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0182AF|$06:$829F:7C	; String ID #$017C: ‘Farewell, stranger[.’][end-FC]

; data -> code
0x0182B0|$06:$82A0:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu


; code -> data
; party direction after sleeping at inn (bits 0-1 = Cannock and Moonbrooke direction, 2-3 = Midenhall direction)
; indexed data load target (from $8263, $8272)
0x0182B3|$06:$82A3:04	; Inn ID #$00, Map IDs #$00/#$03: Fake Midenhall/Midenhall 1F
0x0182B4|$06:$82A4:04	; Inn ID #$01, Map ID #$05: Leftwyne
0x0182B5|$06:$82A5:0E	; Inn ID #$02, Map ID #$06: Cannock
0x0182B6|$06:$82A6:0C	; Inn ID #$03, Map ID #$07: Hamlin
0x0182B7|$06:$82A7:04	; Inn ID #$04, Map ID #$0B: Lianport
0x0182B8|$06:$82A8:0C	; Inn ID #$05, Map ID #$0C: Tantegel
0x0182B9|$06:$82A9:0C	; Inn ID #$06, Map ID #$0F: Osterfair
0x0182BA|$06:$82AA:0C	; Inn ID #$07, Map ID #$10: Zahan
0x0182BB|$06:$82AB:0F	; Inn ID #$08, Map ID #$11: Tuhn / Map ID #$14: Wellgarth Underground
0x0182BC|$06:$82AC:0C	; Inn ID #$09, Map ID #$15: Beran

; data -> code
; handler for dialogue IDs #$14-#$1B (Weapon Shops)
; control flow target (from $81D4)
0x0182BD|$06:$82AD:85 49   	STA $49    	; object hero/target/item/string ID $49
0x0182BF|$06:$82AF:C9 18   	CMP #$18   	; Weapon Shop ID #04, Map ID #$0F: Osterfair
0x0182C1|$06:$82B1:D0 10   	BNE $82C3  
0x0182C3|$06:$82B3:AD C0 05	LDA $05C0  	; NPC #$10 motion nybble + direction nybble
0x0182C6|$06:$82B6:29 03   	AND #$03   
0x0182C8|$06:$82B8:C9 01   	CMP #$01   	; Right
0x0182CA|$06:$82BA:F0 07   	BEQ $82C3  	; talking to the shopkeeper from behind the counter, use a different string
; call to code in a different bank ($0F:$F6F6)
0x0182CC|$06:$82BC: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
0x0182CF|$06:$82BF:CE	; String ID #$02CE: ‘Do not enter this place!’[end-FC]

; data -> code
0x0182D0|$06:$82C0:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $82B1, $82BA)
; call to code in a different bank ($0F:$F6F0)
0x0182D3|$06:$82C3:20 F0 F6	JSR $F6F0  	; open main dialogue window and display string ID specified by byte following JSR + #$0100

; code -> data
; indirect data load target
0x0182D6|$06:$82C6:5B	; String ID #$015B: ‘We deal in weapons and armor.[line]Dost thou wish to see them?’[FD][FD][end-FC]

; data -> code
0x0182D7|$06:$82C7:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x0182DA|$06:$82CA:C9 00   	CMP #$00   	; YES
0x0182DC|$06:$82CC:F0 07   	BEQ $82D5  
; finish weapon transaction
; control flow target (from $82E3, $8318, $8367)
; call to code in a different bank ($0F:$FA2E)
0x0182DE|$06:$82CE:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0182E1|$06:$82D1:5D	; String ID #$015D: ‘Come again[.’][end-FC]

; data -> code
0x0182E2|$06:$82D2:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $82CC, $836A)
; call to code in a different bank ($0F:$FA2E)
0x0182E5|$06:$82D5:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0182E8|$06:$82D8:5C	; String ID #$015C: ‘What would thou purchase?’[FD][FD][end-FC]

; data -> code
0x0182E9|$06:$82D9:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x0182EB|$06:$82DB:38      	SEC        
0x0182EC|$06:$82DC:E9 14   	SBC #$14   	; convert to Shop ID
; call to code in a different bank ($0F:$F61B)
0x0182EE|$06:$82DE:20 1B F6	JSR $F61B  	; display shop menu item list for shop ID given in A, returning selected item (with Jailor's Key replaced by blank) in A
0x0182F1|$06:$82E1:C9 FF   	CMP #$FF   
0x0182F3|$06:$82E3:F0 E9   	BEQ $82CE  	; finish weapon transaction
0x0182F5|$06:$82E5:20 4D 8D	JSR $8D4D  	; given item ID in A, save it to $96 and set $8F-$90 to purchase price of item, accounting for possible Golden Card discount; decrease party gold by that amount and SEC if possible, CLC otherwise
0x0182F8|$06:$82E8:B0 07   	BCS $82F1  	; branch if price of item was deducted from party gold
; call to code in a different bank ($0F:$FA2E)
0x0182FA|$06:$82EA:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0182FD|$06:$82ED:5E	; String ID #$015E: ‘Sorry, it seems thou hast not enough gold[.’][wait][end-FC]

; data -> code
0x0182FE|$06:$82EE:4C 5C 83	JMP $835C  

; control flow target (from $82E8)
; call to code in a different bank ($0F:$F6CE)
0x018301|$06:$82F1:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x018304|$06:$82F4:C9 00   	CMP #$00   
0x018306|$06:$82F6:D0 0E   	BNE $8306  	; if Midenhall is alone, no need to ask who to give it to
0x018308|$06:$82F8:20 6D 83	JSR $836D  	; given hero ID in A and item ID in $96, try to add item to first empty slot in hero's inventory; if unable to add, refund purchase, pop JSR return address and JMP $8092 instead
0x01830B|$06:$82FB:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x01830D|$06:$82FD:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$FA2E)
0x01830F|$06:$82FF:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018312|$06:$8302:5F	; String ID #$015F: ‘The [item], is it? Good choice and many thanks[.’][wait][end-FC]

; data -> code
0x018313|$06:$8303:4C 4C 83	JMP $834C  

; control flow target (from $82F6)
0x018316|$06:$8306:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x018318|$06:$8308:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$FA2E)
0x01831A|$06:$830A:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01831D|$06:$830D:62	; String ID #$0162: ‘The [item]? Who will take this?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$F595)
0x01831E|$06:$830E:20 95 F5	JSR $F595  	; display appropriate shop BUY/SELL hero select menu
0x018321|$06:$8311:C9 FF   	CMP #$FF   
0x018323|$06:$8313:D0 06   	BNE $831B  
; control flow target (from $8330)
0x018325|$06:$8315:20 88 83	JSR $8388  	; add the number at $8F-$90 to party gold; no check for overflow, so this is only safe to use when reverting a sale
0x018328|$06:$8318:4C CE 82	JMP $82CE  	; finish weapon transaction

; control flow target (from $8313)
0x01832B|$06:$831B:85 97   	STA $97    	; subject hero ID $97
0x01832D|$06:$831D:20 A3 A3	JSR $A3A3  	; given item ID in $96 and hero ID in $97, set A to #$80 if hero can equip item, #$00 otherwise
0x018330|$06:$8320:C9 00   	CMP #$00   
0x018332|$06:$8322:D0 0E   	BNE $8332  
0x018334|$06:$8324:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018337|$06:$8327:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01833A|$06:$832A:91	; String ID #$0191: ‘[name] cannot be equipped with the [item]. Is it all right?’[end-FC]

; data -> code
0x01833B|$06:$832B:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x01833E|$06:$832E:C9 00   	CMP #$00   
0x018340|$06:$8330:D0 E3   	BNE $8315  
; control flow target (from $8322)
0x018342|$06:$8332:A5 97   	LDA $97    	; subject hero ID $97
0x018344|$06:$8334:20 6D 83	JSR $836D  	; given hero ID in A and item ID in $96, try to add item to first empty slot in hero's inventory; if unable to add, refund purchase, pop JSR return address and JMP $8092 instead
0x018347|$06:$8337:A9 80   	LDA #$80   	; Alive
0x018349|$06:$8339:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x01834C|$06:$833C:90 0A   	BCC $8348  
0x01834E|$06:$833E:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018351|$06:$8341:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018354|$06:$8344:63	; String ID #$0163: ‘Splendid, [name]!’[wait][end-FC]

; data -> code
0x018355|$06:$8345:4C 4C 83	JMP $834C  

; control flow target (from $833C)
; call to code in a different bank ($0F:$FA2E)
0x018358|$06:$8348:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01835B|$06:$834B:64	; String ID #$0164: ‘Well, I'll just give it to the ghost, eh?’[wait][end-FC]

; data -> code
; control flow target (from $8303, $8345)
0x01835C|$06:$834C:A9 32   	LDA #$32   	; Item ID #$32: Golden Card
0x01835E|$06:$834E: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
0x018361|$06:$8351:C9 FF   	CMP #$FF   
0x018363|$06:$8353:F0 07   	BEQ $835C  
0x018365|$06:$8355:20 11 8D	JSR $8D11  	; given item ID in $96 and discount amount in $8F-$90, set $8F-$90 to discounted item price
; call to code in a different bank ($0F:$FA2E)
0x018368|$06:$8358:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01836B|$06:$835B:60	; String ID #$0160: ‘Since thou hast the Golden Card I shall give thee a special discount of [number] piece[(s)] of gold[.’][wait][end-FC]

; data -> code
; control flow target (from $82EE, $8353)
; call to code in a different bank ($0F:$FA2E)
0x01836C|$06:$835C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01836F|$06:$835F:61	; String ID #$0161: ‘Can I interest thee in anything else?’[FD][FD][end-FC]

; data -> code
0x018370|$06:$8360:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018373|$06:$8363:C9 00   	CMP #$00   	; YES
0x018375|$06:$8365:F0 03   	BEQ $836A  
0x018377|$06:$8367:4C CE 82	JMP $82CE  	; finish weapon transaction

; control flow target (from $8365)
0x01837A|$06:$836A:4C D5 82	JMP $82D5  

; given hero ID in A and item ID in $96, try to add item to first empty slot in hero's inventory; if unable to add, refund purchase, pop JSR return address and JMP $8092 instead
; control flow target (from $82F8, $8334)
0x01837D|$06:$836D:85 97   	STA $97    	; subject hero ID $97
0x01837F|$06:$836F:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x018382|$06:$8372:90 05   	BCC $8379  
; call to code in a different bank ($0F:$EB76)
0x018384|$06:$8374:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018387|$06:$8377:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
0x018388|$06:$8378:60      	RTS        

; control flow target (from $8372)
0x018389|$06:$8379:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01838C|$06:$837C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01838F|$06:$837F:65	; String ID #$0165: ‘It seems [name] has no more room to carry things[.’][end-FC]

; data -> code
0x018390|$06:$8380:20 88 83	JSR $8388  	; add the number at $8F-$90 to party gold; no check for overflow, so this is only safe to use when reverting a sale
0x018393|$06:$8383:68      	PLA        
0x018394|$06:$8384:68      	PLA        
0x018395|$06:$8385:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; add the number at $8F-$90 to party gold; no check for overflow, so this is only safe to use when reverting a sale
; control flow target (from $8315, $8380, $8403)
0x018398|$06:$8388:A5 8F   	LDA $8F    
0x01839A|$06:$838A:18      	CLC        
0x01839B|$06:$838B:6D 24 06	ADC $0624  	; party gold, low byte
0x01839E|$06:$838E:8D 24 06	STA $0624  	; party gold, low byte
0x0183A1|$06:$8391:A5 90   	LDA $90    
0x0183A3|$06:$8393:6D 25 06	ADC $0625  	; party gold, high byte
0x0183A6|$06:$8396:8D 25 06	STA $0625  	; party gold, high byte
0x0183A9|$06:$8399:60      	RTS        

; handler for dialogue IDs #$1C-#$26 (Item Shops)
; control flow target (from $81DB)
0x0183AA|$06:$839A:38      	SEC        
0x0183AB|$06:$839B:E9 14   	SBC #$14   	; convert to Shop ID
0x0183AD|$06:$839D:85 49   	STA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$F6F0)
0x0183AF|$06:$839F:20 F0 F6	JSR $F6F0  	; open main dialogue window and display string ID specified by byte following JSR + #$0100

; code -> data
; indirect data load target
0x0183B2|$06:$83A2:66	; String ID #$0166: ‘We deal in tools.[line]What can I offer thee?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$EB76)
0x0183B3|$06:$83A3:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x0183B6|$06:$83A6:18	; Menu ID #$18: Shop menu: BUY/SELL

; data -> code
0x0183B7|$06:$83A7:C9 FF   	CMP #$FF   
0x0183B9|$06:$83A9:F0 07   	BEQ $83B2  	; finish item transaction
0x0183BB|$06:$83AB:C9 00   	CMP #$00   	; BUY
0x0183BD|$06:$83AD:F0 15   	BEQ $83C4  	; BUY handler
0x0183BF|$06:$83AF:4C 85 84	JMP $8485  	; SELL handler

; finish item transaction
; control flow target (from $83A9, $83C2, $83CF, $83DE, $8406, $8497, $84B4)
; call to code in a different bank ($0F:$FA2E)
0x0183C2|$06:$83B2:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0183C5|$06:$83B5:70	; String ID #$0170: ‘Good day, then[.’][end-FC]

; data -> code
0x0183C6|$06:$83B6:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $83EB, $8469, $8482)
; call to code in a different bank ($0F:$FA2E)
0x0183C9|$06:$83B9:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0183CC|$06:$83BC:6F	; String ID #$016F: ‘Dost thou need anything else?’[FD][FD][end-FC]

; data -> code
0x0183CD|$06:$83BD:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x0183D0|$06:$83C0:C9 00   	CMP #$00   	; YES
0x0183D2|$06:$83C2:D0 EE   	BNE $83B2  	; finish item transaction
; BUY handler
; control flow target (from $83AD)
; call to code in a different bank ($0F:$FA2E)
0x0183D4|$06:$83C4:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0183D7|$06:$83C7:67	; String ID #$0167: ‘What dost thou want?’[FD][FD][end-FC]

; data -> code
0x0183D8|$06:$83C8:A5 49   	LDA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$F61B)
0x0183DA|$06:$83CA:20 1B F6	JSR $F61B  	; display shop menu item list for shop ID given in A, returning selected item (with Jailor's Key replaced by blank) in A
0x0183DD|$06:$83CD:C9 FF   	CMP #$FF   
0x0183DF|$06:$83CF:F0 E1   	BEQ $83B2  	; finish item transaction
0x0183E1|$06:$83D1:C9 00   	CMP #$00   	; Jailor's Key converted to #$00
0x0183E3|$06:$83D3:D0 0D   	BNE $83E2  
; call to code in a different bank ($0F:$FA32)
0x0183E5|$06:$83D5:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0183E8|$06:$83D8:DA	; String ID #$02DA: ‘So thou hast heard about my wares[.’][wait][line]‘A bit expensive, maybe, but such fine craftsmanship![line]Will thou take it?’[FD][FD][end-FC]

; data -> code
0x0183E9|$06:$83D9:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x0183EC|$06:$83DC:C9 00   	CMP #$00   	; YES
0x0183EE|$06:$83DE:D0 D2   	BNE $83B2  	; finish item transaction
0x0183F0|$06:$83E0:A9 39   	LDA #$39   	; Item ID #$39: Jailor’s Key
; control flow target (from $83D3)
0x0183F2|$06:$83E2:20 4D 8D	JSR $8D4D  	; given item ID in A, save it to $96 and set $8F-$90 to purchase price of item, accounting for possible Golden Card discount; decrease party gold by that amount and SEC if possible, CLC otherwise
0x0183F5|$06:$83E5:B0 07   	BCS $83EE  
; call to code in a different bank ($0F:$FA2E)
0x0183F7|$06:$83E7:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0183FA|$06:$83EA:68	; String ID #$0168: ‘Unfortunately, thou hast not enough gold for that[.’][wait][end-FC]

; data -> code
0x0183FB|$06:$83EB:4C B9 83	JMP $83B9  

; control flow target (from $83E5)
; call to code in a different bank ($0F:$F6CE)
0x0183FE|$06:$83EE:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x018401|$06:$83F1:C9 00   	CMP #$00   
0x018403|$06:$83F3:D0 1F   	BNE $8414  	; if Midenhall is alone, no need to ask who to give it to
0x018405|$06:$83F5:85 97   	STA $97    	; subject hero ID $97
0x018407|$06:$83F7:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x01840A|$06:$83FA:B0 0D   	BCS $8409  
0x01840C|$06:$83FC:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01840F|$06:$83FF:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018412|$06:$8402:6C	; String ID #$016C: ‘Sorry. Thou cannot carry more[.’][wait][end-FC]

; data -> code
; revert sale, finish item transaction
; control flow target (from $842E, $8448)
0x018413|$06:$8403:20 88 83	JSR $8388  	; add the number at $8F-$90 to party gold; no check for overflow, so this is only safe to use when reverting a sale
0x018416|$06:$8406:4C B2 83	JMP $83B2  	; finish item transaction

; control flow target (from $83FA)
0x018419|$06:$8409:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x01841B|$06:$840B:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$FA2E)
0x01841D|$06:$840D:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018420|$06:$8410:69	; String ID #$0169: ‘The [item], eh? I thank thee[.’][wait][end-FC]

; data -> code
0x018421|$06:$8411:4C 55 84	JMP $8455  

; control flow target (from $83F3)
0x018424|$06:$8414:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x018426|$06:$8416:C9 39   	CMP #$39   	; Item ID #$39: Jailor’s Key
0x018428|$06:$8418:D0 07   	BNE $8421  
; call to code in a different bank ($0F:$FA32)
0x01842A|$06:$841A:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01842D|$06:$841D:DB	; String ID #$02DB: ‘Tell nobody that I have sold it[.’][wait][end-FC]

; data -> code
0x01842E|$06:$841E:4C 4A 84	JMP $844A  

; control flow target (from $8418)
0x018431|$06:$8421:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$FA2E)
0x018433|$06:$8423:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018436|$06:$8426:6A	; String ID #$016A: ‘Thou will buy the [item]?[line]And who will carry it?’[FD][FD][end-FC]

; data -> code
; control flow target (from $844E)
; call to code in a different bank ($0F:$F595)
0x018437|$06:$8427:20 95 F5	JSR $F595  	; display appropriate shop BUY/SELL hero select menu
0x01843A|$06:$842A:C9 FF   	CMP #$FF   
0x01843C|$06:$842C:D0 03   	BNE $8431  
0x01843E|$06:$842E:4C 03 84	JMP $8403  	; revert sale, finish item transaction

; control flow target (from $842C)
0x018441|$06:$8431:85 97   	STA $97    	; subject hero ID $97
0x018443|$06:$8433:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x018446|$06:$8436:B0 19   	BCS $8451  
0x018448|$06:$8438:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01844B|$06:$843B:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01844E|$06:$843E:6C	; String ID #$016C: ‘Sorry. Thou cannot carry more[.’][wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$FA2E)
0x01844F|$06:$843F:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018452|$06:$8442:6D	; String ID #$016D: ‘Will one of thy companions carry it?’[FD][FD][end-FC]

; data -> code
0x018453|$06:$8443:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018456|$06:$8446:C9 00   	CMP #$00   	; YES
0x018458|$06:$8448:D0 B9   	BNE $8403  	; revert sale, finish item transaction
; control flow target (from $841E)
; call to code in a different bank ($0F:$FA2E)
0x01845A|$06:$844A:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01845D|$06:$844D:6E	; String ID #$016E: ‘Who shall take it?’[FD][FD][end-FC]

; data -> code
0x01845E|$06:$844E:4C 27 84	JMP $8427  

; control flow target (from $8436)
; call to code in a different bank ($0F:$FA2E)
0x018461|$06:$8451:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018464|$06:$8454:6B	; String ID #$016B: ‘I thank thee kindly[.’][wait][end-FC]

; data -> code
; control flow target (from $8411)
; call to code in a different bank ($0F:$EB76)
0x018465|$06:$8455:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018468|$06:$8458:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
0x018469|$06:$8459:A9 32   	LDA #$32   	; Item ID #$32: Golden Card
0x01846B|$06:$845B: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
0x01846E|$06:$845E:C9 FF   	CMP #$FF   
0x018470|$06:$8460:F0 0A   	BEQ $846C  
0x018472|$06:$8462:20 11 8D	JSR $8D11  	; given item ID in $96 and discount amount in $8F-$90, set $8F-$90 to discounted item price
; call to code in a different bank ($0F:$FA2E)
0x018475|$06:$8465:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018478|$06:$8468:71	; String ID #$0171: ‘I see thou hast a Golden Card, but I will offer only a discount of [number] piece[(s)] of gold[.’][wait][end-FC]

; data -> code
; control flow target (from $8473, $847C)
0x018479|$06:$8469:4C B9 83	JMP $83B9  

; control flow target (from $8460)
; call to code in a different bank ($0F:$C3AB)
0x01847C|$06:$846C:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x01847F|$06:$846F:A5 32   	LDA $32    	; RNG byte 0
0x018481|$06:$8471:C9 2B   	CMP #$2B   	; odds of getting a Lottery Ticket = 43/256
0x018483|$06:$8473:B0 F4   	BCS $8469  
0x018485|$06:$8475:A9 33   	LDA #$33   	; Item ID #$33: Lottery Ticket
0x018487|$06:$8477:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x018489|$06:$8479:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x01848C|$06:$847C:90 EB   	BCC $8469  
; call to code in a different bank ($0F:$FA2E)
0x01848E|$06:$847E:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018491|$06:$8481:9D	; String ID #$019D: ‘With my compliments, here is an extra lottery ticket[.’][wait][end-FC]

; data -> code
0x018492|$06:$8482:4C B9 83	JMP $83B9  

; SELL handler
; control flow target (from $83AF)
; call to code in a different bank ($0F:$F6CE)
0x018495|$06:$8485:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x018498|$06:$8488:C9 00   	CMP #$00   
0x01849A|$06:$848A:F0 0E   	BEQ $849A  	; if Midenhall is alone, no need to ask who's selling
; call to code in a different bank ($0F:$FA2E)
0x01849C|$06:$848C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01849F|$06:$848F:72	; String ID #$0172: ‘Whose property will thou sell?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$F595)
0x0184A0|$06:$8490:20 95 F5	JSR $F595  	; display appropriate shop BUY/SELL hero select menu
0x0184A3|$06:$8493:C9 FF   	CMP #$FF   
0x0184A5|$06:$8495:D0 03   	BNE $849A  
0x0184A7|$06:$8497:4C B2 83	JMP $83B2  	; finish item transaction

; control flow target (from $848A, $8495)
0x0184AA|$06:$849A:85 97   	STA $97    	; subject hero ID $97
; control flow target (from $850D)
0x0184AC|$06:$849C:A5 97   	LDA $97    	; subject hero ID $97
0x0184AE|$06:$849E:0A      	ASL        	; 8 inventory items per hero
0x0184AF|$06:$849F:0A      	ASL        
0x0184B0|$06:$84A0:0A      	ASL        
0x0184B1|$06:$84A1:A8      	TAY        	; hero inventory read index
0x0184B2|$06:$84A2:A2 08   	LDX #$08   	; 8 inventory items per hero; loop counter
; control flow target (from $84AB)
0x0184B4|$06:$84A4:B9 00 06	LDA $0600,Y	; Midenhall inventory item 1 (| #$40 if equipped)
0x0184B7|$06:$84A7:D0 0E   	BNE $84B7  
0x0184B9|$06:$84A9:C8      	INY        	; hero inventory read index
0x0184BA|$06:$84AA:CA      	DEX        	; loop counter
0x0184BB|$06:$84AB:D0 F7   	BNE $84A4  
0x0184BD|$06:$84AD:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x0184C0|$06:$84B0:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0184C3|$06:$84B3:73	; String ID #$0173: ‘But [name] hast nothing to sell[.’][wait][end-FC]

; data -> code
; finish item transaction
; control flow target (from $84CF, $850B)
0x0184C4|$06:$84B4:4C B2 83	JMP $83B2  	; finish item transaction

; control flow target (from $84A7)
; call to code in a different bank ($0F:$FA2E)
0x0184C7|$06:$84B7:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0184CA|$06:$84BA:74	; String ID #$0174: ‘Which art thou going to sell?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$EB76)
0x0184CB|$06:$84BB:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x0184CE|$06:$84BE:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
0x0184CF|$06:$84BF:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F5FE)
0x0184D1|$06:$84C1:20 FE F5	JSR $F5FE  	; given a hero ID in A, open hero's item list and return selected item ID (or #$FE if they have no items)
0x0184D4|$06:$84C4:86 49   	STX $49    	; object hero/target/item/string ID $49
0x0184D6|$06:$84C6:48      	PHA        	; item ID
0x0184D7|$06:$84C7:A9 03   	LDA #$03   
; call to code in a different bank ($0F:$CF6A)
0x0184D9|$06:$84C9:20 6A CF	JSR $CF6A  	; wipe selected menu region
0x0184DC|$06:$84CC:68      	PLA        	; item ID
0x0184DD|$06:$84CD:C9 FF   	CMP #$FF   
0x0184DF|$06:$84CF:F0 E3   	BEQ $84B4  	; finish item transaction
0x0184E1|$06:$84D1:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x0184E3|$06:$84D3:29 3F   	AND #$3F   	; strip off the equipped bit
0x0184E5|$06:$84D5:0A      	ASL        
0x0184E6|$06:$84D6:A8      	TAY        
0x0184E7|$06:$84D7:B9 FC 9F	LDA $9FFC,Y	; Item Prices, low byte
0x0184EA|$06:$84DA:85 8F   	STA $8F    
0x0184EC|$06:$84DC:B9 FD 9F	LDA $9FFD,Y	; Item Prices, high byte
0x0184EF|$06:$84DF:85 90   	STA $90    
0x0184F1|$06:$84E1:46 90   	LSR $90    	; LSR 16-bit $8F-$90
0x0184F3|$06:$84E3:66 8F   	ROR $8F    
0x0184F5|$06:$84E5:46 90   	LSR $90    	; LSR 16-bit $8F-$90
0x0184F7|$06:$84E7:66 8F   	ROR $8F    
0x0184F9|$06:$84E9:B9 FC 9F	LDA $9FFC,Y	; Item Prices, low byte
0x0184FC|$06:$84EC:38      	SEC        
0x0184FD|$06:$84ED:E5 8F   	SBC $8F    
0x0184FF|$06:$84EF:85 8F   	STA $8F    
0x018501|$06:$84F1:B9 FD 9F	LDA $9FFD,Y	; Item Prices, high byte
0x018504|$06:$84F4:E5 90   	SBC $90    
0x018506|$06:$84F6:85 90   	STA $90    	; at this point item sell price is 75% of base price
0x018508|$06:$84F8:A5 8F   	LDA $8F    	; check if sell price is zero
0x01850A|$06:$84FA:05 90   	ORA $90    
0x01850C|$06:$84FC:D0 12   	BNE $8510  	; sell price of zero => key item
; call to code in a different bank ($0F:$FA2E)
0x01850E|$06:$84FE:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018511|$06:$8501:75	; String ID #$0175: ‘Sorry, friend, but I cannot buy that[.’][wait][end-FC]

; data -> code
; control flow target (from $8523, $8544, $854B)
; call to code in a different bank ($0F:$FA2E)
0x018512|$06:$8502:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018515|$06:$8505:79	; String ID #$0179: ‘Art thou going to sell more?’[FD][FD][end-FC]

; data -> code
0x018516|$06:$8506:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018519|$06:$8509:C9 00   	CMP #$00   	; YES
0x01851B|$06:$850B:D0 A7   	BNE $84B4  	; finish item transaction
0x01851D|$06:$850D:4C 9C 84	JMP $849C  

; control flow target (from $84FC)
0x018520|$06:$8510:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x018522|$06:$8512:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$FA2E)
0x018524|$06:$8514:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018527|$06:$8517:76	; String ID #$0176: ‘Thy [item]? Well, I'll give thee [number] piece[(s)] of gold for that[.’][FD][FD][end-FC]

; data -> code
0x018528|$06:$8518:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x01852B|$06:$851B:C9 00   	CMP #$00   	; YES
0x01852D|$06:$851D:F0 07   	BEQ $8526  
; call to code in a different bank ($0F:$FA2E)
0x01852F|$06:$851F:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018532|$06:$8522:77	; String ID #$0177: ‘That's too bad[.’][wait][end-FC]

; data -> code
0x018533|$06:$8523:4C 02 85	JMP $8502  

; control flow target (from $851D)
0x018536|$06:$8526:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x018538|$06:$8528:20 0F 8B	JSR $8B0F  	; given hero ID in $97 and hero inventory index in X, return corresponding item ID in A and party inventory index in X
0x01853B|$06:$852B:8A      	TXA        	; don't care about the item ID, just want the party inventory ID
0x01853C|$06:$852C:A8      	TAY        
0x01853D|$06:$852D:20 23 8B	JSR $8B23  	; given party inventory index in Y, CLC and return equipped item ID in A if corresponding item is equipped and cursed, SEC and return unequipped item ID in A otherwise
0x018540|$06:$8530:90 15   	BCC $8547  
; call to code in a different bank ($0F:$FA2E)
0x018542|$06:$8532:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018545|$06:$8535:78	; String ID #$0178: ‘I thank thee[.’][wait][end-FC]

; data -> code
0x018546|$06:$8536:20 F5 8C	JSR $8CF5  	; add $8F-$90 to party gold, capped at $FFFF
0x018549|$06:$8539:A5 97   	LDA $97    	; subject hero ID $97
0x01854B|$06:$853B:A6 49   	LDX $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$C4D4)
0x01854D|$06:$853D:20 D4 C4	JSR $C4D4  	; given hero ID in A and hero inventory offset in X, remove that item from hero's inventory and move all lower items up 1 slot
; call to code in a different bank ($0F:$EB76)
0x018550|$06:$8540:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018553|$06:$8543:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
0x018554|$06:$8544:4C 02 85	JMP $8502  

; control flow target (from $8530)
; call to code in a different bank ($0F:$FA2E)
0x018557|$06:$8547:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01855A|$06:$854A:7A	; String ID #$017A: ‘I fear it won't come off due to the curse[.’][wait][end-FC]

; data -> code
0x01855B|$06:$854B:4C 02 85	JMP $8502  

; handler for dialogue ID #$27 (House of Healing)
; control flow target (from $81E2)
0x01855E|$06:$854E:38      	SEC        
0x01855F|$06:$854F:E9 27   	SBC #$27   	; LDA #$00 would have been shorter and faster
0x018561|$06:$8551:85 49   	STA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$F6F0)
0x018563|$06:$8553:20 F0 F6	JSR $F6F0  	; open main dialogue window and display string ID specified by byte following JSR + #$0100

; code -> data
; indirect data load target
0x018566|$06:$8556:81	; String ID #$0181: ‘Welcome to the House of Healing[.’][wait][end-FC]

; data -> code
; control flow target (from $8573)
; call to code in a different bank ($0F:$FA2E)
0x018567|$06:$8557:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01856A|$06:$855A:82	; String ID #$0182: ‘What service dost thou require?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$EB76)
0x01856B|$06:$855B:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01856E|$06:$855E:1A	; Menu ID #$1A: Priest menu: DETOXICATE/UNCURSE/REVIVAL

; data -> code
0x01856F|$06:$855F:C9 FF   	CMP #$FF   
0x018571|$06:$8561:D0 14   	BNE $8577  
; finish conversation
; control flow target (from $8575, $858E, $85D9, $8632)
; call to code in a different bank ($0F:$FA2E)
0x018573|$06:$8563:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018576|$06:$8566:88	; String ID #$0188: ‘Good luck and hey, let's be careful out there[.’][end-FC]

; data -> code
0x018577|$06:$8567:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; repeat service loop
; control flow target (from $85A0, $85BD, $85F7, $8619, $8645, $866F, $869A)
; call to code in a different bank ($0F:$FA2E)
0x01857A|$06:$856A:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01857D|$06:$856D:87	; String ID #$0187: ‘Can I do anything else for thee?’[FD][FD][end-FC]

; data -> code
0x01857E|$06:$856E:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018581|$06:$8571:C9 00   	CMP #$00   	; YES
0x018583|$06:$8573:F0 E2   	BEQ $8557  
0x018585|$06:$8575:D0 EC   	BNE $8563  	; finish conversation
; control flow target (from $8561)
0x018587|$06:$8577:C9 00   	CMP #$00   	; DETOXICATE
0x018589|$06:$8579:F0 03   	BEQ $857E  	; DETOXICATE handler
0x01858B|$06:$857B:4C C0 85	JMP $85C0  

; DETOXICATE handler
; control flow target (from $8579)
; call to code in a different bank ($0F:$F6CE)
0x01858E|$06:$857E:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x018591|$06:$8581:C9 00   	CMP #$00   
0x018593|$06:$8583:F0 0B   	BEQ $8590  	; if Midenhall is alone, no need to ask for target hero
; call to code in a different bank ($0F:$FA2E)
0x018595|$06:$8585:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018598|$06:$8588:83	; String ID #$0183: ‘Who is the patient?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$F595)
0x018599|$06:$8589:20 95 F5	JSR $F595  	; display appropriate shop BUY/SELL hero select menu
0x01859C|$06:$858C:C9 FF   	CMP #$FF   
0x01859E|$06:$858E:F0 D3   	BEQ $8563  	; finish conversation
; control flow target (from $8583)
0x0185A0|$06:$8590:85 97   	STA $97    	; subject hero ID $97
0x0185A2|$06:$8592:A9 20   	LDA #$20   	; Poison
0x0185A4|$06:$8594:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x0185A7|$06:$8597:B0 0A   	BCS $85A3  
0x0185A9|$06:$8599:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x0185AC|$06:$859C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0185AF|$06:$859F:84	; String ID #$0184: ‘Good news, [name] has not been poisoned[.’][wait][end-FC]

; data -> code
0x0185B0|$06:$85A0:4C 6A 85	JMP $856A  	; repeat service loop

; control flow target (from $8597)
0x0185B3|$06:$85A3:A9 02   	LDA #$02   	; DETOXICATE fee is hero level * 2
0x0185B5|$06:$85A5:20 A4 86	JSR $86A4  	; given hero ID in $97, multiply A by that hero's level, store results in ($10-$11) and ($8F-$90); consumes $0C
0x0185B8|$06:$85A8:20 79 86	JSR $8679  	; try to collect payment for House of Healing service; refusal or insufficient gold pops JSP return address and jumps to repeat service loop at $06:$856A
; call to code in a different bank ($0F:$FA2E)
0x0185BB|$06:$85AB:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0185BE|$06:$85AE:86	; String ID #$0186: ‘Now I will administer the antidote to [name].[line]Stand still, please[.’][wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$C515)
0x0185BF|$06:$85AF:20 15 C5	JSR $C515  	; flash screen 10 times
0x0185C2|$06:$85B2:20 AA 8D	JSR $8DAA  	; given hero ID in $97, set Y to start of hero's data in $062D,Y, i.e. Y = $97 * #$12
0x0185C5|$06:$85B5:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x0185C8|$06:$85B8:29 DF   	AND #$DF   	; clear Poison
0x0185CA|$06:$85BA:99 2D 06	STA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x0185CD|$06:$85BD:4C 6A 85	JMP $856A  	; repeat service loop

; control flow target (from $857B)
0x0185D0|$06:$85C0:C9 01   	CMP #$01   	; UNCURSE
0x0185D2|$06:$85C2:F0 03   	BEQ $85C7  	; UNCURSE handler
0x0185D4|$06:$85C4:4C 20 86	JMP $8620  	; REVIVAL handler

; UNCURSE handler
; control flow target (from $85C2)
; call to code in a different bank ($0F:$F6CE)
0x0185D7|$06:$85C7:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x0185DA|$06:$85CA:C9 00   	CMP #$00   
0x0185DC|$06:$85CC:F0 0E   	BEQ $85DC  	; if Midenhall is alone, no need to ask for target hero
; call to code in a different bank ($0F:$FA2E)
0x0185DE|$06:$85CE:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0185E1|$06:$85D1:8B	; String ID #$018B: ‘A curse is it?[line]Who needs the cure?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$F595)
0x0185E2|$06:$85D2:20 95 F5	JSR $F595  	; display appropriate shop BUY/SELL hero select menu
0x0185E5|$06:$85D5:C9 FF   	CMP #$FF   
0x0185E7|$06:$85D7:D0 03   	BNE $85DC  
0x0185E9|$06:$85D9:4C 63 85	JMP $8563  	; finish conversation

; control flow target (from $85CC, $85D7)
0x0185EC|$06:$85DC:85 97   	STA $97    	; subject hero ID $97
0x0185EE|$06:$85DE:A9 04   	LDA #$04   	; there are 4 cursed items in the game
0x0185F0|$06:$85E0:85 0C   	STA $0C    
; control flow target (from $85EE)
0x0185F2|$06:$85E2:A4 0C   	LDY $0C    
0x0185F4|$06:$85E4:B9 1B 86	LDA $861B,Y	; list of cursed items (equipped), built in offset from $861C
0x0185F7|$06:$85E7:20 BA 8D	JSR $8DBA  	; given a hero ID in $97 and an item ID in A, SEC if hero has that item, CLC otherwise
0x0185FA|$06:$85EA:B0 0E   	BCS $85FA  
0x0185FC|$06:$85EC:C6 0C   	DEC $0C    
0x0185FE|$06:$85EE:D0 F2   	BNE $85E2  	; loop to check next cursed item
0x018600|$06:$85F0:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018603|$06:$85F3:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018606|$06:$85F6:8C	; String ID #$018C: ‘Hmmm. No. [name] is not cursed[.’][wait][end-FC]

; data -> code
0x018607|$06:$85F7:4C 6A 85	JMP $856A  	; repeat service loop

; control flow target (from $85EA)
0x01860A|$06:$85FA:A9 64   	LDA #$64   	; UNCURSE fee is hero level * 100
0x01860C|$06:$85FC:20 A4 86	JSR $86A4  	; given hero ID in $97, multiply A by that hero's level, store results in ($10-$11) and ($8F-$90); consumes $0C
0x01860F|$06:$85FF:20 79 86	JSR $8679  	; try to collect payment for House of Healing service; refusal or insufficient gold pops JSP return address and jumps to repeat service loop at $06:$856A
; call to code in a different bank ($0F:$FA2E)
0x018612|$06:$8602:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018615|$06:$8605:8D	; String ID #$018D: ‘A curse is like a virus, of course. This medicine should remove it[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$C515)
0x018616|$06:$8606:20 15 C5	JSR $C515  	; flash screen 10 times
0x018619|$06:$8609:A9 04   	LDA #$04   	; there are 4 cursed items in the game
0x01861B|$06:$860B:85 0C   	STA $0C    
; control flow target (from $8617)
0x01861D|$06:$860D:A4 0C   	LDY $0C    
0x01861F|$06:$860F:B9 1B 86	LDA $861B,Y	; list of cursed items (equipped), built in offset from $861C
0x018622|$06:$8612:20 C3 8D	JSR $8DC3  	; given a hero ID in $97 and an item ID in A, remove that item from hero's inventory if present and SEC, CLC otherwise
0x018625|$06:$8615:C6 0C   	DEC $0C    
0x018627|$06:$8617:D0 F4   	BNE $860D  	; loop to keep removing cursed items
0x018629|$06:$8619:4C 6A
; list of cursed items (equipped), built in offset from $861C
; indexed data load target (from $85E4, $860F, $8AC8)
0x01862B|$06:$861B:      85	JMP $856A  	; repeat service loop


; code -> data
; list of equipped cursed items
; indexed data load target (from $8B28)
0x01862C|$06:$861C:6F	; Item ID #$6F: Gremlin’s Tail (equipped)
0x01862D|$06:$861D:4C	; Item ID #$4C: Sword of Destruction (equipped)
0x01862E|$06:$861E:57	; Item ID #$57: Gremlin’s Armor (equipped)
0x01862F|$06:$861F:5F	; Item ID #$5F: Evil Shield (equipped)

; data -> code
; REVIVAL handler
; control flow target (from $85C4)
; call to code in a different bank ($0F:$F6CE)
0x018630|$06:$8620:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x018633|$06:$8623:C9 00   	CMP #$00   	; if Midenhall is alone, no need to ask for target hero
0x018635|$06:$8625:F0 0E   	BEQ $8635  
; call to code in a different bank ($0F:$FA2E)
0x018637|$06:$8627:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01863A|$06:$862A:8E	; String ID #$018E: ‘Whom shall I revive?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$F595)
0x01863B|$06:$862B:20 95 F5	JSR $F595  	; display appropriate shop BUY/SELL hero select menu
0x01863E|$06:$862E:C9 FF   	CMP #$FF   
0x018640|$06:$8630:D0 03   	BNE $8635  
0x018642|$06:$8632:4C 63 85	JMP $8563  	; finish conversation

; control flow target (from $8625, $8630)
0x018645|$06:$8635:85 97   	STA $97    	; subject hero ID $97
0x018647|$06:$8637:A9 80   	LDA #$80   	; Alive
0x018649|$06:$8639:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x01864C|$06:$863C:90 0A   	BCC $8648  
0x01864E|$06:$863E:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018651|$06:$8641:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018654|$06:$8644:8F	; String ID #$018F: ‘There, I think [name] will live now[.’][wait][end-FC]

; data -> code
0x018655|$06:$8645:4C 6A 85	JMP $856A  	; repeat service loop

; control flow target (from $863C)
0x018658|$06:$8648:A9 14   	LDA #$14   	; REVIVAL fee is hero level * 20
0x01865A|$06:$864A:20 A4 86	JSR $86A4  	; given hero ID in $97, multiply A by that hero's level, store results in ($10-$11) and ($8F-$90); consumes $0C
0x01865D|$06:$864D:20 79 86	JSR $8679  	; try to collect payment for House of Healing service; refusal or insufficient gold pops JSP return address and jumps to repeat service loop at $06:$856A
; call to code in a different bank ($0F:$FA2E)
0x018660|$06:$8650:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018663|$06:$8653:90	; String ID #$0190: ‘This is a very delicate operation[.’][wait][line]‘It may take a little while[.’][FD][FD][end-FC]

; data -> code
0x018664|$06:$8654:A9 02   	LDA #$02   	; Music ID #$02: revive BGM
; call to code in a different bank ($0F:$C58D)
0x018666|$06:$8656:20 8D C5	JSR $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
0x018669|$06:$8659:20 AA 8D	JSR $8DAA  	; given hero ID in $97, set Y to start of hero's data in $062D,Y, i.e. Y = $97 * #$12
0x01866C|$06:$865C:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01866F|$06:$865F:09 80   	ORA #$80   	; Alive
0x018671|$06:$8661:99 2D 06	STA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018674|$06:$8664:A9 01   	LDA #$01   	; revived with 1 HP
0x018676|$06:$8666:99 3B 06	STA $063B,Y	; Midenhall Current HP, low byte
; call to code in a different bank ($0F:$D302)
0x018679|$06:$8669:20 02 D3	JSR $D302  
; call to code in a different bank ($0F:$C22C)
0x01867C|$06:$866C:20 2C C2	JSR $C22C  
0x01867F|$06:$866F:4C 6A 85	JMP $856A  	; repeat service loop

; call to code in a different bank ($0F:$FA2E)
0x018682|$06:$8672:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
0x018685|$06:$8675:91	; String ID #$0191: ‘[name] cannot be equipped with the [item]. Is it all right?’[end-FC]

; data -> code
0x018686|$06:$8676:4C 7D 86	JMP $867D  

; try to collect payment for House of Healing service; refusal or insufficient gold pops JSP return address and jumps to repeat service loop at $06:$856A
; control flow target (from $85A8, $85FF, $864D)
; call to code in a different bank ($0F:$FA2E)
0x018689|$06:$8679:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01868C|$06:$867C:85	; String ID #$0185: ‘The fee is [number] piece[(s)] of gold.[line]Will thou pay?’[FD][FD][end-FC]

; data -> code
; control flow target (from $8676)
; call to code in a different bank ($0F:$EB76)
0x01868D|$06:$867D:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018690|$06:$8680:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
0x018691|$06:$8681:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018694|$06:$8684:C9 00   	CMP #$00   	; YES
0x018696|$06:$8686:D0 0C   	BNE $8694  
0x018698|$06:$8688:20 31 8D	JSR $8D31  	; given gold amount in $8F-$90, decrease party gold by that amount and SEC if possible, CLC otherwise
0x01869B|$06:$868B:90 10   	BCC $869D  
; call to code in a different bank ($0F:$EB76)
0x01869D|$06:$868D:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x0186A0|$06:$8690:1B	; Menu ID #$1B: Shop menu: current gold

; data -> code
0x0186A1|$06:$8691:4C 25 8D	JMP $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA

; control flow target (from $8686)
; call to code in a different bank ($0F:$FA2E)
0x0186A4|$06:$8694:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0186A7|$06:$8697:89	; String ID #$0189: ‘Come now, dost thou think leeches grow on trees?’[wait][line]‘I have expenses, taxes to pay, a wife, two kids, and a brand new cow[.’][wait][end-FC]

; data -> code
; control flow target (from $86A1)
0x0186A8|$06:$8698:68      	PLA        
0x0186A9|$06:$8699:68      	PLA        
0x0186AA|$06:$869A:4C 6A 85	JMP $856A  	; repeat service loop

; control flow target (from $868B)
; call to code in a different bank ($0F:$FA2E)
0x0186AD|$06:$869D:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0186B0|$06:$86A0:8A	; String ID #$018A: ‘What's this?[line]Thou hast no gold?[line]Well then get some!’[wait][end-FC]

; data -> code
0x0186B1|$06:$86A1:4C 98 86	JMP $8698  

; given hero ID in $97, multiply A by that hero's level, store results in ($10-$11) and ($8F-$90); consumes $0C
; control flow target (from $85A5, $85FC, $864A)
0x0186B4|$06:$86A4:85 0C   	STA $0C    
0x0186B6|$06:$86A6:20 AA 8D	JSR $8DAA  	; given hero ID in $97, set Y to start of hero's data in $062D,Y, i.e. Y = $97 * #$12
0x0186B9|$06:$86A9:B9 3E 06	LDA $063E,Y	; Midenhall Level
; multiply A by $0C, store results in ($10-$11) and ($8F-$90); consumes $0C
; control flow target (from $822B)
0x0186BC|$06:$86AC:85 0E   	STA $0E    
0x0186BE|$06:$86AE:A9 00   	LDA #$00   
0x0186C0|$06:$86B0:85 0D   	STA $0D    
0x0186C2|$06:$86B2:85 0F   	STA $0F    
; call to code in a different bank ($0F:$C339)
0x0186C4|$06:$86B4:20 39 C3	JSR $C339  	; 16-bit multiplication: ($10-$11) = ($0C-$0D) * ($0E-$0F); consumes $0C-$0F
0x0186C7|$06:$86B7:A5 10   	LDA $10    
0x0186C9|$06:$86B9:85 8F   	STA $8F    
0x0186CB|$06:$86BB:A5 11   	LDA $11    
0x0186CD|$06:$86BD:85 90   	STA $90    
0x0186CF|$06:$86BF:60      	RTS        

; handler for dialogue ID #$28 (Lottery)
; control flow target (from $81E9)
; call to code in a different bank ($0F:$F6F0)
0x0186D0|$06:$86C0:20 F0 F6	JSR $F6F0  	; open main dialogue window and display string ID specified by byte following JSR + #$0100

; code -> data
; indirect data load target
0x0186D3|$06:$86C3:94	; String ID #$0194: ‘Step right up and welcome to the Lottery.[line]Art thou going to play?’[FD][FD][end-FC]

; data -> code
0x0186D4|$06:$86C4:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x0186D7|$06:$86C7:C9 00   	CMP #$00   	; YES
0x0186D9|$06:$86C9:F0 0A   	BEQ $86D5  
; finish lottery conversation
; control flow target (from $86E2, $870B, $8723, $873C)
; call to code in a different bank ($0F:$FA2E)
0x0186DB|$06:$86CB:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0186DE|$06:$86CE:95	; String ID #$0195: ‘Well, perhaps some other time[.’][end-FC]

; data -> code
0x0186DF|$06:$86CF:20 05 89	JSR $8905  
0x0186E2|$06:$86D2:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; control flow target (from $86C9)
0x0186E5|$06:$86D5:A9 33   	LDA #$33   	; Item ID #$33: Lottery Ticket
0x0186E7|$06:$86D7: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
0x0186EA|$06:$86DA:C9 FF   	CMP #$FF   
0x0186EC|$06:$86DC:D0 07   	BNE $86E5  
; call to code in a different bank ($0F:$FA2E)
0x0186EE|$06:$86DE:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0186F1|$06:$86E1:96	; String ID #$0196: ‘I'm afraid thou must have a Lottery Ticket[.’][wait][end-FC]

; data -> code
0x0186F2|$06:$86E2:4C CB 86	JMP $86CB  	; finish lottery conversation

; control flow target (from $86DC)
0x0186F5|$06:$86E5:4A      	LSR        	; convert party inventory index to hero ID
0x0186F6|$06:$86E6:4A      	LSR        
0x0186F7|$06:$86E7:4A      	LSR        
0x0186F8|$06:$86E8:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$FA2E)
0x0186FA|$06:$86EA:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0186FD|$06:$86ED:97	; String ID #$0197: ‘Dost thou wish to hear how the game is played?’[FD][FD][end-FC]

; data -> code
0x0186FE|$06:$86EE:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018701|$06:$86F1:C9 00   	CMP #$00   	; YES
0x018703|$06:$86F3:D0 04   	BNE $86F9  
; call to code in a different bank ($0F:$FA2E)
0x018705|$06:$86F5:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018708|$06:$86F8:98	; String ID #$0198: ‘As the Lottery wheels spin, push thy controller button to stop them[.’][wait][line]‘Three [sun] marks win the first prize--a Golden Card[.’][wait][line]‘Three [star] marks win the second prize--the Wizard's Ring[.’][wait][line][FD][FD]‘There may be further prizes, too[.’][wait][end-FC]

; data -> code
; control flow target (from $86F3)
0x018709|$06:$86F9:20 44 87	JSR $8744  
; call to code in a different bank ($0F:$FA2E)
0x01870C|$06:$86FC:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01870F|$06:$86FF:99	; String ID #$0199: ‘Let's play now!’[FD][FD][no voice][no voice][no voice][no voice][no voice][no voice][no voice][sun] [star] [moon][FD][FD][end-FC]

; data -> code
0x018710|$06:$8700:20 78 87	JSR $8778  
0x018713|$06:$8703:C9 05   	CMP #$05   
0x018715|$06:$8705:D0 07   	BNE $870E  
; call to code in a different bank ($0F:$FA2E)
0x018717|$06:$8707:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01871A|$06:$870A:9C	; String ID #$019C: [wait]‘That was close.[line]As a consolation prize I'll give thee a lottery ticket[.’][wait][end-FC]

; data -> code
0x01871B|$06:$870B:4C CB 86	JMP $86CB  	; finish lottery conversation

; control flow target (from $8705)
0x01871E|$06:$870E:85 8F   	STA $8F    	; prize number
0x018720|$06:$8710:A9 00   	LDA #$00   
0x018722|$06:$8712:85 90   	STA $90    
0x018724|$06:$8714:A9 33   	LDA #$33   	; Item ID #$33: Lottery Ticket
0x018726|$06:$8716:20 C3 8D	JSR $8DC3  	; given a hero ID in $97 and an item ID in A, remove that item from hero's inventory if present and SEC, CLC otherwise
0x018729|$06:$8719:A5 8F   	LDA $8F    
0x01872B|$06:$871B:C9 FF   	CMP #$FF   
0x01872D|$06:$871D:D0 07   	BNE $8726  
; call to code in a different bank ($0F:$FA2E)
0x01872F|$06:$871F:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018732|$06:$8722:9B	; String ID #$019B: [wait]‘Sorry, thou hast lost. Better luck next time[.’][wait][end-FC]

; data -> code
0x018733|$06:$8723:4C CB 86	JMP $86CB  	; finish lottery conversation

; control flow target (from $871D)
0x018736|$06:$8726:A8      	TAY        
0x018737|$06:$8727:B9 3F 87	LDA $873F,Y	; Lottery prizes
0x01873A|$06:$872A:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x01873C|$06:$872C:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x01873E|$06:$872E:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x018741|$06:$8731:E6 8F   	INC $8F    
0x018743|$06:$8733:A9 06   	LDA #$06   	; Music ID #$06: lottery win BGM
; call to code in a different bank ($0F:$C58D)
0x018745|$06:$8735:20 8D C5	JSR $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
; call to code in a different bank ($0F:$FA2E)
0x018748|$06:$8738:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01874B|$06:$873B:9A	; String ID #$019A: [wait]‘Congratulations![line]Thou hast won prize number [number], the [item]!’[wait][end-FC]

; data -> code
0x01874C|$06:$873C:4C CB 86	JMP $86CB  	; finish lottery conversation


; code -> data
; Lottery prizes
; indexed data load target (from $8727)
0x01874F|$06:$873F:32	; Item ID #$32: Golden Card
0x018750|$06:$8740:3D	; Item ID #$3D: Wizard’s Ring
0x018751|$06:$8741:03	; Item ID #$03: Wizard’s Wand
0x018752|$06:$8742:30	; Item ID #$30: Dragon’s Bane
0x018753|$06:$8743:3C	; Item ID #$3C: Medical Herb

; data -> code
; control flow target (from $86F9)
; call to code in a different bank ($0F:$C3AB)
0x018754|$06:$8744:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x018757|$06:$8747:A5 32   	LDA $32    	; RNG byte 0
0x018759|$06:$8749:4A      	LSR        
0x01875A|$06:$874A:29 78   	AND #$78   
0x01875C|$06:$874C:85 DD   	STA $DD    
0x01875E|$06:$874E:A2 00   	LDX #$00   
0x018760|$06:$8750:20 78 88	JSR $8878  
0x018763|$06:$8753:A5 32   	LDA $32    	; RNG byte 0
0x018765|$06:$8755:0A      	ASL        
0x018766|$06:$8756:0A      	ASL        
0x018767|$06:$8757:0A      	ASL        
0x018768|$06:$8758:29 78   	AND #$78   
0x01876A|$06:$875A:85 DF   	STA $DF    
0x01876C|$06:$875C:A2 08   	LDX #$08   
0x01876E|$06:$875E:20 78 88	JSR $8878  
0x018771|$06:$8761:A5 33   	LDA $33    	; RNG byte 1
0x018773|$06:$8763:29 78   	AND #$78   
0x018775|$06:$8765:85 E1   	STA $E1    
0x018777|$06:$8767:A2 10   	LDX #$10   
0x018779|$06:$8769:20 78 88	JSR $8878  
0x01877C|$06:$876C:A9 00   	LDA #$00   
0x01877E|$06:$876E:85 DE   	STA $DE    
0x018780|$06:$8770:85 E0   	STA $E0    
0x018782|$06:$8772:85 E2   	STA $E2    
0x018784|$06:$8774:20 5B 89	JSR $895B  
0x018787|$06:$8777:60      	RTS        

; control flow target (from $8700)
0x018788|$06:$8778:A9 00   	LDA #$00   
0x01878A|$06:$877A:85 DC   	STA $DC    
0x01878C|$06:$877C:A5 2F   	LDA $2F    	; joypad 1 data
0x01878E|$06:$877E:29 01   	AND #$01   
0x018790|$06:$8780:85 DA   	STA $DA    
; control flow target (from $87D5)
0x018792|$06:$8782:A5 DC   	LDA $DC    
0x018794|$06:$8784:29 07   	AND #$07   
0x018796|$06:$8786:C9 07   	CMP #$07   
0x018798|$06:$8788:F0 1D   	BEQ $87A7  
; control flow target (from $8799)
0x01879A|$06:$878A:20 1F 89	JSR $891F  
0x01879D|$06:$878D:45 DC   	EOR $DC    
0x01879F|$06:$878F:4A      	LSR        
0x0187A0|$06:$8790:90 02   	BCC $8794  
0x0187A2|$06:$8792:E6 DC   	INC $DC    
; control flow target (from $8790)
0x0187A4|$06:$8794:A5 DC   	LDA $DC    
0x0187A6|$06:$8796:4A      	LSR        
0x0187A7|$06:$8797:29 03   	AND #$03   
0x0187A9|$06:$8799:F0 EF   	BEQ $878A  
0x0187AB|$06:$879B:90 0A   	BCC $87A7  
0x0187AD|$06:$879D:0A      	ASL        
0x0187AE|$06:$879E:AA      	TAX        
0x0187AF|$06:$879F:CA      	DEX        
0x0187B0|$06:$87A0:CA      	DEX        
0x0187B1|$06:$87A1:B5 DE   	LDA $DE,X  
0x0187B3|$06:$87A3:09 40   	ORA #$40   
0x0187B5|$06:$87A5:95 DE   	STA $DE,X  
; control flow target (from $8788, $879B)
0x0187B7|$06:$87A7:A2 00   	LDX #$00   
; control flow target (from $87C9)
0x0187B9|$06:$87A9:86 D5   	STX $D5    
0x0187BB|$06:$87AB:8A      	TXA        
0x0187BC|$06:$87AC:0A      	ASL        
0x0187BD|$06:$87AD:0A      	ASL        
0x0187BE|$06:$87AE:85 D6   	STA $D6    
0x0187C0|$06:$87B0:B5 DD   	LDA $DD,X  
0x0187C2|$06:$87B2:85 D7   	STA $D7    
0x0187C4|$06:$87B4:B5 DE   	LDA $DE,X  
0x0187C6|$06:$87B6:85 D8   	STA $D8    
0x0187C8|$06:$87B8:20 1A 88	JSR $881A  
0x0187CB|$06:$87BB:A6 D5   	LDX $D5    
0x0187CD|$06:$87BD:A5 D7   	LDA $D7    
0x0187CF|$06:$87BF:95 DD   	STA $DD,X  
0x0187D1|$06:$87C1:A5 D8   	LDA $D8    
0x0187D3|$06:$87C3:95 DE   	STA $DE,X  
0x0187D5|$06:$87C5:E8      	INX        
0x0187D6|$06:$87C6:E8      	INX        
0x0187D7|$06:$87C7:E0 06   	CPX #$06   
0x0187D9|$06:$87C9:D0 DE   	BNE $87A9  
0x0187DB|$06:$87CB:20 5B 89	JSR $895B  
0x0187DE|$06:$87CE:A5 DE   	LDA $DE    
0x0187E0|$06:$87D0:25 E0   	AND $E0    
0x0187E2|$06:$87D2:25 E2   	AND $E2    
0x0187E4|$06:$87D4:0A      	ASL        
0x0187E5|$06:$87D5:90 AB   	BCC $8782  
0x0187E7|$06:$87D7:A2 05   	LDX #$05   
0x0187E9|$06:$87D9:A9 00   	LDA #$00   
; control flow target (from $87DF)
0x0187EB|$06:$87DB:9D 62 06	STA $0662,X	; Moonbrooke Level
0x0187EE|$06:$87DE:CA      	DEX        
0x0187EF|$06:$87DF:D0 FA   	BNE $87DB  
0x0187F1|$06:$87E1:A0 00   	LDY #$00   
; control flow target (from $87FF)
0x0187F3|$06:$87E3:B6 DD   	LDX $DD,Y  
0x0187F5|$06:$87E5:8A      	TXA        
0x0187F6|$06:$87E6:4A      	LSR        
0x0187F7|$06:$87E7:4A      	LSR        
0x0187F8|$06:$87E8:4A      	LSR        
0x0187F9|$06:$87E9:29 0F   	AND #$0F   
0x0187FB|$06:$87EB:85 D5   	STA $D5    
0x0187FD|$06:$87ED:98      	TYA        
0x0187FE|$06:$87EE:0A      	ASL        
0x0187FF|$06:$87EF:0A      	ASL        
0x018800|$06:$87F0:0A      	ASL        
0x018801|$06:$87F1:05 D5   	ORA $D5    
0x018803|$06:$87F3:AA      	TAX        
0x018804|$06:$87F4:BD D5 88	LDA $88D5,X
0x018807|$06:$87F7:AA      	TAX        
0x018808|$06:$87F8:FE 63 06	INC $0663,X	; monster ID, group 1
0x01880B|$06:$87FB:C8      	INY        
0x01880C|$06:$87FC:C8      	INY        
0x01880D|$06:$87FD:C0 06   	CPY #$06   
0x01880F|$06:$87FF:D0 E2   	BNE $87E3  
0x018811|$06:$8801:A2 00   	LDX #$00   
; control flow target (from $8811)
0x018813|$06:$8803:BD 63 06	LDA $0663,X	; monster ID, group 1
0x018816|$06:$8806:C9 03   	CMP #$03   
0x018818|$06:$8808:F0 0B   	BEQ $8815  
0x01881A|$06:$880A:C9 02   	CMP #$02   
0x01881C|$06:$880C:F0 09   	BEQ $8817  
0x01881E|$06:$880E:E8      	INX        
0x01881F|$06:$880F:E0 05   	CPX #$05   
0x018821|$06:$8811:D0 F0   	BNE $8803  
0x018823|$06:$8813:A2 FF   	LDX #$FF   
; control flow target (from $8808)
0x018825|$06:$8815:8A      	TXA        
0x018826|$06:$8816:60      	RTS        

; control flow target (from $880C)
0x018827|$06:$8817:A9 05   	LDA #$05   
0x018829|$06:$8819:60      	RTS        

; control flow target (from $87B8)
0x01882A|$06:$881A:A5 D8   	LDA $D8    
0x01882C|$06:$881C:30 51   	BMI $886F  
0x01882E|$06:$881E:29 07   	AND #$07   
0x018830|$06:$8820:D0 4B   	BNE $886D  
0x018832|$06:$8822:E6 D7   	INC $D7    
0x018834|$06:$8824:20 7C 88	JSR $887C  
0x018837|$06:$8827:A5 D7   	LDA $D7    
0x018839|$06:$8829:29 07   	AND #$07   
0x01883B|$06:$882B:D0 2C   	BNE $8859  
0x01883D|$06:$882D:A9 85   	LDA #$85   	; Music ID #$85: single beep SFX
; call to code in a different bank ($0F:$C561)
0x01883F|$06:$882F:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x018842|$06:$8832:A5 D8   	LDA $D8    
0x018844|$06:$8834:29 78   	AND #$78   
0x018846|$06:$8836:C9 40   	CMP #$40   
0x018848|$06:$8838:90 1F   	BCC $8859  
0x01884A|$06:$883A:C9 78   	CMP #$78   
0x01884C|$06:$883C:B0 14   	BCS $8852  
0x01884E|$06:$883E:18      	CLC        
0x01884F|$06:$883F:69 08   	ADC #$08   
0x018851|$06:$8841:85 D8   	STA $D8    
0x018853|$06:$8843:29 20   	AND #$20   
0x018855|$06:$8845:F0 12   	BEQ $8859  
; call to code in a different bank ($0F:$C3AB)
0x018857|$06:$8847:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x01885A|$06:$884A:A5 32   	LDA $32    	; RNG byte 0
0x01885C|$06:$884C:45 D8   	EOR $D8    
0x01885E|$06:$884E:29 18   	AND #$18   
0x018860|$06:$8850:D0 07   	BNE $8859  
; control flow target (from $883C)
0x018862|$06:$8852:A5 D8   	LDA $D8    
0x018864|$06:$8854:09 80   	ORA #$80   
0x018866|$06:$8856:85 D8   	STA $D8    
0x018868|$06:$8858:60      	RTS        

; control flow target (from $882B, $8838, $8845, $8850)
0x018869|$06:$8859:A5 D8   	LDA $D8    
0x01886B|$06:$885B:29 78   	AND #$78   
0x01886D|$06:$885D:85 D8   	STA $D8    
0x01886F|$06:$885F:4A      	LSR        
0x018870|$06:$8860:4A      	LSR        
0x018871|$06:$8861:4A      	LSR        
0x018872|$06:$8862:29 07   	AND #$07   
0x018874|$06:$8864:AA      	TAX        
0x018875|$06:$8865:BD 70 88	LDA $8870,X
0x018878|$06:$8868:05 D8   	ORA $D8    
0x01887A|$06:$886A:85 D8   	STA $D8    
0x01887C|$06:$886C:60      	RTS        

; control flow target (from $8820)
0x01887D|$06:$886D:C6 D8   	DEC $D8    
; control flow target (from $881C)
0x01887F|$06:$886F:60      	RTS        


; code -> data
; indexed data load target (from $8865)
0x018880|$06:$8870:00
0x018881|$06:$8871:01
0x018882|$06:$8872:01
0x018883|$06:$8873:02
0x018884|$06:$8874:02
0x018885|$06:$8875:03
0x018886|$06:$8876:04
0x018887|$06:$8877:07

; data -> code
; control flow target (from $8750, $875E, $8769)
0x018888|$06:$8878:86 D6   	STX $D6    
0x01888A|$06:$887A:85 D7   	STA $D7    
; control flow target (from $8824)
0x01888C|$06:$887C:A5 D6   	LDA $D6    
0x01888E|$06:$887E:0A      	ASL        
0x01888F|$06:$887F:85 D9   	STA $D9    
0x018891|$06:$8881:A5 D7   	LDA $D7    
0x018893|$06:$8883:4A      	LSR        
0x018894|$06:$8884:4A      	LSR        
0x018895|$06:$8885:4A      	LSR        
0x018896|$06:$8886:29 0F   	AND #$0F   
0x018898|$06:$8888:05 D9   	ORA $D9    
0x01889A|$06:$888A:AA      	TAX        
0x01889B|$06:$888B:A5 D7   	LDA $D7    
0x01889D|$06:$888D:29 07   	AND #$07   
0x01889F|$06:$888F:85 D9   	STA $D9    
0x0188A1|$06:$8891:BD D5 88	LDA $88D5,X
0x0188A4|$06:$8894:0A      	ASL        
0x0188A5|$06:$8895:0A      	ASL        
0x0188A6|$06:$8896:0A      	ASL        
0x0188A7|$06:$8897:18      	CLC        
0x0188A8|$06:$8898:65 D9   	ADC $D9    
0x0188AA|$06:$889A:AA      	TAX        
0x0188AB|$06:$889B:A4 D6   	LDY $D6    
; control flow target (from $88A8)
0x0188AD|$06:$889D:BD A2 89	LDA $89A2,X
0x0188B0|$06:$88A0:99 63 06	STA $0663,Y	; monster ID, group 1
0x0188B3|$06:$88A3:C8      	INY        
0x0188B4|$06:$88A4:E8      	INX        
0x0188B5|$06:$88A5:8A      	TXA        
0x0188B6|$06:$88A6:29 07   	AND #$07   
0x0188B8|$06:$88A8:D0 F3   	BNE $889D  
0x0188BA|$06:$88AA:A5 D9   	LDA $D9    
0x0188BC|$06:$88AC:F0 26   	BEQ $88D4  
0x0188BE|$06:$88AE:A5 D6   	LDA $D6    
0x0188C0|$06:$88B0:0A      	ASL        
0x0188C1|$06:$88B1:85 D9   	STA $D9    
0x0188C3|$06:$88B3:A5 D7   	LDA $D7    
0x0188C5|$06:$88B5:4A      	LSR        
0x0188C6|$06:$88B6:4A      	LSR        
0x0188C7|$06:$88B7:4A      	LSR        
0x0188C8|$06:$88B8:18      	CLC        
0x0188C9|$06:$88B9:69 01   	ADC #$01   
0x0188CB|$06:$88BB:29 0F   	AND #$0F   
0x0188CD|$06:$88BD:05 D9   	ORA $D9    
0x0188CF|$06:$88BF:AA      	TAX        
0x0188D0|$06:$88C0:BD D5 88	LDA $88D5,X
0x0188D3|$06:$88C3:0A      	ASL        
0x0188D4|$06:$88C4:0A      	ASL        
0x0188D5|$06:$88C5:0A      	ASL        
0x0188D6|$06:$88C6:AA      	TAX        
; control flow target (from $88D2)
0x0188D7|$06:$88C7:BD A2 89	LDA $89A2,X
0x0188DA|$06:$88CA:99 63 06	STA $0663,Y	; monster ID, group 1
0x0188DD|$06:$88CD:E8      	INX        
0x0188DE|$06:$88CE:C8      	INY        
0x0188DF|$06:$88CF:98      	TYA        
0x0188E0|$06:$88D0:29 07   	AND #$07   
0x0188E2|$06:$88D2:D0 F3   	BNE $88C7  
; control flow target (from $88AC)
0x0188E4|$06:$88D4:60      	RTS        


; code -> data
; indexed data load target (from $87F4, $8891, $88C0)
0x0188E5|$06:$88D5:04
0x0188E6|$06:$88D6:03
0x0188E7|$06:$88D7:02
0x0188E8|$06:$88D8:04
0x0188E9|$06:$88D9:00
0x0188EA|$06:$88DA:04
0x0188EB|$06:$88DB:01
0x0188EC|$06:$88DC:04
0x0188ED|$06:$88DD:02
0x0188EE|$06:$88DE:03
0x0188EF|$06:$88DF:04
0x0188F0|$06:$88E0:01
0x0188F1|$06:$88E1:03
0x0188F2|$06:$88E2:04
0x0188F3|$06:$88E3:02
0x0188F4|$06:$88E4:03
0x0188F5|$06:$88E5:02
0x0188F6|$06:$88E6:04
0x0188F7|$06:$88E7:03
0x0188F8|$06:$88E8:01
0x0188F9|$06:$88E9:04
0x0188FA|$06:$88EA:00
0x0188FB|$06:$88EB:02
0x0188FC|$06:$88EC:04
0x0188FD|$06:$88ED:01
0x0188FE|$06:$88EE:03
0x0188FF|$06:$88EF:04
0x018900|$06:$88F0:03
0x018901|$06:$88F1:01
0x018902|$06:$88F2:04
0x018903|$06:$88F3:00
0x018904|$06:$88F4:04
0x018905|$06:$88F5:04
0x018906|$06:$88F6:00
0x018907|$06:$88F7:04
0x018908|$06:$88F8:02
0x018909|$06:$88F9:01
0x01890A|$06:$88FA:04
0x01890B|$06:$88FB:03
0x01890C|$06:$88FC:02
0x01890D|$06:$88FD:04
0x01890E|$06:$88FE:03
0x01890F|$06:$88FF:01
0x018910|$06:$8900:04
0x018911|$06:$8901:02
0x018912|$06:$8902:03
0x018913|$06:$8903:04
0x018914|$06:$8904:03

; data -> code
; control flow target (from $86CF, $890A)
; call to code in a different bank ($0F:$C1DC)
0x018915|$06:$8905:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x018918|$06:$8908:A5 02   	LDA $02    
0x01891A|$06:$890A:D0 F9   	BNE $8905  
0x01891C|$06:$890C:A9 05   	LDA #$05   
0x01891E|$06:$890E:85 08   	STA $08    
0x018920|$06:$8910:AD 1D 89	LDA $891D  
0x018923|$06:$8913:85 D7   	STA $D7    
0x018925|$06:$8915:AD 1E 89	LDA $891E  
0x018928|$06:$8918:85 D8   	STA $D8    
0x01892A|$06:$891A:4C 73 89	JMP $8973  


; code -> data
; data load target (from $8910)
0x01892D|$06:$891D:A2
; data load target (from $8915)
0x01892E|$06:$891E:   89	; $06:$89A2

; data -> code
; control flow target (from $878A)
0x01892F|$06:$891F:A2 20   	LDX #$20   
0x018931|$06:$8921:A5 DC   	LDA $DC    
0x018933|$06:$8923:29 06   	AND #$06   
0x018935|$06:$8925:D0 07   	BNE $892E  
0x018937|$06:$8927:85 DB   	STA $DB    
; call to code in a different bank ($0F:$C1DC)
0x018939|$06:$8929:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x01893C|$06:$892C:A2 08   	LDX #$08   
; control flow target (from $8925)
0x01893E|$06:$892E:86 DB   	STX $DB    
; call to code in a different bank ($0F:$C476)
0x018940|$06:$8930:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x018943|$06:$8933:A5 2F   	LDA $2F    	; joypad 1 data
0x018945|$06:$8935:45 DA   	EOR $DA    
0x018947|$06:$8937:4A      	LSR        
0x018948|$06:$8938:90 07   	BCC $8941  
0x01894A|$06:$893A:A5 2F   	LDA $2F    	; joypad 1 data
0x01894C|$06:$893C:29 01   	AND #$01   
0x01894E|$06:$893E:85 DA   	STA $DA    
0x018950|$06:$8940:60      	RTS        

; control flow target (from $8938)
0x018951|$06:$8941:A5 DC   	LDA $DC    
0x018953|$06:$8943:18      	CLC        
0x018954|$06:$8944:69 08   	ADC #$08   
0x018956|$06:$8946:85 DC   	STA $DC    
0x018958|$06:$8948:90 10   	BCC $895A  
0x01895A|$06:$894A:E6 DA   	INC $DA    
0x01895C|$06:$894C:E6 DA   	INC $DA    
0x01895E|$06:$894E:A5 DA   	LDA $DA    
0x018960|$06:$8950:C5 DB   	CMP $DB    
0x018962|$06:$8952:90 06   	BCC $895A  
0x018964|$06:$8954:49 01   	EOR #$01   
0x018966|$06:$8956:29 01   	AND #$01   
0x018968|$06:$8958:85 DA   	STA $DA    
; control flow target (from $8948, $8952)
0x01896A|$06:$895A:60      	RTS        

; control flow target (from $8774, $87CB, $8962)
0x01896B|$06:$895B:A5 02   	LDA $02    
0x01896D|$06:$895D:F0 06   	BEQ $8965  
; call to code in a different bank ($0F:$C1DC)
0x01896F|$06:$895F:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x018972|$06:$8962:4C 5B 89	JMP $895B  

; control flow target (from $895D)
0x018975|$06:$8965:A9 05   	LDA #$05   
0x018977|$06:$8967:85 08   	STA $08    
0x018979|$06:$8969:AD 8C 89	LDA $898C  
0x01897C|$06:$896C:85 D7   	STA $D7    
0x01897E|$06:$896E:AD 8D 89	LDA $898D  
0x018981|$06:$8971:85 D8   	STA $D8    
; control flow target (from $891A)
0x018983|$06:$8973:A9 A0   	LDA #$A0   
0x018985|$06:$8975:A0 00   	LDY #$00   
0x018987|$06:$8977:20 8E 89	JSR $898E  
0x01898A|$06:$897A:A9 B0   	LDA #$B0   
0x01898C|$06:$897C:A0 08   	LDY #$08   
0x01898E|$06:$897E:20 8E 89	JSR $898E  
0x018991|$06:$8981:A9 C0   	LDA #$C0   
0x018993|$06:$8983:A0 10   	LDY #$10   
0x018995|$06:$8985:20 8E 89	JSR $898E  
; call to code in a different bank ($0F:$C1DC)
0x018998|$06:$8988:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x01899B|$06:$898B:60      	RTS        


; code -> data
; data load target (from $8969)
0x01899C|$06:$898C:63
; data load target (from $896E)
0x01899D|$06:$898D:   06	; $06:$0663; monster ID, group 1

; data -> code
; control flow target (from $8977, $897E, $8985)
0x01899E|$06:$898E:85 07   	STA $07    
; control flow target (from $899F)
0x0189A0|$06:$8990:84 D5   	STY $D5    
0x0189A2|$06:$8992:B1 D7   	LDA ($D7),Y
0x0189A4|$06:$8994:85 09   	STA $09    
; call to code in a different bank ($0F:$C1FA)
0x0189A6|$06:$8996: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
0x0189A9|$06:$8999:A4 D5   	LDY $D5    
0x0189AB|$06:$899B:C8      	INY        
0x0189AC|$06:$899C:98      	TYA        
0x0189AD|$06:$899D:29 07   	AND #$07   
0x0189AF|$06:$899F:D0 EF   	BNE $8990  
0x0189B1|$06:$89A1:60      	RTS        


; code -> data
; indexed data load target (from $889D, $88C7)
; indirect data load target (via $891D)
0x0189B2|$06:$89A2:10 82 38 7C 7C 38 82 10
0x0189BA|$06:$89AA:10 10 FE 7C 38 7C 6C 82
0x0189C2|$06:$89B2:70 38 1C 1C 1C 1C 38 70
0x0189CA|$06:$89BA:10 10 38 7C FE FE FE 7C
0x0189D2|$06:$89C2:00 6C FE FE 7C 7C 38 10

; data -> code
; COMMAND menu STATUS command handler
; indirect control flow target (via $808A)
; call to code in a different bank ($0F:$F537)
0x0189DA|$06:$89CA:20 37 F5	JSR $F537  	; display hero select STATUS menu if necessary
0x0189DD|$06:$89CD:C9 FF   	CMP #$FF   
0x0189DF|$06:$89CF:D0 03   	BNE $89D4  
0x0189E1|$06:$89D1:4C 6D 80	JMP $806D  	; exit COMMAND menu

; control flow target (from $89CF)
0x0189E4|$06:$89D4:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F497)
0x0189E6|$06:$89D6:20 97 F4	JSR $F497  	; display Menu ID #$03: Main menu: selected hero's status
0x0189E9|$06:$89D9:20 9D 80	JSR $809D  	; wait until all joypad buttons are released and then some button pressed
; call to code in a different bank ($0F:$F492)
0x0189EC|$06:$89DC:20 92 F4	JSR $F492  	; display Menu ID #$02: Main menu: gold/crests
0x0189EF|$06:$89DF:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F63B)
0x0189F1|$06:$89E1:20 3B F6	JSR $F63B  	; display Menu ID #$1C: Main menu: status screen equipped items
0x0189F4|$06:$89E4:C6 97   	DEC $97    	; subject hero ID $97
0x0189F6|$06:$89E6:30 17   	BMI $89FF  	; Midenhall has no magic, so no need to show spell lists
0x0189F8|$06:$89E8:A6 97   	LDX $97    	; subject hero ID $97
0x0189FA|$06:$89EA:BD 18 06	LDA $0618,X	; Cannock's learned battle spell list
0x0189FD|$06:$89ED:1D 1A 06	ORA $061A,X	; Cannock's learned field spell list
0x018A00|$06:$89F0:F0 0D   	BEQ $89FF  	; if casters haven't learned any spell yet (which is impossible), no need to show spell lists
0x018A02|$06:$89F2:20 9D 80	JSR $809D  	; wait until all joypad buttons are released and then some button pressed
0x018A05|$06:$89F5:A9 85   	LDA #$85   	; Music ID #$85: single beep SFX
; call to code in a different bank ($0F:$C561)
0x018A07|$06:$89F7:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x018A0A|$06:$89FA:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F64E)
0x018A0C|$06:$89FC:20 4E F6	JSR $F64E  	; display spell lists
; control flow target (from $89E6, $89F0)
0x018A0F|$06:$89FF:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; COMMAND menu EQUIP handler
; indirect control flow target (via $8090)
; call to code in a different bank ($0F:$F56B)
0x018A12|$06:$8A02:20 6B F5	JSR $F56B  	; display appropriate main EQUIP hero select menu
0x018A15|$06:$8A05:C9 FF   	CMP #$FF   
0x018A17|$06:$8A07:D0 03   	BNE $8A0C  
0x018A19|$06:$8A09:4C 6D 80	JMP $806D  	; exit COMMAND menu

; control flow target (from $8A07)
0x018A1C|$06:$8A0C:85 97   	STA $97    	; subject hero ID $97
0x018A1E|$06:$8A0E:A9 00   	LDA #$00   
0x018A20|$06:$8A10:85 49   	STA $49    	; object hero/target/item/string ID $49; EQUIP sub-type
0x018A22|$06:$8A12:85 A5   	STA $A5    
0x018A24|$06:$8A14:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$CF6A)
0x018A26|$06:$8A16:20 6A CF	JSR $CF6A  	; wipe selected menu region
; control flow target (from $8AEB)
0x018A29|$06:$8A19:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x018A2B|$06:$8A1B:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F5A3)
0x018A2D|$06:$8A1D:20 A3 F5	JSR $F5A3  	; 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
0x018A30|$06:$8A20:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; new item to equip
; control flow target (from $8A35)
0x018A32|$06:$8A22:C9 FF   	CMP #$FF   
0x018A34|$06:$8A24:D0 18   	BNE $8A3E  
0x018A36|$06:$8A26:C6 49   	DEC $49    	; object hero/target/item/string ID $49
0x018A38|$06:$8A28:30 11   	BMI $8A3B  
; control flow target (from $8A39)
0x018A3A|$06:$8A2A:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x018A3C|$06:$8A2C:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F5A3)
0x018A3E|$06:$8A2E:20 A3 F5	JSR $F5A3  	; 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
0x018A41|$06:$8A31:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; new item to equip
0x018A43|$06:$8A33:C9 FE   	CMP #$FE   
0x018A45|$06:$8A35:D0 EB   	BNE $8A22  
0x018A47|$06:$8A37:C6 49   	DEC $49    	; object hero/target/item/string ID $49
0x018A49|$06:$8A39:10 EF   	BPL $8A2A  
; control flow target (from $8A28)
0x018A4B|$06:$8A3B:4C FF 8A	JMP $8AFF  	; wait #$14 interrupts, update each hero's stats based on their current EXP, wipe menu and exit COMMAND menu

; control flow target (from $8A24)
0x018A4E|$06:$8A3E:C9 FE   	CMP #$FE   
0x018A50|$06:$8A40:D0 20   	BNE $8A62  
0x018A52|$06:$8A42:4C E3 8A	JMP $8AE3  

; control flow target (from $8A8C)
0x018A55|$06:$8A45:29 3F   	AND #$3F   	; strip off the equipped bit
0x018A57|$06:$8A47:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$F6F0)
0x018A59|$06:$8A49:20 F0 F6	JSR $F6F0  	; open main dialogue window and display string ID specified by byte following JSR + #$0100

; code -> data
; indirect data load target
0x018A5C|$06:$8A4C:12	; String ID #$0112: It cannot be removed due to the curse.[end-FC]

; data -> code
; control flow target (from $8AE0)
0x018A5D|$06:$8A4D:A9 0A   	LDA #$0A   	; Music ID #$0A: cursed BGM
; call to code in a different bank ($0F:$C58D)
0x018A5F|$06:$8A4F:20 8D C5	JSR $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
0x018A62|$06:$8A52:4C 5A 8A	JMP $8A5A  

; control flow target (from $8ABC)
0x018A65|$06:$8A55:A2 50   	LDX #$50   
; call to code in a different bank ($0F:$C1EE)
0x018A67|$06:$8A57:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; control flow target (from $8A52)
0x018A6A|$06:$8A5A:A9 05   	LDA #$05   
; call to code in a different bank ($0F:$CF6A)
0x018A6C|$06:$8A5C:20 6A CF	JSR $CF6A  	; wipe selected menu region
0x018A6F|$06:$8A5F:4C E3 8A	JMP $8AE3  

; control flow target (from $8A40)
0x018A72|$06:$8A62:E6 A5   	INC $A5    
0x018A74|$06:$8A64:86 12   	STX $12    
0x018A76|$06:$8A66:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x018A78|$06:$8A68:BD 57 F7	LDA $F757,X	; table of first item IDs for each item type
0x018A7B|$06:$8A6B:85 0E   	STA $0E    	; lowest item ID of current item type
0x018A7D|$06:$8A6D:BD 58 F7	LDA $F758,X
0x018A80|$06:$8A70:85 0F   	STA $0F    	; lowest item ID of next item type
0x018A82|$06:$8A72:20 1D 8B	JSR $8B1D  	; set A to hero ID in $97 * 8
0x018A85|$06:$8A75:A8      	TAY        
0x018A86|$06:$8A76:A9 08   	LDA #$08   	; 8 inventory slots per hero
0x018A88|$06:$8A78:85 0C   	STA $0C    	; number of invetory slots left to check
; control flow target (from $8A94)
0x018A8A|$06:$8A7A:B9 00 06	LDA $0600,Y	; Midenhall inventory item 1 (| #$40 if equipped)
0x018A8D|$06:$8A7D:F0 12   	BEQ $8A91  
0x018A8F|$06:$8A7F:29 3F   	AND #$3F   	; strip off the equipped bit
0x018A91|$06:$8A81:C5 0E   	CMP $0E    	; lowest item ID of current item type
0x018A93|$06:$8A83:90 0C   	BCC $8A91  
0x018A95|$06:$8A85:C5 0F   	CMP $0F    	; lowest item ID of next item type
0x018A97|$06:$8A87:B0 08   	BCS $8A91  
0x018A99|$06:$8A89:20 23 8B	JSR $8B23  	; given party inventory index in Y, CLC and return equipped item ID in A if corresponding item is equipped and cursed, SEC and return unequipped item ID in A otherwise
0x018A9C|$06:$8A8C:90 B7   	BCC $8A45  
0x018A9E|$06:$8A8E:99 00 06	STA $0600,Y	; Midenhall inventory item 1 (| #$40 if equipped); note that this unequips the item!
; control flow target (from $8A7D, $8A83, $8A87)
0x018AA1|$06:$8A91:C8      	INY        
0x018AA2|$06:$8A92:C6 0C   	DEC $0C    	; number of invetory slots left to check
0x018AA4|$06:$8A94:D0 E4   	BNE $8A7A  
0x018AA6|$06:$8A96:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x018AA8|$06:$8A98:F0 49   	BEQ $8AE3  
0x018AAA|$06:$8A9A:C9 FF   	CMP #$FF   
0x018AAC|$06:$8A9C:F0 45   	BEQ $8AE3  
0x018AAE|$06:$8A9E:A6 12   	LDX $12    
0x018AB0|$06:$8AA0:20 0F 8B	JSR $8B0F  	; given hero ID in $97 and hero inventory index in X, return corresponding item ID in A and party inventory index in X
0x018AB3|$06:$8AA3:29 3F   	AND #$3F   	; strip off the equipped bit
0x018AB5|$06:$8AA5:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x018AB7|$06:$8AA7:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x018AB9|$06:$8AA9:20 A3 A3	JSR $A3A3  	; given item ID in $96 and hero ID in $97, set A to #$80 if hero can equip item, #$00 otherwise
0x018ABC|$06:$8AAC:C9 00   	CMP #$00   
0x018ABE|$06:$8AAE:D0 0F   	BNE $8ABF  
0x018AC0|$06:$8AB0:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018AC3|$06:$8AB3:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018AC6|$06:$8AB6:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018AC9|$06:$8AB9:92	; String ID #$0192: [name] cannot be equipped with the [item].[end-FC]

; data -> code
0x018ACA|$06:$8ABA:C6 49   	DEC $49    	; object hero/target/item/string ID $49
0x018ACC|$06:$8ABC:4C 55 8A	JMP $8A55  

; control flow target (from $8AAE)
0x018ACF|$06:$8ABF:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
; equip item
0x018AD1|$06:$8AC1:09 40   	ORA #$40   
0x018AD3|$06:$8AC3:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x018AD6|$06:$8AC6:A0 04   	LDY #$04   	; there are 4 cursed item in the game
; control flow target (from $8ACE)
0x018AD8|$06:$8AC8:D9 1B 86	CMP $861B,Y	; list of cursed items (equipped), built in offset from $861C
0x018ADB|$06:$8ACB:F0 05   	BEQ $8AD2  
0x018ADD|$06:$8ACD:88      	DEY        
0x018ADE|$06:$8ACE:D0 F8   	BNE $8AC8  
0x018AE0|$06:$8AD0:F0 11   	BEQ $8AE3  
; control flow target (from $8ACB)
0x018AE2|$06:$8AD2:29 3F   	AND #$3F   	; strip off the equipped bit
0x018AE4|$06:$8AD4:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x018AE6|$06:$8AD6:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018AE9|$06:$8AD9:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018AEC|$06:$8ADC:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018AEF|$06:$8ADF:11	; String ID #$0111: [name], too, was cursed.[end-FC]

; data -> code
0x018AF0|$06:$8AE0:4C 4D 8A	JMP $8A4D  

; control flow target (from $8A42, $8A5F, $8A98, $8A9C, $8AD0)
0x018AF3|$06:$8AE3:E6 49   	INC $49    	; object hero/target/item/string ID $49
0x018AF5|$06:$8AE5:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x018AF7|$06:$8AE7:C9 04   	CMP #$04   	; there are 4 EQUIP item types
0x018AF9|$06:$8AE9:F0 03   	BEQ $8AEE  
0x018AFB|$06:$8AEB:4C 19 8A	JMP $8A19  

; control flow target (from $8AE9)
0x018AFE|$06:$8AEE:A5 A5   	LDA $A5    
0x018B00|$06:$8AF0:D0 0D   	BNE $8AFF  	; wait #$14 interrupts, update each hero's stats based on their current EXP, wipe menu and exit COMMAND menu
0x018B02|$06:$8AF2:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018B05|$06:$8AF5:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018B08|$06:$8AF8:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018B0B|$06:$8AFB:A0	; String ID #$01A0: [name] has nothing to equip.[end-FC]

; data -> code
0x018B0C|$06:$8AFC:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; wait #$14 interrupts, update each hero's stats based on their current EXP, wipe menu and exit COMMAND menu
; control flow target (from $8A3B, $8AF0)
0x018B0F|$06:$8AFF:A2 14   	LDX #$14   
; call to code in a different bank ($0F:$C1EE)
0x018B11|$06:$8B01:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; call to code in a different bank ($0F:$D0EC)
0x018B14|$06:$8B04:20 EC D0	JSR $D0EC  	; update each hero's stats based on their current EXP
0x018B17|$06:$8B07:A9 07   	LDA #$07   
; call to code in a different bank ($0F:$CF6A)
0x018B19|$06:$8B09:20 6A CF	JSR $CF6A  	; wipe selected menu region
0x018B1C|$06:$8B0C:4C 6D 80	JMP $806D  	; exit COMMAND menu

; given hero ID in $97 and hero inventory index in X, return corresponding item ID in A and party inventory index in X
; control flow target (from $8528, $8AA0, $989E, $98B9, $991D)
0x018B1F|$06:$8B0F:20 1D 8B	JSR $8B1D  	; set A to hero ID in $97 * 8
0x018B22|$06:$8B12:85 0C   	STA $0C    
0x018B24|$06:$8B14:8A      	TXA        
0x018B25|$06:$8B15:18      	CLC        
0x018B26|$06:$8B16:65 0C   	ADC $0C    
0x018B28|$06:$8B18:AA      	TAX        
0x018B29|$06:$8B19:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x018B2C|$06:$8B1C:60      	RTS        

; set A to hero ID in $97 * 8
; control flow target (from $8A72, $8B0F)
0x018B2D|$06:$8B1D:A5 97   	LDA $97    	; subject hero ID $97
0x018B2F|$06:$8B1F:0A      	ASL        
0x018B30|$06:$8B20:0A      	ASL        
0x018B31|$06:$8B21:0A      	ASL        
0x018B32|$06:$8B22:60      	RTS        

; given party inventory index in Y, CLC and return equipped item ID in A if corresponding item is equipped and cursed, SEC and return unequipped item ID in A otherwise
; control flow target (from $852D, $8A89)
0x018B33|$06:$8B23:B9 00 06	LDA $0600,Y	; Midenhall inventory item 1 (| #$40 if equipped)
0x018B36|$06:$8B26:A2 03   	LDX #$03   	; max index of list of cursed items in the game
; control flow target (from $8B2E)
0x018B38|$06:$8B28:DD 1C 86	CMP $861C,X	; list of equipped cursed items
0x018B3B|$06:$8B2B:F0 07   	BEQ $8B34  
0x018B3D|$06:$8B2D:CA      	DEX        
0x018B3E|$06:$8B2E:10 F8   	BPL $8B28  
0x018B40|$06:$8B30:29 3F   	AND #$3F   
0x018B42|$06:$8B32:38      	SEC        
0x018B43|$06:$8B33:60      	RTS        

; control flow target (from $8B2B)
0x018B44|$06:$8B34:18      	CLC        
0x018B45|$06:$8B35:60      	RTS        

; COMMAND menu SPELL command handler
; indirect control flow target (via $8088)
; call to code in a different bank ($0F:$F545)
0x018B46|$06:$8B36:20 45 F5	JSR $F545  	; depending on number of casters in party, maybe open caster select menu
0x018B49|$06:$8B39:C9 FF   	CMP #$FF   
0x018B4B|$06:$8B3B:D0 03   	BNE $8B40  	; did not cancel menu
; exit COMMAND menu
; control flow target (from $8B73)
0x018B4D|$06:$8B3D:4C 6D 80	JMP $806D  	; exit COMMAND menu

; did not cancel menu
; control flow target (from $8B3B)
0x018B50|$06:$8B40:85 97   	STA $97    	; subject hero ID $97; caster hero ID
0x018B52|$06:$8B42:C9 FE   	CMP #$FE   
0x018B54|$06:$8B44:D0 0F   	BNE $8B55  	; hero is a caster
0x018B56|$06:$8B46:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018B59|$06:$8B49:A9 00   	LDA #$00   	; Midenhall
; call to code in a different bank ($0F:$FC50)
0x018B5B|$06:$8B4B:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018B5E|$06:$8B4E:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018B61|$06:$8B51:01	; String ID #$0101: [name] cannot use the spell.[end-FC]

; data -> code
0x018B62|$06:$8B52:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; hero is a caster
; control flow target (from $8B44)
0x018B65|$06:$8B55:A9 80   	LDA #$80   	; Alive
0x018B67|$06:$8B57:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x018B6A|$06:$8B5A:B0 0D   	BCS $8B69  	; caster is alive
0x018B6C|$06:$8B5C:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018B6F|$06:$8B5F:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x018B72|$06:$8B62:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018B75|$06:$8B65:02	; String ID #$0102: Alas, poor [name] is dead.[end-FC]

; data -> code
0x018B76|$06:$8B66:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; caster is alive
; control flow target (from $8B5A)
0x018B79|$06:$8B69:A5 97   	LDA $97    	; subject hero ID $97; caster hero ID
0x018B7B|$06:$8B6B:38      	SEC        
0x018B7C|$06:$8B6C:E9 01   	SBC #$01   	; Midenhall can't use magic and $0F:$F5EC wants hero ID - 1
; call to code in a different bank ($0F:$F5EC)
0x018B7E|$06:$8B6E:20 EC F5	JSR $F5EC  	; given hero ID - 1 in A, open hero's spell list and return selected spell ID in A
0x018B81|$06:$8B71:C9 FF   	CMP #$FF   
0x018B83|$06:$8B73:F0 C8   	BEQ $8B3D  	; exit COMMAND menu
0x018B85|$06:$8B75:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; selected spell ID
0x018B87|$06:$8B77:AA      	TAX        
0x018B88|$06:$8B78:20 AA 8D	JSR $8DAA  	; given hero ID in $97, set Y to start of hero's data in $062D,Y, i.e. Y = $97 * #$12
0x018B8B|$06:$8B7B:B9 3D 06	LDA $063D,Y	; Midenhall Current MP
0x018B8E|$06:$8B7E:DD DD 8C	CMP $8CDD,X	; MP costs (built in offset from real data at $8CE6)
0x018B91|$06:$8B81:B0 07   	BCS $8B8A  	; hero has enough MP to cast
; call to code in a different bank ($0F:$F6EA)
0x018B93|$06:$8B83:20 EA F6	JSR $F6EA  	; open main dialogue window and display string ID specified by byte following JSR

; code -> data
; indirect data load target
0x018B96|$06:$8B86:11	; String ID #$0011: Thy MP is low.[end-FC]

; data -> code
0x018B97|$06:$8B87:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; hero has enough MP to cast
; control flow target (from $8B81)
0x018B9A|$06:$8B8A:A0 04   	LDY #$04   	; there are 5 single-target spells on the field
0x018B9C|$06:$8B8C:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; selected spell ID
; check if spell is a healing spell
; control flow target (from $8B94)
0x018B9E|$06:$8B8E:D9 E1 8C	CMP $8CE1,Y	; single-target spell list, field
0x018BA1|$06:$8B91:F0 05   	BEQ $8B98  	; chose a healing spell
0x018BA3|$06:$8B93:88      	DEY        
0x018BA4|$06:$8B94:10 F8   	BPL $8B8E  	; check if spell is a healing spell
0x018BA6|$06:$8B96:30 0C   	BMI $8BA4  	; cast spell
; chose a healing spell
; control flow target (from $8B91)
; call to code in a different bank ($0F:$F579)
0x018BA8|$06:$8B98:20 79 F5	JSR $F579  	; display appropriate main SPELL target menu
0x018BAB|$06:$8B9B:C9 FF   	CMP #$FF   
0x018BAD|$06:$8B9D:D0 03   	BNE $8BA2  	; update target hero ID
0x018BAF|$06:$8B9F:4C 6D 80	JMP $806D  	; exit COMMAND menu

; update target hero ID
; control flow target (from $8B9D)
0x018BB2|$06:$8BA2:85 49   	STA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
; cast spell
; control flow target (from $8B96)
0x018BB4|$06:$8BA4:20 AA 8D	JSR $8DAA  	; given hero ID in $97, set Y to start of hero's data in $062D,Y, i.e. Y = $97 * #$12
0x018BB7|$06:$8BA7:A6 96   	LDX $96    	; temp storage for item/spell/type/etc. IDs; selected spell ID
0x018BB9|$06:$8BA9:B9 3D 06	LDA $063D,Y	; Midenhall Current MP
0x018BBC|$06:$8BAC:38      	SEC        
0x018BBD|$06:$8BAD:FD DD 8C	SBC $8CDD,X	; MP costs (built in offset from real data at $8CE6)
0x018BC0|$06:$8BB0:99 3D 06	STA $063D,Y	; Midenhall Current MP
0x018BC3|$06:$8BB3:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018BC6|$06:$8BB6:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x018BC9|$06:$8BB9:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; selected spell ID
0x018BCB|$06:$8BBB:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$FA2A)
0x018BCD|$06:$8BBD:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x018BD0|$06:$8BC0:1A	; String ID #$001A: [name] chanted the spell of [spell].[end-FC]

; data -> code
0x018BD1|$06:$8BC1:A9 90   	LDA #$90   	; Music ID #$90: casting SFX
; call to code in a different bank ($0F:$C561)
0x018BD3|$06:$8BC3:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; call to code in a different bank ($0F:$C515)
0x018BD6|$06:$8BC6:20 15 C5	JSR $C515  	; flash screen 10 times
0x018BD9|$06:$8BC9:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; selected spell ID
0x018BDB|$06:$8BCB:C9 09   	CMP #$09   	; Spell ID #$09: Heal
0x018BDD|$06:$8BCD:D0 04   	BNE $8BD3  	; spell ID is not #$09
0x018BDF|$06:$8BCF:A2 40   	LDX #$40   	; power on field for Heal
0x018BE1|$06:$8BD1:D0 0E   	BNE $8BE1  
; spell ID is not #$09
; control flow target (from $8BCD)
0x018BE3|$06:$8BD3:C9 0B   	CMP #$0B   	; Spell ID #$0B: Healmore
0x018BE5|$06:$8BD5:D0 04   	BNE $8BDB  	; spell ID is not #$09 or #$0B
0x018BE7|$06:$8BD7:A2 64   	LDX #$64   	; power on field for Healmore
0x018BE9|$06:$8BD9:D0 06   	BNE $8BE1  
; spell ID is not #$09 or #$0B
; control flow target (from $8BD5)
0x018BEB|$06:$8BDB:C9 0D   	CMP #$0D   	; Spell ID #$0D: Healall
0x018BED|$06:$8BDD:D0 24   	BNE $8C03  	; spell ID is not #$09, #$0B, or #$0D
0x018BEF|$06:$8BDF:A2 FF   	LDX #$FF   	; power on field for Healall
; control flow target (from $8BD1, $8BD9)
0x018BF1|$06:$8BE1:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018BF3|$06:$8BE3:20 AC 8D	JSR $8DAC  	; given hero ID in A, set Y to start of hero's data in $062D,Y, i.e. Y = A * #$12
0x018BF6|$06:$8BE6:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018BF9|$06:$8BE9:10 51   	BPL $8C3C  	; spell ineffective; can't heal dead people :(
0x018BFB|$06:$8BEB:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
; call to code in a different bank ($0F:$D146)
0x018BFD|$06:$8BED:20 46 D1	JSR $D146  	; heal hero ID in A by random amount based on healing power in X
; call to code in a different bank ($0F:$C22C)
0x018C00|$06:$8BF0:20 2C C2	JSR $C22C  
0x018C03|$06:$8BF3:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
; call to code in a different bank ($0F:$FC50)
0x018C05|$06:$8BF5:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2A)
0x018C08|$06:$8BF8:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x018C0B|$06:$8BFB:17	; String ID #$0017: [name]'s wounds were healed.[end-FC]

; data -> code
; call to code in a different bank ($0F:$EB76)
0x018C0C|$06:$8BFC:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018C0F|$06:$8BFF:01	; Menu ID #$01: Mini status window, top, Midenhall only

; data -> code
0x018C10|$06:$8C00:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; spell ID is not #$09, #$0B, or #$0D
; control flow target (from $8BDD)
0x018C13|$06:$8C03:C9 10   	CMP #$10   	; Spell ID #$10: Antidote
0x018C15|$06:$8C05:D0 29   	BNE $8C30  	; spell ID is not #$09, #$0B, #$0D, or #$10
0x018C17|$06:$8C07:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018C19|$06:$8C09:20 AC 8D	JSR $8DAC  	; given hero ID in A, set Y to start of hero's data in $062D,Y, i.e. Y = A * #$12
0x018C1C|$06:$8C0C:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018C1F|$06:$8C0F:29 20   	AND #$20   	; pick out the poison bit from hero status byte
0x018C21|$06:$8C11:F0 29   	BEQ $8C3C  	; spell ineffective
0x018C23|$06:$8C13:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
; call to code in a different bank ($0F:$FC50)
0x018C25|$06:$8C15:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2A)
0x018C28|$06:$8C18:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x018C2B|$06:$8C1B:43	; String ID #$0043: The poison was drawn out of [name]'s wound.[end-FC]

; data -> code
0x018C2C|$06:$8C1C:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018C2E|$06:$8C1E:20 AC 8D	JSR $8DAC  	; given hero ID in A, set Y to start of hero's data in $062D,Y, i.e. Y = A * #$12
0x018C31|$06:$8C21:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018C34|$06:$8C24:29 DF   	AND #$DF   	; set poison bit to 0
0x018C36|$06:$8C26:99 2D 06	STA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
; call to code in a different bank ($0F:$EB76)
0x018C39|$06:$8C29:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x018C3C|$06:$8C2C:01	; Menu ID #$01: Mini status window, top

; data -> code
; control flow target (from $8C4B)
0x018C3D|$06:$8C2D:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; spell ID is not #$09, #$0B, #$0D, or #$10
; control flow target (from $8C05)
0x018C40|$06:$8C30:C9 12   	CMP #$12   	; Spell ID #$12: Outside
0x018C42|$06:$8C32:D0 0F   	BNE $8C43  	; spell ID is not #$09, #$0B, #$0D, #$10, or #$12
0x018C44|$06:$8C34:20 D4 8C	JSR $8CD4  	; handler for Outside spell effect
0x018C47|$06:$8C37:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$D88F)
0x018C49|$06:$8C39:4C 8F D8	JMP $D88F  	; warp to warp point given by ($0C)

; spell ineffective
; control flow target (from $8BE9, $8C11, $8C56, $8CAB, $8CDE)
; call to code in a different bank ($0F:$FA2E)
0x018C4C|$06:$8C3C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018C4F|$06:$8C3F:9E	; String ID #$019E: But nothing happened.[end-FC]

; data -> code
0x018C50|$06:$8C40:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; spell ID is not #$09, #$0B, #$0D, #$10, or #$12
; control flow target (from $8C32)
0x018C53|$06:$8C43:C9 13   	CMP #$13   	; Spell ID #$13: Repel
0x018C55|$06:$8C45:D0 06   	BNE $8C4D  	; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$13
0x018C57|$06:$8C47:A9 FE   	LDA #$FE   
0x018C59|$06:$8C49:85 46   	STA $46    	; Repel (#$FE) / Fairy Water (#$FF) flag
0x018C5B|$06:$8C4B:D0 E0   	BNE $8C2D  
; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$13
; control flow target (from $8C45)
0x018C5D|$06:$8C4D:C9 14   	CMP #$14   	; Spell ID #$14: Return
0x018C5F|$06:$8C4F:D0 11   	BNE $8C62  	; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$14
; handler for Return spell effect
; control flow target (from $9661)
0x018C61|$06:$8C51:A2 02   	LDX #$02   
; call to code in a different bank ($0F:$D2E7)
0x018C63|$06:$8C53: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
0x018C66|$06:$8C56:B0 E4   	BCS $8C3C  	; spell ineffective
0x018C68|$06:$8C58:A9 95   	LDA #$95   	; Music ID #$95: Return SFX
; call to code in a different bank ($0F:$C561)
0x018C6A|$06:$8C5A:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x018C6D|$06:$8C5D:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$D88F)
0x018C6F|$06:$8C5F:4C 8F D8	JMP $D88F  	; warp to warp point given by ($0C)

; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$14
; control flow target (from $8C4F)
0x018C72|$06:$8C62:C9 15   	CMP #$15   	; Spell ID #$15: Open
0x018C74|$06:$8C64:D0 2E   	BNE $8C94  	; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$15
0x018C76|$06:$8C66:A9 00   	LDA #$00   
0x018C78|$06:$8C68:85 C9   	STA $C9    
; call to code in a different bank ($0F:$CF7C)
0x018C7A|$06:$8C6A:20 7C CF	JSR $CF7C  
0x018C7D|$06:$8C6D:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018C7F|$06:$8C6F:C9 FF   	CMP #$FF   
0x018C81|$06:$8C71:F0 1E   	BEQ $8C91  
0x018C83|$06:$8C73:A9 01   	LDA #$01   
0x018C85|$06:$8C75:85 C9   	STA $C9    
; call to code in a different bank ($0F:$CF7C)
0x018C87|$06:$8C77:20 7C CF	JSR $CF7C  
0x018C8A|$06:$8C7A:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018C8C|$06:$8C7C:C9 FF   	CMP #$FF   
0x018C8E|$06:$8C7E:F0 11   	BEQ $8C91  
0x018C90|$06:$8C80:A9 02   	LDA #$02   
0x018C92|$06:$8C82:85 C9   	STA $C9    
; call to code in a different bank ($0F:$CF7C)
0x018C94|$06:$8C84:20 7C CF	JSR $CF7C  
0x018C97|$06:$8C87:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018C99|$06:$8C89:C9 FF   	CMP #$FF   
0x018C9B|$06:$8C8B:F0 04   	BEQ $8C91  
; call to code in a different bank ($0F:$FA2E)
0x018C9D|$06:$8C8D:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x018CA0|$06:$8C90:3B	; String ID #$013B: There is no door here.[end-FC]

; data -> code
; control flow target (from $8C71, $8C7E, $8C8B)
0x018CA1|$06:$8C91:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$15
; control flow target (from $8C64)
0x018CA4|$06:$8C94:C9 16   	CMP #$16   	; Spell ID #$16: Stepguard
0x018CA6|$06:$8C96:D0 07   	BNE $8C9F  	; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$16; ergo it's Spell ID #$17: Revive
0x018CA8|$06:$8C98:A9 FF   	LDA #$FF   
0x018CAA|$06:$8C9A:85 47   	STA $47    	; Stepguard flag
0x018CAC|$06:$8C9C:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$16; ergo it's Spell ID #$17: Revive
; control flow target (from $8C96, $964B)
0x018CAF|$06:$8C9F:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018CB1|$06:$8CA1:20 AC 8D	JSR $8DAC  	; given hero ID in A, set Y to start of hero's data in $062D,Y, i.e. Y = A * #$12
0x018CB4|$06:$8CA4:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018CB7|$06:$8CA7:29 80   	AND #$80   	; Alive
0x018CB9|$06:$8CA9:F0 03   	BEQ $8CAE  
0x018CBB|$06:$8CAB:4C 3C 8C	JMP $8C3C  	; spell ineffective

; control flow target (from $8CA9)
0x018CBE|$06:$8CAE:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
0x018CC0|$06:$8CB0:85 97   	STA $97    	; subject hero ID $97
0x018CC2|$06:$8CB2:20 AC 8D	JSR $8DAC  	; given hero ID in A, set Y to start of hero's data in $062D,Y, i.e. Y = A * #$12
0x018CC5|$06:$8CB5:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018CC8|$06:$8CB8:09 80   	ORA #$80   	; Alive
0x018CCA|$06:$8CBA:99 2D 06	STA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018CCD|$06:$8CBD:A9 01   	LDA #$01   	; revive with 1 HP
0x018CCF|$06:$8CBF:99 3B 06	STA $063B,Y	; Midenhall Current HP, low byte
; call to code in a different bank ($0F:$D302)
0x018CD2|$06:$8CC2:20 02 D3	JSR $D302  
; call to code in a different bank ($0F:$C22C)
0x018CD5|$06:$8CC5:20 2C C2	JSR $C22C  
0x018CD8|$06:$8CC8:A5 49   	LDA $49    	; object hero/target/item/string ID $49; target hero ID for single-target spells
; call to code in a different bank ($0F:$FC50)
0x018CDA|$06:$8CCA:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2A)
0x018CDD|$06:$8CCD:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x018CE0|$06:$8CD0:44	; String ID #$0044: [name] returned to life.[end-FC]

; data -> code
0x018CE1|$06:$8CD1:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for Outside spell effect
; control flow target (from $8C34)
; external control flow target (from $0F:$D597, $0F:$D59D)
0x018CE4|$06:$8CD4:A2 01   	LDX #$01   
; call to code in a different bank ($0F:$D2E7)
0x018CE6|$06:$8CD6: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
0x018CE9|$06:$8CD9:B0 01   	BCS $8CDC  
0x018CEB|$06:$8CDB:60      	RTS        

; control flow target (from $8CD9)
0x018CEC|$06:$8CDC:68      	PLA        
; MP costs (built in offset from real data at $8CE6)
; indexed data load target (from $8B7E, $8BAD)
0x018CED|$06:$8CDD:68      	PLA        
0x018CEE|$06:$8CDE:4C 3C 8C	JMP $8C3C  	; spell ineffective


; code -> data
; single-target spell list, field
; indexed data load target (from $8B8E)
0x018CF1|$06:$8CE1:09	; Spell ID #$09: Heal
0x018CF2|$06:$8CE2:0B	; Spell ID #$0B: Healmore
0x018CF3|$06:$8CE3:0D	; Spell ID #$0D: Healall
0x018CF4|$06:$8CE4:10	; Spell ID #$10: Antidote
0x018CF5|$06:$8CE5:17	; Spell ID #$17: Revive

; MP Cost for Spells on Field (referenced as $8CDD,X)
0x018CF6|$06:$8CE6:03	; Spell ID #$09: Heal
0x018CF7|$06:$8CE7:00	; Spell ID #$0A: Increase
0x018CF8|$06:$8CE8:05	; Spell ID #$0B: Healmore
0x018CF9|$06:$8CE9:00	; Spell ID #$0C: Sacrifice
0x018CFA|$06:$8CEA:08	; Spell ID #$0D: Healall
0x018CFB|$06:$8CEB:00	; Spell ID #$0E: Explodet
0x018CFC|$06:$8CEC:00	; Spell ID #$0F: Chance
0x018CFD|$06:$8CED:03	; Spell ID #$10: Antidote
0x018CFE|$06:$8CEE:02	; Spell ID #$11: Heal (not used by heroes)
0x018CFF|$06:$8CEF:06	; Spell ID #$12: Outside
0x018D00|$06:$8CF0:02	; Spell ID #$13: Repel
0x018D01|$06:$8CF1:06	; Spell ID #$14: Return
0x018D02|$06:$8CF2:02	; Spell ID #$15: Open
0x018D03|$06:$8CF3:04	; Spell ID #$16: Stepguard
0x018D04|$06:$8CF4:0F	; Spell ID #$17: Revive

; data -> code
; add $8F-$90 to party gold, capped at $FFFF
; control flow target (from $8536, $9C58)
0x018D05|$06:$8CF5:A5 8F   	LDA $8F    
0x018D07|$06:$8CF7:18      	CLC        
0x018D08|$06:$8CF8:6D 24 06	ADC $0624  	; party gold, low byte
0x018D0B|$06:$8CFB:8D 24 06	STA $0624  	; party gold, low byte
0x018D0E|$06:$8CFE:A5 90   	LDA $90    
0x018D10|$06:$8D00:6D 25 06	ADC $0625  	; party gold, high byte
0x018D13|$06:$8D03:8D 25 06	STA $0625  	; party gold, high byte
0x018D16|$06:$8D06:90 08   	BCC $8D10  	; cap party gold at 65,535
0x018D18|$06:$8D08:A9 FF   	LDA #$FF   
0x018D1A|$06:$8D0A:8D 24 06	STA $0624  	; party gold, low byte
0x018D1D|$06:$8D0D:8D 25 06	STA $0625  	; party gold, high byte
; control flow target (from $8D06)
0x018D20|$06:$8D10:60      	RTS        

; given item ID in $96 and discount amount in $8F-$90, set $8F-$90 to discounted item price
; control flow target (from $8355, $8462)
0x018D21|$06:$8D11:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x018D23|$06:$8D13:0A      	ASL        	; item prices are 2 bytes each
0x018D24|$06:$8D14:A8      	TAY        
0x018D25|$06:$8D15:B9 FC 9F	LDA $9FFC,Y	; Item Prices, low byte
0x018D28|$06:$8D18:38      	SEC        
0x018D29|$06:$8D19:E5 8F   	SBC $8F    
0x018D2B|$06:$8D1B:85 8F   	STA $8F    
0x018D2D|$06:$8D1D:B9 FD 9F	LDA $9FFD,Y	; Item Prices, high byte
0x018D30|$06:$8D20:E5 90   	SBC $90    
0x018D32|$06:$8D22:85 90   	STA $90    
0x018D34|$06:$8D24:60      	RTS        

; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; control flow target (from $8324, $833E, $8379, $83FC, $8438, $84AD, $8599, $85F0, $863E, $8691, $8AB3, $8AD9, $8AF5, $8B5F, $8BB6, $8F26, $904A, $9125, $9476, $959D, $95C0, $963A, $9652, $96D4, $9830, $99B7, $99E5, $99F2, $9A0D, $9A26, $9A31, $9A55, $9A5F, $9A6F, $9A7A, $9A9F, $9AAC, $9AF1, $9B1E, $9D2D, $9D3C)
0x018D35|$06:$8D25:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$FC50)
0x018D37|$06:$8D27:4C 50 FC	JMP $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA

; set $8F-$90 to A-#$00
; control flow target (from $9C75)
0x018D3A|$06:$8D2A:85 8F   	STA $8F    
0x018D3C|$06:$8D2C:A9 00   	LDA #$00   
0x018D3E|$06:$8D2E:85 90   	STA $90    
0x018D40|$06:$8D30:60      	RTS        

; given gold amount in $8F-$90, decrease party gold by that amount and SEC if possible, CLC otherwise
; control flow target (from $823D, $8688, $8D7B, $9130)
0x018D41|$06:$8D31:AD 24 06	LDA $0624  	; party gold, low byte
0x018D44|$06:$8D34:38      	SEC        
0x018D45|$06:$8D35:E5 8F   	SBC $8F    	; amount to subtract, low byte
0x018D47|$06:$8D37:85 0C   	STA $0C    
0x018D49|$06:$8D39:AD 25 06	LDA $0625  	; party gold, high byte
0x018D4C|$06:$8D3C:E5 90   	SBC $90    	; amount to subtract, high byte
0x018D4E|$06:$8D3E:85 0D   	STA $0D    
0x018D50|$06:$8D40:90 0A   	BCC $8D4C  	; C clear => not enough gold, so just RTS
0x018D52|$06:$8D42:A5 0C   	LDA $0C    	; otherwise, C is set; update party gold with new total
0x018D54|$06:$8D44:8D 24 06	STA $0624  	; party gold, low byte
0x018D57|$06:$8D47:A5 0D   	LDA $0D    
0x018D59|$06:$8D49:8D 25 06	STA $0625  	; party gold, high byte
; control flow target (from $8D40)
0x018D5C|$06:$8D4C:60      	RTS        

; given item ID in A, save it to $96 and set $8F-$90 to purchase price of item, accounting for possible Golden Card discount; decrease party gold by that amount and SEC if possible, CLC otherwise
; control flow target (from $82E5, $83E2)
0x018D5D|$06:$8D4D:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x018D5F|$06:$8D4F:0A      	ASL        	; price list is 2 bytes wide
0x018D60|$06:$8D50:A8      	TAY        
0x018D61|$06:$8D51:B9 FC 9F	LDA $9FFC,Y	; Item Prices, low byte
0x018D64|$06:$8D54:85 8F   	STA $8F    
0x018D66|$06:$8D56:B9 FD 9F	LDA $9FFD,Y	; Item Prices, high byte
0x018D69|$06:$8D59:85 90   	STA $90    
0x018D6B|$06:$8D5B:A9 32   	LDA #$32   	; Item ID #$32: Golden Card
0x018D6D|$06:$8D5D: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
0x018D70|$06:$8D60:C9 FF   	CMP #$FF   
0x018D72|$06:$8D62:F0 17   	BEQ $8D7B  	; branch if no Golden Card, otherwise extra string and altered price
0x018D74|$06:$8D64:46 90   	LSR $90    	; 16-bit LSR
0x018D76|$06:$8D66:66 8F   	ROR $8F    
0x018D78|$06:$8D68:46 90   	LSR $90    	; 16-bit LSR
0x018D7A|$06:$8D6A:66 8F   	ROR $8F    
0x018D7C|$06:$8D6C:B9 FC 9F	LDA $9FFC,Y	; Item Prices, low byte
0x018D7F|$06:$8D6F:38      	SEC        
0x018D80|$06:$8D70:E5 8F   	SBC $8F    
0x018D82|$06:$8D72:85 8F   	STA $8F    
0x018D84|$06:$8D74:B9 FD 9F	LDA $9FFD,Y	; Item Prices, high byte
0x018D87|$06:$8D77:E5 90   	SBC $90    
0x018D89|$06:$8D79:85 90   	STA $90    	; 25% discount
; control flow target (from $8D62)
0x018D8B|$06:$8D7B:4C 31 8D	JMP $8D31  	; given gold amount in $8F-$90, decrease party gold by that amount and SEC if possible, CLC otherwise

; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
; control flow target (from $836F, $83F7, $8433, $8479, $872E, $92A9, $9313, $9A07, $9C70, $9C8B, $A2D2, $A2D9, $A2E0)
0x018D8E|$06:$8D7E:A5 97   	LDA $97    	; subject hero ID $97; hero ID
0x018D90|$06:$8D80:0A      	ASL        	; 8 inventory slots per hero
0x018D91|$06:$8D81:0A      	ASL        
0x018D92|$06:$8D82:0A      	ASL        
0x018D93|$06:$8D83:A8      	TAY        
0x018D94|$06:$8D84:A2 00   	LDX #$00   	; loop counter
; control flow target (from $8D8F)
0x018D96|$06:$8D86:B9 00 06	LDA $0600,Y	; Midenhall inventory item 1 (| #$40 if equipped)
0x018D99|$06:$8D89:F0 08   	BEQ $8D93  	; if empty slot, go add item
0x018D9B|$06:$8D8B:C8      	INY        	; else, increment inventory index and loop counter
0x018D9C|$06:$8D8C:E8      	INX        
0x018D9D|$06:$8D8D:E0 08   	CPX #$08   	; 8 inventory slots per hero
0x018D9F|$06:$8D8F:D0 F5   	BNE $8D86  	; if more inventory slots to check, loop to check them
0x018DA1|$06:$8D91:18      	CLC        	; at this point, we know hero's inventory is already full, so flag failure for calling code
0x018DA2|$06:$8D92:60      	RTS        

; control flow target (from $8D89)
0x018DA3|$06:$8D93:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x018DA5|$06:$8D95:99 00 06	STA $0600,Y	; Midenhall inventory item 1 (| #$40 if equipped); add to hero's inventory
0x018DA8|$06:$8D98:38      	SEC        	; flag success for calling code
0x018DA9|$06:$8D99:60      	RTS        

; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
; control flow target (from $8339, $8594, $8639, $8B57, $9045, $9453, $946C, $9499, $94A3, $9595, $95EA, $9608, $99E0, $9A21, $9A36, $9A50, $9A9A, $9ADB, $9D25)
0x018DAA|$06:$8D9A:85 0C   	STA $0C    
0x018DAC|$06:$8D9C:20 AA 8D	JSR $8DAA  	; given hero ID in $97, set Y to start of hero's data in $062D,Y, i.e. Y = $97 * #$12
0x018DAF|$06:$8D9F:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018DB2|$06:$8DA2:25 0C   	AND $0C    
0x018DB4|$06:$8DA4:F0 02   	BEQ $8DA8  
0x018DB6|$06:$8DA6:38      	SEC        
0x018DB7|$06:$8DA7:60      	RTS        

; control flow target (from $8DA4)
0x018DB8|$06:$8DA8:18      	CLC        
0x018DB9|$06:$8DA9:60      	RTS        

; given hero ID in $97, set Y to start of hero's data in $062D,Y, i.e. Y = $97 * #$12
; control flow target (from $85B2, $8659, $86A6, $8B78, $8BA4, $8D9C)
0x018DBA|$06:$8DAA:A5 97   	LDA $97    	; subject hero ID $97
; given hero ID in A, set Y to start of hero's data in $062D,Y, i.e. Y = A * #$12
; control flow target (from $8BE3, $8C09, $8C1E, $8CA1, $8CB2, $960F)
0x018DBC|$06:$8DAC:F0 0A   	BEQ $8DB8  	; if it's Midenhall, use + #$00
0x018DBE|$06:$8DAE:C9 01   	CMP #$01   	; is it Cannock?
0x018DC0|$06:$8DB0:D0 04   	BNE $8DB6  	; if no, keep checking
0x018DC2|$06:$8DB2:A9 12   	LDA #$12   	; if yes, use + #$12
0x018DC4|$06:$8DB4:D0 02   	BNE $8DB8  	; and skip over Moonbrooke
; control flow target (from $8DB0)
0x018DC6|$06:$8DB6:A9 24   	LDA #$24   	; it's Moonbrooke, so use + #$24
; control flow target (from $8DAC, $8DB4)
0x018DC8|$06:$8DB8:A8      	TAY        
0x018DC9|$06:$8DB9:60      	RTS        

; given a hero ID in $97 and an item ID in A, SEC if hero has that item, CLC otherwise
; control flow target (from $85E7, $9897, $98B2, $9916)
0x018DCA|$06:$8DBA:48      	PHA        
0x018DCB|$06:$8DBB:A5 97   	LDA $97    	; subject hero ID $97
0x018DCD|$06:$8DBD:85 9C   	STA $9C    
0x018DCF|$06:$8DBF:68      	PLA        
; call to code in a different bank ($0F:$C4B0)
0x018DD0|$06:$8DC0:4C B0 C4	JMP $C4B0  	; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise

; given a hero ID in $97 and an item ID in A, remove that item from hero's inventory if present and SEC, CLC otherwise
; control flow target (from $8612, $8716)
0x018DD3|$06:$8DC3:48      	PHA        
0x018DD4|$06:$8DC4:A5 97   	LDA $97    	; subject hero ID $97
0x018DD6|$06:$8DC6:85 9C   	STA $9C    
0x018DD8|$06:$8DC8:68      	PLA        
; call to code in a different bank ($0F:$C4B6)
0x018DD9|$06:$8DC9:4C B6 C4	JMP $C4B6  	; 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

; restore full HP to all living party members
; control flow target (from $825B, $951C)
; external control flow target (from $0F:$C789, $0F:$D289)
0x018DDC|$06:$8DCC:A0 00   	LDY #$00   
; control flow target (from $8DE9)
0x018DDE|$06:$8DCE:B9 3B 06	LDA $063B,Y	; Midenhall Current HP, low byte
0x018DE1|$06:$8DD1:19 3C 06	ORA $063C,Y	; Midenhall Current HP, high byte
0x018DE4|$06:$8DD4:F0 0C   	BEQ $8DE2  	; branch if current HP is #$00
0x018DE6|$06:$8DD6:B9 30 06	LDA $0630,Y	; Midenhall Max HP low byte
0x018DE9|$06:$8DD9:99 3B 06	STA $063B,Y	; Midenhall Current HP, low byte
0x018DEC|$06:$8DDC:B9 31 06	LDA $0631,Y	; Midenhall Max HP high byte
0x018DEF|$06:$8DDF:99 3C 06	STA $063C,Y	; Midenhall Current HP, high byte
; control flow target (from $8DD4)
0x018DF2|$06:$8DE2:98      	TYA        
0x018DF3|$06:$8DE3:18      	CLC        
0x018DF4|$06:$8DE4:69 12   	ADC #$12   	; hero data is #$12 bytes each
0x018DF6|$06:$8DE6:A8      	TAY        
0x018DF7|$06:$8DE7:C9 36   	CMP #$36   	; and there are 3 heroes
0x018DF9|$06:$8DE9:D0 E3   	BNE $8DCE  	; if more heroes to heal, heal them
0x018DFB|$06:$8DEB:60      	RTS        

; restore full MP to all living party members
; control flow target (from $825E, $9175)
; external control flow target (from $0F:$C78C)
0x018DFC|$06:$8DEC:A0 00   	LDY #$00   	; start with Midenhall
; control flow target (from $8E03)
0x018DFE|$06:$8DEE:B9 3B 06	LDA $063B,Y	; Midenhall Current HP, low byte
0x018E01|$06:$8DF1:19 3C 06	ORA $063C,Y	; Midenhall Current HP, high byte
0x018E04|$06:$8DF4:F0 06   	BEQ $8DFC  	; zero HP => dead, right?
0x018E06|$06:$8DF6:B9 32 06	LDA $0632,Y	; Midenhall Max MP
0x018E09|$06:$8DF9:99 3D 06	STA $063D,Y	; Midenhall Current MP
; control flow target (from $8DF4)
0x018E0C|$06:$8DFC:98      	TYA        
0x018E0D|$06:$8DFD:18      	CLC        
0x018E0E|$06:$8DFE:69 12   	ADC #$12   	; hero data is #$12 bytes wide
0x018E10|$06:$8E00:A8      	TAY        
0x018E11|$06:$8E01:C9 36   	CMP #$36   	; max of 3 heroes at #$12 each => stop at #$36
0x018E13|$06:$8E03:D0 E9   	BNE $8DEE  	; if more heroes to check, check them
0x018E15|$06:$8E05:60      	RTS        

; handler for dialogue IDs #$29-#$94 (open dialogue window and display string specified by A + #$1D7, i.e. String IDs #$0200-#$026B)
; control flow target (from $81F0)
0x018E16|$06:$8E06:38      	SEC        
0x018E17|$06:$8E07:E9 29   	SBC #$29   
0x018E19|$06:$8E09:85 49   	STA $49    	; object hero/target/item/string ID $49
0x018E1B|$06:$8E0B:48      	PHA        	; string ID
0x018E1C|$06:$8E0C:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018E1F|$06:$8E0F:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$FC50)
0x018E21|$06:$8E11:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x018E24|$06:$8E14:68      	PLA        	; string ID
0x018E25|$06:$8E15:C9 64   	CMP #$64   	; either this or the above call to $FC50 are useless
0x018E27|$06:$8E17:90 17   	BCC $8E30  
0x018E29|$06:$8E19:48      	PHA        	; string ID
0x018E2A|$06:$8E1A:C9 6A   	CMP #$6A   
0x018E2C|$06:$8E1C:B0 04   	BCS $8E22  
0x018E2E|$06:$8E1E:A9 00   	LDA #$00   	; Midenhall
0x018E30|$06:$8E20:F0 0A   	BEQ $8E2C  
; control flow target (from $8E1C)
0x018E32|$06:$8E22:C9 6A   	CMP #$6A   	; string ID #026A uses Cannock's name
0x018E34|$06:$8E24:D0 04   	BNE $8E2A  	; string IDs > #026A uses Moonbrooke's name
0x018E36|$06:$8E26:A9 01   	LDA #$01   	; Cannock
0x018E38|$06:$8E28:D0 02   	BNE $8E2C  
; control flow target (from $8E24)
0x018E3A|$06:$8E2A:A9 02   	LDA #$02   	; Moonbrooke
; control flow target (from $8E20, $8E28)
; call to code in a different bank ($0F:$FC50)
0x018E3C|$06:$8E2C:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x018E3F|$06:$8E2F:68      	PLA        	; String IDs #$0200-#$026B: "‘When in need, visit the Houses of Healing[.’][end-FC]" / "‘[name] is still inexperienced.[line]Return here in thy need[.’][end-FC]" / "‘One who sets foot upon the Travel Door is transported to a distant place[.’][end-FC]" / "‘The Dragon's Bane is a magic charm[.’][wait][line]‘It is said that it may keep one safe from the spell[.’][end-FC]" / "‘If thy path leads west of this castle thou shall reach the town of Leftwyne[.’][end-FC]" / "‘This is Midenhall Castle[.’][end-FC]" / "‘Remember to equip thyself with weapons and armor when thou obtains such items[.’][end-FC]" / "‘Woof, woof!’[end-FC]" / "‘[name], royalty should not venture into prisons such as this[.’][end-FC]" / "‘I have heard that the heir of our good King has ventured forth to do battle with the evil sorcerer, Hargon[.’][wait][line]‘What? Thou art the one? Luck be with thee[.’][end-FC]" / "‘If thou art poisoned, each step will weaken thee further[.’][end-FC]" / "‘Northward lies the castle of Cannock, my friend[.’][end-FC]" / "‘Welcome to Leftwyne[.’][end-FC]" / "‘Look for the monolith by the inland sea west of this place[.’][wait][line]‘It is by that route alone that thou shall reach Moonbrooke[.’][end-FC]" / "‘Oh, thou scared me! And my hiccups are cured! Thank thee, stranger[.’][end-FC]" / "‘Bow-wow!’[end-FC]" / "‘I have heard of a cave far to the east in which the Spring of Bravery rises[.’][end-FC]" / "‘Welcome to Cannock Castle[.’][end-FC]" / "‘Only if the descendants of Erdrick combine their skills can the forces of evil be overcome[.’][end-FC]" / "‘If thou would speak to the prisoners, do so through the barred doors[.’][end-FC]" / "‘Pssst.[line]I'll tell thee a secret[.’][wait][line]‘There is a silver key that opens doors of silver[.’][end-FC]" / "‘What does it matter if people steal things[.’][wait][line]‘The world is doomed no matter what happens[.’][end-FC]" / "‘I saw the sky burning red on the southern horizon[.’][wait][line]‘Perhaps it was Moonbrooke Castle in flames[.’][end-FC]" / "‘Listen closely[.’][wait][line]‘Our prince has studied the ways of magic, though with heavy armor or weapons he has no skill[.’][wait][line]‘Still, he seeks to fight evil[.’][end-FC]" / "‘There is a legend that tells of a great and good wizard who lives in a cave in the sea[.’][wait][line]‘If thou hast the five crests he will come to thee[.’][end-FC]" / "‘Here in Hamlin not all is as it seems[.’][wait][line]‘Talk to everyone, for appearances may not reflect the true person[.’][end-FC]" / "‘Southwest of this village lies the castle of Moonbrooke[.’][end-FC]" / "‘Some say that there is a tall tower, and in it a brave adventurer may find the Cloak of Wind[.’][wait][line]‘It can save thee if thou falls from a great height[.’][end-FC]" / "‘The Mirror of Ra was lost long ago in a swamp southeast of Hamlin in the place where four bridges can be seen[.’][end-FC]" / "‘Help! Help! Hargon is coming to destroy us all!’[end-FC]" / "‘Of keys and doors I know this[.’][wait][line]‘There are silver keys and golden keys, and doors to match them each[.’][wait][line]‘Seek thee first the silver key, for this is what I teach[.’][wait][line]‘That key is in the Cave of the Lake, west of Cannock's walls[.’][wait][line]‘But go only with a friend inside, or there thou shall surely fall[.’][end-FC]" / "‘Eastward, across an arm of the sea lies the kingdom of Alefgard[.’][wait][line]‘From there in ages past came a great warrior ‟a descendant of Erdrick” who slew dragons, and there came also a princess named Gwaelin[.’][end-FC]" / "‘Please, please, do not hurt me!’[wait][line]‘I can tell thee of a secret[.’][wait][line]‘In Hamlin Village there is a Water Crest. Seek it!’[end-FC]" / "‘It has been rumored that the king of Tantegel Castle has disappeared[.’][end-FC]" / "‘I am a soldier from Alefgard[.’][wait][line]‘Perhaps thou has seen ancient maps of my land, but it has changed much through the ages[.’][end-FC]" / "‘Thou art welcome in Lianport[.’][end-FC]" / "‘Yes, this is Tantegel[.’][end-FC]" / "‘The golden key opens the red door, too[.’][end-FC]" / "‘Pardon me, stranger, but I had a vision and in it descendants of the great hero Erdrick came to us in our need[.’][wait][line]‘Ah! So it was true.[line]Thou art truly welcome[.’][end-FC]" / "‘Thou hast come to Tantegel Castle[.’][end-FC]" / "‘Long ago Princess Gwaelin departed over the sea, but thy companion is her twin in appearance[.’][end-FC]" / "‘So thou has come even here to this simple room[.’][wait][line]‘I cannot help thee. My hope fled long ago[.’][end-FC]" / "‘The King keeps himself hidden, for he is afraid of Hargon's wrath[.’][end-FC]" / "‘The Echoing Flute blows a magical note[.’][wait][line]‘On an island, in a tower, in a chamber remote, play it and listen, a wise man once wrote[.’][wait][line]‘For when the sound echoes, there shall thou find, a crest of great power to aid thee in time[.’][end-FC]" / "‘So, thou art the great warriors of which we have heard[.’][end-FC]" / "‘Here in this coliseum many heroes have proven their strength[.’][end-FC]" / "‘Beyond lies the coliseum and the court of the King[.’][end-FC]" / "‘In the island town of Zahan in the southern ocean lives a man named Torval who owns the golden key[.’][end-FC]" / "‘As the story goes, it was a dark and stormy night when the pirate ship, Relentless, hit a reef and sank[.’][wait][line]‘They say that in its hold was the Echoing Flute[.’][end-FC]" / "‘I seek the Armor of Gaia[.’][wait][line]‘I was told that it was kept in a shop that sells armor[.’][end-FC]" / "Thou hast found the Stars Crest.[end-FC]" / "‘Do not overburden thyself. Cast away those items that thou doesn't need[.’][end-FC]" / "‘I have come seeking a thief by the name of Roge Fastfinger[.’][end-FC]" / "‘I warn thee to go back. This wizard's house may be thy ruin[.’][end-FC]" / "‘Thou hast come to Zahan at a poor time[.’][wait][line]‘All the men are away fishing at sea[.’][end-FC]" / "‘Many are the tales of a mountainous island in the sea and its great cavern[.’][wait][line]‘It is said that only one who bears the Moon Fragment may enter there[.’][end-FC]" / "‘One day I will be a great fisherman like Papa[.’][end-FC]" / "‘When the Moon Fragment is held upon high, the tide will rise and the seagulls cry[.’][end-FC]" / "‘Oh Formeo, Formeo, where for art thou my Formeo!’[end-FC]" / "‘Yes, I am Torval's wife. But just between us, he loves his dogs more than me[.’][end-FC]" / "‘That mutt yonder keeps pulling at my sleeve[.’][end-FC]" / "‘So thou hast heard of the sinking of the Relentless[.’][wait][line]‘Some say that the pirates simply left the plug out. Fools[.’][end-FC]" / "‘This is a town of lonely women, old men, dogs and children[.’][wait][line]‘What the men want of those stinking fish is beyond me[.’][end-FC]" / "‘Hello. This is the village of Tuhn[.’][end-FC]" / "‘Many years have passed since the Tower of the Moon could be reached by ship[.’][wait][line]‘It lies to the south[.’][end-FC]" / "‘Thou hast heard of Roge Fastfinger I see[.’][wait][line]‘Well, he stole the key to our watergate, the scoundrel.[line]We would dearly love to have it back[.’][end-FC]" / "‘If Jena sent thee, tell her I would not name our dog Ruffles for all the dragon's gold in Alefgard[.’][end-FC]" / "‘Ruff, ruff..[.’][end-FC]" / "‘It is said that the Tower of the Moon holds a piece of the moon[.’][end-FC]" / "‘I'm Jena. If thou meets my husband, tell him that my father's name was Ruffles[.’][end-FC]" / "‘Far and wide I have sought a master weaver who makes Water Flying Cloth, and they say such a man lives here[.’][end-FC]" / "‘If the watergate were to be raised, water would once more fill the dry riverbed[.’][end-FC]" / "‘Where has everyone gone?[line]Dost thou think it is my breath?’[end-FC]" / "‘Yip, yip, yip!’[end-FC]" / "‘Hargon dwells on the high plateau of Rhone[.’][wait][line]‘Only one who has the Eye of Malroth can find the road to that place[.’][end-FC]" / "‘It is true enough[.’][wait][line]‘I locked Roge Fastfinger in prison and threw away the key.[line]But he has escaped[.’][end-FC]" / "‘For the finest Water Flying Cloth I recommend Don Mahone who lives in Tuhn[.’][end-FC]" / "‘I bid thee welcome to Wellgarth Town[.’][wait][line]‘I shall sing for thee[.’][end-FC]" / "‘Let me tell thee, Hargon is a master of disguise, but if thou hast the Charm of Rubiss thou will see through the deception[.’][end-FC]" / "‘How dare thou enter a lady's room unbidden!’[end-FC]" / "‘It is said that the greatest shall fall by a spell of his own devising[.’][end-FC]" / "‘There is an isolated valley northwest of the town where once a road led to Rhone[.’][end-FC]" / "‘Some say that Hargon has cast a spell over his entire castle, that it looks fair and peaceful[.’][wait][line]‘Thou will not be deceived if thou hast the gift of Rubiss[.’][end-FC]" / "‘In the ocean far to the east lies an island and on it are trees from every corner of the world[.’][end-FC]" / "‘Having come this far, thou may as well try the door there to the left[.’][end-FC]" / "‘Roge Fastfinger? No, I have not heard the name[.’][end-FC]" / "‘We call this town Beran. Welcome[.’][end-FC]" / "‘Thou should see the King of Osterfair for the Moon Crest[.’][end-FC]" / "‘With the Magic Loom and Dew's Yarn thou can make the Water Flying Cloth[.’][end-FC]" / "‘The Leaf of the World Tree has the power to revive ghosts[.’][end-FC]" / "‘I seek the Thunder Sword, for one need not know magic to use its power[.’][end-FC]" / "‘Osterfair lies far south of Midenhall on a great island[.’][end-FC]" / "‘Welcome to Bragol's Tools. May I help thee?’[end-FC]" / "‘Greetings. I am the Keeper of this Inn[.’][end-FC]" / "‘Thou hast come to Midenhall[.’][end-FC]" / "‘[..][..][.’][end-FC]" / "‘[..][..][.’][end-FC]" / "‘Only the golden key can open this door[.’][end-FC]" / "‘This travel door takes one back to the underworld.[line]If that is thy wish, please enter[.’][end-FC]" / "‘The ancient road to Rhone was once west of this monolith[.’][end-FC]" / "‘In Cannock there is a young prince and Moonbrooke had a princess[.’][end-FC]" / "‘Although it makes me sad, thou must go forth and seek thy destiny[.’][end-FC]" / "‘Thief! Thief! What? Thou art [name], heir of Midenhall!’[wait][line]‘Please forgive me[.’][end-FC]" / "[end-FC]" / "‘Ghosts may wander this world under moon or sun and at times they may even be recalled[.’][end-FC]" / "‘If thy name is [name], I have a message for thee[.’][wait][line]‘Seek the Fire Monolith and thou shall find the Sun Crest[.’][end-FC]" / "‘That is the chamber of Prince [name]'s sister, Princess Halla[.’][end-FC]" / "‘After the sacking of Moonbrooke I escaped and made my way here, hoping others would follow[.’][end-FC]"
; control flow target (from $8E17)
; call to code in a different bank ($0F:$FA52)
0x018E40|$06:$8E30:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x018E43|$06:$8E33:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x018E45|$06:$8E35:C9 6B   	CMP #$6B   
0x018E47|$06:$8E37:D0 08   	BNE $8E41  
; call to code in a different bank ($0F:$FA32)
0x018E49|$06:$8E39:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018E4C|$06:$8E3C:6C	; String ID #$026C: [end-FC]

; data -> code
; call to code in a different bank ($0F:$FA32)
0x018E4D|$06:$8E3D:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018E50|$06:$8E40:6D	; String ID #$026D: [end-FC]

; data -> code
; control flow target (from $8E37)
0x018E51|$06:$8E41:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue IDs #$95-#$9C (open dialogue window, display string specified by A + #$1D9, display YES/NO menu, and display string corresponding to selected option)
; control flow target (from $81F7)
0x018E54|$06:$8E44:38      	SEC        
0x018E55|$06:$8E45:E9 95   	SBC #$95   	; why not just SBC #$27?
0x018E57|$06:$8E47:18      	CLC        
0x018E58|$06:$8E48:69 6E   	ADC #$6E   	; String IDs #$026E-#$0275: "‘Dost thou think it was Hargon who attacked Moonbrooke and set it aflame?’[FD][FD][end-FC]" / "‘Dost thou have a lottery ticket?’[FD][FD][end-FC]" / "‘This is a sewing shop, true, but I do not have the Dew's Yarn[.’][line]Dost thou seek the Dew's Yarn, too?’[FD][FD][end-FC]" / "‘Hast thou heard of the sunken treasure?’[FD][FD][end-FC]" / "‘Tell me, did thou come to buy the Jailor's Key?’[FD][FD][end-FC]" / "‘Pardon me, good folk, but dost thou have the time?’[FD][FD][end-FC]" / "‘Hast thou found the Eye of Malroth?’[FD][FD][end-FC]" / "‘Hast thy travels taken thee to the monolith south of Midenhall?’[FD][FD][end-FC]"
0x018E5A|$06:$8E4A:85 49   	STA $49    	; object hero/target/item/string ID $49
0x018E5C|$06:$8E4C:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018E5F|$06:$8E4F:A5 49   	LDA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$FA52)
0x018E61|$06:$8E51:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x018E64|$06:$8E54:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018E67|$06:$8E57:C9 00   	CMP #$00   	; YES
0x018E69|$06:$8E59:D0 04   	BNE $8E5F  
0x018E6B|$06:$8E5B:A9 08   	LDA #$08   	; String IDs #$0276-#$027D: "‘Yes, I think so, too[.’][end-FC]" / "‘The Lottery is but a game; do not take it too seriously[.’][end-FC]" / "‘Alas, I have no more of the Dew's Yarn, but I know where thou may seek some,[wait][line]for it is a substance made of wind and water and it drifts aloft until it lands on the third floor[line]in the North Tower of the Dragon's Horn[.’][end-FC]" / "‘The pirate ship sank in the wide seas of the north[.’][end-FC]" / "‘I heard that it is sold here, but perhaps that is a lie[.’][end-FC]" / "‘I thank thee very much indeed[.’][end-FC]" / "‘The Eye of Malroth sees much that is not readily apparent[.’][wait][line]‘Use it in the swamp of the hidden valley and perhaps thou will see a way to Rhone[.’][end-FC]" / "‘Please say nothing of this[.’][end-FC]"
0x018E6D|$06:$8E5D:D0 02   	BNE $8E61  
; control flow target (from $8E59)
0x018E6F|$06:$8E5F:A9 10   	LDA #$10   	; String IDs #$027E-#$0285: "‘But I cannot think of anyone else with such power[.’][end-FC]" / "‘Some merchants give out Lottery Tickets for free[.’][end-FC]" / "‘Stop again if thou art near[.’][end-FC]" / "‘Speak to the merchantman in Lianport[.’][end-FC]" / "‘Perhaps I should not say anything more[.’][end-FC]" / "‘Then may thy ears become cabbages and thy tongue a sausage[.’][wait][line]‘A little courtesy never killed anyone[.’][end-FC]" / "‘Once thou hast the Moon Fragment thou may enter the island cave where the Eye of Malroth is kept in darkness[.’][end-FC]" / "‘My brother must be there now. Will thou not go to him?’[end-FC]"
; control flow target (from $8E5D)
0x018E71|$06:$8E61:18      	CLC        
0x018E72|$06:$8E62:65 49   	ADC $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$FA52)
0x018E74|$06:$8E64:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x018E77|$06:$8E67:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue IDs #$9D-#$C2 (town NPCs with complex logic)
; control flow target (from $81FE)
0x018E7A|$06:$8E6A:48      	PHA        	; dialogue ID
0x018E7B|$06:$8E6B:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018E7E|$06:$8E6E:68      	PLA        	; dialogue ID
0x018E7F|$06:$8E6F:38      	SEC        
0x018E80|$06:$8E70:E9 9D   	SBC #$9D   	; convert to zero-based
0x018E82|$06:$8E72:0A      	ASL        	; 2 bytes per pointer
0x018E83|$06:$8E73:AA      	TAX        
0x018E84|$06:$8E74:BD 81 8E	LDA $8E81,X	; complex dialogue logic handlers
0x018E87|$06:$8E77:85 0C   	STA $0C    
0x018E89|$06:$8E79:BD 82 8E	LDA $8E82,X
0x018E8C|$06:$8E7C:85 0D   	STA $0D    
0x018E8E|$06:$8E7E:6C 0C 00	JMP ($000C)


; code -> data
; complex dialogue logic handlers
; indexed data load target (from $8E74)
0x018E91|$06:$8E81:CD
; indexed data load target (from $8E79)
0x018E92|$06:$8E82:   8E	; $06:$8ECD; handler for dialogue ID #$9D: King in Map ID #$02: Midenhall 2F
0x018E93|$06:$8E83:6A 8F	; $06:$8F6A; handler for dialogue ID #$9E: Guard in Map ID #$02: Midenhall 2F
0x018E95|$06:$8E85:85 8F	; $06:$8F85; handler for dialogue ID #$9F: Wizard in Map ID #$02: Midenhall 2F
0x018E97|$06:$8E87:AC 8F	; $06:$8FAC; handler for dialogue ID #$A0: Brute in Map ID #$04: Midenhall B1
0x018E99|$06:$8E89:CC 8F	; $06:$8FCC; handler for dialogue ID #$A1: King in Map ID #$06: Cannock
0x018E9B|$06:$8E8B:19 90	; $06:$9019; handler for dialogue ID #$A2: Princess Halla in Map ID #$06: Cannock
0x018E9D|$06:$8E8D:55 90	; $06:$9055; handler for dialogue ID #$A3: Wizard in Map ID #$06: Cannock
0x018E9F|$06:$8E8F:65 90	; $06:$9065; handler for dialogue ID #$A4-#$A5: Monsters in Map ID #$08: Hamlin Waterway
0x018EA1|$06:$8E91:65 90	; $06:$9065; handler for dialogue ID #$A4-#$A5: Monsters in Map ID #$08: Hamlin Waterway
0x018EA3|$06:$8E93:77 90	; $06:$9077; handler for dialogue ID #$A6: King Moonbrooke's Flame in Map ID #$09: Moonbrooke
0x018EA5|$06:$8E95:95 90	; $06:$9095; handler for dialogue ID #$A7: Guard in Map ID #$0A: Moonbrooke B1
0x018EA7|$06:$8E97:A8 90	; $06:$90A8; handler for dialogue ID #$A8: Wizard in Map ID #$0B: Lianport
0x018EA9|$06:$8E99:CC 90	; $06:$90CC; handler for dialogue ID #$A9: Echoing Flute guy in NE in Map ID #$0B: Lianport
0x018EAB|$06:$8E9B:EF 90	; $06:$90EF; handler for dialogue ID #$AA: Woman in Map ID #$0B: Lianport
0x018EAD|$06:$8E9D:02 91	; $06:$9102; handler for dialogue ID #$AB: Brute in Map ID #$0B: Lianport
0x018EAF|$06:$8E9F:12 91	; $06:$9112; handler for dialogue ID #$AC: Woman in SW corner of Map ID #$0B: Lianport
0x018EB1|$06:$8EA1:4D 91	; $06:$914D; handler for dialogue ID #$AD: Wizard in Map ID #$0C: Tantegel
0x018EB3|$06:$8EA3:6E 91	; $06:$916E; handler for dialogue ID #$AE: Wizard in Map ID #$0C: Tantegel
0x018EB5|$06:$8EA5:7B 91	; $06:$917B; handler for dialogue ID #$AF: Priest in Map ID #$0C: Tantegel
0x018EB7|$06:$8EA7:97 91	; $06:$9197; handler for dialogue ID #$B0: King in Map ID #$0F: Osterfair
0x018EB9|$06:$8EA9:13 92	; $06:$9213; handler for dialogue ID #$B1: crazy fortuneteller Wizard in NW Map ID #$0F: Osterfair
0x018EBB|$06:$8EAB:8B 92	; $06:$928B; handler for dialogue IDs #$B2-#$B3: Dog in Map ID #$0F: Osterfair
0x018EBD|$06:$8EAD:8B 92	; $06:$928B; handler for dialogue IDs #$B2-#$B3: Dog in Map ID #$0F: Osterfair
0x018EBF|$06:$8EAF:92 92	; $06:$9292; handler for dialogue ID #$B4: Dog in Map ID #$10: Zahan
0x018EC1|$06:$8EB1:99 92	; $06:$9299; handler for dialogue ID #$B5: Don Mahone in Map ID #$11: Tuhn
0x018EC3|$06:$8EB3:FE 92	; $06:$92FE; handler for dialogue ID #$B6: Roge Fastfinger in NE Map ID #$14: Wellgarth Underground
0x018EC5|$06:$8EB5:2C 93	; $06:$932C; handler for dialogue IDs #$B7-#$B9: Priest in Map ID #$15: Beran
0x018EC7|$06:$8EB7:2C 93	; $06:$932C; handler for dialogue IDs #$B7-#$B9: Priest in Map ID #$15: Beran
0x018EC9|$06:$8EB9:2C 93	; $06:$932C; handler for dialogue IDs #$B7-#$B9: Priest in Map ID #$15: Beran
0x018ECB|$06:$8EBB:3E 93	; $06:$933E; handler for dialogue ID #$BA: Monster in Map ID #$16: Hargon's Castle 1F
0x018ECD|$06:$8EBD:48 93	; $06:$9348; handler for dialogue ID #$BB: Hargon in Map ID #$17: Hargon's Castle 7F
0x018ECF|$06:$8EBF:7F 93	; $06:$937F; handler for dialogue ID #$BC: Dragonlord's Grandson in Map ID #$18: Charlock Castle B8
0x018ED1|$06:$8EC1:9B 93	; $06:$939B; handler for dialogue ID #$BD: Guard in Map ID #$1A: Shrine SW of Cannock
0x018ED3|$06:$8EC3:9F 93	; $06:$939F; handler for dialogue ID #$BE: Guard in Map ID #$1A: Shrine SW of Cannock
0x018ED5|$06:$8EC5:BE 93	; $06:$93BE; handler for dialogue ID #$BF: Wizard in Map ID #$1C: Shrine SE of Rimuldar
0x018ED7|$06:$8EC7:E1 93	; $06:$93E1; handler for dialogue ID #$C0: Wizard in Map ID #$15: Beran
0x018ED9|$06:$8EC9:00 94	; $06:$9400; handler for dialogue ID #$C1: Priest in Map ID #$1F: Rhone Shrine
0x018EDB|$06:$8ECB:4D 94	; $06:$944D; handler for dialogue ID #$C2: Priest in Map ID #$20: Shrine SW of Moonbrooke

; data -> code
; handler for dialogue ID #$9D: King in Map ID #$02: Midenhall 2F
; indirect control flow target (via $8E81)
0x018EDD|$06:$8ECD:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x018EE0|$06:$8ED0:D0 3A   	BNE $8F0C  	; different dialogue when talking to King Midenhall depending on whether Prince Midenhall is alive or not
; call to code in a different bank ($0F:$FC50)
0x018EE2|$06:$8ED2:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x018EE5|$06:$8ED5:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018EE8|$06:$8ED8:86	; String ID #$0286: ‘Welcome back, [name][.’][wait][end-FC]

; data -> code
0x018EE9|$06:$8ED9:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
0x018EEC|$06:$8EDC:A9 00   	LDA #$00   	; Midenhall; pointless since none of these string use the [name] control code
; call to code in a different bank ($0F:$FC50)
0x018EEE|$06:$8EDE:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x018EF1|$06:$8EE1: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)
0x018EF3|$06:$8EE3:C9 02   	CMP #$02   
0x018EF5|$06:$8EE5:F0 0D   	BEQ $8EF4  	; update Cannock quest status to 3
0x018EF7|$06:$8EE7:C9 03   	CMP #$03   
0x018EF9|$06:$8EE9:D0 0F   	BNE $8EFA  
0x018EFB|$06:$8EEB:AD 3F 06	LDA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x018EFE|$06:$8EEE:29 04   	AND #$04   	; pick out the In Party bit
0x018F00|$06:$8EF0:F0 04   	BEQ $8EF6  	; message for when you're able to add Cannock, but haven't yet done so
0x018F02|$06:$8EF2:D0 06   	BNE $8EFA  
; control flow target (from $8EE5)
0x018F04|$06:$8EF4:E6 CA   	INC $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)
; control flow target (from $8EF0)
; call to code in a different bank ($0F:$FA32)
0x018F06|$06:$8EF6:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F09|$06:$8EF9:89	; String ID #$0289: ‘Well, thou hast missed him[.’][wait][line]‘The Prince of Cannock was here, but now he is off to Midenhall, looking for thee, I believe[.’][wait][end-FC]

; data -> code
; control flow target (from $8EE9, $8EF2)
; call to code in a different bank ($0F:$FA32)
0x018F0A|$06:$8EFA:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F0D|$06:$8EFD:87	; String ID #$0287: ‘Dost thou wish to save thy deeds in the Imperial Scrolls of Honor?’[FD][FD][end-FC]

; data -> code
0x018F0E|$06:$8EFE:A9 00   	LDA #$00   	; Save Point ID #$00: Midenhall 2F
0x018F10|$06:$8F00:85 48   	STA $48    	; last save point ID
0x018F12|$06:$8F02:20 5D A3	JSR $A35D  	; save game handler
; call to code in a different bank ($0F:$FA32)
0x018F15|$06:$8F05:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F18|$06:$8F08:88	; String ID #$0288: [wait]‘All of us await the day that Hargon is cast down[.’][end-FC]

; data -> code
0x018F19|$06:$8F09:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $8ED0)
0x018F1C|$06:$8F0C:A9 00   	LDA #$00   	; Midenhall
; call to code in a different bank ($0F:$FC50)
0x018F1E|$06:$8F0E:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x018F21|$06:$8F11:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F24|$06:$8F14:8A	; String ID #$028A: ‘Poor [name]. Thou hast met an untimely end[.’][wait][end-FC]

; data -> code
0x018F25|$06:$8F15:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
0x018F28|$06:$8F18:A9 00   	LDA #$00   	; Save Point ID #$00: Midenhall 2F
0x018F2A|$06:$8F1A:85 48   	STA $48    	; last save point ID
; call to code in a different bank ($0F:$FA32)
0x018F2C|$06:$8F1C:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F2F|$06:$8F1F:87	; String ID #$0287: ‘Dost thou wish to save thy deeds in the Imperial Scrolls of Honor?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$D16B)
0x018F30|$06:$8F20:20 6B D1	JSR $D16B  
0x018F33|$06:$8F23:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x018F36|$06:$8F26:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x018F39|$06:$8F29:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F3C|$06:$8F2C:8B	; String ID #$028B: ‘[name]!’[wait][end-FC]

; data -> code
0x018F3D|$06:$8F2D:A9 00   	LDA #$00   	; Midenhall
; call to code in a different bank ($0F:$FC50)
0x018F3F|$06:$8F2F:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x018F42|$06:$8F32:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F45|$06:$8F35:8C	; String ID #$028C: ‘Please give thy[line]regards to my son[.’][end-FC]

; data -> code
0x018F46|$06:$8F36:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; external control flow target (from $0F:$D28F)
0x018F49|$06:$8F39:4E 25 06	LSR $0625  	; party gold, high byte; full party death costs you half your gold
0x018F4C|$06:$8F3C:6E 24 06	ROR $0624  	; party gold, low byte
0x018F4F|$06:$8F3F:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018F52|$06:$8F42:A9 00   	LDA #$00   	; Midenhall
; call to code in a different bank ($0F:$FC50)
0x018F54|$06:$8F44:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x018F57|$06:$8F47:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F5A|$06:$8F4A:8D	; String ID #$028D: ‘No pulse, no breath, cold as a cod[.’][wait][line]‘Yes, thou art truly dead, [name][.’][wait][line]‘I suppose I had better revive thee, though thou deserve less[.’][end-FC]

; data -> code
0x018F5B|$06:$8F4B:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; external control flow target (from $0F:$C6FD)
0x018F5E|$06:$8F4E:20 CB 9A	JSR $9ACB  	; open dialogue window
0x018F61|$06:$8F51:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x018F64|$06:$8F54:48      	PHA        
; call to code in a different bank ($0F:$FC50)
0x018F65|$06:$8F55:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x018F68|$06:$8F58:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F6B|$06:$8F5B:8E	; String ID #$028E: ‘Welcome back, [name][.’][wait][end-FC]

; data -> code
0x018F6C|$06:$8F5C:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
0x018F6F|$06:$8F5F:68      	PLA        
; call to code in a different bank ($0F:$FC50)
0x018F70|$06:$8F60:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x018F73|$06:$8F63:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018F76|$06:$8F66:90	; String ID #$0290: ‘Thy road is long and fraught with peril, but don't despair.[line]Come see me in thy need, [name][.’][end-FC]

; data -> code
0x018F77|$06:$8F67:4C 92 80	JMP $8092  	; wait until all joypad buttons are released and then some button pressed then wipe menus and exit COMMAND menu

; handler for dialogue ID #$9E: Guard in Map ID #$02: Midenhall 2F
; indirect control flow target (via $8E83)
0x018F7A|$06:$8F6A:A9 00   	LDA #$00   	; Midenhall
; call to code in a different bank ($0F:$FC50)
0x018F7C|$06:$8F6C:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x018F7F|$06:$8F6F: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)
0x018F81|$06:$8F71:C9 03   	CMP #$03   
0x018F83|$06:$8F73:F0 08   	BEQ $8F7D  
0x018F85|$06:$8F75:C9 04   	CMP #$04   
0x018F87|$06:$8F77:F0 04   	BEQ $8F7D  
0x018F89|$06:$8F79:A9 92   	LDA #$92   	; String ID #$0292: ‘I would come with thee, [name],[wait][line]but my place is here beside the King[.’][end-FC]
0x018F8B|$06:$8F7B:D0 02   	BNE $8F7F  
; control flow target (from $8F73, $8F77)
0x018F8D|$06:$8F7D:A9 91   	LDA #$91   	; String ID #$0291: ‘By land and sea and air will thy path lead, and in places I cannot see[.’][end-FC]
; control flow target (from $8F7B)
; call to code in a different bank ($0F:$FA52)
0x018F8F|$06:$8F7F:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x018F92|$06:$8F82:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$9F: Wizard in Map ID #$02: Midenhall 2F
; indirect control flow target (via $8E85)
0x018F95|$06:$8F85:A9 00   	LDA #$00   	; Midenhall
; call to code in a different bank ($0F:$FC50)
0x018F97|$06:$8F87:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x018F9A|$06:$8F8A: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)
0x018F9C|$06:$8F8C:C9 03   	CMP #$03   
0x018F9E|$06:$8F8E:F0 04   	BEQ $8F94  
0x018FA0|$06:$8F90:C9 04   	CMP #$04   
0x018FA2|$06:$8F92:D0 07   	BNE $8F9B  
; control flow target (from $8F8E)
; call to code in a different bank ($0F:$FA32)
0x018FA4|$06:$8F94:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018FA7|$06:$8F97:93	; String ID #$0293: ‘It is difficult to see thee go, [name][.’][end-FC]

; data -> code
0x018FA8|$06:$8F98:4C A9 8F	JMP $8FA9  

; control flow target (from $8F92)
0x018FAB|$06:$8F9B:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x018FAE|$06:$8F9E:D0 04   	BNE $8FA4  	; branch if Midenhall dead
0x018FB0|$06:$8FA0:A9 94   	LDA #$94   	; String ID #$0294: ‘Thou art now as strong as an ox and twice as good looking.[line]That is very good[.’][end-FC]
0x018FB2|$06:$8FA2:D0 02   	BNE $8FA6  
; control flow target (from $8F9E)
0x018FB4|$06:$8FA4:A9 95   	LDA #$95   	; String ID #$0295: ‘[name], it is such a pity[.’][end-FC]
; control flow target (from $8FA2)
; call to code in a different bank ($0F:$FA52)
0x018FB6|$06:$8FA6:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
; control flow target (from $8F98)
0x018FB9|$06:$8FA9:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$A0: Brute in Map ID #$04: Midenhall B1
; indirect control flow target (via $8E87)
0x018FBC|$06:$8FAC:AD F2 05	LDA $05F2  	; probably whether door between you and NPC is open
0x018FBF|$06:$8FAF:F0 13   	BEQ $8FC4  
; call to code in a different bank ($0F:$FA32)
0x018FC1|$06:$8FB1:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018FC4|$06:$8FB4:96	; String ID #$0296: ‘Dost thou have the Jailor's Key?’[end-FC]

; data -> code
0x018FC5|$06:$8FB5:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x018FC8|$06:$8FB8:C9 00   	CMP #$00   	; YES
0x018FCA|$06:$8FBA:D0 04   	BNE $8FC0  
0x018FCC|$06:$8FBC:A9 97   	LDA #$97   	; String ID #$0297: ‘Open this and I shall give thee some news[.’][end-FC]
0x018FCE|$06:$8FBE:D0 06   	BNE $8FC6  
; control flow target (from $8FBA)
0x018FD0|$06:$8FC0:A9 98   	LDA #$98   	; String ID #$0298: ‘Be gone with thee!’[end-FC]
0x018FD2|$06:$8FC2:D0 02   	BNE $8FC6  
; control flow target (from $8FAF)
0x018FD4|$06:$8FC4:A9 99   	LDA #$99   	; String ID #$0299: ‘As a reward for opening the door, let me tell thee of the Crest of Life[.’][wait][line]‘Find it on the dark road that leads to Rhone[.’][end-FC]
; control flow target (from $8FBE, $8FC2)
; call to code in a different bank ($0F:$FA52)
0x018FD6|$06:$8FC6:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x018FD9|$06:$8FC9:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$A1: King in Map ID #$06: Cannock
; indirect control flow target (via $8E89)
0x018FDC|$06:$8FCC:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
; call to code in a different bank ($0F:$FC50)
0x018FDF|$06:$8FCF:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$F6CE)
0x018FE2|$06:$8FD2:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x018FE5|$06:$8FD5:85 49   	STA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$FA32)
0x018FE7|$06:$8FD7:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x018FEA|$06:$8FDA:E2	; String ID #$02E2: ‘Welcome, [name]!’[wait][end-FC]

; data -> code
0x018FEB|$06:$8FDB:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
0x018FEE|$06:$8FDE:A9 01   	LDA #$01   	; Cannock
; call to code in a different bank ($0F:$FC50)
0x018FF0|$06:$8FE0:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x018FF3|$06:$8FE3: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)
0x018FF5|$06:$8FE5:F0 06   	BEQ $8FED  
0x018FF7|$06:$8FE7:C9 01   	CMP #$01   
0x018FF9|$06:$8FE9:F0 04   	BEQ $8FEF  
0x018FFB|$06:$8FEB:D0 09   	BNE $8FF6  
; control flow target (from $8FE5)
0x018FFD|$06:$8FED:E6 CA   	INC $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)
; control flow target (from $8FE9)
; call to code in a different bank ($0F:$FA32)
0x018FFF|$06:$8FEF:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019002|$06:$8FF2:9D	; String ID #$029D: ‘My son, [name], has already left on his journey[.’][wait] [line]‘Please find him and take him as thy companion[.’][wait][end-FC]

; data -> code
0x019003|$06:$8FF3:4C 02 90	JMP $9002  

; control flow target (from $8FEB)
0x019006|$06:$8FF6:C9 03   	CMP #$03   
0x019008|$06:$8FF8:D0 08   	BNE $9002  
0x01900A|$06:$8FFA:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x01900C|$06:$8FFC:D0 04   	BNE $9002  
; call to code in a different bank ($0F:$FA32)
0x01900E|$06:$8FFE:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019011|$06:$9001:9E	; String ID #$029E: [end-FC]

; data -> code
; control flow target (from $8FF3, $8FF8, $8FFC)
; call to code in a different bank ($0F:$FA32)
0x019012|$06:$9002:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019015|$06:$9005:87	; String ID #$0287: ‘Dost thou wish to save thy deeds in the Imperial Scrolls of Honor?’[FD][FD][end-FC]

; data -> code
0x019016|$06:$9006:A9 01   	LDA #$01   	; Save Point ID #$01: Cannock
0x019018|$06:$9008:85 48   	STA $48    	; last save point ID
0x01901A|$06:$900A:20 5D A3	JSR $A35D  	; save game handler
0x01901D|$06:$900D:A9 01   	LDA #$01   	; Cannock
; call to code in a different bank ($0F:$FC50)
0x01901F|$06:$900F:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x019022|$06:$9012:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019025|$06:$9015:9C	; String ID #$029C: [wait]‘With my son's help thou shall go far[.’][end-FC]

; data -> code
0x019026|$06:$9016:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$A2: Princess Halla in Map ID #$06: Cannock
; indirect control flow target (via $8E8B)
0x019029|$06:$9019: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)
0x01902B|$06:$901B:C9 04   	CMP #$04   
0x01902D|$06:$901D:D0 04   	BNE $9023  
0x01902F|$06:$901F:A9 A4   	LDA #$A4   	; String ID #$02A4: [end-FC]
0x019031|$06:$9021:D0 16   	BNE $9039  
; control flow target (from $901D)
; call to code in a different bank ($0F:$F6CE)
0x019033|$06:$9023:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x019036|$06:$9026:D0 17   	BNE $903F  
; call to code in a different bank ($0F:$FA32)
0x019038|$06:$9028:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01903B|$06:$902B:9F	; String ID #$029F: ‘Who art thou?[line]A friend of my brother's?’[FD][FD][end-FC]

; data -> code
0x01903C|$06:$902C:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x01903F|$06:$902F:C9 00   	CMP #$00   	; YES
0x019041|$06:$9031:D0 04   	BNE $9037  
0x019043|$06:$9033:A9 A0   	LDA #$A0   	; String ID #$02A0: ‘Then I'll give thee some advice[.’][wait][line]‘My brother has gone searching for the Spring of Bravery, but he travels slowly[.’][end-FC]
0x019045|$06:$9035:D0 02   	BNE $9039  
; control flow target (from $9031)
0x019047|$06:$9037:A9 A1   	LDA #$A1   	; String ID #$02A1: ‘Then I wish to be left alone[.’][end-FC]
; control flow target (from $9021, $9035, $904F, $9053)
; call to code in a different bank ($0F:$FA52)
0x019049|$06:$9039:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x01904C|$06:$903C:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9026)
0x01904F|$06:$903F:A9 01   	LDA #$01   	; Cannock
0x019051|$06:$9041:85 97   	STA $97    	; subject hero ID $97
0x019053|$06:$9043:A9 80   	LDA #$80   	; Alive
0x019055|$06:$9045:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019058|$06:$9048:90 07   	BCC $9051  
0x01905A|$06:$904A:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x01905D|$06:$904D:A9 A2   	LDA #$A2   	; String ID #$02A2: ‘So, thou hast found my brother[.’][wait][line]‘Why dost thou tarry here when the world is in grave peril?’[end-FC]
0x01905F|$06:$904F:D0 E8   	BNE $9039  
; control flow target (from $9048)
0x019061|$06:$9051:A9 A3   	LDA #$A3   	; String ID #$02A3: ‘Oh, no! He is as dead as a pork chop[.’][end-FC]
0x019063|$06:$9053:D0 E4   	BNE $9039  
; handler for dialogue ID #$A3: Wizard in Map ID #$06: Cannock
; indirect control flow target (via $8E8D)
; call to code in a different bank ($0F:$FA32)
0x019065|$06:$9055:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019068|$06:$9058:A5	; String ID #$02A5: ‘Well, don't just stand there.[line]Open the treasure chest[.’][end-FC]

; data -> code
0x019069|$06:$9059:AD 1A 05	LDA $051A  	; something to do with whether you've opened the chest containing the Shield of Erdrick
0x01906C|$06:$905C:F0 04   	BEQ $9062  
; call to code in a different bank ($0F:$FA32)
0x01906E|$06:$905E:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019071|$06:$9061:A6	; String ID #$02A6: [wait]‘So you've already peeked, eh?’[end-FC]

; data -> code
; control flow target (from $905C)
0x019072|$06:$9062:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$A4-#$A5: Monsters in Map ID #$08: Hamlin Waterway
; indirect control flow target (via $8E8F, $8E91)
; call to code in a different bank ($0F:$FA32)
0x019075|$06:$9065:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019078|$06:$9068:A9	; String ID #$02A9: ‘Aiyee!’[end-FC]

; data -> code
0x019079|$06:$9069:AD F2 05	LDA $05F2  	; probably whether door between you and NPC is open
0x01907C|$06:$906C:D0 06   	BNE $9074  
; call to code in a different bank ($0F:$D1A1)
0x01907E|$06:$906E:20 A1 D1	JSR $D1A1  	; handle Hamlin Waterway Gremlins fight
0x019081|$06:$9071:4C 95 80	JMP $8095  	; wipe menus and exit COMMAND menu

; control flow target (from $906C)
0x019084|$06:$9074:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$A6: King Moonbrooke's Flame in Map ID #$09: Moonbrooke
; indirect control flow target (via $8E93)
0x019087|$06:$9077:A9 02   	LDA #$02   	; Moonbrooke
; call to code in a different bank ($0F:$FC50)
0x019089|$06:$9079:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x01908C|$06:$907C:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01908F|$06:$907F:AA	; String ID #$02AA: ‘Woe is me, for I am the unhappy ghost of the King of Moonbrooke[.’][wait][line]‘To make matters worse, my daughter has been cursed and transformed into a common mutt[.’][wait][line]‘I am burning with shame[.’][end-FC]

; data -> code
0x019090|$06:$9080:AD 51 06	LDA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019093|$06:$9083:29 84   	AND #$84   	; pick out the Alive and In Party bits
0x019095|$06:$9085:C9 84   	CMP #$84   	; is Moonbrooke alive and in your party?
0x019097|$06:$9087:D0 09   	BNE $9092  	; if yes, she gets extra text
0x019099|$06:$9089:A9 02   	LDA #$02   	; Moonbrooke
; call to code in a different bank ($0F:$FC50)
0x01909B|$06:$908B:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x01909E|$06:$908E:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0190A1|$06:$9091:AB	; String ID #$02AB: [wait][line][no voice]Then [name] cried[line][no voice]out: ‘Father? Is it really thee in the flames?’[wait][line]And the Flame replied: ‘Alas, it is I. It is Hargon's way of firing those he doesn't need[.’][end-FC]

; data -> code
; control flow target (from $9087)
0x0190A2|$06:$9092:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$A7: Guard in Map ID #$0A: Moonbrooke B1
; indirect control flow target (via $8E95)
0x0190A5|$06:$9095:20 93 94	JSR $9493  	; SEC if Moonbrooke in party, CLC otherwise
0x0190A8|$06:$9098:90 07   	BCC $90A1  
; call to code in a different bank ($0F:$FA32)
0x0190AA|$06:$909A:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0190AD|$06:$909D:AD	; String ID #$02AD: ‘Princess, thou art now free[.’][end-FC]

; data -> code
0x0190AE|$06:$909E:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9098)
; call to code in a different bank ($0F:$FA32)
0x0190B1|$06:$90A1:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0190B4|$06:$90A4:AC	; String ID #$02AC: ‘The Princess has been transformed by a curse[.’][wait][line]‘Only the Mirror of Ra can break the spell, for in that glass one sees her true self[.’][end-FC]

; data -> code
0x0190B5|$06:$90A5:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$A8: Wizard in Map ID #$0B: Lianport
; indirect control flow target (via $8E97)
0x0190B8|$06:$90A8:AD 9C 05	LDA $059C  	; NPC #$0C X-pos
0x0190BB|$06:$90AB:C9 0F   	CMP #$0F   
0x0190BD|$06:$90AD:D0 04   	BNE $90B3  
0x0190BF|$06:$90AF:A9 B8   	LDA #$B8   	; String ID #$02B8: ‘Farewell[.’][end-FC]
0x0190C1|$06:$90B1:D0 06   	BNE $90B9  
; control flow target (from $90AD)
0x0190C3|$06:$90B3:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x0190C5|$06:$90B5:D0 08   	BNE $90BF  
0x0190C7|$06:$90B7:A9 AE   	LDA #$AE   	; String ID #$02AE: ‘We never lend boats to strangers, sorry[.’][end-FC]
; control flow target (from $90B1)
; call to code in a different bank ($0F:$FA52)
0x0190C9|$06:$90B9:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x0190CC|$06:$90BC:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $90B5)
; call to code in a different bank ($0F:$FA32)
0x0190CF|$06:$90BF:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0190D2|$06:$90C2:AF	; String ID #$02AF: ‘Oh, thou art the ones who helped my granddaughter[.’][wait][line]‘Many thanks[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$D0F5)
0x0190D3|$06:$90C3:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
; call to code in a different bank ($0F:$CCA2)
0x0190D6|$06:$90C6:20 A2 CC	JSR $CCA2  
0x0190D9|$06:$90C9:4C 95 80	JMP $8095  	; wipe menus and exit COMMAND menu

; handler for dialogue ID #$A9: Echoing Flute guy in NE in Map ID #$0B: Lianport
; indirect control flow target (via $8E99)
0x0190DC|$06:$90CC:A9 25   	LDA #$25   	; Item ID #$25: Tresures
0x0190DE|$06:$90CE: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
0x0190E1|$06:$90D1:10 0B   	BPL $90DE  	; branch if found
0x0190E3|$06:$90D3:A9 2A   	LDA #$2A   	; Item ID #$2A: Echoing Flute
0x0190E5|$06:$90D5: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
0x0190E8|$06:$90D8:10 0D   	BPL $90E7  	; branch if found
0x0190EA|$06:$90DA:A9 B0   	LDA #$B0   	; String ID #$02B0: ‘The pirate ship Relentless sank in chill waters with a great treasure still aboard[.’][wait][line]‘Bring me this treasure and I shall pay a handsome fee[.’][end-FC]
0x0190EC|$06:$90DC:D0 0B   	BNE $90E9  
; control flow target (from $90D1)
0x0190EE|$06:$90DE:A9 2A   	LDA #$2A   	; Item ID #$2A: Echoing Flute
0x0190F0|$06:$90E0:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped); replace Tresures in party inventory with Echoing Flute
0x0190F3|$06:$90E3:A9 B1   	LDA #$B1   	; String ID #$02B1: ‘Thou hast done exceedingly well[.’][wait][line]‘As I promised I shall give thee the Echoing Flute as thy reward[.’][end-FC]
0x0190F5|$06:$90E5:D0 02   	BNE $90E9  
; control flow target (from $90D8)
0x0190F7|$06:$90E7:A9 B2   	LDA #$B2   	; String ID #$02B2: ‘Thanks to thee I was greatly helped[.’][end-FC]
; control flow target (from $90DC, $90E5)
; call to code in a different bank ($0F:$FA52)
0x0190F9|$06:$90E9:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x0190FC|$06:$90EC:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$AA: Woman in Map ID #$0B: Lianport
; indirect control flow target (via $8E9B)
0x0190FF|$06:$90EF:AD 94 05	LDA $0594  	; NPC #$0B X-pos
0x019102|$06:$90F2:C9 03   	CMP #$03   
0x019104|$06:$90F4:D0 04   	BNE $90FA  
0x019106|$06:$90F6:A9 B9   	LDA #$B9   	; String ID #$02B9: ‘I am in thy debt.[line]Please see my grandfather[.’][wait][line]‘He is at the port where his ship is docked[.’][end-FC]
0x019108|$06:$90F8:D0 02   	BNE $90FC  
; control flow target (from $90F4)
0x01910A|$06:$90FA:A9 B7   	LDA #$B7   	; String ID #$02B7: ‘I wish thee speed and health[.’][end-FC]
; control flow target (from $90F8)
; call to code in a different bank ($0F:$FA52)
0x01910C|$06:$90FC:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x01910F|$06:$90FF:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$AB: Brute in Map ID #$0B: Lianport
; indirect control flow target (via $8E9D)
; call to code in a different bank ($0F:$FA32)
0x019112|$06:$9102:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019115|$06:$9105:BA	; String ID #$02BA: ‘I have nothing to say to thee[.’][end-FC]

; data -> code
0x019116|$06:$9106:20 9D 94	JSR $949D  	; SEC if Moonbrooke alive, CLC otherwise
0x019119|$06:$9109:90 04   	BCC $910F  
; call to code in a different bank ($0F:$FA32)
0x01911B|$06:$910B:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01911E|$06:$910E:BB	; String ID #$02BB: [wait]‘That's right, nothing at all[.’][end-FC]

; data -> code
; control flow target (from $9109)
0x01911F|$06:$910F:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$AC: Woman in SW corner of Map ID #$0B: Lianport
; indirect control flow target (via $8E9F)
0x019122|$06:$9112:20 9D 94	JSR $949D  	; SEC if Moonbrooke alive, CLC otherwise
0x019125|$06:$9115:B0 2E   	BCS $9145  	; if Moonbrooke's alive, display the boring string, otherwise...
; call to code in a different bank ($0F:$FA32)
0x019127|$06:$9117:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01912A|$06:$911A:BC	; String ID #$02BC: ‘Dost thou think I am pretty enough to be a queen?’[end-FC]

; data -> code
0x01912B|$06:$911B:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x01912E|$06:$911E:C9 00   	CMP #$00   	; #$00 = YES
0x019130|$06:$9120:D0 1F   	BNE $9141  	; branch if you chose NO
0x019132|$06:$9122:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x019135|$06:$9125:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x019138|$06:$9128:A9 64   	LDA #$64   	; 100 gold
0x01913A|$06:$912A:85 8F   	STA $8F    
0x01913C|$06:$912C:A9 00   	LDA #$00   
0x01913E|$06:$912E:85 90   	STA $90    
0x019140|$06:$9130:20 31 8D	JSR $8D31  	; given gold amount in $8F-$90, decrease party gold by that amount and SEC if possible, CLC otherwise
0x019143|$06:$9133:B0 08   	BCS $913D  	; if you didn't have 100 G to start with, reduce party gold to 0 :(
0x019145|$06:$9135:A9 00   	LDA #$00   
0x019147|$06:$9137:8D 24 06	STA $0624  	; party gold, low byte
0x01914A|$06:$913A:8D 25 06	STA $0625  	; party gold, high byte
; control flow target (from $9133)
0x01914D|$06:$913D:A9 BD   	LDA #$BD   	; String ID #$02BD: ‘Perhaps the great Prince of Cannock thinks so too[.’][end-FC]
0x01914F|$06:$913F:D0 06   	BNE $9147  
; control flow target (from $9120)
0x019151|$06:$9141:A9 BE   	LDA #$BE   	; String ID #$02BE: ‘What's wrong!’[end-FC]
0x019153|$06:$9143:D0 02   	BNE $9147  
; control flow target (from $9115)
0x019155|$06:$9145:A9 BF   	LDA #$BF   	; String ID #$02BF: ‘Be nice to one who lives here; she knows how to turn princes into tadpoles[.’][end-FC]
; control flow target (from $913F, $9143)
; call to code in a different bank ($0F:$FA52)
0x019157|$06:$9147:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x01915A|$06:$914A:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$AD: Wizard in Map ID #$0C: Tantegel
; indirect control flow target (via $8EA1)
0x01915D|$06:$914D:A9 00   	LDA #$00   
0x01915F|$06:$914F:85 49   	STA $49    	; object hero/target/item/string ID $49
0x019161|$06:$9151:85 97   	STA $97    	; subject hero ID $97
; control flow target (from $915E)
0x019163|$06:$9153:20 FC 9A	JSR $9AFC  	; given hero ID in $97 and hero inventory index in $49, set Z if item is equipped and cursed, clear if not
0x019166|$06:$9156:F0 0A   	BEQ $9162  
0x019168|$06:$9158:E6 49   	INC $49    	; object hero/target/item/string ID $49
0x01916A|$06:$915A:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x01916C|$06:$915C:C9 18   	CMP #$18   	; party inventory size
0x01916E|$06:$915E:D0 F3   	BNE $9153  
0x019170|$06:$9160:F0 04   	BEQ $9166  
; control flow target (from $9156)
0x019172|$06:$9162:A9 C1   	LDA #$C1   	; String ID #$02C1: ‘Unfortunately I have not the skill to cure this curse[.’][end-FC]
0x019174|$06:$9164:D0 02   	BNE $9168  
; control flow target (from $9160)
0x019176|$06:$9166:A9 C0   	LDA #$C0   	; String ID #$02C0: ‘Come here when thou art afflicted by a curse[.’][end-FC]
; control flow target (from $9164)
; call to code in a different bank ($0F:$FA52)
0x019178|$06:$9168:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x01917B|$06:$916B:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$AE: Wizard in Map ID #$0C: Tantegel
; indirect control flow target (via $8EA3)
; call to code in a different bank ($0F:$FA32)
0x01917E|$06:$916E:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019181|$06:$9171:C2	; String ID #$02C2: ‘Peace be with thee[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$C515)
0x019182|$06:$9172:20 15 C5	JSR $C515  	; flash screen 10 times
0x019185|$06:$9175:20 EC 8D	JSR $8DEC  	; restore full MP to all living party members
0x019188|$06:$9178:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$AF: Priest in Map ID #$0C: Tantegel
; indirect control flow target (via $8EA5)
0x01918B|$06:$917B:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
; call to code in a different bank ($0F:$FA32)
0x01918E|$06:$917E:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019191|$06:$9181:C3	; String ID #$02C3: ‘To the noble descendant of Erdrick I bid welcome[.’][wait][end-FC]

; data -> code
0x019192|$06:$9182:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
; call to code in a different bank ($0F:$FA32)
0x019195|$06:$9185:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019198|$06:$9188:A7	; String ID #$02A7: ‘Although there is no king here, I can save thy deeds[.’][wait][line]‘Shall I do this?’[FD][FD][end-FC]

; data -> code
0x019199|$06:$9189:A9 02   	LDA #$02   	; Save Point ID #$02: Tantegel
0x01919B|$06:$918B:85 48   	STA $48    	; last save point ID
0x01919D|$06:$918D:20 5D A3	JSR $A35D  	; save game handler
; call to code in a different bank ($0F:$FA32)
0x0191A0|$06:$9190:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0191A3|$06:$9193:C4	; String ID #$02C4: [wait]‘Go in peace[.’][end-FC]

; data -> code
0x0191A4|$06:$9194:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$B0: King in Map ID #$0F: Osterfair
; indirect control flow target (via $8EA7)
0x0191A7|$06:$9197:A5 98   	LDA $98    	; outcome of last fight?
0x0191A9|$06:$9199:F0 06   	BEQ $91A1  
0x0191AB|$06:$919B:C9 FC   	CMP #$FC   
0x0191AD|$06:$919D:F0 44   	BEQ $91E3  
0x0191AF|$06:$919F:D0 25   	BNE $91C6  
; control flow target (from $9199)
0x0191B1|$06:$91A1:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x0191B4|$06:$91A4:29 04   	AND #$04   	; Moon Crest
0x0191B6|$06:$91A6:D0 4C   	BNE $91F4  
; call to code in a different bank ($0F:$FA32)
0x0191B8|$06:$91A8:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0191BB|$06:$91AB:C5	; String ID #$02C5: ‘Thou art welcome in my castle of Osterfair[.’][wait][line]‘If thou entertain me, thou shall receive a valuable prize[.’][wait][line]‘Dost thou wish to try?’[FD][FD][end-FC]

; data -> code
0x0191BC|$06:$91AC:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x0191BF|$06:$91AF:C9 00   	CMP #$00   	; YES
0x0191C1|$06:$91B1:D0 3A   	BNE $91ED  
; call to code in a different bank ($0F:$FA32)
0x0191C3|$06:$91B3:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0191C6|$06:$91B6:C6	; String ID #$02C6: ‘Thou must go forth to the center of this Coliseum[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$D0F5)
0x0191C7|$06:$91B7:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x0191CA|$06:$91BA:A9 00   	LDA #$00   
0x0191CC|$06:$91BC:85 98   	STA $98    	; outcome of last fight?
0x0191CE|$06:$91BE:85 03   	STA $03    	; game clock?
; call to code in a different bank ($0F:$CABA)
0x0191D0|$06:$91C0:20 BA CA	JSR $CABA  
0x0191D3|$06:$91C3:4C 95 80	JMP $8095  	; wipe menus and exit COMMAND menu

; control flow target (from $919F)
0x0191D6|$06:$91C6:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0191D9|$06:$91C9:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x0191DC|$06:$91CC:29 04   	AND #$04   	; Moon Crest
0x0191DE|$06:$91CE:D0 0C   	BNE $91DC  
; call to code in a different bank ($0F:$FA32)
0x0191E0|$06:$91D0:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0191E3|$06:$91D3:C7	; String ID #$02C7: ‘Thou hast done well[.’][wait][line]‘I shall give thee the Moon Crest[.’][wait][end-FC]

; data -> code
0x0191E4|$06:$91D4:A9 04   	LDA #$04   	; Moon Crest
0x0191E6|$06:$91D6:0D 12 01	ORA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x0191E9|$06:$91D9:8D 12 01	STA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
; control flow target (from $91CE)
; call to code in a different bank ($0F:$FA2E)
0x0191EC|$06:$91DC:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0191EF|$06:$91DF:15	; String ID #$0115: ‘Thou must fight gallantly[.’][end-FC]

; data -> code
0x0191F0|$06:$91E0:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $919D)
0x0191F3|$06:$91E3:20 CB 9A	JSR $9ACB  	; open dialogue window
; call to code in a different bank ($0F:$FA32)
0x0191F6|$06:$91E6:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0191F9|$06:$91E9:C9	; String ID #$02C9: ‘Thou art a poor excuse for a warrior[.’][wait][line]‘Get thee gone!’[end-FC]

; data -> code
0x0191FA|$06:$91EA:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $91B1)
; call to code in a different bank ($0F:$FA32)
0x0191FD|$06:$91ED:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019200|$06:$91F0:C8	; String ID #$02C8: ‘That's unfortunate[.’][wait][line]‘Good bye[.’][end-FC]

; data -> code
0x019201|$06:$91F1:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $91A6)
0x019204|$06:$91F4:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
; call to code in a different bank ($0F:$FC50)
0x019207|$06:$91F7:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x01920A|$06:$91FA:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01920D|$06:$91FD:EC	; String ID #$02EC: ‘Welcome back!’[wait][end-FC]

; data -> code
0x01920E|$06:$91FE:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
; call to code in a different bank ($0F:$FA32)
0x019211|$06:$9201:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019214|$06:$9204:87	; String ID #$0287: ‘Dost thou wish to save thy deeds in the Imperial Scrolls of Honor?’[FD][FD][end-FC]

; data -> code
0x019215|$06:$9205:A9 03   	LDA #$03   	; Save Point ID #$03: Osterfair
0x019217|$06:$9207:85 48   	STA $48    	; last save point ID
0x019219|$06:$9209:20 5D A3	JSR $A35D  	; save game handler
; call to code in a different bank ($0F:$FA32)
0x01921C|$06:$920C:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01921F|$06:$920F:CA	; String ID #$02CA: [wait]‘Thy strength is that of many fearsome Hibabongos[.’][wait][line]‘The Moon Crest that I have given thee is just one of many tokens thou must collect[.’][end-FC]

; data -> code
0x019220|$06:$9210:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$B1: crazy fortuneteller Wizard in NW Map ID #$0F: Osterfair
; indirect control flow target (via $8EA9)
; call to code in a different bank ($0F:$FA32)
0x019223|$06:$9213:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019226|$06:$9216:CB	; String ID #$02CB: ‘I'm a fortune-teller.[line]Art thou looking for something?’[FD][FD][end-FC]

; data -> code
0x019227|$06:$9217:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x01922A|$06:$921A:C9 00   	CMP #$00   	; YES
0x01922C|$06:$921C:D0 28   	BNE $9246  
; call to code in a different bank ($0F:$C3AB)
0x01922E|$06:$921E:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x019231|$06:$9221:A5 32   	LDA $32    	; RNG byte 0
0x019233|$06:$9223:05 33   	ORA $33    	; RNG byte 1
0x019235|$06:$9225:29 03   	AND #$03   	; 4 direction options to choose from
0x019237|$06:$9227:AA      	TAX        
0x019238|$06:$9228:E8      	INX        
0x019239|$06:$9229:AD 4E 92	LDA $924E  	; -> $06:$9250: Direction Names text
0x01923C|$06:$922C:85 0C   	STA $0C    
0x01923E|$06:$922E:AD 4F 92	LDA $924F  
0x019241|$06:$9231:85 0D   	STA $0D    
0x019243|$06:$9233:20 66 92	JSR $9266  	; given a pointer ($0C) and a number (one-based) in X, update $0C-$0D to the address of the start of the X'th string in ($0C)
0x019246|$06:$9236:A0 00   	LDY #$00   	; copy direction name to $5A
; control flow target (from $9240)
0x019248|$06:$9238:B1 0C   	LDA ($0C),Y
0x01924A|$06:$923A:99 5A 00	STA $005A,Y	; Crest/direction name write buffer start
0x01924D|$06:$923D:C8      	INY        
; [end-FA]
0x01924E|$06:$923E:C9 FA   	CMP #$FA   
0x019250|$06:$9240:D0 F6   	BNE $9238  	; if not end of string, loop to copy more data
0x019252|$06:$9242:A9 CC   	LDA #$CC   	; String ID #$02CC: ‘I'll tell thy fortune[.’][wait][line]‘That which thou seeks is [item-F9]!’[end-FC]
0x019254|$06:$9244:D0 02   	BNE $9248  
; control flow target (from $921C)
0x019256|$06:$9246:A9 CD   	LDA #$CD   	; String ID #$02CD: ‘So be it then.[line]I shall tell thee nothing[.’][end-FC]
; control flow target (from $9244)
; call to code in a different bank ($0F:$FA52)
0x019258|$06:$9248:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x01925B|$06:$924B:4C 48 95	JMP $9548  	; end TALK/ITEM routines


; code -> data
; -> $06:$9250: Direction Names text
; data load target (from $9229)
0x01925E|$06:$924E:50
; data load target (from $922E)
0x01925F|$06:$924F:   92	; $06:$9250; Direction Names text
; Direction Names text
; indirect data load target (via $924E)
0x019260|$06:$9250:28 0A 1C 1D FA	; "East" + [end-FA]
; indirect data load target
0x019265|$06:$9255:3A 0E 1C 1D FA	; "West" + [end-FA]
; indirect data load target
0x01926A|$06:$925A:36 18 1E 1D 11 FA	; "South" + [end-FA]
; indirect data load target
0x019270|$06:$9260:31 18 1B 1D 11 FA	; "North" + [end-FA]

; data -> code
; given a pointer ($0C) and a number (one-based) in X, update $0C-$0D to the address of the start of the X'th string in ($0C)
; control flow target (from $9233, $9287)
0x019276|$06:$9266:A0 00   	LDY #$00   	; start at the current position of ($0C)
; control flow target (from $9277)
0x019278|$06:$9268:B1 0C   	LDA ($0C),Y
; [end-FA]
0x01927A|$06:$926A:C9 FA   	CMP #$FA   
0x01927C|$06:$926C:F0 0C   	BEQ $927A  	; found some end token
; [end-FC]
0x01927E|$06:$926E:C9 FC   	CMP #$FC   
0x019280|$06:$9270:F0 08   	BEQ $927A  	; found some end token
; [end-FF]
0x019282|$06:$9272:C9 FF   	CMP #$FF   
0x019284|$06:$9274:F0 04   	BEQ $927A  	; found some end token
0x019286|$06:$9276:C8      	INY        
0x019287|$06:$9277:4C 68 92	JMP $9268  

; found some end token
; control flow target (from $926C, $9270, $9274)
0x01928A|$06:$927A:CA      	DEX        	; number of strings to skip ahead + 1
0x01928B|$06:$927B:F0 0D   	BEQ $928A  	; if no more strings to skip, then ($0C) is correct and we're done
0x01928D|$06:$927D:98      	TYA        	; otherwise update $0C-$0D and loop to the next string
0x01928E|$06:$927E:38      	SEC        
0x01928F|$06:$927F:65 0C   	ADC $0C    
0x019291|$06:$9281:85 0C   	STA $0C    
0x019293|$06:$9283:90 02   	BCC $9287  
0x019295|$06:$9285:E6 0D   	INC $0D    
; control flow target (from $9283)
0x019297|$06:$9287:4C 66 92	JMP $9266  	; given a pointer ($0C) and a number (one-based) in X, update $0C-$0D to the address of the start of the X'th string in ($0C)

; control flow target (from $927B)
0x01929A|$06:$928A:60      	RTS        

; handler for dialogue IDs #$B2-#$B3: Dog in Map ID #$0F: Osterfair
; indirect control flow target (via $8EAB, $8EAD)
; call to code in a different bank ($0F:$FA32)
0x01929B|$06:$928B:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01929E|$06:$928E:CF	; String ID #$02CF: ‘Roarrrr[..][..]!’[end-FC]

; data -> code
0x01929F|$06:$928F:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$B4: Dog in Map ID #$10: Zahan
; indirect control flow target (via $8EAF)
; call to code in a different bank ($0F:$FA32)
0x0192A2|$06:$9292:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

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

; data -> code
0x0192A6|$06:$9296:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$B5: Don Mahone in Map ID #$11: Tuhn
; indirect control flow target (via $8EB1)
0x0192A9|$06:$9299:A5 CD   	LDA $CD    	; Don Mahone quest status (#$00 = not started, #$01 = ingredients delivered, #$03 = game loaded after ingredients delivered)
0x0192AB|$06:$929B:F0 1D   	BEQ $92BA  
0x0192AD|$06:$929D:C9 03   	CMP #$03   
0x0192AF|$06:$929F:D0 0D   	BNE $92AE  
0x0192B1|$06:$92A1:A9 02   	LDA #$02   	; Moonbrooke
0x0192B3|$06:$92A3:85 97   	STA $97    	; subject hero ID $97
0x0192B5|$06:$92A5:A9 13   	LDA #$13   	; Item ID #$13: Water Flying Cloth
0x0192B7|$06:$92A7:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x0192B9|$06:$92A9:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x0192BC|$06:$92AC:B0 04   	BCS $92B2  
; control flow target (from $929F)
0x0192BE|$06:$92AE:A9 D5   	LDA #$D5   	; String ID #$02D5: ‘Sorry.[line]I haven't finished it yet.[line]Please be patient[.’][end-FC]
0x0192C0|$06:$92B0:D0 46   	BNE $92F8  	; display string, end TALK routine
; control flow target (from $92AC)
0x0192C2|$06:$92B2:A9 00   	LDA #$00   
0x0192C4|$06:$92B4:85 CD   	STA $CD    	; Don Mahone quest status (#$00 = not started, #$01 = ingredients delivered, #$03 = game loaded after ingredients delivered)
0x0192C6|$06:$92B6:A9 D6   	LDA #$D6   	; String ID #$02D6: ‘Hello.[line]I've just finished[.’][wait][line]‘See that the princess wears this[.’][end-FC]
0x0192C8|$06:$92B8:D0 3E   	BNE $92F8  	; display string, end TALK routine
; control flow target (from $929B)
0x0192CA|$06:$92BA:A9 2C   	LDA #$2C   	; Item ID #$2C: Dew’s Yarn
0x0192CC|$06:$92BC: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
0x0192CF|$06:$92BF:30 26   	BMI $92E7  
0x0192D1|$06:$92C1:A9 2D   	LDA #$2D   	; Item ID #$2D: Magic Loom
0x0192D3|$06:$92C3: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
0x0192D6|$06:$92C6:30 1F   	BMI $92E7  
0x0192D8|$06:$92C8:20 A7 94	JSR $94A7  	; X = A mod 8, A = A / 8
0x0192DB|$06:$92CB:85 9C   	STA $9C    	; hero ID
0x0192DD|$06:$92CD:A9 2D   	LDA #$2D   	; Item ID #$2D: Magic Loom
; call to code in a different bank ($0F:$C4B6)
0x0192DF|$06:$92CF:20 B6 C4	JSR $C4B6  	; 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
0x0192E2|$06:$92D2:A9 2C   	LDA #$2C   	; Item ID #$2C: Dew’s Yarn
0x0192E4|$06:$92D4:48      	PHA        	; Item ID #$2C: Dew’s Yarn
0x0192E5|$06:$92D5: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
0x0192E8|$06:$92D8:20 A7 94	JSR $94A7  	; X = A mod 8, A = A / 8
0x0192EB|$06:$92DB:85 9C   	STA $9C    	; hero ID
0x0192ED|$06:$92DD:68      	PLA        	; Item ID #$2C: Dew’s Yarn
; call to code in a different bank ($0F:$C4B6)
0x0192EE|$06:$92DE:20 B6 C4	JSR $C4B6  	; 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
0x0192F1|$06:$92E1:E6 CD   	INC $CD    	; Don Mahone quest status (#$00 = not started, #$01 = ingredients delivered, #$03 = game loaded after ingredients delivered)
0x0192F3|$06:$92E3:A9 D4   	LDA #$D4   	; String ID #$02D4: ‘Ah, so thou has found my loom, and the Dew's Yarn, too[.’][wait][line]‘I shall weave thee a Water Flying Cloth, but it will take time[.’][wait][line]‘Please come back in a day or so[.’][end-FC]
0x0192F5|$06:$92E5:D0 11   	BNE $92F8  	; display string, end TALK routine
; control flow target (from $92BF, $92C6)
; call to code in a different bank ($0F:$FA32)
0x0192F7|$06:$92E7:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0192FA|$06:$92EA:D1	; String ID #$02D1: ‘Yes, I am Don Mahone. Once I was a famous weaver, but my loom was stolen[.’][wait][line]‘Will thou help me?’[FD][FD][end-FC]

; data -> code
0x0192FB|$06:$92EB:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x0192FE|$06:$92EE:C9 00   	CMP #$00   	; YES
0x019300|$06:$92F0:D0 04   	BNE $92F6  
0x019302|$06:$92F2:A9 D2   	LDA #$D2   	; String ID #$02D2: ‘Good, good.[line]All I can tell thee is that the loom was taken by someone who smelled like fish[.’][end-FC]
0x019304|$06:$92F4:D0 02   	BNE $92F8  	; display string, end TALK routine
; control flow target (from $92F0)
0x019306|$06:$92F6:A9 D3   	LDA #$D3   	; String ID #$02D3: ‘That's too bad.[line]We could help each other[.’][end-FC]
; display string, end TALK routine
; control flow target (from $92B0, $92B8, $92E5, $92F4)
; call to code in a different bank ($0F:$FA52)
0x019308|$06:$92F8:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x01930B|$06:$92FB:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$B6: Roge Fastfinger in NE Map ID #$14: Wellgarth Underground
; indirect control flow target (via $8EB3)
0x01930E|$06:$92FE:A5 CE   	LDA $CE    	; Tuhn Watergate open flag (#$00 = closed, #$01 = open)
0x019310|$06:$9300:D0 22   	BNE $9324  
0x019312|$06:$9302:A9 3A   	LDA #$3A   	; Item ID #$3A: Watergate Key
0x019314|$06:$9304:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x019316|$06:$9306: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
0x019319|$06:$9309:10 19   	BPL $9324  
; call to code in a different bank ($0F:$FA32)
0x01931B|$06:$930B:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01931E|$06:$930E:D7	; String ID #$02D7: ‘Curses, I am found!’[wait][line]‘Yes, I am Roge Fastfinger and here is the watergate key[.’][end-FC]

; data -> code
0x01931F|$06:$930F:A9 00   	LDA #$00   	; Midenhall
; control flow target (from $931E)
0x019321|$06:$9311:85 97   	STA $97    	; subject hero ID $97
0x019323|$06:$9313:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x019326|$06:$9316:B0 11   	BCS $9329  
0x019328|$06:$9318:E6 97   	INC $97    	; subject hero ID $97
0x01932A|$06:$931A:A5 97   	LDA $97    	; subject hero ID $97
0x01932C|$06:$931C:C9 03   	CMP #$03   	; max of 3 heroes
0x01932E|$06:$931E:D0 F1   	BNE $9311  	; if more heroes to check, check them
0x019330|$06:$9320:A9 D8   	LDA #$D8   	; String ID #$02D8: [wait]‘But thou hast many things.[line]See me again later[.’][end-FC]
0x019332|$06:$9322:D0 02   	BNE $9326  
; control flow target (from $9300, $9309)
0x019334|$06:$9324:A9 D9   	LDA #$D9   	; String ID #$02D9: ‘I'm sorry; I will not do that anymore[.’][end-FC]
; control flow target (from $9322)
; call to code in a different bank ($0F:$FA52)
0x019336|$06:$9326:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
; control flow target (from $9316)
0x019339|$06:$9329:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue IDs #$B7-#$B9: Priest in Map ID #$15: Beran
; indirect control flow target (via $8EB5, $8EB7, $8EB9)
0x01933C|$06:$932C: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)
0x01933E|$06:$932E:C9 04   	CMP #$04   
0x019340|$06:$9330:B0 04   	BCS $9336  
0x019342|$06:$9332:A9 E1   	LDA #$E1   	; String ID #$02E1: ‘I see that thou hast faced many dangers and the greatest lie ahead[.’][end-FC]
0x019344|$06:$9334:D0 02   	BNE $9338  
; control flow target (from $9330)
0x019346|$06:$9336:A9 E2   	LDA #$E2   	; String ID #$02E2: ‘Welcome, [name]!’[wait][end-FC]
; control flow target (from $9334)
; call to code in a different bank ($0F:$FA52)
0x019348|$06:$9338:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x01934B|$06:$933B:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$BA: Monster in Map ID #$16: Hargon's Castle 1F
; indirect control flow target (via $8EBB)
; call to code in a different bank ($0F:$FA32)
0x01934E|$06:$933E:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019351|$06:$9341:E3	; String ID #$02E3: ‘The fool's false paradise suited thee better[.’][wait][line]‘Thou shall regret meddling in Hargon's affairs[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$D1C6)
0x019352|$06:$9342:20 C6 D1	JSR $D1C6  
0x019355|$06:$9345:4C 95 80	JMP $8095  	; wipe menus and exit COMMAND menu

; handler for dialogue ID #$BB: Hargon in Map ID #$17: Hargon's Castle 7F
; indirect control flow target (via $8EBD)
; call to code in a different bank ($0F:$FA32)
0x019358|$06:$9348:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01935B|$06:$934B:E4	; String ID #$02E4: ‘Who comes hither to disturb the Great Hargon?’[wait][line]‘Dost thou know who I am?’[FD][FD][end-FC]

; data -> code
0x01935C|$06:$934C:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x01935F|$06:$934F:C9 00   	CMP #$00   	; YES
0x019361|$06:$9351:D0 04   	BNE $9357  
0x019363|$06:$9353:A9 E5   	LDA #$E5   	; String ID #$02E5: ‘Such audacity is unforgivable!’[end-FC]
0x019365|$06:$9355:D0 02   	BNE $9359  
; control flow target (from $9351)
0x019367|$06:$9357:A9 E6   	LDA #$E6   	; String ID #$02E6: ‘Then I shall teach the proper respect!’[end-FC]
; control flow target (from $9355)
; call to code in a different bank ($0F:$FA52)
0x019369|$06:$9359:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
; call to code in a different bank ($0F:$D0F5)
0x01936C|$06:$935C:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
; call to code in a different bank ($0F:$D1F8)
0x01936F|$06:$935F:20 F8 D1	JSR $D1F8  	; trigger Fixed Battle #$0B: 1 Hargon (Map ID #$17: Hargon's Castle 7F)
0x019372|$06:$9362:A5 98   	LDA $98    	; outcome of last fight?
0x019374|$06:$9364:C9 FC   	CMP #$FC   
0x019376|$06:$9366:F0 14   	BEQ $937C  
; call to code in a different bank ($0F:$F6F6)
0x019378|$06:$9368: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
0x01937B|$06:$936B:E7	; String ID #$02E7: ‘So thou hast proven a mighty warrior, mightier even than Hargon the Great[.’][wait][line]‘But there is one even greater than I, a sorcerer of the Shadowtime,[wait][line]a being of pure malice that none shall overcome[.’][wait][line]‘I send thee now to meet Malroth!’[end-FC]

; data -> code
0x01937C|$06:$936C:A9 FF   	LDA #$FF   
0x01937E|$06:$936E:8D 61 05	STA $0561  	; NPC #$04 sprite ID
; call to code in a different bank ($0F:$CF64)
0x019381|$06:$9371:20 64 CF	JSR $CF64  
; call to code in a different bank ($0F:$D0F5)
0x019384|$06:$9374:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x019387|$06:$9377:A9 64   	LDA #$64   
0x019389|$06:$9379: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)
0x01938B|$06:$937B:60      	RTS        

; control flow target (from $9366)
0x01938C|$06:$937C:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$BC: Dragonlord's Grandson in Map ID #$18: Charlock Castle B8
; indirect control flow target (via $8EBF)
0x01938F|$06:$937F:A9 00   	LDA #$00   	; Midenhall
; call to code in a different bank ($0F:$FC50)
0x019391|$06:$9381:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x019394|$06:$9384:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019397|$06:$9387:EA	; String ID #$02EA: ‘Welcome, [name][.’][wait][line]‘All that Hargon threatens to take is really mine, for I am the grandson of the Dragonlord[.’][wait][line]‘Defeat Hargon and I will give thee advice.[line]Will thou do this?’[FD][FD][end-FC]

; data -> code
0x019398|$06:$9388:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x01939B|$06:$938B:C9 00   	CMP #$00   	; YES
0x01939D|$06:$938D:D0 04   	BNE $9393  
0x01939F|$06:$938F:A9 F0   	LDA #$F0   	; String ID #$02F0: ‘Once thou hast the five crests, seek out the good wizard, Rubiss,[wait][line]who dwells in the depths of the sea south of Midenhall[.’][end-FC]
0x0193A1|$06:$9391:D0 02   	BNE $9395  
; control flow target (from $938D)
0x0193A3|$06:$9393:A9 F1   	LDA #$F1   	; String ID #$02F1: ‘Thou art surely missing thy brain.[line]But it is up to thee[.’][end-FC]
; control flow target (from $9391)
; call to code in a different bank ($0F:$FA52)
0x0193A5|$06:$9395:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x0193A8|$06:$9398:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$BD: Guard in Map ID #$1A: Shrine SW of Cannock
; indirect control flow target (via $8EC1)
0x0193AB|$06:$939B:A9 BD   	LDA #$BD   	; dialogue ID
0x0193AD|$06:$939D:D0 02   	BNE $93A1  
; handler for dialogue ID #$BE: Guard in Map ID #$1A: Shrine SW of Cannock
; indirect control flow target (via $8EC3)
0x0193AF|$06:$939F:A9 BE   	LDA #$BE   	; dialogue ID
; control flow target (from $939D)
0x0193B1|$06:$93A1:85 49   	STA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$F6CE)
0x0193B3|$06:$93A3:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x0193B6|$06:$93A6:D0 0E   	BNE $93B6  	; if Midenhall is alone, he can't pass
0x0193B8|$06:$93A8:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x0193BA|$06:$93AA:C9 BD   	CMP #$BD   
0x0193BC|$06:$93AC:D0 04   	BNE $93B2  
0x0193BE|$06:$93AE:A9 F3   	LDA #$F3   	; String ID #$02F3: ‘It is dangerous to tread some roads alone[.’][end-FC]
0x0193C0|$06:$93B0:D0 06   	BNE $93B8  
; control flow target (from $93AC)
0x0193C2|$06:$93B2:A9 F4   	LDA #$F4   	; String ID #$02F4: ‘The King of Cannock has left orders that none shall pass alone[.’][end-FC]
0x0193C4|$06:$93B4:D0 02   	BNE $93B8  
; control flow target (from $93A6)
0x0193C6|$06:$93B6:A9 EB   	LDA #$EB   	; String ID #$02EB: ‘Please go through[.’][end-FC]
; control flow target (from $93B0, $93B4)
; call to code in a different bank ($0F:$FA52)
0x0193C8|$06:$93B8:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x0193CB|$06:$93BB:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$BF: Wizard in Map ID #$1C: Shrine SE of Rimuldar
; indirect control flow target (via $8EC5)
0x0193CE|$06:$93BE:A9 23   	LDA #$23   	; Item ID #$23: Helmet of Erdrick
0x0193D0|$06:$93C0: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
0x0193D3|$06:$93C3:30 04   	BMI $93C9  
0x0193D5|$06:$93C5:A9 F7   	LDA #$F7   	; String ID #$02F7: ‘Thou hast no further business here. Go[.’][end-FC]
0x0193D7|$06:$93C7:D0 12   	BNE $93DB  
; control flow target (from $93C3)
0x0193D9|$06:$93C9:A9 24   	LDA #$24   	; Item ID #$24: Token of Erdrick
0x0193DB|$06:$93CB: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
0x0193DE|$06:$93CE:10 04   	BPL $93D4  
0x0193E0|$06:$93D0:A9 F5   	LDA #$F5   	; String ID #$02F5: ‘The real descendant of Erdrick carries a token to prove his heritage[.’][wait][line]‘Now be off with thee, imposter[.’][end-FC]
0x0193E2|$06:$93D2:D0 07   	BNE $93DB  
; control flow target (from $93CE)
0x0193E4|$06:$93D4:A9 23   	LDA #$23   	; Item ID #$23: Helmet of Erdrick
0x0193E6|$06:$93D6:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x0193E9|$06:$93D9:A9 F6   	LDA #$F6   	; String ID #$02F6: ‘I have been waiting for thee to come[.’][wait][line]‘I will trade the Helmet of Erdrick for the token thou carries[.’][end-FC]
; control flow target (from $93C7, $93D2)
; call to code in a different bank ($0F:$FA52)
0x0193EB|$06:$93DB:20 52 FA	JSR $FA52  	; display string ID specified by A + #$0200
0x0193EE|$06:$93DE:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$C0: Wizard in Map ID #$15: Beran
; indirect control flow target (via $8EC7)
0x0193F1|$06:$93E1:A9 04   	LDA #$04   	; Save Point ID #$04: Beran
; update save point $48 to A, run through the whole save point sequence
; control flow target (from $81C2)
0x0193F3|$06:$93E3:85 48   	STA $48    	; last save point ID
0x0193F5|$06:$93E5:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
; call to code in a different bank ($0F:$FC50)
0x0193F8|$06:$93E8:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x0193FB|$06:$93EB:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x0193FE|$06:$93EE:F8	; String ID #$02F8: ‘Even here thou can record thy deeds in the Imperial Scrolls of Honor[.’][wait][end-FC]

; data -> code
0x0193FF|$06:$93EF:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
; call to code in a different bank ($0F:$FA32)
0x019402|$06:$93F2:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019405|$06:$93F5:87	; String ID #$0287: ‘Dost thou wish to save thy deeds in the Imperial Scrolls of Honor?’[FD][FD][end-FC]

; data -> code
0x019406|$06:$93F6:20 5D A3	JSR $A35D  	; save game handler
; call to code in a different bank ($0F:$FA32)
0x019409|$06:$93F9:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01940C|$06:$93FC:F9	; String ID #$02F9: [wait]‘Return when in need[.’][end-FC]

; data -> code
0x01940D|$06:$93FD:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$C1: Priest in Map ID #$1F: Rhone Shrine
; indirect control flow target (via $8EC9)
0x019410|$06:$9400:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x019413|$06:$9403:48      	PHA        	; ID of first living hero at start of conversation
; call to code in a different bank ($0F:$FC50)
0x019414|$06:$9404:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x019417|$06:$9407:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01941A|$06:$940A:FA	; String ID #$02FA: ‘May the light shine upon thee, [name][.’][FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$C515)
0x01941B|$06:$940B:20 15 C5	JSR $C515  	; flash screen 10 times
0x01941E|$06:$940E:A9 84   	LDA #$84   	; everybody's alive and in your party!
0x019420|$06:$9410:8D 2D 06	STA $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019423|$06:$9413:8D 3F 06	STA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019426|$06:$9416:8D 51 06	STA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
; call to code in a different bank ($0F:$C77B)
0x019429|$06:$9419:20 7B C7	JSR $C77B  	; restore full HP/MP to all living party members
0x01942C|$06:$941C:A9 00   	LDA #$00   
0x01942E|$06:$941E:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$D302)
0x019430|$06:$9420:20 02 D3	JSR $D302  
0x019433|$06:$9423:A9 01   	LDA #$01   
0x019435|$06:$9425:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$D302)
0x019437|$06:$9427:20 02 D3	JSR $D302  
0x01943A|$06:$942A:A9 02   	LDA #$02   
0x01943C|$06:$942C:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$D302)
0x01943E|$06:$942E:20 02 D3	JSR $D302  
; call to code in a different bank ($0F:$C22C)
0x019441|$06:$9431:20 2C C2	JSR $C22C  
0x019444|$06:$9434:20 66 94	JSR $9466  	; display EXP to next level messages for entire party
; call to code in a different bank ($0F:$FA32)
0x019447|$06:$9437:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01944A|$06:$943A:87	; String ID #$0287: ‘Dost thou wish to save thy deeds in the Imperial Scrolls of Honor?’[FD][FD][end-FC]

; data -> code
0x01944B|$06:$943B:A9 05   	LDA #$05   	; Save Point ID #$05: Rhone Shrine
0x01944D|$06:$943D:85 48   	STA $48    	; last save point ID
0x01944F|$06:$943F:20 5D A3	JSR $A35D  	; save game handler
0x019452|$06:$9442:68      	PLA        	; ID of first living hero at start of conversation
; call to code in a different bank ($0F:$FC50)
0x019453|$06:$9443:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA32)
0x019456|$06:$9446:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019459|$06:$9449:FB	; String ID #$02FB: [wait]‘Go now, [name][.’][end-FC]

; data -> code
0x01945A|$06:$944A:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue ID #$C2: Priest in Map ID #$20: Shrine SW of Moonbrooke
; indirect control flow target (via $8ECB)
0x01945D|$06:$944D:A9 02   	LDA #$02   	; Moonbrooke
0x01945F|$06:$944F:85 97   	STA $97    	; subject hero ID $97
0x019461|$06:$9451:A9 04   	LDA #$04   	; In Party
0x019463|$06:$9453:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019466|$06:$9456:B0 07   	BCS $945F  
; call to code in a different bank ($0F:$FA32)
0x019468|$06:$9458:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
0x01946B|$06:$945B:FC	; String ID #$02FC: ‘None shall pass until aid has been rendered to the Princess of Moonbrooke[.’][end-FC]

; data -> code
0x01946C|$06:$945C:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9456)
; call to code in a different bank ($0F:$FA32)
0x01946F|$06:$945F:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019472|$06:$9462:00	; String ID #$0200: ‘When in need, visit the Houses of Healing[.’][end-FC]

; data -> code
0x019473|$06:$9463:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; display EXP to next level messages for entire party
; control flow target (from $8ED9, $8F15, $8F5C, $8FDB, $9182, $91FE, $93EF, $9434)
0x019476|$06:$9466:A9 00   	LDA #$00   	; Midenhall
0x019478|$06:$9468:85 97   	STA $97    	; subject hero ID $97
; control flow target (from $9490)
0x01947A|$06:$946A:A9 04   	LDA #$04   	; In Party
0x01947C|$06:$946C:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
; skip if not in party
0x01947F|$06:$946F:90 19   	BCC $948A  
0x019481|$06:$9471:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F734)
0x019483|$06:$9473:20 34 F7	JSR $F734  	; set $8F-$90 to EXP required to reach next level
0x019486|$06:$9476:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x019489|$06:$9479:A5 8F   	LDA $8F    
0x01948B|$06:$947B:05 90   	ORA $90    
0x01948D|$06:$947D:D0 07   	BNE $9486  	; different messages depending on whether you're at max EXP or not
; call to code in a different bank ($0F:$FA2A)
0x01948F|$06:$947F:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x019492|$06:$9482:52	; String ID #$0052: ‘[name] is now strong enough[.’][wait][end-FC]

; data -> code
0x019493|$06:$9483:4C 8A 94	JMP $948A  

; control flow target (from $947D)
; call to code in a different bank ($0F:$FA32)
0x019496|$06:$9486:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x019499|$06:$9489:8F	; String ID #$028F: ‘Of experience points [name] needs [number] to reach the next level[.’][wait][end-FC]

; data -> code
; control flow target (from $946F, $9483)
0x01949A|$06:$948A:E6 97   	INC $97    	; subject hero ID $97
0x01949C|$06:$948C:A5 97   	LDA $97    	; subject hero ID $97
0x01949E|$06:$948E:C9 03   	CMP #$03   	; max of 3 heroes
0x0194A0|$06:$9490:90 D8   	BCC $946A  	; if more heroes to handle, handle them
0x0194A2|$06:$9492:60      	RTS        

; SEC if Moonbrooke in party, CLC otherwise
; control flow target (from $9095)
0x0194A3|$06:$9493:A9 02   	LDA #$02   	; Moonbrooke
0x0194A5|$06:$9495:85 97   	STA $97    	; subject hero ID $97
0x0194A7|$06:$9497:A9 04   	LDA #$04   	; In Party
0x0194A9|$06:$9499:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x0194AC|$06:$949C:60      	RTS        

; SEC if Moonbrooke alive, CLC otherwise
; control flow target (from $9106, $9112)
0x0194AD|$06:$949D:A9 02   	LDA #$02   	; Moonbrooke
0x0194AF|$06:$949F:85 97   	STA $97    	; subject hero ID $97
0x0194B1|$06:$94A1:A9 80   	LDA #$80   	; Alive
0x0194B3|$06:$94A3:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x0194B6|$06:$94A6:60      	RTS        

; X = A mod 8, A = A / 8
; control flow target (from $92C8, $92D8)
0x0194B7|$06:$94A7:48      	PHA        
0x0194B8|$06:$94A8:29 07   	AND #$07   
0x0194BA|$06:$94AA:AA      	TAX        
0x0194BB|$06:$94AB:68      	PLA        
0x0194BC|$06:$94AC:4A      	LSR        
0x0194BD|$06:$94AD:4A      	LSR        
0x0194BE|$06:$94AE:4A      	LSR        
0x0194BF|$06:$94AF:60      	RTS        

; handler for dialogue IDs #$C3-#$CC (open dialogue window and display string specified by A - #$73)
; control flow target (from $8205)
0x0194C0|$06:$94B0:38      	SEC        
0x0194C1|$06:$94B1:E9 73   	SBC #$73   	; convert to string ID
0x0194C3|$06:$94B3:48      	PHA        
0x0194C4|$06:$94B4:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0194C7|$06:$94B7:68      	PLA        	; String IDs #$50-#$59: "‘Take care that thou strays not over the tower's edge[.’][end-FC]" / "‘As the full moon waxes and wanes so too the tide rises and falls[.’][end-FC]" / "‘[name] is now strong enough[.’][wait][end-FC]" / "And [cardinal #] [monster(s)][line]appeared.[end-FC]" / "[cardinal #] [monster(s)][line]appeared.[end-FC]" / "[end-FC]" / "[end-FC]" / "‘In ancient times a volcano rose from the seabed, and inside was a deep cavern[.’][end-FC]" / "[end-FC]" / "[end-FC]"
; call to code in a different bank ($0F:$FA4A)
0x0194C8|$06:$94B8:20 4A FA	JSR $FA4A  	; display string ID specified by A
0x0194CB|$06:$94BB:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue IDs #$CD-#$CF (open dialogue window, display string specified by A - #$73, display YES/NO menu, and display string corresponding to selected option)
; control flow target (from $820C)
0x0194CE|$06:$94BE:38      	SEC        
0x0194CF|$06:$94BF:E9 CD   	SBC #$CD   	; why not just SBC #$73?
0x0194D1|$06:$94C1:18      	CLC        
0x0194D2|$06:$94C2:69 5A   	ADC #$5A   	; String IDs #$5A-#$5C: "‘Hast thou purified thy body in the Spring of Bravery?’[end-FC]" / "‘Dost thou know what I know?’[FD][FD][end-FC]" / "‘Hast thou found the Wizard's Home?’[FD][FD][end-FC]"
0x0194D4|$06:$94C4:85 49   	STA $49    	; object hero/target/item/string ID $49
0x0194D6|$06:$94C6:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0194D9|$06:$94C9:A5 49   	LDA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$FA4A)
0x0194DB|$06:$94CB:20 4A FA	JSR $FA4A  	; display string ID specified by A
0x0194DE|$06:$94CE:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x0194E1|$06:$94D1:C9 00   	CMP #$00   	; YES
0x0194E3|$06:$94D3:D0 04   	BNE $94D9  
0x0194E5|$06:$94D5:A9 03   	LDA #$03   	; String IDs #$5D-#$5F: "‘Then all is well[.’][end-FC]" / "‘But I have not yet spoken[.’][end-FC]" / "‘Go then, for thou must defeat Hargon[.’][end-FC]"
0x0194E7|$06:$94D7:D0 02   	BNE $94DB  
; control flow target (from $94D3)
0x0194E9|$06:$94D9:A9 06   	LDA #$06   	; String IDs #$60-#$62: "‘That is not good[.’][wait][line]‘All who seek victory must first visit the Spring of Bravery[.’][end-FC]" / "‘These twin towers are known as the Dragon's Horn[.’][end-FC]" / "‘Thou art close to the island cave wherein lies an object of great power and greater peril!’[end-FC]"
; control flow target (from $94D7)
0x0194EB|$06:$94DB:18      	CLC        
0x0194EC|$06:$94DC:65 49   	ADC $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$FA4A)
0x0194EE|$06:$94DE:20 4A FA	JSR $FA4A  	; display string ID specified by A
0x0194F1|$06:$94E1:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; handler for dialogue IDs #$D0-#$D8 (dungeon NPCs with complex logic)
; control flow target (from $8213)
0x0194F4|$06:$94E4:48      	PHA        	; dialogue ID
0x0194F5|$06:$94E5:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0194F8|$06:$94E8:68      	PLA        	; dialogue ID
0x0194F9|$06:$94E9:C9 D0   	CMP #$D0   	; dialogue ID #$D0: Wizard in Map ID #$40: Spring of Bravery
0x0194FB|$06:$94EB:D0 38   	BNE $9525  
; call to code in a different bank ($0F:$FA2A)
0x0194FD|$06:$94ED:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x019500|$06:$94F0:6A	; String ID #$006A: ‘Welcome to the Spring of Bravery[.’][wait][end-FC]

; data -> code
0x019501|$06:$94F1: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)
0x019503|$06:$94F3:C9 01   	CMP #$01   
0x019505|$06:$94F5:F0 04   	BEQ $94FB  
0x019507|$06:$94F7:C9 02   	CMP #$02   
0x019509|$06:$94F9:D0 1A   	BNE $9515  
; control flow target (from $94F5)
; call to code in a different bank ($0F:$FA2A)
0x01950B|$06:$94FB:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x01950E|$06:$94FE:64	; String ID #$0064: ‘Art thou seeking the Prince of Cannock?’[FD][FD][end-FC]

; data -> code
0x01950F|$06:$94FF:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x019512|$06:$9502:C9 00   	CMP #$00   	; YES
0x019514|$06:$9504:D0 0F   	BNE $9515  
0x019516|$06:$9506: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)
0x019518|$06:$9508:C9 01   	CMP #$01   
0x01951A|$06:$950A:D0 02   	BNE $950E  
0x01951C|$06:$950C:E6 CA   	INC $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)
; control flow target (from $950A)
; call to code in a different bank ($0F:$FA2A)
0x01951E|$06:$950E:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x019521|$06:$9511:65	; String ID #$0065: ‘Only moments ago he was here.[line]I think he is going to Midenhall Castle[.’][end-FC]

; data -> code
0x019522|$06:$9512:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $94F9, $9504)
; call to code in a different bank ($0F:$FA2A)
0x019525|$06:$9515:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x019528|$06:$9518:63	; String ID #$0063: ‘I shall anoint thee with this water and wish thee well[.’][wait][line]‘Know that Token of Erdrick is kept by a brave hero[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$C515)
0x019529|$06:$9519:20 15 C5	JSR $C515  	; flash screen 10 times
0x01952C|$06:$951C:20 CC 8D	JSR $8DCC  	; restore full HP to all living party members
; call to code in a different bank ($0F:$C22C)
0x01952F|$06:$951F:20 2C C2	JSR $C22C  
0x019532|$06:$9522:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $94EB)
0x019535|$06:$9525:C9 D1   	CMP #$D1   	; dialogue ID #$D1: Wizard in Map ID #$56: Lighthouse 7F
0x019537|$06:$9527:D0 07   	BNE $9530  
; call to code in a different bank ($0F:$FA2E)
0x019539|$06:$9529:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
0x01953C|$06:$952C:52	; String ID #$0152: ‘Follow me and do not make a peep[.’][end-FC]

; data -> code
0x01953D|$06:$952D:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9527)
0x019540|$06:$9530:C9 D6   	CMP #$D6   	; dialogue ID #$D6: Guard in Map ID ; Map ID #$57: Lighthouse 8F
0x019542|$06:$9532:D0 0B   	BNE $953F  
; call to code in a different bank ($0F:$FA2A)
0x019544|$06:$9534:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x019547|$06:$9537:70	; String ID #$0070: ‘For long ages have I guarded the Chamber of Hargon[.’][wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$FA2A)
0x019548|$06:$9538:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x01954B|$06:$953B:71	; String ID #$0071: ‘There is a land called Rhone, high in the mountains in the middle of a great continent[.’][wait][line]‘There shall thou find Hargon[.’][end-FC]

; data -> code
0x01954C|$06:$953C:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9532)
0x01954F|$06:$953F:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; exit COMMAND menu
; control flow target (from $9560, $9569, $958A, $95B8, $9630, $99C8)
; call to code in a different bank ($0F:$FA89)
0x019552|$06:$9542:20 89 FA	JSR $FA89  	; useless JSR to RTS?!
0x019555|$06:$9545:4C 6D 80	JMP $806D  	; exit COMMAND menu

; end TALK/ITEM routines
; control flow target (from $8C40, $8CD1, $8E41, $8E67, $8F09, $8F36, $8F82, $8FA9, $8FC9, $9016, $903C, $9062, $9074, $9092, $909E, $90A5, $90BC, $90EC, $90FF, $910F, $914A, $916B, $9178, $9194, $91E0, $91EA, $91F1, $9210, $924B, $928F, $9296, $92FB, $9329, $933B, $937C, $9398, $93BB, $93DE, $93FD, $944A, $945C, $9463, $94BB, $94E1, $9512, $9522, $952D, $953C, $953F, $957B, $95A4, $9603, $966C, $967E, $96CD, $96F6, $9745, $9754, $97E6, $97F1, $980C, $9822, $983B, $9845, $984F, $9859, $9863, $986D, $9877, $9881, $988B, $9892, $99BE, $99EC, $99FD, $9A14, $9A44, $9A66, $9A81, $9ABA, $9AC1, $9AC8, $9B81, $9BA3, $9BB7, $9BEF, $9C02, $9C34, $9C5F, $9C90, $9CBE, $9D4C)
0x019558|$06:$9548:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x01955A|$06:$954A:10 01   	BPL $954D  
0x01955C|$06:$954C:60      	RTS        

; control flow target (from $954A)
0x01955D|$06:$954D:20 9D 80	JSR $809D  	; wait until all joypad buttons are released and then some button pressed
; call to code in a different bank ($0F:$FA89)
0x019560|$06:$9550:20 89 FA	JSR $FA89  	; useless JSR to RTS?!
0x019563|$06:$9553:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$CF6A)
0x019565|$06:$9555:20 6A CF	JSR $CF6A  	; wipe selected menu region
0x019568|$06:$9558:4C 6D 80	JMP $806D  	; exit COMMAND menu

; COMMAND menu ITEM command handler
; indirect control flow target (via $808C)
; call to code in a different bank ($0F:$F55D)
0x01956B|$06:$955B:20 5D F5	JSR $F55D  	; display appropriate main ITEM hero select menu
0x01956E|$06:$955E:C9 FF   	CMP #$FF   
0x019570|$06:$9560:F0 E0   	BEQ $9542  	; exit COMMAND menu
0x019572|$06:$9562:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F5FE)
0x019574|$06:$9564:20 FE F5	JSR $F5FE  	; given a hero ID in A, open hero's item list and return selected item ID (or #$FE if they have no items)
0x019577|$06:$9567:C9 FF   	CMP #$FF   
0x019579|$06:$9569:F0 D7   	BEQ $9542  	; exit COMMAND menu
0x01957B|$06:$956B:C9 FE   	CMP #$FE   
0x01957D|$06:$956D:D0 0F   	BNE $957E  	; hero has selected an item to use
0x01957F|$06:$956F:20 CB 9A	JSR $9ACB  	; open dialogue window
0x019582|$06:$9572:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$FC50)
0x019584|$06:$9574:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019587|$06:$9577:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01958A|$06:$957A:13	; String ID #$0113: [name] does not yet have anything.[end-FC]

; data -> code
0x01958B|$06:$957B:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; hero has selected an item to use
; control flow target (from $956D)
0x01958E|$06:$957E:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019590|$06:$9580:85 95   	STA $95    	; ID for [item] and [spell] control codes; item ID
0x019592|$06:$9582:86 49   	STX $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$EB76)
0x019594|$06:$9584:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x019597|$06:$9587:17	; Menu ID #$17: Main menu: what to do with selected item

; data -> code
0x019598|$06:$9588:C9 FF   	CMP #$FF   
0x01959A|$06:$958A:F0 B6   	BEQ $9542  	; exit COMMAND menu
0x01959C|$06:$958C:C9 01   	CMP #$01   	; TRADE
0x01959E|$06:$958E:90 03   	BCC $9593  	; USE handler
0x0195A0|$06:$9590:4C A8 99	JMP $99A8  	; TRADE/THROW handler

; USE handler
; control flow target (from $958E)
0x0195A3|$06:$9593:A9 80   	LDA #$80   	; Alive
0x0195A5|$06:$9595:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x0195A8|$06:$9598:B0 0D   	BCS $95A7  	; USE handler, hero alive
0x0195AA|$06:$959A:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0195AD|$06:$959D:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x0195B0|$06:$95A0:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0195B3|$06:$95A3:1F	; String ID #$011F: Alas, being but a ghost, [name] cannot use the [item].[end-FC]

; data -> code
0x0195B4|$06:$95A4:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; USE handler, hero alive
; control flow target (from $9598)
0x0195B7|$06:$95A7:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x0195B9|$06:$95A9:C9 3C   	CMP #$3C   	; Item ID #$3C: Medical Herb
0x0195BB|$06:$95AB:F0 04   	BEQ $95B1  	; USE Medical/Antidote Herb
0x0195BD|$06:$95AD:C9 3B   	CMP #$3B   	; Item ID #$3B: Antidote Herb
0x0195BF|$06:$95AF:D0 74   	BNE $9625  
; USE Medical/Antidote Herb
; control flow target (from $95AB)
; call to code in a different bank ($0F:$F587)
0x0195C1|$06:$95B1:20 87 F5	JSR $F587  	; display appropriate main ITEM target menu
0x0195C4|$06:$95B4:C9 FF   	CMP #$FF   
0x0195C6|$06:$95B6:D0 03   	BNE $95BB  
0x0195C8|$06:$95B8:4C 42 95	JMP $9542  	; exit COMMAND menu

; control flow target (from $95B6)
0x0195CB|$06:$95BB:85 C9   	STA $C9    	; target hero ID
0x0195CD|$06:$95BD:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0195D0|$06:$95C0:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x0195D3|$06:$95C3:A5 97   	LDA $97    	; subject hero ID $97
0x0195D5|$06:$95C5:C5 C9   	CMP $C9    	; target hero ID
0x0195D7|$06:$95C7:F0 0D   	BEQ $95D6  	; use different strings depending on whether hero uses item on themself or another hero
; call to code in a different bank ($0F:$FA2E)
0x0195D9|$06:$95C9:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0195DC|$06:$95CC:20	; String ID #$0120: [name] [end-FF]

; data -> code
0x0195DD|$06:$95CD:A5 C9   	LDA $C9    	; target hero ID
; call to code in a different bank ($0F:$FC50)
0x0195DF|$06:$95CF:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x0195E2|$06:$95D2:A9 1D   	LDA #$1D   	; String ID #$011D: used the [item] on [name].[end-FC]
0x0195E4|$06:$95D4:D0 02   	BNE $95D8  
; control flow target (from $95C7)
0x0195E6|$06:$95D6:A9 1E   	LDA #$1E   	; String ID #$011E: [name] used the [item].[end-FC]
; control flow target (from $95D4)
; call to code in a different bank ($0F:$FA4E)
0x0195E8|$06:$95D8:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x0195EB|$06:$95DB:A5 97   	LDA $97    	; subject hero ID $97
0x0195ED|$06:$95DD:48      	PHA        	; subject hero ID
0x0195EE|$06:$95DE:A5 C9   	LDA $C9    	; target hero ID
0x0195F0|$06:$95E0:85 97   	STA $97    	; subject hero ID $97
0x0195F2|$06:$95E2:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x0195F4|$06:$95E4:C9 3C   	CMP #$3C   	; Item ID #$3C: Medical Herb
0x0195F6|$06:$95E6:D0 1E   	BNE $9606  	; USE Antidote Herb
0x0195F8|$06:$95E8:A9 80   	LDA #$80   	; Alive
0x0195FA|$06:$95EA:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x0195FD|$06:$95ED:90 0A   	BCC $95F9  	; Medical Herbs can't heal dead people
0x0195FF|$06:$95EF:A5 C9   	LDA $C9    	; target hero ID
0x019601|$06:$95F1:A2 64   	LDX #$64   	; Healing Power on field for Medical Herb
; call to code in a different bank ($0F:$F72B)
0x019603|$06:$95F3:20 2B F7	JSR $F72B  	; heal hero ID in A by random amount based on healing power in X
; call to code in a different bank ($0F:$C22C)
0x019606|$06:$95F6:20 2C C2	JSR $C22C  
; control flow target (from $95ED, $960B, $961A)
0x019609|$06:$95F9:68      	PLA        	; subject hero ID
0x01960A|$06:$95FA:A6 49   	LDX $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$C4D4)
0x01960C|$06:$95FC:20 D4 C4	JSR $C4D4  	; given hero ID in A and hero inventory offset in X, remove that item from hero's inventory and move all lower items up 1 slot
; call to code in a different bank ($0F:$EB76)
0x01960F|$06:$95FF:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x019612|$06:$9602:01	; Menu ID #$01: Mini status window, top

; data -> code
0x019613|$06:$9603:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; USE Antidote Herb
; control flow target (from $95E6)
0x019616|$06:$9606:A9 80   	LDA #$80   	; Alive
0x019618|$06:$9608:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x01961B|$06:$960B:90 EC   	BCC $95F9  	; Antidote Herbs can't heal dead people
0x01961D|$06:$960D:A5 C9   	LDA $C9    	; target hero ID
0x01961F|$06:$960F:20 AC 8D	JSR $8DAC  	; given hero ID in A, set Y to start of hero's data in $062D,Y, i.e. Y = A * #$12
0x019622|$06:$9612:A9 DF   	LDA #$DF   	; clear Poison
0x019624|$06:$9614:39 2D 06	AND $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019627|$06:$9617:99 2D 06	STA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01962A|$06:$961A:4C F9 95	JMP $95F9  

; given hero ID in $97 and hero inventory offset in $49, remove that item from hero's inventory and move all lower items up 1 slot
; control flow target (from $9634, $965E, $967B, $9809)
0x01962D|$06:$961D:A5 97   	LDA $97    	; subject hero ID $97
0x01962F|$06:$961F:A6 49   	LDX $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$C4D4)
0x019631|$06:$9621:20 D4 C4	JSR $C4D4  	; given hero ID in A and hero inventory offset in X, remove that item from hero's inventory and move all lower items up 1 slot
0x019634|$06:$9624:60      	RTS        

; control flow target (from $95AF)
0x019635|$06:$9625:C9 29   	CMP #$29   	; Item ID #$29: Leaf of The World Tree
0x019637|$06:$9627:D0 25   	BNE $964E  
; call to code in a different bank ($0F:$F587)
0x019639|$06:$9629:20 87 F5	JSR $F587  	; display appropriate main ITEM target menu
0x01963C|$06:$962C:C9 FF   	CMP #$FF   
0x01963E|$06:$962E:D0 03   	BNE $9633  	; USE Item ID #$29: Leaf of The World Tree on target hero
0x019640|$06:$9630:4C 42 95	JMP $9542  	; exit COMMAND menu

; USE Item ID #$29: Leaf of The World Tree on target hero
; control flow target (from $962E)
0x019643|$06:$9633:48      	PHA        	; target hero ID
0x019644|$06:$9634:20 1D 96	JSR $961D  	; given hero ID in $97 and hero inventory offset in $49, remove that item from hero's inventory and move all lower items up 1 slot
0x019647|$06:$9637:20 CB 9A	JSR $9ACB  	; open dialogue window
0x01964A|$06:$963A:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01964D|$06:$963D:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019650|$06:$9640:20	; String ID #$0120: [name] [end-FF]

; data -> code
0x019651|$06:$9641:68      	PLA        	; target hero ID
0x019652|$06:$9642:85 49   	STA $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$FC50)
0x019654|$06:$9644:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019657|$06:$9647:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01965A|$06:$964A:32	; String ID #$0132: ground up the Leaf of the World Tree and gave it to [name].[wait][end-FC]

; data -> code
0x01965B|$06:$964B:4C 9F 8C	JMP $8C9F  	; spell ID is not #$09, #$0B, #$0D, #$10, or #$12-#$16; ergo it's Spell ID #$17: Revive

; control flow target (from $9627)
0x01965E|$06:$964E:48      	PHA        	; item ID
0x01965F|$06:$964F:20 CB 9A	JSR $9ACB  	; open dialogue window
0x019662|$06:$9652:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x019665|$06:$9655:68      	PLA        	; item ID
0x019666|$06:$9656:C9 35   	CMP #$35   	; Item ID #$35: Wing of the Wyvern
0x019668|$06:$9658:D0 0A   	BNE $9664  
; call to code in a different bank ($0F:$FA2E)
0x01966A|$06:$965A:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01966D|$06:$965D:21	; String ID #$0121: [name] threw the Wing of the Wyvern into the air.[end-FC]

; data -> code
0x01966E|$06:$965E:20 1D 96	JSR $961D  	; given hero ID in $97 and hero inventory offset in $49, remove that item from hero's inventory and move all lower items up 1 slot
0x019671|$06:$9661:4C 51 8C	JMP $8C51  	; handler for Return spell effect

; control flow target (from $9658)
0x019674|$06:$9664:C9 25   	CMP #$25   	; Item ID #$25: Tresures
0x019676|$06:$9666:D0 07   	BNE $966F  
; call to code in a different bank ($0F:$FA2E)
0x019678|$06:$9668:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01967B|$06:$966B:29	; String ID #$0129: [name] could not open the treasure chest, for it was locked.[end-FC]

; data -> code
0x01967C|$06:$966C:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9666)
0x01967F|$06:$966F:C9 34   	CMP #$34   	; Item ID #$34: Fairy Water
0x019681|$06:$9671:D0 0E   	BNE $9681  
; call to code in a different bank ($0F:$FA2E)
0x019683|$06:$9673:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019686|$06:$9676:2A	; String ID #$012A: [name] sprinkled the Fairy Water from head to toe.[end-FC]

; data -> code
0x019687|$06:$9677:A9 FF   	LDA #$FF   
0x019689|$06:$9679:85 46   	STA $46    	; Repel (#$FE) / Fairy Water (#$FF) flag
0x01968B|$06:$967B:20 1D 96	JSR $961D  	; given hero ID in $97 and hero inventory offset in $49, remove that item from hero's inventory and move all lower items up 1 slot
0x01968E|$06:$967E:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9671)
0x019691|$06:$9681:C9 28   	CMP #$28   	; Item ID #$28: Eye of Malroth
0x019693|$06:$9683:D0 4B   	BNE $96D0  
; call to code in a different bank ($0F:$FA2E)
0x019695|$06:$9685:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019698|$06:$9688:31	; String ID #$0131: [name] held high the Eye of Malroth.[end-FC]

; data -> code
0x019699|$06:$9689:A5 31   	LDA $31    	; current map ID
0x01969B|$06:$968B:C9 01   	CMP #$01   	; Map ID #$01: World Map
0x01969D|$06:$968D:D0 24   	BNE $96B3  	; if not World Map, go check Hagon's Castle 1F
0x01969F|$06:$968F:AD F9 05	LDA $05F9  	; flag for Cave to Rhone open
0x0196A2|$06:$9692:D0 35   	BNE $96C9  	; item useless here
0x0196A4|$06:$9694:A5 16   	LDA $16    	; current map X-pos (1)
0x0196A6|$06:$9696:C9 71   	CMP #$71   	; X-pos range for successful use: #$71 - #$76 inclusive
0x0196A8|$06:$9698:90 2F   	BCC $96C9  	; item useless here
0x0196AA|$06:$969A:C9 77   	CMP #$77   
0x0196AC|$06:$969C:B0 2B   	BCS $96C9  	; item useless here
0x0196AE|$06:$969E:A5 17   	LDA $17    	; current map Y-pos (1)
0x0196B0|$06:$96A0:C9 C6   	CMP #$C6   	; Y-pos range for successful use: #$C6 - #$C8 inclusive
0x0196B2|$06:$96A2:90 25   	BCC $96C9  	; item useless here
0x0196B4|$06:$96A4:C9 C9   	CMP #$C9   
0x0196B6|$06:$96A6:B0 21   	BCS $96C9  	; item useless here
; call to code in a different bank ($0F:$D0F5)
0x0196B8|$06:$96A8:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x0196BB|$06:$96AB:A2 3C   	LDX #$3C   
; call to code in a different bank ($0F:$C1EE)
0x0196BD|$06:$96AD:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; call to code in a different bank ($0F:$D23E)
0x0196C0|$06:$96B0:4C 3E D2	JMP $D23E  

; control flow target (from $968D)
0x0196C3|$06:$96B3:C9 16   	CMP #$16   	; Map ID #$16: Hargon's Castle 1F
0x0196C5|$06:$96B5:D0 12   	BNE $96C9  	; item useless here
; call to code in a different bank ($0F:$CD26)
0x0196C7|$06:$96B7: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
0x0196CA|$06:$96BA:0D
; indirect data load target
0x0196CB|$06:$96BB:04

; data -> code
0x0196CC|$06:$96BC:D0 0B   	BNE $96C9  	; item useless here
0x0196CE|$06:$96BE:A2 78   	LDX #$78   
; call to code in a different bank ($0F:$C1EE)
0x0196D0|$06:$96C0:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; call to code in a different bank ($0F:$C515)
0x0196D3|$06:$96C3:20 15 C5	JSR $C515  	; flash screen 10 times
; call to code in a different bank ($0F:$D7A6)
0x0196D6|$06:$96C6:4C A6 D7	JMP $D7A6  

; item useless here
; control flow target (from $9692, $9698, $969C, $96A2, $96A6, $96B5, $96BC)
; call to code in a different bank ($0F:$FA2E)
0x0196D9|$06:$96C9:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0196DC|$06:$96CC:27	; String ID #$0127: [wait]But nothing happened.[end-FC]

; data -> code
0x0196DD|$06:$96CD:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9683)
0x0196E0|$06:$96D0:C9 2B   	CMP #$2B   	; Item ID #$2B: Mirror of Ra
0x0196E2|$06:$96D2:D0 74   	BNE $9748  
0x0196E4|$06:$96D4:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x0196E7|$06:$96D7:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0196EA|$06:$96DA:36	; String ID #$0136: [name] held up the Mirror of Ra.[end-FC]

; data -> code
0x0196EB|$06:$96DB:A9 00   	LDA #$00   
0x0196ED|$06:$96DD:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
; control flow target (from $96F0)
0x0196EF|$06:$96DF:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
; call to code in a different bank ($0F:$CF70)
0x0196F1|$06:$96E1:20 70 CF	JSR $CF70  
0x0196F4|$06:$96E4:A5 0C   	LDA $0C    
0x0196F6|$06:$96E6:C9 02   	CMP #$02   	; Moonbrooke
0x0196F8|$06:$96E8:F0 0F   	BEQ $96F9  
0x0196FA|$06:$96EA:E6 96   	INC $96    	; temp storage for item/spell/type/etc. IDs
0x0196FC|$06:$96EC:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x0196FE|$06:$96EE:C9 04   	CMP #$04   
0x019700|$06:$96F0:D0 ED   	BNE $96DF  
; call to code in a different bank ($0F:$FA2E)
0x019702|$06:$96F2:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019705|$06:$96F5:27	; String ID #$0127: [wait]But nothing happened.[end-FC]

; data -> code
0x019706|$06:$96F6:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $96E8)
0x019709|$06:$96F9:A9 02   	LDA #$02   	; Moonbrooke; useless op
; call to code in a different bank ($0F:$FC50)
0x01970B|$06:$96FB:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01970E|$06:$96FE:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019711|$06:$9701:37	; String ID #$0137: [wait]Behold, the mirror reflected back the image of Princess [name].[wait][line]Suddenly it shattered and the enchantment was broken,[wait][line]freeing the princess from her furry form.[end-FC]

; data -> code
0x019712|$06:$9702:A5 97   	LDA $97    	; subject hero ID $97
0x019714|$06:$9704:A6 49   	LDX $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$C4D4)
0x019716|$06:$9706:20 D4 C4	JSR $C4D4  	; given hero ID in A and hero inventory offset in X, remove that item from hero's inventory and move all lower items up 1 slot
; call to code in a different bank ($0F:$D0F5)
0x019719|$06:$9709:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x01971C|$06:$970C:A2 28   	LDX #$28   
; call to code in a different bank ($0F:$C1EE)
0x01971E|$06:$970E:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x019721|$06:$9711:A9 00   	LDA #$00   
0x019723|$06:$9713:8D 4A 05	STA $054A  	; NPC #$01 scripted motion low byte
0x019726|$06:$9716:8D 4B 05	STA $054B  	; NPC #$01 scripted motion high byte
0x019729|$06:$9719:A9 09   	LDA #$09   
0x01972B|$06:$971B:A0 1F   	LDY #$1F   
; call to code in a different bank ($0F:$CD45)
0x01972D|$06:$971D:20 45 CD	JSR $CD45  
0x019730|$06:$9720:A9 02   	LDA #$02   
0x019732|$06:$9722:A0 1F   	LDY #$1F   
; call to code in a different bank ($0F:$CD4B)
0x019734|$06:$9724:20 4B CD	JSR $CD4B  
0x019737|$06:$9727:20 72 81	JSR $8172  
0x01973A|$06:$972A:A9 84   	LDA #$84   	; add Moonbrooke to party
0x01973C|$06:$972C:8D 51 06	STA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01973F|$06:$972F:A9 02   	LDA #$02   
0x019741|$06:$9731:8D 51 05	STA $0551  	; NPC #$02 sprite ID
; control flow target (from $81B6)
0x019744|$06:$9734:20 CB 9A	JSR $9ACB  	; open dialogue window
0x019747|$06:$9737:A9 02   	LDA #$02   	; Moonbrooke
; call to code in a different bank ($0F:$FC50)
0x019749|$06:$9739:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01974C|$06:$973C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01974F|$06:$973F:57	; String ID #$0157: ‘Oh, dear cousin, thou hast freed me beyond all hope[.’][wait][line]‘To repay this, I offer thee my loyalty and service as the Princess of Moonbrooke[.’][wait][line]‘Please, take me with thee on thy quest[.’][end-FC]

; data -> code
0x019750|$06:$9740:A9 07   	LDA #$07   	; Music ID #$07: add party member BGM
; call to code in a different bank ($0F:$C58D)
0x019752|$06:$9742:20 8D C5	JSR $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
0x019755|$06:$9745:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $96D2)
0x019758|$06:$9748:C9 2C   	CMP #$2C   	; Item ID #$2C: Dew’s Yarn
0x01975A|$06:$974A:F0 04   	BEQ $9750  
0x01975C|$06:$974C:C9 2D   	CMP #$2D   	; Item ID #$2D: Magic Loom
0x01975E|$06:$974E:D0 07   	BNE $9757  
; control flow target (from $974A)
; call to code in a different bank ($0F:$FA2E)
0x019760|$06:$9750:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019763|$06:$9753:38	; String ID #$0138: [name] tried to use the [item],[wait] but didn't know how.[end-FC]

; data -> code
0x019764|$06:$9754:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $974E)
0x019767|$06:$9757:C9 37   	CMP #$37   	; Item ID #$37: Golden Key
0x019769|$06:$9759:D0 04   	BNE $975F  
0x01976B|$06:$975B:A9 01   	LDA #$01   
0x01976D|$06:$975D:D0 14   	BNE $9773  
; control flow target (from $9759)
0x01976F|$06:$975F:C9 38   	CMP #$38   	; Item ID #$38: Silver Key
0x019771|$06:$9761:D0 04   	BNE $9767  
0x019773|$06:$9763:A9 00   	LDA #$00   
0x019775|$06:$9765:F0 0C   	BEQ $9773  
; control flow target (from $9761)
0x019777|$06:$9767:C9 39   	CMP #$39   	; Item ID #$39: Jailor’s Key
0x019779|$06:$9769:F0 06   	BEQ $9771  
0x01977B|$06:$976B:C9 3A   	CMP #$3A   	; Item ID #$3A: Watergate Key
0x01977D|$06:$976D:F0 1E   	BEQ $978D  	; check Watergate
0x01977F|$06:$976F:D0 78   	BNE $97E9  
; control flow target (from $9769)
0x019781|$06:$9771:A9 02   	LDA #$02   
; control flow target (from $975D, $9765)
0x019783|$06:$9773:85 C9   	STA $C9    
; call to code in a different bank ($0F:$CF7C)
0x019785|$06:$9775:20 7C CF	JSR $CF7C  
0x019788|$06:$9778:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x01978A|$06:$977A:D0 08   	BNE $9784  
0x01978C|$06:$977C:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x01978E|$06:$977E:C9 39   	CMP #$39   	; Item ID #$39: Jailor’s Key
0x019790|$06:$9780:F0 57   	BEQ $97D9  
0x019792|$06:$9782:D0 51   	BNE $97D5  
; control flow target (from $977A)
0x019794|$06:$9784:C9 01   	CMP #$01   
0x019796|$06:$9786:F0 59   	BEQ $97E1  	; wrong key for door
0x019798|$06:$9788:A9 58   	LDA #$58   	; String ID #$0158: The door opened.[end-FC]
0x01979A|$06:$978A:4C E3 97	JMP $97E3  

; check Watergate
; control flow target (from $976D)
0x01979D|$06:$978D:A5 31   	LDA $31    	; current map ID
0x01979F|$06:$978F:C9 12   	CMP #$12   	; Map ID #$12: Tuhn Watergate
0x0197A1|$06:$9791:D0 4A   	BNE $97DD  
; call to code in a different bank ($0F:$CD26)
0x0197A3|$06:$9793: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
0x0197A6|$06:$9796:02
; indirect data load target
0x0197A7|$06:$9797:04

; data -> code
0x0197A8|$06:$9798:D0 43   	BNE $97DD  
; call to code in a different bank ($0F:$FA2E)
0x0197AA|$06:$979A:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0197AD|$06:$979D:59	; String ID #$0159: The water gate opened.[end-FC]

; data -> code
; call to code in a different bank ($0F:$D0F5)
0x0197AE|$06:$979E:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x0197B1|$06:$97A1:A5 97   	LDA $97    	; subject hero ID $97
0x0197B3|$06:$97A3:85 9C   	STA $9C    
0x0197B5|$06:$97A5:A9 3A   	LDA #$3A   	; Item ID #$3A: Watergate Key
; call to code in a different bank ($0F:$C4B6)
0x0197B7|$06:$97A7:20 B6 C4	JSR $C4B6  	; 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
0x0197BA|$06:$97AA:A9 04   	LDA #$04   
0x0197BC|$06:$97AC: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?)
0x0197BE|$06:$97AE:A9 01   	LDA #$01   
0x0197C0|$06:$97B0:85 CE   	STA $CE    	; Tuhn Watergate open flag (#$00 = closed, #$01 = open)
0x0197C2|$06:$97B2:A9 00   	LDA #$00   
0x0197C4|$06:$97B4:85 18   	STA $18    
0x0197C6|$06:$97B6:A9 02   	LDA #$02   
0x0197C8|$06:$97B8:85 19   	STA $19    
; call to code in a different bank ($0F:$D256)
0x0197CA|$06:$97BA:20 56 D2	JSR $D256  
0x0197CD|$06:$97BD:A9 02   	LDA #$02   
0x0197CF|$06:$97BF:85 18   	STA $18    
; call to code in a different bank ($0F:$D256)
0x0197D1|$06:$97C1:20 56 D2	JSR $D256  
0x0197D4|$06:$97C4:A9 96   	LDA #$96   	; Music ID #$96: Watergate SFX
; call to code in a different bank ($0F:$C561)
0x0197D6|$06:$97C6:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x0197D9|$06:$97C9:A2 3C   	LDX #$3C   
; call to code in a different bank ($0F:$C1EE)
0x0197DB|$06:$97CB:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x0197DE|$06:$97CE:A9 32   	LDA #$32   
0x0197E0|$06:$97D0:85 41   	STA $41    
; call to code in a different bank ($0F:$E938)
0x0197E2|$06:$97D2:4C 38 E9	JMP $E938  

; control flow target (from $9782)
0x0197E5|$06:$97D5:A9 3B   	LDA #$3B   	; String ID #$013B: There is no door here.[end-FC]
0x0197E7|$06:$97D7:D0 0A   	BNE $97E3  
; control flow target (from $9780)
0x0197E9|$06:$97D9:A9 3C   	LDA #$3C   	; String ID #$013C: There is no prison here.[end-FC]
0x0197EB|$06:$97DB:D0 06   	BNE $97E3  
; control flow target (from $9791, $9798)
0x0197ED|$06:$97DD:A9 3D   	LDA #$3D   	; String ID #$013D: This is not the water gate.[end-FC]
0x0197EF|$06:$97DF:D0 02   	BNE $97E3  
; wrong key for door
; control flow target (from $9786)
0x0197F1|$06:$97E1:A9 3E   	LDA #$3E   	; String ID #$013E: The key wouldn't turn in the lock.[end-FC]
; control flow target (from $978A, $97D7, $97DB, $97DF)
; call to code in a different bank ($0F:$FA4E)
0x0197F3|$06:$97E3:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x0197F6|$06:$97E6:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $976F)
0x0197F9|$06:$97E9:C9 33   	CMP #$33   	; Item ID #$33: Lottery Ticket
0x0197FB|$06:$97EB:D0 07   	BNE $97F4  
; call to code in a different bank ($0F:$FA2E)
0x0197FD|$06:$97ED:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019800|$06:$97F0:40	; String ID #$0140: [name] eagerly handed over the lottery ticket.[end-FC]

; data -> code
0x019801|$06:$97F1:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $97EB)
0x019804|$06:$97F4:C9 3D   	CMP #$3D   	; Item ID #$3D: Wizard’s Ring
0x019806|$06:$97F6:D0 17   	BNE $980F  
; call to code in a different bank ($0F:$FA2E)
0x019808|$06:$97F8:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01980B|$06:$97FB:41	; String ID #$0141: [name] slipped on the Wizard's Ring and spoke a word of magic.[end-FC]

; data -> code
0x01980C|$06:$97FC:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F722)
0x01980E|$06:$97FE:20 22 F7	JSR $F722  	; 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
0x019811|$06:$9801:A5 99   	LDA $99    	; chance for Wizard's Ring to break
0x019813|$06:$9803:D0 07   	BNE $980C  
; call to code in a different bank ($0F:$FA2E)
0x019815|$06:$9805:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019818|$06:$9808:42	; String ID #$0142: [wait]The ring crumbled like clay into dust, losing all its power.[end-FC]

; data -> code
0x019819|$06:$9809:20 1D 96	JSR $961D  	; given hero ID in $97 and hero inventory offset in $49, remove that item from hero's inventory and move all lower items up 1 slot
; control flow target (from $9803)
0x01981C|$06:$980C:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $97F6)
0x01981F|$06:$980F:C9 31   	CMP #$31   	; Item ID #$31: Dragon’s Potion
0x019821|$06:$9811:D0 12   	BNE $9825  
; call to code in a different bank ($0F:$FA2E)
0x019823|$06:$9813:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019826|$06:$9816:43	; String ID #$0143: The beautiful voice can be heard from somewhere[..][..][wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$FA32)
0x019827|$06:$9817:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01982A|$06:$981A:87	; String ID #$0287: ‘Dost thou wish to save thy deeds in the Imperial Scrolls of Honor?’[FD][FD][end-FC]

; data -> code
0x01982B|$06:$981B:20 5D A3	JSR $A35D  	; save game handler
; call to code in a different bank ($0F:$FA2E)
0x01982E|$06:$981E:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019831|$06:$9821:47	; String ID #$0147: ‘I watch over my descendants[.’][end-FC]

; data -> code
0x019832|$06:$9822:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9811)
0x019835|$06:$9825:C9 3E   	CMP #$3E   	; Item ID #$3E: Perilous
0x019837|$06:$9827:D0 0B   	BNE $9834  
; external control flow target (from $0F:$F74D)
0x019839|$06:$9829:86 49   	STX $49    	; object hero/target/item/string ID $49
0x01983B|$06:$982B:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x01983D|$06:$982D:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x01983F|$06:$982F:48      	PHA        
0x019840|$06:$9830:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x019843|$06:$9833:68      	PLA        
; control flow target (from $9827)
0x019844|$06:$9834:C9 30   	CMP #$30   	; Item ID #$30: Dragon’s Bane
0x019846|$06:$9836:D0 06   	BNE $983E  
0x019848|$06:$9838:20 95 98	JSR $9895  	; USE Dragon's Bane
0x01984B|$06:$983B:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9836)
0x01984E|$06:$983E:C9 2F   	CMP #$2F   	; Item ID #$2F: Gremlin’s Tail
0x019850|$06:$9840:D0 06   	BNE $9848  
0x019852|$06:$9842:20 B0 98	JSR $98B0  	; USE Gremlin's Tail
0x019855|$06:$9845:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9840)
0x019858|$06:$9848:C9 26   	CMP #$26   	; Item ID #$26: Moon Fragment
0x01985A|$06:$984A:D0 06   	BNE $9852  
0x01985C|$06:$984C:20 CB 98	JSR $98CB  	; USE Moon Fragment
0x01985F|$06:$984F:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $984A)
0x019862|$06:$9852:C9 24   	CMP #$24   	; Item ID #$24: Token of Erdrick
0x019864|$06:$9854:D0 06   	BNE $985C  
0x019866|$06:$9856:20 08 99	JSR $9908  	; USE Token of Erdrick
0x019869|$06:$9859:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9854)
0x01986C|$06:$985C:C9 2E   	CMP #$2E   	; Item ID #$2E: Cloak of Wind
0x01986E|$06:$985E:D0 06   	BNE $9866  
0x019870|$06:$9860:20 14 99	JSR $9914  	; USE Cloak of Wind
0x019873|$06:$9863:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $985E)
0x019876|$06:$9866:C9 27   	CMP #$27   	; Item ID #$27: Charm of Rubiss
0x019878|$06:$9868:D0 06   	BNE $9870  
0x01987A|$06:$986A:20 2F 99	JSR $992F  	; USE Charm of Rubiss
0x01987D|$06:$986D:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9868)
0x019880|$06:$9870:C9 2A   	CMP #$2A   	; Item ID #$2A: Echoing Flute
0x019882|$06:$9872:D0 06   	BNE $987A  
0x019884|$06:$9874:20 63 99	JSR $9963  	; USE Echoing Flute
0x019887|$06:$9877:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9872)
0x01988A|$06:$987A:C9 36   	CMP #$36   	; Item ID #$36: [blank]
0x01988C|$06:$987C:D0 06   	BNE $9884  
0x01988E|$06:$987E:20 9C 99	JSR $999C  	; USE Golden Card
0x019891|$06:$9881:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $987C)
0x019894|$06:$9884:C9 32   	CMP #$32   	; Item ID #$32: Golden Card
0x019896|$06:$9886:D0 06   	BNE $988E  
0x019898|$06:$9888:20 9C 99	JSR $999C  	; USE Golden Card
0x01989B|$06:$988B:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9886)
; call to code in a different bank ($0F:$FA2E)
0x01989E|$06:$988E:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0198A1|$06:$9891:9E	; String ID #$019E: But nothing happened.[end-FC]

; data -> code
0x0198A2|$06:$9892:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; USE Dragon's Bane
; control flow target (from $9838)
0x0198A5|$06:$9895:09 40   	ORA #$40   	; check for equipped version
0x0198A7|$06:$9897:20 BA 8D	JSR $8DBA  	; given a hero ID in $97 and an item ID in A, SEC if hero has that item, CLC otherwise
0x0198AA|$06:$989A:B0 0E   	BCS $98AA  
0x0198AC|$06:$989C:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x0198AE|$06:$989E:20 0F 8B	JSR $8B0F  	; given hero ID in $97 and hero inventory index in X, return corresponding item ID in A and party inventory index in X
0x0198B1|$06:$98A1:09 40   	ORA #$40   	; equip it
0x0198B3|$06:$98A3:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x0198B6|$06:$98A6:A9 22   	LDA #$22   	; String ID #$0122: [name] put on the Dragon's Bane.[end-FC]
0x0198B8|$06:$98A8:D0 02   	BNE $98AC  
; control flow target (from $989A)
0x0198BA|$06:$98AA:A9 23   	LDA #$23   	; String ID #$0123: [name] has already put on the Dragon's Bane.[end-FC]
; control flow target (from $98A8)
; call to code in a different bank ($0F:$FA4E)
0x0198BC|$06:$98AC:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x0198BF|$06:$98AF:60      	RTS        

; USE Gremlin's Tail
; control flow target (from $9842)
0x0198C0|$06:$98B0:09 40   	ORA #$40   	; check for equipped version
0x0198C2|$06:$98B2:20 BA 8D	JSR $8DBA  	; given a hero ID in $97 and an item ID in A, SEC if hero has that item, CLC otherwise
0x0198C5|$06:$98B5:B0 0E   	BCS $98C5  
0x0198C7|$06:$98B7:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x0198C9|$06:$98B9:20 0F 8B	JSR $8B0F  	; given hero ID in $97 and hero inventory index in X, return corresponding item ID in A and party inventory index in X
0x0198CC|$06:$98BC:09 40   	ORA #$40   	; equip it
0x0198CE|$06:$98BE:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x0198D1|$06:$98C1:A9 24   	LDA #$24   	; String ID #$0124: [name] put on the Gremlin's Tail.[end-FC]
0x0198D3|$06:$98C3:D0 02   	BNE $98C7  
; control flow target (from $98B5)
0x0198D5|$06:$98C5:A9 25   	LDA #$25   	; String ID #$0125: [name] has already put on the Gremlin's Tail.[end-FC]
; control flow target (from $98C3)
; call to code in a different bank ($0F:$FA4E)
0x0198D7|$06:$98C7:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x0198DA|$06:$98CA:60      	RTS        

; USE Moon Fragment
; control flow target (from $984C)
; call to code in a different bank ($0F:$FA2E)
0x0198DB|$06:$98CB:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0198DE|$06:$98CE:26	; String ID #$0126: [name] held the Moon Fragment overhead.[end-FC]

; data -> code
0x0198DF|$06:$98CF:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x0198E1|$06:$98D1:30 2D   	BMI $9900  
0x0198E3|$06:$98D3: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)
0x0198E5|$06:$98D5:D0 29   	BNE $9900  
0x0198E7|$06:$98D7:AD F8 05	LDA $05F8  	; Sea Cave shoal status (#$00 = shoals up, others = shoals down)
0x0198EA|$06:$98DA:D0 24   	BNE $9900  
0x0198EC|$06:$98DC:A5 16   	LDA $16    	; current map X-pos (1)
0x0198EE|$06:$98DE:C9 B1   	CMP #$B1   	; X-range for effective use is #$B1-#$B9 inclusive
0x0198F0|$06:$98E0:90 1E   	BCC $9900  
0x0198F2|$06:$98E2:C9 BA   	CMP #$BA   
0x0198F4|$06:$98E4:B0 1A   	BCS $9900  
0x0198F6|$06:$98E6:A5 17   	LDA $17    	; current map Y-pos (1)
0x0198F8|$06:$98E8:C9 A2   	CMP #$A2   	; Y-range for effective use is #$A2-#$AC inclusive
0x0198FA|$06:$98EA:90 14   	BCC $9900  
0x0198FC|$06:$98EC:C9 AD   	CMP #$AD   
0x0198FE|$06:$98EE:B0 10   	BCS $9900  
; call to code in a different bank ($0F:$D0F5)
0x019900|$06:$98F0:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x019903|$06:$98F3:A2 3C   	LDX #$3C   
; call to code in a different bank ($0F:$C1EE)
0x019905|$06:$98F5:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x019908|$06:$98F8:A9 01   	LDA #$01   
0x01990A|$06:$98FA:8D F8 05	STA $05F8  	; Sea Cave shoal status (#$00 = shoals up, others = shoals down)
; call to code in a different bank ($0F:$D218)
0x01990D|$06:$98FD:4C 18 D2	JMP $D218  	; open path to Sea Cave

; control flow target (from $98D1, $98D5, $98DA, $98E0, $98E4, $98EA, $98EE)
; call to code in a different bank ($0F:$F73D)
0x019910|$06:$9900:20 3D F7	JSR $F73D  	; calls $04:$99E6
; call to code in a different bank ($0F:$FA2E)
0x019913|$06:$9903:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019916|$06:$9906:27	; String ID #$0127: [wait]But nothing happened.[end-FC]

; data -> code
0x019917|$06:$9907:60      	RTS        

; USE Token of Erdrick
; control flow target (from $9856)
; call to code in a different bank ($0F:$FA2E)
0x019918|$06:$9908:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
0x01991B|$06:$990B:28	; String ID #$0128: [name] gripped Token of Erdrick.[wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$F73D)
0x01991C|$06:$990C:20 3D F7	JSR $F73D  	; calls $04:$99E6
; call to code in a different bank ($0F:$FA2E)
0x01991F|$06:$990F:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
0x019922|$06:$9912:53	; String ID #$0153: Thy courage soared![end-FC]

; data -> code
0x019923|$06:$9913:60      	RTS        

; USE Cloak of Wind
; control flow target (from $9860)
0x019924|$06:$9914:09 40   	ORA #$40   	; check for equipped version
0x019926|$06:$9916:20 BA 8D	JSR $8DBA  	; given a hero ID in $97 and an item ID in A, SEC if hero has that item, CLC otherwise
0x019929|$06:$9919:B0 0E   	BCS $9929  
0x01992B|$06:$991B:A6 49   	LDX $49    	; object hero/target/item/string ID $49
0x01992D|$06:$991D:20 0F 8B	JSR $8B0F  	; given hero ID in $97 and hero inventory index in X, return corresponding item ID in A and party inventory index in X
0x019930|$06:$9920:09 40   	ORA #$40   	; equip it
0x019932|$06:$9922:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x019935|$06:$9925:A9 2C   	LDA #$2C   	; String ID #$012C: [name] donned the Cloak of Wind.[end-FC]
0x019937|$06:$9927:D0 02   	BNE $992B  
; control flow target (from $9919)
0x019939|$06:$9929:A9 2D   	LDA #$2D   	; String ID #$012D: Remember, [name] has already put on the Cloak of Wind.[end-FC]
; control flow target (from $9927)
; call to code in a different bank ($0F:$FA4E)
0x01993B|$06:$992B:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x01993E|$06:$992E:60      	RTS        

; USE Charm of Rubiss
; control flow target (from $986A)
; call to code in a different bank ($0F:$FA2E)
0x01993F|$06:$992F:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019942|$06:$9932:2E	; String ID #$012E: With one hand, [name] held aloft the Charm of Rubiss.[wait][end-FC]

; data -> code
0x019943|$06:$9933:A5 8E   	LDA $8E    	; flag for in battle or not (#$FF)?
0x019945|$06:$9935:30 24   	BMI $995B  
0x019947|$06:$9937:A5 31   	LDA $31    	; current map ID
; Map ID #$00: Fake Midenhall
0x019949|$06:$9939:D0 20   	BNE $995B  
; call to code in a different bank ($0F:$FA2E)
0x01994B|$06:$993B:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01994E|$06:$993E:30	; String ID #$0130: [name] could hear a voice drawing near.[wait][line]‘[name]! Be not deceived by false visions[.’][end-FC]

; data -> code
0x01994F|$06:$993F:A2 78   	LDX #$78   
; call to code in a different bank ($0F:$C1EE)
0x019951|$06:$9941:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; call to code in a different bank ($0F:$C515)
0x019954|$06:$9944:20 15 C5	JSR $C515  	; flash screen 10 times
; call to code in a different bank ($0F:$C515)
0x019957|$06:$9947:20 15 C5	JSR $C515  	; flash screen 10 times
0x01995A|$06:$994A:68      	PLA        
0x01995B|$06:$994B:68      	PLA        
0x01995C|$06:$994C:AD 59 99	LDA $9959  
0x01995F|$06:$994F:85 0C   	STA $0C    
0x019961|$06:$9951:AD 5A 99	LDA $995A  
0x019964|$06:$9954:85 0D   	STA $0D    
; call to code in a different bank ($0F:$D81C)
0x019966|$06:$9956:4C 1C D8	JMP $D81C  


; code -> data
; data load target (from $994C)
0x019969|$06:$9959:85
; data load target (from $9951)
0x01996A|$06:$995A:   BD	; $03:$BD85

; data -> code
; control flow target (from $9935, $9939)
; call to code in a different bank ($0F:$F73D)
0x01996B|$06:$995B:20 3D F7	JSR $F73D  	; calls $04:$99E6
; call to code in a different bank ($0F:$FA2E)
0x01996E|$06:$995E:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019971|$06:$9961:2F	; String ID #$012F: And yet nothing happened.[end-FC]

; data -> code
0x019972|$06:$9962:60      	RTS        

; USE Echoing Flute
; control flow target (from $9874)
; call to code in a different bank ($0F:$FA2E)
0x019973|$06:$9963:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019976|$06:$9966:35	; String ID #$0135: Briefly, [name] played the Echoing Flute.[end-FC]

; data -> code
0x019977|$06:$9967:A0 00   	LDY #$00   
0x019979|$06:$9969:A5 31   	LDA $31    	; current map ID
; control flow target (from $9986)
0x01997B|$06:$996B:D9 8D 99	CMP $998D,Y	; minimum map ID (inclusive)
0x01997E|$06:$996E:90 11   	BCC $9981  	; wrong map
0x019980|$06:$9970:D9 8E 99	CMP $998E,Y	; maximum map ID (exclusive)
0x019983|$06:$9973:B0 0C   	BCS $9981  	; wrong map
0x019985|$06:$9975:B9 8F 99	LDA $998F,Y	; Crest in this map
0x019988|$06:$9978:2D 12 01	AND $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x01998B|$06:$997B:D0 0B   	BNE $9988  	; flute does not echo
0x01998D|$06:$997D:A9 03   	LDA #$03   	; Music ID #$03: Echoing Flute echoing BGM
0x01998F|$06:$997F:D0 09   	BNE $998A  	; flute echoes!
; wrong map
; control flow target (from $996E, $9973)
0x019991|$06:$9981:C8      	INY        
0x019992|$06:$9982:C8      	INY        
0x019993|$06:$9983:C8      	INY        
0x019994|$06:$9984:C0 0F   	CPY #$0F   	; 3 bytes per crest * 5 crests = #$0F
0x019996|$06:$9986:D0 E3   	BNE $996B  	; if more maps to check, check them
; flute does not echo
; control flow target (from $997B)
0x019998|$06:$9988:A9 04   	LDA #$04   	; Music ID #$04: Echoing Flute not echoing BGM
; control flow target (from $997F)
; call to code in a different bank ($0F:$C58D)
0x01999A|$06:$998A:4C 8D C5	JMP $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM


; code -> data
; minimum map ID (inclusive)
; indexed data load target (from $996B)
0x01999D|$06:$998D:08
; maximum map ID (exclusive)
; indexed data load target (from $9970)
0x01999E|$06:$998E:   09
; Crest in this map
; indexed data load target (from $9975)
0x01999F|$06:$998F:      08	; Map ID #$08: Hamlin Waterway
0x0199A0|$06:$9990:0F 10 04	; Map ID #$0F: Osterfair
0x0199A3|$06:$9993:1E 1F 01	; Map ID #$1E: Shrine NW of Zahan
0x0199A6|$06:$9996:50 58 02	; Map IDs #$50 - #$57: Lighthouse
0x0199A9|$06:$9999:37 40 10	; Map IDs #$37 - #$3F: Cave to Rhone

; data -> code
; USE Golden Card
; control flow target (from $987E, $9888)
; call to code in a different bank ($0F:$FA2E)
0x0199AC|$06:$999C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0199AF|$06:$999F:3F	; String ID #$013F: [name] took the Golden Card.[wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$F73D)
0x0199B0|$06:$99A0:20 3D F7	JSR $F73D  	; calls $04:$99E6
; call to code in a different bank ($0F:$FA2E)
0x0199B3|$06:$99A3:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0199B6|$06:$99A6:54	; String ID #$0154: Thou art happy indeed.[end-FC]

; data -> code
0x0199B7|$06:$99A7:60      	RTS        

; TRADE/THROW handler
; control flow target (from $9590)
0x0199B8|$06:$99A8:C9 01   	CMP #$01   	; TRADE; useless op
0x0199BA|$06:$99AA:F0 03   	BEQ $99AF  	; TRADE handler
0x0199BC|$06:$99AC:4C 84 9A	JMP $9A84  	; THROW command handler

; TRADE handler
; control flow target (from $99AA)
; call to code in a different bank ($0F:$F6CE)
0x0199BF|$06:$99AF:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x0199C2|$06:$99B2:D0 0D   	BNE $99C1  	; determine target hero
0x0199C4|$06:$99B4:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0199C7|$06:$99B7:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x0199CA|$06:$99BA:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0199CD|$06:$99BD:19	; String ID #$0119: [name] has no companion with which to exchange tools.[end-FC]

; data -> code
0x0199CE|$06:$99BE:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; determine target hero
; control flow target (from $99B2)
; call to code in a different bank ($0F:$F587)
0x0199D1|$06:$99C1:20 87 F5	JSR $F587  	; display appropriate main ITEM target menu
0x0199D4|$06:$99C4:C9 FF   	CMP #$FF   
0x0199D6|$06:$99C6:D0 03   	BNE $99CB  
0x0199D8|$06:$99C8:4C 42 95	JMP $9542  	; exit COMMAND menu

; control flow target (from $99C6)
0x0199DB|$06:$99CB:85 C9   	STA $C9    	; target hero ID
0x0199DD|$06:$99CD:20 CB 9A	JSR $9ACB  	; open dialogue window
0x0199E0|$06:$99D0:20 FC 9A	JSR $9AFC  	; given hero ID in $97 and hero inventory index in $49, set Z if item is equipped and cursed, clear if not
0x0199E3|$06:$99D3:D0 03   	BNE $99D8  	; item can be traded
0x0199E5|$06:$99D5:4C C4 9A	JMP $9AC4  	; item is equipped and cursed

; item can be traded
; control flow target (from $99D3)
0x0199E8|$06:$99D8:A5 97   	LDA $97    	; subject hero ID $97
0x0199EA|$06:$99DA:C5 C9   	CMP $C9    	; target hero ID
0x0199EC|$06:$99DC:D0 22   	BNE $9A00  	; give to different hero
0x0199EE|$06:$99DE:A9 80   	LDA #$80   	; Alive
0x0199F0|$06:$99E0:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x0199F3|$06:$99E3:90 0A   	BCC $99EF  	; ghost giving to itself
0x0199F5|$06:$99E5:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x0199F8|$06:$99E8:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x0199FB|$06:$99EB:1C	; String ID #$011C: [name] started to give it, but held on to it instead.[end-FC]

; data -> code
0x0199FC|$06:$99EC:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; ghost giving to itself
; control flow target (from $99E3)
0x0199FF|$06:$99EF:20 EB 9A	JSR $9AEB  	; using name of first living hero, display String ID #$0120: [name] [end-FF]
0x019A02|$06:$99F2:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019A05|$06:$99F5:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A08|$06:$99F8:A1	; String ID #$01A1: took the [item] from the ghost of [name] and [end-FF]

; data -> code
; call to code in a different bank ($0F:$FA2E)
0x019A09|$06:$99F9:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A0C|$06:$99FC:A3	; String ID #$01A3: gave it back to the ghost of [name].[end-FC]

; data -> code
0x019A0D|$06:$99FD:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; give to different hero
; control flow target (from $99DC)
0x019A10|$06:$9A00:A5 97   	LDA $97    	; subject hero ID $97
0x019A12|$06:$9A02:48      	PHA        	; item owner hero ID
0x019A13|$06:$9A03:A5 C9   	LDA $C9    	; target hero ID
0x019A15|$06:$9A05:85 97   	STA $97    	; subject hero ID $97
0x019A17|$06:$9A07:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x019A1A|$06:$9A0A:B0 0B   	BCS $9A17  	; item given to target hero
0x019A1C|$06:$9A0C:68      	PLA        	; item owner hero ID
0x019A1D|$06:$9A0D:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019A20|$06:$9A10:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A23|$06:$9A13:1B	; String ID #$011B: [name] cannot carry more items.[end-FC]

; data -> code
0x019A24|$06:$9A14:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; item given to target hero
; control flow target (from $9A0A)
0x019A27|$06:$9A17:68      	PLA        	; item owner hero ID
0x019A28|$06:$9A18:85 97   	STA $97    	; subject hero ID $97
0x019A2A|$06:$9A1A:A6 49   	LDX $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$C4D4)
0x019A2C|$06:$9A1C:20 D4 C4	JSR $C4D4  	; given hero ID in A and hero inventory offset in X, remove that item from hero's inventory and move all lower items up 1 slot
0x019A2F|$06:$9A1F:A9 80   	LDA #$80   	; Alive
0x019A31|$06:$9A21:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019A34|$06:$9A24:90 21   	BCC $9A47  	; owner is a ghost
0x019A36|$06:$9A26:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019A39|$06:$9A29:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A3C|$06:$9A2C:20	; String ID #$0120: [name] [end-FF]

; data -> code
0x019A3D|$06:$9A2D:A5 C9   	LDA $C9    	; target hero ID
0x019A3F|$06:$9A2F:85 97   	STA $97    	; subject hero ID $97
0x019A41|$06:$9A31:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x019A44|$06:$9A34:A9 80   	LDA #$80   	; Alive
0x019A46|$06:$9A36:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019A49|$06:$9A39:90 04   	BCC $9A3F  	; target is a ghost
0x019A4B|$06:$9A3B:A9 1A   	LDA #$1A   	; String ID #$011A: handed the [item] to [name].[end-FC]
0x019A4D|$06:$9A3D:D0 02   	BNE $9A41  	; target is alive
; target is a ghost
; control flow target (from $9A39)
0x019A4F|$06:$9A3F:A9 17   	LDA #$17   	; String ID #$0117: gave the [item] to the ghost of [name].[end-FC]
; target is alive
; control flow target (from $9A3D)
; call to code in a different bank ($0F:$FA4E)
0x019A51|$06:$9A41:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x019A54|$06:$9A44:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; owner is a ghost
; control flow target (from $9A24)
0x019A57|$06:$9A47:A5 97   	LDA $97    	; subject hero ID $97
0x019A59|$06:$9A49:48      	PHA        	; item owner hero ID
0x019A5A|$06:$9A4A:A5 C9   	LDA $C9    	; target hero ID
0x019A5C|$06:$9A4C:85 97   	STA $97    	; subject hero ID $97
0x019A5E|$06:$9A4E:A9 80   	LDA #$80   	; Alive
0x019A60|$06:$9A50:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019A63|$06:$9A53:90 14   	BCC $9A69  	; target is a ghost
0x019A65|$06:$9A55:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x019A68|$06:$9A58:68      	PLA        	; item owner hero ID
0x019A69|$06:$9A59:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$FA2E)
0x019A6B|$06:$9A5B:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A6E|$06:$9A5E:20	; String ID #$0120: [name] [end-FF]

; data -> code
0x019A6F|$06:$9A5F:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019A72|$06:$9A62:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A75|$06:$9A65:18	; String ID #$0118: took the [item] from [name].[end-FC]

; data -> code
0x019A76|$06:$9A66:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; target is a ghost
; control flow target (from $9A53)
0x019A79|$06:$9A69:20 EB 9A	JSR $9AEB  	; using name of first living hero, display String ID #$0120: [name] [end-FF]
0x019A7C|$06:$9A6C:68      	PLA        	; item owner hero ID
0x019A7D|$06:$9A6D:85 97   	STA $97    	; subject hero ID $97
0x019A7F|$06:$9A6F:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019A82|$06:$9A72:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A85|$06:$9A75:A1	; String ID #$01A1: took the [item] from the ghost of [name] and [end-FF]

; data -> code
0x019A86|$06:$9A76:A5 C9   	LDA $C9    	; target hero ID
0x019A88|$06:$9A78:85 97   	STA $97    	; subject hero ID $97
0x019A8A|$06:$9A7A:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019A8D|$06:$9A7D:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019A90|$06:$9A80:A2	; String ID #$01A2: gave it to ghost of [name].[end-FC]

; data -> code
0x019A91|$06:$9A81:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; THROW command handler
; control flow target (from $99AC)
0x019A94|$06:$9A84:20 CB 9A	JSR $9ACB  	; open dialogue window
0x019A97|$06:$9A87:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x019A99|$06:$9A89:0A      	ASL        	; item prices are 2 bytes each
0x019A9A|$06:$9A8A:A8      	TAY        
0x019A9B|$06:$9A8B:B9 FC 9F	LDA $9FFC,Y	; Item Prices, low byte
0x019A9E|$06:$9A8E:19 FD 9F	ORA $9FFD,Y	; Item Prices, high byte
0x019AA1|$06:$9A91:F0 2A   	BEQ $9ABD  	; 0 G items are key items
0x019AA3|$06:$9A93:20 FC 9A	JSR $9AFC  	; given hero ID in $97 and hero inventory index in $49, set Z if item is equipped and cursed, clear if not
0x019AA6|$06:$9A96:F0 2C   	BEQ $9AC4  	; item is equipped and cursed
0x019AA8|$06:$9A98:A9 80   	LDA #$80   	; Alive
0x019AAA|$06:$9A9A:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019AAD|$06:$9A9D:90 0A   	BCC $9AA9  	; owner is a ghost
0x019AAF|$06:$9A9F:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019AB2|$06:$9AA2:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019AB5|$06:$9AA5:14	; String ID #$0114: [name] threw away the [item].[end-FC]

; data -> code
0x019AB6|$06:$9AA6:4C B3 9A	JMP $9AB3  

; owner is a ghost
; control flow target (from $9A9D)
0x019AB9|$06:$9AA9:20 EB 9A	JSR $9AEB  	; using name of first living hero, display String ID #$0120: [name] [end-FF]
0x019ABC|$06:$9AAC:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019ABF|$06:$9AAF:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019AC2|$06:$9AB2:16	; String ID #$0116: took the [item] from [name] and threw it away.[end-FC]

; data -> code
; control flow target (from $9AA6)
0x019AC3|$06:$9AB3:A5 97   	LDA $97    	; subject hero ID $97
0x019AC5|$06:$9AB5:A6 49   	LDX $49    	; object hero/target/item/string ID $49
; call to code in a different bank ($0F:$C4D4)
0x019AC7|$06:$9AB7:20 D4 C4	JSR $C4D4  	; given hero ID in A and hero inventory offset in X, remove that item from hero's inventory and move all lower items up 1 slot
0x019ACA|$06:$9ABA:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; 0 G items are key items
; control flow target (from $9A91)
; call to code in a different bank ($0F:$FA2E)
0x019ACD|$06:$9ABD:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019AD0|$06:$9AC0:0E	; String ID #$010E: Thou should not throw that away.[end-FC]

; data -> code
0x019AD1|$06:$9AC1:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; item is equipped and cursed
; control flow target (from $99D5, $9A96)
; call to code in a different bank ($0F:$FA2E)
0x019AD4|$06:$9AC4:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019AD7|$06:$9AC7:12	; String ID #$0112: It cannot be removed due to the curse.[end-FC]

; data -> code
0x019AD8|$06:$9AC8:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; open dialogue window
; control flow target (from $80CE, $80FA, $8160, $81BD, $8AB0, $8AD6, $8AF2, $8B46, $8B5C, $8BB3, $8E0C, $8E4C, $8E6B, $8F3F, $8F4E, $91C6, $91E3, $94B4, $94C6, $94E5, $956F, $959A, $95BD, $9637, $964F, $9734, $99B4, $99CD, $9A84)
; call to code in a different bank ($0F:$EB76)
0x019ADB|$06:$9ACB:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x019ADE|$06:$9ACE:04	; Menu ID #$04: Dialogue window

; data -> code
0x019ADF|$06:$9ACF:60      	RTS        

; open YES/NO menu, return selected option in A
; control flow target (from $8236, $82C7, $832B, $8360, $83BD, $83D9, $8443, $8506, $8518, $856E, $8681, $86C4, $86EE, $8E54, $8FB5, $902C, $911B, $91AC, $9217, $92EB, $934C, $9388, $94CE, $94FF, $9CAE)
; call to code in a different bank ($0F:$EB76)
0x019AE0|$06:$9AD0:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x019AE3|$06:$9AD3:19	; Menu ID #$19: General menu: YES/NO

; data -> code
0x019AE4|$06:$9AD4:60      	RTS        

; set A/$97 to ID of first living hero
; control flow target (from $8ECD, $8F23, $8F51, $8F9B, $8FCC, $9122, $917B, $91F4, $93E5, $9400, $9AEE, $9B1B)
0x019AE5|$06:$9AD5:A9 00   	LDA #$00   	; start with Midenhall
0x019AE7|$06:$9AD7:85 97   	STA $97    	; subject hero ID $97
; control flow target (from $9AE6)
0x019AE9|$06:$9AD9:A9 80   	LDA #$80   	; Alive
0x019AEB|$06:$9ADB:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019AEE|$06:$9ADE:B0 08   	BCS $9AE8  	; if hero alive, then we're done
0x019AF0|$06:$9AE0:E6 97   	INC $97    	; subject hero ID $97
0x019AF2|$06:$9AE2:A5 97   	LDA $97    	; subject hero ID $97
0x019AF4|$06:$9AE4:C9 03   	CMP #$03   	; only 3 heroes
0x019AF6|$06:$9AE6:D0 F1   	BNE $9AD9  	; loop if more heroes to check
; control flow target (from $9ADE)
0x019AF8|$06:$9AE8:A5 97   	LDA $97    	; subject hero ID $97
0x019AFA|$06:$9AEA:60      	RTS        

; using name of first living hero, display String ID #$0120: [name] [end-FF]
; control flow target (from $99EF, $9A69, $9AA9, $9D2A)
0x019AFB|$06:$9AEB:A5 97   	LDA $97    	; subject hero ID $97; save $97 to stack since $9AD5 will overwrite it
0x019AFD|$06:$9AED:48      	PHA        
0x019AFE|$06:$9AEE:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x019B01|$06:$9AF1:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019B04|$06:$9AF4:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019B07|$06:$9AF7:20	; String ID #$0120: [name] [end-FF]

; data -> code
0x019B08|$06:$9AF8:68      	PLA        	; restore $97 from stack
0x019B09|$06:$9AF9:85 97   	STA $97    	; subject hero ID $97
0x019B0B|$06:$9AFB:60      	RTS        

; given hero ID in $97 and hero inventory index in $49, set Z if item is equipped and cursed, clear if not
; control flow target (from $9153, $99D0, $9A93, $9CF4)
0x019B0C|$06:$9AFC:A5 97   	LDA $97    	; subject hero ID $97
0x019B0E|$06:$9AFE:0A      	ASL        	; inventory is 8 items per hero
0x019B0F|$06:$9AFF:0A      	ASL        
0x019B10|$06:$9B00:0A      	ASL        
0x019B11|$06:$9B01:18      	CLC        
0x019B12|$06:$9B02:65 49   	ADC $49    	; object hero/target/item/string ID $49
0x019B14|$06:$9B04:AA      	TAX        
0x019B15|$06:$9B05:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x019B18|$06:$9B08:C9 4C   	CMP #$4C   	; Item ID #$4C: Sword of Destruction (equipped)
0x019B1A|$06:$9B0A:F0 0A   	BEQ $9B16  
0x019B1C|$06:$9B0C:C9 57   	CMP #$57   	; Item ID #$57: Gremlin’s Armor (equipped)
0x019B1E|$06:$9B0E:F0 06   	BEQ $9B16  
0x019B20|$06:$9B10:C9 5F   	CMP #$5F   	; Item ID #$5F: Evil Shield (equipped)
0x019B22|$06:$9B12:F0 02   	BEQ $9B16  
0x019B24|$06:$9B14:C9 6F   	CMP #$6F   	; Item ID #$6F: Gremlin’s Tail (equipped)
; control flow target (from $9B0A, $9B0E, $9B12)
0x019B26|$06:$9B16:60      	RTS        

; COMMAND menu SEARCH handler
; indirect control flow target (via $808E)
; call to code in a different bank ($0F:$EB76)
0x019B27|$06:$9B17:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x019B2A|$06:$9B1A:04	; Menu ID #$04: Dialogue window

; data -> code
0x019B2B|$06:$9B1B:20 D5 9A	JSR $9AD5  	; set A/$97 to ID of first living hero
0x019B2E|$06:$9B1E:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
0x019B31|$06:$9B21:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x019B33|$06:$9B23:29 04   	AND #$04   	; pick out the "on ship" bit
0x019B35|$06:$9B25:F0 04   	BEQ $9B2B  	; branch if you're not on the ship
0x019B37|$06:$9B27:A9 07   	LDA #$07   	; String ID #$0107: [name] dove overboard into the sea.[wait][end-FC]
0x019B39|$06:$9B29:D0 02   	BNE $9B2D  
; control flow target (from $9B25)
0x019B3B|$06:$9B2B:A9 03   	LDA #$03   	; String ID #$0103: [name] searched all about.[wait][end-FC]
; control flow target (from $9B29)
; call to code in a different bank ($0F:$FA4E)
0x019B3D|$06:$9B2D:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
; call to code in a different bank ($0F:$D095)
0x019B40|$06:$9B30:20 95 D0	JSR $D095  
0x019B43|$06:$9B33:90 10   	BCC $9B45  
0x019B45|$06:$9B35:AD 2A 9E	LDA $9E2A  	; -> $06:$9E2E: Treasure List 1 (map ID, X-pos, Y-pos, item ID)
0x019B48|$06:$9B38:85 0C   	STA $0C    
0x019B4A|$06:$9B3A:AD 2B 9E	LDA $9E2B  
0x019B4D|$06:$9B3D:85 0D   	STA $0D    
0x019B4F|$06:$9B3F:20 58 9D	JSR $9D58  	; scan treasure list at ($0C), returning in A/$95/$96 the item ID corresponding to party's current map ID/position or #$00 if there is no item or you're not allowed to get it
0x019B52|$06:$9B42:4C 84 9B	JMP $9B84  

; control flow target (from $9B33)
0x019B55|$06:$9B45:A5 31   	LDA $31    	; current map ID
0x019B57|$06:$9B47:C9 68   	CMP #$68   	; Map ID #$68: Dragon Horn North 3F
0x019B59|$06:$9B49:D0 1E   	BNE $9B69  
0x019B5B|$06:$9B4B:A9 2C   	LDA #$2C   	; Item ID #$2C: Dew’s Yarn
0x019B5D|$06:$9B4D:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019B5F|$06:$9B4F:85 95   	STA $95    	; ID for [item] and [spell] control codes; item ID
0x019B61|$06:$9B51: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
0x019B64|$06:$9B54:10 27   	BPL $9B7D  	; search failed
0x019B66|$06:$9B56:A9 13   	LDA #$13   	; Item ID #$13: Water Flying Cloth
0x019B68|$06:$9B58:20 60 A3	JSR $A360  	; check for item A (possibly equipped) in party inventory, returning inventory index of item in A/X if found, #$FF if not
0x019B6B|$06:$9B5B:10 20   	BPL $9B7D  	; search failed
; call to code in a different bank ($0F:$C3AB)
0x019B6D|$06:$9B5D:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x019B70|$06:$9B60:A5 32   	LDA $32    	; RNG byte 0
0x019B72|$06:$9B62:29 03   	AND #$03   	; 1/4 chance to find item
0x019B74|$06:$9B64:D0 17   	BNE $9B7D  	; search failed
0x019B76|$06:$9B66:4C 05 9C	JMP $9C05  

; control flow target (from $9B49)
0x019B79|$06:$9B69:AD 2C 9E	LDA $9E2C  	; -> $06:$9F07: Treasure List 2 (map ID, X-pos, Y-pos, item ID)
0x019B7C|$06:$9B6C:85 0C   	STA $0C    
0x019B7E|$06:$9B6E:AD 2D 9E	LDA $9E2D  
0x019B81|$06:$9B71:85 0D   	STA $0D    
0x019B83|$06:$9B73:20 58 9D	JSR $9D58  	; scan treasure list at ($0C), returning in A/$95/$96 the item ID corresponding to party's current map ID/position or #$00 if there is no item or you're not allowed to get it
0x019B86|$06:$9B76:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; useless op; $96 is already in A
0x019B88|$06:$9B78:F0 03   	BEQ $9B7D  	; search failed
0x019B8A|$06:$9B7A:4C 05 9C	JMP $9C05  

; search failed
; control flow target (from $9B54, $9B5B, $9B64, $9B78)
; call to code in a different bank ($0F:$FA2E)
0x019B8D|$06:$9B7D:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019B90|$06:$9B80:06	; String ID #$0106: But [name] found nothing.[end-FC]

; data -> code
0x019B91|$06:$9B81:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9B42)
0x019B94|$06:$9B84:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; useless op; $96 is already in A
0x019B96|$06:$9B86:C9 FF   	CMP #$FF   	; Item ID #$FF: Trap!
0x019B98|$06:$9B88:F0 1C   	BEQ $9BA6  	; if Midenhall is equipped with the Armour of Erdrick, chest is empty, otherwise it's a trap with 50/50 chance for the party leader losing half their current HP or getting poisoned
; call to code in a different bank ($0F:$FA2E)
0x019B9A|$06:$9B8A:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019B9D|$06:$9B8D:05	; String ID #$0105: Seeing a treasure chest, [name] opened it.[wait][end-FC]

; data -> code
0x019B9E|$06:$9B8E:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019BA0|$06:$9B90:D0 73   	BNE $9C05  	; Item ID #$00: (no item)
; call to code in a different bank ($0F:$FA2E)
0x019BA2|$06:$9B92:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019BA5|$06:$9B95:4B	; String ID #$014B: But it was empty.[end-FC]

; data -> code
0x019BA6|$06:$9B96:A5 31   	LDA $31    	; current map ID
0x019BA8|$06:$9B98:C9 51   	CMP #$51   	; Map ID #$51: Lighthouse 2F
0x019BAA|$06:$9B9A:D0 07   	BNE $9BA3  
0x019BAC|$06:$9B9C:A5 D0   	LDA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x019BAE|$06:$9B9E:30 03   	BMI $9BA3  
; call to code in a different bank ($0F:$CC0A)
0x019BB0|$06:$9BA0:4C 0A CC	JMP $CC0A  	; trigger Stars Crest battle

; control flow target (from $9B9A, $9B9E)
0x019BB3|$06:$9BA3:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; if Midenhall is equipped with the Armour of Erdrick, chest is empty, otherwise it's a trap with 50/50 chance for the party leader losing half their current HP or getting poisoned
; control flow target (from $9B88)
0x019BB6|$06:$9BA6:A9 5B   	LDA #$5B   	; Item ID #$5B: Armor of Erdrick (equipped)
0x019BB8|$06:$9BA8: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
0x019BBB|$06:$9BAB:C9 08   	CMP #$08   	; only Midenhall can equip the Armour of Erdrick, so inventory index >= #$08 means he does not have it equipped
0x019BBD|$06:$9BAD:B0 0B   	BCS $9BBA  	; if you don't have it or it isn't equipped, the treasure chest is a trap :(
; call to code in a different bank ($0F:$FA2E)
0x019BBF|$06:$9BAF:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019BC2|$06:$9BB2:05	; String ID #$0105: Seeing a treasure chest, [name] opened it.[wait][end-FC]

; data -> code
; call to code in a different bank ($0F:$FA2E)
0x019BC3|$06:$9BB3:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019BC6|$06:$9BB6:4B	; String ID #$014B: But it was empty.[end-FC]

; data -> code
0x019BC7|$06:$9BB7:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9BAD)
; call to code in a different bank ($0F:$FA2E)
0x019BCA|$06:$9BBA:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019BCD|$06:$9BBD:4C	; String ID #$014C: The treasure chest was a trap![end-FC]

; data -> code
; call to code in a different bank ($0F:$C3AB)
0x019BCE|$06:$9BBE:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x019BD1|$06:$9BC1:A5 32   	LDA $32    	; RNG byte 0
0x019BD3|$06:$9BC3:30 2D   	BMI $9BF2  	; 50% chance to branch and get poisoned or not branch and lose half your current HP
0x019BD5|$06:$9BC5:20 4F 9D	JSR $9D4F  	; given hero ID in $97, set A to the offset of that hero's data in $062D
0x019BD8|$06:$9BC8:18      	CLC        
0x019BD9|$06:$9BC9:69 0E   	ADC #$0E   	; offset for hero's current HP, low byte
0x019BDB|$06:$9BCB:AA      	TAX        
0x019BDC|$06:$9BCC:BD 2D 06	LDA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019BDF|$06:$9BCF:85 8F   	STA $8F    	; hero's current HP, low byte
0x019BE1|$06:$9BD1:BD 2E 06	LDA $062E,X	; Midenhall Battle Command Target
0x019BE4|$06:$9BD4:85 90   	STA $90    	; hero's current HP, high byte
0x019BE6|$06:$9BD6:46 90   	LSR $90    	; divide 16-bit current HP by 2 (round down)
0x019BE8|$06:$9BD8:66 8F   	ROR $8F    
0x019BEA|$06:$9BDA:BD 2D 06	LDA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019BED|$06:$9BDD:38      	SEC        	; set 16-bit current HP to 1/2 current HP, rounded up
0x019BEE|$06:$9BDE:E5 8F   	SBC $8F    
0x019BF0|$06:$9BE0:9D 2D 06	STA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019BF3|$06:$9BE3:BD 2E 06	LDA $062E,X	; Midenhall Battle Command Target
0x019BF6|$06:$9BE6:E5 90   	SBC $90    
0x019BF8|$06:$9BE8:9D 2E 06	STA $062E,X	; Midenhall Battle Command Target
; call to code in a different bank ($0F:$FA2A)
0x019BFB|$06:$9BEB:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x019BFE|$06:$9BEE:0C	; String ID #$000C: [name]'s HP is reduced by [number].[end-FC]

; data -> code
0x019BFF|$06:$9BEF:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9BC3)
0x019C02|$06:$9BF2:20 4F 9D	JSR $9D4F  	; given hero ID in $97, set A to the offset of that hero's data in $062D
0x019C05|$06:$9BF5:AA      	TAX        
0x019C06|$06:$9BF6:A9 20   	LDA #$20   	; Poison
0x019C08|$06:$9BF8:1D 2D 06	ORA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019C0B|$06:$9BFB:9D 2D 06	STA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
; call to code in a different bank ($0F:$FA2E)
0x019C0E|$06:$9BFE:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019C11|$06:$9C01:4D	; String ID #$014D: The poison weakened [name].[end-FC]

; data -> code
0x019C12|$06:$9C02:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9B66, $9B7A, $9B90)
0x019C15|$06:$9C05:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019C17|$06:$9C07:C9 40   	CMP #$40   	; Crest ID #$40: Sun Crest
0x019C19|$06:$9C09:90 57   	BCC $9C62  	; find a regular item
0x019C1B|$06:$9C0B:C9 45   	CMP #$45   	; Chest Gold ID #$45: 15 - 30 G
0x019C1D|$06:$9C0D:B0 28   	BCS $9C37  	; generate randomized gold amount for treasure ID in A
0x019C1F|$06:$9C0F:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; ... yup, still item ID
0x019C21|$06:$9C11:C9 43   	CMP #$43   	; Crest ID #$43: Water Crest
0x019C23|$06:$9C13:D0 04   	BNE $9C19  
0x019C25|$06:$9C15:A0 0A   	LDY #$0A   	; offset from $9F5F for start of "Water Crest"
0x019C27|$06:$9C17:D0 0A   	BNE $9C23  
; control flow target (from $9C13)
0x019C29|$06:$9C19:C9 40   	CMP #$40   	; Crest ID #$40: Sun Crest
0x019C2B|$06:$9C1B:D0 04   	BNE $9C21  	; #$44 = Life Crest, #$41, #$42 = Life Crest too :p
0x019C2D|$06:$9C1D:A0 00   	LDY #$00   	; offset from $9F5F for start of "Sun Crest"
0x019C2F|$06:$9C1F:F0 02   	BEQ $9C23  
; control flow target (from $9C1B)
0x019C31|$06:$9C21:A0 16   	LDY #$16   	; offset from $9F5F for start of "Life Crest"
; copy crest name (terminated by #$FA) to $5A,X
; control flow target (from $9C17, $9C1F)
0x019C33|$06:$9C23:A2 00   	LDX #$00   
; control flow target (from $9C2E)
0x019C35|$06:$9C25:B9 5F 9F	LDA $9F5F,Y	; Crest Names
0x019C38|$06:$9C28:95 5A   	STA $5A,X  	; Crest/direction name write buffer start
0x019C3A|$06:$9C2A:C8      	INY        
0x019C3B|$06:$9C2B:E8      	INX        
0x019C3C|$06:$9C2C:C9 FA   	CMP #$FA   
0x019C3E|$06:$9C2E:D0 F5   	BNE $9C25  
; call to code in a different bank ($0F:$FA2E)
0x019C40|$06:$9C30:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019C43|$06:$9C33:4E	; String ID #$014E: Thou hast found the [item-F9].[end-FC]

; data -> code
0x019C44|$06:$9C34:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; generate randomized gold amount for treasure ID in A
; control flow target (from $9C0D)
0x019C47|$06:$9C37:38      	SEC        
0x019C48|$06:$9C38:E9 45   	SBC #$45   	; subtract treasure offset to get index
0x019C4A|$06:$9C3A:85 8F   	STA $8F    	; A = A * 3 (treasure list is 3 bytes per item)
0x019C4C|$06:$9C3C:0A      	ASL        
0x019C4D|$06:$9C3D:18      	CLC        
0x019C4E|$06:$9C3E:65 8F   	ADC $8F    
0x019C50|$06:$9C40:48      	PHA        
; call to code in a different bank ($0F:$C3AB)
0x019C51|$06:$9C41:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x019C54|$06:$9C44:68      	PLA        
0x019C55|$06:$9C45:A8      	TAY        
0x019C56|$06:$9C46:B9 3A 9F	LDA $9F3A,Y	; random treasure chest gold amount; fetch maximum bonus gold amount
0x019C59|$06:$9C49:25 32   	AND $32    	; RNG byte 0; AND with random number to make a randomized bonus gold amount
0x019C5B|$06:$9C4B:18      	CLC        
0x019C5C|$06:$9C4C:79 38 9F	ADC $9F38,Y	; base treasure chest gold amount, low byte; add random bonus amount to low byte of base gold amount
0x019C5F|$06:$9C4F:85 8F   	STA $8F    	; store to $8F for later use
0x019C61|$06:$9C51:B9 39 9F	LDA $9F39,Y	; base treasure chest gold amount, high byte; load high byte of base gold amount
0x019C64|$06:$9C54:69 00   	ADC #$00   	; add carry from low byte
0x019C66|$06:$9C56:85 90   	STA $90    	; store to $90 for later use
; add $8F-$90 to party gold, capped at $FFFF, and display String ID #$0048: And earned [number] piece[(s)] of gold.[end-FC]
; control flow target (from $9C78)
0x019C68|$06:$9C58:20 F5 8C	JSR $8CF5  	; add $8F-$90 to party gold, capped at $FFFF
; call to code in a different bank ($0F:$FA2A)
0x019C6B|$06:$9C5B:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x019C6E|$06:$9C5E:48	; String ID #$0048: And earned [number] piece[(s)] of gold.[end-FC]

; data -> code
0x019C6F|$06:$9C5F:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; find a regular item
; control flow target (from $9C09)
; call to code in a different bank ($0F:$FA2E)
0x019C72|$06:$9C62:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019C75|$06:$9C65:04	; String ID #$0104: And there [name] discovered the [item]![end-FC]

; data -> code
0x019C76|$06:$9C66:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019C78|$06:$9C68:C9 06   	CMP #$06   	; Item ID #$06: Copper Sword
0x019C7A|$06:$9C6A:D0 0F   	BNE $9C7B  
0x019C7C|$06:$9C6C:A9 00   	LDA #$00   	; Midenhall
0x019C7E|$06:$9C6E:85 97   	STA $97    	; subject hero ID $97
0x019C80|$06:$9C70:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x019C83|$06:$9C73:A9 32   	LDA #$32   	; at this point in the game, Midenhall is incapable of having a full inventory, so no need to check C; #$32 = 50 Gold
0x019C85|$06:$9C75:20 2A 8D	JSR $8D2A  	; set $8F-$90 to A-#$00
0x019C88|$06:$9C78:4C 58 9C	JMP $9C58  	; add $8F-$90 to party gold, capped at $FFFF, and display String ID #$0048: And earned [number] piece[(s)] of gold.[end-FC]

; control flow target (from $9C6A)
0x019C8B|$06:$9C7B:A5 95   	LDA $95    	; ID for [item] and [spell] control codes; item ID
0x019C8D|$06:$9C7D:8D 4C 61	STA $614C  	; found item ID
; call to code in a different bank ($0F:$F6CE)
0x019C90|$06:$9C80:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x019C93|$06:$9C83:85 C9   	STA $C9    	; number of party members - 1
0x019C95|$06:$9C85:E6 C9   	INC $C9    	; number of party members
0x019C97|$06:$9C87:A9 00   	LDA #$00   
0x019C99|$06:$9C89:85 97   	STA $97    	; subject hero ID $97
; try to add item to party member's inventory
; control flow target (from $9C99)
0x019C9B|$06:$9C8B:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x019C9E|$06:$9C8E:90 03   	BCC $9C93  	; branch if party member has no room
0x019CA0|$06:$9C90:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9C8E)
0x019CA3|$06:$9C93:E6 97   	INC $97    	; subject hero ID $97
0x019CA5|$06:$9C95:A5 97   	LDA $97    	; subject hero ID $97
0x019CA7|$06:$9C97:C5 C9   	CMP $C9    
; if more party members to try, try them
0x019CA9|$06:$9C99:D0 F0   	BNE $9C8B  	; try to add item to party member's inventory
0x019CAB|$06:$9C9B:A9 00   	LDA #$00   
0x019CAD|$06:$9C9D:85 97   	STA $97    	; subject hero ID $97
0x019CAF|$06:$9C9F:C6 C9   	DEC $C9    	; number of party members
0x019CB1|$06:$9CA1:A5 C9   	LDA $C9    	; number of party members - 1
0x019CB3|$06:$9CA3:F0 02   	BEQ $9CA7  	; useless op; #$80 and #$00 are identical as far as $FC50 is concerned
0x019CB5|$06:$9CA5:A9 80   	LDA #$80   
; control flow target (from $9CA3)
; call to code in a different bank ($0F:$FC50)
0x019CB7|$06:$9CA7:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019CBA|$06:$9CAA:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019CBD|$06:$9CAD:08	; String ID #$0108: [wait][name] can carry no more. Dost thou wish to throw something away?[FD][FD][end-FC]

; data -> code
0x019CBE|$06:$9CAE:20 D0 9A	JSR $9AD0  	; open YES/NO menu, return selected option in A
0x019CC1|$06:$9CB1:C9 00   	CMP #$00   	; YES
0x019CC3|$06:$9CB3:F0 0C   	BEQ $9CC1  
; give up new item
; control flow target (from $9CCE, $9CEC)
0x019CC5|$06:$9CB5:AD 4C 61	LDA $614C  	; found item ID; useless op; $95 hasn't changed since we copied it to $614C
0x019CC8|$06:$9CB8:85 95   	STA $95    	; ID for [item] and [spell] control codes
; call to code in a different bank ($0F:$FA2E)
0x019CCA|$06:$9CBA:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019CCD|$06:$9CBD:09	; String ID #$0109: [name] gave up the [item].[end-FC]

; data -> code
0x019CCE|$06:$9CBE:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; control flow target (from $9CB3)
0x019CD1|$06:$9CC1:A5 C9   	LDA $C9    	; number of party members - 1
0x019CD3|$06:$9CC3:F0 0D   	BEQ $9CD2  	; if Midenhall's alone, no need to pick a party member
; control flow target (from $9CEE)
; call to code in a different bank ($0F:$FA2E)
0x019CD5|$06:$9CC5:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019CD8|$06:$9CC8:0A	; String ID #$010A: Who shall throw something away?[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$F55D)
0x019CD9|$06:$9CC9:20 5D F5	JSR $F55D  	; display appropriate main ITEM hero select menu
0x019CDC|$06:$9CCC:C9 FF   	CMP #$FF   
0x019CDE|$06:$9CCE:F0 E5   	BEQ $9CB5  	; give up new item
0x019CE0|$06:$9CD0:85 97   	STA $97    	; subject hero ID $97
; control flow target (from $9CC3, $9CFD, $9D12)
; call to code in a different bank ($0F:$FA2E)
0x019CE2|$06:$9CD2:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019CE5|$06:$9CD5:0B	; String ID #$010B: What shall thou throw away?[FD][FD][end-FC]

; data -> code
0x019CE6|$06:$9CD6:A5 97   	LDA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$F5FE)
0x019CE8|$06:$9CD8:20 FE F5	JSR $F5FE  	; given a hero ID in A, open hero's item list and return selected item ID (or #$FE if they have no items)
0x019CEB|$06:$9CDB:48      	PHA        	; item ID to drop
0x019CEC|$06:$9CDC:8A      	TXA        
0x019CED|$06:$9CDD:48      	PHA        	; save X
0x019CEE|$06:$9CDE:A9 03   	LDA #$03   
; call to code in a different bank ($0F:$CF6A)
0x019CF0|$06:$9CE0:20 6A CF	JSR $CF6A  	; wipe selected menu region
0x019CF3|$06:$9CE3:68      	PLA        	; restore X
0x019CF4|$06:$9CE4:AA      	TAX        
0x019CF5|$06:$9CE5:68      	PLA        	; item ID to drop
0x019CF6|$06:$9CE6:C9 FF   	CMP #$FF   
0x019CF8|$06:$9CE8:D0 06   	BNE $9CF0  
0x019CFA|$06:$9CEA:A5 C9   	LDA $C9    	; number of party members - 1
0x019CFC|$06:$9CEC:F0 C7   	BEQ $9CB5  	; give up new item
0x019CFE|$06:$9CEE:D0 D5   	BNE $9CC5  
; control flow target (from $9CE8)
0x019D00|$06:$9CF0:86 49   	STX $49    	; object hero/target/item/string ID $49
0x019D02|$06:$9CF2:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x019D04|$06:$9CF4:20 FC 9A	JSR $9AFC  	; given hero ID in $97 and hero inventory index in $49, set Z if item is equipped and cursed, clear if not
0x019D07|$06:$9CF7:D0 07   	BNE $9D00  
; call to code in a different bank ($0F:$FA2E)
0x019D09|$06:$9CF9:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019D0C|$06:$9CFC:12	; String ID #$0112: It cannot be removed due to the curse.[end-FC]

; data -> code
0x019D0D|$06:$9CFD:4C D2 9C	JMP $9CD2  

; control flow target (from $9CF7)
0x019D10|$06:$9D00:A5 95   	LDA $95    	; ID for [item] and [spell] control codes; item ID to throw away
0x019D12|$06:$9D02:29 3F   	AND #$3F   	; strip off the equipped bit
0x019D14|$06:$9D04:0A      	ASL        
0x019D15|$06:$9D05:A8      	TAY        
0x019D16|$06:$9D06:B9 FC 9F	LDA $9FFC,Y	; Item Prices, low byte
0x019D19|$06:$9D09:19 FD 9F	ORA $9FFD,Y	; Item Prices, high byte
0x019D1C|$06:$9D0C:D0 07   	BNE $9D15  	; if price is 0 G, it's a quest item
; call to code in a different bank ($0F:$FA2E)
0x019D1E|$06:$9D0E:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019D21|$06:$9D11:0E	; String ID #$010E: Thou should not throw that away.[end-FC]

; data -> code
0x019D22|$06:$9D12:4C D2 9C	JMP $9CD2  

; control flow target (from $9D0C)
0x019D25|$06:$9D15:A5 97   	LDA $97    	; subject hero ID $97
0x019D27|$06:$9D17:0A      	ASL        	; 8 items per hero
0x019D28|$06:$9D18:0A      	ASL        
0x019D29|$06:$9D19:0A      	ASL        
0x019D2A|$06:$9D1A:18      	CLC        
0x019D2B|$06:$9D1B:65 49   	ADC $49    	; object hero/target/item/string ID $49
0x019D2D|$06:$9D1D:AA      	TAX        
0x019D2E|$06:$9D1E:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID to gain
0x019D30|$06:$9D20:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x019D33|$06:$9D23:A9 80   	LDA #$80   	; Alive
0x019D35|$06:$9D25:20 9A 8D	JSR $8D9A  	; given hero ID in $97, and status in A, SEC if hero has that status, CLC otherwise
0x019D38|$06:$9D28:B0 12   	BCS $9D3C  
0x019D3A|$06:$9D2A:20 EB 9A	JSR $9AEB  	; using name of first living hero, display String ID #$0120: [name] [end-FF]
0x019D3D|$06:$9D2D:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019D40|$06:$9D30:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019D43|$06:$9D33:0F	; String ID #$010F: threw away [name]'s [item] and gave [end-FF]

; data -> code
0x019D44|$06:$9D34:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x019D46|$06:$9D36:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x019D48|$06:$9D38:A9 10   	LDA #$10   	; String ID #$0110: the [item] to ghost of [name].[end-FC]
0x019D4A|$06:$9D3A:D0 0D   	BNE $9D49  
; control flow target (from $9D28)
0x019D4C|$06:$9D3C:20 25 8D	JSR $8D25  	; print name of hero given by low 2 bits of $97 to [name] buffer $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x019D4F|$06:$9D3F:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x019D52|$06:$9D42:0C	; String ID #$010C: [name] threw away the [item].[end-FC]

; data -> code
0x019D53|$06:$9D43:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x019D55|$06:$9D45:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x019D57|$06:$9D47:A9 0D   	LDA #$0D   	; String ID #$010D: [name] obtained the [item].[end-FC]
; control flow target (from $9D3A)
; call to code in a different bank ($0F:$FA4E)
0x019D59|$06:$9D49:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x019D5C|$06:$9D4C:4C 48 95	JMP $9548  	; end TALK/ITEM routines

; given hero ID in $97, set A to the offset of that hero's data in $062D
; control flow target (from $9BC5, $9BF2)
0x019D5F|$06:$9D4F:A6 97   	LDX $97    	; subject hero ID $97
0x019D61|$06:$9D51:BD 55 9D	LDA $9D55,X	; pre-computed offsets for the start of each hero's data at $062D
0x019D64|$06:$9D54:60      	RTS        


; code -> data
; pre-computed offsets for the start of each hero's data at $062D
; indexed data load target (from $9D51)
0x019D65|$06:$9D55:00	; Midenhall
0x019D66|$06:$9D56:12	; Cannock
0x019D67|$06:$9D57:24	; Moonbrooke

; data -> code
; scan treasure list at ($0C), returning in A/$95/$96 the item ID corresponding to party's current map ID/position or #$00 if there is no item or you're not allowed to get it
; control flow target (from $9B3F, $9B73, $9DFB)
0x019D68|$06:$9D58:A0 00   	LDY #$00   
0x019D6A|$06:$9D5A:B1 0C   	LDA ($0C),Y	; read map ID
0x019D6C|$06:$9D5C:C9 FF   	CMP #$FF   	; #$FF => end of list
0x019D6E|$06:$9D5E:D0 03   	BNE $9D63  
0x019D70|$06:$9D60:4C FE 9D	JMP $9DFE  	; end of treasure list or you aren't allowed to get the item again; set $95 = $96 = #$00 and RTS

; control flow target (from $9D5E)
0x019D73|$06:$9D63:C5 31   	CMP $31    	; current map ID
0x019D75|$06:$9D65:F0 03   	BEQ $9D6A  	; map ID matches, start checking position
0x019D77|$06:$9D67:4C EE 9D	JMP $9DEE  	; increment 16-bit $0C-$0D by 4 (move to next treasure record) and loop to check next treasure

; map ID matches, start checking position
; control flow target (from $9D65)
0x019D7A|$06:$9D6A:C8      	INY        
0x019D7B|$06:$9D6B:B1 0C   	LDA ($0C),Y	; treasure X-pos
0x019D7D|$06:$9D6D:C5 16   	CMP $16    	; current map X-pos (1)
0x019D7F|$06:$9D6F:D0 7D   	BNE $9DEE  	; increment 16-bit $0C-$0D by 4 (move to next treasure record) and loop to check next treasure
0x019D81|$06:$9D71:C8      	INY        
0x019D82|$06:$9D72:B1 0C   	LDA ($0C),Y	; treasure Y-pos
0x019D84|$06:$9D74:C5 17   	CMP $17    	; current map Y-pos (1)
0x019D86|$06:$9D76:D0 76   	BNE $9DEE  	; increment 16-bit $0C-$0D by 4 (move to next treasure record) and loop to check next treasure
0x019D88|$06:$9D78:C8      	INY        
0x019D89|$06:$9D79:B1 0C   	LDA ($0C),Y	; item ID
0x019D8B|$06:$9D7B:D0 03   	BNE $9D80  	; map/position is valid and there is an item here
0x019D8D|$06:$9D7D:4C 00 9E	JMP $9E00  	; store item ID in $95 and $96 and RTS

; map/position is valid and there is an item here
; control flow target (from $9D7B)
0x019D90|$06:$9D80:C9 45   	CMP #$45   	; randomized gold chests have IDs >= #$45
0x019D92|$06:$9D82:B0 7C   	BCS $9E00  	; store item ID in $95 and $96 and RTS
0x019D94|$06:$9D84:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019D96|$06:$9D86:C9 25   	CMP #$25   	; Item ID #$25: Tresures
0x019D98|$06:$9D88:D0 09   	BNE $9D93  
0x019D9A|$06:$9D8A:A9 2A   	LDA #$2A   	; Item ID #$2A: Echoing Flute
0x019D9C|$06:$9D8C: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
0x019D9F|$06:$9D8F:10 6D   	BPL $9DFE  	; end of treasure list or you aren't allowed to get the item again; set $95 = $96 = #$00 and RTS
0x019DA1|$06:$9D91:30 27   	BMI $9DBA  
; control flow target (from $9D88)
0x019DA3|$06:$9D93:C9 2B   	CMP #$2B   	; Item ID #$2B: Mirror of Ra
0x019DA5|$06:$9D95:D0 09   	BNE $9DA0  
0x019DA7|$06:$9D97:AD 51 06	LDA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x019DAA|$06:$9D9A:29 04   	AND #$04   	; pick out the In Party bit
0x019DAC|$06:$9D9C:D0 60   	BNE $9DFE  	; end of treasure list or you aren't allowed to get the item again; set $95 = $96 = #$00 and RTS
0x019DAE|$06:$9D9E:F0 1A   	BEQ $9DBA  
; control flow target (from $9D95)
0x019DB0|$06:$9DA0:C9 37   	CMP #$37   	; Item ID #$37: Golden Key
0x019DB2|$06:$9DA2:D0 16   	BNE $9DBA  
; the Golden Key is available in 2 places in Zahan; a dog points you to the one at (#$16, #$08), and the other one is at (#$12, #$04)
; you can only pick it up from one place at a time, however, depending on the position of the dog
0x019DB4|$06:$9DA4:A5 17   	LDA $17    	; current map Y-pos (1)
0x019DB6|$06:$9DA6:C9 04   	CMP #$04   
0x019DB8|$06:$9DA8:D0 09   	BNE $9DB3  
; the (#$12, #$04) Golden Key
0x019DBA|$06:$9DAA:AD 7C 05	LDA $057C  	; NPC #$08 X-pos; dog's X-pos
0x019DBD|$06:$9DAD:C9 12   	CMP #$12   
0x019DBF|$06:$9DAF:D0 3D   	BNE $9DEE  	; increment 16-bit $0C-$0D by 4 (move to next treasure record) and loop to check next treasure
0x019DC1|$06:$9DB1:F0 07   	BEQ $9DBA  
; the (#$16, #$08) Golden Key
; control flow target (from $9DA8)
0x019DC3|$06:$9DB3:AD 7C 05	LDA $057C  	; NPC #$08 X-pos; dog's X-pos
0x019DC6|$06:$9DB6:C9 12   	CMP #$12   
0x019DC8|$06:$9DB8:F0 34   	BEQ $9DEE  	; increment 16-bit $0C-$0D by 4 (move to next treasure record) and loop to check next treasure
; control flow target (from $9D91, $9D9E, $9DA2, $9DB1)
0x019DCA|$06:$9DBA:AD 24 9F	LDA $9F24  	; -> $06:$9F26: unique items
0x019DCD|$06:$9DBD:85 0C   	STA $0C    
0x019DCF|$06:$9DBF:AD 25 9F	LDA $9F25  
0x019DD2|$06:$9DC2:85 0D   	STA $0D    
0x019DD4|$06:$9DC4:A0 00   	LDY #$00   
0x019DD6|$06:$9DC6:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
; control flow target (from $9DCF)
0x019DD8|$06:$9DC8:D1 0C   	CMP ($0C),Y	; compare against list of unique items
0x019DDA|$06:$9DCA:F0 08   	BEQ $9DD4  
0x019DDC|$06:$9DCC:C8      	INY        
0x019DDD|$06:$9DCD:C0 12   	CPY #$12   
0x019DDF|$06:$9DCF:D0 F7   	BNE $9DC8  	; if more items to check, check them
0x019DE1|$06:$9DD1:4C 00 9E	JMP $9E00  	; store item ID in $95 and $96 and RTS; happens if item is not unique

; control flow target (from $9DCA)
0x019DE4|$06:$9DD4:C9 40   	CMP #$40   	; we already handled IDs >= #$45, so this checks for Crests #$40 - #$44
0x019DE6|$06:$9DD6:B0 2D   	BCS $9E05  	; handle finding a Crest
0x019DE8|$06:$9DD8:20 60 A3	JSR $A360  	; check for item A (possibly equipped) in party inventory, returning inventory index of item in A/X if found, #$FF if not
0x019DEB|$06:$9DDB:10 21   	BPL $9DFE  	; end of treasure list or you aren't allowed to get the item again; set $95 = $96 = #$00 and RTS
0x019DED|$06:$9DDD:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019DEF|$06:$9DDF:C9 24   	CMP #$24   	; Item ID #$24: Token of Erdrick
0x019DF1|$06:$9DE1:D0 1D   	BNE $9E00  	; store item ID in $95 and $96 and RTS
0x019DF3|$06:$9DE3:A9 23   	LDA #$23   	; Item ID #$23: Helmet of Erdrick
0x019DF5|$06:$9DE5:20 60 A3	JSR $A360  	; check for item A (possibly equipped) in party inventory, returning inventory index of item in A/X if found, #$FF if not
0x019DF8|$06:$9DE8:10 14   	BPL $9DFE  	; end of treasure list or you aren't allowed to get the item again; set $95 = $96 = #$00 and RTS
0x019DFA|$06:$9DEA:A9 24   	LDA #$24   	; Item ID #$24: Token of Erdrick
0x019DFC|$06:$9DEC:D0 12   	BNE $9E00  	; store item ID in $95 and $96 and RTS
; increment 16-bit $0C-$0D by 4 (move to next treasure record) and loop to check next treasure
; control flow target (from $9D67, $9D6F, $9D76, $9DAF, $9DB8)
0x019DFE|$06:$9DEE:A5 0C   	LDA $0C    
0x019E00|$06:$9DF0:18      	CLC        
0x019E01|$06:$9DF1:69 04   	ADC #$04   
0x019E03|$06:$9DF3:85 0C   	STA $0C    
0x019E05|$06:$9DF5:A5 0D   	LDA $0D    
0x019E07|$06:$9DF7:69 00   	ADC #$00   
0x019E09|$06:$9DF9:85 0D   	STA $0D    
0x019E0B|$06:$9DFB:4C 58 9D	JMP $9D58  	; scan treasure list at ($0C), returning in A/$95/$96 the item ID corresponding to party's current map ID/position or #$00 if there is no item or you're not allowed to get it

; end of treasure list or you aren't allowed to get the item again; set $95 = $96 = #$00 and RTS
; control flow target (from $9D60, $9D8F, $9D9C, $9DDB, $9DE8, $9E1C)
0x019E0E|$06:$9DFE:A9 00   	LDA #$00   
; store item ID in $95 and $96 and RTS
; control flow target (from $9D7D, $9D82, $9DD1, $9DE1, $9DEC, $9E28)
0x019E10|$06:$9E00:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x019E12|$06:$9E02:85 95   	STA $95    	; ID for [item] and [spell] control codes
0x019E14|$06:$9E04:60      	RTS        

; handle finding a Crest
; control flow target (from $9DD6)
0x019E15|$06:$9E05:C9 43   	CMP #$43   	; Crest ID #$43: Water Crest
0x019E17|$06:$9E07:D0 04   	BNE $9E0D  
0x019E19|$06:$9E09:A9 08   	LDA #$08   	; Crest ID #$43: Water Crest sets bit #$08
0x019E1B|$06:$9E0B:D0 0A   	BNE $9E17  
; control flow target (from $9E07)
0x019E1D|$06:$9E0D:C9 40   	CMP #$40   
0x019E1F|$06:$9E0F:D0 04   	BNE $9E15  
0x019E21|$06:$9E11:A9 01   	LDA #$01   	; Crest ID #$40: Sun Crest sets bit #$01
0x019E23|$06:$9E13:D0 02   	BNE $9E17  
; control flow target (from $9E0F)
0x019E25|$06:$9E15:A9 10   	LDA #$10   	; by process of elimination, Crest ID #$44: Life Crest sets bit #$10
; control flow target (from $9E0B, $9E13)
0x019E27|$06:$9E17:85 0C   	STA $0C    
0x019E29|$06:$9E19:2D 12 01	AND $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x019E2C|$06:$9E1C:D0 E0   	BNE $9DFE  	; end of treasure list or you aren't allowed to get the item again; set $95 = $96 = #$00 and RTS
0x019E2E|$06:$9E1E:A5 0C   	LDA $0C    
0x019E30|$06:$9E20:0D 12 01	ORA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x019E33|$06:$9E23:8D 12 01	STA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun); mark Crest as found
0x019E36|$06:$9E26:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x019E38|$06:$9E28:D0 D6   	BNE $9E00  	; store item ID in $95 and $96 and RTS

; code -> data
; -> $06:$9E2E: Treasure List 1 (map ID, X-pos, Y-pos, item ID)
; data load target (from $9B35)
0x019E3A|$06:$9E2A:2E
; data load target (from $9B3A)
0x019E3B|$06:$9E2B:   9E	; $06:$9E2E; Treasure List 1 (map ID, X-pos, Y-pos, item ID)
; -> $06:$9F07: Treasure List 2 (map ID, X-pos, Y-pos, item ID)
; data load target (from $9B69)
0x019E3C|$06:$9E2C:07
; data load target (from $9B6E)
0x019E3D|$06:$9E2D:   9F	; $06:$9F07; Treasure List 2 (map ID, X-pos, Y-pos, item ID)
; Treasure List 1 (map ID, X-pos, Y-pos, item ID)
; indirect data load target (via $9E2A)
0x019E3E|$06:$9E2E:03 0E 02 06	; Item ID #$06: Copper Sword (Midenhall Castle)
0x019E42|$06:$9E32:03 13 0E 35	; Item ID #$35: Wing of Wyvern (Midenhall Castle)
0x019E46|$06:$9E36:03 14 0E 3C	; Item ID #$3C: Medical Herb (Midenhall Castle)
0x019E4A|$06:$9E3A:03 13 0F 47	; Item ID #$47: 50 - 113 G (Midenhall Castle)
0x019E4E|$06:$9E3E:03 14 0F 00	; Item ID #$00: Empty (Midenhall Castle)
0x019E52|$06:$9E42:03 15 0F 24	; Item ID #$24: Token of Erdrick (Midenhall Castle)

0x019E56|$06:$9E46:06 0A 0A 20	; Item ID #$20: Shield of Erdrick (Cannock Castle)

0x019E5A|$06:$9E4A:0F 06 14 1A	; Item ID #$1A: Armor of Gaia (Osterfair)
0x019E5E|$06:$9E4E:0F 06 16 02	; Item ID #$02: Magic Knife (Osterfair)

0x019E62|$06:$9E52:10 02 02 2D	; Item ID #$2D: Magic Loom (Zahan)

0x019E66|$06:$9E56:18 07 06 33	; Item ID #$33: Lottery Ticket (Charlock Castle)
0x019E6A|$06:$9E5A:18 08 06 3C	; Item ID #$3C: Medical Herb (Charlock Castle)
0x019E6E|$06:$9E5E:18 06 07 49	; Item ID #$49: 100 - 163 G (Charlock Castle)
0x019E72|$06:$9E62:18 07 07 35	; Item ID #$35: Wing of Wyvern (Charlock Castle)

0x019E76|$06:$9E66:2C 12 0C 3C	; Item ID #$3C: Medical Herb (Lake Cave B1)
0x019E7A|$06:$9E6A:2C 0E 1C 45	; Item ID #$45: 15 - 30 G (Lake Cave B1)
0x019E7E|$06:$9E6E:2D 0E 0C 3C	; Item ID #$3C: Medical Herb (Lake Cave B2)
0x019E82|$06:$9E72:2D 14 1A 46	; Item ID #$46: 31 - 46 G (Lake Cave B2)
0x019E86|$06:$9E76:2D 02 14 3B	; Item ID #$3B: Antidote Herb (Lake Cave B2)
0x019E8A|$06:$9E7A:2D 14 1C 35	; Item ID #$35: Wing of Wyvern (Lake Cave B2)
0x019E8E|$06:$9E7E:2D 14 14 38	; Item ID #$38: Silver Key (Lake Cave B2)

0x019E92|$06:$9E82:2E 18 02 4B	; Item ID #$4B: 111 - 142 G (Sea Cave B1)
0x019E96|$06:$9E86:2E 02 0A 3C	; Item ID #$3C: Medical Herb (Sea Cave B1)
0x019E9A|$06:$9E8A:2F 20 0E FF	; Item ID #$FF: Trap (Sea Cave B2)
0x019E9E|$06:$9E8E:2F 0E 18 48	; Item ID #$48: 51 - 82 G (Sea Cave B2)
0x019EA2|$06:$9E92:31 02 02 49	; Item ID #$49: 100 - 163 G (Sea Cave B3(2))
0x019EA6|$06:$9E96:31 0A 02 FF	; Item ID #$FF: Trap (Sea Cave B3(2))
0x019EAA|$06:$9E9A:32 10 0E 30	; Item ID #$30: Dragon's Bane (Sea Cave B4)
0x019EAE|$06:$9E9E:33 16 02 28	; Item ID #$28: Eye of Malroth (Sea Cave B5)

0x019EB2|$06:$9EA2:34 0E 10 0F	; Item ID #$0F: Sword of Erdrick (Charlock Castle)

0x019EB6|$06:$9EA6:37 10 10 44	; Item ID #$44: Life Crest (Cave to Rhone B1)
0x019EBA|$06:$9EAA:3C 0C 1A 4B	; Item ID #$4B: 111 - 142 G (Cave to Rhone 3F)
0x019EBE|$06:$9EAE:3C 0E 32 10	; Item ID #$10: Thunder Sword (Cave to Rhone 3F)
0x019EC2|$06:$9EB2:3C 1E 2C 33	; Item ID #$33: Lottery Ticket (Cave to Rhone 3F)
0x019EC6|$06:$9EB6:3E 18 0E 1B	; Item ID #$1B: Armor of Erdrick (Cave to Rhone 5F)
0x019ECA|$06:$9EBA:3E 1A 18 4D	; Item ID #$4D: 111 - 174 G (Cave to Rhone 5F)
0x019ECE|$06:$9EBE:3E 12 20 FF	; Item ID #$FF: Trap (Cave to Rhone 5F)
0x019ED2|$06:$9EC2:3E 12 24 4A	; Item ID #$4A: 561 - 624 G (Cave to Rhone 5F)

0x019ED6|$06:$9EC6:40 02 0E 3C	; Item ID #$3C: Medical Herb (Spring Of Bravery)
0x019EDA|$06:$9ECA:40 0E 1A 45	; Item ID #$45: 15 - 30 G (Spring Of Bravery)
0x019EDE|$06:$9ECE:40 16 1C 3C	; Item ID #$3C: Medical Herb (Spring Of Bravery)

0x019EE2|$06:$9ED2:49 12 14 3C	; Item ID #$3C: Medical Herb (Moon Tower 1F)
0x019EE6|$06:$9ED6:49 10 02 26	; Item ID #$26: Moon Fragment (Moon Tower 1F)
0x019EEA|$06:$9EDA:4B 02 02 50	; Item ID #$50: 101 - 132 G (Moon Tower 3F)
0x019EEE|$06:$9EDE:4C 04 0C 01	; Item ID #$01: Bamboo Stick (Moon Tower 4F)
0x019EF2|$06:$9EE2:4C 02 0C 4F	; Item ID #$4F: 251 - 282 G (Moon Tower 4F)

0x019EF6|$06:$9EE6:50 14 0A 51	; Item ID #$51: 38 - 53 G (Lighthouse 1F)
0x019EFA|$06:$9EEA:51 1E 1C 00	; Item ID #$00: Empty (triggers Star Crest battle) (Lighthouse 2F)
0x019EFE|$06:$9EEE:53 0C 16 4E	; Item ID #$4E: 120 - 135 G (Lighthouse 4F)
0x019F02|$06:$9EF2:54 16 02 34	; Item ID #$34: Fairy Water (Lighthouse 5F)
0x019F06|$06:$9EF6:54 0E 12 07	; Item ID #$07: Chain Sickle (Lighthouse 5F)

0x019F0A|$06:$9EFA:58 10 14 3C	; Item ID #$3C: Medical Herb (Wind Tower 1F)
0x019F0E|$06:$9EFE:59 02 04 2E	; Item ID #$2E: Cloak of Wind (Wind Tower 2F)
0x019F12|$06:$9F02:5A 06 10 4C	; Item ID #$4C: 41 - 56 G (Wind Tower 3F)
; indirect data load target
0x019F16|$06:$9F06:FF	; end of Treasure List 1
; Treasure List 2 (map ID, X-pos, Y-pos, item ID)
; indirect data load target (via $9E2C)
0x019F17|$06:$9F07:01 92 6D 2B	; Item ID #$2B: Mirror of Ra (Swamp SE of Hamlin)
0x019F1B|$06:$9F0B:01 1E FC 25	; Item ID #$25: Tresures (Ocean NW of Tantegal)
0x019F1F|$06:$9F0F:01 BB DD 29	; Item ID #$29: Leaf of World Tree (Island E of Wellgarth)
0x019F23|$06:$9F13:08 05 01 43	; Item ID #$43: Water Crest (Hamlin)
0x019F27|$06:$9F17:1E 08 00 40	; Item ID #$40: Sun Crest (Monolith E of Wellgarth)
0x019F2B|$06:$9F1B:10 12 04 37	; Item ID #$37: Golden Key location #1 (Zahan)
0x019F2F|$06:$9F1F:10 16 08 37	; Item ID #$37: Golden Key location #2 (Zahan)
; indirect data load target
0x019F33|$06:$9F23:FF	; end of Treasure List 2
; -> $06:$9F26: unique items
; data load target (from $9DBA)
0x019F34|$06:$9F24:26
; data load target (from $9DBF)
0x019F35|$06:$9F25:   9F	; $06:$9F26; unique items
; unique items
; indirect data load target (via $9F24)
0x019F36|$06:$9F26:38	; Item ID #$38: Silver Key
0x019F37|$06:$9F27:25	; Item ID #$25: Tresures
0x019F38|$06:$9F28:29	; Item ID #$29: Leaf of The World Tree
0x019F39|$06:$9F29:24	; Item ID #$24: Token of Erdrick
0x019F3A|$06:$9F2A:20	; Item ID #$20: Shield of Erdrick
0x019F3B|$06:$9F2B:43	; Crest ID #$43: Water Crest
0x019F3C|$06:$9F2C:1A	; Item ID #$1A: Armor of Gaia
0x019F3D|$06:$9F2D:10	; Item ID #$10: Thunder Sword
0x019F3E|$06:$9F2E:40	; Crest ID #$40: Sun Crest
0x019F3F|$06:$9F2F:28	; Item ID #$28: Eye of Malroth
0x019F40|$06:$9F30:0F	; Item ID #$0F: Sword of Erdrick
0x019F41|$06:$9F31:44	; Crest ID #$44: Life Crest
0x019F42|$06:$9F32:1B	; Item ID #$1B: Armor of Erdrick
0x019F43|$06:$9F33:26	; Item ID #$26: Moon Fragment
0x019F44|$06:$9F34:2E	; Item ID #$2E: Cloak of Wind
0x019F45|$06:$9F35:2B	; Item ID #$2B: Mirror of Ra
0x019F46|$06:$9F36:37	; Item ID #$37: Golden Key
0x019F47|$06:$9F37:2D	; Item ID #$2D: Magic Loom
; base treasure chest gold amount, low byte
; random gold amounts
; indexed data load target (from $9C4C)
0x019F48|$06:$9F38:0F
; base treasure chest gold amount, high byte
; indexed data load target (from $9C51)
0x019F49|$06:$9F39:   00
; random treasure chest gold amount
; indexed data load target (from $9C46)
0x019F4A|$06:$9F3A:      0F	; Chest Gold ID #$45: 15 - 30 G
0x019F4B|$06:$9F3B:1F 00 0F	; Chest Gold ID #$46: 31 - 46 G
0x019F4E|$06:$9F3E:32 00 3F	; Chest Gold ID #$47: 50 - 113 G
0x019F51|$06:$9F41:33 00 1F	; Chest Gold ID #$48: 51 - 82 G
0x019F54|$06:$9F44:64 00 3F	; Chest Gold ID #$49: 100 - 163 G
0x019F57|$06:$9F47:31 02 3F	; Chest Gold ID #$4A: 561 - 624 G
0x019F5A|$06:$9F4A:6F 00 1F	; Chest Gold ID #$4B: 111 - 142 G
0x019F5D|$06:$9F4D:29 00 0F	; Chest Gold ID #$4C: 41 - 56 G
0x019F60|$06:$9F50:6F 00 3F	; Chest Gold ID #$4D: 111 - 174 G
0x019F63|$06:$9F53:78 00 0F	; Chest Gold ID #$4E: 120 - 135 G
0x019F66|$06:$9F56:FB 00 1F	; Chest Gold ID #$4F: 251 - 282 G
0x019F69|$06:$9F59:65 00 1F	; Chest Gold ID #$50: 101 - 132 G
0x019F6C|$06:$9F5C:26 00 0F	; Chest Gold ID #$51: 38 - 53 G
; Crest Names
; indexed data load target (from $9C25)
0x019F6F|$06:$9F5F:36 1E 17 5F 26 1B 0E 1C 1D FA	; "Sun Crest" + [end-FA]
0x019F79|$06:$9F69:3A 0A 1D 0E 1B 5F 26 1B 0E 1C 1D FA	; "Water Crest" + [end-FA]
0x019F85|$06:$9F75:2F 12 0F 0E 5F 26 1B 0E 1C 1D FA	; "Life Crest"  + [end-FA]
; Inn prices per party member
; indexed data load target (from $821F)
0x019F90|$06:$9F80:04	; Inn ID #$00, Map IDs #$00/#$03: Fake Midenhall/Midenhall 1F
0x019F91|$06:$9F81:06	; Inn ID #$01, Map ID #$05: Leftwyne
0x019F92|$06:$9F82:08	; Inn ID #$02, Map ID #$06: Cannock
0x019F93|$06:$9F83:0C	; Inn ID #$03, Map ID #$07: Hamlin
0x019F94|$06:$9F84:14	; Inn ID #$04, Map ID #$0B: Lianport
0x019F95|$06:$9F85:02	; Inn ID #$05, Map ID #$0C: Tantegel
0x019F96|$06:$9F86:19	; Inn ID #$06, Map ID #$0F: Osterfair
0x019F97|$06:$9F87:1E	; Inn ID #$07, Map ID #$10: Zahan
0x019F98|$06:$9F88:28	; Inn ID #$08, Map ID #$11: Tuhn / Map ID #$14: Wellgarth Underground
0x019F99|$06:$9F89:1E
; Weapon Shop inventories
; external indexed data load target (from $0F:$F266, $0F:$F278, $0F:$F299)
0x019F9A|$06:$9F8A:05 06 02 07 16 1C	; Shop ID #00, Weapons/Armor, Map ID #$05: Leftwyne
0x019FA0|$06:$9F90:07 08 0A 16 19 1E	; Shop ID #01, Weapons/Armor, Map ID #$07: Hamlin
0x019FA6|$06:$9F96:02 0A 03 19 12 1E	; Shop ID #02, Weapons/Armor, Map ID #$0B: Lianport
0x019FAC|$06:$9F9C:0A 0B 03 12 1E 22	; Shop ID #03, Weapons/Armor, Map ID #$0C: Tantegel
0x019FB2|$06:$9FA2:0A 0B 0D 12 18 22	; Shop ID #04, Weapons/Armor, Map ID #$0F: Osterfair
0x019FB8|$06:$9FA8:03 09 0D 18 1D 22	; Shop ID #05, Weapons/Armor, Map ID #$11: Tuhn
0x019FBE|$06:$9FAE:0B 0D 0E 14 1D 22	; Shop ID #06, Weapons/Armor, Map ID #$14: Wellgarth Underground
0x019FC4|$06:$9FB4:0B 03 0D 1E 1D 22	; Shop ID #07, Weapons/Armor, Map ID #$15: Beran
; Tool Shop inventories
0x019FCA|$06:$9FBA:3C 3B 00 00 00 00	; Shop ID #$00, Items, Map IDs #$00/#$03: Fake Midenhall/Midenhall 1F
0x019FD0|$06:$9FC0:3C 3B 35 00 00 00	; Shop ID #$01, Items, Map ID #$05: Leftwyne
0x019FD6|$06:$9FC6:3C 3B 35 34 00 00	; Shop ID #$02, Items, Map ID #$06: Cannock
0x019FDC|$06:$9FCC:3C 3B 35 34 00 00	; Shop ID #$03, Items, Map ID #$07: Hamlin
0x019FE2|$06:$9FD2:3C 3B 35 34 30 00	; Shop ID #$04, Items, Map ID #$0B: Lianport
0x019FE8|$06:$9FD8:3C 3B 35 34 30 00	; Shop ID #$05, Items, Map ID #$0C: Tantegel
0x019FEE|$06:$9FDE:3C 35 34 30 00 00	; Shop ID #$06, Items, Map ID #$10: Zahan
0x019FF4|$06:$9FE4:35 34 30 00 00 00	; Shop ID #$07, Items, Map ID #$11: Tuhn
0x019FFA|$06:$9FEA:3C 3B 34 30 00 00	; Shop ID #$08, Items, Map ID #$14: Wellgarth Underground, #1
0x01A000|$06:$9FF0:3C 3B 39 35 00 00	; Shop ID #$09, Items, Map ID #$14: Wellgarth Underground, #2
0x01A006|$06:$9FF6:3C 3B 35 34 00 00	; Shop ID #$0A, Items, Map ID #$15: Beran
; Item Prices, low byte
; indexed data load target (from $84D7, $84E9, $8D15, $8D51, $8D6C, $9A8B, $9D06)
; external indexed data load target (from $0F:$EED3)
0x01A00C|$06:$9FFC:00
; Item Prices, high byte
; indexed data load target (from $84DC, $84F1, $8D1D, $8D56, $8D74, $9A8E, $9D09)
; external indexed data load target (from $0F:$EED8)
0x01A00D|$06:$9FFD:   00	; Item ID #$00: (no item)
0x01A00E|$06:$9FFE:14 00	; Item ID #$01: Bamboo Stick
0x01A010|$06:$A000:C8 00	; Item ID #$02: Magic Knife
0x01A012|$06:$A002:C4 09	; Item ID #$03: Wizard’s Wand
0x01A014|$06:$A004:90 65	; Item ID #$04: Staff of Thunder
0x01A016|$06:$A006:3C 00	; Item ID #$05: Club
0x01A018|$06:$A008:64 00	; Item ID #$06: Copper Sword
0x01A01A|$06:$A00A:86 01	; Item ID #$07: Chain Sickle
0x01A01C|$06:$A00C:02 03	; Item ID #$08: Iron Spear
0x01A01E|$06:$A00E:A8 61	; Item ID #$09: Falcon Sword
0x01A020|$06:$A010:DC 05	; Item ID #$0A: Broad Sword
0x01A022|$06:$A012:A0 0F	; Item ID #$0B: Giant Hammer
0x01A024|$06:$A014:98 3A	; Item ID #$0C: Sword of Destruction
0x01A026|$06:$A016:40 1F	; Item ID #$0D: Dragon Killer
0x01A028|$06:$A018:80 3E	; Item ID #$0E: Light Sword
0x01A02A|$06:$A01A:02 00	; Item ID #$0F: Sword of Erdrick
0x01A02C|$06:$A01C:F4 01	; Item ID #$10: Thunder Sword

0x01A02E|$06:$A01E:1E 00	; Item ID #$11: Clothes
0x01A030|$06:$A020:E2 04	; Item ID #$12: Clothes Hiding
0x01A032|$06:$A022:46 00	; Item ID #$13: Water Flying Cloth
0x01A034|$06:$A024:E8 FD	; Item ID #$14: Mink Coat
0x01A036|$06:$A026:96 00	; Item ID #$15: Leather Armor
0x01A038|$06:$A028:E0 01	; Item ID #$16: Chain Mail
0x01A03A|$06:$A02A:00 19	; Item ID #$17: Gremlin’s Armor
0x01A03C|$06:$A02C:CC 10	; Item ID #$18: Magic Armor
0x01A03E|$06:$A02E:E8 03	; Item ID #$19: Full Plate Armor
0x01A040|$06:$A030:32 00	; Item ID #$1A: Armor of Gaia
0x01A042|$06:$A032:04 00	; Item ID #$1B: Armor of Erdrick

0x01A044|$06:$A034:5A 00	; Item ID #$1C: Leather Shield
0x01A046|$06:$A036:FC 53	; Item ID #$1D: Shield of Strength
0x01A048|$06:$A038:D0 07	; Item ID #$1E: Steel Shield
0x01A04A|$06:$A03A:60 22	; Item ID #$1F: Evil Shield
0x01A04C|$06:$A03C:14 00	; Item ID #$20: Shield of Erdrick

0x01A04E|$06:$A03E:20 4E	; Item ID #$21: Mysterious Hat
0x01A050|$06:$A040:4E 0C	; Item ID #$22: Iron Helmet
0x01A052|$06:$A042:46 00	; Item ID #$23: Helmet of Erdrick

0x01A054|$06:$A044:0A 00	; Item ID #$24: Token of Erdrick
0x01A056|$06:$A046:00 00	; Item ID #$25: Tresures
0x01A058|$06:$A048:2C 01	; Item ID #$26: Moon Fragment
0x01A05A|$06:$A04A:00 00	; Item ID #$27: Charm of Rubiss
0x01A05C|$06:$A04C:00 00	; Item ID #$28: Eye of Malroth
0x01A05E|$06:$A04E:06 00	; Item ID #$29: Leaf of The World Tree
0x01A060|$06:$A050:90 01	; Item ID #$2A: Echoing Flute
0x01A062|$06:$A052:00 00	; Item ID #$2B: Mirror of Ra
0x01A064|$06:$A054:28 00	; Item ID #$2C: Dew’s Yarn
0x01A066|$06:$A056:1E 00	; Item ID #$2D: Magic Loom
0x01A068|$06:$A058:46 00	; Item ID #$2E: Cloak of Wind
0x01A06A|$06:$A05A:DC 05	; Item ID #$2F: Gremlin’s Tail
0x01A06C|$06:$A05C:80 02	; Item ID #$30: Dragon’s Bane
0x01A06E|$06:$A05E:10 27	; Item ID #$31: Dragon’s Potion
0x01A070|$06:$A060:F4 01	; Item ID #$32: Golden Card
0x01A072|$06:$A062:46 00	; Item ID #$33: Lottery Ticket
0x01A074|$06:$A064:28 00	; Item ID #$34: Fairy Water
0x01A076|$06:$A066:50 00	; Item ID #$35: Wing of the Wyvern
0x01A078|$06:$A068:02 00	; Item ID #$36: [blank]
0x01A07A|$06:$A06A:02 00	; Item ID #$37: Golden Key
0x01A07C|$06:$A06C:02 00	; Item ID #$38: Silver Key
0x01A07E|$06:$A06E:D0 07	; Item ID #$39: Jailor’s Key
0x01A080|$06:$A070:00 00	; Item ID #$3A: Watergate Key
0x01A082|$06:$A072:08 00	; Item ID #$3B: Antidote Herb
0x01A084|$06:$A074:0F 00	; Item ID #$3C: Medical Herb
0x01A086|$06:$A076:28 0A	; Item ID #$3D: Wizard’s Ring
0x01A088|$06:$A078:02 00	; Item ID #$3E: Perilous
0x01A08A|$06:$A07A:02 00	; Item ID #$3F: [blank]

; data -> code
; control flow target (from $A141, $A14C)
0x01A08C|$06:$A07C:A5 47   	LDA $47    	; Stepguard flag
0x01A08E|$06:$A07E:10 08   	BPL $A088  
0x01A090|$06:$A080:C0 04   	CPY #$04   
0x01A092|$06:$A082:D0 11   	BNE $A095  
0x01A094|$06:$A084:A9 07   	LDA #$07   
0x01A096|$06:$A086:85 47   	STA $47    	; Stepguard flag
; control flow target (from $A07E)
0x01A098|$06:$A088:98      	TYA        
0x01A099|$06:$A089:25 47   	AND $47    	; Stepguard flag
0x01A09B|$06:$A08B:F0 0D   	BEQ $A09A  
0x01A09D|$06:$A08D:0A      	ASL        
0x01A09E|$06:$A08E:38      	SEC        
0x01A09F|$06:$A08F:E9 01   	SBC #$01   
0x01A0A1|$06:$A091:05 47   	ORA $47    	; Stepguard flag
0x01A0A3|$06:$A093:85 47   	STA $47    	; Stepguard flag
; control flow target (from $A082)
0x01A0A5|$06:$A095:68      	PLA        
0x01A0A6|$06:$A096:68      	PLA        
0x01A0A7|$06:$A097:4C A1 A1	JMP $A1A1  

; control flow target (from $A08B)
0x01A0AA|$06:$A09A:60      	RTS        


; code -> data
; indexed data load target (from $A11D)
0x01A0AB|$06:$A09B:04
0x01A0AC|$06:$A09C:02
0x01A0AD|$06:$A09D:01

; data -> code
; external control flow target (from $0F:$C89E)
0x01A0AE|$06:$A09E:AD 5A 01	LDA $015A  
0x01A0B1|$06:$A0A1:8D 5B 01	STA $015B  
0x01A0B4|$06:$A0A4:AD 59 01	LDA $0159  
0x01A0B7|$06:$A0A7:8D 5A 01	STA $015A  
0x01A0BA|$06:$A0AA:A5 3B   	LDA $3B    	; high nybble = terrain ID
0x01A0BC|$06:$A0AC:8D 59 01	STA $0159  
0x01A0BF|$06:$A0AF:A9 00   	LDA #$00   
0x01A0C1|$06:$A0B1:85 0E   	STA $0E    
0x01A0C3|$06:$A0B3:A9 06   	LDA #$06   
0x01A0C5|$06:$A0B5:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x01A0C7|$06:$A0B7:A5 46   	LDA $46    	; Repel (#$FE) / Fairy Water (#$FF) flag
0x01A0C9|$06:$A0B9:F0 23   	BEQ $A0DE  
0x01A0CB|$06:$A0BB:C9 01   	CMP #$01   
0x01A0CD|$06:$A0BD:D0 04   	BNE $A0C3  
0x01A0CF|$06:$A0BF:A9 2B   	LDA #$2B   	; String ID #$012B: The Fairy Water evaporated and lost its power.[end-FC]
0x01A0D1|$06:$A0C1:D0 06   	BNE $A0C9  
; control flow target (from $A0BD)
0x01A0D3|$06:$A0C3:C9 02   	CMP #$02   
0x01A0D5|$06:$A0C5:D0 13   	BNE $A0DA  
0x01A0D7|$06:$A0C7:A9 BE   	LDA #$BE   	; String ID #$01BE: Repel has lost its effect.[end-FC]
; control flow target (from $A0C1)
0x01A0D9|$06:$A0C9:48      	PHA        
; call to code in a different bank ($0F:$EB76)
0x01A0DA|$06:$A0CA:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01A0DD|$06:$A0CD:04	; Menu ID #$04: Dialogue window

; data -> code
0x01A0DE|$06:$A0CE:68      	PLA        
; call to code in a different bank ($0F:$FA4E)
0x01A0DF|$06:$A0CF:20 4E FA	JSR $FA4E  	; display string ID specified by A + #$0100
0x01A0E2|$06:$A0D2:A9 01   	LDA #$01   
0x01A0E4|$06:$A0D4:85 0E   	STA $0E    
0x01A0E6|$06:$A0D6:A9 02   	LDA #$02   
0x01A0E8|$06:$A0D8:85 46   	STA $46    	; Repel (#$FE) / Fairy Water (#$FF) flag
; control flow target (from $A0C5)
0x01A0EA|$06:$A0DA:C6 46   	DEC $46    	; Repel (#$FE) / Fairy Water (#$FF) flag
0x01A0EC|$06:$A0DC:C6 46   	DEC $46    	; Repel (#$FE) / Fairy Water (#$FF) flag
; control flow target (from $A0B9)
0x01A0EE|$06:$A0DE:EE FB 05	INC $05FB  	; movement counter
0x01A0F1|$06:$A0E1:AD FB 05	LDA $05FB  	; movement counter
0x01A0F4|$06:$A0E4:29 03   	AND #$03   
0x01A0F6|$06:$A0E6:D0 26   	BNE $A10E  
0x01A0F8|$06:$A0E8: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)
0x01A0FA|$06:$A0EA:C9 01   	CMP #$01   
0x01A0FC|$06:$A0EC:F0 20   	BEQ $A10E  
0x01A0FE|$06:$A0EE:A0 00   	LDY #$00   
; control flow target (from $A10C)
0x01A100|$06:$A0F0:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01A103|$06:$A0F3:29 A0   	AND #$A0   
0x01A105|$06:$A0F5:C9 A0   	CMP #$A0   
0x01A107|$06:$A0F7:D0 0C   	BNE $A105  
0x01A109|$06:$A0F9:98      	TYA        
0x01A10A|$06:$A0FA:48      	PHA        
0x01A10B|$06:$A0FB:20 62 A2	JSR $A262  
0x01A10E|$06:$A0FE:68      	PLA        
0x01A10F|$06:$A0FF:A8      	TAY        
0x01A110|$06:$A100:A9 01   	LDA #$01   
0x01A112|$06:$A102:20 C7 A1	JSR $A1C7  
; control flow target (from $A0F7)
0x01A115|$06:$A105:98      	TYA        
0x01A116|$06:$A106:18      	CLC        
0x01A117|$06:$A107:69 12   	ADC #$12   
0x01A119|$06:$A109:A8      	TAY        
0x01A11A|$06:$A10A:C0 36   	CPY #$36   
0x01A11C|$06:$A10C:90 E2   	BCC $A0F0  
; control flow target (from $A0E6, $A0EC)
0x01A11E|$06:$A10E:A9 24   	LDA #$24   
0x01A120|$06:$A110:85 49   	STA $49    	; object hero/target/item/string ID $49
0x01A122|$06:$A112:A9 00   	LDA #$00   
0x01A124|$06:$A114:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
; control flow target (from $A1AA)
0x01A126|$06:$A116:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x01A128|$06:$A118:4A      	LSR        
0x01A129|$06:$A119:4A      	LSR        
0x01A12A|$06:$A11A:4A      	LSR        
0x01A12B|$06:$A11B:4A      	LSR        
0x01A12C|$06:$A11C:AA      	TAX        
0x01A12D|$06:$A11D:BC 9B A0	LDY $A09B,X
0x01A130|$06:$A120:BD 59 01	LDA $0159,X
0x01A133|$06:$A123:C9 70   	CMP #$70   
0x01A135|$06:$A125:D0 04   	BNE $A12B  
0x01A137|$06:$A127:A9 02   	LDA #$02   
0x01A139|$06:$A129:D0 36   	BNE $A161  
; control flow target (from $A125)
0x01A13B|$06:$A12B:C9 A0   	CMP #$A0   
0x01A13D|$06:$A12D:D0 0E   	BNE $A13D  
0x01A13F|$06:$A12F:A5 31   	LDA $31    	; current map ID
0x01A141|$06:$A131:C9 2E   	CMP #$2E   	; Map ID #$2E: Sea Cave B1
0x01A143|$06:$A133:90 1E   	BCC $A153  
0x01A145|$06:$A135:C9 34   	CMP #$34   	; Map ID #$34: Charlock Castle B1/B2
0x01A147|$06:$A137:B0 1A   	BCS $A153  
0x01A149|$06:$A139:A9 01   	LDA #$01   
0x01A14B|$06:$A13B:D0 24   	BNE $A161  
; control flow target (from $A12D)
0x01A14D|$06:$A13D:C9 80   	CMP #$80   
0x01A14F|$06:$A13F:D0 07   	BNE $A148  
0x01A151|$06:$A141:20 7C A0	JSR $A07C  
0x01A154|$06:$A144:A9 0F   	LDA #$0F   
0x01A156|$06:$A146:D0 19   	BNE $A161  
; control flow target (from $A13F)
0x01A158|$06:$A148:C9 90   	CMP #$90   
0x01A15A|$06:$A14A:D0 07   	BNE $A153  
0x01A15C|$06:$A14C:20 7C A0	JSR $A07C  
0x01A15F|$06:$A14F:A9 1E   	LDA #$1E   
0x01A161|$06:$A151:D0 0E   	BNE $A161  
; control flow target (from $A133, $A137, $A14A)
0x01A163|$06:$A153:A5 47   	LDA $47    	; Stepguard flag
0x01A165|$06:$A155:30 4A   	BMI $A1A1  
0x01A167|$06:$A157:98      	TYA        
0x01A168|$06:$A158:49 FF   	EOR #$FF   
0x01A16A|$06:$A15A:25 47   	AND $47    	; Stepguard flag
0x01A16C|$06:$A15C:85 47   	STA $47    	; Stepguard flag
0x01A16E|$06:$A15E:4C A1 A1	JMP $A1A1  

; control flow target (from $A129, $A13B, $A146, $A151)
0x01A171|$06:$A161:85 CC   	STA $CC    
0x01A173|$06:$A163:A4 49   	LDY $49    	; object hero/target/item/string ID $49
0x01A175|$06:$A165:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01A178|$06:$A168:10 37   	BPL $A1A1  
0x01A17A|$06:$A16A:A9 5B   	LDA #$5B   
0x01A17C|$06:$A16C:20 B5 A1	JSR $A1B5  
0x01A17F|$06:$A16F:B0 30   	BCS $A1A1  
0x01A181|$06:$A171:A5 CC   	LDA $CC    
0x01A183|$06:$A173:C9 0A   	CMP #$0A   
0x01A185|$06:$A175:B0 07   	BCS $A17E  
0x01A187|$06:$A177:A9 53   	LDA #$53   
0x01A189|$06:$A179:20 B5 A1	JSR $A1B5  
0x01A18C|$06:$A17C:B0 23   	BCS $A1A1  
; control flow target (from $A175)
0x01A18E|$06:$A17E:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs
0x01A190|$06:$A180:D0 18   	BNE $A19A  
0x01A192|$06:$A182:98      	TYA        
0x01A193|$06:$A183:48      	PHA        
0x01A194|$06:$A184:A5 CC   	LDA $CC    
0x01A196|$06:$A186:C9 0A   	CMP #$0A   
0x01A198|$06:$A188:B0 0B   	BCS $A195  
0x01A19A|$06:$A18A:A9 91   	LDA #$91   	; Music ID #$91: swamp SFX
; call to code in a different bank ($0F:$C561)
0x01A19C|$06:$A18C:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x01A19F|$06:$A18F:20 62 A2	JSR $A262  
0x01A1A2|$06:$A192:4C 98 A1	JMP $A198  

; control flow target (from $A188)
0x01A1A5|$06:$A195:20 96 A2	JSR $A296  
; control flow target (from $A192)
0x01A1A8|$06:$A198:68      	PLA        
0x01A1A9|$06:$A199:A8      	TAY        
; control flow target (from $A180)
0x01A1AA|$06:$A19A:E6 96   	INC $96    	; temp storage for item/spell/type/etc. IDs
0x01A1AC|$06:$A19C:A5 CC   	LDA $CC    
0x01A1AE|$06:$A19E:20 C7 A1	JSR $A1C7  
; control flow target (from $A097, $A155, $A15E, $A168, $A16F, $A17C)
0x01A1B1|$06:$A1A1:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x01A1B3|$06:$A1A3:38      	SEC        
0x01A1B4|$06:$A1A4:E9 12   	SBC #$12   
0x01A1B6|$06:$A1A6:85 49   	STA $49    	; object hero/target/item/string ID $49
0x01A1B8|$06:$A1A8:30 03   	BMI $A1AD  
0x01A1BA|$06:$A1AA:4C 16 A1	JMP $A116  

; control flow target (from $A1A8)
0x01A1BD|$06:$A1AD:A5 0E   	LDA $0E    
0x01A1BF|$06:$A1AF:F0 03   	BEQ $A1B4  
; call to code in a different bank ($0F:$D0F5)
0x01A1C1|$06:$A1B1:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
; control flow target (from $A1AF)
0x01A1C4|$06:$A1B4:60      	RTS        

; control flow target (from $A16C, $A179)
0x01A1C5|$06:$A1B5:85 0C   	STA $0C    
0x01A1C7|$06:$A1B7:98      	TYA        
0x01A1C8|$06:$A1B8:48      	PHA        
0x01A1C9|$06:$A1B9:4A      	LSR        
0x01A1CA|$06:$A1BA:4A      	LSR        
0x01A1CB|$06:$A1BB:4A      	LSR        
0x01A1CC|$06:$A1BC:4A      	LSR        
0x01A1CD|$06:$A1BD:85 9C   	STA $9C    
0x01A1CF|$06:$A1BF:A5 0C   	LDA $0C    
; call to code in a different bank ($0F:$C4B0)
0x01A1D1|$06:$A1C1:20 B0 C4	JSR $C4B0  	; given a hero ID in $9C and an item ID in A, SEC if hero has that item, CLC otherwise
0x01A1D4|$06:$A1C4:68      	PLA        
0x01A1D5|$06:$A1C5:A8      	TAY        
0x01A1D6|$06:$A1C6:60      	RTS        

; control flow target (from $A102, $A19E)
0x01A1D7|$06:$A1C7:85 0C   	STA $0C    
0x01A1D9|$06:$A1C9:B9 3B 06	LDA $063B,Y	; Midenhall Current HP, low byte
0x01A1DC|$06:$A1CC:38      	SEC        
0x01A1DD|$06:$A1CD:E5 0C   	SBC $0C    
0x01A1DF|$06:$A1CF:99 3B 06	STA $063B,Y	; Midenhall Current HP, low byte
0x01A1E2|$06:$A1D2:B9 3C 06	LDA $063C,Y	; Midenhall Current HP, high byte
0x01A1E5|$06:$A1D5:E9 00   	SBC #$00   
0x01A1E7|$06:$A1D7:99 3C 06	STA $063C,Y	; Midenhall Current HP, high byte
0x01A1EA|$06:$A1DA:B0 08   	BCS $A1E4  
0x01A1EC|$06:$A1DC:A9 00   	LDA #$00   
0x01A1EE|$06:$A1DE:99 3B 06	STA $063B,Y	; Midenhall Current HP, low byte
0x01A1F1|$06:$A1E1:99 3C 06	STA $063C,Y	; Midenhall Current HP, high byte
; control flow target (from $A1DA)
0x01A1F4|$06:$A1E4:19 3B 06	ORA $063B,Y	; Midenhall Current HP, low byte
0x01A1F7|$06:$A1E7:F0 0C   	BEQ $A1F5  
0x01A1F9|$06:$A1E9:98      	TYA        
0x01A1FA|$06:$A1EA:48      	PHA        
0x01A1FB|$06:$A1EB:8A      	TXA        
0x01A1FC|$06:$A1EC:48      	PHA        
; call to code in a different bank ($0F:$C22C)
0x01A1FD|$06:$A1ED:20 2C C2	JSR $C22C  
0x01A200|$06:$A1F0:68      	PLA        
0x01A201|$06:$A1F1:AA      	TAX        
0x01A202|$06:$A1F2:68      	PLA        
0x01A203|$06:$A1F3:A8      	TAY        
0x01A204|$06:$A1F4:60      	RTS        

; control flow target (from $A1E7)
0x01A205|$06:$A1F5:A9 04   	LDA #$04   
0x01A207|$06:$A1F7:99 2D 06	STA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01A20A|$06:$A1FA:A9 FF   	LDA #$FF   
0x01A20C|$06:$A1FC:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x01A20E|$06:$A1FE:A5 0E   	LDA $0E    
0x01A210|$06:$A200:D0 0C   	BNE $A20E  
0x01A212|$06:$A202:98      	TYA        
0x01A213|$06:$A203:48      	PHA        
; call to code in a different bank ($0F:$EB76)
0x01A214|$06:$A204:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01A217|$06:$A207:04	; Menu ID #$04: Dialogue window

; data -> code
0x01A218|$06:$A208:68      	PLA        
0x01A219|$06:$A209:A8      	TAY        
0x01A21A|$06:$A20A:A9 00   	LDA #$00   
0x01A21C|$06:$A20C:85 0E   	STA $0E    
; control flow target (from $A200)
0x01A21E|$06:$A20E:E6 0E   	INC $0E    
0x01A220|$06:$A210:A5 0E   	LDA $0E    
0x01A222|$06:$A212:48      	PHA        
0x01A223|$06:$A213:98      	TYA        
0x01A224|$06:$A214:48      	PHA        
0x01A225|$06:$A215:4A      	LSR        
0x01A226|$06:$A216:4A      	LSR        
0x01A227|$06:$A217:4A      	LSR        
0x01A228|$06:$A218:4A      	LSR        
0x01A229|$06:$A219:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$FC50)
0x01A22B|$06:$A21B:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
0x01A22E|$06:$A21E:A5 97   	LDA $97    	; subject hero ID $97
0x01A230|$06:$A220:18      	CLC        
0x01A231|$06:$A221:69 03   	ADC #$03   
0x01A233|$06:$A223:85 97   	STA $97    	; subject hero ID $97
; call to code in a different bank ($0F:$D302)
0x01A235|$06:$A225:20 02 D3	JSR $D302  
; call to code in a different bank ($0F:$FA2A)
0x01A238|$06:$A228:20 2A FA	JSR $FA2A  	; display string ID specified by next byte

; code -> data
; indirect data load target
0x01A23B|$06:$A22B:1B	; String ID #$001B: Alas, brave [name] hast died.[end-FC]

; data -> code
0x01A23C|$06:$A22C:68      	PLA        
0x01A23D|$06:$A22D:A8      	TAY        
0x01A23E|$06:$A22E:68      	PLA        
0x01A23F|$06:$A22F:85 0E   	STA $0E    
0x01A241|$06:$A231:A2 00   	LDX #$00   
; control flow target (from $A23F)
0x01A243|$06:$A233:BD 2D 06	LDA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01A246|$06:$A236:30 25   	BMI $A25D  
0x01A248|$06:$A238:8A      	TXA        
0x01A249|$06:$A239:18      	CLC        
0x01A24A|$06:$A23A:69 12   	ADC #$12   
0x01A24C|$06:$A23C:AA      	TAX        
0x01A24D|$06:$A23D:C9 36   	CMP #$36   
0x01A24F|$06:$A23F:90 F2   	BCC $A233  
; call to code in a different bank ($0F:$F6CE)
0x01A251|$06:$A241:20 CE F6	JSR $F6CE  	; return number of party members - 1 in A/X
0x01A254|$06:$A244:F0 09   	BEQ $A24F  
0x01A256|$06:$A246:A9 80   	LDA #$80   
; call to code in a different bank ($0F:$FC50)
0x01A258|$06:$A248:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01A25B|$06:$A24B:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01A25E|$06:$A24E:51	; String ID #$0151: [name] is utterly destroyed.[end-FC]

; data -> code
; control flow target (from $A244)
0x01A25F|$06:$A24F:A9 12   	LDA #$12   	; Music ID #$12: party defeat BGM
0x01A261|$06:$A251:8D F7 05	STA $05F7  	; probably BGM for current area
; call to code in a different bank ($0F:$C561)
0x01A264|$06:$A254:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x01A267|$06:$A257:20 9D 80	JSR $809D  	; wait until all joypad buttons are released and then some button pressed
; call to code in a different bank ($0F:$D271)
0x01A26A|$06:$A25A:4C 71 D2	JMP $D271  

; control flow target (from $A236)
0x01A26D|$06:$A25D:A9 00   	LDA #$00   
0x01A26F|$06:$A25F:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x01A271|$06:$A261:60      	RTS        

; control flow target (from $A0FB, $A18F, $A29F)
; call to code in a different bank ($0F:$C1DC)
0x01A272|$06:$A262:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x01A275|$06:$A265:AD 87 A2	LDA $A287  
0x01A278|$06:$A268:85 0A   	STA $0A    
0x01A27A|$06:$A26A:AD 88 A2	LDA $A288  
0x01A27D|$06:$A26D:20 7E A2	JSR $A27E  
; call to code in a different bank ($0F:$C1DC)
0x01A280|$06:$A270:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; call to code in a different bank ($0F:$C1DC)
0x01A283|$06:$A273:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x01A286|$06:$A276:AD E9 C2	LDA $C2E9  
0x01A289|$06:$A279:85 0A   	STA $0A    
0x01A28B|$06:$A27B:AD EA C2	LDA $C2EA  
; control flow target (from $A26D)
0x01A28E|$06:$A27E:85 0B   	STA $0B    
0x01A290|$06:$A280:A9 00   	LDA #$00   
0x01A292|$06:$A282:85 0C   	STA $0C    
; call to code in a different bank ($0F:$C228)
0x01A294|$06:$A284:4C 28 C2	JMP $C228  


; code -> data
; data load target (from $A265)
0x01A297|$06:$A287:89
; data load target (from $A26A)
0x01A298|$06:$A288:   A2	; $06:$A289
; indirect data load target (via $A287)
0x01A299|$06:$A289:0F
; indirect data load target
0x01A29A|$06:$A28A:16
; indirect data load target
0x01A29B|$06:$A28B:16
; indirect data load target
0x01A29C|$06:$A28C:16
; indirect data load target
0x01A29D|$06:$A28D:16
; indirect data load target
0x01A29E|$06:$A28E:16
; indirect data load target
0x01A29F|$06:$A28F:16
; indirect data load target
0x01A2A0|$06:$A290:16
; indirect data load target
0x01A2A1|$06:$A291:16
; indirect data load target
0x01A2A2|$06:$A292:16
; indirect data load target
0x01A2A3|$06:$A293:16
; indirect data load target
0x01A2A4|$06:$A294:16
; indirect data load target
0x01A2A5|$06:$A295:16

; data -> code
; control flow target (from $A195)
0x01A2A6|$06:$A296:A9 81   	LDA #$81   	; Music ID #$81: hit 1 SFX
; call to code in a different bank ($0F:$C561)
0x01A2A8|$06:$A298:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x01A2AB|$06:$A29B:A9 04   	LDA #$04   
0x01A2AD|$06:$A29D:85 13   	STA $13    
; control flow target (from $A2A4)
0x01A2AF|$06:$A29F:20 62 A2	JSR $A262  
0x01A2B2|$06:$A2A2:C6 13   	DEC $13    
0x01A2B4|$06:$A2A4:D0 F9   	BNE $A29F  
0x01A2B6|$06:$A2A6:60      	RTS        

; external control flow target (from $0F:$C91B)
0x01A2B7|$06:$A2A7:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x01A2BA|$06:$A2AA:29 1F   	AND #$1F   
0x01A2BC|$06:$A2AC:C9 1F   	CMP #$1F   
0x01A2BE|$06:$A2AE:F0 01   	BEQ $A2B1  
; control flow target (from $A2B8)
0x01A2C0|$06:$A2B0:60      	RTS        

; control flow target (from $A2AE)
0x01A2C1|$06:$A2B1:A9 27   	LDA #$27   
0x01A2C3|$06:$A2B3: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
0x01A2C6|$06:$A2B6:C9 FF   	CMP #$FF   
0x01A2C8|$06:$A2B8:D0 F6   	BNE $A2B0  
0x01A2CA|$06:$A2BA:A9 05   	LDA #$05   	; Music ID #$05: Rubiss BGM
; call to code in a different bank ($0F:$C561)
0x01A2CC|$06:$A2BC:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x01A2CF|$06:$A2BF:A9 04   	LDA #$04   
0x01A2D1|$06:$A2C1:85 49   	STA $49    	; object hero/target/item/string ID $49
0x01A2D3|$06:$A2C3:20 FB A2	JSR $A2FB  
; call to code in a different bank ($0F:$F6F6)
0x01A2D6|$06:$A2C6: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
0x01A2D9|$06:$A2C9:FD	; String ID #$02FD: I hear a mortal voice calling me.[wait][line]‘Ah, three descendants of Erdrick[.’][wait][line]‘Yes, I shall help thee[.’][wait][line]‘I am Rubiss, an Enchanter, and long ago I promised Erdrick to help when the time came[.’][wait][line]‘Now is the time[.’][wait][line]‘Receive now my charm and my spell of protection[.’][end-FC]

; data -> code
0x01A2DA|$06:$A2CA:A9 27   	LDA #$27   
0x01A2DC|$06:$A2CC:85 96   	STA $96    	; temp storage for item/spell/type/etc. IDs
0x01A2DE|$06:$A2CE:A9 00   	LDA #$00   
0x01A2E0|$06:$A2D0:85 97   	STA $97    	; subject hero ID $97
0x01A2E2|$06:$A2D2:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x01A2E5|$06:$A2D5:B0 12   	BCS $A2E9  
0x01A2E7|$06:$A2D7:E6 97   	INC $97    	; subject hero ID $97
0x01A2E9|$06:$A2D9:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x01A2EC|$06:$A2DC:B0 0B   	BCS $A2E9  
0x01A2EE|$06:$A2DE:E6 97   	INC $97    	; subject hero ID $97
0x01A2F0|$06:$A2E0:20 7E 8D	JSR $8D7E  	; given hero ID in $97 and item ID in $96, try to add item to first empty slot in hero's inventory; SEC if added, CLC if no empty slots
0x01A2F3|$06:$A2E3:B0 04   	BCS $A2E9  
; call to code in a different bank ($0F:$FA32)
0x01A2F5|$06:$A2E5:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
0x01A2F8|$06:$A2E8:D8	; String ID #$02D8: [wait]‘But thou hast many things.[line]See me again later[.’][end-FC]

; data -> code
; control flow target (from $A2D5, $A2DC, $A2E3)
0x01A2F9|$06:$A2E9:A2 3C   	LDX #$3C   
; call to code in a different bank ($0F:$C1EE)
0x01A2FB|$06:$A2EB:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x01A2FE|$06:$A2EE:A9 FF   	LDA #$FF   
0x01A300|$06:$A2F0:85 49   	STA $49    	; object hero/target/item/string ID $49
0x01A302|$06:$A2F2:20 FB A2	JSR $A2FB  
; call to code in a different bank ($0F:$C59D)
0x01A305|$06:$A2F5:20 9D C5	JSR $C59D  
; call to code in a different bank ($0F:$D0F5)
0x01A308|$06:$A2F8:4C F5 D0	JMP $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01

; control flow target (from $A2C3, $A2F2)
0x01A30B|$06:$A2FB:A0 1F   	LDY #$1F   
0x01A30D|$06:$A2FD:20 0C A3	JSR $A30C  
0x01A310|$06:$A300:A0 27   	LDY #$27   
0x01A312|$06:$A302:20 0C A3	JSR $A30C  
0x01A315|$06:$A305:A0 2F   	LDY #$2F   
0x01A317|$06:$A307:20 0C A3	JSR $A30C  
0x01A31A|$06:$A30A:A0 37   	LDY #$37   
; control flow target (from $A2FD, $A302, $A307)
0x01A31C|$06:$A30C:A5 49   	LDA $49    	; object hero/target/item/string ID $49
0x01A31E|$06:$A30E:99 3A 05	STA $053A,Y
; call to code in a different bank ($0F:$CF64)
0x01A321|$06:$A311:20 64 CF	JSR $CF64  
0x01A324|$06:$A314:A2 19   	LDX #$19   
; call to code in a different bank ($0F:$C1EE)
0x01A326|$06:$A316:4C EE C1	JMP $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF

; 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
; external control flow target (from $0F:$E438)
0x01A329|$06:$A319:A2 00   	LDX #$00   
0x01A32B|$06:$A31B:A0 00   	LDY #$00   
; control flow target (from $A337)
0x01A32D|$06:$A31D:86 0C   	STX $0C    
0x01A32F|$06:$A31F:BD 4E A3	LDA $A34E,X
0x01A332|$06:$A322:85 0D   	STA $0D    
0x01A334|$06:$A324:BD 4D A3	LDA $A34D,X	; stat ranges
0x01A337|$06:$A327:AA      	TAX        
; control flow target (from $A32F)
0x01A338|$06:$A328:20 3A A3	JSR $A33A  	; if $05FC is #$00, copy $015D,Y to $0600,X, otherwise copy $0600,X to $015D,Y
0x01A33B|$06:$A32B:E8      	INX        
0x01A33C|$06:$A32C:C8      	INY        
0x01A33D|$06:$A32D:E4 0D   	CPX $0D    
0x01A33F|$06:$A32F:D0 F7   	BNE $A328  
0x01A341|$06:$A331:A6 0C   	LDX $0C    
0x01A343|$06:$A333:E8      	INX        
0x01A344|$06:$A334:E8      	INX        
0x01A345|$06:$A335:E0 10   	CPX #$10   
0x01A347|$06:$A337:D0 E4   	BNE $A31D  
0x01A349|$06:$A339:60      	RTS        

; if $05FC is #$00, copy $015D,Y to $0600,X, otherwise copy $0600,X to $015D,Y
; control flow target (from $A328)
0x01A34A|$06:$A33A:AD FC 05	LDA $05FC  
0x01A34D|$06:$A33D:F0 07   	BEQ $A346  
0x01A34F|$06:$A33F:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x01A352|$06:$A342:99 5D 01	STA $015D,Y
0x01A355|$06:$A345:60      	RTS        

; control flow target (from $A33D)
0x01A356|$06:$A346:B9 5D 01	LDA $015D,Y
0x01A359|$06:$A349:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x01A35C|$06:$A34C:60      	RTS        


; code -> data
; stat ranges
; indexed data load target (from $A324)
0x01A35D|$06:$A34D:00
; indexed data load target (from $A31F)
0x01A35E|$06:$A34E:   18	; $0600 inclusive - $0618 exclusive
0x01A35F|$06:$A34F:24 26	; $0624 inclusive - $0626 exclusive
0x01A361|$06:$A351:2D 2E	; $062D inclusive - $062E exclusive
0x01A363|$06:$A353:3B 3E	; $063B inclusive - $063E exclusive
0x01A365|$06:$A355:3F 40	; $063F inclusive - $0640 exclusive
0x01A367|$06:$A357:4D 50	; $064D inclusive - $0650 exclusive
0x01A369|$06:$A359:51 52	; $0651 inclusive - $0652 exclusive
0x01A36B|$06:$A35B:5F 62	; $065F inclusive - $0662 exclusive

; data -> code
; save game handler
; control flow target (from $8F02, $900A, $918D, $9209, $93F6, $943F, $981B)
; call to code in a different bank ($0F:$D159)
0x01A36D|$06:$A35D:4C 59 D1	JMP $D159  

; check for item A (possibly equipped) in party inventory, returning inventory index of item in A/X if found, #$FF if not
; control flow target (from $9B58, $9DD8, $9DE5)
0x01A370|$06:$A360: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
0x01A373|$06:$A363:10 3A   	BPL $A39F  	; if found, RTS
0x01A375|$06:$A365:A5 0C   	LDA $0C    	; otherwise re-load the item ID
0x01A377|$06:$A367:09 40   	ORA #$40   	; and check for an equipped version
; check for item A in party inventory, returning inventory index of item in A/X if found, #$FF if not
; control flow target (from $834E, $845B, $86D7, $8D5D, $90CE, $90D5, $92BC, $92C3, $92D5, $9306, $93C0, $93CB, $9B51, $9BA8, $9D8C, $A2B3, $A360)
; external control flow target (from $0F:$D589)
0x01A379|$06:$A369:84 10   	STY $10    	; save Y in $10
0x01A37B|$06:$A36B:85 0C   	STA $0C    	; save item ID in $0C
0x01A37D|$06:$A36D:A2 00   	LDX #$00   	; initialize both inventory index and hero ID to #$00
0x01A37F|$06:$A36F:86 0D   	STX $0D    	; inventory index
; control flow target (from $A398)
0x01A381|$06:$A371:A4 0D   	LDY $0D    	; hero ID
0x01A383|$06:$A373:B9 A0 A3	LDA $A3A0,Y	; pre-computed offsets for the start of each hero's data (what's wrong with the same data at $06:$9D55?)
0x01A386|$06:$A376:A8      	TAY        
0x01A387|$06:$A377:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01A38A|$06:$A37A:29 04   	AND #$04   	; pick out the In Party bit
0x01A38C|$06:$A37C:D0 07   	BNE $A385  	; if not in party, skip to the next hero (but heroes are gained sequentially and never leave, so BNE $A39A would be faster)
0x01A38E|$06:$A37E:8A      	TXA        	; inventory index
0x01A38F|$06:$A37F:18      	CLC        
0x01A390|$06:$A380:69 08   	ADC #$08   	; move to start of next hero's inventory
0x01A392|$06:$A382:AA      	TAX        
0x01A393|$06:$A383:D0 0D   	BNE $A392  	; branch always taken; skip cheking current hero's inventory (since they're not in the party)
; control flow target (from $A37C, $A390)
0x01A395|$06:$A385:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x01A398|$06:$A388:C5 0C   	CMP $0C    	; item ID
0x01A39A|$06:$A38A:F0 10   	BEQ $A39C  	; if we have one, then done
0x01A39C|$06:$A38C:E8      	INX        	; otherwise move to next inventory index
0x01A39D|$06:$A38D:8A      	TXA        	; calculate inventory index mod 8
0x01A39E|$06:$A38E:29 07   	AND #$07   
0x01A3A0|$06:$A390:D0 F3   	BNE $A385  	; if this hero has more inventory to check, check it
; control flow target (from $A383)
0x01A3A2|$06:$A392:E6 0D   	INC $0D    	; increment hero ID
0x01A3A4|$06:$A394:A5 0D   	LDA $0D    
0x01A3A6|$06:$A396:C9 03   	CMP #$03   	; 3 heroes total
0x01A3A8|$06:$A398:D0 D7   	BNE $A371  	; if more heroes to check, check them
0x01A3AA|$06:$A39A:A2 FF   	LDX #$FF   	; otherwise flag item not found
; control flow target (from $A38A)
0x01A3AC|$06:$A39C:A4 10   	LDY $10    	; restore Y from $10
0x01A3AE|$06:$A39E:8A      	TXA        
; control flow target (from $A363)
0x01A3AF|$06:$A39F:60      	RTS        


; code -> data
; pre-computed offsets for the start of each hero's data (what's wrong with the same data at $06:$9D55?)
; indexed data load target (from $A373)
0x01A3B0|$06:$A3A0:00	; Midenhall
0x01A3B1|$06:$A3A1:12	; Cannock
0x01A3B2|$06:$A3A2:24	; Moonbrooke

; data -> code
; given item ID in $96 and hero ID in $97, set A to #$80 if hero can equip item, #$00 otherwise
; control flow target (from $831D, $8AA9)
0x01A3B3|$06:$A3A3:86 10   	STX $10    	; save X
0x01A3B5|$06:$A3A5:A5 96   	LDA $96    	; temp storage for item/spell/type/etc. IDs; item ID
0x01A3B7|$06:$A3A7:29 3F   	AND #$3F   	; strip off equipped bit
0x01A3B9|$06:$A3A9:AA      	TAX        
0x01A3BA|$06:$A3AA:BD BD A3	LDA $A3BD,X	; Bit fields controlling who can equip each item
0x01A3BD|$06:$A3AD:85 0D   	STA $0D    
0x01A3BF|$06:$A3AF:A4 97   	LDY $97    	; subject hero ID $97
0x01A3C1|$06:$A3B1:C8      	INY        	; number of bits to shift
; control flow target (from $A3B8)
0x01A3C2|$06:$A3B2:A9 00   	LDA #$00   	; initialize return value
0x01A3C4|$06:$A3B4:46 0D   	LSR $0D    	; shift hero's equipability bit into C
0x01A3C6|$06:$A3B6:6A      	ROR        	; and then into A
0x01A3C7|$06:$A3B7:88      	DEY        	; number of bits to shift
0x01A3C8|$06:$A3B8:D0 F8   	BNE $A3B2  	; if it's the wrong hero's data, loop to next hero
0x01A3CA|$06:$A3BA:A6 10   	LDX $10    	; restore X
0x01A3CC|$06:$A3BC:60      	RTS        


; code -> data
; Bit fields controlling who can equip each item
; #$01 = Midenhall, #$02 = Cannock, #$04 = Moonbrooke
; indexed data load target (from $A3AA)
0x01A3CD|$06:$A3BD:00	; Item ID #$00: (no item)
0x01A3CE|$06:$A3BE:07	; Item ID #$01: Bamboo Stick
0x01A3CF|$06:$A3BF:07	; Item ID #$02: Magic Knife
0x01A3D0|$06:$A3C0:07	; Item ID #$03: Wizard’s Wand
0x01A3D1|$06:$A3C1:07	; Item ID #$04: Staff of Thunder
0x01A3D2|$06:$A3C2:03	; Item ID #$05: Club
0x01A3D3|$06:$A3C3:03	; Item ID #$06: Copper Sword
0x01A3D4|$06:$A3C4:03	; Item ID #$07: Chain Sickle
0x01A3D5|$06:$A3C5:03	; Item ID #$08: Iron Spear
0x01A3D6|$06:$A3C6:03	; Item ID #$09: Falcon Sword
0x01A3D7|$06:$A3C7:01	; Item ID #$0A: Broad Sword
0x01A3D8|$06:$A3C8:01	; Item ID #$0B: Giant Hammer
0x01A3D9|$06:$A3C9:01	; Item ID #$0C: Sword of Destruction
0x01A3DA|$06:$A3CA:01	; Item ID #$0D: Dragon Killer
0x01A3DB|$06:$A3CB:01	; Item ID #$0E: Light Sword
0x01A3DC|$06:$A3CC:01	; Item ID #$0F: Sword of Erdrick
0x01A3DD|$06:$A3CD:01	; Item ID #$10: Thunder Sword

0x01A3DE|$06:$A3CE:07	; Item ID #$11: Clothes
0x01A3DF|$06:$A3CF:07	; Item ID #$12: Clothes Hiding
0x01A3E0|$06:$A3D0:07	; Item ID #$13: Water Flying Cloth
0x01A3E1|$06:$A3D1:07	; Item ID #$14: Mink Coat
0x01A3E2|$06:$A3D2:03	; Item ID #$15: Leather Armor
0x01A3E3|$06:$A3D3:03	; Item ID #$16: Chain Mail
0x01A3E4|$06:$A3D4:03	; Item ID #$17: Gremlin’s Armor
0x01A3E5|$06:$A3D5:03	; Item ID #$18: Magic Armor
0x01A3E6|$06:$A3D6:01	; Item ID #$19: Full Plate Armor
0x01A3E7|$06:$A3D7:01	; Item ID #$1A: Armor of Gaia
0x01A3E8|$06:$A3D8:01	; Item ID #$1B: Armor of Erdrick

0x01A3E9|$06:$A3D9:03	; Item ID #$1C: Leather Shield
0x01A3EA|$06:$A3DA:03	; Item ID #$1D: Shield of Strength
0x01A3EB|$06:$A3DB:01	; Item ID #$1E: Steel Shield
0x01A3EC|$06:$A3DC:01	; Item ID #$1F: Evil Shield
0x01A3ED|$06:$A3DD:01	; Item ID #$20: Shield of Erdrick

0x01A3EE|$06:$A3DE:07	; Item ID #$21: Mysterious Hat
0x01A3EF|$06:$A3DF:01	; Item ID #$22: Iron Helmet
0x01A3F0|$06:$A3E0:01	; Item ID #$23: Helmet of Erdrick
; pointers to warp spaces for irregularly-shaped maps
; indirect data load target (via $8042)
; external indexed data load target (from $0F:$E8BC)
0x01A3F1|$06:$A3E1:00
; external indexed data load target (from $0F:$E8C1)
0x01A3F2|$06:$A3E2:   00	; $06:$0000; Map ID #$2B: Cave to Hamlin
0x01A3F3|$06:$A3E3:1B A4	; $06:$A41B; Map ID #$2C: Lake Cave B1
0x01A3F5|$06:$A3E5:30 A4	; $06:$A430; Map ID #$2D: Lake Cave B2
0x01A3F7|$06:$A3E7:45 A4	; $06:$A445; Map ID #$2E: Sea Cave B1
0x01A3F9|$06:$A3E9:50 A4	; $06:$A450; Map ID #$2F: Sea Cave B2
0x01A3FB|$06:$A3EB:00 00	; $06:$0000; Map ID #$30: Sea Cave B3-1
0x01A3FD|$06:$A3ED:00 00	; $06:$0000; Map ID #$31: Sea Cave B3-2
0x01A3FF|$06:$A3EF:00 00	; $06:$0000; Map ID #$32: Sea Cave B4
0x01A401|$06:$A3F1:00 00	; $06:$0000; Map ID #$33: Sea Cave B5
0x01A403|$06:$A3F3:00 00	; $06:$0000; Map ID #$34: Charlock Castle B1/B2
0x01A405|$06:$A3F5:00 00	; $06:$0000; Map ID #$35: Charlock Castle B3/B4-1/B5-1
0x01A407|$06:$A3F7:00 00	; $06:$0000; Map ID #$36: Charlock Castle B4-2/B5-2/B6
0x01A409|$06:$A3F9:00 00	; $06:$0000; Map ID #$37: Cave to Rhone B1
0x01A40B|$06:$A3FB:00 00	; $06:$0000; Map ID #$38: Cave to Rhone 1F
0x01A40D|$06:$A3FD:5B A4	; $06:$A45B; Map ID #$39: Cave to Rhone 2F-1
0x01A40F|$06:$A3FF:98 A4	; $06:$A498; Map ID #$3A: Cave to Rhone 2F-2
0x01A411|$06:$A401:D5 A4	; $06:$A4D5; Map ID #$3B: Cave to Rhone 2F-3
0x01A413|$06:$A403:F4 A4	; $06:$A4F4; Map ID #$3C: Cave to Rhone 3F
0x01A415|$06:$A405:00 00	; $06:$0000; Map ID #$3D: Cave to Rhone 4F
0x01A417|$06:$A407:00 00	; $06:$0000; Map ID #$3E: Cave to Rhone 5F
0x01A419|$06:$A409:31 A5	; $06:$A531; Map ID #$3F: Cave to Rhone 6F
0x01A41B|$06:$A40B:00 00	; $06:$0000; Map ID #$40: Spring of Bravery
0x01A41D|$06:$A40D:00 00	; $06:$0000; Map ID #$41: unused?
0x01A41F|$06:$A40F:00 00	; $06:$0000; Map ID #$42: unused?
0x01A421|$06:$A411:00 00	; $06:$0000; Map ID #$43: Cave to Rimuldar
0x01A423|$06:$A413:00 00	; $06:$0000; Map ID #$44: Hargon's Castle 2F
0x01A425|$06:$A415:00 00	; $06:$0000; Map ID #$45: Hargon's Castle 3F
0x01A427|$06:$A417:00 00	; $06:$0000; Map ID #$46: Hargon's Castle 4F
0x01A429|$06:$A419:00 00	; $06:$0000; Map ID #$47: Hargon's Castle 5F
; warp spaces for irregularly-shaped maps; format is (destination map ID, destination X-pos, destination Y-pos, transition X-pos, transition Y-pos), all positions are 7-bit, describing a 2x2 space
; Map ID #$2C: Lake Cave B1
; indirect data load target (via $A3E3)
0x01A42B|$06:$A41B:2C 1E 16 FE 10
0x01A430|$06:$A420:2C 00 10 20 16
0x01A435|$06:$A425:2C 04 00 18 20
0x01A43A|$06:$A42A:2C 18 1E 04 FE
; indirect data load target
0x01A43F|$06:$A42F:FF
; Map ID #$2D: Lake Cave B2
; indirect data load target (via $A3E5)
0x01A440|$06:$A430:2D 16 02 0E 20
0x01A445|$06:$A435:2D 0E 1E 16 00
0x01A44A|$06:$A43A:2D 1A 1C FE 1C
0x01A44F|$06:$A43F:2D 00 1C 1C 1C
; indirect data load target
0x01A454|$06:$A444:FF
; Map ID #$2E: Sea Cave B1
; indirect data load target (via $A3E7)
0x01A455|$06:$A445:2E 04 02 02 1C
0x01A45A|$06:$A44A:2E 02 1A 04 00
; indirect data load target
0x01A45F|$06:$A44F:FF
; Map ID #$2F: Sea Cave B2
; indirect data load target (via $A3E9)
0x01A460|$06:$A450:2F 20 14 12 28
0x01A465|$06:$A455:2F 12 26 20 12
; indirect data load target
0x01A46A|$06:$A45A:FF
; Map ID #$39: Cave to Rhone 2F-1
; indirect data load target (via $A3FD)
0x01A46B|$06:$A45B:3A 06 0A 06 00
0x01A470|$06:$A460:3A 10 0A 10 00
0x01A475|$06:$A465:3A 1A 0A 1A 00
0x01A47A|$06:$A46A:3A 24 0A 24 00
0x01A47F|$06:$A46F:3A 2E 0A 2E 00
0x01A484|$06:$A474:3A 06 02 06 0C
0x01A489|$06:$A479:3A 10 02 10 0C
0x01A48E|$06:$A47E:3A 1A 02 1A 0C
0x01A493|$06:$A483:3A 24 02 24 0C
0x01A498|$06:$A488:3A 2E 02 2E 0C
0x01A49D|$06:$A48D:3B 08 04 FE 08
0x01A4A2|$06:$A492:3B 00 04 36 08
; indirect data load target
0x01A4A7|$06:$A497:FF
; Map ID #$3A: Cave to Rhone 2F-2
; indirect data load target (via $A3FF)
0x01A4A8|$06:$A498:39 06 0A 06 00
0x01A4AD|$06:$A49D:39 10 0A 10 00
0x01A4B2|$06:$A4A2:39 1A 0A 1A 00
0x01A4B7|$06:$A4A7:39 24 0A 24 00
0x01A4BC|$06:$A4AC:39 2E 0A 2E 00
0x01A4C1|$06:$A4B1:39 06 02 06 0C
0x01A4C6|$06:$A4B6:39 10 02 10 0C
0x01A4CB|$06:$A4BB:39 1A 02 1A 0C
0x01A4D0|$06:$A4C0:39 24 02 24 0C
0x01A4D5|$06:$A4C5:39 2E 02 2E 0C
0x01A4DA|$06:$A4CA:3B 08 0E FE 08
0x01A4DF|$06:$A4CF:3B 00 0E 36 08
; indirect data load target
0x01A4E4|$06:$A4D4:FF
; Map ID #$3B: Cave to Rhone 2F-3
; indirect data load target (via $A401)
0x01A4E5|$06:$A4D5:3B 04 00 04 14
0x01A4EA|$06:$A4DA:3B 04 12 04 FE
0x01A4EF|$06:$A4DF:39 34 08 FE 04
0x01A4F4|$06:$A4E4:39 00 08 0A 04
0x01A4F9|$06:$A4E9:3A 34 08 FE 0E
0x01A4FE|$06:$A4EE:3A 00 08 0A 0E
; indirect data load target
0x01A503|$06:$A4F3:FF
; Map ID #$3C: Cave to Rhone 3F
; indirect data load target (via $A403)
0x01A504|$06:$A4F4:3C 16 18 FE 06
0x01A509|$06:$A4F9:3C 00 06 18 18
0x01A50E|$06:$A4FE:3C 26 0A FE 12
0x01A513|$06:$A503:3C 00 12 28 0A
0x01A518|$06:$A508:3C 26 16 FE 22
0x01A51D|$06:$A50D:3C 00 22 28 16
0x01A522|$06:$A512:3C 22 1E 20 38
0x01A527|$06:$A517:3C 20 36 22 1C
0x01A52C|$06:$A51C:3C 0A 2A 28 34
0x01A531|$06:$A521:3C 26 34 08 2A
0x01A536|$06:$A526:3C 26 02 10 16
0x01A53B|$06:$A52B:3C 12 16 28 02
; indirect data load target
0x01A540|$06:$A530:FF
; Map ID #$3F: Cave to Rhone 6F
; indirect data load target (via $A409)
0x01A541|$06:$A531:3F 02 16 1A 12
0x01A546|$06:$A536:3F 18 12 00 16
0x01A54B|$06:$A53B:3F 18 12 20 14
0x01A550|$06:$A540:3F 18 12 FE 02
0x01A555|$06:$A545:3F 08 0C 12 0E
0x01A55A|$06:$A54A:3F 12 10 08 0E
0x01A55F|$06:$A54F:3F 12 10 06 30
0x01A564|$06:$A554:3F 24 0E 0A 12
0x01A569|$06:$A559:3F 0C 12 26 0E
0x01A56E|$06:$A55E:3F 0C 12 06 02
0x01A573|$06:$A563:3F 0C 12 06 12
0x01A578|$06:$A568:3F 00 0C 28 02
0x01A57D|$06:$A56D:3F 26 02 FE 0C
0x01A582|$06:$A572:3F 00 12 28 1A
0x01A587|$06:$A577:3F 26 1A FE 12
0x01A58C|$06:$A57C:3F 00 26 1E 04
0x01A591|$06:$A581:3F 00 26 28 14
0x01A596|$06:$A586:3F 00 26 20 1C
0x01A59B|$06:$A58B:3F 10 2C 12 24
0x01A5A0|$06:$A590:3F 10 2C 20 22
0x01A5A5|$06:$A595:3F 10 2C 1A 2C
0x01A5AA|$06:$A59A:3F 22 22 12 2C
0x01A5AF|$06:$A59F:3F 00 1C 28 24
0x01A5B4|$06:$A5A4:3F 00 1C 28 2C
0x01A5B9|$06:$A5A9:3F 26 24 FE 1C
0x01A5BE|$06:$A5AE:3F 00 20 28 28
0x01A5C3|$06:$A5B3:3F 26 28 FE 20
0x01A5C8|$06:$A5B8:3F 1C 2C 28 20
0x01A5CD|$06:$A5BD:3F 0E 0C 1E 26
0x01A5D2|$06:$A5C2:3F 1A 1E 0A FE
0x01A5D7|$06:$A5C7:3F 16 2E 1C 16
0x01A5DC|$06:$A5CC:3F 08 18 1C 24
0x01A5E1|$06:$A5D1:3F 1A 24 06 18
0x01A5E6|$06:$A5D6:3F 18 0A 16 1E
0x01A5EB|$06:$A5DB:3F 14 1E 16 0A
0x01A5F0|$06:$A5E0:3F 06 2E 12 FE
0x01A5F5|$06:$A5E5:3F 0C 24 0E 0E
0x01A5FA|$06:$A5EA:3F 0C 24 1A 20
0x01A5FF|$06:$A5EF:3F 0C 24 16 30
0x01A604|$06:$A5F4:3F 12 0A 12 1A
0x01A609|$06:$A5F9:3F 12 18 12 08
0x01A60E|$06:$A5FE:3F 12 18 0C 22
0x01A613|$06:$A603:3F 12 18 22 FE
0x01A618|$06:$A608:3F 1C 04 FE 26
0x01A61D|$06:$A60D:FF

; data -> code
0x01A61E|$06:$A60E:A9 FF   	LDA #$FF   
0x01A620|$06:$A610:D0 02   	BNE $A614  
; indirect control flow target (via $8000)
0x01A622|$06:$A612:A9 00   	LDA #$00   
; control flow target (from $A610)
0x01A624|$06:$A614:20 1A A6	JSR $A61A  
; call to code in a different bank ($0F:$C1DC)
0x01A627|$06:$A617:4C DC C1	JMP $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF

; control flow target (from $A614)
; indirect control flow target (via $803C)
0x01A62A|$06:$A61A:48      	PHA        
0x01A62B|$06:$A61B:AD 01 00	LDA $0001  
0x01A62E|$06:$A61E:F0 03   	BEQ $A623  
; call to code in a different bank ($0F:$C1DC)
0x01A630|$06:$A620:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
; control flow target (from $A61E)
0x01A633|$06:$A623:A9 01   	LDA #$01   
0x01A635|$06:$A625:8D 83 01	STA $0183  
0x01A638|$06:$A628:A9 00   	LDA #$00   
0x01A63A|$06:$A62A:8D 80 60	STA $6080  
0x01A63D|$06:$A62D:68      	PLA        
0x01A63E|$06:$A62E:20 63 A7	JSR $A763  
0x01A641|$06:$A631:A9 00   	LDA #$00   
0x01A643|$06:$A633:8D 81 60	STA $6081  
0x01A646|$06:$A636:8D 82 60	STA $6082  
0x01A649|$06:$A639:AD 7B 60	LDA $607B  
0x01A64C|$06:$A63C:48      	PHA        
0x01A64D|$06:$A63D:29 F0   	AND #$F0   
0x01A64F|$06:$A63F:4A      	LSR        
0x01A650|$06:$A640:4A      	LSR        
0x01A651|$06:$A641:4A      	LSR        
0x01A652|$06:$A642:8D 7E 60	STA $607E  
0x01A655|$06:$A645:68      	PLA        
0x01A656|$06:$A646:29 0F   	AND #$0F   
0x01A658|$06:$A648:0A      	ASL        
0x01A659|$06:$A649:8D 7F 60	STA $607F  
0x01A65C|$06:$A64C:8D 83 60	STA $6083  
0x01A65F|$06:$A64F:AE 02 00	LDX $0002  
; control flow target (from $A6D0)
0x01A662|$06:$A652:A5 08   	LDA $08    
0x01A664|$06:$A654:8D 90 60	STA $6090  
0x01A667|$06:$A657:A5 07   	LDA $07    
0x01A669|$06:$A659:8D 8F 60	STA $608F  
0x01A66C|$06:$A65C:29 1F   	AND #$1F   
0x01A66E|$06:$A65E:8D 8B 60	STA $608B  
0x01A671|$06:$A661:A9 20   	LDA #$20   
0x01A673|$06:$A663:38      	SEC        
0x01A674|$06:$A664:ED 8B 60	SBC $608B  
0x01A677|$06:$A667:8D 8D 60	STA $608D  
0x01A67A|$06:$A66A:AD 7F 60	LDA $607F  
0x01A67D|$06:$A66D:38      	SEC        
0x01A67E|$06:$A66E:ED 8D 60	SBC $608D  
0x01A681|$06:$A671:8D 8E 60	STA $608E  
0x01A684|$06:$A674:F0 02   	BEQ $A678  
0x01A686|$06:$A676:B0 09   	BCS $A681  
; control flow target (from $A674)
0x01A688|$06:$A678:AD 7F 60	LDA $607F  
0x01A68B|$06:$A67B:8D 8D 60	STA $608D  
0x01A68E|$06:$A67E:4C A4 A6	JMP $A6A4  

; control flow target (from $A676)
0x01A691|$06:$A681:20 D6 A6	JSR $A6D6  
0x01A694|$06:$A684:AD 90 60	LDA $6090  
0x01A697|$06:$A687:49 04   	EOR #$04   
0x01A699|$06:$A689:8D 90 60	STA $6090  
0x01A69C|$06:$A68C:AD 8F 60	LDA $608F  
0x01A69F|$06:$A68F:29 1F   	AND #$1F   
0x01A6A1|$06:$A691:8D 8B 60	STA $608B  
0x01A6A4|$06:$A694:AD 8F 60	LDA $608F  
0x01A6A7|$06:$A697:38      	SEC        
0x01A6A8|$06:$A698:ED 8B 60	SBC $608B  
0x01A6AB|$06:$A69B:8D 8F 60	STA $608F  
0x01A6AE|$06:$A69E:AD 8E 60	LDA $608E  
0x01A6B1|$06:$A6A1:8D 8D 60	STA $608D  
; control flow target (from $A67E)
0x01A6B4|$06:$A6A4:20 D6 A6	JSR $A6D6  
0x01A6B7|$06:$A6A7:A5 08   	LDA $08    
0x01A6B9|$06:$A6A9:29 FB   	AND #$FB   
0x01A6BB|$06:$A6AB:C9 23   	CMP #$23   
0x01A6BD|$06:$A6AD:90 11   	BCC $A6C0  
0x01A6BF|$06:$A6AF:A5 07   	LDA $07    
0x01A6C1|$06:$A6B1:C9 A0   	CMP #$A0   
0x01A6C3|$06:$A6B3:90 0B   	BCC $A6C0  
0x01A6C5|$06:$A6B5:29 1F   	AND #$1F   
0x01A6C7|$06:$A6B7:85 07   	STA $07    
0x01A6C9|$06:$A6B9:A5 08   	LDA $08    
0x01A6CB|$06:$A6BB:29 FC   	AND #$FC   
0x01A6CD|$06:$A6BD:4C CB A6	JMP $A6CB  

; control flow target (from $A6AD, $A6B3)
0x01A6D0|$06:$A6C0:A5 07   	LDA $07    
0x01A6D2|$06:$A6C2:18      	CLC        
0x01A6D3|$06:$A6C3:69 20   	ADC #$20   
0x01A6D5|$06:$A6C5:85 07   	STA $07    
0x01A6D7|$06:$A6C7:A5 08   	LDA $08    
0x01A6D9|$06:$A6C9:69 00   	ADC #$00   
; control flow target (from $A6BD)
0x01A6DB|$06:$A6CB:85 08   	STA $08    
0x01A6DD|$06:$A6CD:CE 7E 60	DEC $607E  
0x01A6E0|$06:$A6D0:D0 80   	BNE $A652  
0x01A6E2|$06:$A6D2:8E 02 00	STX $0002  
0x01A6E5|$06:$A6D5:60      	RTS        

; control flow target (from $A681, $A6A4)
0x01A6E6|$06:$A6D6:AD 90 60	LDA $6090  
0x01A6E9|$06:$A6D9:09 80   	ORA #$80   
0x01A6EB|$06:$A6DB:9D 00 03	STA $0300,X	; PPU write buffer start
0x01A6EE|$06:$A6DE:AD 8D 60	LDA $608D  
0x01A6F1|$06:$A6E1:9D 01 03	STA $0301,X
0x01A6F4|$06:$A6E4:AD 8F 60	LDA $608F  
0x01A6F7|$06:$A6E7:9D 02 03	STA $0302,X
0x01A6FA|$06:$A6EA:E8      	INX        
0x01A6FB|$06:$A6EB:E8      	INX        
0x01A6FC|$06:$A6EC:E8      	INX        
0x01A6FD|$06:$A6ED:AD 8D 60	LDA $608D  
0x01A700|$06:$A6F0:48      	PHA        
0x01A701|$06:$A6F1:AC 81 60	LDY $6081  
; control flow target (from $A6FF)
0x01A704|$06:$A6F4:B9 0B 60	LDA $600B,Y
0x01A707|$06:$A6F7:9D 00 03	STA $0300,X	; PPU write buffer start
0x01A70A|$06:$A6FA:E8      	INX        
0x01A70B|$06:$A6FB:C8      	INY        
0x01A70C|$06:$A6FC:CE 8D 60	DEC $608D  
0x01A70F|$06:$A6FF:D0 F3   	BNE $A6F4  
0x01A711|$06:$A701:8C 81 60	STY $6081  
0x01A714|$06:$A704:68      	PLA        
0x01A715|$06:$A705:4A      	LSR        
0x01A716|$06:$A706:8D 8D 60	STA $608D  
0x01A719|$06:$A709:AD 7E 60	LDA $607E  
0x01A71C|$06:$A70C:29 01   	AND #$01   
0x01A71E|$06:$A70E:F0 4F   	BEQ $A75F  
0x01A720|$06:$A710:AC 82 60	LDY $6082  
0x01A723|$06:$A713:AD 90 60	LDA $6090  
0x01A726|$06:$A716:8D 98 60	STA $6098  
0x01A729|$06:$A719:AD 8F 60	LDA $608F  
0x01A72C|$06:$A71C:8D 97 60	STA $6097  
; control flow target (from $A75A)
0x01A72F|$06:$A71F:8A      	TXA        
0x01A730|$06:$A720:48      	PHA        
0x01A731|$06:$A721:98      	TYA        
0x01A732|$06:$A722:48      	PHA        
0x01A733|$06:$A723:AD 90 60	LDA $6090  
0x01A736|$06:$A726:48      	PHA        
0x01A737|$06:$A727:B9 6B 60	LDA $606B,Y
0x01A73A|$06:$A72A:20 89 A7	JSR $A789  
0x01A73D|$06:$A72D:8D 8B 60	STA $608B  
0x01A740|$06:$A730:68      	PLA        
0x01A741|$06:$A731:8D 90 60	STA $6090  
0x01A744|$06:$A734:68      	PLA        
0x01A745|$06:$A735:A8      	TAY        
0x01A746|$06:$A736:68      	PLA        
0x01A747|$06:$A737:AA      	TAX        
0x01A748|$06:$A738:AD 9A 60	LDA $609A  
0x01A74B|$06:$A73B:9D 00 03	STA $0300,X	; PPU write buffer start
0x01A74E|$06:$A73E:E8      	INX        
0x01A74F|$06:$A73F:AD 99 60	LDA $6099  
0x01A752|$06:$A742:9D 00 03	STA $0300,X	; PPU write buffer start
0x01A755|$06:$A745:E8      	INX        
0x01A756|$06:$A746:AD 8B 60	LDA $608B  
0x01A759|$06:$A749:9D 00 03	STA $0300,X	; PPU write buffer start
0x01A75C|$06:$A74C:E8      	INX        
0x01A75D|$06:$A74D:C8      	INY        
0x01A75E|$06:$A74E:EE 97 60	INC $6097  
0x01A761|$06:$A751:EE 97 60	INC $6097  
0x01A764|$06:$A754:EE 01 00	INC $0001  
0x01A767|$06:$A757:CE 8D 60	DEC $608D  
0x01A76A|$06:$A75A:D0 C3   	BNE $A71F  
0x01A76C|$06:$A75C:8C 82 60	STY $6082  
; control flow target (from $A70E)
0x01A76F|$06:$A75F:EE 01 00	INC $0001  
0x01A772|$06:$A762:60      	RTS        

; control flow target (from $A62E)
0x01A773|$06:$A763:48      	PHA        
0x01A774|$06:$A764:20 72 A7	JSR $A772  
0x01A777|$06:$A767:68      	PLA        
0x01A778|$06:$A768:D0 01   	BNE $A76B  
0x01A77A|$06:$A76A:60      	RTS        

; control flow target (from $A768)
0x01A77B|$06:$A76B:A5 08   	LDA $08    
0x01A77D|$06:$A76D:49 04   	EOR #$04   
0x01A77F|$06:$A76F:85 08   	STA $08    
0x01A781|$06:$A771:60      	RTS        

; control flow target (from $A764)
0x01A782|$06:$A772:AD 7C 60	LDA $607C  
0x01A785|$06:$A775:0A      	ASL        
0x01A786|$06:$A776:29 1E   	AND #$1E   
0x01A788|$06:$A778:8D 8B 60	STA $608B  
0x01A78B|$06:$A77B:AD 7C 60	LDA $607C  
0x01A78E|$06:$A77E:4A      	LSR        
0x01A78F|$06:$A77F:4A      	LSR        
0x01A790|$06:$A780:4A      	LSR        
0x01A791|$06:$A781:29 1E   	AND #$1E   
0x01A793|$06:$A783:8D 8C 60	STA $608C  
0x01A796|$06:$A786:4C 09 A8	JMP $A809  

; control flow target (from $A72A)
0x01A799|$06:$A789:8D 96 60	STA $6096  
0x01A79C|$06:$A78C:A9 1F   	LDA #$1F   
0x01A79E|$06:$A78E:2D 97 60	AND $6097  
0x01A7A1|$06:$A791:4A      	LSR        
0x01A7A2|$06:$A792:4A      	LSR        
0x01A7A3|$06:$A793:8D 90 60	STA $6090  
0x01A7A6|$06:$A796:A9 80   	LDA #$80   
0x01A7A8|$06:$A798:2D 97 60	AND $6097  
0x01A7AB|$06:$A79B:4A      	LSR        
0x01A7AC|$06:$A79C:4A      	LSR        
0x01A7AD|$06:$A79D:4A      	LSR        
0x01A7AE|$06:$A79E:4A      	LSR        
0x01A7AF|$06:$A79F:0D 90 60	ORA $6090  
0x01A7B2|$06:$A7A2:8D 90 60	STA $6090  
0x01A7B5|$06:$A7A5:A9 03   	LDA #$03   
0x01A7B7|$06:$A7A7:2D 98 60	AND $6098  
0x01A7BA|$06:$A7AA:0A      	ASL        
0x01A7BB|$06:$A7AB:0A      	ASL        
0x01A7BC|$06:$A7AC:0A      	ASL        
0x01A7BD|$06:$A7AD:0A      	ASL        
0x01A7BE|$06:$A7AE:09 C0   	ORA #$C0   
0x01A7C0|$06:$A7B0:0D 90 60	ORA $6090  
0x01A7C3|$06:$A7B3:8D 99 60	STA $6099  
0x01A7C6|$06:$A7B6:A2 23   	LDX #$23   
0x01A7C8|$06:$A7B8:AD 98 60	LDA $6098  
0x01A7CB|$06:$A7BB:C9 24   	CMP #$24   
0x01A7CD|$06:$A7BD:90 02   	BCC $A7C1  
0x01A7CF|$06:$A7BF:A2 27   	LDX #$27   
; control flow target (from $A7BD)
0x01A7D1|$06:$A7C1:8E 9A 60	STX $609A  
0x01A7D4|$06:$A7C4:AD 97 60	LDA $6097  
0x01A7D7|$06:$A7C7:29 40   	AND #$40   
0x01A7D9|$06:$A7C9:4A      	LSR        
0x01A7DA|$06:$A7CA:4A      	LSR        
0x01A7DB|$06:$A7CB:4A      	LSR        
0x01A7DC|$06:$A7CC:4A      	LSR        
0x01A7DD|$06:$A7CD:8D 93 60	STA $6093  
0x01A7E0|$06:$A7D0:AD 97 60	LDA $6097  
0x01A7E3|$06:$A7D3:29 02   	AND #$02   
0x01A7E5|$06:$A7D5:0D 93 60	ORA $6093  
0x01A7E8|$06:$A7D8:8D 93 60	STA $6093  
0x01A7EB|$06:$A7DB:AD 99 60	LDA $6099  
0x01A7EE|$06:$A7DE:85 57   	STA $57    	; pointer to start of main pointer table, low byte
0x01A7F0|$06:$A7E0:AD 9A 60	LDA $609A  
0x01A7F3|$06:$A7E3:29 07   	AND #$07   
0x01A7F5|$06:$A7E5:85 58   	STA $58    	; pointer to start of main pointer table, high byte
0x01A7F7|$06:$A7E7:A0 00   	LDY #$00   
0x01A7F9|$06:$A7E9:B1 57   	LDA ($57),Y	; pointer to start of main pointer table, low byte
0x01A7FB|$06:$A7EB:8D 94 60	STA $6094  
0x01A7FE|$06:$A7EE:A9 03   	LDA #$03   
0x01A800|$06:$A7F0:AC 93 60	LDY $6093  
0x01A803|$06:$A7F3:F0 07   	BEQ $A7FC  
; control flow target (from $A7FA)
0x01A805|$06:$A7F5:0A      	ASL        
0x01A806|$06:$A7F6:0E 96 60	ASL $6096  
0x01A809|$06:$A7F9:88      	DEY        
0x01A80A|$06:$A7FA:D0 F9   	BNE $A7F5  
; control flow target (from $A7F3)
0x01A80C|$06:$A7FC:49 FF   	EOR #$FF   
0x01A80E|$06:$A7FE:2D 94 60	AND $6094  
0x01A811|$06:$A801:0D 96 60	ORA $6096  
0x01A814|$06:$A804:A0 00   	LDY #$00   
0x01A816|$06:$A806:91 57   	STA ($57),Y	; pointer to start of main pointer table, low byte
0x01A818|$06:$A808:60      	RTS        

; from $02:$B74E, $06:$B0A8, $0F:$FD25, $0F:$FD98 via $8002
; control flow target (from $A786, $AF70)
; indirect control flow target (via $8002)
0x01A819|$06:$A809:A5 04   	LDA $04    
0x01A81B|$06:$A80B:0A      	ASL        
0x01A81C|$06:$A80C:0A      	ASL        
0x01A81D|$06:$A80D:29 04   	AND #$04   
0x01A81F|$06:$A80F:09 20   	ORA #$20   
0x01A821|$06:$A811:85 08   	STA $08    
0x01A823|$06:$A813:AD 8B 60	LDA $608B  
0x01A826|$06:$A816:0A      	ASL        
0x01A827|$06:$A817:0A      	ASL        
0x01A828|$06:$A818:0A      	ASL        
0x01A829|$06:$A819:18      	CLC        
0x01A82A|$06:$A81A:65 05   	ADC $05    
0x01A82C|$06:$A81C:85 07   	STA $07    
0x01A82E|$06:$A81E:90 06   	BCC $A826  
0x01A830|$06:$A820:A5 08   	LDA $08    
0x01A832|$06:$A822:49 04   	EOR #$04   
0x01A834|$06:$A824:85 08   	STA $08    
; control flow target (from $A81E)
0x01A836|$06:$A826:A5 06   	LDA $06    
0x01A838|$06:$A828:4A      	LSR        
0x01A839|$06:$A829:4A      	LSR        
0x01A83A|$06:$A82A:4A      	LSR        
0x01A83B|$06:$A82B:18      	CLC        
0x01A83C|$06:$A82C:6D 8C 60	ADC $608C  
0x01A83F|$06:$A82F:C9 1E   	CMP #$1E   
0x01A841|$06:$A831:90 02   	BCC $A835  
0x01A843|$06:$A833:E9 1E   	SBC #$1E   
; control flow target (from $A831)
0x01A845|$06:$A835:4A      	LSR        
0x01A846|$06:$A836:66 07   	ROR $07    
0x01A848|$06:$A838:4A      	LSR        
0x01A849|$06:$A839:66 07   	ROR $07    
0x01A84B|$06:$A83B:4A      	LSR        
0x01A84C|$06:$A83C:66 07   	ROR $07    
0x01A84E|$06:$A83E:05 08   	ORA $08    
0x01A850|$06:$A840:85 08   	STA $08    
0x01A852|$06:$A842:60      	RTS        

; display and handle main game menu
; from $0F:$C6C7 via $8004
; indirect control flow target (via $8004)
0x01A853|$06:$A843:A9 0C   	LDA #$0C   	; Music ID #$0C: game menu / Wellgarth singer BGM
0x01A855|$06:$A845:8D F7 05	STA $05F7  	; probably BGM for current area
; call to code in a different bank ($0F:$D14F)
0x01A858|$06:$A848:20 4F D1	JSR $D14F  
0x01A85B|$06:$A84B:A9 00   	LDA #$00   	; Music ID #$00: BGM off
0x01A85D|$06:$A84D:8D F7 05	STA $05F7  	; probably BGM for current area
0x01A860|$06:$A850:20 CA A8	JSR $A8CA  
; control flow target (from $A85C)
0x01A863|$06:$A853:20 7E A9	JSR $A97E  
; control flow target (from $A9CC)
0x01A866|$06:$A856:20 A3 A9	JSR $A9A3  	; open apporpriate main game menu based on number of filled save slots, set $75DB = #$0A, #$05, or #$00 based on number of filled slots, return menu selection index in A
0x01A869|$06:$A859:20 CF A9	JSR $A9CF  
0x01A86C|$06:$A85C:4C 53 A8	JMP $A853  

; from $0F:$D15F via $8008
; indirect control flow target (via $8008)
0x01A86F|$06:$A85F:A9 19   	LDA #$19   	; Menu ID #$19: General menu: YES/NO
0x01A871|$06:$A861:20 93 A9	JSR $A993  	; open menu specified by A
0x01A874|$06:$A864:AA      	TAX        
0x01A875|$06:$A865:D0 0D   	BNE $A874  	; branch if NO
0x01A877|$06:$A867:A9 FF   	LDA #$FF   
0x01A879|$06:$A869:8D 70 70	STA $7070  	; ????, SRAM buffer
0x01A87C|$06:$A86C:20 85 A8	JSR $A885  	; copy save data from system RAM to per-game save data
0x01A87F|$06:$A86F:A9 78   	LDA #$78   	; String ID #$0078: ‘I have entered thy deeds in the Imperial Scrolls of Honor[.’][wait][end-FC]
0x01A881|$06:$A871:20 9B A9	JSR $A99B  	; display string ID specified by A
; control flow target (from $A865)
0x01A884|$06:$A874:A9 79   	LDA #$79   	; String ID #$0079: ‘Dost thou wish to continue thy quest?’[FD][FD][end-FC]
0x01A886|$06:$A876:20 9B A9	JSR $A99B  	; display string ID specified by A
0x01A889|$06:$A879:A9 19   	LDA #$19   	; Menu ID #$19: General menu: YES/NO
0x01A88B|$06:$A87B:20 93 A9	JSR $A993  	; open menu specified by A
0x01A88E|$06:$A87E:AA      	TAX        
0x01A88F|$06:$A87F:D0 01   	BNE $A882  	; branch if NO
0x01A891|$06:$A881:60      	RTS        

; control flow target (from $A87F)
; call to code in a different bank ($0F:$D175)
0x01A892|$06:$A882:4C 75 D1	JMP $D175  

; copy save data from system RAM to per-game save data
; from $0F:$C6DA via $801E
; control flow target (from $A86C)
; indirect control flow target (via $801E)
0x01A895|$06:$A885:20 3C AC	JSR $AC3C  	; copy save data from system RAM to $7000-$706F
0x01A898|$06:$A888:20 AD AC	JSR $ACAD  	; initialize the RNG based on 71 passes using SRAM data $7000-$7070 and save resulting seed to $7071-$7072
0x01A89B|$06:$A88B:20 87 AB	JSR $AB87  	; copy data from SRAM buffer to per-game save data
0x01A89E|$06:$A88E:60      	RTS        

; copy Midenhall's short name from save slot in A to $0100 in reverse
; from $0F:$EE7E via $801C
; indirect control flow target (via $801C)
0x01A89F|$06:$A88F:20 F5 A9	JSR $A9F5  	; given save slot number in A, set $99-$9A to pointer to second part of save slot data
0x01A8A2|$06:$A892:A0 03   	LDY #$03   	; copy 4 bytes
0x01A8A4|$06:$A894:D0 08   	BNE $A89E  
; copy Midenhall's full name from save slot in $75DB to $0100 in reverse
; from $0F:$EF5B via $800A
; indirect control flow target (via $800A)
0x01A8A6|$06:$A896:AD DB 75	LDA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01A8A9|$06:$A899:20 F5 A9	JSR $A9F5  	; given save slot number in A, set $99-$9A to pointer to second part of save slot data
0x01A8AC|$06:$A89C:A0 07   	LDY #$07   	; copy 8 bytes
; control flow target (from $A894)
0x01A8AE|$06:$A89E:A2 00   	LDX #$00   
; control flow target (from $A8A7)
0x01A8B0|$06:$A8A0:B1 99   	LDA ($99),Y
0x01A8B2|$06:$A8A2:9D 00 01	STA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x01A8B5|$06:$A8A5:E8      	INX        
0x01A8B6|$06:$A8A6:88      	DEY        
0x01A8B7|$06:$A8A7:10 F7   	BPL $A8A0  
0x01A8B9|$06:$A8A9:60      	RTS        

; given current game save slot in $75DB, return Midenhall's level in that save game in A/$0E
; indirect control flow target (via $800C)
0x01A8BA|$06:$A8AA:AD DB 75	LDA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01A8BD|$06:$A8AD:20 F5 A9	JSR $A9F5  	; given save slot number in A, set $99-$9A to pointer to second part of save slot data
0x01A8C0|$06:$A8B0:A0 08   	LDY #$08   	; offset for Midenhall's level
0x01A8C2|$06:$A8B2:B1 99   	LDA ($99),Y
0x01A8C4|$06:$A8B4:85 0E   	STA $0E    
0x01A8C6|$06:$A8B6:60      	RTS        

; indirect control flow target (via $800E)
0x01A8C7|$06:$A8B7:20 F5 A9	JSR $A9F5  	; given save slot number in A, set $99-$9A to pointer to second part of save slot data
0x01A8CA|$06:$A8BA:A2 02   	LDX #$02   
0x01A8CC|$06:$A8BC:A0 09   	LDY #$09   
0x01A8CE|$06:$A8BE:B1 99   	LDA ($99),Y
0x01A8D0|$06:$A8C0:30 06   	BMI $A8C8  
0x01A8D2|$06:$A8C2:C9 46   	CMP #$46   
0x01A8D4|$06:$A8C4:F0 01   	BEQ $A8C7  
0x01A8D6|$06:$A8C6:CA      	DEX        
; control flow target (from $A8C4)
0x01A8D7|$06:$A8C7:CA      	DEX        
; control flow target (from $A8C0)
0x01A8D8|$06:$A8C8:8A      	TXA        
0x01A8D9|$06:$A8C9:60      	RTS        

; control flow target (from $A850)
0x01A8DA|$06:$A8CA:A2 05   	LDX #$05   
; control flow target (from $A8DF)
0x01A8DC|$06:$A8CC:BD B9 AD	LDA $ADB9,X
0x01A8DF|$06:$A8CF:DD FA 75	CMP $75FA,X
0x01A8E2|$06:$A8D2:F0 0A   	BEQ $A8DE  
0x01A8E4|$06:$A8D4:DD 01 60	CMP $6001,X
0x01A8E7|$06:$A8D7:F0 05   	BEQ $A8DE  
0x01A8E9|$06:$A8D9:DD A7 61	CMP $61A7,X
0x01A8EC|$06:$A8DC:D0 05   	BNE $A8E3  
; control flow target (from $A8D2, $A8D7)
0x01A8EE|$06:$A8DE:CA      	DEX        
0x01A8EF|$06:$A8DF:10 EB   	BPL $A8CC  
0x01A8F1|$06:$A8E1:30 36   	BMI $A919  
; control flow target (from $A8DC)
0x01A8F3|$06:$A8E3:AD F4 AD	LDA $ADF4  
0x01A8F6|$06:$A8E6:8D 99 00	STA $0099  
0x01A8F9|$06:$A8E9:AD F5 AD	LDA $ADF5  
0x01A8FC|$06:$A8EC:8D 9A 00	STA $009A  
0x01A8FF|$06:$A8EF:A2 0D   	LDX #$0D   
; control flow target (from $A908)
0x01A901|$06:$A8F1:A0 72   	LDY #$72   
0x01A903|$06:$A8F3:A9 00   	LDA #$00   
; control flow target (from $A8F8)
0x01A905|$06:$A8F5:91 99   	STA ($99),Y
0x01A907|$06:$A8F7:88      	DEY        
0x01A908|$06:$A8F8:10 FB   	BPL $A8F5  
0x01A90A|$06:$A8FA:38      	SEC        
0x01A90B|$06:$A8FB:A5 99   	LDA $99    
0x01A90D|$06:$A8FD:E9 73   	SBC #$73   
0x01A90F|$06:$A8FF:85 99   	STA $99    
0x01A911|$06:$A901:A5 9A   	LDA $9A    
0x01A913|$06:$A903:E9 00   	SBC #$00   
0x01A915|$06:$A905:85 9A   	STA $9A    
0x01A917|$06:$A907:CA      	DEX        
0x01A918|$06:$A908:D0 E7   	BNE $A8F1  
0x01A91A|$06:$A90A:A9 00   	LDA #$00   
0x01A91C|$06:$A90C:8D DA 75	STA $75DA  	; bit field for which save game slots are filled
0x01A91F|$06:$A90F:A2 02   	LDX #$02   
0x01A921|$06:$A911:A9 FF   	LDA #$FF   
; control flow target (from $A917)
0x01A923|$06:$A913:9D D7 75	STA $75D7,X	; save slot 1 status (write-only?)
0x01A926|$06:$A916:CA      	DEX        
0x01A927|$06:$A917:10 FA   	BPL $A913  
; control flow target (from $A8E1)
0x01A929|$06:$A919:A2 05   	LDX #$05   
; control flow target (from $A928)
0x01A92B|$06:$A91B:BD B9 AD	LDA $ADB9,X
0x01A92E|$06:$A91E:9D FA 75	STA $75FA,X
0x01A931|$06:$A921:9D 01 60	STA $6001,X
0x01A934|$06:$A924:9D A7 61	STA $61A7,X
0x01A937|$06:$A927:CA      	DEX        
0x01A938|$06:$A928:10 F1   	BPL $A91B  
0x01A93A|$06:$A92A:A9 00   	LDA #$00   
0x01A93C|$06:$A92C:8D DB 75	STA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
; control flow target (from $A973)
0x01A93F|$06:$A92F:AE DB 75	LDX $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01A942|$06:$A932:AD DA 75	LDA $75DA  	; bit field for which save game slots are filled
; control flow target (from $A937)
0x01A945|$06:$A935:4A      	LSR        
0x01A946|$06:$A936:CA      	DEX        
0x01A947|$06:$A937:10 FC   	BPL $A935  
0x01A949|$06:$A939:90 30   	BCC $A96B  
0x01A94B|$06:$A93B:20 44 AB	JSR $AB44  	; copy current save game's data to save data buffer at $7000; CLC if data is valid, SEC if it's unrecoverable
0x01A94E|$06:$A93E:90 28   	BCC $A968  
0x01A950|$06:$A940:AE DB 75	LDX $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01A953|$06:$A943:A9 FD   	LDA #$FD   
0x01A955|$06:$A945:9D D7 75	STA $75D7,X	; save slot 1 status (write-only?)
0x01A958|$06:$A948:E8      	INX        
0x01A959|$06:$A949:86 8F   	STX $8F    
0x01A95B|$06:$A94B:A9 00   	LDA #$00   
0x01A95D|$06:$A94D:85 90   	STA $90    
0x01A95F|$06:$A94F:A9 04   	LDA #$04   	; Menu ID #$04: Dialogue window
0x01A961|$06:$A951:20 93 A9	JSR $A993  	; open menu specified by A
0x01A964|$06:$A954:A9 0A   	LDA #$0A   	; Music ID #$0A: cursed BGM
; call to code in a different bank ($0F:$C58D)
0x01A966|$06:$A956:20 8D C5	JSR $C58D  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM]), wait for it to finish, then play previous BGM
0x01A969|$06:$A959:E6 8E   	INC $8E    	; flag for in battle or not (#$FF)?
0x01A96B|$06:$A95B:A9 77   	LDA #$77   	; String ID #$0077: [no voice]I'm afraid that[line][no voice]scenario [number] was not[line][no voice]recorded in the[line][no voice]Imperial Scrolls of[line][no voice]Honor.[end-FC]
0x01A96D|$06:$A95D:20 9B A9	JSR $A99B  	; display string ID specified by A
0x01A970|$06:$A960:E6 8E   	INC $8E    	; flag for in battle or not (#$FF)?
0x01A972|$06:$A962:20 76 A9	JSR $A976  	; wait for controller input
0x01A975|$06:$A965:20 EB AA	JSR $AAEB  
; control flow target (from $A93E)
0x01A978|$06:$A968:20 02 AA	JSR $AA02  	; copy more data to second part of per-game save data
; control flow target (from $A939)
0x01A97B|$06:$A96B:EE DB 75	INC $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01A97E|$06:$A96E:AD DB 75	LDA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01A981|$06:$A971:C9 03   	CMP #$03   
0x01A983|$06:$A973:90 BA   	BCC $A92F  
0x01A985|$06:$A975:60      	RTS        

; wait for controller input
; control flow target (from $A962, $A97B)
; call to code in a different bank ($0F:$C476)
0x01A986|$06:$A976:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x01A989|$06:$A979:A5 2F   	LDA $2F    	; joypad 1 data
0x01A98B|$06:$A97B:F0 F9   	BEQ $A976  	; wait for controller input
0x01A98D|$06:$A97D:60      	RTS        

; control flow target (from $A853)
; call to code in a different bank ($0F:$C42A)
0x01A98E|$06:$A97E:20 2A C4	JSR $C42A  
; call to code in a different bank ($0F:$C446)
0x01A991|$06:$A981:20 46 C4	JSR $C446  	; turn screen off, write $800 [space] tiles to PPU $2000, turn screen on
; call to code in a different bank ($0F:$C1DC)
0x01A994|$06:$A984:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x01A997|$06:$A987:A9 80   	LDA #$80   
0x01A999|$06:$A989:8D 07 60	STA $6007  
; call to code in a different bank ($0F:$C41C)
0x01A99C|$06:$A98C:20 1C C4	JSR $C41C  	; wait for interrupt, turn screen sprites and backround on
; call to code in a different bank ($0F:$D14F)
0x01A99F|$06:$A98F:20 4F D1	JSR $D14F  
0x01A9A2|$06:$A992:60      	RTS        

; open menu specified by A
; control flow target (from $A861, $A87B, $A951, $A9C2, $AA76, $AAFE, $AB03, $AB1C)
0x01A9A3|$06:$A993:A2 06   	LDX #$06   
0x01A9A5|$06:$A995:86 94   	STX $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
; call to code in a different bank ($0F:$EB89)
0x01A9A7|$06:$A997:20 89 EB	JSR $EB89  	; open menu specified by A
0x01A9AA|$06:$A99A:60      	RTS        	; JMP > JSR + RTS

; display string ID specified by A
; control flow target (from $A871, $A876, $A95D)
0x01A9AB|$06:$A99B:A2 06   	LDX #$06   
0x01A9AD|$06:$A99D:86 94   	STX $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
; call to code in a different bank ($0F:$FA4A)
0x01A9AF|$06:$A99F:20 4A FA	JSR $FA4A  	; display string ID specified by A
0x01A9B2|$06:$A9A2:60      	RTS        

; open apporpriate main game menu based on number of filled save slots, set $75DB = #$0A, #$05, or #$00 based on number of filled slots, return menu selection index in A
; control flow target (from $A856)
0x01A9B3|$06:$A9A3:A2 02   	LDX #$02   
0x01A9B5|$06:$A9A5:AD DA 75	LDA $75DA  	; bit field for which save game slots are filled
0x01A9B8|$06:$A9A8:29 07   	AND #$07   
0x01A9BA|$06:$A9AA:F0 06   	BEQ $A9B2  	; 0 slots filled => use X = #$02
0x01A9BC|$06:$A9AC:C9 07   	CMP #$07   
0x01A9BE|$06:$A9AE:D0 01   	BNE $A9B1  	; 1-2 slots filled => use X = #$01
0x01A9C0|$06:$A9B0:CA      	DEX        	; 3 slots filled => use X = #$00
; control flow target (from $A9AE)
0x01A9C1|$06:$A9B1:CA      	DEX        
; control flow target (from $A9AA)
0x01A9C2|$06:$A9B2:8A      	TXA        
0x01A9C3|$06:$A9B3:8D DB 75	STA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values; base index into main game menu handlers
0x01A9C6|$06:$A9B6:0A      	ASL        
0x01A9C7|$06:$A9B7:0A      	ASL        
0x01A9C8|$06:$A9B8:6D DB 75	ADC $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values; base index into main game menu handlers
0x01A9CB|$06:$A9BB:8D DB 75	STA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values; base index into main game menu handlers
0x01A9CE|$06:$A9BE:8A      	TXA        
0x01A9CF|$06:$A9BF:18      	CLC        
0x01A9D0|$06:$A9C0:69 32   	ADC #$32   	; Menu ID #$32 - #$34: Game menu: 3, 1-2, or 0 saves
0x01A9D2|$06:$A9C2:20 93 A9	JSR $A993  	; open menu specified by A
0x01A9D5|$06:$A9C5:C9 FF   	CMP #$FF   
0x01A9D7|$06:$A9C7:F0 01   	BEQ $A9CA  
0x01A9D9|$06:$A9C9:60      	RTS        

; control flow target (from $A9C7)
0x01A9DA|$06:$A9CA:68      	PLA        
0x01A9DB|$06:$A9CB:68      	PLA        
0x01A9DC|$06:$A9CC:4C 56 A8	JMP $A856  

; control flow target (from $A859)
0x01A9DF|$06:$A9CF:18      	CLC        
0x01A9E0|$06:$A9D0:6D DB 75	ADC $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values; base index into main game menu handlers
0x01A9E3|$06:$A9D3:AA      	TAX        
0x01A9E4|$06:$A9D4:BD D7 AD	LDA $ADD7,X	; index into jump table at $ADE2
0x01A9E7|$06:$A9D7:0A      	ASL        
0x01A9E8|$06:$A9D8:AA      	TAX        
0x01A9E9|$06:$A9D9:BD E2 AD	LDA $ADE2,X	; jump table for main game menu handlers
0x01A9EC|$06:$A9DC:85 99   	STA $99    
0x01A9EE|$06:$A9DE:BD E3 AD	LDA $ADE3,X
0x01A9F1|$06:$A9E1:85 9A   	STA $9A    
0x01A9F3|$06:$A9E3:6C 99 00	JMP ($0099)

0x01A9F6|$06:$A9E6:A8      	TAY        
0x01A9F7|$06:$A9E7:A2 00   	LDX #$00   
0x01A9F9|$06:$A9E9:AD DA 75	LDA $75DA  	; bit field for which save game slots are filled
; control flow target (from $A9EE, $A9F1)
0x01A9FC|$06:$A9EC:E8      	INX        
0x01A9FD|$06:$A9ED:4A      	LSR        
0x01A9FE|$06:$A9EE:90 FC   	BCC $A9EC  
0x01AA00|$06:$A9F0:88      	DEY        
0x01AA01|$06:$A9F1:10 F9   	BPL $A9EC  
0x01AA03|$06:$A9F3:CA      	DEX        
0x01AA04|$06:$A9F4:8A      	TXA        
; given save slot number in A, set $99-$9A to pointer to second part of save slot data
; control flow target (from $A88F, $A899, $A8AD, $A8B7, $AA05)
0x01AA05|$06:$A9F5:0A      	ASL        
0x01AA06|$06:$A9F6:AA      	TAX        
0x01AA07|$06:$A9F7:BD F6 AD	LDA $ADF6,X
0x01AA0A|$06:$A9FA:85 99   	STA $99    
0x01AA0C|$06:$A9FC:BD F7 AD	LDA $ADF7,X
0x01AA0F|$06:$A9FF:85 9A   	STA $9A    
0x01AA11|$06:$AA01:60      	RTS        

; copy more data to second part of per-game save data
; control flow target (from $A968, $AB8C)
0x01AA12|$06:$AA02:AD DB 75	LDA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01AA15|$06:$AA05:20 F5 A9	JSR $A9F5  	; given save slot number in A, set $99-$9A to pointer to second part of save slot data
0x01AA18|$06:$AA08:A0 09   	LDY #$09   
0x01AA1A|$06:$AA0A:AD 6F 70	LDA $706F  	; current battle message delay, SRAM buffer
0x01AA1D|$06:$AA0D:91 99   	STA ($99),Y
0x01AA1F|$06:$AA0F:88      	DEY        
0x01AA20|$06:$AA10:AD 26 70	LDA $7026  
0x01AA23|$06:$AA13:91 99   	STA ($99),Y
0x01AA25|$06:$AA15:A2 03   	LDX #$03   
; control flow target (from $AA1E)
0x01AA27|$06:$AA17:88      	DEY        
0x01AA28|$06:$AA18:BD 63 70	LDA $7063,X	; party names, bytes 4-7, SRAM buffer
0x01AA2B|$06:$AA1B:91 99   	STA ($99),Y
0x01AA2D|$06:$AA1D:CA      	DEX        
0x01AA2E|$06:$AA1E:10 F7   	BPL $AA17  
0x01AA30|$06:$AA20:88      	DEY        
; control flow target (from $AA27)
0x01AA31|$06:$AA21:B9 09 70	LDA $7009,Y	; Midenhall name bytes 0-3, SRAM buffer
0x01AA34|$06:$AA24:91 99   	STA ($99),Y
0x01AA36|$06:$AA26:88      	DEY        
0x01AA37|$06:$AA27:10 F8   	BPL $AA21  
0x01AA39|$06:$AA29:60      	RTS        

; mark save game slot specified by $75DB as filled
; control flow target (from $AAAE, $AAD3)
0x01AA3A|$06:$AA2A:38      	SEC        
0x01AA3B|$06:$AA2B:A9 00   	LDA #$00   
0x01AA3D|$06:$AA2D:AE DB 75	LDX $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
; control flow target (from $AA32)
0x01AA40|$06:$AA30:2A      	ROL        
0x01AA41|$06:$AA31:CA      	DEX        
0x01AA42|$06:$AA32:10 FC   	BPL $AA30  	; keep shifting that 1 set bit until it's in the right position
0x01AA44|$06:$AA34:0D DA 75	ORA $75DA  	; bit field for which save game slots are filled
0x01AA47|$06:$AA37:8D DA 75	STA $75DA  	; bit field for which save game slots are filled
0x01AA4A|$06:$AA3A:60      	RTS        

; mark save game slot specified by $75DB as empty
; control flow target (from $AAEB)
0x01AA4B|$06:$AA3B:18      	CLC        
0x01AA4C|$06:$AA3C:A9 FF   	LDA #$FF   
0x01AA4E|$06:$AA3E:AE DB 75	LDX $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
; control flow target (from $AA43)
0x01AA51|$06:$AA41:2A      	ROL        
0x01AA52|$06:$AA42:CA      	DEX        
0x01AA53|$06:$AA43:10 FC   	BPL $AA41  	; keep shifting that 1 clear bit until it's in the right position
0x01AA55|$06:$AA45:2D DA 75	AND $75DA  	; bit field for which save game slots are filled
0x01AA58|$06:$AA48:8D DA 75	STA $75DA  	; bit field for which save game slots are filled
0x01AA5B|$06:$AA4B:60      	RTS        

; set $75D7,$75DB to #$FF (useless op?)
; control flow target (from $AAB1, $AAD6)
0x01AA5C|$06:$AA4C:A9 FF   	LDA #$FF   
0x01AA5E|$06:$AA4E:AE DB 75	LDX $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01AA61|$06:$AA51:9D D7 75	STA $75D7,X	; save slot 1 status (write-only?)
0x01AA64|$06:$AA54:60      	RTS        

; CONTINUE A QUEST handler
; indirect control flow target (via $ADE2)
0x01AA65|$06:$AA55:20 0C AB	JSR $AB0C  	; display filled slots selection menu, set A/$75DB to selected slot
0x01AA68|$06:$AA58:20 44 AB	JSR $AB44  	; copy current save game's data to save data buffer at $7000; CLC if data is valid, SEC if it's unrecoverable
0x01AA6B|$06:$AA5B:20 C7 AB	JSR $ABC7  	; copy save data from save data buffer at $7000 to system RAM; update Don Mahone quest status if applicable
; control flow target (from $AABA)
0x01AA6E|$06:$AA5E:68      	PLA        
0x01AA6F|$06:$AA5F:68      	PLA        
; call to code in a different bank ($0F:$C577)
0x01AA70|$06:$AA60:20 77 C5	JSR $C577  	; set $6144 to #$05
0x01AA73|$06:$AA63:60      	RTS        

; CHANGE MESSAGE SPEED handler
; indirect control flow target (via $ADE4)
0x01AA74|$06:$AA64:20 0C AB	JSR $AB0C  	; display filled slots selection menu, set A/$75DB to selected slot
0x01AA77|$06:$AA67:20 44 AB	JSR $AB44  	; copy current save game's data to save data buffer at $7000; CLC if data is valid, SEC if it's unrecoverable
0x01AA7A|$06:$AA6A:20 6E AA	JSR $AA6E  	; display Menu ID #$45: Game menu: select message speed, update message speed based on new selection
0x01AA7D|$06:$AA6D:60      	RTS        

; display Menu ID #$45: Game menu: select message speed, update message speed based on new selection
; control flow target (from $AA6A, $AAA9)
0x01AA7E|$06:$AA6E:AD 6F 70	LDA $706F  	; current battle message delay, SRAM buffer
0x01AA81|$06:$AA71:8D 2C 06	STA $062C  	; current battle message delay
0x01AA84|$06:$AA74:A9 45   	LDA #$45   	; Menu ID #$45: Game menu: select message speed
0x01AA86|$06:$AA76:20 93 A9	JSR $A993  	; open menu specified by A
0x01AA89|$06:$AA79:C9 FF   	CMP #$FF   
0x01AA8B|$06:$AA7B:F0 12   	BEQ $AA8F  	; pop JSR return address and RTS back to to display and handle main game menu
0x01AA8D|$06:$AA7D:AA      	TAX        
0x01AA8E|$06:$AA7E:BD BF AD	LDA $ADBF,X	; battle message delays (frames between prints; higher = slower)
0x01AA91|$06:$AA81:8D 6F 70	STA $706F  	; current battle message delay, SRAM buffer
0x01AA94|$06:$AA84:8D 2C 06	STA $062C  	; current battle message delay
0x01AA97|$06:$AA87:20 AD AC	JSR $ACAD  	; initialize the RNG based on 71 passes using SRAM data $7000-$7070 and save resulting seed to $7071-$7072
0x01AA9A|$06:$AA8A:20 87 AB	JSR $AB87  	; copy data from SRAM buffer to per-game save data
0x01AA9D|$06:$AA8D:18      	CLC        
0x01AA9E|$06:$AA8E:60      	RTS        

; pop JSR return address and RTS back to to display and handle main game menu
; control flow target (from $AA7B)
0x01AA9F|$06:$AA8F:68      	PLA        
0x01AAA0|$06:$AA90:68      	PLA        
0x01AAA1|$06:$AA91:38      	SEC        
0x01AAA2|$06:$AA92:60      	RTS        

; BEGIN A NEW QUEST handler
; indirect control flow target (via $ADE6)
0x01AAA3|$06:$AA93:A9 00   	LDA #$00   
0x01AAA5|$06:$AA95:8D 70 70	STA $7070  	; ????, SRAM buffer
0x01AAA8|$06:$AA98:20 15 AB	JSR $AB15  	; display empty slots selection menu, set A/$75DB to selected slot
0x01AAAB|$06:$AA9B:20 CD AC	JSR $ACCD  
0x01AAAE|$06:$AA9E:20 C0 AA	JSR $AAC0  	; if $0100 is [space], pop JSR return address and RTS back to to display and handle main game menu
0x01AAB1|$06:$AAA1:A9 46   	LDA #$46   	; NORMAL
0x01AAB3|$06:$AAA3:8D 2C 06	STA $062C  	; current battle message delay
0x01AAB6|$06:$AAA6:8D 6F 70	STA $706F  	; current battle message delay, SRAM buffer
0x01AAB9|$06:$AAA9:20 6E AA	JSR $AA6E  	; display Menu ID #$45: Game menu: select message speed, update message speed based on new selection
0x01AABC|$06:$AAAC:B0 0F   	BCS $AABD  	; impossible branch; if $AA6E finishes with SEC, it also popped its return address, so control flow does not end up here
0x01AABE|$06:$AAAE:20 2A AA	JSR $AA2A  	; mark save game slot specified by $75DB as filled
0x01AAC1|$06:$AAB1:20 4C AA	JSR $AA4C  	; set $75D7,$75DB to #$FF (useless op?)
0x01AAC4|$06:$AAB4:20 AD AC	JSR $ACAD  	; initialize the RNG based on 71 passes using SRAM data $7000-$7070 and save resulting seed to $7071-$7072
0x01AAC7|$06:$AAB7:20 87 AB	JSR $AB87  	; copy data from SRAM buffer to per-game save data
0x01AACA|$06:$AABA:4C 5E AA	JMP $AA5E  

; pop JSR return address and RTS back to to display and handle main game menu
; control flow target (from $AAAC)
0x01AACD|$06:$AABD:68      	PLA        
0x01AACE|$06:$AABE:68      	PLA        
0x01AACF|$06:$AABF:60      	RTS        

; if $0100 is [space], pop JSR return address and RTS back to to display and handle main game menu
; control flow target (from $AA9E)
0x01AAD0|$06:$AAC0:AD 00 01	LDA $0100  	; string copy buffer start (often referenced as $00FF,X)
0x01AAD3|$06:$AAC3:C9 5F   	CMP #$5F   	; Tile ID #$5F: [space]
0x01AAD5|$06:$AAC5:D0 02   	BNE $AAC9  
0x01AAD7|$06:$AAC7:68      	PLA        
0x01AAD8|$06:$AAC8:68      	PLA        
; control flow target (from $AAC5)
0x01AAD9|$06:$AAC9:60      	RTS        

; COPY A QUEST handler
; indirect control flow target (via $ADE8)
0x01AADA|$06:$AACA:20 0C AB	JSR $AB0C  	; display filled slots selection menu, set A/$75DB to selected slot
0x01AADD|$06:$AACD:20 44 AB	JSR $AB44  	; copy current save game's data to save data buffer at $7000; CLC if data is valid, SEC if it's unrecoverable
0x01AAE0|$06:$AAD0:20 15 AB	JSR $AB15  	; display empty slots selection menu, set A/$75DB to selected slot
0x01AAE3|$06:$AAD3:20 2A AA	JSR $AA2A  	; mark save game slot specified by $75DB as filled
0x01AAE6|$06:$AAD6:20 4C AA	JSR $AA4C  	; set $75D7,$75DB to #$FF (useless op?)
0x01AAE9|$06:$AAD9:20 87 AB	JSR $AB87  	; copy data from SRAM buffer to per-game save data
0x01AAEC|$06:$AADC:60      	RTS        

; ERASE A QUEST handler
; indirect control flow target (via $ADEA)
0x01AAED|$06:$AADD:20 0C AB	JSR $AB0C  	; display filled slots selection menu, set A/$75DB to selected slot
0x01AAF0|$06:$AAE0:20 FC AA	JSR $AAFC  	; display Menu ID #$43: Game menu: delete selected game and Menu ID #$19: General menu: YES/NO
0x01AAF3|$06:$AAE3:AE DB 75	LDX $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01AAF6|$06:$AAE6:A9 FE   	LDA #$FE   
0x01AAF8|$06:$AAE8:9D D7 75	STA $75D7,X	; save slot 1 status (write-only?)
; control flow target (from $A965)
0x01AAFB|$06:$AAEB:20 3B AA	JSR $AA3B  	; mark save game slot specified by $75DB as empty
0x01AAFE|$06:$AAEE:A2 72   	LDX #$72   	; fill save game buffer with #$00
0x01AB00|$06:$AAF0:A9 00   	LDA #$00   
; control flow target (from $AAF6)
0x01AB02|$06:$AAF2:9D 00 70	STA $7000,X	; 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), SRAM buffer
0x01AB05|$06:$AAF5:CA      	DEX        
0x01AB06|$06:$AAF6:10 FA   	BPL $AAF2  
0x01AB08|$06:$AAF8:20 87 AB	JSR $AB87  	; copy data from SRAM buffer to per-game save data
0x01AB0B|$06:$AAFB:60      	RTS        

; display Menu ID #$43: Game menu: delete selected game and Menu ID #$19: General menu: YES/NO
; control flow target (from $AAE0)
0x01AB0C|$06:$AAFC:A9 43   	LDA #$43   	; Menu ID #$43: Game menu: delete selected game
0x01AB0E|$06:$AAFE:20 93 A9	JSR $A993  	; open menu specified by A
0x01AB11|$06:$AB01:A9 19   	LDA #$19   	; Menu ID #$19: General menu: YES/NO
0x01AB13|$06:$AB03:20 93 A9	JSR $A993  	; open menu specified by A
0x01AB16|$06:$AB06:AA      	TAX        
; if NO, pop JSR return address and RTS back to to display and handle main game menu
0x01AB17|$06:$AB07:F0 02   	BEQ $AB0B  
0x01AB19|$06:$AB09:68      	PLA        
0x01AB1A|$06:$AB0A:68      	PLA        
; control flow target (from $AB07)
0x01AB1B|$06:$AB0B:60      	RTS        

; display filled slots selection menu, set A/$75DB to selected slot
; control flow target (from $AA55, $AA64, $AACA, $AADD)
0x01AB1C|$06:$AB0C:A9 00   	LDA #$00   	; get index for filled slots
0x01AB1E|$06:$AB0E:20 32 AB	JSR $AB32  	; set A to offset of appropriate save slot selection menu: A = #$00 gets index for filled slots, A = #$FF gets index for empty slots; also sets $75DB to offset for corresponding current slot lut
0x01AB21|$06:$AB11:69 3C   	ADC #$3C   	; base menu ID
0x01AB23|$06:$AB13:D0 07   	BNE $AB1C  
; display empty slots selection menu, set A/$75DB to selected slot
; control flow target (from $AA98, $AAD0)
0x01AB25|$06:$AB15:A9 FF   	LDA #$FF   	; get index for empty slots
0x01AB27|$06:$AB17:20 32 AB	JSR $AB32  	; set A to offset of appropriate save slot selection menu: A = #$00 gets index for filled slots, A = #$FF gets index for empty slots; also sets $75DB to offset for corresponding current slot lut
0x01AB2A|$06:$AB1A:69 35   	ADC #$35   	; base menu ID
; control flow target (from $AB13)
0x01AB2C|$06:$AB1C:20 93 A9	JSR $A993  	; open menu specified by A
0x01AB2F|$06:$AB1F:C9 FF   	CMP #$FF   
0x01AB31|$06:$AB21:F0 0C   	BEQ $AB2F  	; pop JSR return address and RTS back to to display and handle main game menu
0x01AB33|$06:$AB23:18      	CLC        
0x01AB34|$06:$AB24:6D DB 75	ADC $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values; offset for current slot lookup table
0x01AB37|$06:$AB27:AA      	TAX        
0x01AB38|$06:$AB28:BD C2 AD	LDA $ADC2,X	; lookup table for save game slot based on save game slot selection type + menu selection index
0x01AB3B|$06:$AB2B:8D DB 75	STA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01AB3E|$06:$AB2E:60      	RTS        

; pop JSR return address and RTS back to to display and handle main game menu
; control flow target (from $AB21)
0x01AB3F|$06:$AB2F:68      	PLA        
0x01AB40|$06:$AB30:68      	PLA        
0x01AB41|$06:$AB31:60      	RTS        

; set A to offset of appropriate save slot selection menu: A = #$00 gets index for filled slots, A = #$FF gets index for empty slots; also sets $75DB to offset for corresponding current slot lut
; control flow target (from $AB0E, $AB17)
0x01AB42|$06:$AB32:4D DA 75	EOR $75DA  	; bit field for which save game slots are filled
0x01AB45|$06:$AB35:29 07   	AND #$07   	; 3 save slots
0x01AB47|$06:$AB37:AA      	TAX        
0x01AB48|$06:$AB38:CA      	DEX        
0x01AB49|$06:$AB39:8A      	TXA        
0x01AB4A|$06:$AB3A:85 99   	STA $99    
0x01AB4C|$06:$AB3C:0A      	ASL        
0x01AB4D|$06:$AB3D:65 99   	ADC $99    
0x01AB4F|$06:$AB3F:8D DB 75	STA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01AB52|$06:$AB42:8A      	TXA        
0x01AB53|$06:$AB43:60      	RTS        

; copy current save game's data to save data buffer at $7000; CLC if data is valid, SEC if it's unrecoverable
; control flow target (from $A93B, $AA58, $AA67, $AACD)
0x01AB54|$06:$AB44:20 90 AB	JSR $AB90  	; set $99-$9A to pointer to current game's save slot, $9B-$9C to pointer to save data buffer at $7000
0x01AB57|$06:$AB47:A2 00   	LDX #$00   	; save data copy number
; control flow target (from $AB7B)
0x01AB59|$06:$AB49:A0 72   	LDY #$72   	; copy #$73 bytes of data from current game's save slot to save data buffer at $7000
; control flow target (from $AB50)
0x01AB5B|$06:$AB4B:B1 99   	LDA ($99),Y
0x01AB5D|$06:$AB4D:91 9B   	STA ($9B),Y
0x01AB5F|$06:$AB4F:88      	DEY        
0x01AB60|$06:$AB50:10 F9   	BPL $AB4B  
0x01AB62|$06:$AB52:98      	TYA        	; save Y and X on the stack
0x01AB63|$06:$AB53:48      	PHA        
0x01AB64|$06:$AB54:8A      	TXA        
0x01AB65|$06:$AB55:48      	PHA        
0x01AB66|$06:$AB56:20 BB AC	JSR $ACBB  	; initialize the RNG based on 71 passes using SRAM data $7000-$7070
0x01AB69|$06:$AB59:68      	PLA        	; restore X and Y from the stack
0x01AB6A|$06:$AB5A:AA      	TAX        
0x01AB6B|$06:$AB5B:68      	PLA        
0x01AB6C|$06:$AB5C:A8      	TAY        
0x01AB6D|$06:$AB5D:AD 71 70	LDA $7071  	; RNG byte 0, SRAM buffer
0x01AB70|$06:$AB60:C5 32   	CMP $32    	; RNG byte 0
0x01AB72|$06:$AB62:D0 07   	BNE $AB6B  	; save data corrupted!
0x01AB74|$06:$AB64:AD 72 70	LDA $7072  	; RNG byte 1, SRAM buffer
0x01AB77|$06:$AB67:C5 33   	CMP $33    	; RNG byte 1
0x01AB79|$06:$AB69:F0 14   	BEQ $AB7F  	; save data valid!
; save data corrupted!
; control flow target (from $AB62)
0x01AB7B|$06:$AB6B:18      	CLC        	; add #$159 (i.e. #$73 * 3) to $99-$9A
0x01AB7C|$06:$AB6C:A9 59   	LDA #$59   
0x01AB7E|$06:$AB6E:65 99   	ADC $99    
0x01AB80|$06:$AB70:85 99   	STA $99    
0x01AB82|$06:$AB72:A9 01   	LDA #$01   
0x01AB84|$06:$AB74:65 9A   	ADC $9A    
0x01AB86|$06:$AB76:85 9A   	STA $9A    
0x01AB88|$06:$AB78:E8      	INX        	; save data copy number
0x01AB89|$06:$AB79:E0 04   	CPX #$04   	; there are 4 copies of save data
0x01AB8B|$06:$AB7B:D0 CC   	BNE $AB49  
0x01AB8D|$06:$AB7D:38      	SEC        	; flag data as unrecoverable :(
0x01AB8E|$06:$AB7E:60      	RTS        

; save data valid!
; control flow target (from $AB69)
0x01AB8F|$06:$AB7F:8A      	TXA        
0x01AB90|$06:$AB80:F0 03   	BEQ $AB85  	; if first save data copy was bad, update all copies with good data
0x01AB92|$06:$AB82:20 AA AB	JSR $ABAA  	; copy save data from save data buffer to current game's save slot, making X copies of the data spaced 3 saves slots away
; control flow target (from $AB80)
0x01AB95|$06:$AB85:18      	CLC        	; flag data as valid
0x01AB96|$06:$AB86:60      	RTS        

; copy data from SRAM buffer to per-game save data
; control flow target (from $A88B, $AA8A, $AAB7, $AAD9, $AAF8)
0x01AB97|$06:$AB87:A2 04   	LDX #$04   	; make 4 copies of save data
0x01AB99|$06:$AB89:20 AA AB	JSR $ABAA  	; copy save data from save data buffer to current game's save slot, making X copies of the data spaced 3 saves slots away
0x01AB9C|$06:$AB8C:20 02 AA	JSR $AA02  	; copy more data to second part of per-game save data
0x01AB9F|$06:$AB8F:60      	RTS        

; set $99-$9A to pointer to current game's save slot, $9B-$9C to pointer to save data buffer at $7000
; control flow target (from $AB44, $ABAA)
0x01ABA0|$06:$AB90:AD DB 75	LDA $75DB  	; in game: current game save slot; out of game: various temporary game menu setup values
0x01ABA3|$06:$AB93:0A      	ASL        
0x01ABA4|$06:$AB94:A8      	TAY        
0x01ABA5|$06:$AB95:B9 EE AD	LDA $ADEE,Y	; pointers to start of per-game save data
0x01ABA8|$06:$AB98:85 99   	STA $99    
0x01ABAA|$06:$AB9A:B9 EF AD	LDA $ADEF,Y
0x01ABAD|$06:$AB9D:85 9A   	STA $9A    
0x01ABAF|$06:$AB9F:AD EC AD	LDA $ADEC  	; pointer to start of current game save data buffer
0x01ABB2|$06:$ABA2:85 9B   	STA $9B    
0x01ABB4|$06:$ABA4:AD ED AD	LDA $ADED  
0x01ABB7|$06:$ABA7:85 9C   	STA $9C    
0x01ABB9|$06:$ABA9:60      	RTS        

; copy save data from save data buffer to current game's save slot, making X copies of the data spaced 3 saves slots away
; control flow target (from $AB82, $AB89)
0x01ABBA|$06:$ABAA:20 90 AB	JSR $AB90  	; set $99-$9A to pointer to current game's save slot, $9B-$9C to pointer to save data buffer at $7000
; control flow target (from $ABC4)
0x01ABBD|$06:$ABAD:A0 72   	LDY #$72   
; control flow target (from $ABB4)
0x01ABBF|$06:$ABAF:B1 9B   	LDA ($9B),Y
0x01ABC1|$06:$ABB1:91 99   	STA ($99),Y
0x01ABC3|$06:$ABB3:88      	DEY        
0x01ABC4|$06:$ABB4:10 F9   	BPL $ABAF  
0x01ABC6|$06:$ABB6:18      	CLC        	; add #$72 * 3 = #$0159 to write address $99-$9A
0x01ABC7|$06:$ABB7:A9 59   	LDA #$59   
0x01ABC9|$06:$ABB9:65 99   	ADC $99    
0x01ABCB|$06:$ABBB:85 99   	STA $99    
0x01ABCD|$06:$ABBD:A9 01   	LDA #$01   
0x01ABCF|$06:$ABBF:65 9A   	ADC $9A    
0x01ABD1|$06:$ABC1:85 9A   	STA $9A    
0x01ABD3|$06:$ABC3:CA      	DEX        
0x01ABD4|$06:$ABC4:D0 E7   	BNE $ABAD  	; make X copies of the save data
0x01ABD6|$06:$ABC6:60      	RTS        

; copy save data from save data buffer at $7000 to system RAM; update Don Mahone quest status if applicable
; from $0F:$C6F9 via $8006
; control flow target (from $AA5B)
; indirect control flow target (via $8006)
0x01ABD7|$06:$ABC7:AD 00 70	LDA $7000  	; 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), SRAM buffer
0x01ABDA|$06:$ABCA:85 CA   	STA $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)
0x01ABDC|$06:$ABCC:AD 01 70	LDA $7001  	; Don Mahone quest status (#$00 = not started, #$01 = ingredients delivered, #$03 = game loaded after ingredients delivered), SRAM buffer
0x01ABDF|$06:$ABCF:F0 02   	BEQ $ABD3  
0x01ABE1|$06:$ABD1:A9 03   	LDA #$03   
; control flow target (from $ABCF)
0x01ABE3|$06:$ABD3:85 CD   	STA $CD    	; Don Mahone quest status (#$00 = not started, #$01 = ingredients delivered, #$03 = game loaded after ingredients delivered)
0x01ABE5|$06:$ABD5:AD 02 70	LDA $7002  	; Tuhn Watergate open flag (#$00 = closed, #$01 = open), SRAM buffer
0x01ABE8|$06:$ABD8:85 CE   	STA $CE    	; Tuhn Watergate open flag (#$00 = closed, #$01 = open)
0x01ABEA|$06:$ABDA:AD 03 70	LDA $7003  	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x01ABED|$06:$ABDD:85 CF   	STA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x01ABEF|$06:$ABDF:AD 04 70	LDA $7004  	; Sea Cave shoal status (#$00 = shoals up, others = shoals down), SRAM buffer
0x01ABF2|$06:$ABE2:8D F8 05	STA $05F8  	; Sea Cave shoal status (#$00 = shoals up, others = shoals down)
0x01ABF5|$06:$ABE5:AD 05 70	LDA $7005  	; Crests found bit field, SRAM buffer
0x01ABF8|$06:$ABE8:8D 12 01	STA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x01ABFB|$06:$ABEB:AD 06 70	LDA $7006  	; last save point ID, SRAM buffer
0x01ABFE|$06:$ABEE:8D 48 00	STA $0048  	; last save point ID
0x01AC01|$06:$ABF1:AD 07 70	LDA $7007  	; party gold, low byte, SRAM buffer
0x01AC04|$06:$ABF4:8D 24 06	STA $0624  	; party gold, low byte
0x01AC07|$06:$ABF7:AD 08 70	LDA $7008  	; party gold, high byte, SRAM buffer
0x01AC0A|$06:$ABFA:8D 25 06	STA $0625  	; party gold, high byte
0x01AC0D|$06:$ABFD:A2 35   	LDX #$35   
; control flow target (from $AC06)
0x01AC0F|$06:$ABFF:BD 15 70	LDA $7015,X	; hero data from $062D, SRAM buffer
0x01AC12|$06:$AC02:9D 2D 06	STA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01AC15|$06:$AC05:CA      	DEX        
0x01AC16|$06:$AC06:10 F7   	BPL $ABFF  
0x01AC18|$06:$AC08:A2 17   	LDX #$17   
; control flow target (from $AC11)
0x01AC1A|$06:$AC0A:BD 4B 70	LDA $704B,X	; party inventory, SRAM buffer
0x01AC1D|$06:$AC0D:9D 00 06	STA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x01AC20|$06:$AC10:CA      	DEX        
0x01AC21|$06:$AC11:10 F7   	BPL $AC0A  
0x01AC23|$06:$AC13:A2 03   	LDX #$03   
; control flow target (from $AC28)
0x01AC25|$06:$AC15:BD 09 70	LDA $7009,X	; Midenhall name bytes 0-3, SRAM buffer
0x01AC28|$06:$AC18:9D 13 01	STA $0113,X	; Midenhall name bytes 0-3 + terminator
0x01AC2B|$06:$AC1B:BD 0D 70	LDA $700D,X	; Cannock name bytes 0-3, SRAM buffer
0x01AC2E|$06:$AC1E:9D 18 01	STA $0118,X	; Cannock name bytes 0-3 + terminator
0x01AC31|$06:$AC21:BD 11 70	LDA $7011,X	; Moonbrooke name bytes 0-3, SRAM buffer
0x01AC34|$06:$AC24:9D 1D 01	STA $011D,X	; Moonbrooke name bytes 0-3 + terminator
0x01AC37|$06:$AC27:CA      	DEX        
0x01AC38|$06:$AC28:10 EB   	BPL $AC15  
0x01AC3A|$06:$AC2A:A2 0B   	LDX #$0B   
; control flow target (from $AC33)
0x01AC3C|$06:$AC2C:BD 63 70	LDA $7063,X	; party names, bytes 4-7, SRAM buffer
0x01AC3F|$06:$AC2F:9D 86 01	STA $0186,X	; Midenhall name bytes 4-7
0x01AC42|$06:$AC32:CA      	DEX        
0x01AC43|$06:$AC33:10 F7   	BPL $AC2C  
0x01AC45|$06:$AC35:AD 6F 70	LDA $706F  	; current battle message delay, SRAM buffer
0x01AC48|$06:$AC38:8D 2C 06	STA $062C  	; current battle message delay
0x01AC4B|$06:$AC3B:60      	RTS        

; copy save data from system RAM to $7000-$706F
; control flow target (from $A885)
0x01AC4C|$06:$AC3C: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)
0x01AC4E|$06:$AC3E:8D 00 70	STA $7000  	; 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), SRAM buffer
0x01AC51|$06:$AC41:A5 CD   	LDA $CD    	; Don Mahone quest status (#$00 = not started, #$01 = ingredients delivered, #$03 = game loaded after ingredients delivered)
0x01AC53|$06:$AC43:8D 01 70	STA $7001  	; Don Mahone quest status (#$00 = not started, #$01 = ingredients delivered, #$03 = game loaded after ingredients delivered), SRAM buffer
0x01AC56|$06:$AC46:A5 CE   	LDA $CE    	; Tuhn Watergate open flag (#$00 = closed, #$01 = open)
0x01AC58|$06:$AC48:8D 02 70	STA $7002  	; Tuhn Watergate open flag (#$00 = closed, #$01 = open), SRAM buffer
0x01AC5B|$06:$AC4B:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x01AC5D|$06:$AC4D:8D 03 70	STA $7003  	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x01AC60|$06:$AC50:AD F8 05	LDA $05F8  	; Sea Cave shoal status (#$00 = shoals up, others = shoals down)
0x01AC63|$06:$AC53:8D 04 70	STA $7004  	; Sea Cave shoal status (#$00 = shoals up, others = shoals down), SRAM buffer
0x01AC66|$06:$AC56:AD 12 01	LDA $0112  	; Crests found bit field (#$10 = Life, #$80 = Water, #$04 = Moon, #$02 = Stars, #$01 = Sun)
0x01AC69|$06:$AC59:8D 05 70	STA $7005  	; Crests found bit field, SRAM buffer
0x01AC6C|$06:$AC5C:AD 48 00	LDA $0048  	; last save point ID
0x01AC6F|$06:$AC5F:8D 06 70	STA $7006  	; last save point ID, SRAM buffer
0x01AC72|$06:$AC62:AD 24 06	LDA $0624  	; party gold, low byte
0x01AC75|$06:$AC65:8D 07 70	STA $7007  	; party gold, low byte, SRAM buffer
0x01AC78|$06:$AC68:AD 25 06	LDA $0625  	; party gold, high byte
0x01AC7B|$06:$AC6B:8D 08 70	STA $7008  	; party gold, high byte, SRAM buffer
0x01AC7E|$06:$AC6E:A2 35   	LDX #$35   
; control flow target (from $AC77)
0x01AC80|$06:$AC70:BD 2D 06	LDA $062D,X	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01AC83|$06:$AC73:9D 15 70	STA $7015,X	; hero data from $062D, SRAM buffer
0x01AC86|$06:$AC76:CA      	DEX        
0x01AC87|$06:$AC77:10 F7   	BPL $AC70  
0x01AC89|$06:$AC79:A2 17   	LDX #$17   
; control flow target (from $AC82)
0x01AC8B|$06:$AC7B:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x01AC8E|$06:$AC7E:9D 4B 70	STA $704B,X	; party inventory, SRAM buffer
0x01AC91|$06:$AC81:CA      	DEX        
0x01AC92|$06:$AC82:10 F7   	BPL $AC7B  
0x01AC94|$06:$AC84:A2 03   	LDX #$03   
; control flow target (from $AC99)
0x01AC96|$06:$AC86:BD 13 01	LDA $0113,X	; Midenhall name bytes 0-3 + terminator
0x01AC99|$06:$AC89:9D 09 70	STA $7009,X	; Midenhall name bytes 0-3, SRAM buffer
0x01AC9C|$06:$AC8C:BD 18 01	LDA $0118,X	; Cannock name bytes 0-3 + terminator
0x01AC9F|$06:$AC8F:9D 0D 70	STA $700D,X	; Cannock name bytes 0-3, SRAM buffer
0x01ACA2|$06:$AC92:BD 1D 01	LDA $011D,X	; Moonbrooke name bytes 0-3 + terminator
0x01ACA5|$06:$AC95:9D 11 70	STA $7011,X	; Moonbrooke name bytes 0-3, SRAM buffer
0x01ACA8|$06:$AC98:CA      	DEX        
0x01ACA9|$06:$AC99:10 EB   	BPL $AC86  
0x01ACAB|$06:$AC9B:A2 0B   	LDX #$0B   
; control flow target (from $ACA4)
0x01ACAD|$06:$AC9D:BD 86 01	LDA $0186,X	; Midenhall name bytes 4-7
0x01ACB0|$06:$ACA0:9D 63 70	STA $7063,X	; party names, bytes 4-7, SRAM buffer
0x01ACB3|$06:$ACA3:CA      	DEX        
0x01ACB4|$06:$ACA4:10 F7   	BPL $AC9D  
0x01ACB6|$06:$ACA6:AD 2C 06	LDA $062C  	; current battle message delay
0x01ACB9|$06:$ACA9:8D 6F 70	STA $706F  	; current battle message delay, SRAM buffer
0x01ACBC|$06:$ACAC:60      	RTS        

; initialize the RNG based on 71 passes using SRAM data $7000-$7070 and save resulting seed to $7071-$7072
; control flow target (from $A888, $AA87, $AAB4)
0x01ACBD|$06:$ACAD:20 BB AC	JSR $ACBB  	; initialize the RNG based on 71 passes using SRAM data $7000-$7070
0x01ACC0|$06:$ACB0:A5 32   	LDA $32    	; RNG byte 0
0x01ACC2|$06:$ACB2:8D 71 70	STA $7071  	; RNG byte 0, SRAM buffer
0x01ACC5|$06:$ACB5:A5 33   	LDA $33    	; RNG byte 1
0x01ACC7|$06:$ACB7:8D 72 70	STA $7072  	; RNG byte 1, SRAM buffer
0x01ACCA|$06:$ACBA:60      	RTS        

; initialize the RNG based on 71 passes using SRAM data $7000-$7070
; control flow target (from $AB56, $ACAD)
0x01ACCB|$06:$ACBB:A2 70   	LDX #$70   
0x01ACCD|$06:$ACBD:86 32   	STX $32    	; RNG byte 0
0x01ACCF|$06:$ACBF:86 33   	STX $33    	; RNG byte 1
; control flow target (from $ACCA)
0x01ACD1|$06:$ACC1:BD 00 70	LDA $7000,X	; 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), SRAM buffer
0x01ACD4|$06:$ACC4:85 0C   	STA $0C    
; call to code in a different bank ($0F:$C3B6)
0x01ACD6|$06:$ACC6:20 B6 C3	JSR $C3B6  	; generate a random number and store it in $32-$33 (one pass)
0x01ACD9|$06:$ACC9:CA      	DEX        
0x01ACDA|$06:$ACCA:10 F5   	BPL $ACC1  
0x01ACDC|$06:$ACCC:60      	RTS        

; control flow target (from $AA9B)
0x01ACDD|$06:$ACCD:20 86 AE	JSR $AE86  
0x01ACE0|$06:$ACD0:A2 03   	LDX #$03   
; save Midenhall's name
; control flow target (from $ACE5)
0x01ACE2|$06:$ACD2:BD 04 01	LDA $0104,X
0x01ACE5|$06:$ACD5:9D 63 70	STA $7063,X	; party names, bytes 4-7, SRAM buffer
0x01ACE8|$06:$ACD8:9D 86 01	STA $0186,X	; Midenhall name bytes 4-7
0x01ACEB|$06:$ACDB:BD 00 01	LDA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x01ACEE|$06:$ACDE:9D 09 70	STA $7009,X	; Midenhall name bytes 0-3, SRAM buffer
0x01ACF1|$06:$ACE1:9D 13 01	STA $0113,X	; Midenhall name bytes 0-3 + terminator
0x01ACF4|$06:$ACE4:CA      	DEX        
0x01ACF5|$06:$ACE5:10 EB   	BPL $ACD2  
0x01ACF7|$06:$ACE7:20 EB AC	JSR $ACEB  	; generate and save Cannock/Moonbrooke's names
0x01ACFA|$06:$ACEA:60      	RTS        

; generate and save Cannock/Moonbrooke's names
; control flow target (from $ACE7)
0x01ACFB|$06:$ACEB:A9 00   	LDA #$00   
0x01ACFD|$06:$ACED:A2 03   	LDX #$03   
0x01ACFF|$06:$ACEF:18      	CLC        
; control flow target (from $ACF7)
0x01AD00|$06:$ACF0:7D 09 70	ADC $7009,X	; Midenhall name bytes 0-3, SRAM buffer; first 4 characters of Midenhall's name
0x01AD03|$06:$ACF3:7D 63 70	ADC $7063,X	; party names, bytes 4-7, SRAM buffer; last 4 characters of Midenhall's name
0x01AD06|$06:$ACF6:CA      	DEX        
0x01AD07|$06:$ACF7:10 F7   	BPL $ACF0  
0x01AD09|$06:$ACF9:48      	PHA        
0x01AD0A|$06:$ACFA:29 07   	AND #$07   	; Cannock's name is based on bits 0-2 of the sum of Midenhall's name
0x01AD0C|$06:$ACFC:0A      	ASL        	; << 3 since names are 8 bytes long
0x01AD0D|$06:$ACFD:0A      	ASL        
0x01AD0E|$06:$ACFE:0A      	ASL        
0x01AD0F|$06:$ACFF:AA      	TAX        
0x01AD10|$06:$AD00:A0 00   	LDY #$00   
; save Cannock's name
; control flow target (from $AD18)
0x01AD12|$06:$AD02:BD 39 AD	LDA $AD39,X	; Prince of Cannock Names, first 4 bytes; pointer to list of Cannock names, starting at 0th byte
0x01AD15|$06:$AD05:99 0D 70	STA $700D,Y	; Cannock name bytes 0-3, SRAM buffer; store the first 4 characters in SRAM
0x01AD18|$06:$AD08:99 18 01	STA $0118,Y	; Cannock name bytes 0-3 + terminator; store the first 4 characters in RAM
0x01AD1B|$06:$AD0B:BD 3D AD	LDA $AD3D,X	; Prince of Cannock Names, last 4 bytes; pointer to list of Cannock names, starting at 4th byte
0x01AD1E|$06:$AD0E:99 67 70	STA $7067,Y	; store the last 4 characters in SRAM
0x01AD21|$06:$AD11:99 8A 01	STA $018A,Y	; Cannock name bytes 4-7; store the last 4 characters in RAM
0x01AD24|$06:$AD14:E8      	INX        
0x01AD25|$06:$AD15:C8      	INY        
0x01AD26|$06:$AD16:C0 04   	CPY #$04   
0x01AD28|$06:$AD18:D0 E8   	BNE $AD02  
0x01AD2A|$06:$AD1A:68      	PLA        
0x01AD2B|$06:$AD1B:29 38   	AND #$38   	; Moonbrooke's name is based on bits 3-6 of the sum of Midenhall's name
0x01AD2D|$06:$AD1D:AA      	TAX        
0x01AD2E|$06:$AD1E:A0 00   	LDY #$00   
; save Moonbrooke's name
; control flow target (from $AD36)
0x01AD30|$06:$AD20:BD 79 AD	LDA $AD79,X	; Princess of Moonbrooke Names, first 4 bytes; pointer to list of Moonbrooke names, starting at 0th byte
0x01AD33|$06:$AD23:99 11 70	STA $7011,Y	; Moonbrooke name bytes 0-3, SRAM buffer; store the first 4 characters in SRAM
0x01AD36|$06:$AD26:99 1D 01	STA $011D,Y	; Moonbrooke name bytes 0-3 + terminator; store the first 4 characters in RAM
0x01AD39|$06:$AD29:BD 7D AD	LDA $AD7D,X	; Princess of Moonbrooke Names, last 4 bytes; pointer to list of Moonbrooke names, starting at 0th byte
0x01AD3C|$06:$AD2C:99 6B 70	STA $706B,Y	; store the last 4 characters in SRAM
0x01AD3F|$06:$AD2F:99 8E 01	STA $018E,Y	; Moonbrooke name bytes 4-7; store the last 4 characters in RAM
0x01AD42|$06:$AD32:E8      	INX        
0x01AD43|$06:$AD33:C8      	INY        
0x01AD44|$06:$AD34:C0 04   	CPY #$04   
0x01AD46|$06:$AD36:D0 E8   	BNE $AD20  
0x01AD48|$06:$AD38:60      	RTS        


; code -> data
; Prince of Cannock Names, first 4 bytes
; indexed data load target (from $AD02)
0x01AD49|$06:$AD39:25 1B 0A 17
; Prince of Cannock Names, last 4 bytes
; indexed data load target (from $AD0B)
0x01AD4D|$06:$AD3D:            5F 5F 5F 5F	; "Bran    "
0x01AD51|$06:$AD41:2A 15 22 17 17 5F 5F 5F	; "Glynn   "
0x01AD59|$06:$AD49:37 0A 15 12 17 1D 5F 5F	; "Talint  "
0x01AD61|$06:$AD51:31 1E 16 18 1B 5F 5F 5F	; "Numor   "
0x01AD69|$06:$AD59:2F 0A 1B 1C 5F 5F 5F 5F	; "Lars    "
0x01AD71|$06:$AD61:32 1B 0F 0E 18 5F 5F 5F	; "Orfeo   "
0x01AD79|$06:$AD69:24 1B 1D 11 18 5F 5F 5F	; "Artho   "
0x01AD81|$06:$AD71:28 1C 10 0A 1B 5F 5F 5F	; "Esgar   "
; Princess of Moonbrooke Names, first 4 bytes
; indexed data load target (from $AD20)
0x01AD89|$06:$AD79:39 0A 1B 12
; Princess of Moonbrooke Names, last 4 bytes
; indexed data load target (from $AD29)
0x01AD8D|$06:$AD7D:            0A 5F 5F 5F	; "Varia   "
0x01AD91|$06:$AD81:28 15 0A 17 12 5F 5F 5F	; "Elani   "
0x01AD99|$06:$AD89:32 15 15 12 1C 0A 5F 5F	; "Ollisa  "
0x01ADA1|$06:$AD91:35 18 23 5F 5F 5F 5F 5F	; "Roz     "
0x01ADA9|$06:$AD99:2E 0A 12 15 12 17 5F 5F	; "Kailin  "
0x01ADB1|$06:$ADA1:33 0E 1D 0A 5F 5F 5F 5F	; "Peta    "
0x01ADB9|$06:$ADA9:2C 15 15 22 1D 11 5F 5F	; "Illyth  "
0x01ADC1|$06:$ADB1:2A 20 0E 17 5F 5F 5F 5F	; "Gwen    "
; indexed data load target (from $A8CC, $A91B)
0x01ADC9|$06:$ADB9:44 51 32 55 53 41
; battle message delays (frames between prints; higher = slower)
; indexed data load target (from $AA7E)
0x01ADCF|$06:$ADBF:28	; 40 frames
0x01ADD0|$06:$ADC0:46	; 70 frames
0x01ADD1|$06:$ADC1:FF	; 255 frames
; lookup table for save game slot based on save game slot selection type + menu selection index
; only slot 0
; indexed data load target (from $AB28)
0x01ADD2|$06:$ADC2:00	; slot 0
0x01ADD3|$06:$ADC3:00	; (impossible)
0x01ADD4|$06:$ADC4:00	; (impossible)
; only slot 1
0x01ADD5|$06:$ADC5:01	; slot 1
0x01ADD6|$06:$ADC6:00	; (impossible)
0x01ADD7|$06:$ADC7:00	; (impossible)
; slots 0 and 1
0x01ADD8|$06:$ADC8:00	; slot 0
0x01ADD9|$06:$ADC9:01	; slot 1
0x01ADDA|$06:$ADCA:00	; (impossible)
; only slot 2
0x01ADDB|$06:$ADCB:02	; slot 2
0x01ADDC|$06:$ADCC:00	; (impossible)
0x01ADDD|$06:$ADCD:00	; (impossible)
; slots 0 and 2
0x01ADDE|$06:$ADCE:00	; slot 0
0x01ADDF|$06:$ADCF:02	; slot 2
0x01ADE0|$06:$ADD0:00	; (impossible)
; slots 1 and 2
0x01ADE1|$06:$ADD1:01	; slot 1
0x01ADE2|$06:$ADD2:02	; slot 2
0x01ADE3|$06:$ADD3:00	; (impossible)
; all 3 slots
0x01ADE4|$06:$ADD4:00	; slot 0
0x01ADE5|$06:$ADD5:01	; slot 1
0x01ADE6|$06:$ADD6:02	; slot 2
; index into jump table at $ADE2
; indexed data load target (from $A9D4)
0x01ADE7|$06:$ADD7:00	; CONTINUE A QUEST
0x01ADE8|$06:$ADD8:01	; CHANGE MESSAGE SPEED
0x01ADE9|$06:$ADD9:04	; ERASE A QUEST
0x01ADEA|$06:$ADDA:00	; (impossible)
0x01ADEB|$06:$ADDB:00	; (impossible)
0x01ADEC|$06:$ADDC:00	; CONTINUE A QUEST
0x01ADED|$06:$ADDD:01	; CHANGE MESSAGE SPEED
0x01ADEE|$06:$ADDE:02	; BEGIN A NEW QUEST
0x01ADEF|$06:$ADDF:03	; COPY A QUEST
0x01ADF0|$06:$ADE0:04	; ERASE A QUEST
0x01ADF1|$06:$ADE1:02	; BEGIN A NEW QUEST
; jump table for main game menu handlers
; indexed data load target (from $A9D9)
0x01ADF2|$06:$ADE2:55
; indexed data load target (from $A9DE)
0x01ADF3|$06:$ADE3:   AA	; $06:$AA55; CONTINUE A QUEST handler
0x01ADF4|$06:$ADE4:64 AA	; $06:$AA64; CHANGE MESSAGE SPEED handler
0x01ADF6|$06:$ADE6:93 AA	; $06:$AA93; BEGIN A NEW QUEST handler
0x01ADF8|$06:$ADE8:CA AA	; $06:$AACA; COPY A QUEST handler
0x01ADFA|$06:$ADEA:DD AA	; $06:$AADD; ERASE A QUEST handler
; pointer to start of current game save data buffer
; data load target (from $AB9F)
0x01ADFC|$06:$ADEC:00
; data load target (from $ABA4)
0x01ADFD|$06:$ADED:   70	; $7000; 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), SRAM buffer
; pointers to start of per-game save data
; indexed data load target (from $AB95)
0x01ADFE|$06:$ADEE:73
; indexed data load target (from $AB9A)
0x01ADFF|$06:$ADEF:   70	; $7073; start of save game 1 backup #1
0x01AE00|$06:$ADF0:E6 70	; $70E6; start of save game 1 backup #2
0x01AE02|$06:$ADF2:59 71	; $7159; start of save game 1 backup #3
; data load target (from $A8E3)
0x01AE04|$06:$ADF4:64
; data load target (from $A8E9)
0x01AE05|$06:$ADF5:   75	; $7564
; indexed data load target (from $A9F7)
0x01AE06|$06:$ADF6:DC
; indexed data load target (from $A9FC)
0x01AE07|$06:$ADF7:   75	; $75DC
0x01AE08|$06:$ADF8:E6 75	; $75E6
0x01AE0A|$06:$ADFA:F0 75	; $75F0

; data -> code
; 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
; from $0F:$F4E6, $0F:$F5E4, $0F:$F614 via $8010
; indirect control flow target (via $8010)
0x01AE0C|$06:$ADFC:C9 FE   	CMP #$FE   
0x01AE0E|$06:$ADFE:B0 2F   	BCS $AE2F  	; A >= #$FE => just RTS
0x01AE10|$06:$AE00:8E 9D 60	STX $609D  	; menu function parameter
0x01AE13|$06:$AE03:85 10   	STA $10    	; selected item index
; call to code in a different bank ($0F:$F1B0)
0x01AE15|$06:$AE05: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
0x01AE18|$06:$AE08:A0 08   	LDY #$08   
0x01AE1A|$06:$AE0A:8C AA 60	STY $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 $AE1E)
0x01AE1D|$06:$AE0D:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
; call to code in a different bank ($0F:$F1D6)
0x01AE20|$06:$AE10: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)
0x01AE23|$06:$AE13:CD 9D 60	CMP $609D  	; menu function parameter
0x01AE26|$06:$AE16:D0 04   	BNE $AE1C  	; if it's not the right type of item, it doesn't count
0x01AE28|$06:$AE18:C6 10   	DEC $10    	; otherwise it does!
0x01AE2A|$06:$AE1A:30 08   	BMI $AE24  	; branch if we've found the right item
; control flow target (from $AE16)
0x01AE2C|$06:$AE1C:E8      	INX        	; increment inventory index
0x01AE2D|$06:$AE1D:88      	DEY        	; decrement inventory counter
0x01AE2E|$06:$AE1E:D0 ED   	BNE $AE0D  	; if more inventory slots to check, check them
0x01AE30|$06:$AE20:A9 00   	LDA #$00   	; if item not found, set A = X = #$00
0x01AE32|$06:$AE22:AA      	TAX        
0x01AE33|$06:$AE23:60      	RTS        

; control flow target (from $AE1A)
0x01AE34|$06:$AE24:BD 00 06	LDA $0600,X	; Midenhall inventory item 1 (| #$40 if equipped)
0x01AE37|$06:$AE27:48      	PHA        
0x01AE38|$06:$AE28:8A      	TXA        	; X = X mod 8
0x01AE39|$06:$AE29:29 07   	AND #$07   
0x01AE3B|$06:$AE2B:AA      	TAX        
0x01AE3C|$06:$AE2C:68      	PLA        
0x01AE3D|$06:$AE2D:29 3F   	AND #$3F   	; strip off the equipped bit
; control flow target (from $ADFE)
0x01AE3F|$06:$AE2F:60      	RTS        

; given hero ID - 1 in $4A and field spell menu selection index in A, return spell ID in A
; from $0F:$F5FA via $8012
; indirect control flow target (via $8012)
0x01AE40|$06:$AE30:06 4A   	ASL $4A    	; convert hero ID - 1 to spell list start index; 8 spells per hero
0x01AE42|$06:$AE32:06 4A   	ASL $4A    
0x01AE44|$06:$AE34:06 4A   	ASL $4A    
; add list start offset to spell menu selection index
0x01AE46|$06:$AE36:65 4A   	ADC $4A    
0x01AE48|$06:$AE38:AA      	TAX        
0x01AE49|$06:$AE39:BD 66 AE	LDA $AE66,X	; Cannock field spell list
0x01AE4C|$06:$AE3C:60      	RTS        

; given hero ID - 1 in $4A and battle spell menu selection index in A, return spell ID in A
; from $0F:$F4AC via $8014
; indirect control flow target (via $8014)
0x01AE4D|$06:$AE3D:06 4A   	ASL $4A    	; convert hero ID - 1 to spell list start index; 8 spells per hero
0x01AE4F|$06:$AE3F:06 4A   	ASL $4A    
0x01AE51|$06:$AE41:06 4A   	ASL $4A    
; add list start offset to spell menu selection index
0x01AE53|$06:$AE43:65 4A   	ADC $4A    
0x01AE55|$06:$AE45:AA      	TAX        
0x01AE56|$06:$AE46:BD 76 AE	LDA $AE76,X	; Cannock battle spell list
0x01AE59|$06:$AE49:60      	RTS        

; given spell ID in A, set A to spell name index
; from $02:$BEA4 via $8020
; indirect control flow target (via $8020)
0x01AE5A|$06:$AE4A:AA      	TAX        
0x01AE5B|$06:$AE4B:BD 4E AE	LDA $AE4E,X
; indexed data load target (from $AE4B)
0x01AE5E|$06:$AE4E:60      	RTS        


; code -> data
; spell ID -> spell name index (built in offset from $AE4F)
0x01AE5F|$06:$AE4F:00	; Spell ID #$00: (no spell)
0x01AE60|$06:$AE50:10	; Spell ID #$01: Firebal
0x01AE61|$06:$AE51:04	; Spell ID #$02: Sleep
0x01AE62|$06:$AE52:06	; Spell ID #$03: Firebane
0x01AE63|$06:$AE53:12	; Spell ID #$04: Defeat
0x01AE64|$06:$AE54:02	; Spell ID #$05: Infernos
0x01AE65|$06:$AE55:14	; Spell ID #$06: Stopspell
0x01AE66|$06:$AE56:13	; Spell ID #$07: Surround
0x01AE67|$06:$AE57:08	; Spell ID #$08: Defence
0x01AE68|$06:$AE58:05	; Spell ID #$09: Heal
0x01AE69|$06:$AE59:18	; Spell ID #$0A: Increase
0x01AE6A|$06:$AE5A:07	; Spell ID #$0B: Healmore
0x01AE6B|$06:$AE5B:1B	; Spell ID #$0C: Sacrifice
0x01AE6C|$06:$AE5C:16	; Spell ID #$0D: Healall
0x01AE6D|$06:$AE5D:17	; Spell ID #$0E: Explodet
0x01AE6E|$06:$AE5E:1A	; Spell ID #$0F: Chance
0x01AE6F|$06:$AE5F:08	; Spell ID #$10: Antidote
0x01AE70|$06:$AE60:1C	; Spell ID #$11: Heal (not used by heroes)
0x01AE71|$06:$AE61:19	; Spell ID #$12: Outside
0x01AE72|$06:$AE62:0A	; Spell ID #$13: Repel
0x01AE73|$06:$AE63:1E	; Spell ID #$14: Return
0x01AE74|$06:$AE64:0D	; Spell ID #$15: Open
0x01AE75|$06:$AE65:0E
; Cannock field spell list
; indexed data load target (from $AE39)
0x01AE76|$06:$AE66:09	; Spell ID #$09: Heal
0x01AE77|$06:$AE67:10	; Spell ID #$10: Antidote
0x01AE78|$06:$AE68:14	; Spell ID #$14: Return
0x01AE79|$06:$AE69:12	; Spell ID #$12: Outside
0x01AE7A|$06:$AE6A:0B	; Spell ID #$0B: Healmore
0x01AE7B|$06:$AE6B:16	; Spell ID #$16: Stepguard
0x01AE7C|$06:$AE6C:17	; Spell ID #$17: Revive
0x01AE7D|$06:$AE6D:00	; Spell ID #$00: (no spell)
; Moonbrooke field spell list
0x01AE7E|$06:$AE6E:0B	; Spell ID #$0B: Healmore
0x01AE7F|$06:$AE6F:13	; Spell ID #$13: Repel
0x01AE80|$06:$AE70:10	; Spell ID #$10: Antidote
0x01AE81|$06:$AE71:0D	; Spell ID #$0D: Healall
0x01AE82|$06:$AE72:12	; Spell ID #$12: Outside
0x01AE83|$06:$AE73:16	; Spell ID #$16: Stepguard
0x01AE84|$06:$AE74:15	; Spell ID #$15: Open
0x01AE85|$06:$AE75:00	; Spell ID #$00: (no spell)
; Cannock battle spell list
; indexed data load target (from $AE46)
0x01AE86|$06:$AE76:01	; Spell ID #$01: Firebal
0x01AE87|$06:$AE77:09	; Spell ID #$09: Heal
0x01AE88|$06:$AE78:06	; Spell ID #$06: Stopspell
0x01AE89|$06:$AE79:0B	; Spell ID #$0B: Healmore
0x01AE8A|$06:$AE7A:03	; Spell ID #$03: Firebane
0x01AE8B|$06:$AE7B:0A	; Spell ID #$0A: Increase
0x01AE8C|$06:$AE7C:04	; Spell ID #$04: Defeat
0x01AE8D|$06:$AE7D:0C	; Spell ID #$0C: Sacrifice
; Moonbrooke battle spell list
0x01AE8E|$06:$AE7E:02	; Spell ID #$02: Sleep
0x01AE8F|$06:$AE7F:0B	; Spell ID #$0B: Healmore
0x01AE90|$06:$AE80:05	; Spell ID #$05: Infernos
0x01AE91|$06:$AE81:08	; Spell ID #$08: Defence
0x01AE92|$06:$AE82:07	; Spell ID #$07: Surround
0x01AE93|$06:$AE83:0D	; Spell ID #$0D: Healall
0x01AE94|$06:$AE84:0E	; Spell ID #$0E: Explodet
0x01AE95|$06:$AE85:0F	; Spell ID #$0F: Chance

; data -> code
; control flow target (from $ACCD)
; indirect control flow target (via $8016)
0x01AE96|$06:$AE86:20 9E AE	JSR $AE9E  
0x01AE99|$06:$AE89:20 56 AF	JSR $AF56  
0x01AE9C|$06:$AE8C:20 7F AF	JSR $AF7F  
; control flow target (from $AE9A)
0x01AE9F|$06:$AE8F:20 CC AE	JSR $AECC  
0x01AEA2|$06:$AE92:20 30 AF	JSR $AF30  
0x01AEA5|$06:$AE95:B0 06   	BCS $AE9D  
0x01AEA7|$06:$AE97:20 8E AF	JSR $AF8E  
0x01AEAA|$06:$AE9A:4C 8F AE	JMP $AE8F  

; control flow target (from $AE95)
0x01AEAD|$06:$AE9D:60      	RTS        

; control flow target (from $AE86)
0x01AEAE|$06:$AE9E:A9 FF   	LDA #$FF   
0x01AEB0|$06:$AEA0:85 8E   	STA $8E    	; flag for in battle or not (#$FF)?
0x01AEB2|$06:$AEA2:A9 00   	LDA #$00   
0x01AEB4|$06:$AEA4:8D C2 60	STA $60C2  
0x01AEB7|$06:$AEA7:8D C3 60	STA $60C3  
0x01AEBA|$06:$AEAA:A9 47   	LDA #$47   	; Menu ID #$47: Game menu: new game name entry display
; call to code in a different bank ($0F:$EB89)
0x01AEBC|$06:$AEAC:20 89 EB	JSR $EB89  	; open menu specified by A
0x01AEBF|$06:$AEAF:A9 44   	LDA #$44   	; Menu ID #$44: Game menu: new game name input area
; call to code in a different bank ($0F:$EB89)
0x01AEC1|$06:$AEB1:20 89 EB	JSR $EB89  	; open menu specified by A
; call to code in a different bank ($0F:$C22C)
0x01AEC4|$06:$AEB4:20 2C C2	JSR $C22C  
0x01AEC7|$06:$AEB7:A9 12   	LDA #$12   
0x01AEC9|$06:$AEB9:8D A5 60	STA $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x01AECC|$06:$AEBC:A9 21   	LDA #$21   
0x01AECE|$06:$AEBE:8D A9 60	STA $60A9  	; menu cursor initial position (from ROM; X-pos = low nybble, Y-pos = high nybble)
0x01AED1|$06:$AEC1:A9 60   	LDA #$60   
0x01AED3|$06:$AEC3:A2 0C   	LDX #$0C   
; control flow target (from $AEC9)
0x01AED5|$06:$AEC5:9D 00 01	STA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x01AED8|$06:$AEC8:CA      	DEX        
0x01AED9|$06:$AEC9:10 FA   	BPL $AEC5  
0x01AEDB|$06:$AECB:60      	RTS        

; control flow target (from $AE8F)
0x01AEDC|$06:$AECC:C9 FF   	CMP #$FF   
0x01AEDE|$06:$AECE:F0 35   	BEQ $AF05  
0x01AEE0|$06:$AED0:C9 1A   	CMP #$1A   
0x01AEE2|$06:$AED2:90 1B   	BCC $AEEF  
0x01AEE4|$06:$AED4:C9 21   	CMP #$21   
0x01AEE6|$06:$AED6:90 21   	BCC $AEF9  
0x01AEE8|$06:$AED8:C9 3B   	CMP #$3B   
0x01AEEA|$06:$AEDA:90 18   	BCC $AEF4  
0x01AEEC|$06:$AEDC:C9 3D   	CMP #$3D   
0x01AEEE|$06:$AEDE:90 1F   	BCC $AEFF  
0x01AEF0|$06:$AEE0:C9 3D   	CMP #$3D   
0x01AEF2|$06:$AEE2:F0 21   	BEQ $AF05  
0x01AEF4|$06:$AEE4:20 46 AF	JSR $AF46  	; CLC if $0100-$0103 are all #$60, SEC otherwise
0x01AEF7|$06:$AEE7:90 05   	BCC $AEEE  
0x01AEF9|$06:$AEE9:A9 08   	LDA #$08   
0x01AEFB|$06:$AEEB:8D C2 60	STA $60C2  
; control flow target (from $AEE7)
0x01AEFE|$06:$AEEE:60      	RTS        

; control flow target (from $AED2)
0x01AEFF|$06:$AEEF:18      	CLC        
0x01AF00|$06:$AEF0:69 24   	ADC #$24   
0x01AF02|$06:$AEF2:D0 20   	BNE $AF14  
; control flow target (from $AEDA)
0x01AF04|$06:$AEF4:38      	SEC        
0x01AF05|$06:$AEF5:E9 17   	SBC #$17   
0x01AF07|$06:$AEF7:D0 1B   	BNE $AF14  
; control flow target (from $AED6)
0x01AF09|$06:$AEF9:AA      	TAX        
0x01AF0A|$06:$AEFA:BD 5C AF	LDA $AF5C,X
0x01AF0D|$06:$AEFD:D0 15   	BNE $AF14  
; control flow target (from $AEDE)
0x01AF0F|$06:$AEFF:AA      	TAX        	; A is either #$3B or #$3C
0x01AF10|$06:$AF00:BD 42 AF	LDA $AF42,X	; $AF7D or $AF7E
0x01AF13|$06:$AF03:D0 0F   	BNE $AF14  
; control flow target (from $AECE, $AEE2)
0x01AF15|$06:$AF05:AD C2 60	LDA $60C2  
0x01AF18|$06:$AF08:F0 09   	BEQ $AF13  
0x01AF1A|$06:$AF0A:20 5A AF	JSR $AF5A  
0x01AF1D|$06:$AF0D:CE C2 60	DEC $60C2  
0x01AF20|$06:$AF10:20 56 AF	JSR $AF56  
; control flow target (from $AF08)
0x01AF23|$06:$AF13:60      	RTS        

; control flow target (from $AEF2, $AEF7, $AEFD, $AF03)
0x01AF24|$06:$AF14:48      	PHA        
0x01AF25|$06:$AF15:20 5A AF	JSR $AF5A  
0x01AF28|$06:$AF18:68      	PLA        
0x01AF29|$06:$AF19:AE C2 60	LDX $60C2  
0x01AF2C|$06:$AF1C:9D 00 01	STA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x01AF2F|$06:$AF1F:20 60 AF	JSR $AF60  
0x01AF32|$06:$AF22:EE C2 60	INC $60C2  
0x01AF35|$06:$AF25:AD C2 60	LDA $60C2  
0x01AF38|$06:$AF28:C9 08   	CMP #$08   
0x01AF3A|$06:$AF2A:B0 03   	BCS $AF2F  
0x01AF3C|$06:$AF2C:20 56 AF	JSR $AF56  
; control flow target (from $AF2A)
0x01AF3F|$06:$AF2F:60      	RTS        

; control flow target (from $AE92)
0x01AF40|$06:$AF30:AD C2 60	LDA $60C2  
0x01AF43|$06:$AF33:C9 08   	CMP #$08   
0x01AF45|$06:$AF35:90 0E   	BCC $AF45  
0x01AF47|$06:$AF37:20 46 AF	JSR $AF46  	; CLC if $0100-$0103 are all #$60, SEC otherwise
0x01AF4A|$06:$AF3A:B0 09   	BCS $AF45  	; branch if we have something != #$60
0x01AF4C|$06:$AF3C:A9 07   	LDA #$07   
0x01AF4E|$06:$AF3E:8D C2 60	STA $60C2  
0x01AF51|$06:$AF41:20
; actual target is $AF7D/$AF7E
; indexed data load target (from $AF00)
0x01AF52|$06:$AF42:   56 AF	JSR $AF56  
0x01AF54|$06:$AF44:18      	CLC        
; control flow target (from $AF35, $AF3A)
0x01AF55|$06:$AF45:60      	RTS        

; CLC if $0100-$0103 are all #$60, SEC otherwise
; control flow target (from $AEE4, $AF37)
0x01AF56|$06:$AF46:A2 03   	LDX #$03   
; control flow target (from $AF50)
0x01AF58|$06:$AF48:BD 00 01	LDA $0100,X	; string copy buffer start (often referenced as $00FF,X)
0x01AF5B|$06:$AF4B:C9 60   	CMP #$60   
0x01AF5D|$06:$AF4D:D0 05   	BNE $AF54  
0x01AF5F|$06:$AF4F:CA      	DEX        
0x01AF60|$06:$AF50:10 F6   	BPL $AF48  
0x01AF62|$06:$AF52:18      	CLC        	; entire string is #$60
0x01AF63|$06:$AF53:60      	RTS        

; control flow target (from $AF4D)
0x01AF64|$06:$AF54:38      	SEC        	; not entire string is #$60
0x01AF65|$06:$AF55:60      	RTS        

; control flow target (from $AE89, $AF10, $AF2C, $AF41)
0x01AF66|$06:$AF56:A9 77   	LDA #$77   
0x01AF68|$06:$AF58:D0 02   	BNE $AF5C  
; control flow target (from $AF0A, $AF15)
0x01AF6A|$06:$AF5A:A9 5F   	LDA #$5F   
; control flow target (from $AF58)
; indexed data load target (from $AEFA)
0x01AF6C|$06:$AF5C:A2 07   	LDX #$07   
0x01AF6E|$06:$AF5E:D0 02   	BNE $AF62  
; control flow target (from $AF1F)
0x01AF70|$06:$AF60:A2 06   	LDX #$06   
; control flow target (from $AF5E)
0x01AF72|$06:$AF62:8E 8C 60	STX $608C  
0x01AF75|$06:$AF65:85 09   	STA $09    
0x01AF77|$06:$AF67:AD C2 60	LDA $60C2  
0x01AF7A|$06:$AF6A:18      	CLC        
0x01AF7B|$06:$AF6B:69 0C   	ADC #$0C   
0x01AF7D|$06:$AF6D:8D 8B 60	STA $608B  
0x01AF80|$06:$AF70:20 09 A8	JSR $A809  
; call to code in a different bank ($0F:$C1FA)
0x01AF83|$06:$AF73: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
0x01AF86|$06:$AF76:67
0x01AF87|$06:$AF77:69
0x01AF88|$06:$AF78:6B
0x01AF89|$06:$AF79:70
0x01AF8A|$06:$AF7A:75
0x01AF8B|$06:$AF7B:63
0x01AF8C|$06:$AF7C:60
0x01AF8D|$06:$AF7D:6F
0x01AF8E|$06:$AF7E:6E

; data -> code
; from $0F:$F0BF via $8018
; control flow target (from $AE8C)
; indirect control flow target (via $8018)
0x01AF8F|$06:$AF7F:AD B4 60	LDA $60B4  	; menu phase (1 = first, 0 = second)
0x01AF92|$06:$AF82:D0 0D   	BNE $AF91  
0x01AF94|$06:$AF84:20 C6 AF	JSR $AFC6  
0x01AF97|$06:$AF87:A9 80   	LDA #$80   
0x01AF99|$06:$AF89:8D C5 60	STA $60C5  
0x01AF9C|$06:$AF8C:85 2F   	STA $2F    	; joypad 1 data
; control flow target (from $AE97)
; indirect control flow target (via $801A)
0x01AF9E|$06:$AF8E:20 92 AF	JSR $AF92  
; control flow target (from $AF82)
0x01AFA1|$06:$AF91:60      	RTS        

; control flow target (from $AF8E, $AF98)
0x01AFA2|$06:$AF92:20 9B AF	JSR $AF9B  
0x01AFA5|$06:$AF95:20 AC B0	JSR $B0AC  
0x01AFA8|$06:$AF98:4C 92 AF	JMP $AF92  

; control flow target (from $AF92, $AFB4, $AFC3)
; call to code in a different bank ($0F:$C1DC)
0x01AFAB|$06:$AF9B:20 DC C1	JSR $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF
0x01AFAE|$06:$AF9E:20 85 B0	JSR $B085  
0x01AFB1|$06:$AFA1:A5 2F   	LDA $2F    	; joypad 1 data
0x01AFB3|$06:$AFA3:F0 06   	BEQ $AFAB  
0x01AFB5|$06:$AFA5:A5 03   	LDA $03    	; game clock?
0x01AFB7|$06:$AFA7:29 0F   	AND #$0F   
0x01AFB9|$06:$AFA9:D0 03   	BNE $AFAE  
; control flow target (from $AFA3)
0x01AFBB|$06:$AFAB:8D C5 60	STA $60C5  
; control flow target (from $AFA9)
; call to code in a different bank ($0F:$C476)
0x01AFBE|$06:$AFAE:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x01AFC1|$06:$AFB1:AD C5 60	LDA $60C5  
0x01AFC4|$06:$AFB4:D0 E5   	BNE $AF9B  
0x01AFC6|$06:$AFB6:AD C5 60	LDA $60C5  
0x01AFC9|$06:$AFB9:25 2F   	AND $2F    	; joypad 1 data
0x01AFCB|$06:$AFBB:8D C5 60	STA $60C5  
0x01AFCE|$06:$AFBE:45 2F   	EOR $2F    	; joypad 1 data
0x01AFD0|$06:$AFC0:8D 8D 60	STA $608D  
0x01AFD3|$06:$AFC3:F0 D6   	BEQ $AF9B  
0x01AFD5|$06:$AFC5:60      	RTS        

; control flow target (from $AF84)
0x01AFD6|$06:$AFC6:A9 00   	LDA #$00   
0x01AFD8|$06:$AFC8:85 82   	STA $82    
0x01AFDA|$06:$AFCA:85 83   	STA $83    
0x01AFDC|$06:$AFCC:85 81   	STA $81    
0x01AFDE|$06:$AFCE:8D B0 60	STA $60B0  
0x01AFE1|$06:$AFD1:8D B1 60	STA $60B1  
0x01AFE4|$06:$AFD4:8D C5 60	STA $60C5  
0x01AFE7|$06:$AFD7:AD A5 60	LDA $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x01AFEA|$06:$AFDA:4A      	LSR        
0x01AFEB|$06:$AFDB:4A      	LSR        
0x01AFEC|$06:$AFDC:4A      	LSR        
0x01AFED|$06:$AFDD:4A      	LSR        
0x01AFEE|$06:$AFDE:AA      	TAX        
0x01AFEF|$06:$AFDF:BD C8 B2	LDA $B2C8,X
0x01AFF2|$06:$AFE2:8D C4 60	STA $60C4  
0x01AFF5|$06:$AFE5:A5 59   	LDA $59    	; menu ID
0x01AFF7|$06:$AFE7:C9 13   	CMP #$13   	; Menu ID #$13: Main menu: equip weapon
0x01AFF9|$06:$AFE9:F0 58   	BEQ $B043  
0x01AFFB|$06:$AFEB:C9 2D   	CMP #$2D   	; Menu ID #$2D: Main menu: equip armour
0x01AFFD|$06:$AFED:F0 54   	BEQ $B043  
0x01AFFF|$06:$AFEF:C9 2E   	CMP #$2E   	; Menu ID #$2E: Main menu: equip shield
0x01B001|$06:$AFF1:F0 50   	BEQ $B043  
0x01B003|$06:$AFF3:C9 2F   	CMP #$2F   	; Menu ID #$2F: Main menu: equip helmet
0x01B005|$06:$AFF5:F0 4C   	BEQ $B043  
0x01B007|$06:$AFF7:C9 45   	CMP #$45   	; Menu ID #$45: Game menu: select message speed
0x01B009|$06:$AFF9:F0 07   	BEQ $B002  
0x01B00B|$06:$AFFB:C9 07   	CMP #$07   	; Menu ID #$07: Battle menu: spell list
0x01B00D|$06:$AFFD:F0 1C   	BEQ $B01B  
0x01B00F|$06:$AFFF:4C 60 B0	JMP $B060  

; control flow target (from $AFF9)
0x01B012|$06:$B002:A2 00   	LDX #$00   
0x01B014|$06:$B004:AD 2C 06	LDA $062C  	; current battle message delay
0x01B017|$06:$B007:C9 32   	CMP #$32   
0x01B019|$06:$B009:90 06   	BCC $B011  
0x01B01B|$06:$B00B:E8      	INX        
0x01B01C|$06:$B00C:C9 64   	CMP #$64   
0x01B01E|$06:$B00E:90 01   	BCC $B011  
0x01B020|$06:$B010:E8      	INX        
; control flow target (from $B009, $B00E)
0x01B021|$06:$B011:86 83   	STX $83    
0x01B023|$06:$B013:8A      	TXA        
0x01B024|$06:$B014:0A      	ASL        
0x01B025|$06:$B015:8D B1 60	STA $60B1  
0x01B028|$06:$B018:4C 60 B0	JMP $B060  

; control flow target (from $AFFD)
0x01B02B|$06:$B01B:A2 00   	LDX #$00   
; control flow target (from $B025)
0x01B02D|$06:$B01D:BD BA 60	LDA $60BA,X
0x01B030|$06:$B020:D0 07   	BNE $B029  
0x01B032|$06:$B022:E8      	INX        
0x01B033|$06:$B023:E0 08   	CPX #$08   
0x01B035|$06:$B025:D0 F6   	BNE $B01D  
0x01B037|$06:$B027:A2 00   	LDX #$00   
; control flow target (from $B020)
0x01B039|$06:$B029:8A      	TXA        
0x01B03A|$06:$B02A:29 01   	AND #$01   
0x01B03C|$06:$B02C:85 82   	STA $82    
0x01B03E|$06:$B02E:F0 08   	BEQ $B038  
0x01B040|$06:$B030:AD A5 60	LDA $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x01B043|$06:$B033:29 0F   	AND #$0F   
0x01B045|$06:$B035:8D B0 60	STA $60B0  
; control flow target (from $B02E)
0x01B048|$06:$B038:8A      	TXA        
0x01B049|$06:$B039:4A      	LSR        
0x01B04A|$06:$B03A:85 83   	STA $83    
0x01B04C|$06:$B03C:0A      	ASL        
0x01B04D|$06:$B03D:8D B1 60	STA $60B1  
0x01B050|$06:$B040:4C 60 B0	JMP $B060  

; control flow target (from $AFE9, $AFED, $AFF1, $AFF5)
0x01B053|$06:$B043:AD B9 60	LDA $60B9  
0x01B056|$06:$B046:C9 FF   	CMP #$FF   
0x01B058|$06:$B048:F0 09   	BEQ $B053  
0x01B05A|$06:$B04A:85 83   	STA $83    
0x01B05C|$06:$B04C:0A      	ASL        
0x01B05D|$06:$B04D:8D B1 60	STA $60B1  
0x01B060|$06:$B050:4C 60 B0	JMP $B060  

; control flow target (from $B048)
0x01B063|$06:$B053:38      	SEC        
0x01B064|$06:$B054:AD A3 60	LDA $60A3  	; menu window height (ROM value * 2)
0x01B067|$06:$B057:E9 03   	SBC #$03   
0x01B069|$06:$B059:4A      	LSR        
0x01B06A|$06:$B05A:85 83   	STA $83    
0x01B06C|$06:$B05C:0A      	ASL        
0x01B06D|$06:$B05D:8D B1 60	STA $60B1  
; control flow target (from $AFFF, $B018, $B040, $B050)
0x01B070|$06:$B060:AD A9 60	LDA $60A9  	; menu cursor initial position (from ROM; X-pos = low nybble, Y-pos = high nybble)
0x01B073|$06:$B063:48      	PHA        
0x01B074|$06:$B064:29 0F   	AND #$0F   
0x01B076|$06:$B066:8D B2 60	STA $60B2  
0x01B079|$06:$B069:18      	CLC        
0x01B07A|$06:$B06A:6D B0 60	ADC $60B0  
0x01B07D|$06:$B06D:8D B0 60	STA $60B0  
0x01B080|$06:$B070:68      	PLA        
0x01B081|$06:$B071:29 F0   	AND #$F0   
0x01B083|$06:$B073:4A      	LSR        
0x01B084|$06:$B074:4A      	LSR        
0x01B085|$06:$B075:4A      	LSR        
0x01B086|$06:$B076:4A      	LSR        
0x01B087|$06:$B077:8D B3 60	STA $60B3  
0x01B08A|$06:$B07A:6D B1 60	ADC $60B1  
0x01B08D|$06:$B07D:8D B1 60	STA $60B1  
0x01B090|$06:$B080:A9 05   	LDA #$05   
0x01B092|$06:$B082:85 03   	STA $03    	; game clock?
0x01B094|$06:$B084:60      	RTS        

; control flow target (from $AF9E)
0x01B095|$06:$B085:A2 5F   	LDX #$5F   
0x01B097|$06:$B087:A5 03   	LDA $03    	; game clock?
0x01B099|$06:$B089:29 1F   	AND #$1F   
0x01B09B|$06:$B08B:C9 10   	CMP #$10   
0x01B09D|$06:$B08D:B0 02   	BCS $B091  
; control flow target (from $B218)
0x01B09F|$06:$B08F:A2 72   	LDX #$72   
; control flow target (from $B08D, $B211)
0x01B0A1|$06:$B091:86 09   	STX $09    
0x01B0A3|$06:$B093:A5 4D   	LDA $4D    
0x01B0A5|$06:$B095:18      	CLC        
0x01B0A6|$06:$B096:6D B0 60	ADC $60B0  
0x01B0A9|$06:$B099:8D 8B 60	STA $608B  
0x01B0AC|$06:$B09C:A5 4E   	LDA $4E    
0x01B0AE|$06:$B09E:18      	CLC        
0x01B0AF|$06:$B09F:6D B1 60	ADC $60B1  
0x01B0B2|$06:$B0A2:8D 8C 60	STA $608C  
; call to code in a different bank ($0F:$FE97)
0x01B0B5|$06:$B0A5: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
0x01B0B8|$06:$B0A8:C1	; $06:$8002

; data -> code
; call to code in a different bank ($0F:$C1FA)
0x01B0B9|$06:$B0A9: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

; control flow target (from $AF95)
0x01B0BC|$06:$B0AC:AD 8D 60	LDA $608D  
0x01B0BF|$06:$B0AF:4A      	LSR        
0x01B0C0|$06:$B0B0:B0 17   	BCS $B0C9  
0x01B0C2|$06:$B0B2:4A      	LSR        
0x01B0C3|$06:$B0B3:B0 31   	BCS $B0E6  
0x01B0C5|$06:$B0B5:4A      	LSR        
0x01B0C6|$06:$B0B6:4A      	LSR        
0x01B0C7|$06:$B0B7:4A      	LSR        
0x01B0C8|$06:$B0B8:B0 39   	BCS $B0F3  
0x01B0CA|$06:$B0BA:4A      	LSR        
0x01B0CB|$06:$B0BB:B0 63   	BCS $B120  
0x01B0CD|$06:$B0BD:4A      	LSR        
0x01B0CE|$06:$B0BE:B0 06   	BCS $B0C6  
0x01B0D0|$06:$B0C0:4A      	LSR        
0x01B0D1|$06:$B0C1:90 47   	BCC $B10A  
0x01B0D3|$06:$B0C3:4C BE B1	JMP $B1BE  

; control flow target (from $B0BE)
0x01B0D6|$06:$B0C6:4C 74 B1	JMP $B174  

; control flow target (from $B0B0)
0x01B0D9|$06:$B0C9:A9 01   	LDA #$01   
0x01B0DB|$06:$B0CB:8D C5 60	STA $60C5  
0x01B0DE|$06:$B0CE:20 14 B2	JSR $B214  
0x01B0E1|$06:$B0D1:A9 85   	LDA #$85   	; Music ID #$85: single beep SFX
; call to code in a different bank ($0F:$C561)
0x01B0E3|$06:$B0D3:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x01B0E6|$06:$B0D6:A5 82   	LDA $82    
0x01B0E8|$06:$B0D8:85 12   	STA $12    
0x01B0EA|$06:$B0DA:A5 83   	LDA $83    
0x01B0EC|$06:$B0DC:85 13   	STA $13    
0x01B0EE|$06:$B0DE:20 94 B2	JSR $B294  
0x01B0F1|$06:$B0E1:68      	PLA        
0x01B0F2|$06:$B0E2:68      	PLA        
0x01B0F3|$06:$B0E3:A5 81   	LDA $81    
0x01B0F5|$06:$B0E5:60      	RTS        

; control flow target (from $B0B3)
0x01B0F6|$06:$B0E6:A9 02   	LDA #$02   
0x01B0F8|$06:$B0E8:8D C5 60	STA $60C5  
0x01B0FB|$06:$B0EB:20 14 B2	JSR $B214  
0x01B0FE|$06:$B0EE:68      	PLA        
0x01B0FF|$06:$B0EF:68      	PLA        
0x01B100|$06:$B0F0:A9 FF   	LDA #$FF   
0x01B102|$06:$B0F2:60      	RTS        

; control flow target (from $B0B8)
0x01B103|$06:$B0F3:A9 10   	LDA #$10   
0x01B105|$06:$B0F5:8D C5 60	STA $60C5  
0x01B108|$06:$B0F8: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)
0x01B10B|$06:$B0FB:70 0E   	BVS $B10B  
; control flow target (from $B112)
0x01B10D|$06:$B0FD:A5 83   	LDA $83    
0x01B10F|$06:$B0FF:F0 09   	BEQ $B10A  
0x01B111|$06:$B101:20 0F B2	JSR $B20F  
0x01B114|$06:$B104:20 BC B2	JSR $B2BC  
0x01B117|$06:$B107:20 14 B2	JSR $B214  
; control flow target (from $B0C1, $B0FF, $B10E)
0x01B11A|$06:$B10A:60      	RTS        

; control flow target (from $B0FB)
0x01B11B|$06:$B10B:AD B1 60	LDA $60B1  
0x01B11E|$06:$B10E:F0 FA   	BEQ $B10A  
0x01B120|$06:$B110:A5 83   	LDA $83    
0x01B122|$06:$B112:D0 E9   	BNE $B0FD  
0x01B124|$06:$B114:20 0F B2	JSR $B20F  
0x01B127|$06:$B117:A9 00   	LDA #$00   
0x01B129|$06:$B119:8D B1 60	STA $60B1  
0x01B12C|$06:$B11C:20 14 B2	JSR $B214  
0x01B12F|$06:$B11F:60      	RTS        

; control flow target (from $B0BB)
0x01B130|$06:$B120:A9 20   	LDA #$20   
0x01B132|$06:$B122:8D C5 60	STA $60C5  
0x01B135|$06:$B125:A5 59   	LDA $59    	; menu ID
0x01B137|$06:$B127:C9 45   	CMP #$45   	; Menu ID #$45: Game menu: select message speed
0x01B139|$06:$B129:D0 06   	BNE $B131  
0x01B13B|$06:$B12B:A5 83   	LDA $83    
0x01B13D|$06:$B12D:C9 02   	CMP #$02   
0x01B13F|$06:$B12F:F0 42   	BEQ $B173  
; control flow target (from $B129)
0x01B141|$06:$B131:38      	SEC        
0x01B142|$06:$B132:AD A3 60	LDA $60A3  	; menu window height (ROM value * 2)
0x01B145|$06:$B135:E9 03   	SBC #$03   
0x01B147|$06:$B137:4A      	LSR        
0x01B148|$06:$B138:C5 83   	CMP $83    
0x01B14A|$06:$B13A:F0 37   	BEQ $B173  
0x01B14C|$06:$B13C:20 0F B2	JSR $B20F  
0x01B14F|$06:$B13F:A5 59   	LDA $59    	; menu ID
0x01B151|$06:$B141:C9 44   	CMP #$44   	; Menu ID #$44: Game menu: new game name input area
0x01B153|$06:$B143:F0 13   	BEQ $B158  
0x01B155|$06:$B145:C9 07   	CMP #$07   	; Menu ID #$07: Battle menu: spell list
0x01B157|$06:$B147:F0 08   	BEQ $B151  
0x01B159|$06:$B149:C9 08   	CMP #$08   	; Menu ID #$08: Battle menu: item list window 1
0x01B15B|$06:$B14B:F0 04   	BEQ $B151  
0x01B15D|$06:$B14D:C9 22   	CMP #$22   	; Menu ID #$22: Battle menu: item list window 2
0x01B15F|$06:$B14F:D0 0A   	BNE $B15B  
; control flow target (from $B147, $B14B)
0x01B161|$06:$B151:20 43 B2	JSR $B243  
0x01B164|$06:$B154:90 1D   	BCC $B173  
0x01B166|$06:$B156:B0 03   	BCS $B15B  
; control flow target (from $B143)
0x01B168|$06:$B158:20 1E B2	JSR $B21E  
; control flow target (from $B14F, $B156)
0x01B16B|$06:$B15B:AD B1 60	LDA $60B1  
0x01B16E|$06:$B15E:D0 08   	BNE $B168  
0x01B170|$06:$B160:AD B3 60	LDA $60B3  
0x01B173|$06:$B163:8D B1 60	STA $60B1  
0x01B176|$06:$B166:D0 08   	BNE $B170  
; control flow target (from $B15E)
0x01B178|$06:$B168:18      	CLC        
0x01B179|$06:$B169:69 02   	ADC #$02   
0x01B17B|$06:$B16B:8D B1 60	STA $60B1  
0x01B17E|$06:$B16E:E6 83   	INC $83    
; control flow target (from $B166)
0x01B180|$06:$B170:20 14 B2	JSR $B214  
; control flow target (from $B12F, $B13A, $B154)
0x01B183|$06:$B173:60      	RTS        

; control flow target (from $B0C6)
0x01B184|$06:$B174:A9 40   	LDA #$40   
0x01B186|$06:$B176:8D C5 60	STA $60C5  
0x01B189|$06:$B179:A5 82   	LDA $82    
0x01B18B|$06:$B17B:F0 40   	BEQ $B1BD  
0x01B18D|$06:$B17D:A5 59   	LDA $59    	; menu ID
0x01B18F|$06:$B17F:C9 44   	CMP #$44   	; Menu ID #$44: Game menu: new game name input area
0x01B191|$06:$B181:F0 0B   	BEQ $B18E  
0x01B193|$06:$B183:C9 07   	CMP #$07   	; Menu ID #$07: Battle menu: spell list
0x01B195|$06:$B185:D0 1E   	BNE $B1A5  
0x01B197|$06:$B187:20 52 B2	JSR $B252  
0x01B19A|$06:$B18A:90 31   	BCC $B1BD  
0x01B19C|$06:$B18C:B0 17   	BCS $B1A5  
; control flow target (from $B181)
0x01B19E|$06:$B18E:A5 83   	LDA $83    
0x01B1A0|$06:$B190:C9 05   	CMP #$05   
0x01B1A2|$06:$B192:D0 11   	BNE $B1A5  
0x01B1A4|$06:$B194:A5 82   	LDA $82    
0x01B1A6|$06:$B196:C9 09   	CMP #$09   
0x01B1A8|$06:$B198:D0 0B   	BNE $B1A5  
0x01B1AA|$06:$B19A:A9 06   	LDA #$06   
0x01B1AC|$06:$B19C:85 82   	STA $82    
0x01B1AE|$06:$B19E:20 0F B2	JSR $B20F  
0x01B1B1|$06:$B1A1:A9 0D   	LDA #$0D   
0x01B1B3|$06:$B1A3:D0 12   	BNE $B1B7  
; control flow target (from $B185, $B18C, $B192, $B198)
0x01B1B5|$06:$B1A5:20 0F B2	JSR $B20F  
0x01B1B8|$06:$B1A8:C6 82   	DEC $82    
0x01B1BA|$06:$B1AA:AD A5 60	LDA $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x01B1BD|$06:$B1AD:29 0F   	AND #$0F   
0x01B1BF|$06:$B1AF:85 10   	STA $10    
0x01B1C1|$06:$B1B1:AD B0 60	LDA $60B0  
0x01B1C4|$06:$B1B4:38      	SEC        
0x01B1C5|$06:$B1B5:E5 10   	SBC $10    
; control flow target (from $B1A3)
0x01B1C7|$06:$B1B7:8D B0 60	STA $60B0  
0x01B1CA|$06:$B1BA:20 14 B2	JSR $B214  
; control flow target (from $B17B, $B18A)
0x01B1CD|$06:$B1BD:60      	RTS        

; control flow target (from $B0C3)
0x01B1CE|$06:$B1BE:A9 80   	LDA #$80   
0x01B1D0|$06:$B1C0:8D C5 60	STA $60C5  
0x01B1D3|$06:$B1C3:AD A5 60	LDA $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x01B1D6|$06:$B1C6:F0 46   	BEQ $B20E  
0x01B1D8|$06:$B1C8:A5 59   	LDA $59    	; menu ID
0x01B1DA|$06:$B1CA:C9 44   	CMP #$44   	; Menu ID #$44: Game menu: new game name input area
0x01B1DC|$06:$B1CC:F0 0B   	BEQ $B1D9  
0x01B1DE|$06:$B1CE:C9 07   	CMP #$07   	; Menu ID #$07: Battle menu: spell list
0x01B1E0|$06:$B1D0:D0 20   	BNE $B1F2  
0x01B1E2|$06:$B1D2:20 5A B2	JSR $B25A  
0x01B1E5|$06:$B1D5:90 37   	BCC $B20E  
0x01B1E7|$06:$B1D7:B0 19   	BCS $B1F2  
; control flow target (from $B1CC)
0x01B1E9|$06:$B1D9:A5 83   	LDA $83    
0x01B1EB|$06:$B1DB:C9 05   	CMP #$05   
0x01B1ED|$06:$B1DD:D0 13   	BNE $B1F2  
0x01B1EF|$06:$B1DF:A5 82   	LDA $82    
0x01B1F1|$06:$B1E1:C9 06   	CMP #$06   
0x01B1F3|$06:$B1E3:90 0D   	BCC $B1F2  
0x01B1F5|$06:$B1E5:D0 27   	BNE $B20E  
0x01B1F7|$06:$B1E7:20 0F B2	JSR $B20F  
0x01B1FA|$06:$B1EA:A9 09   	LDA #$09   
0x01B1FC|$06:$B1EC:85 82   	STA $82    
0x01B1FE|$06:$B1EE:A9 13   	LDA #$13   
0x01B200|$06:$B1F0:D0 16   	BNE $B208  
; control flow target (from $B1D0, $B1D7, $B1DD, $B1E3)
0x01B202|$06:$B1F2:AE C4 60	LDX $60C4  
0x01B205|$06:$B1F5:CA      	DEX        
0x01B206|$06:$B1F6:E4 82   	CPX $82    
0x01B208|$06:$B1F8:F0 14   	BEQ $B20E  
0x01B20A|$06:$B1FA:20 0F B2	JSR $B20F  
0x01B20D|$06:$B1FD:E6 82   	INC $82    
0x01B20F|$06:$B1FF:AD A5 60	LDA $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x01B212|$06:$B202:29 0F   	AND #$0F   
0x01B214|$06:$B204:18      	CLC        
0x01B215|$06:$B205:6D B0 60	ADC $60B0  
; control flow target (from $B1F0)
0x01B218|$06:$B208:8D B0 60	STA $60B0  
0x01B21B|$06:$B20B:20 14 B2	JSR $B214  
; control flow target (from $B1C6, $B1D5, $B1E5, $B1F8)
0x01B21E|$06:$B20E:60      	RTS        

; control flow target (from $B101, $B114, $B13C, $B19E, $B1A5, $B1E7, $B1FA, $B276, $B27F)
0x01B21F|$06:$B20F:A2 5F   	LDX #$5F   
0x01B221|$06:$B211:4C 91 B0	JMP $B091  

; control flow target (from $B0CE, $B0EB, $B107, $B11C, $B170, $B1BA, $B20B)
0x01B224|$06:$B214:A9 05   	LDA #$05   
0x01B226|$06:$B216:85 03   	STA $03    	; game clock?
0x01B228|$06:$B218:20 8F B0	JSR $B08F  
; call to code in a different bank ($0F:$C1DC)
0x01B22B|$06:$B21B:4C DC C1	JMP $C1DC  	; set $6007 = #$00, set $00 = #$01, wait for interrupt, set $00 = #$FF

; control flow target (from $B158)
0x01B22E|$06:$B21E:A5 83   	LDA $83    
0x01B230|$06:$B220:C9 04   	CMP #$04   
0x01B232|$06:$B222:D0 1E   	BNE $B242  
0x01B234|$06:$B224:A5 82   	LDA $82    
0x01B236|$06:$B226:C9 07   	CMP #$07   
0x01B238|$06:$B228:F0 0F   	BEQ $B239  
0x01B23A|$06:$B22A:C9 08   	CMP #$08   
0x01B23C|$06:$B22C:90 14   	BCC $B242  
0x01B23E|$06:$B22E:A9 09   	LDA #$09   
0x01B240|$06:$B230:85 82   	STA $82    
0x01B242|$06:$B232:A9 13   	LDA #$13   
0x01B244|$06:$B234:8D B0 60	STA $60B0  
0x01B247|$06:$B237:D0 09   	BNE $B242  
; control flow target (from $B228)
0x01B249|$06:$B239:A9 06   	LDA #$06   
0x01B24B|$06:$B23B:85 82   	STA $82    
0x01B24D|$06:$B23D:A9 0D   	LDA #$0D   
0x01B24F|$06:$B23F:8D B0 60	STA $60B0  
; control flow target (from $B222, $B22C, $B237)
0x01B252|$06:$B242:60      	RTS        

; control flow target (from $B151)
0x01B253|$06:$B243:20 B3 B2	JSR $B2B3  	; copy $82-$83 to $12-$13
0x01B256|$06:$B246:E6 13   	INC $13    
0x01B258|$06:$B248:AD B1 60	LDA $60B1  
0x01B25B|$06:$B24B:F0 03   	BEQ $B250  
0x01B25D|$06:$B24D:4C 87 B2	JMP $B287  

; control flow target (from $B24B)
0x01B260|$06:$B250:38      	SEC        
0x01B261|$06:$B251:60      	RTS        

; control flow target (from $B187)
0x01B262|$06:$B252:20 B3 B2	JSR $B2B3  	; copy $82-$83 to $12-$13
0x01B265|$06:$B255:C6 12   	DEC $12    
0x01B267|$06:$B257:4C 5F B2	JMP $B25F  

; control flow target (from $B1D2)
0x01B26A|$06:$B25A:20 B3 B2	JSR $B2B3  	; copy $82-$83 to $12-$13
0x01B26D|$06:$B25D:E6 12   	INC $12    
; control flow target (from $B257)
0x01B26F|$06:$B25F:20 87 B2	JSR $B287  
0x01B272|$06:$B262:B0 22   	BCS $B286  
0x01B274|$06:$B264:C6 13   	DEC $13    
0x01B276|$06:$B266:30 1E   	BMI $B286  
0x01B278|$06:$B268:20 87 B2	JSR $B287  
0x01B27B|$06:$B26B:B0 12   	BCS $B27F  
0x01B27D|$06:$B26D:C6 13   	DEC $13    
0x01B27F|$06:$B26F:30 15   	BMI $B286  
0x01B281|$06:$B271:20 87 B2	JSR $B287  
0x01B284|$06:$B274:90 10   	BCC $B286  
0x01B286|$06:$B276:20 0F B2	JSR $B20F  
0x01B289|$06:$B279:20 BC B2	JSR $B2BC  
0x01B28C|$06:$B27C:4C 82 B2	JMP $B282  

; control flow target (from $B26B)
0x01B28F|$06:$B27F:20 0F B2	JSR $B20F  
; control flow target (from $B27C)
0x01B292|$06:$B282:20 BC B2	JSR $B2BC  
0x01B295|$06:$B285:38      	SEC        
; control flow target (from $B262, $B266, $B26F, $B274)
0x01B296|$06:$B286:60      	RTS        

; control flow target (from $B24D, $B25F, $B268, $B271)
0x01B297|$06:$B287:20 94 B2	JSR $B294  
0x01B29A|$06:$B28A:AA      	TAX        
0x01B29B|$06:$B28B:BD BA 60	LDA $60BA,X
0x01B29E|$06:$B28E:F0 02   	BEQ $B292  
0x01B2A0|$06:$B290:38      	SEC        
0x01B2A1|$06:$B291:60      	RTS        

; control flow target (from $B28E)
0x01B2A2|$06:$B292:18      	CLC        
0x01B2A3|$06:$B293:60      	RTS        

; control flow target (from $B0DE, $B287)
0x01B2A4|$06:$B294:A5 13   	LDA $13    
0x01B2A6|$06:$B296:AE A5 60	LDX $60A5  	; menu cursor second column X-offset (from left edge of menu)
0x01B2A9|$06:$B299:F0 15   	BEQ $B2B0  
0x01B2AB|$06:$B29B:29 0F   	AND #$0F   
0x01B2AD|$06:$B29D:85 10   	STA $10    
0x01B2AF|$06:$B29F:A9 00   	LDA #$00   
0x01B2B1|$06:$B2A1:85 11   	STA $11    
0x01B2B3|$06:$B2A3:A2 10   	LDX #$10   
0x01B2B5|$06:$B2A5:AD C4 60	LDA $60C4  
; call to code in a different bank ($0F:$F0F4)
0x01B2B8|$06:$B2A8:20 F4 F0	JSR $F0F4  	; 16-bit multiplication: set 16-bit ($00,X-$01,X) = ($00,X-$01,X) * A
0x01B2BB|$06:$B2AB:A5 10   	LDA $10    
0x01B2BD|$06:$B2AD:18      	CLC        
0x01B2BE|$06:$B2AE:65 12   	ADC $12    
; control flow target (from $B299)
0x01B2C0|$06:$B2B0:85 81   	STA $81    
0x01B2C2|$06:$B2B2:60      	RTS        

; copy $82-$83 to $12-$13
; control flow target (from $B243, $B252, $B25A)
0x01B2C3|$06:$B2B3:A5 82   	LDA $82    
0x01B2C5|$06:$B2B5:85 12   	STA $12    
0x01B2C7|$06:$B2B7:A5 83   	LDA $83    
0x01B2C9|$06:$B2B9:85 13   	STA $13    
0x01B2CB|$06:$B2BB:60      	RTS        

; control flow target (from $B104, $B279, $B282)
0x01B2CC|$06:$B2BC:AD B1 60	LDA $60B1  
0x01B2CF|$06:$B2BF:38      	SEC        
0x01B2D0|$06:$B2C0:E9 02   	SBC #$02   
0x01B2D2|$06:$B2C2:8D B1 60	STA $60B1  
0x01B2D5|$06:$B2C5:C6 83   	DEC $83    
0x01B2D7|$06:$B2C7:60      	RTS        


; code -> data
; indexed data load target (from $AFDF)
0x01B2D8|$06:$B2C8:02
0x01B2D9|$06:$B2C9:0B
; Item list part 1, line 1
; indirect data load target (via $8022)
0x01B2DA|$06:$B2CA:25 0A 16 0B 18 18 FF	; Bamboo[end-FF]
0x01B2E1|$06:$B2D1:30 0A 10 12 0C FF	; Magic[end-FF]
0x01B2E7|$06:$B2D7:3A 12 23 0A 1B 0D 67 1C FF	; Wizard's[end-FF]
0x01B2F0|$06:$B2E0:36 1D 0A 0F 0F 5F 18 0F FF	; Staff of[end-FF]
0x01B2F9|$06:$B2E9:26 15 1E 0B FF	; Club[end-FF]
0x01B2FE|$06:$B2EE:26 18 19 19 0E 1B FF	; Copper[end-FF]
0x01B305|$06:$B2F5:26 11 0A 12 17 FF	; Chain[end-FF]
0x01B30B|$06:$B2FB:2C 1B 18 17 FF	; Iron[end-FF]
0x01B310|$06:$B300:29 0A 15 0C 18 17 FF	; Falcon[end-FF]
0x01B317|$06:$B307:25 1B 18 0A 0D FF	; Broad[end-FF]
0x01B31D|$06:$B30D:2A 12 0A 17 1D FF	; Giant[end-FF]
0x01B323|$06:$B313:36 20 18 1B 0D 5F 18 0F FF	; Sword of[end-FF]
0x01B32C|$06:$B31C:27 1B 0A 10 18 17 FF	; Dragon[end-FF]
0x01B333|$06:$B323:2F 12 10 11 1D FF	; Light[end-FF]
0x01B339|$06:$B329:36 20 18 1B 0D 5F 18 0F FF	; Sword of[end-FF]
0x01B342|$06:$B332:37 11 1E 17 0D 0E 1B FF	; Thunder[end-FF]
0x01B34A|$06:$B33A:26 15 18 1D 11 0E 1C FF	; Clothes[end-FF]
0x01B352|$06:$B342:26 15 18 1D 11 0E 1C FF	; Clothes[end-FF]
0x01B35A|$06:$B34A:3A 0A 1D 0E 1B 5F 29 15 22 12 17 10 FF	; Water Flying[end-FF]
0x01B367|$06:$B357:30 12 17 14 FF	; Mink[end-FF]
0x01B36C|$06:$B35C:2F 0E 0A 1D 11 0E 1B FF	; Leather[end-FF]
0x01B374|$06:$B364:26 11 0A 12 17 FF	; Chain[end-FF]
0x01B37A|$06:$B36A:2A 1B 0E 16 15 12 17 67 1C FF	; Gremlin's[end-FF]
0x01B384|$06:$B374:30 0A 10 12 0C FF	; Magic[end-FF]
0x01B38A|$06:$B37A:29 1E 15 15 5F 33 15 0A 1D 0E FF	; Full Plate[end-FF]
0x01B395|$06:$B385:24 1B 16 18 1B 5F 18 0F FF	; Armor of[end-FF]
0x01B39E|$06:$B38E:24 1B 16 18 1B 5F 18 0F FF	; Armor of[end-FF]
0x01B3A7|$06:$B397:2F 0E 0A 1D 11 0E 1B FF	; Leather[end-FF]
0x01B3AF|$06:$B39F:36 11 12 0E 15 0D 5F 18 0F FF	; Shield of[end-FF]
0x01B3B9|$06:$B3A9:36 1D 0E 0E 15 FF	; Steel[end-FF]
0x01B3BF|$06:$B3AF:28 1F 12 15 FF	; Evil[end-FF]
0x01B3C4|$06:$B3B4:36 11 12 0E 15 0D 5F 18 0F FF	; Shield of[end-FF]
; Item list part 2, line 1
; indirect data load target (via $8030)
0x01B3CE|$06:$B3BE:30 22 1C 1D 0E 1B 12 18 1E 1C FF	; Mysterious[end-FF]
0x01B3D9|$06:$B3C9:2C 1B 18 17 FF	; Iron[end-FF]
0x01B3DE|$06:$B3CE:2B 0E 15 16 0E 1D 5F 18 0F FF	; Helmet of[end-FF]
0x01B3E8|$06:$B3D8:37 18 14 0E 17 5F 18 0F FF	; Token of[end-FF]
0x01B3F1|$06:$B3E1:37 1B 0E 1C 1E 1B 0E 1C FF	; Tresures[end-FF]
0x01B3FA|$06:$B3EA:30 18 18 17 FF	; Moon[end-FF]
0x01B3FF|$06:$B3EF:26 11 0A 1B 16 5F 18 0F FF	; Charm of[end-FF]
0x01B408|$06:$B3F8:28 22 0E 5F 18 0F FF	; Eye of[end-FF]
0x01B40F|$06:$B3FF:2F 0E 0A 0F 5F 18 0F 5F 37 11 0E FF	; Leaf of The[end-FF]
0x01B41B|$06:$B40B:28 0C 11 18 12 17 10 FF	; Echoing[end-FF]
0x01B423|$06:$B413:30 12 1B 1B 18 1B 5F 18 0F FF	; Mirror of[end-FF]
0x01B42D|$06:$B41D:27 0E 20 67 1C FF	; Dew's[end-FF]
0x01B433|$06:$B423:30 0A 10 12 0C FF	; Magic[end-FF]
0x01B439|$06:$B429:26 15 18 0A 14 5F 18 0F FF	; Cloak of[end-FF]
0x01B442|$06:$B432:2A 1B 0E 16 15 12 17 67 1C FF	; Gremlin's[end-FF]
0x01B44C|$06:$B43C:27 1B 0A 10 18 17 67 1C FF	; Dragon's[end-FF]
0x01B455|$06:$B445:27 1B 0A 10 18 17 67 1C FF	; Dragon's[end-FF]
0x01B45E|$06:$B44E:2A 18 15 0D 0E 17 FF	; Golden[end-FF]
0x01B465|$06:$B455:2F 18 1D 1D 0E 1B 22 FF	; Lottery[end-FF]
0x01B46D|$06:$B45D:29 0A 12 1B 22 FF	; Fairy[end-FF]
0x01B473|$06:$B463:3A 12 17 10 5F 18 0F FF	; Wing of[end-FF]
0x01B47B|$06:$B46B:FF	; [end-FF]
0x01B47C|$06:$B46C:2A 18 15 0D 0E 17 FF	; Golden[end-FF]
0x01B483|$06:$B473:36 12 15 1F 0E 1B FF	; Silver[end-FF]
0x01B48A|$06:$B47A:2D 0A 12 15 18 1B 67 1C FF	; Jailor's[end-FF]
0x01B493|$06:$B483:3A 0A 1D 0E 1B 10 0A 1D 0E FF	; Watergate[end-FF]
0x01B49D|$06:$B48D:24 17 1D 12 0D 18 1D 0E FF	; Antidote[end-FF]
0x01B4A6|$06:$B496:30 0E 0D 12 0C 0A 15 FF	; Medical[end-FF]
0x01B4AE|$06:$B49E:3A 12 23 0A 1B 0D 67 1C FF	; Wizard's[end-FF]
0x01B4B7|$06:$B4A7:33 0E 1B 12 15 18 1E 1C FF	; Perilous[end-FF]
0x01B4C0|$06:$B4B0:FF	; [end-FF]
0x01B4C1|$06:$B4B1:FF	; [end-FF]
; Item list part 1, line 2
; indirect data load target (via $8024)
0x01B4C2|$06:$B4B2:36 1D 12 0C 14 FF	; Stick[end-FF]
0x01B4C8|$06:$B4B8:2E 17 12 0F 0E FF	; Knife[end-FF]
0x01B4CE|$06:$B4BE:3A 0A 17 0D FF	; Wand[end-FF]
0x01B4D3|$06:$B4C3:37 11 1E 17 0D 0E 1B FF	; Thunder[end-FF]
0x01B4DB|$06:$B4CB:FF	; [end-FF]
0x01B4DC|$06:$B4CC:36 20 18 1B 0D FF	; Sword[end-FF]
0x01B4E2|$06:$B4D2:36 12 0C 14 15 0E FF	; Sickle[end-FF]
0x01B4E9|$06:$B4D9:36 19 0E 0A 1B FF	; Spear[end-FF]
0x01B4EF|$06:$B4DF:36 20 18 1B 0D FF	; Sword[end-FF]
0x01B4F5|$06:$B4E5:36 20 18 1B 0D FF	; Sword[end-FF]
0x01B4FB|$06:$B4EB:2B 0A 16 16 0E 1B FF	; Hammer[end-FF]
0x01B502|$06:$B4F2:27 0E 1C 1D 1B 1E 0C 1D 12 18 17 FF	; Destruction[end-FF]
0x01B50E|$06:$B4FE:2E 12 15 15 0E 1B FF	; Killer[end-FF]
0x01B515|$06:$B505:36 20 18 1B 0D FF	; Sword[end-FF]
0x01B51B|$06:$B50B:28 1B 0D 1B 12 0C 14 FF	; Erdrick[end-FF]
0x01B523|$06:$B513:36 20 18 1B 0D FF	; Sword[end-FF]
0x01B529|$06:$B519:FF	; [end-FF]
0x01B52A|$06:$B51A:2B 12 0D 12 17 10 FF	; Hiding[end-FF]
0x01B531|$06:$B521:26 15 18 1D 11 FF	; Cloth[end-FF]
0x01B537|$06:$B527:26 18 0A 1D FF	; Coat[end-FF]
0x01B53C|$06:$B52C:24 1B 16 18 1B FF	; Armor[end-FF]
0x01B542|$06:$B532:30 0A 12 15 FF	; Mail[end-FF]
0x01B547|$06:$B537:24 1B 16 18 1B FF	; Armor[end-FF]
0x01B54D|$06:$B53D:24 1B 16 18 1B FF	; Armor[end-FF]
0x01B553|$06:$B543:24 1B 16 18 1B FF	; Armor[end-FF]
0x01B559|$06:$B549:2A 0A 12 0A FF	; Gaia[end-FF]
0x01B55E|$06:$B54E:28 1B 0D 1B 12 0C 14 FF	; Erdrick[end-FF]
0x01B566|$06:$B556:36 11 12 0E 15 0D FF	; Shield[end-FF]
0x01B56D|$06:$B55D:36 1D 1B 0E 17 10 1D 11 FF	; Strength[end-FF]
0x01B576|$06:$B566:36 11 12 0E 15 0D FF	; Shield[end-FF]
0x01B57D|$06:$B56D:36 11 12 0E 15 0D FF	; Shield[end-FF]
0x01B584|$06:$B574:28 1B 0D 1B 12 0C 14 FF	; Erdrick[end-FF]
; Item list part 2, line 2
; indirect data load target (via $8032)
0x01B58C|$06:$B57C:2B 0A 1D FF	; Hat[end-FF]
0x01B590|$06:$B580:2B 0E 15 16 0E 1D FF	; Helmet[end-FF]
0x01B597|$06:$B587:28 1B 0D 1B 12 0C 14 FF	; Erdrick[end-FF]
0x01B59F|$06:$B58F:28 1B 0D 1B 12 0C 14 FF	; Erdrick[end-FF]
0x01B5A7|$06:$B597:FF	; [end-FF]
0x01B5A8|$06:$B598:29 1B 0A 10 16 0E 17 1D FF	; Fragment[end-FF]
0x01B5B1|$06:$B5A1:35 1E 0B 12 1C 1C FF	; Rubiss[end-FF]
0x01B5B8|$06:$B5A8:30 0A 15 1B 18 1D 11 FF	; Malroth[end-FF]
0x01B5C0|$06:$B5B0:3A 18 1B 15 0D 5F 37 1B 0E 0E FF	; World Tree[end-FF]
0x01B5CB|$06:$B5BB:29 15 1E 1D 0E FF	; Flute[end-FF]
0x01B5D1|$06:$B5C1:35 0A FF	; Ra[end-FF]
0x01B5D4|$06:$B5C4:3C 0A 1B 17 FF	; Yarn[end-FF]
0x01B5D9|$06:$B5C9:2F 18 18 16 FF	; Loom[end-FF]
0x01B5DE|$06:$B5CE:3A 12 17 0D FF	; Wind[end-FF]
0x01B5E3|$06:$B5D3:37 0A 12 15 FF	; Tail[end-FF]
0x01B5E8|$06:$B5D8:25 0A 17 0E FF	; Bane[end-FF]
0x01B5ED|$06:$B5DD:33 18 1D 12 18 17 FF	; Potion[end-FF]
0x01B5F4|$06:$B5E4:26 0A 1B 0D FF	; Card[end-FF]
0x01B5F9|$06:$B5E9:37 12 0C 14 0E 1D FF	; Ticket[end-FF]
0x01B600|$06:$B5F0:3A 0A 1D 0E 1B FF	; Water[end-FF]
0x01B606|$06:$B5F6:1D 11 0E 5F 3A 22 1F 0E 1B 17 FF	; the Wyvern[end-FF]
0x01B611|$06:$B601:FF	; [end-FF]
0x01B612|$06:$B602:2E 0E 22 FF	; Key[end-FF]
0x01B616|$06:$B606:2E 0E 22 FF	; Key[end-FF]
0x01B61A|$06:$B60A:2E 0E 22 FF	; Key[end-FF]
0x01B61E|$06:$B60E:2E 0E 22 FF	; Key[end-FF]
0x01B622|$06:$B612:2B 0E 1B 0B FF	; Herb[end-FF]
0x01B627|$06:$B617:2B 0E 1B 0B FF	; Herb[end-FF]
0x01B62C|$06:$B61C:35 12 17 10 FF	; Ring[end-FF]
0x01B631|$06:$B621:FF	; [end-FF]
0x01B632|$06:$B622:FF	; [end-FF]
0x01B633|$06:$B623:FF	; [end-FF]
; Spell name list
; indirect data load target (via $8026)
0x01B634|$06:$B624:29 12 1B 0E 0B 0A 15 FF	; Firebal[end-FF]
0x01B63C|$06:$B62C:2B 0E 0A 15 FF	; Heal[end-FF]
0x01B641|$06:$B631:36 1D 18 19 1C 19 0E 15 15 FF	; Stopspell[end-FF]
0x01B64B|$06:$B63B:2B 0E 0A 15 16 18 1B 0E FF	; Healmore[end-FF]
0x01B654|$06:$B644:29 12 1B 0E 0B 0A 17 0E FF	; Firebane[end-FF]
0x01B65D|$06:$B64D:2C 17 0C 1B 0E 0A 1C 0E FF	; Increase[end-FF]
0x01B666|$06:$B656:27 0E 0F 0E 0A 1D FF	; Defeat[end-FF]
0x01B66D|$06:$B65D:36 0A 0C 1B 12 0F 12 0C 0E FF	; Sacrifice[end-FF]
0x01B677|$06:$B667:2B 0E 0A 15 FF	; Heal[end-FF]
0x01B67C|$06:$B66C:24 17 1D 12 0D 18 1D 0E FF	; Antidote[end-FF]
0x01B685|$06:$B675:35 0E 1D 1E 1B 17 FF	; Return[end-FF]
0x01B68C|$06:$B67C:32 1E 1D 1C 12 0D 0E FF	; Outside[end-FF]
0x01B694|$06:$B684:2B 0E 0A 15 16 18 1B 0E FF	; Healmore[end-FF]
0x01B69D|$06:$B68D:36 1D 0E 19 10 1E 0A 1B 0D FF	; Stepguard[end-FF]
0x01B6A7|$06:$B697:35 0E 1F 12 1F 0E FF	; Revive[end-FF]
0x01B6AE|$06:$B69E:FF	; [end-FF]
0x01B6AF|$06:$B69F:36 15 0E 0E 19 FF	; Sleep[end-FF]
0x01B6B5|$06:$B6A5:2B 0E 0A 15 16 18 1B 0E FF	; Healmore[end-FF]
0x01B6BE|$06:$B6AE:2C 17 0F 0E 1B 17 18 1C FF	; Infernos[end-FF]
0x01B6C7|$06:$B6B7:27 0E 0F 0E 17 0C 0E FF	; Defence[end-FF]
0x01B6CF|$06:$B6BF:36 1E 1B 1B 18 1E 17 0D FF	; Surround[end-FF]
0x01B6D8|$06:$B6C8:2B 0E 0A 15 0A 15 15 FF	; Healall[end-FF]
0x01B6E0|$06:$B6D0:28 21 19 15 18 0D 0E 1D FF	; Explodet[end-FF]
0x01B6E9|$06:$B6D9:26 11 0A 17 0C 0E FF	; Chance[end-FF]
0x01B6F0|$06:$B6E0:2B 0E 0A 15 16 18 1B 0E FF	; Healmore[end-FF]
0x01B6F9|$06:$B6E9:35 0E 19 0E 15 FF	; Repel[end-FF]
0x01B6FF|$06:$B6EF:24 17 1D 12 0D 18 1D 0E FF	; Antidote[end-FF]
0x01B708|$06:$B6F8:2B 0E 0A 15 0A 15 15 FF	; Healall[end-FF]
0x01B710|$06:$B700:32 1E 1D 1C 12 0D 0E FF	; Outside[end-FF]
0x01B718|$06:$B708:36 1D 0E 19 10 1E 0A 1B 0D FF	; Stepguard[end-FF]
0x01B722|$06:$B712:32 19 0E 17 FF	; Open[end-FF]
0x01B727|$06:$B717:FF	; [end-FF]
; Monster list part 1, line 1
; indirect data load target (via $8028)
0x01B728|$06:$B718:36 15 12 16 0E FF	; Slime[end-FF]
0x01B72E|$06:$B71E:25 12 10 FF	; Big[end-FF]
0x01B732|$06:$B722:2C 1B 18 17 FF	; Iron[end-FF]
0x01B737|$06:$B727:27 1B 0A 14 0E 0E FF	; Drakee[end-FF]
0x01B73E|$06:$B72E:3A 12 15 0D FF	; Wild[end-FF]
0x01B743|$06:$B733:2B 0E 0A 15 0E 1B FF	; Healer[end-FF]
0x01B74A|$06:$B73A:2A 11 18 1C 1D FF	; Ghost[end-FF]
0x01B750|$06:$B740:25 0A 0B 0B 15 0E FF	; Babble[end-FF]
0x01B757|$06:$B747:24 1B 16 22 FF	; Army[end-FF]
0x01B75C|$06:$B74C:30 0A 10 12 0C 12 0A 17 FF	; Magician[end-FF]
0x01B765|$06:$B755:25 12 10 FF	; Big[end-FF]
0x01B769|$06:$B759:25 12 10 FF	; Big[end-FF]
0x01B76D|$06:$B75D:30 0A 10 12 0C FF	; Magic[end-FF]
0x01B773|$06:$B763:30 0A 10 12 0D 1B 0A 14 0E 0E FF	; Magidrakee[end-FF]
0x01B77E|$06:$B76E:26 0E 17 1D 12 19 18 0D FF	; Centipod[end-FF]
0x01B787|$06:$B777:30 0A 17 5F 32 67 FF	; Man O'[end-FF]
0x01B78E|$06:$B77E:2F 12 23 0A 1B 0D FF	; Lizard[end-FF]
0x01B795|$06:$B785:3D 18 16 0B 12 0E FF	; Zombie[end-FF]
0x01B79C|$06:$B78C:36 16 18 14 0E FF	; Smoke[end-FF]
0x01B7A2|$06:$B792:2A 11 18 1C 1D FF	; Ghost[end-FF]
0x01B7A8|$06:$B798:25 0A 0B 18 18 17 FF	; Baboon[end-FF]
0x01B7AF|$06:$B79F:26 0A 1B 17 12 1F 18 10 FF	; Carnivog[end-FF]
0x01B7B8|$06:$B7A8:30 0E 10 0A 19 0E 0D 0E FF	; Megapede[end-FF]
0x01B7C1|$06:$B7B1:36 0E 0A FF	; Sea[end-FF]
0x01B7C5|$06:$B7B5:30 0E 0D 1E 1C 0A FF	; Medusa[end-FF]
0x01B7CC|$06:$B7BC:28 17 0C 11 0A 17 1D 0E 1B FF	; Enchanter[end-FF]
0x01B7D6|$06:$B7C6:30 1E 0D FF	; Mud[end-FF]
0x01B7DA|$06:$B7CA:30 0A 10 12 0C FF	; Magic[end-FF]
0x01B7E0|$06:$B7D0:27 0E 16 12 10 11 18 1C 1D FF	; Demighost[end-FF]
0x01B7EA|$06:$B7DA:2A 1B 0E 16 15 12 17 FF	; Gremlin[end-FF]
0x01B7F2|$06:$B7E2:33 18 12 1C 18 17 FF	; Poison[end-FF]
0x01B7F9|$06:$B7E9:30 1E 16 16 22 FF	; Mummy[end-FF]
0x01B7FF|$06:$B7EF:2A 18 1B 10 18 17 FF	; Gorgon[end-FF]
0x01B806|$06:$B7F6:36 0A 0B 0E 1B FF	; Saber[end-FF]
0x01B80C|$06:$B7FC:27 1B 0A 10 18 17 FF	; Dragon[end-FF]
0x01B813|$06:$B803:37 12 1D 0A 17 FF	; Titan[end-FF]
0x01B819|$06:$B809:38 17 0D 0E 0A 0D FF	; Undead[end-FF]
0x01B820|$06:$B810:25 0A 1C 12 15 12 1C 14 FF	; Basilisk[end-FF]
0x01B829|$06:$B819:2A 18 18 19 12 FF	; Goopi[end-FF]
0x01B82F|$06:$B81F:32 1B 0C FF	; Orc[end-FF]
0x01B833|$06:$B823:33 1E 19 19 0E 1D FF	; Puppet[end-FF]
0x01B83A|$06:$B82A:30 1E 16 16 22 FF	; Mummy[end-FF]
0x01B840|$06:$B830:28 1F 12 15 FF	; Evil[end-FF]
0x01B845|$06:$B835:2A 0A 1C FF	; Gas[end-FF]
0x01B849|$06:$B839:2B 18 1B 14 FF	; Hork[end-FF]
0x01B84E|$06:$B83E:2B 0A 20 14 FF	; Hawk[end-FF]
0x01B853|$06:$B843:36 18 1B 0C 0E 1B 0E 1B FF	; Sorcerer[end-FF]
0x01B85C|$06:$B84C:30 0E 1D 0A 15 FF	; Metal[end-FF]
0x01B862|$06:$B852:2B 1E 17 1D 0E 1B FF	; Hunter[end-FF]
0x01B869|$06:$B859:28 1F 12 15 FF	; Evil[end-FF]
; Monster list part 2, line 1
; indirect data load target (via $8034)
0x01B86E|$06:$B85E:2B 12 0B 0A 0B 0A 17 10 18 FF	; Hibabango[end-FF]
0x01B878|$06:$B868:2A 1B 0A 0B 18 18 19 12 FF	; Graboopi[end-FF]
0x01B881|$06:$B871:2A 18 15 0D FF	; Gold[end-FF]
0x01B886|$06:$B876:28 1F 12 15 FF	; Evil[end-FF]
0x01B88B|$06:$B87B:2A 11 18 1E 15 FF	; Ghoul[end-FF]
0x01B891|$06:$B881:39 0A 16 19 12 1B 1E 1C FF	; Vampirus[end-FF]
0x01B89A|$06:$B88A:30 0E 10 0A FF	; Mega[end-FF]
0x01B89F|$06:$B88F:36 0A 0B 0E 1B FF	; Saber[end-FF]
0x01B8A5|$06:$B895:30 0E 1D 0A 15 FF	; Metal[end-FF]
0x01B8AB|$06:$B89B:32 23 20 0A 1B 10 FF	; Ozwarg[end-FF]
0x01B8B2|$06:$B8A2:27 0A 1B 14 FF	; Dark[end-FF]
0x01B8B7|$06:$B8A7:2A 0A 1B 10 18 22 15 0E FF	; Gargoyle[end-FF]
0x01B8C0|$06:$B8B0:32 1B 0C FF	; Orc[end-FF]
0x01B8C4|$06:$B8B4:30 0A 10 12 0C FF	; Magic[end-FF]
0x01B8CA|$06:$B8BA:25 0E 1B 1C 0E 1B 14 0E 1B FF	; Berserker[end-FF]
0x01B8D4|$06:$B8C4:30 0E 1D 0A 15 FF	; Metal[end-FF]
0x01B8DA|$06:$B8CA:2B 0A 1B 10 18 17 67 1C FF	; Hargon's[end-FF]
0x01B8E3|$06:$B8D3:26 22 0C 15 18 19 1C FF	; Cyclops[end-FF]
0x01B8EB|$06:$B8DB:24 1D 1D 0A 0C 14 0B 18 1D FF	; Attackbot[end-FF]
0x01B8F5|$06:$B8E5:2A 1B 0E 0E 17 FF	; Green[end-FF]
0x01B8FB|$06:$B8EB:30 0A 0C 0E FF	; Mace[end-FF]
0x01B900|$06:$B8F0:29 15 0A 16 0E FF	; Flame[end-FF]
0x01B906|$06:$B8F6:36 12 15 1F 0E 1B FF	; Silver[end-FF]
0x01B90D|$06:$B8FD:25 15 12 23 23 0A 1B 0D FF	; Blizzard[end-FF]
0x01B916|$06:$B906:2A 12 0A 17 1D FF	; Giant[end-FF]
0x01B91C|$06:$B90C:2A 18 15 0D FF	; Gold[end-FF]
0x01B921|$06:$B911:25 1E 15 15 20 18 17 10 FF	; Bullwong[end-FF]
0x01B92A|$06:$B91A:24 1D 15 0A 1C FF	; Atlas[end-FF]
0x01B930|$06:$B920:25 0A 23 1E 23 1E FF	; Bazuzu[end-FF]
0x01B937|$06:$B927:3D 0A 1B 15 18 21 FF	; Zarlox[end-FF]
0x01B93E|$06:$B92E:2B 0A 1B 10 18 17 FF	; Hargon[end-FF]
0x01B945|$06:$B935:30 0A 15 1B 18 1D 11 FF	; Malroth[end-FF]
0x01B94D|$06:$B93D:28 17 0E 16 12 0E 1C FF	; Enemies[end-FF]
; Monster list part 1, line 2
; indirect data load target (via $802A)
0x01B955|$06:$B945:FF	; [end-FF]
0x01B956|$06:$B946:36 15 1E 10 FF	; Slug[end-FF]
0x01B95B|$06:$B94B:24 17 1D FF	; Ant[end-FF]
0x01B95F|$06:$B94F:FF	; [end-FF]
0x01B960|$06:$B950:30 18 1E 1C 0E FF	; Mouse[end-FF]
0x01B966|$06:$B956:FF	; [end-FF]
0x01B967|$06:$B957:30 18 1E 1C 0E FF	; Mouse[end-FF]
0x01B96D|$06:$B95D:FF	; [end-FF]
0x01B96E|$06:$B95E:24 17 1D FF	; Ant[end-FF]
0x01B972|$06:$B962:FF	; [end-FF]
0x01B973|$06:$B963:35 0A 1D FF	; Rat[end-FF]
0x01B977|$06:$B967:26 18 0B 1B 0A FF	; Cobra[end-FF]
0x01B97D|$06:$B96D:24 17 1D FF	; Ant[end-FF]
0x01B981|$06:$B971:FF	; [end-FF]
0x01B982|$06:$B972:FF	; [end-FF]
0x01B983|$06:$B973:3A 0A 1B FF	; War[end-FF]
0x01B987|$06:$B977:29 15 22 FF	; Fly[end-FF]
0x01B98B|$06:$B97B:FF	; [end-FF]
0x01B98C|$06:$B97C:FF	; [end-FF]
0x01B98D|$06:$B97D:35 0A 1D FF	; Rat[end-FF]
0x01B991|$06:$B981:FF	; [end-FF]
0x01B992|$06:$B982:FF	; [end-FF]
0x01B993|$06:$B983:FF	; [end-FF]
0x01B994|$06:$B984:36 15 1E 10 FF	; Slug[end-FF]
0x01B999|$06:$B989:25 0A 15 15 FF	; Ball[end-FF]
0x01B99E|$06:$B98E:FF	; [end-FF]
0x01B99F|$06:$B98F:30 0A 17 FF	; Man[end-FF]
0x01B9A3|$06:$B993:25 0A 0B 18 18 17 FF	; Baboon[end-FF]
0x01B9AA|$06:$B99A:FF	; [end-FF]
0x01B9AB|$06:$B99B:FF	; [end-FF]
0x01B9AC|$06:$B99C:2F 12 15 22 FF	; Lily[end-FF]
0x01B9B1|$06:$B9A1:30 0A 17 FF	; Man[end-FF]
0x01B9B5|$06:$B9A5:FF	; [end-FF]
0x01B9B6|$06:$B9A6:37 12 10 0E 1B FF	; Tiger[end-FF]
0x01B9BC|$06:$B9AC:29 15 22 FF	; Fly[end-FF]
0x01B9C0|$06:$B9B0:37 1B 0E 0E FF	; Tree[end-FF]
0x01B9C5|$06:$B9B5:FF	; [end-FF]
0x01B9C6|$06:$B9B6:FF	; [end-FF]
0x01B9C7|$06:$B9B7:FF	; [end-FF]
0x01B9C8|$06:$B9B8:FF	; [end-FF]
0x01B9C9|$06:$B9B9:30 0A 17 FF	; Man[end-FF]
0x01B9CD|$06:$B9BD:FF	; [end-FF]
0x01B9CE|$06:$B9BE:37 1B 0E 0E FF	; Tree[end-FF]
0x01B9D3|$06:$B9C3:FF	; [end-FF]
0x01B9D4|$06:$B9C4:FF	; [end-FF]
0x01B9D5|$06:$B9C5:30 0A 17 FF	; Man[end-FF]
0x01B9D9|$06:$B9C9:FF	; [end-FF]
0x01B9DA|$06:$B9CA:36 15 12 16 0E FF	; Slime[end-FF]
0x01B9E0|$06:$B9D0:FF	; [end-FF]
0x01B9E1|$06:$B9D1:28 22 0E FF	; Eye[end-FF]
; Monster list part 2, line 2
; indirect data load target (via $8036)
0x01B9E5|$06:$B9D5:FF	; [end-FF]
0x01B9E6|$06:$B9D6:FF	; [end-FF]
0x01B9E7|$06:$B9D7:32 1B 0C FF	; Orc[end-FF]
0x01B9EB|$06:$B9DB:26 15 18 20 17 FF	; Clown[end-FF]
0x01B9F1|$06:$B9E1:FF	; [end-FF]
0x01B9F2|$06:$B9E2:FF	; [end-FF]
0x01B9F3|$06:$B9E3:2E 17 12 10 11 1D FF	; Knight[end-FF]
0x01B9FA|$06:$B9EA:2F 12 18 17 FF	; Lion[end-FF]
0x01B9FF|$06:$B9EF:2B 1E 17 1D 0E 1B FF	; Hunter[end-FF]
0x01BA06|$06:$B9F6:FF	; [end-FF]
0x01BA07|$06:$B9F7:28 22 0E FF	; Eye[end-FF]
0x01BA0B|$06:$B9FB:FF	; [end-FF]
0x01BA0C|$06:$B9FC:2E 12 17 10 FF	; King[end-FF]
0x01BA11|$06:$BA01:39 0A 16 19 12 1B 1E 1C FF	; Vampirus[end-FF]
0x01BA1A|$06:$BA0A:FF	; [end-FF]
0x01BA1B|$06:$BA0B:25 0A 0B 0B 15 0E FF	; Babble[end-FF]
0x01BA22|$06:$BA12:2E 17 12 10 11 1D FF	; Knight[end-FF]
0x01BA29|$06:$BA19:FF	; [end-FF]
0x01BA2A|$06:$BA1A:FF	; [end-FF]
0x01BA2B|$06:$BA1B:27 1B 0A 10 18 17 FF	; Dragon[end-FF]
0x01BA32|$06:$BA22:30 0A 1C 1D 0E 1B FF	; Master[end-FF]
0x01BA39|$06:$BA29:FF	; [end-FF]
0x01BA3A|$06:$BA2A:25 0A 1D 0B 18 18 17 FF	; Batboon[end-FF]
0x01BA42|$06:$BA32:FF	; [end-FF]
0x01BA43|$06:$BA33:FF	; [end-FF]
0x01BA44|$06:$BA34:25 0A 1D 0B 18 18 17 FF	; Batboon[end-FF]
0x01BA4C|$06:$BA3C:FF	; [end-FF]
0x01BA4D|$06:$BA3D:FF	; [end-FF]
0x01BA4E|$06:$BA3E:FF	; [end-FF]
0x01BA4F|$06:$BA3F:FF	; [end-FF]
0x01BA50|$06:$BA40:FF	; [end-FF]
0x01BA51|$06:$BA41:FF	; [end-FF]
0x01BA52|$06:$BA42:FF	; [end-FF]
; 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 during battle where there is no main COMMAND menu
; completely useless?
; indirect data load target (via $802C)
0x01BA53|$06:$BA43:24 31 5F 5F
0x01BA57|$06:$BA47:27 77 5F 5F
0x01BA5B|$06:$BA4B:77 77 5F 5F
0x01BA5F|$06:$BA4F:77 7C 5F 5F
0x01BA63|$06:$BA53:5F 5F 5F 5F
0x01BA67|$06:$BA57:36 33 5F 5F
0x01BA6B|$06:$BA5B:28 2F 5F 5F
0x01BA6F|$06:$BA5F:2F 7B 5F 7B
0x01BA73|$06:$BA63:5F 5F 5F 5F
0x01BA77|$06:$BA67:2C 37 5F 5F
0x01BA7B|$06:$BA6B:28 30 5F 5F
0x01BA7F|$06:$BA6F:5F 7B 5F 7B
0x01BA83|$06:$BA73:5F 5F 7D 7D
0x01BA87|$06:$BA77:28 34 7D 7D
0x01BA8B|$06:$BA7B:38 2C 7D 7D
0x01BA8F|$06:$BA7F:33 7B 7D 7E
; indirect data load target (via $802E)
0x01BA93|$06:$BA83:77 77 77 77
0x01BA97|$06:$BA87:77 77 77 7C
0x01BA9B|$06:$BA8B:79 77 77 77
0x01BA9F|$06:$BA8F:77 77 7C 7B
0x01BAA3|$06:$BA93:76 5F 5F 5F
0x01BAA7|$06:$BA97:5F 5F 7B 7B
0x01BAAB|$06:$BA9B:7A 7D 7D 7D
0x01BAAF|$06:$BA9F:7D 7D 7E 7B

; data -> code
; indirect control flow target (via $803A)
0x01BAB3|$06:$BAA3:A9 05   	LDA #$05   
0x01BAB5|$06:$BAA5:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
0x01BAB7|$06:$BAA7:A5 31   	LDA $31    	; current map ID
0x01BAB9|$06:$BAA9:C9 03   	CMP #$03   	; Map ID #$03: Midenhall 1F
0x01BABB|$06:$BAAB:F0 01   	BEQ $BAAE  
; control flow target (from $BAB3, $BAB9, $BABF, $BAC3)
0x01BABD|$06:$BAAD:60      	RTS        

; control flow target (from $BAAB)
0x01BABE|$06:$BAAE:AD 49 05	LDA $0549  	; NPC #$01 sprite ID
0x01BAC1|$06:$BAB1:C9 FF   	CMP #$FF   
0x01BAC3|$06:$BAB3:F0 F8   	BEQ $BAAD  
0x01BAC5|$06:$BAB5:A5 17   	LDA $17    	; current map Y-pos (1)
0x01BAC7|$06:$BAB7:C9 05   	CMP #$05   
0x01BAC9|$06:$BAB9:D0 F2   	BNE $BAAD  
0x01BACB|$06:$BABB:A5 16   	LDA $16    	; current map X-pos (1)
0x01BACD|$06:$BABD:C9 0E   	CMP #$0E   
0x01BACF|$06:$BABF:90 EC   	BCC $BAAD  
0x01BAD1|$06:$BAC1:C9 11   	CMP #$11   
0x01BAD3|$06:$BAC3:B0 E8   	BCS $BAAD  
0x01BAD5|$06:$BAC5:AD 4B 05	LDA $054B  	; NPC #$01 scripted motion high byte
0x01BAD8|$06:$BAC8:C9 7F   	CMP #$7F   
0x01BADA|$06:$BACA:D0 09   	BNE $BAD5  
; call to code in a different bank ($0F:$CCF1)
0x01BADC|$06:$BACC: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
0x01BADF|$06:$BACF:82
; indirect data load target
0x01BAE0|$06:$BAD0:21
; indirect data load target
0x01BAE1|$06:$BAD1:D5 80	; $07:$80D5; motion script for Moonbrooke, ending part 1 (turned)

; data -> code
0x01BAE3|$06:$BAD3:90 0A   	BCC $BADF  
; control flow target (from $BACA)
; call to code in a different bank ($0F:$CCF1)
0x01BAE5|$06:$BAD5: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
0x01BAE8|$06:$BAD8:82
; indirect data load target
0x01BAE9|$06:$BAD9:21
; indirect data load target
0x01BAEA|$06:$BADA:DB 80	; $07:$80DB; motion script for Cannock, ending part 1

; data -> code
0x01BAEC|$06:$BADC:EE 65 05	INC $0565  	; NPC #$05 Y-pos
; control flow target (from $BAD3)
; call to code in a different bank ($0F:$CCF1)
0x01BAEF|$06:$BADF: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
0x01BAF2|$06:$BAE2:81
; indirect data load target
0x01BAF3|$06:$BAE3:21
; indirect data load target
0x01BAF4|$06:$BAE4:CF 80	; $07:$80CF; motion script for Moonbrooke, ending part 1 (not turned)

; data -> code
0x01BAF6|$06:$BAE6:A5 16   	LDA $16    	; current map X-pos (1)
0x01BAF8|$06:$BAE8:C9 0E   	CMP #$0E   
0x01BAFA|$06:$BAEA:D0 08   	BNE $BAF4  
0x01BAFC|$06:$BAEC:EE 5A 05	INC $055A  	; NPC #$03 scripted motion low byte
0x01BAFF|$06:$BAEF:CE 5C 05	DEC $055C  	; NPC #$04 X-pos
0x01BB02|$06:$BAF2:D0 0A   	BNE $BAFE  
; control flow target (from $BAEA)
0x01BB04|$06:$BAF4:C9 10   	CMP #$10   
0x01BB06|$06:$BAF6:D0 06   	BNE $BAFE  
0x01BB08|$06:$BAF8:CE 5A 05	DEC $055A  	; NPC #$03 scripted motion low byte
0x01BB0B|$06:$BAFB:EE 5C 05	INC $055C  	; NPC #$04 X-pos
; control flow target (from $BAF2, $BAF6)
0x01BB0E|$06:$BAFE:A5 16   	LDA $16    	; current map X-pos (1)
0x01BB10|$06:$BB00:18      	CLC        
0x01BB11|$06:$BB01:6D 44 05	ADC $0544  	; NPC #$01 ?
0x01BB14|$06:$BB04:18      	CLC        
0x01BB15|$06:$BB05:6D 4C 05	ADC $054C  	; NPC #$02 ?
0x01BB18|$06:$BB08:C9 0E   	CMP #$0E   
0x01BB1A|$06:$BB0A:D0 08   	BNE $BB14  
0x01BB1C|$06:$BB0C:CE 62 05	DEC $0562  	; NPC #$04 scripted motion low byte
0x01BB1F|$06:$BB0F:CE 64 05	DEC $0564  	; NPC #$05 X-pos
0x01BB22|$06:$BB12:D0 0A   	BNE $BB1E  
; control flow target (from $BB0A)
0x01BB24|$06:$BB14:C9 10   	CMP #$10   
0x01BB26|$06:$BB16:D0 06   	BNE $BB1E  
0x01BB28|$06:$BB18:EE 62 05	INC $0562  	; NPC #$04 scripted motion low byte
0x01BB2B|$06:$BB1B:EE 64 05	INC $0564  	; NPC #$05 X-pos
; control flow target (from $BB12, $BB16)
0x01BB2E|$06:$BB1E:A9 00   	LDA #$00   
0x01BB30|$06:$BB20:A8      	TAY        
; control flow target (from $BB27)
0x01BB31|$06:$BB21:99 42 05	STA $0542,Y	; NPC #$00 ?
0x01BB34|$06:$BB24:C8      	INY        
0x01BB35|$06:$BB25:C0 10   	CPY #$10   
0x01BB37|$06:$BB27:D0 F8   	BNE $BB21  
0x01BB39|$06:$BB29:A9 FF   	LDA #$FF   
0x01BB3B|$06:$BB2B:8D 49 05	STA $0549  	; NPC #$01 sprite ID
0x01BB3E|$06:$BB2E:8D 51 05	STA $0551  	; NPC #$02 sprite ID
0x01BB41|$06:$BB31:A2 01   	LDX #$01   
0x01BB43|$06:$BB33:8E 61 05	STX $0561  	; NPC #$04 sprite ID
0x01BB46|$06:$BB36:E8      	INX        
0x01BB47|$06:$BB37:8E 69 05	STX $0569  	; NPC #$05 sprite ID
; call to code in a different bank ($0F:$CCD2)
0x01BB4A|$06:$BB3A:4C D2 CC	JMP $CCD2  	; execute scripted motion

; indirect control flow target (via $8038)
; call to code in a different bank ($0F:$CD26)
0x01BB4D|$06:$BB3D: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
0x01BB50|$06:$BB40:0F
; indirect data load target
0x01BB51|$06:$BB41:03

; data -> code
0x01BB52|$06:$BB42:F0 01   	BEQ $BB45  
0x01BB54|$06:$BB44:60      	RTS        

; control flow target (from $BB42)
0x01BB55|$06:$BB45:A9 FF   	LDA #$FF   
0x01BB57|$06:$BB47:85 35   	STA $35    	; flag indicating whether any menu is currently open
0x01BB59|$06:$BB49:A9 46   	LDA #$46   
0x01BB5B|$06:$BB4B:8D 2C 06	STA $062C  	; current battle message delay
; call to code in a different bank ($0F:$EB76)
0x01BB5E|$06:$BB4E:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01BB61|$06:$BB51:04	; Menu ID #$04: Dialogue window

; data -> code
0x01BB62|$06:$BB52:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$FC50)
0x01BB64|$06:$BB54:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01BB67|$06:$BB57:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BB6A|$06:$BB5A:B5	; String ID #$01B5: ‘[name], thou art of the line of Erdrick and have proven thy heritage by thy deeds[.’][wait][end-FC]

; data -> code
; control flow target (from $BB6B)
; call to code in a different bank ($0F:$FA2E)
0x01BB6B|$06:$BB5B:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BB6E|$06:$BB5E:B6	; String ID #$01B6: ‘Now is the time for thee to take the throne. Will it be so?’[FD][FD][end-FC]

; data -> code
; call to code in a different bank ($0F:$EB76)
0x01BB6F|$06:$BB5F:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01BB72|$06:$BB62:19	; Menu ID #$19: General menu: YES/NO

; data -> code
0x01BB73|$06:$BB63:C9 00   	CMP #$00   
0x01BB75|$06:$BB65:F0 07   	BEQ $BB6E  
; call to code in a different bank ($0F:$FA2E)
0x01BB77|$06:$BB67:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BB7A|$06:$BB6A:B7	; String ID #$01B7: ‘Be careful, [name]. Do not be selfish[.’][wait][end-FC]

; data -> code
0x01BB7B|$06:$BB6B:4C 5B BB	JMP $BB5B  

; control flow target (from $BB65)
0x01BB7E|$06:$BB6E:A9 01   	LDA #$01   
; call to code in a different bank ($0F:$FC50)
0x01BB80|$06:$BB70:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01BB83|$06:$BB73:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BB86|$06:$BB76:B8	; String ID #$01B8: ‘Hail all to the new monarch of Midenhall!’[wait][line]‘Now, [name], Prince of Cannock, come forth[.’][wait][end-FC]

; data -> code
0x01BB87|$06:$BB77:A9 02   	LDA #$02   
; call to code in a different bank ($0F:$FC50)
0x01BB89|$06:$BB79:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01BB8C|$06:$BB7C:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BB8F|$06:$BB7F:BC	; String ID #$01BC: ‘[name], Princess of Moonbrooke, come forth[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$D0F5)
0x01BB90|$06:$BB80:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
; call to code in a different bank ($0F:$CCF1)
0x01BB93|$06:$BB83: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
0x01BB96|$06:$BB86:85
; indirect data load target
0x01BB97|$06:$BB87:20
; indirect data load target
0x01BB98|$06:$BB88:BE 80	; $07:$80BE; motion script for top 2 guards, ending part 2

; data -> code
; call to code in a different bank ($0F:$CCF1)
0x01BB9A|$06:$BB8A: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
0x01BB9D|$06:$BB8D:84
; indirect data load target
0x01BB9E|$06:$BB8E:20
; indirect data load target
0x01BB9F|$06:$BB8F:BE 80	; $07:$80BE; motion script for top 2 guards, ending part 2

; data -> code
; call to code in a different bank ($0F:$CCE7)
0x01BBA1|$06:$BB91:20 E7 CC	JSR $CCE7  
0x01BBA4|$06:$BB94:20 38 BC	JSR $BC38  
; call to code in a different bank ($0F:$CCF1)
0x01BBA7|$06:$BB97: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
0x01BBAA|$06:$BB9A:82
; indirect data load target
0x01BBAB|$06:$BB9B:20
; indirect data load target
0x01BBAC|$06:$BB9C:55 80	; $07:$8055; motion script for Cannock and Moonbrooke, ending part 3, dog in Zahan, triggered from right

; data -> code
; call to code in a different bank ($0F:$CCF1)
0x01BBAE|$06:$BB9E: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
0x01BBB1|$06:$BBA1:81
; indirect data load target
0x01BBB2|$06:$BBA2:20
; indirect data load target
0x01BBB3|$06:$BBA3:55 80	; $07:$8055; motion script for Cannock and Moonbrooke, ending part 3, dog in Zahan, triggered from right

; data -> code
; call to code in a different bank ($0F:$CCE7)
0x01BBB5|$06:$BBA5:20 E7 CC	JSR $CCE7  
0x01BBB8|$06:$BBA8:20 38 BC	JSR $BC38  
; call to code in a different bank ($0F:$EB76)
0x01BBBB|$06:$BBAB:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01BBBE|$06:$BBAE:04	; Menu ID #$04: Dialogue window

; data -> code
; call to code in a different bank ($0F:$FA2E)
0x01BBBF|$06:$BBAF:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BBC2|$06:$BBB2:B9	; String ID #$01B9: ‘This charge I lay on the three heroes, that for evermore they guard against evil[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$D0F5)
0x01BBC3|$06:$BBB3:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x01BBC6|$06:$BBB6:A0 38   	LDY #$38   
; control flow target (from $BBC2)
0x01BBC8|$06:$BBB8:A9 02   	LDA #$02   
0x01BBCA|$06:$BBBA:99 78 05	STA $0578,Y	; NPC #$07 motion nybble + direction nybble
0x01BBCD|$06:$BBBD:98      	TYA        
0x01BBCE|$06:$BBBE:38      	SEC        
0x01BBCF|$06:$BBBF:E9 08   	SBC #$08   
0x01BBD1|$06:$BBC1:A8      	TAY        
0x01BBD2|$06:$BBC2:10 F4   	BPL $BBB8  
; call to code in a different bank ($0F:$CF64)
0x01BBD4|$06:$BBC4:20 64 CF	JSR $CF64  
0x01BBD7|$06:$BBC7:20 38 BC	JSR $BC38  
; call to code in a different bank ($0F:$EB76)
0x01BBDA|$06:$BBCA:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01BBDD|$06:$BBCD:04	; Menu ID #$04: Dialogue window

; data -> code
0x01BBDE|$06:$BBCE:A9 00   	LDA #$00   
; call to code in a different bank ($0F:$FC50)
0x01BBE0|$06:$BBD0:20 50 FC	JSR $FC50  	; print name of hero given by low 2 bits of A to $6119, terminated by #$FA
; call to code in a different bank ($0F:$FA2E)
0x01BBE3|$06:$BBD3:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BBE6|$06:$BBD6:BA	; String ID #$01BA: ‘Three cheers for the new monarch of Midenhall![line]Hip-hip-hooray!’[end-FC]

; data -> code
; call to code in a different bank ($0F:$D0F5)
0x01BBE7|$06:$BBD7:20 F5 D0	JSR $D0F5  	; wait for a while and then wipe menu regions #$03, #$00, and #$01
0x01BBEA|$06:$BBDA:A9 01   	LDA #$01   
0x01BBEC|$06:$BBDC:8D 68 05	STA $0568  	; NPC #$05 motion nybble + direction nybble
0x01BBEF|$06:$BBDF:20 2D BC	JSR $BC2D  
0x01BBF2|$06:$BBE2:A9 02   	LDA #$02   
0x01BBF4|$06:$BBE4:8D 68 05	STA $0568  	; NPC #$05 motion nybble + direction nybble
0x01BBF7|$06:$BBE7:20 2D BC	JSR $BC2D  
0x01BBFA|$06:$BBEA:A2 0A   	LDX #$0A   
; call to code in a different bank ($0F:$C1EE)
0x01BBFC|$06:$BBEC:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x01BBFF|$06:$BBEF:A9 03   	LDA #$03   
0x01BC01|$06:$BBF1:8D 60 05	STA $0560  	; NPC #$04 motion nybble + direction nybble
0x01BC04|$06:$BBF4:20 2D BC	JSR $BC2D  
0x01BC07|$06:$BBF7:A9 02   	LDA #$02   
0x01BC09|$06:$BBF9:8D 60 05	STA $0560  	; NPC #$04 motion nybble + direction nybble
0x01BC0C|$06:$BBFC:20 2D BC	JSR $BC2D  
0x01BC0F|$06:$BBFF:20 34 BC	JSR $BC34  
0x01BC12|$06:$BC02:A9 01   	LDA #$01   
0x01BC14|$06:$BC04:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x01BC17|$06:$BC07:20 2D BC	JSR $BC2D  
0x01BC1A|$06:$BC0A:A9 02   	LDA #$02   
0x01BC1C|$06:$BC0C:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x01BC1F|$06:$BC0F:20 2D BC	JSR $BC2D  
0x01BC22|$06:$BC12:20 34 BC	JSR $BC34  
0x01BC25|$06:$BC15:A9 19   	LDA #$19   	; Music ID #$19: end credits BGM
; call to code in a different bank ($0F:$C561)
0x01BC27|$06:$BC17:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
0x01BC2A|$06:$BC1A:20 38 BC	JSR $BC38  
0x01BC2D|$06:$BC1D:A9 FF   	LDA #$FF   	; SLOW
0x01BC2F|$06:$BC1F:8D 2C 06	STA $062C  	; current battle message delay
; call to code in a different bank ($0F:$EB76)
0x01BC32|$06:$BC22:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01BC35|$06:$BC25:04	; Menu ID #$04: Dialogue window

; data -> code
; call to code in a different bank ($0F:$FA2E)
0x01BC36|$06:$BC26:20 2E FA	JSR $FA2E  	; display string ID specified by next byte + #$0100

; code -> data
; indirect data load target
0x01BC39|$06:$BC29:93	; String ID #$0193: ‘Then peace returned[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$D343)
0x01BC3A|$06:$BC2A:4C 43 D3	JMP $D343  

; control flow target (from $BBDF, $BBE7, $BBF4, $BBFC, $BC07, $BC0F)
; call to code in a different bank ($0F:$CF64)
0x01BC3D|$06:$BC2D:20 64 CF	JSR $CF64  
0x01BC40|$06:$BC30:A2 0A   	LDX #$0A   
0x01BC42|$06:$BC32:D0 06   	BNE $BC3A  
; control flow target (from $BBFF, $BC12)
0x01BC44|$06:$BC34:A2 1E   	LDX #$1E   
0x01BC46|$06:$BC36:D0 02   	BNE $BC3A  
; control flow target (from $BB94, $BBA8, $BBC7, $BC1A)
0x01BC48|$06:$BC38:A2 3C   	LDX #$3C   
; control flow target (from $BC32, $BC36)
; call to code in a different bank ($0F:$C1EE)
0x01BC4A|$06:$BC3A:4C EE C1	JMP $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF

; indirect control flow target (via $803E)
0x01BC4D|$06:$BC3D:A2 3D   	LDX #$3D   
; control flow target (from $BC46)
0x01BC4F|$06:$BC3F:BD 4F BC	LDA $BC4F,X	; code copied to and executed in RAM
0x01BC52|$06:$BC42:9D 00 04	STA $0400,X	; menu-based palette overrides start
0x01BC55|$06:$BC45:CA      	DEX        
0x01BC56|$06:$BC46:10 F7   	BPL $BC3F  
0x01BC58|$06:$BC48:AD F6 05	LDA $05F6  	; current bank
0x01BC5B|$06:$BC4B:48      	PHA        
; call to code in RAM
0x01BC5C|$06:$BC4C:4C 33 04	JMP $0433  

; code copied to and executed in RAM
; control flow target (from $BC8B)
; indexed data load target (from $BC3F)
0x01BC5F|$06:$BC4F:AC F6 05	LDY $05F6  	; current bank
0x01BC62|$06:$BC52:C8      	INY        
0x01BC63|$06:$BC53:98      	TYA        
0x01BC64|$06:$BC54:29 07   	AND #$07   
0x01BC66|$06:$BC56:48      	PHA        
0x01BC67|$06:$BC57:A6 43   	LDX $43    
0x01BC69|$06:$BC59:E0 03   	CPX #$03   
0x01BC6B|$06:$BC5B:D0 09   	BNE $BC66  
; call to code in a different bank ($0F:$C476)
0x01BC6D|$06:$BC5D:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x01BC70|$06:$BC60:46 2F   	LSR $2F    	; joypad 1 data
0x01BC72|$06:$BC62:A6 43   	LDX $43    
0x01BC74|$06:$BC64:90 1E   	BCC $BC84  
; control flow target (from $BC5B)
0x01BC76|$06:$BC66:E8      	INX        
0x01BC77|$06:$BC67:E0 14   	CPX #$14   
0x01BC79|$06:$BC69:90 19   	BCC $BC84  
; call to code in a different bank ($0F:$C3AB)
0x01BC7B|$06:$BC6B:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x01BC7E|$06:$BC6E:A5 32   	LDA $32    	; RNG byte 0
0x01BC80|$06:$BC70:29 24   	AND #$24   
0x01BC82|$06:$BC72:D0 10   	BNE $BC84  
; control flow target (from $BC79)
; call to code in a different bank ($0F:$C476)
0x01BC84|$06:$BC74:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x01BC87|$06:$BC77:46 2F   	LSR $2F    	; joypad 1 data
0x01BC89|$06:$BC79:90 F9   	BCC $BC74  
; control flow target (from $BC80)
; call to code in a different bank ($0F:$C476)
0x01BC8B|$06:$BC7B:20 76 C4	JSR $C476  	; read joypad 1 data into $2F
0x01BC8E|$06:$BC7E:46 2F   	LSR $2F    	; joypad 1 data
0x01BC90|$06:$BC80:B0 F9   	BCS $BC7B  
0x01BC92|$06:$BC82:A2 03   	LDX #$03   
; control flow target (from $BC64, $BC69, $BC72)
0x01BC94|$06:$BC84:68      	PLA        
; call to code in a different bank ($0F:$C3D5)
0x01BC95|$06:$BC85: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 ($0F:$C1EE)
0x01BC98|$06:$BC88:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x01BC9B|$06:$BC8B:F0 C2   	BEQ $BC4F  	; code copied to and executed in RAM

; indirect control flow target (via $8040)
0x01BC9D|$06:$BC8D:A5 17   	LDA $17    	; current map Y-pos (1)
0x01BC9F|$06:$BC8F:C9 07   	CMP #$07   
0x01BCA1|$06:$BC91:F0 01   	BEQ $BC94  
0x01BCA3|$06:$BC93:60      	RTS        

; control flow target (from $BC91)
0x01BCA4|$06:$BC94:A0 50   	LDY #$50   
0x01BCA6|$06:$BC96:A9 00   	LDA #$00   
; control flow target (from $BC9E)
0x01BCA8|$06:$BC98:99 3A 05	STA $053A,Y
0x01BCAB|$06:$BC9B:C8      	INY        
0x01BCAC|$06:$BC9C:C0 68   	CPY #$68   
0x01BCAE|$06:$BC9E:D0 F8   	BNE $BC98  
0x01BCB0|$06:$BCA0:A9 FF   	LDA #$FF   
0x01BCB2|$06:$BCA2:8D 91 05	STA $0591  	; NPC #$0A sprite ID
0x01BCB5|$06:$BCA5:8D 99 05	STA $0599  	; NPC #$0B sprite ID
0x01BCB8|$06:$BCA8:8D A1 05	STA $05A1  	; NPC #$0C sprite ID
0x01BCBB|$06:$BCAB:A5 16   	LDA $16    	; current map X-pos (1)
0x01BCBD|$06:$BCAD:8D 8C 05	STA $058C  	; NPC #$0A X-pos
0x01BCC0|$06:$BCB0:8D 94 05	STA $0594  	; NPC #$0B X-pos
0x01BCC3|$06:$BCB3:CE 94 05	DEC $0594  	; NPC #$0B X-pos
0x01BCC6|$06:$BCB6:8D 9C 05	STA $059C  	; NPC #$0C X-pos
0x01BCC9|$06:$BCB9:EE 9C 05	INC $059C  	; NPC #$0C X-pos
0x01BCCC|$06:$BCBC:A5 17   	LDA $17    	; current map Y-pos (1)
0x01BCCE|$06:$BCBE:8D 8D 05	STA $058D  	; NPC #$0A Y-pos
0x01BCD1|$06:$BCC1:EE 8D 05	INC $058D  	; NPC #$0A Y-pos
0x01BCD4|$06:$BCC4:8D 95 05	STA $0595  	; NPC #$0B Y-pos
0x01BCD7|$06:$BCC7:8D 9D 05	STA $059D  	; NPC #$0C Y-pos
0x01BCDA|$06:$BCCA:A9 04   	LDA #$04   
0x01BCDC|$06:$BCCC:8D 91 05	STA $0591  	; NPC #$0A sprite ID
0x01BCDF|$06:$BCCF:20 6C BD	JSR $BD6C  
0x01BCE2|$06:$BCD2:8D 99 05	STA $0599  	; NPC #$0B sprite ID
0x01BCE5|$06:$BCD5:20 6C BD	JSR $BD6C  
0x01BCE8|$06:$BCD8:8D A1 05	STA $05A1  	; NPC #$0C sprite ID
0x01BCEB|$06:$BCDB:20 6C BD	JSR $BD6C  
0x01BCEE|$06:$BCDE:20 7C BD	JSR $BD7C  
0x01BCF1|$06:$BCE1:20 7C BD	JSR $BD7C  
0x01BCF4|$06:$BCE4:A9 0A   	LDA #$0A   
0x01BCF6|$06:$BCE6:85 D0   	STA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
; control flow target (from $BD23)
; call to code in a different bank ($0F:$C3AB)
0x01BCF8|$06:$BCE8:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x01BCFB|$06:$BCEB:A5 32   	LDA $32    	; RNG byte 0
0x01BCFD|$06:$BCED:29 0E   	AND #$0E   
0x01BCFF|$06:$BCEF:38      	SEC        
0x01BD00|$06:$BCF0:E9 08   	SBC #$08   
0x01BD02|$06:$BCF2:85 18   	STA $18    
; call to code in a different bank ($0F:$C3AB)
0x01BD04|$06:$BCF4:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x01BD07|$06:$BCF7:A5 32   	LDA $32    	; RNG byte 0
0x01BD09|$06:$BCF9:29 0E   	AND #$0E   
0x01BD0B|$06:$BCFB:38      	SEC        
0x01BD0C|$06:$BCFC:E9 08   	SBC #$08   
0x01BD0E|$06:$BCFE:85 19   	STA $19    
0x01BD10|$06:$BD00:A9 00   	LDA #$00   
0x01BD12|$06:$BD02:85 1C   	STA $1C    
0x01BD14|$06:$BD04:85 1E   	STA $1E    
0x01BD16|$06:$BD06:A9 87   	LDA #$87   	; Music ID #$87: hit 2 SFX
; call to code in a different bank ($0F:$C561)
0x01BD18|$06:$BD08:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; call to code in a different bank ($0F:$D325)
0x01BD1B|$06:$BD0B:20 25 D3	JSR $D325  
; call to code in a different bank ($0F:$C3AB)
0x01BD1E|$06:$BD0E:20 AB C3	JSR $C3AB  	; generate a random number and store it in $32-$33 (two passes)
0x01BD21|$06:$BD11:A5 32   	LDA $32    	; RNG byte 0
0x01BD23|$06:$BD13:29 07   	AND #$07   
0x01BD25|$06:$BD15:D0 06   	BNE $BD1D  
; call to code in a different bank ($0F:$C511)
0x01BD27|$06:$BD17:20 11 C5	JSR $C511  	; flash screen 5 times
0x01BD2A|$06:$BD1A:4C 21 BD	JMP $BD21  

; control flow target (from $BD15)
0x01BD2D|$06:$BD1D:AA      	TAX        
; call to code in a different bank ($0F:$C1EE)
0x01BD2E|$06:$BD1E:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
; control flow target (from $BD1A)
0x01BD31|$06:$BD21:C6 D0   	DEC $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x01BD33|$06:$BD23:D0 C3   	BNE $BCE8  
; control flow target (from $BD31)
0x01BD35|$06:$BD25:A9 94   	LDA #$94   	; Music ID #$94: burning SFX
; call to code in a different bank ($0F:$C561)
0x01BD37|$06:$BD27:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; call to code in a different bank ($0F:$D200)
0x01BD3A|$06:$BD2A:20 00 D2	JSR $D200  
0x01BD3D|$06:$BD2D:A5 98   	LDA $98    	; outcome of last fight?
0x01BD3F|$06:$BD2F:C9 FE   	CMP #$FE   
0x01BD41|$06:$BD31:90 F2   	BCC $BD25  
0x01BD43|$06:$BD33:A9 06   	LDA #$06   
0x01BD45|$06:$BD35:85 94   	STA $94    	; return bank for various function calls, doubles as index of selected option for multiple-choice menus
; call to code in a different bank ($0F:$FA32)
0x01BD47|$06:$BD37:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01BD4A|$06:$BD3A:E8	; String ID #$02E8: [wait]‘Thou hast delivered the world from Malroth's evil[.’][wait][line]‘Great is the victory and greater the rewards[.’][wait][line]‘I, Rubiss, have watched thy struggles and I am proud of thee[.’][end-FC]

; data -> code
; call to code in a different bank ($0F:$C515)
0x01BD4B|$06:$BD3B:20 15 C5	JSR $C515  	; flash screen 10 times
; call to code in a different bank ($0F:$C515)
0x01BD4E|$06:$BD3E:20 15 C5	JSR $C515  	; flash screen 10 times
0x01BD51|$06:$BD41:A9 84   	LDA #$84   
0x01BD53|$06:$BD43:8D 2D 06	STA $062D  	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01BD56|$06:$BD46:8D 3F 06	STA $063F  	; Cannock status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01BD59|$06:$BD49:8D 51 06	STA $0651  	; Moonbrooke status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
; call to code in a different bank ($0F:$C77B)
0x01BD5C|$06:$BD4C:20 7B C7	JSR $C77B  	; restore full HP/MP to all living party members
; call to code in a different bank ($0F:$EB76)
0x01BD5F|$06:$BD4F:20 76 EB	JSR $EB76  	; open menu specified by next byte

; code -> data
; indirect data load target
0x01BD62|$06:$BD52:01	; Menu ID #$04: Mini status window, top

; data -> code
; call to code in a different bank ($0F:$C22C)
0x01BD63|$06:$BD53:20 2C C2	JSR $C22C  
; call to code in a different bank ($0F:$FA32)
0x01BD66|$06:$BD56:20 32 FA	JSR $FA32  	; display string ID specified by next byte + #$0200

; code -> data
; indirect data load target
0x01BD69|$06:$BD59:E9	; String ID #$02E9: [wait]‘Go now!’[end-FC]

; data -> code
0x01BD6A|$06:$BD5A:A9 FF   	LDA #$FF   
0x01BD6C|$06:$BD5C:85 D0   	STA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x01BD6E|$06:$BD5E: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)
0x01BD70|$06:$BD60:A2 01   	LDX #$01   
; call to code in a different bank ($0F:$D2F1)
0x01BD72|$06:$BD62:20 F1 D2	JSR $D2F1  
0x01BD75|$06:$BD65:A9 00   	LDA #$00   
0x01BD77|$06:$BD67:85 8E   	STA $8E    	; flag for in battle or not (#$FF)?
; call to code in a different bank ($0F:$D88F)
0x01BD79|$06:$BD69:4C 8F D8	JMP $D88F  	; warp to warp point given by ($0C)

; control flow target (from $BCCF, $BCD5, $BCDB)
0x01BD7C|$06:$BD6C:A9 91   	LDA #$91   	; Music ID #$91: swamp SFX
; call to code in a different bank ($0F:$C561)
0x01BD7E|$06:$BD6E:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; call to code in a different bank ($0F:$D32E)
0x01BD81|$06:$BD71:20 2E D3	JSR $D32E  
0x01BD84|$06:$BD74:A2 28   	LDX #$28   
; call to code in a different bank ($0F:$C1EE)
0x01BD86|$06:$BD76:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x01BD89|$06:$BD79:A9 04   	LDA #$04   
0x01BD8B|$06:$BD7B:60      	RTS        

; control flow target (from $BCDE, $BCE1)
0x01BD8C|$06:$BD7C:A9 94   	LDA #$94   	; Music ID #$94: burning SFX
; call to code in a different bank ($0F:$C561)
0x01BD8E|$06:$BD7E:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; call to code in a different bank ($0F:$C511)
0x01BD91|$06:$BD81:20 11 C5	JSR $C511  	; flash screen 5 times
0x01BD94|$06:$BD84:A2 11   	LDX #$11   
; call to code in a different bank ($0F:$C1EE)
0x01BD96|$06:$BD86:20 EE C1	JSR $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF
0x01BD99|$06:$BD89:A9 94   	LDA #$94   	; Music ID #$94: burning SFX
; call to code in a different bank ($0F:$C561)
0x01BD9B|$06:$BD8B:20 61 C5	JSR $C561  	; play PCM specified by A (>= #$80 = sound effect [SFX], < #$80 = background music [BGM])
; call to code in a different bank ($0F:$C511)
0x01BD9E|$06:$BD8E:20 11 C5	JSR $C511  	; flash screen 5 times
0x01BDA1|$06:$BD91:A2 32   	LDX #$32   
; call to code in a different bank ($0F:$C1EE)
0x01BDA3|$06:$BD93:4C EE C1	JMP $C1EE  	; set $6007 = #$00, set $00 = #$01, wait for X interrupts, set $00 = #$FF

; indirect control flow target (via $8044)
0x01BDA6|$06:$BD96:AD AD 61	LDA $61AD  
0x01BDA9|$06:$BD99:D0 51   	BNE $BDEC  
0x01BDAB|$06:$BD9B:A9 FF   	LDA #$FF   
0x01BDAD|$06:$BD9D:8D 41 05	STA $0541  	; NPC #$00 sprite ID
0x01BDB0|$06:$BDA0:8D 49 05	STA $0549  	; NPC #$01 sprite ID
0x01BDB3|$06:$BDA3:8D 51 05	STA $0551  	; NPC #$02 sprite ID
0x01BDB6|$06:$BDA6:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x01BDB8|$06:$BDA8:29 04   	AND #$04   
0x01BDBA|$06:$BDAA:F0 07   	BEQ $BDB3  
0x01BDBC|$06:$BDAC:A9 05   	LDA #$05   
0x01BDBE|$06:$BDAE:8D 41 05	STA $0541  	; NPC #$00 sprite ID
0x01BDC1|$06:$BDB1:D0 13   	BNE $BDC6  
; control flow target (from $BDAA)
0x01BDC3|$06:$BDB3:A2 07   	LDX #$07   
0x01BDC5|$06:$BDB5:A9 84   	LDA #$84   
0x01BDC7|$06:$BDB7:85 0E   	STA $0E    
0x01BDC9|$06:$BDB9:20 ED BD	JSR $BDED  
0x01BDCC|$06:$BDBC:A9 04   	LDA #$04   
0x01BDCE|$06:$BDBE:85 0E   	STA $0E    
0x01BDD0|$06:$BDC0:20 ED BD	JSR $BDED  
0x01BDD3|$06:$BDC3:20 10 BE	JSR $BE10  
; control flow target (from $BDB1)
0x01BDD6|$06:$BDC6:A0 00   	LDY #$00   
; control flow target (from $BDEA)
0x01BDD8|$06:$BDC8:B9 41 05	LDA $0541,Y	; NPC #$00 sprite ID
0x01BDDB|$06:$BDCB:C9 FF   	CMP #$FF   
0x01BDDD|$06:$BDCD:D0 14   	BNE $BDE3  
0x01BDDF|$06:$BDCF:A9 00   	LDA #$00   
0x01BDE1|$06:$BDD1:99 3A 05	STA $053A,Y
0x01BDE4|$06:$BDD4:99 3B 05	STA $053B,Y
0x01BDE7|$06:$BDD7:99 3C 05	STA $053C,Y	; NPC #$00 ?
0x01BDEA|$06:$BDDA:99 3D 05	STA $053D,Y	; NPC #$00 ?
0x01BDED|$06:$BDDD:99 3E 05	STA $053E,Y	; NPC #$00 ?
0x01BDF0|$06:$BDE0:99 3F 05	STA $053F,Y	; NPC #$00 ?
; control flow target (from $BDCD)
0x01BDF3|$06:$BDE3:98      	TYA        
0x01BDF4|$06:$BDE4:18      	CLC        
0x01BDF5|$06:$BDE5:69 08   	ADC #$08   
0x01BDF7|$06:$BDE7:A8      	TAY        
0x01BDF8|$06:$BDE8:C9 18   	CMP #$18   
0x01BDFA|$06:$BDEA:D0 DC   	BNE $BDC8  
; control flow target (from $BD99)
0x01BDFC|$06:$BDEC:60      	RTS        

; control flow target (from $BDB9, $BDC0)
0x01BDFD|$06:$BDED:A0 00   	LDY #$00   
0x01BDFF|$06:$BDEF:84 0C   	STY $0C    
; control flow target (from $BE0D)
0x01BE01|$06:$BDF1:B9 2D 06	LDA $062D,Y	; Midenhall status (80 = Alive, 40 = Sleep, 20 = Poison, 10 = ?, 08 = ?, 04 = In Party, 02 = Surround, 01 = Silence)
0x01BE04|$06:$BDF4:29 84   	AND #$84   
0x01BE06|$06:$BDF6:C5 0E   	CMP $0E    
0x01BE08|$06:$BDF8:D0 0A   	BNE $BE04  
0x01BE0A|$06:$BDFA:A5 0C   	LDA $0C    
0x01BE0C|$06:$BDFC:9D 3A 05	STA $053A,X
0x01BE0F|$06:$BDFF:8A      	TXA        
0x01BE10|$06:$BE00:18      	CLC        
0x01BE11|$06:$BE01:69 08   	ADC #$08   
0x01BE13|$06:$BE03:AA      	TAX        
; control flow target (from $BDF8)
0x01BE14|$06:$BE04:E6 0C   	INC $0C    
0x01BE16|$06:$BE06:98      	TYA        
0x01BE17|$06:$BE07:18      	CLC        
0x01BE18|$06:$BE08:69 12   	ADC #$12   
0x01BE1A|$06:$BE0A:A8      	TAY        
0x01BE1B|$06:$BE0B:C9 36   	CMP #$36   
0x01BE1D|$06:$BE0D:D0 E2   	BNE $BDF1  
0x01BE1F|$06:$BE0F:60      	RTS        

; control flow target (from $BDC3)
0x01BE20|$06:$BE10:A5 45   	LDA $45    
0x01BE22|$06:$BE12:C9 FF   	CMP #$FF   
0x01BE24|$06:$BE14:D0 01   	BNE $BE17  
0x01BE26|$06:$BE16:60      	RTS        

; control flow target (from $BE14)
0x01BE27|$06:$BE17:C9 00   	CMP #$00   
0x01BE29|$06:$BE19:D0 08   	BNE $BE23  
0x01BE2B|$06:$BE1B:A9 02   	LDA #$02   
; control flow target (from $BE57, $BE5F, $BE67, $BE6F)
0x01BE2D|$06:$BE1D:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x01BE30|$06:$BE20:4C 27 BE	JMP $BE27  

; control flow target (from $BE19)
0x01BE33|$06:$BE23:C9 01   	CMP #$01   
0x01BE35|$06:$BE25:D0 2A   	BNE $BE51  
; control flow target (from $BE20)
0x01BE37|$06:$BE27:AD 3A 05	LDA $053A  
0x01BE3A|$06:$BE2A:8D 42 05	STA $0542  	; NPC #$00 ?
0x01BE3D|$06:$BE2D:8D 4A 05	STA $054A  	; NPC #$01 scripted motion low byte
0x01BE40|$06:$BE30:AD 3B 05	LDA $053B  
0x01BE43|$06:$BE33:8D 43 05	STA $0543  	; NPC #$00 ?
0x01BE46|$06:$BE36:8D 4B 05	STA $054B  	; NPC #$01 scripted motion high byte
0x01BE49|$06:$BE39:AD 40 05	LDA $0540  	; NPC #$00 ? + direction nybble
0x01BE4C|$06:$BE3C:8D 48 05	STA $0548  	; NPC #$01 ? + direction nybble
0x01BE4F|$06:$BE3F:8D 50 05	STA $0550  	; NPC #$02 ? + direction nybble
0x01BE52|$06:$BE42:A9 00   	LDA #$00   
0x01BE54|$06:$BE44:8D 44 05	STA $0544  	; NPC #$01 ?
0x01BE57|$06:$BE47:8D 45 05	STA $0545  	; NPC #$01 ?
0x01BE5A|$06:$BE4A:8D 4C 05	STA $054C  	; NPC #$02 ?
0x01BE5D|$06:$BE4D:8D 4D 05	STA $054D  	; NPC #$02 ?
0x01BE60|$06:$BE50:60      	RTS        

; control flow target (from $BE25)
0x01BE61|$06:$BE51:C9 03   	CMP #$03   
0x01BE63|$06:$BE53:D0 04   	BNE $BE59  
0x01BE65|$06:$BE55:A9 03   	LDA #$03   
0x01BE67|$06:$BE57:D0 C4   	BNE $BE1D  
; control flow target (from $BE53)
0x01BE69|$06:$BE59:C9 04   	CMP #$04   
0x01BE6B|$06:$BE5B:D0 04   	BNE $BE61  
0x01BE6D|$06:$BE5D:A9 01   	LDA #$01   
0x01BE6F|$06:$BE5F:D0 BC   	BNE $BE1D  
; control flow target (from $BE5B)
0x01BE71|$06:$BE61:C9 09   	CMP #$09   
0x01BE73|$06:$BE63:D0 04   	BNE $BE69  
0x01BE75|$06:$BE65:A9 00   	LDA #$00   
0x01BE77|$06:$BE67:F0 B4   	BEQ $BE1D  
; control flow target (from $BE63)
0x01BE79|$06:$BE69:C9 0A   	CMP #$0A   
0x01BE7B|$06:$BE6B:D0 04   	BNE $BE71  
0x01BE7D|$06:$BE6D:A9 02   	LDA #$02   
0x01BE7F|$06:$BE6F:D0 AC   	BNE $BE1D  
; control flow target (from $BE6B)
0x01BE81|$06:$BE71:C9 02   	CMP #$02   
0x01BE83|$06:$BE73:D0 47   	BNE $BEBC  
0x01BE85|$06:$BE75:A5 17   	LDA $17    	; current map Y-pos (1)
0x01BE87|$06:$BE77:D0 04   	BNE $BE7D  
; control flow target (from $BEC6)
0x01BE89|$06:$BE79:A9 02   	LDA #$02   
0x01BE8B|$06:$BE7B:D0 16   	BNE $BE93  
; control flow target (from $BE77)
0x01BE8D|$06:$BE7D:A5 16   	LDA $16    	; current map X-pos (1)
0x01BE8F|$06:$BE7F:C5 21   	CMP $21    	; map width
0x01BE91|$06:$BE81:D0 04   	BNE $BE87  
; control flow target (from $BECA)
0x01BE93|$06:$BE83:A9 03   	LDA #$03   
0x01BE95|$06:$BE85:D0 0C   	BNE $BE93  
; control flow target (from $BE81)
0x01BE97|$06:$BE87:A5 16   	LDA $16    	; current map X-pos (1)
0x01BE99|$06:$BE89:D0 04   	BNE $BE8F  
; control flow target (from $BEC2)
0x01BE9B|$06:$BE8B:A9 01   	LDA #$01   
0x01BE9D|$06:$BE8D:D0 04   	BNE $BE93  
; control flow target (from $BE89, $BEBE)
0x01BE9F|$06:$BE8F:A9 00   	LDA #$00   
0x01BEA1|$06:$BE91:F0 00   	BEQ $BE93  	; useless op
; control flow target (from $BE7B, $BE85, $BE8D, $BE91)
0x01BEA3|$06:$BE93:8D 40 05	STA $0540  	; NPC #$00 ? + direction nybble
0x01BEA6|$06:$BE96:8D 48 05	STA $0548  	; NPC #$01 ? + direction nybble
0x01BEA9|$06:$BE99:8D 50 05	STA $0550  	; NPC #$02 ? + direction nybble
0x01BEAC|$06:$BE9C:0A      	ASL        
0x01BEAD|$06:$BE9D:0A      	ASL        
0x01BEAE|$06:$BE9E:0A      	ASL        
0x01BEAF|$06:$BE9F:AA      	TAX        
0x01BEB0|$06:$BEA0:A0 08   	LDY #$08   
; control flow target (from $BEB9)
0x01BEB2|$06:$BEA2:A9 04   	LDA #$04   
0x01BEB4|$06:$BEA4:85 2E   	STA $2E    
; control flow target (from $BEB0)
0x01BEB6|$06:$BEA6:BD CD BE	LDA $BECD,X
0x01BEB9|$06:$BEA9:99 3A 05	STA $053A,Y
0x01BEBC|$06:$BEAC:C8      	INY        
0x01BEBD|$06:$BEAD:E8      	INX        
0x01BEBE|$06:$BEAE:C6 2E   	DEC $2E    
0x01BEC0|$06:$BEB0:D0 F4   	BNE $BEA6  
0x01BEC2|$06:$BEB2:98      	TYA        
0x01BEC3|$06:$BEB3:18      	CLC        
0x01BEC4|$06:$BEB4:69 04   	ADC #$04   
0x01BEC6|$06:$BEB6:A8      	TAY        
0x01BEC7|$06:$BEB7:C9 18   	CMP #$18   
0x01BEC9|$06:$BEB9:D0 E7   	BNE $BEA2  
0x01BECB|$06:$BEBB:60      	RTS        

; control flow target (from $BE73)
0x01BECC|$06:$BEBC:C9 05   	CMP #$05   
0x01BECE|$06:$BEBE:F0 CF   	BEQ $BE8F  
0x01BED0|$06:$BEC0:C9 06   	CMP #$06   
0x01BED2|$06:$BEC2:F0 C7   	BEQ $BE8B  
0x01BED4|$06:$BEC4:C9 07   	CMP #$07   
0x01BED6|$06:$BEC6:F0 B1   	BEQ $BE79  
0x01BED8|$06:$BEC8:C9 08   	CMP #$08   
0x01BEDA|$06:$BECA:F0 B7   	BEQ $BE83  
0x01BEDC|$06:$BECC:60      	RTS        


; code -> data
; indexed data load target (from $BEA6)
0x01BEDD|$06:$BECD:80 7F 00 01
0x01BEE1|$06:$BED1:80 8F 00 01
0x01BEE5|$06:$BED5:70 6F FF 00
0x01BEE9|$06:$BED9:60 6F FF 00
0x01BEED|$06:$BEDD:80 5F 00 FF
0x01BEF1|$06:$BEE1:80 4F 00 FF
; indirect data load target
0x01BEF5|$06:$BEE5:90 6F 01 00
0x01BEF9|$06:$BEE9:A0 6F 01 00

; data -> code
; 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
; indirect control flow target (via $8046)
0x01BEFD|$06:$BEED:CA      	DEX        
0x01BEFE|$06:$BEEE:F0 08   	BEQ $BEF8  	; CLC and update $0C-$0D to warp point data to use if Outside allowed from current map
0x01BF00|$06:$BEF0:CA      	DEX        
0x01BF01|$06:$BEF1:F0 47   	BEQ $BF3A  	; CLC and update $0C-$0D to warp point data to use if Return allowed from current map
0x01BF03|$06:$BEF3:CA      	DEX        
0x01BF04|$06:$BEF4:F0 69   	BEQ $BF5F  	; disembark from ship and update ship position based on last save point ID $48
0x01BF06|$06:$BEF6:38      	SEC        
0x01BF07|$06:$BEF7:60      	RTS        

; CLC and update $0C-$0D to warp point data to use if Outside allowed from current map
; control flow target (from $BEEE)
0x01BF08|$06:$BEF8:A5 31   	LDA $31    	; current map ID
0x01BF0A|$06:$BEFA:C9 17   	CMP #$17   	; Map ID #$17: Hargon's Castle 7F
0x01BF0C|$06:$BEFC:D0 11   	BNE $BF0F  
; Hargon's Castle 7F is special: after defeating Hargon, you can't escape before defeating Malroth
0x01BF0E|$06:$BEFE:A5 D0   	LDA $D0    	; Malroth status flag (#$FF = defeated, #$00 = alive, others = countdown to battle)
0x01BF10|$06:$BF00:30 07   	BMI $BF09  	; Outside from Hargon's Castle 7F is okay
0x01BF12|$06:$BF02:AD 61 05	LDA $0561  	; NPC #$04 sprite ID; #$FF if Hargon defeated
0x01BF15|$06:$BF05:C9 FF   	CMP #$FF   
0x01BF17|$06:$BF07:F0 1A   	BEQ $BF23  	; SEC to flag Outside not allowed for calling code
; Outside from Hargon's Castle 7F is okay
; control flow target (from $BF00)
0x01BF19|$06:$BF09:A9 44   	LDA #$44   	; Map ID #$44: Hargon's Castle 2F
0x01BF1B|$06:$BF0B:A0 07   	LDY #$07   	; first floor index for Map ID #$44: Hargon's Castle 2F
0x01BF1D|$06:$BF0D:D0 16   	BNE $BF25  	; Outside is allowed
; control flow target (from $BEFC)
0x01BF1F|$06:$BF0F:C9 18   	CMP #$18   	; Map ID #$18: Charlock Castle B8
0x01BF21|$06:$BF11:D0 06   	BNE $BF19  
; Charlock Castle B8 is not considered a dungeon, so handle it specially
0x01BF23|$06:$BF13:A9 34   	LDA #$34   	; Map ID #$34: Charlock Castle B1/B2
0x01BF25|$06:$BF15:A0 03   	LDY #$03   	; first floor index for Map ID #$34: Charlock Castle B1/B2
0x01BF27|$06:$BF17:D0 0C   	BNE $BF25  	; Outside is allowed
; control flow target (from $BF11)
0x01BF29|$06:$BF19:A0 0C   	LDY #$0C   	; for everything else, start scanning the first floor list
; control flow target (from $BF21)
0x01BF2B|$06:$BF1B:D9 82 BF	CMP $BF82,Y	; dungeon first floors
0x01BF2E|$06:$BF1E:B0 05   	BCS $BF25  	; Outside is allowed
0x01BF30|$06:$BF20:88      	DEY        
0x01BF31|$06:$BF21:10 F8   	BPL $BF1B  	; if more first floors to check, check them
; SEC to flag Outside not allowed for calling code
; control flow target (from $BF07)
0x01BF33|$06:$BF23:38      	SEC        
0x01BF34|$06:$BF24:60      	RTS        

; Outside is allowed
; control flow target (from $BF0D, $BF17, $BF1E)
0x01BF35|$06:$BF25:38      	SEC        
0x01BF36|$06:$BF26:F9 82 BF	SBC $BF82,Y	; dungeon first floors
0x01BF39|$06:$BF29:85 0E   	STA $0E    	; floor number
0x01BF3B|$06:$BF2B:98      	TYA        
0x01BF3C|$06:$BF2C:0A      	ASL        
0x01BF3D|$06:$BF2D:A8      	TAY        
0x01BF3E|$06:$BF2E:B9 8F BF	LDA $BF8F,Y	; pointer to warp point data used when casting Outside
0x01BF41|$06:$BF31:85 0C   	STA $0C    
0x01BF43|$06:$BF33:B9 90 BF	LDA $BF90,Y
0x01BF46|$06:$BF36:85 0D   	STA $0D    
0x01BF48|$06:$BF38:18      	CLC        
0x01BF49|$06:$BF39:60      	RTS        

; CLC and update $0C-$0D to warp point data to use if Return allowed from current map
; control flow target (from $BEF1)
0x01BF4A|$06:$BF3A:A5 31   	LDA $31    	; current map ID
0x01BF4C|$06:$BF3C:F0 1F   	BEQ $BF5D  	; SEC to flag Return disallowed for calling code; Map ID #$00: Fake Midenhall
0x01BF4E|$06:$BF3E:C9 2B   	CMP #$2B   	; map IDs >= #$2B are dungeon maps
0x01BF50|$06:$BF40:B0 1B   	BCS $BF5D  	; SEC to flag Return disallowed for calling code
0x01BF52|$06:$BF42:C9 17   	CMP #$17   	; Map ID #$17: Hargon's Castle 7F
0x01BF54|$06:$BF44:F0 17   	BEQ $BF5D  	; SEC to flag Return disallowed for calling code
0x01BF56|$06:$BF46:C9 18   	CMP #$18   	; Map ID #$18: Charlock Castle B8
0x01BF58|$06:$BF48:F0 13   	BEQ $BF5D  	; SEC to flag Return disallowed for calling code
0x01BF5A|$06:$BF4A:20 5F BF	JSR $BF5F  	; disembark from ship and update ship position based on last save point ID $48
0x01BF5D|$06:$BF4D:A5 48   	LDA $48    	; last save point ID
0x01BF5F|$06:$BF4F:0A      	ASL        
0x01BF60|$06:$BF50:A8      	TAY        
0x01BF61|$06:$BF51:B9 A9 BF	LDA $BFA9,Y	; pointer to warp point data used when casting Return
0x01BF64|$06:$BF54:85 0C   	STA $0C    
0x01BF66|$06:$BF56:B9 AA BF	LDA $BFAA,Y
0x01BF69|$06:$BF59:85 0D   	STA $0D    
0x01BF6B|$06:$BF5B:18      	CLC        	; CLC to flag Return allowed for calling code
0x01BF6C|$06:$BF5C:60      	RTS        

; SEC to flag Return disallowed for calling code
; control flow target (from $BF3C, $BF40, $BF44, $BF48)
0x01BF6D|$06:$BF5D:38      	SEC        
0x01BF6E|$06:$BF5E:60      	RTS        

; disembark from ship and update ship position based on last save point ID $48
; control flow target (from $BEF4, $BF4A)
0x01BF6F|$06:$BF5F:A5 CF   	LDA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x01BF71|$06:$BF61:29 03   	AND #$03   
0x01BF73|$06:$BF63:85 CF   	STA $CF    	; ship status (#$04 = on ship, #$02 = own ship, #$01 = beat Lianport Gremlins)
0x01BF75|$06:$BF65:A5 48   	LDA $48    	; last save point ID
0x01BF77|$06:$BF67:0A      	ASL        
0x01BF78|$06:$BF68:A8      	TAY        
0x01BF79|$06:$BF69:B9 74 BF	LDA $BF74,Y	; ship X-pos after warp
0x01BF7C|$06:$BF6C:85 D2   	STA $D2    	; ship X-pos (when you aren't on it)
0x01BF7E|$06:$BF6E:B9 75 BF	LDA $BF75,Y	; ship Y-pos after warp
0x01BF81|$06:$BF71:85 D3   	STA $D3    	; ship Y-pos (when you aren't on it)
0x01BF83|$06:$BF73:60      	RTS        


; code -> data
; ship X-pos after warp
; indexed data load target (from $BF69)
0x01BF84|$06:$BF74:D4
; ship Y-pos after warp
; indexed data load target (from $BF6E)
0x01BF85|$06:$BF75:   3C	; Save Point ID #$00: Midenhall 2F
0x01BF86|$06:$BF76:A4 09	; Save Point ID #$01: Cannock
; indirect data load target
0x01BF88|$06:$BF78:3B 2E	; Save Point ID #$02: Tantegel
0x01BF8A|$06:$BF7A:DA 91	; Save Point ID #$03: Osterfair
0x01BF8C|$06:$BF7C:1F C5	; Save Point ID #$04: Beran
0x01BF8E|$06:$BF7E:1F C5	; Save Point ID #$05: Rhone Shrine
0x01BF90|$06:$BF80:78 58	; Save Point ID #$06: Hamlin
; dungeon first floors
; indexed data load target (from $BF1B, $BF26)
0x01BF92|$06:$BF82:2B	; Map ID #$2B: Cave to Hamlin
0x01BF93|$06:$BF83:2C	; Map ID #$2C: Lake Cave B1
0x01BF94|$06:$BF84:2E	; Map ID #$2E: Sea Cave B1
0x01BF95|$06:$BF85:34	; Map ID #$34: Charlock Castle B1/B2
0x01BF96|$06:$BF86:37	; Map ID #$37: Cave to Rhone B1
0x01BF97|$06:$BF87:40	; Map ID #$40: Spring of Bravery
0x01BF98|$06:$BF88:43	; Map ID #$43: Cave to Rimuldar
0x01BF99|$06:$BF89:44	; Map ID #$44: Hargon's Castle 2F
0x01BF9A|$06:$BF8A:49	; Map ID #$49: Moon Tower 1F
0x01BF9B|$06:$BF8B:50	; Map ID #$50: Lighthouse 1F
0x01BF9C|$06:$BF8C:58	; Map ID #$58: Wind Tower 1F
0x01BF9D|$06:$BF8D:60	; Map ID #$60: Dragon Horn South 1F
0x01BF9E|$06:$BF8E:66	; Map ID #$66: Dragon Horn North 1F
; pointer to warp point data used when casting Outside
; indexed data load target (from $BF2E)
; indirect data load target
0x01BF9F|$06:$BF8F:A8
; indexed data load target (from $BF33)
0x01BFA0|$06:$BF90:   A2	; $02:$A2A8; Map ID #$2B: Cave to Hamlin
0x01BFA1|$06:$BF91:CF A2	; $02:$A2CF; Map ID #$2C: Lake Cave B1
0x01BFA3|$06:$BF93:D2 A2	; $02:$A2D2; Map ID #$2E: Sea Cave B1
0x01BFA5|$06:$BF95:D8 A2	; $02:$A2D8; Map ID #$34: Charlock Castle B1/B2
0x01BFA7|$06:$BF97:DE A2	; $02:$A2DE; Map ID #$37: Cave to Rhone B1
0x01BFA9|$06:$BF99:ED A2	; $02:$A2ED; Map ID #$40: Spring of Bravery
0x01BFAB|$06:$BF9B:EA A2	; $02:$A2EA; Map ID #$43: Cave to Rimuldar
0x01BFAD|$06:$BF9D:A2 A2	; $02:$A2A2; Map ID #$44: Hargon's Castle 2F
0x01BFAF|$06:$BF9F:E1 A2	; $02:$A2E1; Map ID #$49: Moon Tower 1F
0x01BFB1|$06:$BFA1:DB A2	; $02:$A2DB; Map ID #$50: Lighthouse 1F
0x01BFB3|$06:$BFA3:D5 A2	; $02:$A2D5; Map ID #$58: Wind Tower 1F
0x01BFB5|$06:$BFA5:E4 A2	; $02:$A2E4; Map ID #$60: Dragon Horn South 1F
0x01BFB7|$06:$BFA7:E7 A2	; $02:$A2E7; Map ID #$66: Dragon Horn North 1F
; pointer to warp point data used when casting Return
; indexed data load target (from $BF51)
; indirect data load target
0x01BFB9|$06:$BFA9:69
; indexed data load target (from $BF56)
0x01BFBA|$06:$BFAA:   A2	; $02:$A269; warp point data (map ID, X-pos, Y-pos) used when casting Return; Save Point ID #$00: Midenhall 2F
0x01BFBB|$06:$BFAB:6C A2	; $02:$A26C; Save Point ID #$01: Cannock
0x01BFBD|$06:$BFAD:6F A2	; $02:$A26F; Save Point ID #$02: Tantegel
0x01BFBF|$06:$BFAF:72 A2	; $02:$A272; Save Point ID #$03: Osterfair
0x01BFC1|$06:$BFB1:75 A2	; $02:$A275; Save Point ID #$04: Beran
0x01BFC3|$06:$BFB3:78 A2	; $02:$A278; Save Point ID #$05: Rhone Shrine
0x01BFC5|$06:$BFB5:7B A2	; $02:$A27B; Save Point ID #$06: Hamlin

; data -> free
; indirect data load target
0x01BFC7|$06:$BFB7:FF
; ... skipping $1F FF bytes
; indirect data load target
0x01BFE7|$06:$BFD7:FF

; free -> unknown
0x01BFE8|$06:$BFD8:78      	; SEI        
0x01BFE9|$06:$BFD9:EE DF BF	; INC $BFDF  
0x01BFEA|$06:$BFDA:DF      	; INVALID OPCODE
0x01BFEB|$06:$BFDB:BF      	; INVALID OPCODE
0x01BFEC|$06:$BFDC:4C 86 FF	; JMP $FF86  
0x01BFED|$06:$BFDD:86 FF   	; STX $FF    
0x01BFEE|$06:$BFDE:FF      	; INVALID OPCODE
0x01BFEF|$06:$BFDF:80      	; INVALID OPCODE
0x01BFF0|$06:$BFE0:44      	; INVALID OPCODE
0x01BFF1|$06:$BFE1:52      	; INVALID OPCODE
0x01BFF2|$06:$BFE2:41 47   	; EOR ($47,X)
0x01BFF3|$06:$BFE3:47      	; INVALID OPCODE
0x01BFF4|$06:$BFE4:4F      	; INVALID OPCODE
0x01BFF5|$06:$BFE5:4E 20 57	; LSR $5720  
0x01BFF6|$06:$BFE6:20 57 41	; JSR $4157  
0x01BFF7|$06:$BFE7:57      	; INVALID OPCODE
0x01BFF8|$06:$BFE8:41 52   	; EOR ($52,X)
0x01BFF9|$06:$BFE9:52      	; INVALID OPCODE
0x01BFFA|$06:$BFEA:52      	; INVALID OPCODE
0x01BFFB|$06:$BFEB:49 4F   	; EOR #$4F   
0x01BFFC|$06:$BFEC:4F      	; INVALID OPCODE
0x01BFFD|$06:$BFED:52      	; INVALID OPCODE
0x01BFFE|$06:$BFEE:53      	; INVALID OPCODE
0x01BFFF|$06:$BFEF:32      	; INVALID OPCODE
0x01C000|$06:$BFF0:FF      	; INVALID OPCODE
0x01C001|$06:$BFF1:FF      	; INVALID OPCODE
0x01C002|$06:$BFF2:00      	; BRK        
0x01C003|$06:$BFF3:00      	; BRK        
0x01C004|$06:$BFF4:48      	; PHA        
0x01C005|$06:$BFF5:04      	; INVALID OPCODE
0x01C006|$06:$BFF6:01 0F   	; ORA ($0F,X)
0x01C007|$06:$BFF7:0F      	; INVALID OPCODE
0x01C008|$06:$BFF8:07      	; INVALID OPCODE
0x01C009|$06:$BFF9:9D D8 BF	; STA $BFD8,X
0x01C00A|$06:$BFFA:D8      	; CLD        
0x01C00B|$06:$BFFB:BF      	; INVALID OPCODE
0x01C00C|$06:$BFFC:D8      	; CLD        
0x01C00D|$06:$BFFD:BF      	; INVALID OPCODE
0x01C00E|$06:$BFFE:D8      	; CLD        
0x01C00F|$06:$BFFF:BF      	; INVALID OPCODE