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

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

	 use	FNAPRO12.X.S
	 
*-----------------------

	use	4/Locator.Macs
	use	4/Mem.Macs
	use	4/Misc.Macs
	use	4/Util.Macs
	
*-----------------------

L080000  ENT
         PHD
         TSC
         SEC
         SBC   #$00E9
         TCD
         ADC   #$0086
         TCS
         PEA   $0000
         PEI   $F1
         PEI   $EF
         JSL   L110068
         PLY
         PLY
         PLY
         STA   $9A
         LDA   $9A
         SEC
         SBC   #$0000
         BVS   L080026
         EOR   #$8000
L080026  BPL   L080097
         PEA   $0000
         PEA   $0004
         PEA   $0000
         TDC
         CLC
         ADC   #$00A0
         PHA
         PEI   $9A
         JSL   L1100BA
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $A0
         XBA
         STA   $A0
         LDA   $A2
         XBA
         STA   $A2
         LDA   $A2
         PHA
         LDA   $A0
         SEC
         JSL   L010FAB
         PLA
         ASL
         LDX   #$0000
         TAY
         BPL   L08005F
         DEX
L08005F  STX   $9E
         STA   $9C
         PEI   $9E
         PEI   $9C
         JSL   L0E0000
         PLY
         PLY
         LDY   #$0002
         PHA
         TXA
         STA   [$F7],Y
         PLA
         STA   [$F7]
         PEI   $9E
         PEI   $9C
         LDY   #$0002
         LDA   [$F7],Y
         TAX
         LDA   [$F7]
         PHX
         PHA
         PEI   $9A
         JSL   L1100BA
         PLY
         PLY
         PLY
         PLY
         PLY
         PEI   $9A
         JSL   L110110
         PLY
L080097  PHX
         PHA
         PEA   $0000
         PEA   $FD80
         LDA   L02000C
         PHA
*         PEA   $8010
	 pea   $8018 ; + no special
         PEA   $0000
         PEA   $0000
         _NewHandle
         BCS   L0800B8
         LDA   #$0000
L0800B8  STAL  L020010
         PLA
         PLX
         STX   $94
         STA   $92
         LDA   $92
         CMP   #$0000
         BNE   L0800D9
         LDA   $94
         CMP   #$0000
         BNE   L0800D9
         LDA   L020010
         PHA
         JSL   L1009A5
         PLY
L0800D9  LDY   #$0002
         LDA   [$92],Y
         TAX
         LDA   [$92]
         LDY   #$0002
         PHA
         TXA
         STA   [$FB],Y
         PLA
         STA   [$FB]
         PEA   ^L030548
         PEA   L030548
         JSL   L1002E2
         PLY
         PLY
         STX   $8C
         STA   $8A
         LDY   #$0002
         LDA   [$8A],Y
         STA   $88
         LDA   $88
         XBA
         STA   $88
         PEI   $88
         LDY   #$0002
         LDA   [$FB],Y
         TAX
         LDA   [$FB]
         PHX
         PHA
         LDX   $8C
         LDA   $8A
         CLC
         ADC   #$0004
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         JSL   L100887
         PLY
         PLY
         PLY
         PLY
         PLY
         PEI   $8C
         PEI   $8A
         JSL   L100210
         PLY
         PLY
         LDA   #$01FB
         STA   L02014F
         TSC
         CLC
         ADC   #$0062
         TCS
         PLD
         RTL

L080145  ENT
         PHD
         TSC
         SEC
         SBC   #$00F1
         TCD
         ADC   #$00EA
         TCS
         LDA   $FF
         ASL
         ASL
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L033CE9
         LDX   #^L033CE9
         JSL   L010E15
         PEA   $0002
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEI   $F7
         JSL   L050342
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L080185  ENT
         PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00D4
         TCS
         LDY   #$0012
         LDA   [$FB],Y
         BNE   L0801A9
         LDA   #$0000
         LDY   #$0016
         STA   [$FB],Y
         PEI   $FD
         PEI   $FB
         JSL   L0A0000
         PLY
         PLY
L0801A9  LDY   #$0002
         LDA   [$FB],Y
         STA   $E2
         LDY   #$0006
         LDA   [$FB],Y
         STA   $E4
         LDA   $E2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031709
         LDX   #^L031709
         JSL   L010E15
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         STX   $DC
         STA   $DA
         LDA   L020153
         LDX   #$0000
         TAY
         BPL   L0801E6
         DEX
