*
* Hostage
*
* (c) 1990, Infogrames / Mindscape
* (s) 2020, Antoine Vignau
*

*-----------------------
		
	 mx	%00
	 rel
	 lst	off

	 use	STRAT.X.S
	 
*-----------------------

	use	4/Event.Macs
	use	4/Locator.Macs
	use	4/Mem.Macs
	use	4/Misc.Macs
	use	4/QD.Macs
	use	4/Sound.Macs
	use	4/Util.Macs
	
*-----------------------

L140000  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F0
         TCS
         LDA   $FF
         SEC
         SBC   #$0000
         BEQ   L140027
         BVS   L140018
         EOR   #$8000
L140018  BPL   L140027
         LDA   $FF
         SEC
         SBC   #$0006
         BVS   L140025
         EOR   #$8000
L140025  BPL   L14002C
L140027  LDA   #$0000
         BRA   L14002F
L14002C  LDA   #$0001
L14002F  SEP   #$20
         STA   $F2
         REP   #$20
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BEQ   L140097
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$0003
         BVS   L14007B
         EOR   #$8000
L14007B  BPL   L140097
         LDA   $F2
         AND   #$00FF
         BEQ   L14008F
         PEA   $00FA
         PEI   $FF
         JSL   L0D1030
         PLY
         PLY
L14008F  SEP   #$20
         STZ   $F3
         REP   #$20
         BRA   L1400A0
L140097  LDA   #$0001
         SEP   #$20
         STA   $F3
         REP   #$20
L1400A0  LDA   $F3
         TAY
         TSC
         CLC
         ADC   #$0008
         TCS
         TYA
         PLD
         RTL

L1400AC  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EF
         TCS
         PEI   $FF
         JSL   L140000
         PLY
         SEP   #$20
         STA   $F1
         REP   #$20
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         STZ   $F2
         BRL   L140343
L1400E1  LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0001
         LDA   [$F4],Y
         BNE   L14010C
         BRL   L140341
L14010C  LDA   $F2
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BNE   L140130
         BRL   L140341
L140130  LDX   L020068
         LDA   L020066
         PHX
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0003
         LDA   [$F4],Y
         CLC
         ADC   #$0008
         PHA
         LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0001
         LDA   [$F4],Y
         PHA
         LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0005
         LDA   [$F4],Y
         AND   #$00FF
         PHA
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDA   $F2
         SEC
         SBC   #$0003
         BVS   L1401D3
         EOR   #$8000
L1401D3  BPL   L1401D8
         BRL   L140341
L1401D8  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L1401E1
         DEX
L1401E1  STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L031688
         LDX   #^L031688
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         PHX
         PHA
         PEA   ^L033269
         PEA   L033269
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDA   $F2
         SEC
         SBC   #$0001
         PHA
         LDA   #$0009
         SEC
         JSL   L01059C
         LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0003
         LDA   [$F4],Y
         PLX
         STX   $F8
         CLC
         ADC   $F8
         PHA
         LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0001
         LDA   [$F4],Y
         CLC
         ADC   #$000A
         PHA
         JSL   L130403
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         LDA   $F2
         CMP   $FF
         BEQ   L140291
         BRL   L140341
L140291  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L14029A
         DEX
L14029A  STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L031688
         LDX   #^L031688
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         PHX
         PHA
         PEA   ^L033271
         PEA   L033271
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDA   $F2
         SEC
         SBC   #$0001
         PHA
         LDA   #$0009
         SEC
         JSL   L01059C
         LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0003
         LDA   [$F4],Y
         PLX
         STX   $F8
         CLC
         ADC   $F8
         PHA
         LDA   $F2
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0001
         LDA   [$F4],Y
         CLC
         ADC   #$000A
         PHA
         JSL   L130403
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
L140341  INC   $F2
L140343  LDA   $F2
         SEC
         SBC   #$0006
         BVS   L14034E
         EOR   #$8000
L14034E  BMI   L140353
         BRL   L1400E1
L140353  LDA   $FF
         SEC
         SBC   #$0000
         BVS   L14035E
         EOR   #$8000
L14035E  BMI   L140363
         BRL   L140401
L140363  LDA   $FF
         LDX   #$0000
         TAY
         BPL   L14036C
         DEX
