*
* Dugeon Master
* (c) 1987, FTL
* (s) 2016, Brutal Deluxe Software
*

         mx	%00
	rel
	dsk	MEMORY.L
	lst	off

	use	MEMORY.X

L0B0000  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EC
         TCS
         LDA   L030168
         ASL
         ASL
         PHA
         LDA   #$0002
         PLX
         STX   $F8
         CLC
         ADC   $F8
         LDX   #$0000
         STX   $F2
         STA   $F0
         STZ   $EE
         BRA   L0B005A
L0B0025  LDA   $EE
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030170
         LDA   L03016E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         LDX   #$0000
         PHX
         PHA
         LDX   $F2
         LDA   $F0
         JSL   L021F00
         PLA
         PLX
         STX   $F2
         STA   $F0
         INC   $EE
L0B005A  LDA   $EE
         CMP   $FF
         BCC   L0B0025
         LDX   $F2
         LDA   $F0
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PLD
         RTL

L0B006E  ENT
         PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00EA
         TCS
         LDX   $FD
         LDA   $FB
         AND   #$0001
         PHA
         TXA
         AND   #$0000
         TAX
         PLA
         STX   $F0
         ORA   $F0
         BEQ   L0B0093
         INC   $FB
         BNE   L0B0093
         INC   $FD
L0B0093  LDA   $FF
         CMP   #$0001
         BEQ   L0B009D
         BRL   L0B00F4
L0B009D  SEC
         LDA   L0301B4
         SBC   $FB
         BNE   L0B00AC
         LDA   L0301B6
         SBC   $FD
         BRA   L0B00B3
L0B00AC  LDA   L0301B6
         SBC   $FD
         REP   #$02
L0B00B3  BVS   L0B00B8
         EOR   #$8000
L0B00B8  BMI   L0B00BD
         BRL   L0B00F4
L0B00BD  LDX   L0301B6
         LDA   L0301B4
         SEC
         SBC   $FB
         PHA
         TXA
         SBC   $FD
         TAX
         PLA
         STX   L0301B6
         STA   L0301B4
         LDX   L0301B2
         LDA   L0301B0
         STX   $EE
         STA   $EC
         LDX   L0301B2
         LDA   L0301B0
         CLC
         ADC   $FB
         PHA
         TXA
         ADC   $FD
         TAX
         PLA
         STX   L0301B2
         STA   L0301B0
         BRL   L0B0167
L0B00F4  SEC
         LDA   $FB
         SBC   L0301A0
         BNE   L0B0103
         LDA   $FD
         SBC   L0301A2
         BRA   L0B010A
L0B0103  LDA   $FD
         SBC   L0301A2
         REP   #$02
L0B010A  BEQ   L0B011B
         BVS   L0B0111
         EOR   #$8000
L0B0111  BPL   L0B011B
         PEA   $0028
         JSL   L0203A1
         PLY
L0B011B  LDA   $FF
         CMP   #$0002
         BNE   L0B0139
         LDX   L03019A
         LDA   L030198
         SEC
         SBC   L0301A0
         PHA
         TXA
         SBC   L0301A2
         TAX
         PLA
         STX   $EE
         STA   $EC
         BRA   L0B0152
L0B0139  LDX   L03019A
         LDA   L030198
         SEC
         SBC   $FB
         PHA
         TXA
         SBC   $FD
         TAX
         PLA
         STX   L03019A
         STA   L030198
         STX   $EE
         STA   $EC
L0B0152  LDX   L0301A2
         LDA   L0301A0
         SEC
         SBC   $FB
         PHA
         TXA
         SBC   $FD
         TAX
         PLA
         STX   L0301A2
         STA   L0301A0
L0B0167  LDX   $EE
         LDA   $EC
         TAY
         TSC
         CLC
         ADC   #$000A
         TCS
         TYA
         PLD
         RTL

L0B0175  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00F0
         TCS
         LDX   $FF
         LDA   $FD
         AND   #$0001
         PHA
         TXA
         AND   #$0000
         TAX
         PLA
         STX   $F2
         ORA   $F2
         BEQ   L0B019A
         INC   $FD
         BNE   L0B019A
         INC   $FF
L0B019A  LDX   L0301A2
         LDA   L0301A0
         CLC
         ADC   $FD
         PHA
         TXA
         ADC   $FF
         TAX
         PLA
         STX   L0301A2
         STA   L0301A0
         LDX   L03019A
         LDA   L030198
         CLC
         ADC   $FD
         PHA
         TXA
         ADC   $FF
         TAX
         PLA
         STX   L03019A
         STA   L030198
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0B01CC  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00F0
         TCS
         LDX   $FF
         LDA   $FD
         AND   #$0001
         PHA
         TXA
         AND   #$0000
         TAX
         PLA
         STX   $F2
         ORA   $F2
         BEQ   L0B01F1
         INC   $FD
         BNE   L0B01F1
         INC   $FF
L0B01F1  LDX   L0301A2
         LDA   L0301A0
         CLC
         ADC   $FD
         PHA
         TXA
         ADC   $FF
         TAX
         PLA
         STX   L0301A2
         STA   L0301A0
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0B020E  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E8
         TCS
         LDY   #$0006
         LDA   [$FD],Y
         TAX
         LDY   #$0004
         LDA   [$FD],Y
         STX   $F0
         STA   $EE
         LDY   #$000A
         LDA   [$FD],Y
         TAX
         LDY   #$0008
         LDA   [$FD],Y
         STX   $EC
         STA   $EA
         LDA   $EE
         CMP   #$0000
         BNE   L0B027A
         LDA   $F0
         CMP   #$0000
         BNE   L0B027A
         LDA   $EA
         CMP   #$0000
         BNE   L0B025B
         LDA   $EC
         CMP   #$0000
         BNE   L0B025B
         STZ   L0301C2
         STZ   L0301C4
         BRA   L0B0278
L0B025B  LDX   $EC
         LDA   $EA
         STX   L0301C4
         STA   L0301C2
         LDX   #$0000
         LDA   #$0000
         LDY   #$0006
         PHA
         TXA
         STA   [$EA],Y
         PLA
         LDY   #$0004
         STA   [$EA],Y
L0B0278  BRA   L0B02B4
L0B027A  LDX   $EC
         LDA   $EA
         LDY   #$000A
         PHA
         TXA
         STA   [$EE],Y
         PLA
         LDY   #$0008
         STA   [$EE],Y
         SEC
         LDA   $EA
         SBC   #$0000
         BNE   L0B029A
         LDA   $EC
         SBC   #$0000
         BRA   L0B02A1
L0B029A  LDA   $EC
         SBC   #$0000
         REP   #$02
L0B02A1  BEQ   L0B02B4
         LDX   $F0
         LDA   $EE
         LDY   #$0006
         PHA
         TXA
         STA   [$EA],Y
         PLA
         LDY   #$0004
         STA   [$EA],Y
L0B02B4  TSC
         CLC
         ADC   #$000E
         TCS
         PLD
         RTL

L0B02BC  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00DE
         TCS
         LDX   $FF
         LDA   $FD
         STX   $EC
         STA   $EA
         LDA   L0301C2
         CMP   #$0000
         BNE   L0B030C
         LDA   L0301C4
         CMP   #$0000
         BNE   L0B030C
         LDX   $EC
         LDA   $EA
         STX   L0301C4
         STA   L0301C2
         LDX   #$0000
         LDA   #$0000
         LDY   #$000A
         PHA
         TXA
         STA   [$EA],Y
         PLA
         LDY   #$0008
         STA   [$EA],Y
         LDY   #$0006
         PHA
         TXA
         STA   [$EA],Y
         PLA
         LDY   #$0004
         STA   [$EA],Y
         BRL   L0B0446
L0B030C  LDX   L0301C4
         LDA   L0301C2
         STX   $F0
         STA   $EE
         LDY   #$0002
         LDA   [$EA],Y
         TAX
         LDA   [$EA]
         STX   $E4
         STA   $E2
         LDY   #$0002
         LDA   [$EE],Y
         TAX
         LDA   [$EE]
         PHX
         PHA
         LDX   $E4
         LDA   $E2
         JSL   L022171
         BEQ   L0B033D
         BVS   L0B033B
         EOR   #$8000
L0B033B  BMI   L0B037F
L0B033D  LDX   $EC
         LDA   $EA
         STX   L0301C4
         STA   L0301C2
         LDX   #$0000
         LDA   #$0000
         LDY   #$0006
         PHA
         TXA
         STA   [$EA],Y
         PLA
         LDY   #$0004
         STA   [$EA],Y
         LDX   $F0
         LDA   $EE
         LDY   #$000A
         PHA
         TXA
         STA   [$EA],Y
         PLA
         LDY   #$0008
         STA   [$EA],Y
         LDX   $EC
         LDA   $EA
         LDY   #$0006
         PHA
         TXA
         STA   [$EE],Y
         PLA
         LDY   #$0004
         STA   [$EE],Y
         BRL   L0B0446
L0B037F  STZ   $E0
L0B0381  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDY   #$000A
         LDA   [$EE],Y
         TAX
         LDY   #$0008
         LDA   [$EE],Y
         STX   $EC
         STA   $EA
         JSL   L022171
         BEQ   L0B040D
         LDY   #$0002
         LDA   [$EA],Y
         TAX
         LDA   [$EA]
         PHX
         PHA
         LDX   $E4
         LDA   $E2
         JSL   L022171
         BEQ   L0B03B9
         BVS   L0B03B7
         EOR   #$8000
L0B03B7  BMI   L0B0402
L0B03B9  LDX   $FF
         LDA   $FD
         LDY   #$0006
         PHA
         TXA
         STA   [$EA],Y
         PLA
         LDY   #$0004
         STA   [$EA],Y
         LDY   #$000A
         PHA
         TXA
         STA   [$EE],Y
         PLA
         LDY   #$0008
         STA   [$EE],Y
         LDX   $F0
         LDA   $EE
         LDY   #$0006
         PHA
         TXA
         STA   [$FD],Y
         PLA
         LDY   #$0004
         STA   [$FD],Y
         LDX   $EC
         LDA   $EA
         LDY   #$000A
         PHA
         TXA
         STA   [$FD],Y
         PLA
         LDY   #$0008
         STA   [$FD],Y
         LDA   #$0001
         STA   $E0
         BRA   L0B040D
         BRA   L0B040A
L0B0402  LDX   $EC
         LDA   $EA
         STX   $F0
         STA   $EE
L0B040A  BRL   L0B0381
L0B040D  LDA   $E0
         BNE   L0B0446
         LDX   $FF
         LDA   $FD
         LDY   #$000A
         PHA
         TXA
         STA   [$EE],Y
         PLA
         LDY   #$0008
         STA   [$EE],Y
         LDX   $F0
         LDA   $EE
         LDY   #$0006
         PHA
         TXA
         STA   [$FD],Y
         PLA
         LDY   #$0004
         STA   [$FD],Y
         LDX   #$0000
         LDA   #$0000
         LDY   #$000A
         PHA
         TXA
         STA   [$FD],Y
         PLA
         LDY   #$0008
         STA   [$FD],Y
L0B0446  TSC
         CLC
         ADC   #$0018
         TCS
         PLD
         RTL

L0B044E  PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00DE
         TCS
         STZ   $E4
         LDA   $FF
         STA   $E6