L0801E6  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $DC
         LDA   $DA
         JSL   L010E15
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         STA   $E0
         LDA   $E0
         AND   #$7FFF
         STA   $DE
         LDA   $E0
         AND   #$8000
         TAY
         BNE   L080213
         BRL   L0802E7
L080213  LDA   L020153
         CMP   $E2
         BNE   L08021D
         BRL   L0802E7
L08021D  LDY   #$0010
         LDA   [$FB],Y
         BEQ   L080263
         LDY   #$0010
         LDA   [$FB],Y
         LDY   #$0002
         STA   [$FB],Y
         PEI   $FF
         PEI   $FD
         PEI   $FB
         JSL   L0C079B
         PLY
         PLY
         PLY
         LDA   #$003A
         LDY   #$0002
         STA   [$FB],Y
         LDA   #$0000
         LDY   #$0010
         STA   [$FB],Y
         LDA   #$0000
         LDY   #$0006
         STA   [$FB],Y
         LDA   #$FFFF
         STA   $E4
         LDA   #$0000
         LDY   #$0004
         STA   [$FB],Y
         BRL   L0802E7
L080263  LDA   $E2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0317F5
         LDX   #^L0317F5
         JSL   L010E15
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         STX   $D8
         STA   $D6
         LDA   L020153
         LDX   #$0000
         TAY
         BPL   L080292
         DEX
L080292  STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $D8
         LDA   $D6
         JSL   L010E15
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         SEC
         SBC   $E4
         BEQ   L0802B7
         BVS   L0802B5
         EOR   #$8000
L0802B5  BMI   L0802E7
L0802B7  LDA   $DE
         CMP   #$003A
         BEQ   L0802E7
         LDA   $DE
         LDY   #$0002
         STA   [$FB],Y
         LDA   #$0000
         LDY   #$0006
         STA   [$FB],Y
         LDA   #$FFFF
         STA   $E4
         LDA   #$0000
         LDY   #$0004
         STA   [$FB],Y
         PEI   $FF
         PEI   $FD
         PEI   $FB
         JSL   L0C079B
         PLY
         PLY
         PLY
L0802E7  LDY   #$0004
         LDA   [$FB],Y
         BEQ   L0802FE
         LDY   #$0004
         LDA   [$FB],Y
         PHA
         DEC
         LDY   #$0004
         STA   [$FB],Y
         PLA
         BRL   L08044E
L0802FE  LDY   #$0002
         LDA   [$FB],Y
         LDX   #$0000
         TAY
         BPL   L08030A
         DEX
L08030A  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDA   #L032647
         LDX   #^L032647
         JSL   L010E15
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         STX   $EE
         STA   $EC
         INC   $E4
         LDA   $E4
         LDX   #$0000
         TAY
         BPL   L08033D
         DEX
L08033D  PEA   $0000
         PEA   $000A
         CLC
         JSL   L010FF0
         LDX   $EE
         LDA   $EC
         JSL   L010E15
         PLA
         PLX
         STX   $EA
         STA   $E8
         LDA   [$E8]
         STA   $E6
         LDA   $E6
         BNE   L080362
         STZ   $E4
         BRA   L0803B4
L080362  LDA   $E6
         AND   #$8000
         TAY
         BEQ   L0803AC
         STZ   $E4
         LDA   $E6
         AND   #$7FFF
         LDY   #$0002
         STA   [$FB],Y
         LDY   #$0002
         LDA   [$FB],Y
         LDX   #$0000
         TAY
         BPL   L080382
         DEX
L080382  STX   $F4
         ASL
         ROL   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDA   #L032647
         LDX   #^L032647
         JSL   L010E15
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         TAX
         LDA   [$F0]
         STX   $EE
         STA   $EC
         BRA   L0803B4
L0803AC  LDX   $EA
         LDA   $E8
         STX   $EE
         STA   $EC
L0803B4  LDA   $E4
         LDY   #$0006
         STA   [$FB],Y
         LDA   [$EC]
         LDY   #$0004
         STA   [$FB],Y
         LDY   #$0002
         LDA   [$EC],Y
         STA   [$FB]
         LDY   #$0008
         LDA   [$EC],Y
         BEQ   L080422
         LDY   #$0008
         LDA   [$EC],Y
         AND   #$8000
         TAY
         BNE   L0803FD
         LDY   #$0008
         LDA   [$EC],Y
         LDY   #$0008
         STA   [$FB],Y
         LDY   #$0006
         LDA   [$EC],Y
         PHA
         LDY   #$000A
         LDA   [$FB],Y
         PLX
         STX   $F4
         CLC
         ADC   $F4
         LDY   #$000A
         STA   [$FB],Y
         BRA   L080420