L14036C  STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03165E
         LDX   #^L03165E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         PHX
         PHA
         PEA   ^L033279
         PEA   L033279
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $000C
         PEA   $0011
         JSL   L130403
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L1403BB
         DEX
L1403BB  STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03165E
         LDX   #^L03165E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         PHX
         PHA
         PEA   ^L033281
         PEA   L033281
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $000D
         PEA   $0010
         JSL   L130403
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
L140401  PEA   $0000
         JSL   L0C0000
         PLY
         STZ   $F2
         BRL   L1404EA
L14040E  LDA   $F2
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         BNE   L140432
         BRL   L1404E8
L140432  LDA   L02011B
         BNE   L14043A
         BRL   L1404E8
L14043A  LDA   $F2
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BNE   L14045E
         BRL   L1404E8
L14045E  PEA   $0000
         LDA   $F2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         CLC
         ADC   #$0006
         PHA
         LDA   $F2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CLC
         ADC   #$003C
         PHA
         LDA   $F2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDA   $F2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         JSL   L1503A9
         PLY
         PLY
         PLY
         PLY
         PLY
L1404E8  INC   $F2
L1404EA  LDA   $F2
         SEC
         SBC   #$0006
         BVS   L1404F5
         EOR   #$8000
L1404F5  BMI   L1404FA
         BRL   L14040E
L1404FA  LDA   $F1
         AND   #$00FF
         BEQ   L140519
         PEA   $0000
         PEA   $0071
         PEA   $013A
         PEA   $0031
         PEA   $00F8
         JSL   L1503A9
         PLY
         PLY
         PLY
         PLY
         PLY
L140519  LDA   L02011B
         EOR   #$0001
         STA   L02011B
         JSL   L070062
         TSC
         CLC
         ADC   #$0009
         TCS
         PLD
         RTL

L14052E  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00EE
         TCS
         STZ   $F0
         BRL   L140687
L14053E  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         BNE   L140562
         BRL   L14065C
L140562  LDA   $F0
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03080A
         LDX   #^L03080A
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331C9
         LDX   #^L0331C9
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0001
         STA   [$F6],Y
         LDA   $F0
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03080A
         LDX   #^L03080A
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331C9
         LDX   #^L0331C9
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0003
         STA   [$F6],Y
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0001
         SEP   #$20
         LDY   #$0005
         STA   [$F6],Y
         REP   #$20
         BRA   L140685
L14065C  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         LDY   #$0001
         STA   [$F6],Y
L140685  INC   $F0
L140687  LDA   $F0
         SEC
         SBC   #$0003
         BVS   L140692
         EOR   #$8000
L140692  BMI   L140697
         BRL   L14053E
L140697  LDA   #$0003
         STA   $F0
         BRL   L140BEE
L14069F  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         LDY   #$0001
         STA   [$F6],Y
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         SEP   #$20
         LDY   #$0006
         STA   [$F6],Y
         REP   #$20
         LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         BNE   L140719
         BRL   L140852
L140719  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         CMP   #$0002
         BEQ   L14073D
         BRL   L140852
L14073D  LDA   $F0
         SEC
         SBC   #$0003
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331D5
         LDX   #^L0331D5
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0001
         STA   [$F6],Y
         LDA   $F0
         SEC
         SBC   #$0003
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331D5
         LDX   #^L0331D5
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0003
         STA   [$F6],Y
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0001
         SEP   #$20
         LDY   #$0006
         STA   [$F6],Y
         REP   #$20
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0001
         SEP   #$20
         LDY   #$0005
         STA   [$F6],Y
         REP   #$20
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0012
         SEP   #$20
         STA   [$F6]
         REP   #$20
L140852  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         BNE   L140876
         BRL   L140931
L140876  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         SEC
         SBC   #$0003
         BVS   L14089B
         EOR   #$8000
L14089B  BMI   L1408A0
         BRL   L140931
L1408A0  LDA   $F0
         SEC
         SBC   #$0003
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331D5
         LDX   #^L0331D5
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0001
         STA   [$F6],Y
         LDA   $F0
         SEC
         SBC   #$0003
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331D5
         LDX   #^L0331D5
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0003
         STA   [$F6],Y
L140931  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         BNE   L140955
         BRL   L140BEC
L140955  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         CMP   #$0001
         BEQ   L140979
         BRL   L140BEC