L0B045F  LDA   #$0001
         PHA
         LDA   $E6
         SEC
         JSL   L0222DF
         PLA
         STA   $E6
         TAY
         BEQ   L0B0474
         INC   $E4
         BRA   L0B045F
L0B0474  LDA   $E4
         SEC
         SBC   #$0001
         STA   $E6
         BRL   L0B05C2
L0B047F  LDA   $E6
         PHA
         LDA   #$0001
         SEC
         JSL   L0222A8
         PLA
         SEC
         SBC   #$0001
         STA   $E2
         ASL
         STA   $E0
         LDA   $E2
         STA   $EC
         BRL   L0B05B2
L0B049B  LDA   $EC
         STA   $EE
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         STA   $E8
L0B04BD  LDA   $EE
         ASL
         CLC
         ADC   #$0001
         STA   $EA
         CMP   $FF
         BCC   L0B04CD
         BRL   L0B0590
L0B04CD  LDA   $EA
         CLC
         ADC   #$0001
         CMP   $FF
         BCS   L0B0523
         LDA   $EA
         CLC
         ADC   #$0001
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   $EA
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PLX
         STX   $F0
         CMP   $F0
         BEQ   L0B0521
         BCS   L0B0523
L0B0521  INC   $EA
L0B0523  LDA   $EA
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         CMP   $E8
         BEQ   L0B058B
         BCC   L0B058B
         LDA   $EA
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   $EE
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         PLA
         STA   [$F0]
         LDA   $EA
         STA   $EE
         BRA   L0B058D
L0B058B  BRA   L0B0590
L0B058D  BRL   L0B04BD
L0B0590  LDA   $EE
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   $E8
         STA   [$F0]
         INC   $EC
L0B05B2  LDA   $EC
         CMP   $E0
         BNE   L0B05BB
         BRL   L0B049B
L0B05BB  BCS   L0B05C0
         BRL   L0B049B
L0B05C0  DEC   $E6
L0B05C2  LDA   $E6
         SEC
         SBC   #$0000
         BVS   L0B05CD
         EOR   #$8000
L0B05CD  BPL   L0B05D2
         BRL   L0B047F
L0B05D2  LDA   $FF
         SEC
         SBC   #$0001
         STA   $E2
         BRL   L0B073D
L0B05DD  LDA   $E2
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         STA   $E8
         LDA   #$0000
         STA   $EE
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   $E2
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         PLA
         STA   [$F0]
L0B063E  LDA   $EE
         ASL
         CLC
         ADC   #$0001
         STA   $EA
         PHA
         LDA   $E2
         SEC
         SBC   #$0001
         PLX
         STX   $F0
         CMP   $F0
         BCS   L0B0658
         BRL   L0B071B
L0B0658  LDA   $EA
         CLC
         ADC   #$0001
         CMP   $E2
         BCS   L0B06AE
         LDA   $EA
         CLC
         ADC   #$0001
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   $EA
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PLX
         STX   $F0
         CMP   $F0
         BEQ   L0B06AC
         BCS   L0B06AE
L0B06AC  INC   $EA
L0B06AE  LDA   $EA
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         CMP   $E8
         BEQ   L0B0716
         BCC   L0B0716
         LDA   $EA
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   $EE
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         PLA
         STA   [$F0]
         LDA   $EA
         STA   $EE
         BRA   L0B0718
L0B0716  BRA   L0B071B
L0B0718  BRL   L0B063E
L0B071B  LDA   $EE
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   $E8
         STA   [$F0]
         DEC   $E2
L0B073D  LDA   $E2
         CMP   #$0001
         BCC   L0B0747
         BRL   L0B05DD
L0B0747  TSC
         CLC
         ADC   #$0016
         TCS
         PLD
         RTL

L0B074F  PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00DA
         TCS
         PEI   $FB
         JSL   L0B0000
         PLY
         STX   $EE
         STA   $EC
         LDA   $FB
         LDX   #$0000
         TAY
         BPL   L0B076E
         DEX
L0B076E  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030170
         LDA   L03016E
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         STA   $E6
         LDX   #$0000
         LDA   #$000A
         PHX
         PHA
         LDX   $EE
         LDA   $EC
         SEC
         JSL   L022303
         PLA
         PLX
         STA   $E2
         LDX   #$0000
         LDA   #$000A
         PHX
         PHA
         LDA   $E2
         LDX   #$0000
         TAY
         BPL   L0B07B1
         DEX
L0B07B1  SEC
         JSL   L0222B8
         PLA
         PLX
         STX   $EA
         STA   $E8
L0B07BC  LDA   $E6
         SEC
         SBC   #$0000
         BNE   L0B07C7
         BRL   L0B08D5
L0B07C7  BVS   L0B07CC
         EOR   #$8000
L0B07CC  BMI   L0B07D1
         BRL   L0B08D5
L0B07D1  LDA   $E2
         CMP   L030162
         BNE   L0B07E0
         LDA   L030192
         BNE   L0B07E0
         BRL   L0B0840
L0B07E0  LDA   $E2
         STA   L030162
         LDX   #$0000
         LDA   #$0400
         PHX
         PHA
         LDX   L03016C
         LDA   L03016A
         SEC
         SBC   $E8
         PHA
         TXA
         SBC   $EA
         TAX
         PLA
         STX   $DE
         STA   $DC
         JSL   L022171
         BVS   L0B0809
         EOR   #$8000
L0B0809  BMI   L0B0815
         LDX   #$0000
         LDA   #$0400
         STX   $DE
         STA   $DC
L0B0815  PEI   $EA
         PEI   $E8
         LDA   L030164
         PHA
         JSL   L081A7E
         PLY
         PLY
         PLY
         LDX   L030190
         LDA   L03018E
         PHX
         PHA
         PEI   $DE
         PEI   $DC
         LDA   L030164
         PHA
         JSL   L081ACB
         PLY
         PLY
         PLY
         PLY
         PLY
         STZ   L030192
L0B0840  LDX   $EE
         LDA   $EC
         SEC
         SBC   $E8
         PHA
         TXA
         SBC   $EA
         TAX
         PLA
         STA   $E4
         LDA   #$0400
         SEC
         SBC   $E4
         PHA
         PEI   $E6
         JSL   L020493
         PLY
         PLY
         STA   $E0
         PEI   $E0
         PEI   $FF
         PEI   $FD
         LDA   $E4
         LDX   #$0000
         TAY
         BPL   L0B086F
         DEX
L0B086F  PHX
         PHA
         LDX   L030190
         LDA   L03018E
         JSL   L021F00
         JSL   L0202AB
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $E6
         SEC
         SBC   $E0
         STA   $E6
         LDA   $E0
         LDX   #$0000
         TAY
         BPL   L0B0894
         DEX
L0B0894  PHX
         PHA
         LDX   $EE
         LDA   $EC
         JSL   L021F00
         PLA
         PLX
         STX   $EE
         STA   $EC
         LDA   $E0
         LDX   #$0000
         TAY
         BPL   L0B08AD
         DEX
L0B08AD  PHX
         PHA
         LDX   $FF
         LDA   $FD
         JSL   L021F00
         PLA
         PLX
         STX   $FF
         STA   $FD
         INC   $E2
         LDX   $EA
         LDA   $E8
         CLC
         ADC   #$0400
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $EA
         STA   $E8
         BRL   L0B07BC
L0B08D5  TSC
         CLC
         ADC   #$001A
         TCS
         PLD
         RTL

L0B08DD  ENT
         PHD
         TSC
         SEC
         SBC   #$00EB
         TCD
         ADC   #$00E4
         TCS
         LDX   $F3
         LDA   $F1
         STX   L0301AE
         STA   L0301AC
         STX   L030188
         STA   L030186
         LDX   $F3
         LDA   $F1
         CLC
         ADC   $F5
         PHA
         TXA
         ADC   $F7
         TAX
         PLA
         STX   L030196
         STA   L030194
         STX   L03019A
         STA   L030198
         LDX   $F7
         LDA   $F5
         STX   L0301A2
         STA   L0301A0
         LDX   $FB
         LDA   $F9
         STX   L0301B2
         STA   L0301B0
         LDX   $FF
         LDA   $FD
         STX   L0301B6
         STA   L0301B4
         PEA   $0001
         PEA   $0000
         PEA   $0400
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L030190
         STA   L03018E
         PEA   $0001
         PEA   $0000
         PEA   $13EC
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L0301BC
         STA   L0301BA
         PEA   $13EC
         LDX   L0301BC
         LDA   L0301BA
         PHX
         PHA
         JSL   L020232
         PLY
         PLY
         PLY
         PEA   $0001
         PEA   $0000
         PEA   $05B4
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L030180
         STA   L03017E
         PEA   $0002
         PEA   $FFFF
         PEA   $02DA
         LDX   L030180
         LDA   L03017E
         PHX
         PHA
         JSL   L020284
         PLY
         PLY
         PLY
         PLY
         PLY
         PEA   $0001
         PEA   $0000
         PEA   $05B4
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L030184
         STA   L030182
         LDX   #$0000
         LDA   #$0000
         STX   L0301C4
         STA   L0301C2
         STX   L0301D0
         STA   L0301CE
         STX   L0301CC
         STA   L0301CA
         STX   L0301C8
         STA   L0301C6
         LDX   #$FFFF
         LDA   #$FFFF
         STX   L0301D6
         STA   L0301D4
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0B09E5  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$0074
         TCS
         LDX   #$0005
         LDA   #$A550
         PHX
         PHA
         LDX   L03019A
         LDA   L030198
         SEC
         SBC   L030186
         PHA
         TXA
         SBC   L030188
         TAX
         PLA
         JSL   L022171
         BVS   L0B0A12
         EOR   #$8000
L0B0A12  BPL   L0B0A19
         LDA   #$0000
         BRA   L0B0A1C
L0B0A19  LDA   #$0001
L0B0A1C  STA   L0301D2
         TAY
         BEQ   L0B0A26
         JSL   L0D5467
L0B0A26  LDX   L03019A
         LDA   L030198
         SEC
         SBC   #$2710
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STX   L03018C
         STA   L03018A
         LDA   #$0001
         STA   L0301B8
         LDX   L03018C
         LDA   L03018A
         STX   L0301AA
         STA   L0301A8
         STX   L0301A6
         STA   L0301A4
         LDX   #$0000
         LDA   #$2710
         STX   L0301A2
         STA   L0301A0
         LDX   L03018C
         LDA   L03018A
         SEC
         SBC   L030186
         PHA
         TXA
         SBC   L030188
         TAX
         PLA
         STX   L0301C0
         STA   L0301BE
         TSC
         CLC
         ADC   #$0086
         TCS
         PLD
         RTL

L0B0A80  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         LDA   L030166
         PHA
         INC
         STA   L030166
         PLA
         TAY
         BEQ   L0B0A99
         BRA   L0B0ABC
L0B0A99  PEA   ^L054586
         PEA   L054586
         JSL   L081B9F
         PLY
         PLY
         STA   L030164
         LDA   L030164
         PHA
         JSL   L081DA1
         PLY
         TAY
         BEQ   L0B0ABC
         PEA   $0029
         JSL   L0203A1
         PLY