L0803FD  LDY   #$0008
         LDA   [$EC],Y
         AND   #$7FFF
         LDY   #$000A
         STA   [$FB],Y
         LDY   #$0004
         LDA   [$EC],Y
         PHA
         LDY   #$0008
         LDA   [$FB],Y
         PLX
         STX   $F4
         CLC
         ADC   $F4
         LDY   #$0008
         STA   [$FB],Y
L080420  BRA   L08044E
L080422  LDY   #$0004
         LDA   [$EC],Y
         PHA
         LDY   #$0008
         LDA   [$FB],Y
         PLX
         STX   $F4
         CLC
         ADC   $F4
         LDY   #$0008
         STA   [$FB],Y
         LDY   #$0006
         LDA   [$EC],Y
         PHA
         LDY   #$000A
         LDA   [$FB],Y
         PLX
         STX   $F4
         CLC
         ADC   $F4
         LDY   #$000A
         STA   [$FB],Y
L08044E  TSC
         CLC
         ADC   #$0020
         TCS
         PLD
         RTL

L080456  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E0
         TCS
         LDA   [$FD]
         AND   #$7FFF
         STA   $EC
         LDA   $EC
         SEC
         SBC   #$0025
         BEQ   L080477
         BVS   L080475
         EOR   #$8000
L080475  BMI   L0804A7
L080477  LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDY   #$000E
         LDA   [$FD],Y
         PHA
         LDY   #$000C
         LDA   [$FD],Y
         PHA
         LDA   [$FD]
         PHA
         JSL   L0F0951
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         BRA   L0804E7
L0804A7  LDA   [$FD]
         AND   #$8000
         PHA
         LDA   $EC
         SEC
         SBC   #$0026
         PLX
         STX   $F6
         ORA   $F6
         STA   $EC
         LDAL  L033DCB
         TAX
         LDAL  L033DC9
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDY   #$000E
         LDA   [$FD],Y
         PHA
         LDY   #$000C
         LDA   [$FD],Y
         PHA
         PEI   $EC
         JSL   L0F0951
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0804E7  TSC
         CLC
         ADC   #$0016
         TCS
         PLD
         RTL

L0804EF  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E8
         TCS
         LDAL  L03272F+2
         TAX
         LDAL  L03272F
         STX   $F0
         STA   $EE
         LDA   $FD
         LDX   #$0000
         TAY
         BPL   L080510
         DEX
L080510  STX   $F6
         ASL
         ROL   $F6
         ASL
         ROL   $F6
         LDX   $F6
         PHX
         PHA
         LDA   #L032647
         LDX   #^L032647
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         TAX
         LDA   [$F2]
         STX   $EC
         STA   $EA
         PEA   $0000
         PEI   $FD
         JSL   L0C07BC
         PLY
         PLY
L080543  LDX   $EC
         LDA   $EA
         PHX
         PHA
         CLC
         ADC   #$000A
         STA   $EA
         LDA   $EC
         BCC   L080554
         INC
L080554  STA   $EC
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   $F2
         LDX   $F4
         PHX
         PHA
         LDX   $F0
         LDA   $EE
         PHX
         PHA
         CLC
         ADC   #$000A
         STA   $EE
         LDA   $F0
         BCC   L080573
         INC
L080573  STA   $F0
         PLA
         PLX
         STA   $F2
         STX   $F4
         PEI   $F4
         PEI   $F2
         PEA   $000A
         JSL   L0110A2
         PLA
         PLA
         PLA
         PLA
         PLX
         LDA   [$EA]
         BEQ   L080597
         LDA   [$EA]
         AND   #$8000
         TAY
         BEQ   L080543
L080597  LDX   $F0
         LDA   $EE
         SEC
         SBC   #$000A
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STA   $F2
         STX   $F4
         LDA   $FF
         LDY   #$0008
         STA   [$F2],Y
         LDA   $EA
         LDX   $EC
         PHX
         PHA
         LDA   $F0
         PHA
         LDA   $EE
         PHA
         PEA   $000A
         JSL   L0110A2
         PLA
         PLA
         PLA
         PLA
         PLX
         TSC
         CLC
         ADC   #$000E
         TCS
         PLD
         RTL