L140979  LDA   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03081C
         LDX   #^L03081C
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         STA   $F2
         LDA   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03081C
         LDX   #^L03081C
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         BRL   L1409E8
L1409CF  STZ   $F4
         BRL   L1409FA
L1409D4  LDA   #$0001
         STA   $F4
         BRL   L1409FA
L1409DC  LDA   #$0002
         STA   $F4
         BRL   L1409FA
L1409E4  BRA   L1409FA
         BRA   L1409FA
L1409E8  CMP   #$0009
         BEQ   L1409CF
         CMP   #$001C
         BEQ   L1409D4
         CMP   #$002F
         BEQ   L1409DC
         JMP   L1409E4

L1409FA  LDA   $F4
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F2
         PHA
         LDA   #$000C
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331E1
         LDX   #^L0331E1
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         CLC
         ADC   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0001
         STA   [$F6],Y
         LDA   $F4
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F2
         PHA
         LDA   #$000C
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331E1
         LDX   #^L0331E1
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         CLC
         ADC   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         LDY   #$0003
         STA   [$F6],Y
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0001
         SEP   #$20
         LDY   #$0005
         STA   [$F6],Y
         REP   #$20
         LDA   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03081C
         LDX   #^L03081C
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0004
         LDA   [$F6],Y
         SEC
         SBC   #$0005
         BEQ   L140B26
         BVS   L140B21
         EOR   #$8000
L140B21  BPL   L140B26
         BRL   L140B95
L140B26  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0001
         SEP   #$20
         LDY   #$0006
         STA   [$F6],Y
         REP   #$20
         LDA   $F2
         PHA
         LDA   #$0003
         SEC
         JSL   L01059C
         PLA
         CLC
         ADC   $F4
         PHA
         LDA   #$0002
         SEC
         JSL   L01059C
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         SEP   #$20
         STA   [$F6]
         REP   #$20
         BRA   L140BEC
L140B95  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         SEP   #$20
         LDY   #$0006
         STA   [$F6],Y
         REP   #$20
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0012
         SEP   #$20
         STA   [$F6]
         REP   #$20
L140BEC  INC   $F0
L140BEE  LDA   $F0
         SEC
         SBC   #$0006
         BVS   L140BF9
         EOR   #$8000
L140BF9  BMI   L140BFE
         BRL   L14069F
L140BFE  PEA   $FFFF
         PEA   $FFFF
         PEA   $FFFF
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L150000
         PLY
         PLY
         PLY
         PLY
         PLY
         STZ   $F0
         BRL   L140CD0
L140C1D  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         CMP   #$0000
         BEQ   L140C44
         BRL   L140CCE
L140C44  PEA   $0000
         LDA   $F0
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         CLC
         ADC   #$0006
         PHA
         LDA   $F0
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         CLC
         ADC   #$0040
         PHA
         LDA   $F0
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         PHA
         LDA   $F0
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         PHA
         JSL   L1503A9
         PLY
         PLY
         PLY
         PLY
         PLY
L140CCE  INC   $F0
L140CD0  LDA   $F0
         SEC
         SBC   #$0006
         BVS   L140CDB
         EOR   #$8000
L140CDB  BMI   L140CE0
         BRL   L140C1D
L140CE0  PEA   $FFFF
         PEA   $FFFF
         PEA   $FFFF
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         JSL   L150000
         PLY
         PLY
         PLY
         PLY
         PLY
         PEA   $FFFF
         JSL   L1400AC
         PLY
         TSC
         CLC
         ADC   #$000C
         TCS
         PLD
         RTL

L140D0A  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F0
         TCS
         STZ   $F2
         BRA   L140D1B
L140D19  INC   $F2
L140D1B  LDA   $F2
         SEC
         SBC   $FF
         BVS   L140D25
         EOR   #$8000
L140D25  BPL   L140D19
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L140D2F  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E6
         TCS
         STZ   $F2
         LDA   $FF
         STA   $F0
         LDA   $F0
         STA   $EC
         LDA   $F0
         SEC
         SBC   #$0000
         BVS   L140D4F
         EOR   #$8000
L140D4F  BMI   L140D54
         BRL   L1411AC
L140D54  LDA   $F0
         SEC
         SBC   #$0006
         BVS   L140D5F
         EOR   #$8000
L140D5F  BPL   L140D64
         BRL   L1411AC