L0B0ABC  TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L0B0AC6  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         LDA   L030166
         DEC
         STA   L030166
         TAY
         BEQ   L0B0ADD
         BRA   L0B0AE6
L0B0ADD  LDA   L030164
         PHA
         JSL   L081BF5
         PLY
L0B0AE6  TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L0B0AF0  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F0
         TCS
         STZ   L030166
         JSL   L0B0A80
         PEA   ^L030168
         PEA   L030168
         PEA   $0000
         PEA   $0002
         LDA   L030164
         PHA
         JSL   L081ACB
         PLY
         PLY
         PLY
         PLY
         PLY
         TAY
         BNE   L0B0B21
         BRL   L0B0C09
L0B0B21  LDA   L030168
         ASL
         STA   $F2
         TAY
         BNE   L0B0B2D
         BRL   L0B0C09
L0B0B2D  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         PEA   $0001
         LDA   $F2
         LDX   #$0000
         PHX
         PHA
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L030170
         STA   L03016E
         JSL   L022171
         BNE   L0B0B55
         BRL   L0B0C09
L0B0B55  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         PEA   $0001
         LDA   $F2
         LDX   #$0000
         PHX
         PHA
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L030174
         STA   L030172
         JSL   L022171
         BNE   L0B0B7D
         BRL   L0B0C09
L0B0B7D  LDX   L030170
         LDA   L03016E
         PHX
         PHA
         LDA   $F2
         LDX   #$0000
         PHX
         PHA
         LDA   L030164
         PHA
         JSL   L081ACB
         PLY
         PLY
         PLY
         PLY
         PLY
         TAY
         BNE   L0B0B9F
         BRL   L0B0C09
L0B0B9F  LDX   L030174
         LDA   L030172
         PHX
         PHA
         LDA   $F2
         LDX   #$0000
         PHX
         PHA
         LDA   L030164
         PHA
         JSL   L081ACB
         PLY
         PLY
         PLY
         PLY
         PLY
         TAY
         BEQ   L0B0C09
         LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         PEA   $0001
         LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L030178
         STA   L030176
         JSL   L022171
         BEQ   L0B0C09
         LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         PEA   $0001
         LDA   $F2
         LDX   #$0000
         PHX
         PHA
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L03017C
         STA   L03017A
         JSL   L022171
         BNE   L0B0C0E
L0B0C09  LDA   #$0000
         BRA   L0B0C11
L0B0C0E  LDA   #$0001
L0B0C11  STA   $F4
         LDA   $F4
         BNE   L0B0C1A
         BRL   L0B0CE4
L0B0C1A  PEI   $F2
         LDX   L030174
         LDA   L030172
         PHX
         PHA
         LDX   L030170
         LDA   L03016E
         PHX
         PHA
         JSL   L0202AB
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $F2
         ASL
         PHA
         LDX   L030178
         LDA   L030176
         PHX
         PHA
         JSL   L020232
         PLY
         PLY
         PLY
         PEA   $0002
         PEA   $FFFF
         LDA   $F2
         LSR
         STA   $F2
         PHA
         LDX   L03017C
         LDA   L03017A
         PHX
         PHA
         JSL   L020284
         PLY
         PLY
         PLY
         PLY
         PLY
         DEC   $F2
         LDA   $F2
         LDX   #$0000
         STX   $FA
         ASL
         ROL   $FA
         LDX   $FA
         PHX
         PHA
         LDX   L030170
         LDA   L03016E
         JSL   L021F00
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         LDX   #$0000
         PHX
         PHA
         PEI   $F2
         JSL   L0B0000
         PLY
         JSL   L021F00
         PLA
         PLX
         STX   L03016C
         STA   L03016A
         LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         PEA   $0001
         LDX   L030174
         LDA   L030172
         STA   $F6
         STX   $F8
         LDA   [$F6]
         LDX   #$0000
         PHX
         PHA
         JSL   L0B006E
         PLY
         PLY
         PLY
         STX   L030082
         STA   L030080
         JSL   L022171
         BNE   L0B0CD0
         BRA   L0B0CE4
L0B0CD0  LDX   L030082
         LDA   L030080
         PHX
         PHA
         PEA   $0000
         JSL   L0B074F
         PLY
         PLY
         PLY
         BRA   L0B0CEC
L0B0CE4  PEA   $002A
         JSL   L0203A1
         PLY
L0B0CEC  TAY
         TSC
         CLC
         ADC   #$000A
         TCS
         TYA
         PLD
         RTL

L0B0CF6  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00DE
         TCS
         LDA   $FF
         SEC
         SBC   #$0000
         BVS   L0B0D0C
         EOR   #$8000
L0B0D0C  BPL   L0B0D65
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B0D17
         DEX
L0B0D17  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L03017C
         LDA   L03017A
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $E2
         CMP   #$FFFF
         BNE   L0B0D3C
         BRL   L0B10AC
L0B0D3C  LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B0D45
         DEX
L0B0D45  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L03017C
         LDA   L03017A
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         STA   [$F4]
         BRA   L0B0DC1
L0B0D65  LDA   $FF
         AND   #$7FFF
         STA   $FF
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B0D75
         DEX
L0B0D75  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $E2
         CMP   #$FFFF
         BNE   L0B0D9A
         BRL   L0B10AC
L0B0D9A  LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B0DA3
         DEX
L0B0DA3  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         STA   [$F4]
L0B0DC1  LDA   $E2
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $F2
         STA   $F0
         LDA   $E2
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   #$0000
         LDA   #$0000
         LDY   #$0002
         PHA
         TXA
         STA   [$F4],Y
         PLA
         STA   [$F4]
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         JSL   L021F0B
         STX   $EA
         STA   $E8
         LDX   L0301C0
         LDA   L0301BE
         CLC
         ADC   $E8
         PHA
         TXA
         ADC   $EA
         TAX
         PLA
         STX   L0301C0
         STA   L0301BE
         LDY   #$0006
         LDA   [$F0],Y
         STA   $E2
         LDY   #$0008
         LDA   [$F0],Y
         STA   $E0
         LDA   $E2
         CMP   #$FFFF
         BEQ   L0B0E5C
         BRL   L0B0ED6
L0B0E5C  LDA   $E0
         CMP   #$FFFF
         BNE   L0B0E78
         STZ   L0301C6
         STZ   L0301C8
         STZ   L0301CA
         STZ   L0301CC
         STZ   L0301CE
         STZ   L0301D0
         BRL   L0B0ED3
L0B0E78  LDA   $E0
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   L0301C8
         STA   L0301C6
         LDX   L0301C8
         LDA   L0301C6
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         LDY   #$0006
         STA   [$F4],Y
         LDA   L0301CE
         CMP   $F0
         BNE   L0B0ED3
         LDA   L0301D0
         CMP   $F2
         BNE   L0B0ED3
         LDX   L0301C8
         LDA   L0301C6
         STX   L0301D0
         STA   L0301CE
L0B0ED3  BRL   L0B0F7D
L0B0ED6  LDA   $E2
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EE
         STA   $EC
         LDA   $E0
         LDY   #$0008
         STA   [$EC],Y
         LDA   $E0
         CMP   #$FFFF
         BNE   L0B0F31
         LDX   $EE
         LDA   $EC
         STX   L0301CC
         STA   L0301CA
         LDA   L0301CE
         CMP   $F0
         BNE   L0B0F2F
         LDA   L0301D0
         CMP   $F2
         BNE   L0B0F2F
         STZ   L0301CE
         STZ   L0301D0
L0B0F2F  BRA   L0B0F7D
L0B0F31  LDA   $E0
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EE
         STA   $EC
         LDA   $E2
         LDY   #$0006
         STA   [$EC],Y
         LDA   L0301CE
         CMP   $F0
         BNE   L0B0F7D
         LDA   L0301D0
         CMP   $F2
         BNE   L0B0F7D
         LDX   $EE
         LDA   $EC
         STX   L0301D0
         STA   L0301CE
L0B0F7D  SEC
         LDA   $F0
         SBC   L030186
         BNE   L0B0F8C
         LDA   $F2
         SBC   L030188
         BRA   L0B0F93
L0B0F8C  LDA   $F2
         SBC   L030188
         REP   #$02
L0B0F93  BEQ   L0B0FF3
         LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDX   $F2
         LDA   $F0
         SEC
         SBC   #$0004
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $E6
         STA   $E4
         JSL   L022171
         BVS   L0B0FC5
         EOR   #$8000
L0B0FC5  BMI   L0B0FF3
         LDX   $F2
         LDA   $F0
         SEC
         SBC   $E4
         PHA
         TXA
         SBC   $E6
         TAX
         PLA
         STX   $F2
         STA   $F0
         PEI   $F2
         PEI   $F0
         JSL   L0B020E
         PLY
         PLY
         LDX   $EA
         LDA   $E8
         CLC
         ADC   $E4
         PHA
         TXA
         ADC   $E6
         TAX
         PLA
         STX   $EA
         STA   $E8
L0B0FF3  LDX   L0301AE
         LDA   L0301AC
         PHX
         PHA
         LDX   $F2
         LDA   $F0
         CLC
         ADC   $E8
         PHA
         TXA
         ADC   $EA
         TAX
         PLA
         JSL   L022171
         BNE   L0B101B
         LDX   $F2
         LDA   $F0
         STX   L0301AE
         STA   L0301AC
         BRL   L0B10AC
L0B101B  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDX   $F2
         LDA   $F0
         CLC
         ADC   $E8
         PHA
         TXA
         ADC   $EA
         TAX
         PLA
         STX   $EE
         STA   $EC
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $E6
         STA   $E4
         JSL   L022171
         BVS   L0B104D
         EOR   #$8000
L0B104D  BMI   L0B106A
         PEI   $EE
         PEI   $EC
         JSL   L0B020E
         PLY
         PLY
         LDX   $EA
         LDA   $E8
         CLC
         ADC   $E4
         PHA
         TXA
         ADC   $E6
         TAX
         PLA
         STX   $EA
         STA   $E8
L0B106A  LDX   $EA
         LDA   $E8
         LDY   #$0002
         PHA
         TXA
         STA   [$F0],Y
         PLA
         STA   [$F0]
         LDX   $F2
         LDA   $F0
         CLC
         ADC   $E8
         PHA
         TXA
         ADC   $EA
         TAX
         PLA
         SEC
         SBC   #$0004
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STA   $F4
         STX   $F6
         LDX   $EA
         LDA   $E8
         LDY   #$0002
         PHA
         TXA
         STA   [$F4],Y
         PLA
         STA   [$F4]
         PEI   $F2
         PEI   $F0
         JSL   L0B02BC
         PLY
         PLY
L0B10AC  TAY
         TSC
         CLC
         ADC   #$001A
         TCS
         TYA
         PLD
         RTL

L0B10B6  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00F0
         TCS
L0B10C1  SEC
         LDA   L0301BE
         SBC   $FD
         BNE   L0B10D0
         LDA   L0301C0
         SBC   $FF
         BRA   L0B10D7
L0B10D0  LDA   L0301C0
         SBC   $FF
         REP   #$02
L0B10D7  BVS   L0B10DC
         EOR   #$8000
L0B10DC  BMI   L0B110D
         LDA   L0301C6
         CMP   #$0000
         BNE   L0B10F6
         LDA   L0301C8
         CMP   #$0000
         BNE   L0B10F6
         PEA   $002B
         JSL   L0203A1
         PLY