L0805D1  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00D8
         TCS
         LDY   #$0002
         LDA   [$FD],Y
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031709
         LDX   #^L031709
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         TAX
         LDA   [$F2]
         STX   $E4
         STA   $E2
         LDA   L020153
         LDX   #$0000
         TAY
         BPL   L08060E
         DEX
L08060E  STX   $F6
         ASL
         ROL   $F6
         LDX   $F6
         PHX
         PHA
         LDX   $E4
         LDA   $E2
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         CMP   #$803A
         BEQ   L08062F
         BRL   L0806E7
L08062F  LDA   [$FD]
         AND   #$8000
         STA   $F0
         LDA   $F0
         BNE   L080641
         LDY   #$0008
         LDA   [$FD],Y
         BRA   L08064A
L080641  LDY   #$0008
         LDA   [$FD],Y
         CLC
         ADC   #$0040
L08064A  STA   $E8
         STZ   $EC
         STZ   $E6
         LDA   $F0
         BNE   L08065C
         LDA   #L030ADF
         LDX   #^L030ADF
         BRA   L080662
L08065C  LDA   #L030BA7
         LDX   #^L030BA7
L080662  STX   $E0
         STA   $DE
L080666  LDA   $E6
         SEC
         SBC   #$0014
         BVS   L080671
         EOR   #$8000
L080671  BMI   L0806E7
         LDA   $EC
         BNE   L0806E7
         LDA   $E6
         INC   $E6
         LDX   #$0000
         TAY
         BPL   L080682
         DEX
L080682  PEA   $0000
         PEA   $000A
         CLC
         JSL   L010FF0
         LDX   $E0
         LDA   $DE
         JSL   L010E15
         PLA
         PLX
         STX   $DC
         STA   $DA
         LDA   [$DA]
         SEC
         SBC   $E8
         BVS   L0806A5
         EOR   #$8000
L0806A5  BMI   L0806E4
         LDY   #$0002
         LDA   [$DA],Y
         SEC
         SBC   $E8
         BEQ   L0806E4
         BVS   L0806B6
         EOR   #$8000
L0806B6  BPL   L0806E4
         LDA   $E6
         SEC
         SBC   #$0001
         LDY   #$0016
         STA   [$FD],Y
         LDY   #$0004
         LDA   [$DA],Y
         STA   $EC
         LDA   #$003A
         LDY   #$0010
         STA   [$FD],Y
         LDY   #$0006
         LDA   [$DA],Y
         PHA
         LDY   #$0004
         LDA   [$DA],Y
         PHA
         JSL   L0804EF
         PLY
         PLY
L0806E4  BRL   L080666
L0806E7  LDY   #$0010
         LDA   [$FD],Y
         TAY
         TSC
         CLC
         ADC   #$001E
         TCS
         TYA
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         LDA   $FF
         SEC
         SBC   #$0000
         BVS   L08070C
         EOR   #$8000
L08070C  BPL   L080712
         LDA   $FF
         BRA   L080718
L080712  LDA   $FF
         EOR   #$FFFF
         INC
L080718  STA   $FF
         LDA   $FF
         TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L080726  ENT
         LDAL  L020168
         INC
         STAL  L020168
         PHX
         TAX
         LDAL  $FE0F00,X
         ADCL  $FE7F00,X
         ADCL  $FEFF00,X
         PLX
         AND   #$7FFF
         RTL

L080742  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EC
         TCS
         LDA   L020102
         CMP   #$0001
         BNE   L080768
         LDY   #$0012
         LDA   [$FD],Y
         BEQ   L080768
         LDA   #$000A
         STA   L020104
         LDA   #$0005
         STA   L020106
L080768  LDA   L020104
         BNE   L080770
         BRL   L08091D
L080770  LDY   #$000A
         LDA   [$FD],Y
         SEC
         SBC   #$00AC
         BVS   L08077E
         EOR   #$8000
L08077E  BMI   L080786
         STZ   L020104
         STZ   L020106
L080786  LDA   L020106
         PHA
         DEC
         STA   L020106
         PLA
         TAY
         BNE   L080795
         BRL   L08091D
L080795  LDA   #$0002
         PHA
         JSL   L080726
         SEC
         JSL   L010E20
         PLA
         STA   $F0
         LDA   $F0
         LDX   #$0000
         TAY
         BPL   L0807AE
         DEX
L0807AE  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   #$0000
         STA   [$F2]
         STZ   $EE
         BRL   L08090E
L0807D3  LDA   #$0003
         PHA
         JSL   L080726
         SEC
         JSL   L010E20
         LDA   #$000B
         PLX
         STX   $F6
         CLC
         ADC   $F6
         PHA
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0807F3
         DEX