L140D64  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0001
         LDA   [$F4],Y
         BNE   L140D8F
         BRL   L1411AC
L140D8F  STZ   $E8
         BRA   L140DC2
L140D93  LDA   $E8
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0001
         SEP   #$20
         LDY   #$0005
         STA   [$F4],Y
         REP   #$20
         INC   $E8
L140DC2  LDA   $E8
         SEC
         SBC   #$0006
         BVS   L140DCD
         EOR   #$8000
L140DCD  BPL   L140D93
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0002
         SEP   #$20
         LDY   #$0005
         STA   [$F4],Y
         REP   #$20
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         STA   $EA
         LDA   $F0
         SEC
         SBC   #$0003
         BVS   L140E2F
         EOR   #$8000
L140E2F  BMI   L140E34
         BRL   L140F16
L140E34  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0006
         LDA   [$F4],Y
         AND   #$00FF
         BNE   L140E62
         BRL   L140F16
L140E62  LDA   $F0
         SEC
         SBC   #$0003
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331D5
         LDX   #^L0331D5
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDAL  L033261
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDAL  L03325F
         PHA
         LDA   #$000C
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331E1
         LDX   #^L0331E1
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDA   $F0
         SEC
         SBC   #$0003
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331D5
         LDX   #^L0331D5
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDAL  L033261
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDAL  L03325F
         PHA
         LDA   #$000C
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331E1
         LDX   #^L0331E1
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0002
         STA   [$F4],Y
L140F16  LDA   $F0
         SEC
         SBC   #$0003
         BVS   L140F21
         EOR   #$8000
L140F21  BMI   L140F26
         BRL   L141111
L140F26  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0006
         LDA   [$F4],Y
         AND   #$00FF
         BNE   L140F54
         BRL   L141111
L140F54  JSL   L160143
         PHA
         JSL   L1508E5
         PLY
         SEC
         SBC   #$00C9
         STA   $EC
         JSL   L150027
         AND   #$0080
         STA   $EE
         TAY
         BNE   L140F73
         BRL   L14110F
L140F73  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0001
         LDA   [$F4],Y
         BNE   L140F9E
         BRL   L14110F
L140F9E  LDA   $EA
         SEC
         SBC   #$0012
         BVS   L140FA9
         EOR   #$8000
L140FA9  BMI   L140FB5
         LDA   $EA
         CLC
         ADC   #$0002
         STA   $EA
         BRA   L140FB7
L140FB5  STZ   $EA
L140FB7  LDA   $EA
         CLC
         ADC   #$0001
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03323B
         LDX   #^L03323B
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03323B
         LDX   #^L03323B
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDA   #$000C
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331E1
         LDX   #^L0331E1
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CLC
         ADC   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0001
         STA   [$F4],Y
         LDA   $EA
         CLC
         ADC   #$0001
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03323B
         LDX   #^L03323B
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03323B
         LDX   #^L03323B
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDA   #$000C
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0331E1
         LDX   #^L0331E1
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         CLC
         ADC   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0003
         STA   [$F4],Y
         LDA   $EA
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         SEP   #$20
         STA   [$F4]
         REP   #$20
L14110F  BRA   L14112A
L141111  JSL   L160143
         PHA
         JSL   L1508E5
         PLY
         SEC
         SBC   #$00C9
         STA   $EC
         JSL   L150027
         AND   #$0080
         STA   $EE
L14112A  PEA   $2710
         JSL   L140D0A
         PLY
         PEI   $F0
         JSL   L1400AC
         PLY
         LDA   $EC
         SEC
         SBC   #$0000
         BVS   L141144
         EOR   #$8000
L141144  BPL   L14115A
         LDA   $EC
         SEC
         SBC   #$0005
         BEQ   L141155
         BVS   L141153
         EOR   #$8000
L141153  BMI   L14115A
L141155  LDA   #$0000
         BRA   L14115D
L14115A  LDA   #$0001
L14115D  STA   $F2
         TAY
         BEQ   L14117D
         LDA   $EC
         CMP   #$FF52
         BNE   L14116E
         LDA   #$0000
         BRA   L141171
L14116E  LDA   #$0001
L141171  STA   $F2
         TAY
         BEQ   L14117B
         LDA   $F0
         STA   L02011D