L0B10F6  LDX   L0301C8
         LDA   L0301C6
         STA   $F2
         STX   $F4
         LDY   #$000A
         LDA   [$F2],Y
         PHA
         JSL   L0B0CF6
         PLY
         BRA   L0B10C1
L0B110D  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0B1115  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00E4
         TCS
         LDA   L0301C2
         CMP   #$0000
         BNE   L0B1133
         LDA   L0301C4
         CMP   #$0000
         BNE   L0B1133
         BRL   L0B12D0
L0B1133  LDX   L030188
         LDA   L030186
         STX   $F0
         STA   $EE
         STX   $F4
         STA   $F2
L0B1141  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDY   #$0002
         LDA   [$EE],Y
         TAX
         LDA   [$EE]
         STX   $EC
         STA   $EA
         JSL   L022171
         BVS   L0B115E
         EOR   #$8000
L0B115E  BMI   L0B1174
         LDX   $F0
         LDA   $EE
         CLC
         ADC   $EA
         PHA
         TXA
         ADC   $EC
         TAX
         PLA
         STX   $F0
         STA   $EE
         BRL   L0B12AC
L0B1174  LDX   $EC
         LDA   $EA
         JSL   L021F0B
         STX   $EC
         STA   $EA
         SEC
         LDA   $EE
         SBC   $F2
         BNE   L0B118D
         LDA   $F0
         SBC   $F4
         BRA   L0B1193
L0B118D  LDA   $F0
         SBC   $F4
         REP   #$02
L0B1193  BNE   L0B1198
         BRL   L0B128A
L0B1198  LDY   #$000A
         LDA   [$EE],Y
         STA   $E8
         LDA   $E8
         SEC
         SBC   #$0000
         BVS   L0B11AA
         EOR   #$8000
L0B11AA  BPL   L0B11D4
         LDA   $E8
         LDX   #$0000
         TAY
         BPL   L0B11B5
         DEX
L0B11B5  STX   $FA
         ASL
         ROL   $FA
         LDX   $FA
         PHX
         PHA
         LDX   L03017C
         LDA   L03017A
         JSL   L021F00
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         STA   $E6
         BRA   L0B11FD
L0B11D4  LDA   $E8
         AND   #$7FFF
         LDX   #$0000
         TAY
         BPL   L0B11E0
         DEX
L0B11E0  STX   $FA
         ASL
         ROL   $FA
         LDX   $FA
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         STA   $E6
L0B11FD  LDA   $E6
         LDX   #$0000
         STX   $FA
         ASL
         ROL   $FA
         ASL
         ROL   $FA
         LDX   $FA
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDX   $F4
         LDA   $F2
         LDY   #$0002
         PHA
         TXA
         STA   [$F6],Y
         PLA
         STA   [$F6]
         LDX   $EC
         LDA   $EA
         PHA
         PEI   $F4
         PEI   $F2
         PEI   $F0
         PEI   $EE
         JSL   L0202AB
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   L0301C6
         CMP   $EE
         BNE   L0B125A
         LDA   L0301C8
         CMP   $F0
         BNE   L0B125A
         LDX   $F4
         LDA   $F2
         STX   L0301C8
         STA   L0301C6
L0B125A  LDA   L0301CA
         CMP   $EE
         BNE   L0B1272
         LDA   L0301CC
         CMP   $F0
         BNE   L0B1272
         LDX   $F4
         LDA   $F2
         STX   L0301CC
         STA   L0301CA
L0B1272  LDA   L0301CE
         CMP   $EE
         BNE   L0B128A
         LDA   L0301D0
         CMP   $F0
         BNE   L0B128A
         LDX   $F4
         LDA   $F2
         STX   L0301D0
         STA   L0301CE
L0B128A  LDX   $F0
         LDA   $EE
         CLC
         ADC   $EA
         PHA
         TXA
         ADC   $EC
         TAX
         PLA
         STX   $F0
         STA   $EE
         LDX   $F4
         LDA   $F2
         CLC
         ADC   $EA
         PHA
         TXA
         ADC   $EC
         TAX
         PLA
         STX   $F4
         STA   $F2
L0B12AC  LDA   $EE
         CMP   L0301AC
         BEQ   L0B12B6
         BRL   L0B1141
L0B12B6  LDA   $F0
         CMP   L0301AE
         BEQ   L0B12C0
         BRL   L0B1141
L0B12C0  LDX   $F4
         LDA   $F2
         STX   L0301AE
         STA   L0301AC
         STZ   L0301C2
         STZ   L0301C4
L0B12D0  TAY
         TSC
         CLC
         ADC   #$0016
         TCS
         TYA
         PLD
         RTL

L0B12DA  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E2
         TCS
         PEI   $FF
         PEI   $FD
         JSL   L0B10B6
         PLY
         PLY
         LDX   $FF
         LDA   $FD
         PHX
         PHA
         LDX   L03018C
         LDA   L03018A
         SEC
         SBC   L0301AC
         PHA
         TXA
         SBC   L0301AE
         TAX
         PLA
         JSL   L022171
         BEQ   L0B1313
         BVS   L0B1311
         EOR   #$8000
L0B1311  BMI   L0B1335
L0B1313  LDX   L0301AE
         LDA   L0301AC
         STX   $F0
         STA   $EE
         LDX   L0301AE
         LDA   L0301AC
         CLC
         ADC   $FD
         PHA
         TXA
         ADC   $FF
         TAX
         PLA
         STX   L0301AE
         STA   L0301AC
         BRL   L0B1495
L0B1335  LDX   $FF
         LDA   $FD
         PHX
         PHA
         LDX   L0301C4
         LDA   L0301C2
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         TAX
         LDA   [$F2]
         JSL   L022171
         BEQ   L0B1380
         BVS   L0B1358
         EOR   #$8000
L0B1358  BPL   L0B1380
         JSL   L0B1115
         LDX   L0301AE
         LDA   L0301AC
         STX   $F0
         STA   $EE
         LDX   L0301AE
         LDA   L0301AC
         CLC
         ADC   $FD
         PHA
         TXA
         ADC   $FF
         TAX
         PLA
         STX   L0301AE
         STA   L0301AC
         BRL   L0B1495
L0B1380  LDX   L0301C4
         LDA   L0301C2
         STX   $F0
         STA   $EE
         STZ   $E8
L0B138C  LDX   $FF
         LDA   $FD
         PHX
         PHA
         LDY   #$0002
         LDA   [$EE],Y
         TAX
         LDA   [$EE]
         JSL   L022171
         BNE   L0B13A7
         LDA   #$0001
         STA   $E8
         BRA   L0B13F8
L0B13A7  LDX   $FF
         LDA   $FD
         PHX
         PHA
         LDY   #$0002
         LDA   [$EE],Y
         TAX
         LDA   [$EE]
         JSL   L022171
         BEQ   L0B13C2
         BVS   L0B13C0
         EOR   #$8000
L0B13C0  BMI   L0B13DF
L0B13C2  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDY   #$000A
         LDA   [$EE],Y
         TAX
         LDY   #$0008
         LDA   [$EE],Y
         STX   $EC
         STA   $EA
         JSL   L022171
         BNE   L0B13F0
L0B13DF  LDX   L0301C4
         LDA   L0301C2
         STX   $F0
         STA   $EE
         LDA   #$0001
         STA   $E8
         BRA   L0B13F8
L0B13F0  LDX   $EC
         LDA   $EA
         STX   $F0
         STA   $EE
L0B13F8  LDA   $E8
         BEQ   L0B138C
         PEI   $F0
         PEI   $EE
         JSL   L0B020E
         PLY
         PLY
         LDY   #$0002
         LDA   [$EE],Y
         TAX
         LDA   [$EE]
         SEC
         SBC   $FD
         PHA
         TXA
         SBC   $FF
         TAX
         PLA
         STX   $E6
         STA   $E4
         SEC
         LDA   $E4
         SBC   #$0018
         BNE   L0B142A
         LDA   $E6
         SBC   #$0000
         BRA   L0B1431
L0B142A  LDA   $E6
         SBC   #$0000
         REP   #$02
L0B1431  BVS   L0B1436
         EOR   #$8000
L0B1436  BPL   L0B1489
         LDX   $F0
         LDA   $EE
         CLC
         ADC   $FD
         PHA
         TXA
         ADC   $FF
         TAX
         PLA
         STX   $EC
         STA   $EA
         LDX   $EC
         LDA   $EA
         CLC
         ADC   $E4
         PHA
         TXA
         ADC   $E6
         TAX
         PLA
         SEC
         SBC   #$0004
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STA   $F2
         STX   $F4
         LDX   $E6
         LDA   $E4
         LDY   #$0002
         PHA
         TXA
         STA   [$F2],Y
         PLA
         STA   [$F2]
         LDY   #$0002
         PHA
         TXA
         STA   [$EA],Y
         PLA
         STA   [$EA]
         PEI   $EC
         PEI   $EA
         JSL   L0B02BC
         PLY
         PLY
         BRA   L0B1495
L0B1489  LDY   #$0002
         LDA   [$EE],Y
         TAX
         LDA   [$EE]
         STX   $FF
         STA   $FD
L0B1495  LDX   L0301C0
         LDA   L0301BE
         SEC
         SBC   $FD
         PHA
         TXA
         SBC   $FF
         TAX
         PLA
         STX   L0301C0
         STA   L0301BE
         LDX   $FF
         LDA   $FD
         JSL   L021F0B
         LDY   #$0002
         PHA
         TXA
         STA   [$EE],Y
         PLA
         STA   [$EE]
         LDX   $FF
         LDA   $FD
         JSL   L021F0B
         PHX
         PHA
         LDX   $F0
         LDA   $EE
         CLC
         ADC   $FD
         PHA
         TXA
         ADC   $FF
         TAX
         PLA
         SEC
         SBC   #$0004
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STA   $F2
         STX   $F4
         PLA
         PLX
         LDY   #$0002
         PHA
         TXA
         STA   [$F2],Y
         PLA
         STA   [$F2]
         LDX   $F0
         LDA   $EE
         TAY
         TSC
         CLC
         ADC   #$0014
         TCS
         TYA
         PLD
         RTL

L0B14FC  ENT
         PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00CE
         TCS
         STZ   $D0
         PEI   $FF
         PEI   $FD
         PEI   $FB
         JSL   L0B044E
         PLY
         PLY
         PLY
         STZ   $E2
         STZ   $E4
         STZ   $EE
         BRL   L0B1626
L0B151F  LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B1528
         DEX
L0B1528  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         STA   $EA
L0B1543  LDA   $EE
         CLC
         ADC   #$0001
         STA   $EC
         SEC
         SBC   $FF
         BVS   L0B1553
         EOR   #$8000
L0B1553  BMI   L0B15C4
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B155E
         DEX
L0B155E  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         CMP   $EA
         BNE   L0B15C4
         LDA   $FF
         DEC   $FF
         SEC
         SBC   $EC
         ASL
         PHA
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B158D
         DEX
L0B158D  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B15A7
         DEX
L0B15A7  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         JSL   L0202AB
         PLY
         PLY
         PLY
         PLY
         PLY
         BRL   L0B1543
L0B15C4  LDA   $EA
         LDX   #$0000
         TAY
         BPL   L0B15CD
         DEX