L0807F3  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         STA   [$F2]
         LDA   [$FD]
         AND   #$8000
         TAY
         BNE   L080861
         JSL   L080726
         AND   #$000F
         CLC
         ADC   #$000E
         PHA
         LDY   #$000C
         LDA   [$FD],Y
         CLC
         ADC   #$0000
         PLX
         STX   $F6
         CLC
         ADC   $F6
         PHA
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L08083E
         DEX
L08083E  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         LDY   #$0002
         STA   [$F2],Y
         BRA   L0808A7
L080861  JSL   L080726
         AND   #$000F
         CLC
         ADC   #$000E
         PHA
         LDY   #$000C
         LDA   [$FD],Y
         CLC
         ADC   #$0040
         PLX
         STX   $F6
         SEC
         SBC   $F6
         PHA
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L080886
         DEX
L080886  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         LDY   #$0002
         STA   [$F2],Y
L0808A7  LDA   #$0007
         PHA
         JSL   L080726
         SEC
         JSL   L010E20
         PLA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03052A
         LDX   #^L03052A
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         CLC
         ADC   #$000A
         PHA
         LDY   #$000E
         LDA   [$FD],Y
         CLC
         ADC   #$0010
         PLX
         STX   $F6
         SEC
         SBC   $F6
         PHA
         LDA   $EE
         LDX   #$0000
         TAY
         BPL   L0808EB
         DEX
L0808EB  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         LDY   #$0004
         STA   [$F2],Y
         INC   $EE
L08090E  LDA   $EE
         SEC
         SBC   $F0
         BVS   L080918
         EOR   #$8000
L080918  BMI   L08091D
         BRL   L0807D3
L08091D  TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L080925  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EA
         TCS
         LDA   L020104
         BNE   L080938
         BRL   L080B1F
L080938  STZ   $F0
L08093A  LDA   $F0
         LDX   #$0000
         TAY
         BPL   L080943
         DEX
L080943  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         BNE   L080965
         BRL   L080B05
L080965  LDA   $F0
         LDX   #$0000
         TAY
         BPL   L08096E
         DEX
L08096E  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         SEC
         SBC   #$00FA
         BVS   L080997
         EOR   #$8000
L080997  BPL   L08099C
         BRL   L080A36
L08099C  LDAL  L033DD3
         TAX
         LDAL  L033DD1
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $F0
         LDX   #$0000
         TAY
         BPL   L0809B8
         DEX
L0809B8  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         PHA
         LDA   $F0
         LDX   #$0000
         TAY
         BPL   L0809E2
         DEX
L0809E2  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         PHA
         LDA   $F0
         LDX   #$0000
         TAY
         BPL   L080A0C
         DEX
L080A0C  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         PHA
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L080A36  LDA   $F0
         LDX   #$0000
         TAY
         BPL   L080A3F
         DEX
L080A3F  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         STA   $EE
         CMP   L0200C0
         BEQ   L080A6F
         BCC   L080A6F
         LDA   $EE
         STA   L0200C0
         BRA   L080A7B
L080A6F  LDA   $EE
         CMP   L0200BC
         BCS   L080A7B
         LDA   $EE
         STA   L0200BC
L080A7B  LDA   $F0
         LDX   #$0000
         TAY
         BPL   L080A84
         DEX
L080A84  PEA   $0000
         PEA   $0006
         CLC
         JSL   L010FF0
         LDA   #L033DB9
         LDX   #^L033DB9
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         STA   $EC
         CMP   L0200C2
         BEQ   L080AB4
         BCC   L080AB4
         LDA   $EC
         STA   L0200C2
         BRA   L080AC0
L080AB4  LDA   $EC
         CMP   L0200BE
         BCS   L080AC0
         LDA   $EC
         STA   L0200BE
L080AC0  INC   $F0
         LDA   L020081
         AND   #$00FF
         BNE   L080AD2
         LDA   L020083
         AND   #$00FF
         BNE   L080AF5
L080AD2  JSL   L080726
         AND   #$0003
         PHA
         LDA   #$002C
         PLX
         STX   $F6
         CLC
         ADC   $F6
         PHA
         PEA   $0000
         PEA   ^L033257
         PEA   L033257
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
L080AF5  SEP   #$20
         STZ   L020091
         REP   #$20
         LDA   #$0005
         STA   L02008F
         BRL   L08093A