L14117B  BRA   L1411A3
L14117D  LDA   $EC
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BEQ   L1411A3
         LDA   $EC
         STA   L02011D
L1411A3  LDA   $F2
         BEQ   L1411AA
         BRL   L140F16
L1411AA  BRA   L1411B1
L1411AC  LDA   L02011D
         STA   $EC
L1411B1  LDA   $F0
         SEC
         SBC   #$0003
         BVS   L1411BC
         EOR   #$8000
L1411BC  BMI   L1411C1
         BRL   L1413E5
L1411C1  LDA   $F0
         SEC
         SBC   #$0006
         BVS   L1411CC
         EOR   #$8000
L1411CC  BPL   L1411D1
         BRL   L1413E5
L1411D1  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0006
         LDA   [$F4],Y
         AND   #$00FF
         BNE   L1411FF
         BRL   L1413E5
L1411FF  LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         CMP   #$0012
         BNE   L14122D
         BRL   L1413C6
L14122D  LDA   #$0006
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         SEC
         JSL   L01041B
         PLY
         PHA
         LDA   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03081C
         LDX   #^L03081C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0001
         STA   [$F4]
         LDA   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03081C
         LDX   #^L03081C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0004
         LDY   #$0004
         STA   [$F4],Y
         LDA   #$0001
         PHA
         LDA   #$0006
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         SEC
         JSL   L01041B
         PLA
         SEC
         JSL   L01076A
         PLA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L033263
         LDX   #^L033263
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDA   $F0
         SEC
         SBC   #$0003
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03081C
         LDX   #^L03081C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0002
         STA   [$F4],Y
         PEA   $0003
         LDA   #$0001
         PHA
         LDA   #$0006
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         SEC
         JSL   L01041B
         PLA
         SEC
         JSL   L01076A
         LDA   #$0006
         PHA
         LDA   $F0
         PHA
         LDA   #$0007
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L033211
         LDX   #^L033211
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         SEC
         JSL   L01041B
         PLY
         PHA
         JSL   L0F0E17
         PLY
         PLY
         PLY
         BRA   L1413E5
L1413C6  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0002
         STA   [$F4]
L1413E5  LDA   $EC
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         PLD
         RTL

L1413F1  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EA
         TCS
         PEA   $00C7
         PEA   $0000
         JSL   L1507AF
         PLY
         PLY
         PEA   $0001
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L020064
         LDA   L020062
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         STZ   L0200D9
         PEA   $0002
         JSL   L0F102A
         PLY
         JSL   L0F0F81
         JSL   L070062
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         LDA   $FF
         STA   $F2
         JSL   L14052E
L14146F  PEI   $F2
         JSL   L140D2F
         PLY
         STA   $F2
         LDA   L02011D
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BEQ   L1414C6
         LDA   L02011D
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$000A
         LDA   [$F4],Y
         CMP   #$000E
         BNE   L1414CB
L1414C6  LDA   L02004E
         STA   $F2
L1414CB  LDA   $F2
         CMP   #$FF52
         BNE   L14146F
         LDA   L02011D
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0002
         BNE   L1414F7
         BRL   L14146F
L1414F7  LDA   #$0003
         STA   $EC
         BRL   L141659
L1414FF  LDA   $EC
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BNE   L141523
         BRL   L141657
L141523  PEA   $0003
         PEA   $0007
         PEA   $0040
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L150690
         TAY
         TSC
         CLC
         ADC   #$0016
         TCS
         TYA
         PEA   $0003
         PEA   $0007
         PEA   $0040
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         PEA   $00E1
         PEA   $2000
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDA   $EC
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L150690
         TAY
         TSC
         CLC
         ADC   #$0016
         TCS
         TYA
L141657  INC   $EC
L141659  LDA   $EC
         CMP   #$0006
         BCS   L141663
         BRL   L1414FF
L141663  LDX   L02009E
         LDA   L02009C
         STX   $F0
         STA   $EE
         LDX   L0200A2
         LDA   L0200A0
         PHX
         PHA
         LDX   #$0000
         LDA   #$0032
         CLC
         JSL   L0105E1
         PLA
         PLX
         STX   L02009E
         STA   L02009C
         JSL   L0F0FE2
         LDX   $F0
         LDA   $EE
         STX   L02009E
         STA   L02009C
         LDA   L02011D
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PLD
         RTL