L0B15CD  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030174
         LDA   L030172
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   #$0002
         PLX
         STX   $F4
         CLC
         ADC   $F4
         LDX   #$0000
         STX   $E8
         STA   $E6
         LDX   $E8
         LDA   $E6
         AND   #$0001
         PHA
         TXA
         AND   #$0000
         TAX
         PLA
         STX   $F0
         ORA   $F0
         BEQ   L0B1613
         INC   $E6
         BNE   L0B1613
         INC   $E8
L0B1613  LDX   $E4
         LDA   $E2
         CLC
         ADC   $E6
         PHA
         TXA
         ADC   $E8
         TAX
         PLA
         STX   $E4
         STA   $E2
         INC   $EE
L0B1626  LDA   $EE
         SEC
         SBC   $FF
         BVS   L0B1630
         EOR   #$8000
L0B1630  BMI   L0B1635
         BRL   L0B151F
L0B1635  LDA   L0301B8
         BEQ   L0B165A
         LDX   L0301A6
         LDA   L0301A4
         SEC
         SBC   $E2
         PHA
         TXA
         SBC   $E4
         TAX
         PLA
         SEC
         SBC   L030186
         PHA
         TXA
         SBC   L030188
         TAX
         PLA
         STX   $E0
         STA   $DE
         BRA   L0B166F
L0B165A  LDX   L03018C
         LDA   L03018A
         SEC
         SBC   L030186
         PHA
         TXA
         SBC   L030188
         TAX
         PLA
         STX   $E0
         STA   $DE
L0B166F  SEC
         LDA   #$4C78
         SBC   $DE
         BNE   L0B167E
         LDA   #$0000
         SBC   $E0
         BRA   L0B1685
L0B167E  LDA   #$0000
         SBC   $E0
         REP   #$02
L0B1685  BEQ   L0B1696
         BVS   L0B168C
         EOR   #$8000
L0B168C  BPL   L0B1696
         PEA   $002C
         JSL   L0203A1
         PLY
L0B1696  STZ   $EE
         BRA   L0B16D0
L0B169A  LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B16A3
         DEX
L0B16A3  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         CMP   #$FFFF
         BEQ   L0B16CE
         LDA   $EE
         ORA   #$8000
         PHA
         JSL   L0B0CF6
         PLY
L0B16CE  INC   $EE
L0B16D0  LDA   $EE
         SEC
         SBC   #$02DA
         BVS   L0B16DB
         EOR   #$8000
L0B16DB  BPL   L0B169A
         LDA   #$0000
         STA   $EE
         STA   $EC
L0B16E4  LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B16ED
         DEX
L0B16ED  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         STA   $EA
         BRL   L0B17ED
L0B170B  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B171C
         DEX
L0B171C  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         STX   $DC
         STA   $DA
         JSL   L022171
         BNE   L0B174D
         BRL   L0B17EB
L0B174D  PEI   $EC
         JSL   L0B0CF6
         PLY
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B175D
         DEX
L0B175D  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDX   #$0000
         LDA   #$0000
         LDY   #$0002
         PHA
         TXA
         STA   [$F0],Y
         PLA
         STA   [$F0]
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B1792
         DEX
L0B1792  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030174
         LDA   L030172
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         LDX   #$0000
         STX   $E8
         STA   $E6
         LDX   $E8
         LDA   $E6
         AND   #$0001
         PHA
         TXA
         AND   #$0000
         TAX
         PLA
         STX   $F0
         ORA   $F0
         BEQ   L0B17CE
         INC   $E6
         BNE   L0B17CE
         INC   $E8
L0B17CE  LDX   $E8
         LDA   $E6
         JSL   L021F0B
         PHA
         LDX   $DC
         LDA   $DA
         CLC
         ADC   $E6
         PHA
         TXA
         ADC   $E8
         TAX
         PLA
         STA   $F0
         STX   $F2
         PLA
         STA   [$F0]
L0B17EB  INC   $EC
L0B17ED  LDA   $EC
         SEC
         SBC   $EA
         BVS   L0B17F7
         EOR   #$8000
L0B17F7  BMI   L0B17FC
         BRL   L0B170B
L0B17FC  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDA   $EC
         INC   $EC
         LDX   #$0000
         TAY
         BPL   L0B180F
         DEX
L0B180F  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         JSL   L022171
         BEQ   L0B1882
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B1842
         DEX
L0B1842  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         EOR   #$FFFF
         PHA
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B1868
         DEX
L0B1868  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         PLA
         STA   [$F0]
L0B1882  INC   $EE
         LDA   $EE
         SEC
         SBC   $FF
         BVS   L0B188E
         EOR   #$8000
L0B188E  BMI   L0B1893
         BRL   L0B16E4
L0B1893  BRL   L0B1978
L0B1896  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B18A7
         DEX
L0B18A7  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         STX   $DC
         STA   $DA
         JSL   L022171
         BNE   L0B18D8
         BRL   L0B1976
L0B18D8  PEI   $EC
         JSL   L0B0CF6
         PLY
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B18E8
         DEX
L0B18E8  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDX   #$0000
         LDA   #$0000
         LDY   #$0002
         PHA
         TXA
         STA   [$F0],Y
         PLA
         STA   [$F0]
         LDA   $EC
         LDX   #$0000
         TAY
         BPL   L0B191D
         DEX
L0B191D  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030174
         LDA   L030172
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         LDX   #$0000
         STX   $E8
         STA   $E6
         LDX   $E8
         LDA   $E6
         AND   #$0001
         PHA
         TXA
         AND   #$0000
         TAX
         PLA
         STX   $F0
         ORA   $F0
         BEQ   L0B1959
         INC   $E6
         BNE   L0B1959
         INC   $E8
L0B1959  LDX   $E8
         LDA   $E6
         JSL   L021F0B
         PHA
         LDX   $DC
         LDA   $DA
         CLC
         ADC   $E6
         PHA
         TXA
         ADC   $E8
         TAX
         PLA
         STA   $F0
         STX   $F2
         PLA
         STA   [$F0]
L0B1976  INC   $EC
L0B1978  LDA   $EC
         CMP   L030168
         BCS   L0B1982
         BRL   L0B1896
L0B1982  LDA   L0301B8
         BNE   L0B198A
         BRL   L0B19ED
L0B198A  LDX   L0301A6
         LDA   L0301A4
         SEC
         SBC   $E2
         PHA
         TXA
         SBC   $E4
         TAX
         PLA
         PHX
         PHA
         LDX   L0301AA
         LDA   L0301A8
         JSL   L02209A
         PLA
         PLX
         STX   $E8
         STA   $E6
         SEC
         LDA   $E6
         SBC   #$0000
         BNE   L0B19BA
         LDA   $E8
         SBC   #$0000
         BRA   L0B19C1
L0B19BA  LDA   $E8
         SBC   #$0000
         REP   #$02
L0B19C1  BEQ   L0B19D4
         BVS   L0B19C8
         EOR   #$8000
L0B19C8  BPL   L0B19D4
         PEI   $E8
         PEI   $E6
         JSL   L0B10B6
         PLY
         PLY
L0B19D4  JSL   L0B1115
         LDX   L0301C0
         LDA   L0301BE
         SEC
         SBC   $E6
         PHA
         TXA
         SBC   $E8
         TAX
         PLA
         STX   L0301C0
         STA   L0301BE
L0B19ED  LDX   L0301A6
         LDA   L0301A4
         STX   $D8
         STA   $D6
         SEC
         SBC   #$0002
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STX   $DC
         STA   $DA
L0B1A06  SEC
         LDA   $DA
         SBC   L0301A8
         BNE   L0B1A15
         LDA   $DC
         SBC   L0301AA
         BRA   L0B1A1C
L0B1A15  LDA   $DC
         SBC   L0301AA
         REP   #$02
L0B1A1C  BNE   L0B1A21
         BRL   L0B1B37
L0B1A21  BVS   L0B1A26
         EOR   #$8000
L0B1A26  BMI   L0B1A2B
         BRL   L0B1B37
L0B1A2B  LDA   [$DA]
         STA   $EA
         SEC
         SBC   #$0000
         BVS   L0B1A38
         EOR   #$8000
L0B1A38  BMI   L0B1A5A
         LDA   $EA
         SEC
         SBC   #$0002
         LDX   #$0000
         TAY
         BPL   L0B1A47
         DEX
L0B1A47  PHX
         PHA
         LDX   $DC
         LDA   $DA
         JSL   L021F00
         PLA
         PLX
         STX   $DC
         STA   $DA
         BRL   L0B1B34
L0B1A5A  LDA   $EA
         LDX   #$0000
         TAY
         BPL   L0B1A63
         DEX
L0B1A63  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         PHX
         PHA
         LDX   $DC
         LDA   $DA
         JSL   L02209A
         LDX   #$0000
         LDA   #$0002
         JSL   L021F00
         PLA
         PLX
         STX   $E8
         STA   $E6
         LDX   $D8
         LDA   $D6
         SEC
         SBC   $E6
         PHA
         TXA
         SBC   $E8
         TAX
         PLA
         STX   $D8
         STA   $D6
         LDX   $DC
         LDA   $DA
         SEC
         SBC   $E6
         PHA
         TXA
         SBC   $E8
         TAX
         PLA
         STX   $DC
         STA   $DA
         LDX   $D8
         LDA   $D6
         PHX
         PHA
         LDX   $DC
         LDA   $DA
         CLC
         ADC   #$0002
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         JSL   L022171
         BEQ   L0B1B34
         LDX   $E8
         LDA   $E6
         PHA
         PEI   $D8
         PEI   $D6
         LDX   $DC
         LDA   $DA
         CLC
         ADC   #$0002
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         JSL   L0202AB
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $EA
         LDX   #$0000
         TAY
         BPL   L0B1B0A
         DEX
L0B1B0A  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDX   $D8
         LDA   $D6
         LDY   #$0002
         PHA
         TXA
         STA   [$F0],Y
         PLA
         STA   [$F0]
L0B1B34  BRL   L0B1A06
L0B1B37  STZ   $EE
         BRL   L0B1C89
L0B1B3C  LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B1B45
         DEX
L0B1B45  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         STA   $EA
         SEC
         SBC   #$0000
         BVS   L0B1B69
         EOR   #$8000
L0B1B69  BMI   L0B1BB7
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B1B74
         DEX
L0B1B74  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         EOR   #$FFFF
         PHA
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0B1B9A
         DEX
L0B1B9A  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         PLA
         STA   [$F0]
         BRL   L0B1C87
L0B1BB7  LDX   $D8
         LDA   $D6
         SEC
         SBC   #$0002
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STA   $F0
         STX   $F2
         LDA   $EA
         STA   [$F0]
         LDA   $EA
         LDX   #$0000
         TAY
         BPL   L0B1BD7
         DEX
L0B1BD7  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030174
         LDA   L030172
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   #$0002
         PLX
         STX   $F4
         CLC
         ADC   $F4
         LDX   #$0000
         STX   $E8
         STA   $E6
         LDX   $E8
         LDA   $E6
         AND   #$0001
         PHA
         TXA
         AND   #$0000
         TAX
         PLA
         STX   $F0
         ORA   $F0
         BEQ   L0B1C1D
         INC   $E6
         BNE   L0B1C1D
         INC   $E8