L080B05  JSL   L080726
         AND   #$0003
         CMP   #$0000
         BEQ   L080B16
         LDA   #$0000
         BRA   L080B19
L080B16  LDA   #$0001
L080B19  STA   L02001F
         DEC   L020104
L080B1F  TSC
         CLC
         ADC   #$000C
         TCS
         PLD
         RTL

L080B27  ENT
         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00DD
         TCS
         LDA   #$0002
         STA   $EA
L080B37  LDX   $FB
         LDA   $F9
         STX   $E4
         STA   $E2
         LDA   $EA
         SEC
         SBC   #$0020
         SEC
         SBC   #$0000
         BEQ   L080B5A
         BVS   L080B50
         EOR   #$8000
L080B50  BPL   L080B5A
         LDA   $EA
         SEC
         SBC   #$0020
         BRA   L080B5D
L080B5A  LDA   #$0000
L080B5D  STA   $E6
         LDA   $FD
         STA   $EC
L080B63  LDA   [$E2]
         AND   #$00FF
         BEQ   L080BC7
         INC   $E2
         BNE   L080B70
         INC   $E4
L080B70  LDX   $E4
         LDA   $E2
         INC   $E2
         BNE   L080B7A
         INC   $E4
L080B7A  STA   $EE
         STX   $F0
         LDA   [$EE]
         AND   #$00FF
         PHA
         LDA   $EC
         PLX
         STX   $F2
         CLC
         ADC   $F2
         STA   $EC
         LDAL  L033DD7
         TAX
         LDAL  L033DD5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $EA
         PEI   $EC
         LDX   $E4
         LDA   $E2
         INC   $E2
         BNE   L080BAF
         INC   $E4
L080BAF  STA   $EE
         STX   $F0
         LDA   [$EE]
         AND   #$00FF
         PHA
         JSL   L0F06B3
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         BRA   L080B63
L080BC7  LDA   #$0001
         PHA
         LDA   $FD
         SEC
         JSL   L011179
         LDA   $E6
         LDX   #$0000
         TAY
         BPL   L080BDB
         DEX
L080BDB  STX   $F2
         ASL
         ROL   $F2
         LDX   $F2
         PHX
         PHA
         LDA   #L033ED8
         LDX   #^L033ED8
         JSL   L010E15
         PLA
         PLX
         STA   $EE
         STX   $F0
         LDA   [$EE]
         PLX
         STX   $F2
         CLC
         ADC   $F2
         STA   $DF
         PEA   $00AA
         PEA   $0028
         PEI   $DF
         JSL   L0F0BD6
         PLY
         PLY
         PLY
         PEA   $00AA
         PEA   $0028
         LDA   $DF
         LDX   #$0000
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         JSL   L010E15
         LDA   $DF
         LDX   #$0000
         PHX
         PHA
         LDX   L020135
         LDA   L020133
         JSL   L010E15
         JSL   L0F0B88
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         LDA   $EA
         CLC
         ADC   #$0002
         STA   $EA
         LDA   $EA
         SEC
         SBC   $FF
         BVS   L080C53
         EOR   #$8000
L080C53  BMI   L080C58
         BRL   L080B37
L080C58  TSC
         CLC
         ADC   #$0015
         TCS
         PLD
         RTL

L080C60  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EE
         TCS
         LDA   $FF
         LDX   #$0000
         TAY
         BPL   L080C74
         DEX
L080C74  STX   $F8
         ASL
         ROL   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L033C10
         LDX   #^L033C10
         JSL   L010E15
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         TAX
         LDA   [$F4]
         STX   $F2
         STA   $F0
         PEI   $F2
         PEI   $F0
         PEA   ^L030559
         PEA   L030559
         PEA   $00E1
         PEA   $2000
         PEA   $0082
         PEA   $0040
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PEI   $F2
         PEI   $F0
         PEA   ^L03056E
         PEA   L03056E
         PEA   $00E1
         PEA   $2000
         PEA   $0083
         PEA   $003F
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L080CE8  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F0
         TCS
         PEA   $0000
         PEA   $7D00
         JSL   L0E0000
         PLY
         PLY
         STX   L020135
         STA   L020133
         PEA   $0000
         PEA   $1F40
         JSL   L0E0000
         PLY
         PLY
         STX   L02013D
         STA   L02013B
         PEA   $0000
         PEA   $0780
         JSL   L0E0000
         PLY
         PLY
         STX   L020162
         STA   L020160
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L080D31  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         LDX   L02012D
         LDA   L02012B
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDX   L020129
         LDA   L020127
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