L0B1C1D  LDX   $D8
         LDA   $D6
         SEC
         SBC   $E6
         PHA
         TXA
         SBC   $E8
         TAX
         PLA
         STX   $D8
         STA   $D6
         LDA   $D0
         BNE   L0B1C47
         PEA   $0000
         PEA   $0000
         JSL   L0D0FA2
         PLY
         PLY
         JSL   L0B0A80
         LDA   #$0001
         STA   $D0
L0B1C47  PEI   $D8
         PEI   $D6
         PEI   $EA
         JSL   L0B074F
         PLY
         PLY
         PLY
         LDA   $EA
         LDX   #$0000
         TAY
         BPL   L0B1C5D
         DEX
L0B1C5D  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDX   $D8
         LDA   $D6
         LDY   #$0002
         PHA
         TXA
         STA   [$F0],Y
         PLA
         STA   [$F0]
L0B1C87  INC   $EE
L0B1C89  LDA   $EE
         SEC
         SBC   $FF
         BVS   L0B1C93
         EOR   #$8000
L0B1C93  BMI   L0B1C98
         BRL   L0B1B3C
L0B1C98  LDA   $D0
         BEQ   L0B1CA0
         JSL   L0B0AC6
L0B1CA0  LDX   $D8
         LDA   $D6
         STX   L0301AA
         STA   L0301A8
         LDA   L0301B8
         BEQ   L0B1CBB
         LDX   L0301AA
         LDA   L0301A8
         STX   L03018C
         STA   L03018A
L0B1CBB  PEA   ^L050036
         PEA   L050036
         JSL   L02176B
         PLY
         PLY
         TSC
         CLC
         ADC   #$0026
         TCS
         PLD
         RTL

L0B1CCF  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00EE
         TCS
         LDX   L030050
         LDA   L03004E
         STX   L0301D6
         STA   L0301D4
         STZ   L0301CE
         STZ   L0301D0
         LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDX   L0301CC
         LDA   L0301CA
         STX   $F4
         STA   $F2
         JSL   L022171
         BNE   L0B1D06
         BRA   L0B1D55
L0B1D06  LDY   #$0004
         LDA   [$F2],Y
         CMP   #$0000
         BEQ   L0B1D55
         LDA   #$0000
         LDY   #$0004
         STA   [$F2],Y
         LDY   #$0006
         LDA   [$F2],Y
         STA   $F0
         CMP   #$FFFF
         BNE   L0B1D26
         BRA   L0B1D55
L0B1D26  LDA   $F0
         LDX   #$0000
         STX   $FA
         ASL
         ROL   $FA
         ASL
         ROL   $FA
         LDX   $FA
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         TAX
         LDA   [$F6]
         STX   $F4
         STA   $F2
         BRA   L0B1D06
L0B1D55  TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PLD
         RTL

L0B1D5F  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E4
         TCS
         LDA   $FF
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $F2
         STA   $F0
         LDA   #$0001
         LDY   #$0004
         STA   [$F0],Y
         LDA   L0301CE
         CMP   #$0000
         BEQ   L0B1DAA
         BRL   L0B1E74
L0B1DAA  LDA   L0301D0
         CMP   #$0000
         BEQ   L0B1DB5
         BRL   L0B1E74
L0B1DB5  LDA   #$FFFF
         LDY   #$0008
         STA   [$F0],Y
         LDA   L0301CA
         CMP   #$0000
         BNE   L0B1DE2
         LDA   L0301CC
         CMP   #$0000
         BNE   L0B1DE2
         LDA   #$FFFF
         LDY   #$0006
         STA   [$F0],Y
         LDX   $F2
         LDA   $F0
         STX   L0301C8
         STA   L0301C6
         BRL   L0B1E67
L0B1DE2  LDX   L0301CC
         LDA   L0301CA
         STA   $F4
         STX   $F6
         LDA   $FF
         LDY   #$0008
         STA   [$F4],Y
         LDX   L0301CC
         LDA   L0301CA
         STA   $F4
         STX   $F6
         LDY   #$000A
         LDA   [$F4],Y
         STA   $E6
         LDA   $E6
         SEC
         SBC   #$0000
         BVS   L0B1E0F
         EOR   #$8000
L0B1E0F  BPL   L0B1E37
         LDA   $E6
         LDX   #$0000
         TAY
         BPL   L0B1E1A
         DEX
L0B1E1A  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L03017C
         LDA   L03017A
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BRA   L0B1E5E
L0B1E37  LDA   $E6
         AND   #$7FFF
         LDX   #$0000
         TAY
         BPL   L0B1E43
         DEX
L0B1E43  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
L0B1E5E  STA   $EA
         LDA   $EA
         LDY   #$0006
         STA   [$F0],Y
L0B1E67  LDX   $F2
         LDA   $F0
         STX   L0301CC
         STA   L0301CA
         BRL   L0B1F63
L0B1E74  LDX   L0301D0
         LDA   L0301CE
         STA   $F4
         STX   $F6
         LDY   #$0006
         LDA   [$F4],Y
         STA   $EA
         LDX   L0301D0
         LDA   L0301CE
         STA   $F4
         STX   $F6
         LDA   $FF
         LDY   #$0006
         STA   [$F4],Y
         LDA   $EA
         LDY   #$0006
         STA   [$F0],Y
         LDA   $EA
         CMP   #$FFFF
         BEQ   L0B1EE5
         LDA   $EA
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EE
         STA   $EC
         LDY   #$0008
         LDA   [$EC],Y
         LDY   #$0008
         STA   [$F0],Y
         LDA   $FF
         LDY   #$0008
         STA   [$EC],Y
         BRL   L0B1F63
L0B1EE5  LDX   L0301D0
         LDA   L0301CE
         STA   $F4
         STX   $F6
         LDY   #$000A
         LDA   [$F4],Y
         STA   $E6
         LDA   $E6
         SEC
         SBC   #$0000
         BVS   L0B1F01
         EOR   #$8000
L0B1F01  BPL   L0B1F29
         LDA   $E6
         LDX   #$0000
         TAY
         BPL   L0B1F0C
         DEX
L0B1F0C  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L03017C
         LDA   L03017A
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BRA   L0B1F50
L0B1F29  LDA   $E6
         AND   #$7FFF
         LDX   #$0000
         TAY
         BPL   L0B1F35
         DEX
L0B1F35  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
L0B1F50  STA   $E8
         LDA   $E8
         LDY   #$0008
         STA   [$F0],Y
         LDX   $F2
         LDA   $F0
         STX   L0301C8
         STA   L0301C6
L0B1F63  LDX   $F2
         LDA   $F0
         STX   L0301D0
         STA   L0301CE
         TSC
         CLC
         ADC   #$0014
         TCS
         PLD
         RTL

L0B1F75  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E0
         TCS
         LDA   $FF
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $F2
         STA   $F0
         STX   $E4
         STA   $E2
         LDY   #$0004
         LDA   [$F0],Y
         STA   $E6
         CMP   #$0000
         BEQ   L0B1FC0
         BRL   L0B207B
L0B1FC0  LDY   #$0008
         LDA   [$F0],Y
         STA   $E8
         CMP   #$FFFF
         BNE   L0B1FE5
         LDX   $F2
         LDA   $F0
         STX   L0301D0
         STA   L0301CE
         LDA   #$0001
         LDY   #$0004
         STA   [$F0],Y
         LDX   $F2
         LDA   $F0
         BRL   L0B21F4
L0B1FE5  LDA   $E8
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EE
         STA   $EC
         LDY   #$0006
         LDA   [$F0],Y
         STA   $EA
         CMP   #$FFFF
         BNE   L0B2032
         LDX   $EE
         LDA   $EC
         STX   L0301C8
         STA   L0301C6
         LDA   #$FFFF
         LDY   #$0006
         STA   [$EC],Y
         BRA   L0B206D
L0B2032  LDA   $EA
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $F2
         STA   $F0
         LDA   $E8
         LDY   #$0008
         STA   [$F0],Y
         LDA   $EA
         LDY   #$0006
         STA   [$EC],Y
L0B206D  PEI   $FF
         JSL   L0B1D5F
         PLY
         LDX   $E4
         LDA   $E2
         BRL   L0B21F4
L0B207B  LDA   $E6
         CLC
         ADC   #$0001
         STA   $E6
         LDY   #$0004
         STA   [$F0],Y
         LDA   $F0
         CMP   L0301CA
         BNE   L0B209D
         LDA   $F2
         CMP   L0301CC
         BNE   L0B209D
         LDX   $F2
         LDA   $F0
         BRL   L0B21F4
L0B209D  LDY   #$0008
         LDA   [$F0],Y
         STA   $E8
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EE
         STA   $EC
         LDY   #$0004
         LDA   [$EC],Y
         CMP   $E6
         BCC   L0B20DF
         LDX   $F2
         LDA   $F0
         BRL   L0B21F4
L0B20DF  LDY   #$0006
         LDA   [$F0],Y
         STA   $EA
         CMP   #$FFFF
         BNE   L0B2105
         LDX   $EE
         LDA   $EC
         STX   L0301D0
         STA   L0301CE
         STX   L0301C8
         STA   L0301C6
         LDA   #$FFFF
         LDY   #$0006
         STA   [$EC],Y
         BRA   L0B2158
L0B2105  LDA   L0301CE
         CMP   $F0
         BNE   L0B211D
         LDA   L0301D0
         CMP   $F2
         BNE   L0B211D
         LDX   $EE
         LDA   $EC
         STX   L0301D0
         STA   L0301CE
L0B211D  LDA   $EA
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $F2
         STA   $F0
         LDA   $E8
         LDY   #$0008
         STA   [$F0],Y
         LDA   $EA
         LDY   #$0006
         STA   [$EC],Y
L0B2158  LDX   $EE
         LDA   $EC
         STX   $F2
         STA   $F0
         LDA   $E8
         STA   $EA
         LDY   #$0008
         LDA   [$F0],Y
         STA   $E8
         CMP   #$FFFF
         BNE   L0B2194
         LDA   $FF
         LDY   #$0008
         STA   [$F0],Y
         LDA   $EA
         LDY   #$0006
         STA   [$E2],Y
         LDA   #$FFFF
         LDY   #$0008
         STA   [$E2],Y
         LDX   $E4
         LDA   $E2
         STX   L0301CC
         STA   L0301CA
         BRA   L0B21F4
         BRA   L0B21EC
L0B2194  LDA   $E8
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EE
         STA   $EC
         LDY   #$0004
         LDA   [$EC],Y
         CMP   $E6
         BCC   L0B21EC
         LDA   $FF
         LDY   #$0008
         STA   [$F0],Y
         LDA   $EA
         LDY   #$0006
         STA   [$E2],Y
         LDA   $E8
         LDY   #$0008
         STA   [$E2],Y
         LDA   $FF
         LDY   #$0006
         STA   [$EC],Y
         LDX   $E4
         LDA   $E2
         BRA   L0B21F4
L0B21EC  LDA   #$0001
         BEQ   L0B21F4
         BRL   L0B2158
L0B21F4  TAY
         TSC
         CLC
         ADC   #$0018
         TCS
         TYA
         PLD
         RTL

L0B21FE  ENT
         PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00EA
         TCS
         LDA   $FB
         LDX   #$0000
         TAY
         BPL   L0B2212
         DEX
L0B2212  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         STX   $EE
         STA   $EC
         PEA   $0000
         PEA   $0000
         PEI   $FF
         PEI   $FD
         PEI   $EE
         PEI   $EC
         JSL   L080000
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L0B225C  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E4
         TCS
         LDA   $FF
         AND   #$8000
         TAY
         BEQ   L0B22A6
         LDA   $FF
         AND   #$7FFF
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EC
         STA   $EA
         LDX   $EC
         LDA   $EA
         BRL   L0B243D
L0B22A6  LDX   L0301D6
         LDA   L0301D4
         PHX
         PHA
         LDX   L030050
         LDA   L03004E
         JSL   L022171
         BEQ   L0B22BE
         JSL   L0B1CCF
L0B22BE  LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B22C7
         DEX
L0B22C7  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L03017C
         LDA   L03017A
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $F2
         CMP   #$FFFF
         BEQ   L0B22FE
         PEI   $F2
         JSL   L0B1F75
         PLY
         CLC
         ADC   #$000C
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         BRL   L0B243D
L0B22FE  LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B2307
         DEX
L0B2307  STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030178
         LDA   L030176
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $EC
         STA   $EA
         LDY   #$0002
         LDA   [$EA],Y
         PHA
         LDA   #$0001
         PHA
         LDA   [$EA]
         SEC
         JSL   L0222DF
         PLA
         SEC
         JSL   L0220A5
         LDA   #$0010
         PLX
         STX   $F8
         CLC
         ADC   $F8
         LDX   #$0000
         TAY
         BPL   L0B2356
         DEX
L0B2356  STX   $E8
         STA   $E6
         PEI   $E8
         PEI   $E6
         JSL   L0B12DA
         PLY
         PLY
         STX   $F0
         STA   $EE
         STZ   $F2
L0B236A  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDA   $F2
         INC   $F2
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         JSL   L022171
         BEQ   L0B23A5
         BRA   L0B236A
L0B23A5  DEC   $F2
         LDA   $F2
         PHA
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B23B3
         DEX
L0B23B3  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L03017C
         LDA   L03017A
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDA   $F2
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F0
         LDA   $EE
         LDY   #$0002
         PHA
         TXA
         STA   [$F4],Y
         PLA
         STA   [$F4]
         LDA   $FF
         LDY   #$000A
         STA   [$EE],Y
         PEI   $F2
         JSL   L0B1D5F
         PLY
         LDX   $F0
         LDA   $EE
         CLC
         ADC   #$000C
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $F0
         STA   $EE
         PEA   $0000
         PEA   $0000
         PEI   $F0
         PEI   $EE
         PEI   $EC
         PEI   $EA
         JSL   L080000
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         LDX   $F0
         LDA   $EE
L0B243D  TAY
         TSC
         CLC
         ADC   #$0014
         TCS
         TYA
         PLD
         RTL

L0B2447  ENT
         PHD
         TSC
         SEC
         SBC   #$00F1
         TCD
         ADC   #$00E4
         TCS
         JSL   L0B0A80
         LDA   $F7
         AND   #$8000
         STA   $E6
         LDA   $F7
         AND   #$7FFF
         STA   $F7
         LDA   $E6
         BEQ   L0B246E
         LDX   $FB
         LDA   $F9
         BRA   L0B2474
L0B246E  LDX   L03002E
         LDA   L03002C
L0B2474  PHX
         PHA
         PEI   $F7
         JSL   L0B074F
         PLY
         PLY
         PLY
         LDA   $E6
         BNE   L0B24A5
         PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         LDX   L03002E
         LDA   L03002C
         PHX
         PHA
         JSL   L080000
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         LDA   #$0001
         STA   L03001A
L0B24A5  JSL   L0B0AC6
         TSC
         CLC
         ADC   #$000C
         TCS
         PLD
         RTL

L0B24B1  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E8
         TCS
         LDX   L0301D6
         LDA   L0301D4
         PHX
         PHA
         LDX   L030050
         LDA   L03004E
         JSL   L022171
         BEQ   L0B24D4
         JSL   L0B1CCF
L0B24D4  LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B24DD
         DEX
L0B24DD  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $F2
         CMP   #$FFFF
         BEQ   L0B250C
         PEI   $F2
         JSL   L0B1F75
         PLY
         LDA   #$0001
         BRL   L0B25F2
L0B250C  LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B2515
         DEX
L0B2515  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030184
         LDA   L030182
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDA   #$0010
         PLX
         STX   $F8
         CLC
         ADC   $F8
         LDX   #$0000
         STX   $EC
         STA   $EA
         PEI   $EC
         PEI   $EA
         JSL   L0B12DA
         PLY
         PLY
         STX   $F0
         STA   $EE
         STZ   $F2
L0B2551  LDX   #$0000
         LDA   #$0000
         PHX
         PHA
         LDA   $F2
         INC   $F2
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         JSL   L022171
         BEQ   L0B258C
         BRA   L0B2551
L0B258C  DEC   $F2
         LDA   $F2
         PHA
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B259A
         DEX
L0B259A  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDA   $F2
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F0
         LDA   $EE
         LDY   #$0002
         PHA
         TXA
         STA   [$F4],Y
         PLA
         STA   [$F4]
         LDA   $FF
         ORA   #$8000
         LDY   #$000A
         STA   [$EE],Y
         LDA   #$0000
L0B25F2  TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PLD
         RTL

L0B25FC  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B2610
         DEX
L0B2610  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         LDX   #$0000
         STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L0301BC
         LDA   L0301BA
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         CLC
         ADC   #$000C
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L0B2667  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B267B
         DEX
L0B267B  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030180
         LDA   L03017E
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         JSL   L0B1D5F
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0B26A4  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L0B26B8
         DEX
L0B26B8  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDX   L030174
         LDA   L030172
         JSL   L021F00
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L0B26DD  PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00E4
         TCS
         LDA   #L0545A8
         LDX   #^L0545A8
         STX   $E8
         STA   $E6
         LDA   L0301E6
         SEC
         SBC   #$0000
         BEQ   L0B2702
         BVS   L0B2700
         EOR   #$8000
L0B2700  BMI   L0B2726
L0B2702  LDA   L0301DA
         SEC
         SBC   L0301DC
         BVS   L0B270E
         EOR   #$8000
L0B270E  BMI   L0B2726
         LDA   L0301E4
         SEC
         SBC   L0301E2
         BNE   L0B271C
         BRL   L0B282C
L0B271C  BVS   L0B2721
         EOR   #$8000
L0B2721  BMI   L0B2726
         BRL   L0B282C
L0B2726  LDA   L0301E4
         SEC
         SBC   L0301E2
         BEQ   L0B275D
         BVS   L0B2734
         EOR   #$8000
L0B2734  BPL   L0B275D
         INC   L0301E0
         LDA   L0301E0
         CMP   #$000C
         BNE   L0B2749
         LDA   L0301D8
         STA   L0301E2
         BRA   L0B275D
L0B2749  LDA   L0301E0
         PHA
         LDA   #$0001
         SEC
         JSL   L0222A8
         PLA
         SEC
         SBC   #$0001
         STA   L0301E2
L0B275D  LDA   L0301E6
         SEC
         SBC   #$0000
         BEQ   L0B2787
         BVS   L0B276B
         EOR   #$8000
L0B276B  BPL   L0B2787
         LDA   #$0009
         STA   L0301E0
         PHA
         LDA   #$0001
         SEC
         JSL   L0222A8
         PLA
         SEC
         SBC   #$0001
         STA   L0301E2
         STZ   L0301E6
L0B2787  LDA   L0301E0
         LDX   #$0000
         TAY
         BPL   L0B2791
         DEX
L0B2791  PHX
         PHA
         LDY   #$0002
         LDA   [$FD],Y
         TAX
         LDA   [$FD]
         JSL   L022171
         BVS   L0B27A4
         EOR   #$8000
L0B27A4  BMI   L0B27AE
         LDA   L0301E0
         STA   L0301DC
         BRA   L0B27B9
L0B27AE  LDY   #$0002
         LDA   [$FD],Y
         TAX
         LDA   [$FD]
         STA   L0301DC
L0B27B9  LDA   L0301DC
         SEC
         SBC   #$0000
         BEQ   L0B280C
         BVS   L0B27C7
         EOR   #$8000
L0B27C7  BPL   L0B280C
         PEA   ^L0545A8
         PEA   L0545A8
         LDA   L0301DC
         LDX   #$0000
         TAY
         BPL   L0B27D9
         DEX
L0B27D9  PHX
         PHA
         PEI   $FB
         JSL   L081ACB
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   L0301DC
         LDX   #$0000
         TAY
         BPL   L0B27F0
         DEX
L0B27F0  PHX
         PHA
         LDY   #$0002
         LDA   [$FD],Y
         TAX
         LDA   [$FD]
         JSL   L02209A
         PLA
         PLX
         LDY   #$0002
         PHA
         TXA
         STA   [$FD],Y
         PLA
         STA   [$FD]
         BRA   L0B2812
L0B280C  LDA   #$FFFF
         BRL   L0B291C
L0B2812  STZ   L0301DA
         LDA   L0301E0
         SEC
         SBC   #$0001
         PHA
         LDA   L0301DC
         ASL
         ASL
         ASL
         PLX
         STX   $F4
         SEC
         SBC   $F4
         STA   L0301DC
L0B282C  LDA   L0301DA
         STA   $EC
         LDA   L0301E0
         STA   $EA
         LDA   #$0003
         PHA
         LDA   $EC
         SEC
         JSL   L0222DF
         PLA
         LDX   #$0000
         TAY
         BPL   L0B2849
         DEX
L0B2849  PHX
         PHA
         LDX   $E8
         LDA   $E6
         JSL   L021F00
         PLA
         PLX
         STX   $E8
         STA   $E6
         LDA   $EC
         AND   #$0007
         STA   $EC
         LDA   $EC
         PHA
         LDX   $E8
         LDA   $E6
         INC   $E6
         BNE   L0B286D
         INC   $E8
L0B286D  STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$00FF
         SEC
         JSL   L0222DF
         PLA
         STA   $EE
         LDA   #$0008
         SEC
         SBC   $EC
         PHA
         LDA   $EA
         PLX
         STX   $F4
         SEC
         SBC   $F4
         STA   $EA
         LDA   #$0008
         SEC
         SBC   $EC
         STA   $EC
         LDA   $EA
         SEC
         SBC   #$0008
         BVS   L0B28A2
         EOR   #$8000
L0B28A2  BPL   L0B28D8
         LDA   $EC
         PHA
         LDX   $E8
         LDA   $E6
         INC   $E6
         BNE   L0B28B1
         INC   $E8
L0B28B1  STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$00FF
         SEC
         JSL   L0222A8
         LDA   $EE
         PLX
         STX   $F4
         ORA   $F4
         STA   $EE
         LDA   $EC
         CLC
         ADC   #$0008
         STA   $EC
         LDA   $EA
         SEC
         SBC   #$0008
         STA   $EA
L0B28D8  LDA   $EC
         PHA
         LDA   $EA
         LDX   #$0000
         PHX
         PHA
         LDA   #L05459F
         LDX   #^L05459F
         JSL   L021F00
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$00FF
         PHA
         LDA   [$E6]
         AND   #$00FF
         PLX
         STX   $F4
         AND   $F4
         SEC
         JSL   L0222A8
         LDA   $EE
         PLX
         STX   $F4
         ORA   $F4
         STA   $EE
         LDA   L0301DA
         CLC
         ADC   L0301E0
         STA   L0301DA
         LDA   $EE
L0B291C  TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PLD
         RTL

L0B2926  PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00EA
         TCS
         LDY   #$0002
         LDA   [$FD],Y
         TAX
         LDA   [$FD]
         STX   $EE
         STA   $EC
         LDA   L0301DE
         BRL   L0B29EB
L0B2943  LDA   $FB
         AND   #$00FF
         CMP   #$0090
         BNE   L0B2955
         LDA   #$0001
         STA   L0301DE
         BRA   L0B2973
L0B2955  LDA   $FB
         AND   #$00FF
         STA   L0301E8
         PHA
         LDX   $EE
         LDA   $EC
         INC   $EC
         BNE   L0B2968
         INC   $EE
L0B2968  STA   $F0
         STX   $F2
         PLA
         SEP   #$20
         STA   [$F0]
         REP   #$20
L0B2973  LDX   $EE
         LDA   $EC
         LDY   #$0002
         PHA
         TXA
         STA   [$FD],Y
         PLA
         STA   [$FD]
         BRL   L0B29F8
L0B2984  LDA   $FB
         AND   #$00FF
         BEQ   L0B29B5
L0B298B  SEP   #$20
         DEC   $FB
         REP   #$20
         LDA   $FB
         AND   #$00FF
         BEQ   L0B29B3
         LDA   L0301E8
         PHA
         LDX   $EE
         LDA   $EC
         INC   $EC
         BNE   L0B29A6
         INC   $EE
L0B29A6  STA   $F0
         STX   $F2
         PLA
         SEP   #$20
         STA   [$F0]
         REP   #$20
         BRA   L0B298B
L0B29B3  BRA   L0B29CC
L0B29B5  LDX   $EE
         LDA   $EC
         INC   $EC
         BNE   L0B29BF
         INC   $EE
L0B29BF  STA   $F0
         STX   $F2
         LDA   #$0090
         SEP   #$20
         STA   [$F0]
         REP   #$20
L0B29CC  STZ   L0301DE
         LDX   $EE
         LDA   $EC
         LDY   #$0002
         PHA
         TXA
         STA   [$FD],Y
         PLA
         STA   [$FD]
         BRL   L0B29F8
L0B29E0  BRA   L0B29E0
         BRL   L0B29F8
L0B29E5  DA    L0B2943
         DA    L0B2984
         DA    L0B29E0
L0B29EB  CMP   #$0002
         BCC   L0B29F3
         LDA   #$0002
L0B29F3  ASL
         TAX
         JMP   (L0B29E5,X)

L0B29F8  TAY
         TSC
         CLC
         ADC   #$000A
         TCS
         TYA
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00E9
         TCD
         ADC   #$00C6
         TCS
         LDX   $FB
         LDA   $F9
         STX   $DA
         STA   $D8
         LDX   $FB
         LDA   $F9
         CLC
         ADC   #$2716
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $D6
         STA   $D4
         LDX   $FF
         LDA   $FD
         STX   $DE
         STA   $DC
         STX   $E2
         STA   $E0
         LDX   $F7
         LDA   $F5
         STX   $CA
         STA   $C8
         STZ   L0301DE
         LDA   #$000C
         STA   $D0
         LDA   #$0009
         STA   L0301E0
         STZ   L0301E6
         LDA   #$0009
         STA   L0301E0
         PHA
         LDA   #$0001
         SEC
         JSL   L0222A8
         PLA
         SEC
         SBC   #$0001
         STA   L0301E2
         LDA   #$00FF
         STA   $D0
         BRA   L0B2AB5
L0B2A6B  LDA   $D0
         LDX   #$0000
         TAY
         BPL   L0B2A74
         DEX
L0B2A74  STX   $E8
         ASL
         ROL   $E8
         LDX   $E8
         PHX
         PHA
         LDX   $DA
         LDA   $D8
         JSL   L021F00
         PLA
         PLX
         STA   $E4
         STX   $E6
         LDA   #$0000
         STA   [$E4]
         LDA   $D0
         PHA
         LDA   $D0
         LDX   #$0000
         TAY
         BPL   L0B2A9C
         DEX
L0B2A9C  PHX
         PHA
         LDX   $D6
         LDA   $D4
         JSL   L021F00
         PLA
         PLX
         STA   $E4
         STX   $E6
         PLA
         SEP   #$20
         STA   [$E4]
         REP   #$20
         DEC   $D0
L0B2AB5  LDA   $D0
         SEC
         SBC   #$0000
         BVS   L0B2AC0
         EOR   #$8000
L0B2AC0  BMI   L0B2A6B
         LDA   #$0101
         STA   L0301E4
         PEA   $0000
         TDC
         CLC
         ADC   #$00F1
         PHA
         PEI   $EF
         JSL   L0B26DD
         PLY
         PLY
         PLY
         STA   $CE
         STA   $D2
         LDA   $CE
         CMP   #$FFFF
         BNE   L0B2AEE
         LDX   #$FFFF
         LDA   #$FFFF
         BRL   L0B2CE7
L0B2AEE  PEA   $0000
         TDC
         CLC
         ADC   #$00F5
         PHA
         LDA   $D2
         AND   #$00FF
         PHA
         JSL   L0B2926
         PLY
         PLY
         PLY
L0B2B04  PEA   $0000
         TDC
         CLC
         ADC   #$00F1
         PHA
         PEI   $EF
         JSL   L0B26DD
         PLY
         PLY
         PLY
         STA   $D0
         SEC
         SBC   #$FFFF
         BNE   L0B2B21
         BRL   L0B2CDA
L0B2B21  BVS   L0B2B26
         EOR   #$8000
L0B2B26  BMI   L0B2B2B
         BRL   L0B2CDA
L0B2B2B  LDA   $D0
         CMP   #$0100
         BNE   L0B2B68
         PEA   $0200
         PEI   $DA
         PEI   $D8
         JSL   L020232
         PLY
         PLY
         PLY
         LDA   #$0001
         STA   L0301E6
         LDA   #$0100
         STA   L0301E4
         PEA   $0000
         TDC
         CLC
         ADC   #$00F1
         PHA
         PEI   $EF
         JSL   L0B26DD
         PLY
         PLY
         PLY
         STA   $D0
         CMP   #$FFFF
         BNE   L0B2B68
         BRL   L0B2CDA
L0B2B68  LDA   $D0
         STA   $CC
         LDA   $D0
         SEC
         SBC   L0301E4
         BVS   L0B2B77
         EOR   #$8000
L0B2B77  BPL   L0B2B95
         LDA   $D2
         PHA
         LDX   $E2
         LDA   $E0
         INC   $E0
         BNE   L0B2B86
         INC   $E2
L0B2B86  STA   $E4
         STX   $E6
         PLA
         SEP   #$20
         STA   [$E4]
         REP   #$20
         LDA   $CE
         STA   $D0
L0B2B95  LDA   $D0
         SEC
         SBC   #$0100
         BVS   L0B2BA0
         EOR   #$8000
L0B2BA0  BPL   L0B2BF9
         LDA   $D0
         LDX   #$0000
         TAY
         BPL   L0B2BAB
         DEX
L0B2BAB  PHX
         PHA
         LDX   $D6
         LDA   $D4
         JSL   L021F00
         PLA
         PLX
         STA   $E4
         STX   $E6
         LDA   [$E4]
         PHA
         LDX   $E2
         LDA   $E0
         INC   $E0
         BNE   L0B2BC8
         INC   $E2
L0B2BC8  STA   $E4
         STX   $E6
         PLA
         SEP   #$20
         STA   [$E4]
         REP   #$20
         LDA   $D0
         LDX   #$0000
         TAY
         BPL   L0B2BDC
         DEX
L0B2BDC  STX   $E8
         ASL
         ROL   $E8
         LDX   $E8
         PHX
         PHA
         LDX   $DA
         LDA   $D8
         JSL   L021F00
         PLA
         PLX
         STA   $E4
         STX   $E6
         LDA   [$E4]
         STA   $D0
         BRA   L0B2B95
L0B2BF9  LDA   $D0
         LDX   #$0000
         TAY
         BPL   L0B2C02
         DEX
L0B2C02  PHX
         PHA
         LDX   $D6
         LDA   $D4
         JSL   L021F00
         PLA
         PLX
         STA   $E4
         STX   $E6
         LDA   [$E4]
         AND   #$00FF
         STA   $D2
         PHA
         LDX   $E2
         LDA   $E0
         INC   $E0
         BNE   L0B2C24
         INC   $E2
L0B2C24  STA   $E4
         STX   $E6
         PLA
         SEP   #$20
         STA   [$E4]
         REP   #$20
L0B2C2F  PEA   $0000
         TDC
         CLC
         ADC   #$00F5
         PHA
         LDA   $E0
         BNE   L0B2C3E
         DEC   $E2
L0B2C3E  DEC   $E0
         LDX   $E2
         LDA   $E0
         STA   $E4
         STX   $E6
         LDA   [$E4]
         AND   #$00FF
         PHA
         JSL   L0B2926
         PLY
         PLY
         PLY
         SEC
         LDA   $E0
         SBC   $DC
         BNE   L0B2C62
         LDA   $E2
         SBC   $DE
         BRA   L0B2C68
L0B2C62  LDA   $E2
         SBC   $DE
         REP   #$02
L0B2C68  BEQ   L0B2C71
         BVS   L0B2C6F
         EOR   #$8000
L0B2C6F  BMI   L0B2C2F
L0B2C71  LDA   L0301E4
         STA   $D0
         SEC
         SBC   L0301D8
         BVS   L0B2C7F
         EOR   #$8000
L0B2C7F  BMI   L0B2CD3
         LDA   $CE
         PHA
         LDA   $D0
         LDX   #$0000
         TAY
         BPL   L0B2C8D
         DEX
L0B2C8D  STX   $E8
         ASL
         ROL   $E8
         LDX   $E8
         PHX
         PHA
         LDX   $DA
         LDA   $D8
         JSL   L021F00
         PLA
         PLX
         STA   $E4
         STX   $E6
         PLA
         STA   [$E4]
         LDA   $D2
         PHA
         LDA   $D0
         LDX   #$0000
         TAY
         BPL   L0B2CB3
         DEX
L0B2CB3  PHX
         PHA
         LDX   $D6
         LDA   $D4
         JSL   L021F00
         PLA
         PLX
         STA   $E4
         STX   $E6
         PLA
         SEP   #$20
         STA   [$E4]
         REP   #$20
         LDA   $D0
         CLC
         ADC   #$0001
         STA   L0301E4
L0B2CD3  LDA   $CC
         STA   $CE
         BRL   L0B2B04
L0B2CDA  LDX   $F7
         LDA   $F5
         SEC
         SBC   $C8
         PHA
         TXA
         SBC   $CA
         TAX
         PLA
L0B2CE7  TAY
         TSC
         CLC
         ADC   #$0022
         TCS
         TYA
         PLD
         RTL

