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

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

	 use	FNAPRO3.X.S
	 
*-----------------------

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

L0C0000  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F0
         TCS
         STZ   $F4
L0C000D  LDA   $F4
         LDX   #$0000
         PHX
         PHA
         LDA   L02010A
         PHA
         LDA   #$001E
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0306EF
         LDX   #^L0306EF
         JSL   L010E15
         PLA
         PLX
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         PHA
         LDA   $F4
         LDX   #$0000
         PHX
         PHA
         LDA   #L03091F
         LDX   #^L03091F
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         SEP   #$20
         STA   [$F6]
         REP   #$20
         INC   $F4
         LDA   $F4
         LDX   #$0000
         PHX
         PHA
         LDA   L02010A
         PHA
         LDA   #$001E
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0306EF
         LDX   #^L0306EF
         JSL   L010E15
         PLA
         PLX
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         AND   #$00FF
         CMP   #$0000
         BEQ   L0C009B
         BRL   L0C000D
L0C009B  STZ   $F2
         BRA   L0C00DB
L0C009F  LDA   $F2
         LDX   #$0000
         PHX
         PHA
         LDA   #L0339AC
         LDX   #^L0339AC
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         PHA
         LDA   $F4
         LDX   #$0000
         PHX
         PHA
         LDA   #L03091F
         LDX   #^L03091F
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         SEP   #$20
         STA   [$F6]
         REP   #$20
         INC   $F4
         INC   $F2
L0C00DB  LDA   $F2
         CMP   #$0140
         BCC   L0C009F
         LDA   $F4
         LDX   #$0000
         PHX
         PHA
         LDA   #L03091F
         LDX   #^L03091F
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         SEP   #$20
         STA   [$F6]
         REP   #$20
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L0C010A  PHD
         TSC
         SEC
         SBC   #$00E9
         TCD
         ADC   #$00DA
         TCS
         LDA   $EF
         PHA
         LDA   #$001F
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L030749
         LDX   #^L030749
         JSL   L010E15
         PLA
         PLX
         STX   $DE
         STA   $DC
         LDA   $F3
         STA   $E2
         LDA   $F5
         STA   $E0
         LDA   $F7
         BEQ   L0C014A
         LDA   $FF
         STA   $F9
         LDA   $FD
         STA   $FB
L0C014A  LDA   $DC
         CLC
         ADC   #$000A
         TAX
         LDA   $DE
         BCC   L0C0156
         INC
L0C0156  PHA
         PHX
         PEI   $F1
         PEI   $F9
         PEA   ^L030841
         PEA   L030841
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PHA
         LDY   #$0002
         LDA   [$DC],Y
         PLX
         STX   $E8
         CLC
         ADC   $E8
         PHA
         LDA   $E2
         ASL
         ASL
         ASL
         PHA
         LDA   [$DC]
         ASL
         ASL
         ASL
         PLX
         STX   $E8
         CLC
         ADC   $E8
         PHA
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0014
         TCS
         TYA
         LDA   $DC
         CLC
         ADC   #$000A
         TAX
         LDA   $DE
         BCC   L0C01A6
         INC
L0C01A6  PHA
         PHX
         PEI   $FB
         PEA   ^L03084A
         PEA   L03084A
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PHA
         LDY   #$0002
         LDA   [$DC],Y
         PHA
         LDA   #$0001
         PLX
         STX   $E8
         CLC
         ADC   $E8
         PLX
         STX   $E8
         CLC
         ADC   $E8
         PHA
         LDA   $E2
         ASL
         ASL
         ASL
         PHA
         LDA   [$DC]
         ASL
         ASL
         ASL
         PLX
         STX   $E8
         CLC
         ADC   $E8
         SEC
         SBC   #$0001
         PHA
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         TSC
         CLC
         ADC   #$000E
         TCS
         PLD
         RTL

L0C01FE  PHD
         TSC
         SEC
         SBC   #$00E9
         TCD
         ADC   #$00D6
         TCS
         LDA   $EF
         STA   $DE
         PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEA   $0001
         PEI   $F7
         PEI   $F5
         PEI   $F3
         PEI   $DE
         JSL   L0C010A
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         STZ   $D8
L0C022E  LDA   L020151
         BEQ   L0C0238
         DEC   L020151
         BRA   L0C0247
L0C0238  LDA   #$000F
         SEP   #$20
         STA   L02015F
         REP   #$20
         LDA   #$00FF
         STA   $D8
L0C0247  LDA   L02015F
         AND   #$00FF
         PHA
         JSL   L100099
         PLX
         STX   $E8
         AND   $E8
         LDX   #$0000
         TAY
         BPL   L0C025E
         DEX
L0C025E  PHX
         PHA
         LDA   #L033BF0
         LDX   #^L033BF0
         JSL   L010E15
         PLA
         PLX
         STA   $E4
         STX   $E6
         LDA   [$E4]
         AND   #$00FF
         STA   $DA
         LDA   L0200B6
         AND   #$00FF
         AND   $D8
         STA   $DC
         LDA   $DC
         CMP   #$000A
         BNE   L0C028F
         LDA   #$0005
         STA   $DA
         BRA   L0C029B
L0C028F  LDA   $DC
         CMP   #$000B
         BNE   L0C029B
         LDA   #$0001
         STA   $DA
L0C029B  LDA   $DA
         BRL   L0C039B
L0C02A0  PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEA   $0000
         PEI   $F7
         PEI   $F5
         PEI   $F3
         PEI   $DE
         JSL   L0C010A
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         DEC   $DE
         LDA   $DE
         SEC
         SBC   $EF
         BVS   L0C02CB
         EOR   #$8000
L0C02CB  BMI   L0C02D1
         LDA   $F1
         STA   $DE
L0C02D1  PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEA   $0001
         PEI   $F7
         PEI   $F5
         PEI   $F3
         PEI   $DE
         JSL   L0C010A
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         LDA   #$0004
         STA   L020151
         SEP   #$20
         STZ   L02015F
         REP   #$20
         STZ   $D8
         BRL   L0C03A9
L0C0302  PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEA   $0000
         PEI   $F7
         PEI   $F5
         PEI   $F3
         PEI   $DE
         JSL   L0C010A
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         INC   $DE
         LDA   $DE
         SEC
         SBC   $F1
         BEQ   L0C0335
         BVS   L0C032F
         EOR   #$8000
L0C032F  BPL   L0C0335
         LDA   $EF
         STA   $DE
L0C0335  PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEA   $0001
         PEI   $F7
         PEI   $F5
         PEI   $F3
         PEI   $DE
         JSL   L0C010A
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         LDA   #$0004
         STA   L020151
         SEP   #$20
         STZ   L02015F
         REP   #$20
         STZ   $D8
         BRL   L0C03A9
L0C0366  PEA   $0078
         PEA   $0046
         PEA   $00E1
         PEA   $2000
         PEA   $0046
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         BRL   L0C03A9
         BRL   L0C03A9
L0C038F  DA    L0C02A0
         DA    L0C0366
         DA    L0C0366
         DA    L0C0366
         DA    L0C0302
         DA    L0C0366
L0C039B  DEC
         CMP   #$0005
         BCC   L0C03A4
         LDA   #$0005
L0C03A4  ASL
         TAX
         JMP   (L0C038F,X)

L0C03A9  LDA   L0200B6
         AND   #$00FF
         CMP   #$000D
         BEQ   L0C03C0
         JSL   L100099
         CMP   #$0080
         BEQ   L0C03C0
         BRL   L0C022E
L0C03C0  PEA   $0000
         PEA   $0000
         PEA   ^L030587
         PEA   L030587
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
L0C03D4  LDA   L020081
         AND   #$00FF
         BEQ   L0C03DE
         BRA   L0C03D4
L0C03DE  LDA   $DE
         SEC
         SBC   $EF
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         PLD
         RTL

L0C03ED  ENT
         PHD
         TSC
         SEC
         SBC   #$00EB
         TCD
         ADC   #$00CC
         TCS
         LDA   $F1
         STA   $E0
         LDA   $F3
         STA   $DE
         LDA   #$0053
         STA   $DC
         LDA   #$000A
         STA   $D6
         STZ   $DA
         PEI   $F5
         LDA   $DE
         ASL
         ASL
         ASL
         CLC
         ADC   $DC
         CLC
         ADC   #$0001
         PHA
         LDA   $D6
         ASL
         ASL
         ASL
         ASL
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PLX
         STX   $EA
         CLC
         ADC   $EA
         PHA
         LDA   $DE
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         PEI   $F7
         LDA   $DE
         ASL
         ASL
         ASL
         CLC
         ADC   $DC
         PHA
         LDA   $D6
         ASL
         ASL
         ASL
         ASL
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PLX
         STX   $EA
         CLC
         ADC   $EA
         SEC
         SBC   #$0001
         PHA
         LDA   $DE
         ASL
         ASL
         ASL
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   #$0018
         STA   $D8
         LDA   #$0002
         STA   $D4
         LDA   #$0030
         STA   $D2
L0C0491  LDA   $D8
         DEC   $D8
         TAY
         BNE   L0C049B
         BRL   L0C0544
L0C049B  PEA   $0000
         LDA   $DC
         CLC
         ADC   #$0001
         PHA
         LDA   $DE
         ASL
         ASL
         ASL
         PLX
         STX   $EA
         CLC
         ADC   $EA
         SEC
         SBC   $D4
         PHA
         LDA   $D6
         ASL
         ASL
         ASL
         ASL
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PLX
         STX   $EA
         CLC
         ADC   $EA
         SEC
         SBC   $D4
         PHA
         LDA   $DE
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         CLC
         ADC   $D4
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         CLC
         ADC   $D4
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         PEA   $0000
         LDA   $DE
         ASL
         ASL
         ASL
         CLC
         ADC   $DC
         SEC
         SBC   $D2
         PHA
         LDA   $D6
         ASL
         ASL
         ASL
         ASL
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PLX
         STX   $EA
         CLC
         ADC   $EA
         SEC
         SBC   #$0001
         SEC
         SBC   $D2
         PHA
         LDA   $DE
         ASL
         ASL
         ASL
         CLC
         ADC   $D2
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         CLC
         ADC   $D2
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $D4
         CLC
         ADC   #$0002
         STA   $D4
         LDA   $D2
         SEC
         SBC   #$0002
         STA   $D2
         BRL   L0C0491
L0C0544  PEA   $0078
         PEA   $0046
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0046
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         STZ   $D8
         BRL   L0C063B
L0C056C  LDA   $D8
         PHA
         LDA   #$001F
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L030749
         LDX   #^L030749
         JSL   L010E15
         PLA
         PLX
         STX   $D0
         STA   $CE
         LDA   $CE
         CLC
         ADC   #$000A
         TAX
         LDA   $D0
         BCC   L0C0599
         INC
L0C0599  PHA
         PHX
         PEI   $DA
         PEI   $F9
         PEA   ^L030851
         PEA   L030851
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $DE
         ASL
         ASL
         ASL
         PHA
         LDY   #$0002
         LDA   [$CE],Y
         PLX
         STX   $EA
         CLC
         ADC   $EA
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PHA
         LDA   [$CE]
         ASL
         ASL
         ASL
         PLX
         STX   $EA
         CLC
         ADC   $EA
         PHA
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0014
         TCS
         TYA
         LDA   $CE
         CLC
         ADC   #$000A
         TAX
         LDA   $D0
         BCC   L0C05E9
         INC
L0C05E9  PHA
         PHX
         PEI   $FB
         PEA   ^L03085A
         PEA   L03085A
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $DE
         ASL
         ASL
         ASL
         PHA
         LDY   #$0002
         LDA   [$CE],Y
         PHA
         LDA   #$0001
         PLX
         STX   $EA
         CLC
         ADC   $EA
         PLX
         STX   $EA
         CLC
         ADC   $EA
         PHA
         LDA   $E0
         ASL
         ASL
         ASL
         PHA
         LDA   [$CE]
         ASL
         ASL
         ASL
         PLX
         STX   $EA
         CLC
         ADC   $EA
         SEC
         SBC   #$0001
         PHA
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         INC   $D8
L0C063B  LDA   $D8
         SEC
         SBC   #$0008
         BVS   L0C0646
         EOR   #$8000
L0C0646  BMI   L0C064B
         BRL   L0C056C
L0C064B  PEA   $0078
         PEA   $0046
         PEA   $00E1
         PEA   $2000
         PEA   $0046
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEI   $DE
         PEI   $E0
         PEI   $DA
         PEA   $0002
         PEA   $0000
         JSL   L0C01FE
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         STA   L02010A
         JSL   L0C0000
         PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         PEI   $DE
         PEI   $E0
         PEI   $DA
         PEA   $0007
         PEA   $0003
         JSL   L0C01FE
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         STA   L0200A1
         LDA   L0200A1
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0306DB
         LDX   #^L0306DB
         JSL   L010E15
         PLA
         PLX
         STA   $E6
         STX   $E8
         LDY   #$0002
         LDA   [$E6],Y
         TAX
         LDA   [$E6]
         STX   L02011F
         STA   L02011D
         TSC
         CLC
         ADC   #$001E
         TCS
         PLD
         RTL

L0C06E8  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDAL  L033DD3
         TAX
         LDAL  L033DD1
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDAL  L033DCF
         TAX
         LDAL  L033DCD
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDAL  L033DCB
         TAX
         LDAL  L033DC9
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0C0750  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         LDX   L02013D
         LDA   L02013B
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDX   L020139
         LDA   L020137
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDX   L020135
         LDA   L020133
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDX   L020162
         LDA   L020160
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0C079B  ENT
         PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00EE
         TCS
         PEI   $FF
         LDY   #$0002
         LDA   [$FB],Y
         PHA
         JSL   L0C07BC
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0C07BC  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EC
         TCS
         STZ   $EE
         STZ   $F0
         LDA   $FD
         BRL   L0C089D
L0C07D0  PEA   $003C
         JSL   L0605D9
         PLY
         LDA   #$0003
         STA   $F0
         LDA   #$0014
         STA   L02008F
         SEP   #$20
         STZ   L020091
         REP   #$20
         BRL   L0C08AE
L0C07ED  LDA   #$000D
         STA   $F0
         LDA   #$000A
         STA   L02008F
         SEP   #$20
         STZ   L020091
         REP   #$20
         BRL   L0C08AE
L0C0802  LDA   L020081
         AND   #$00FF
         BNE   L0C0812
         LDA   L020083
         AND   #$00FF
         BNE   L0C0840
L0C0812  PEA   $0078
         JSL   L0605D9
         PLY
         JSL   L080726
         AND   #$0003
         PHA
         LDA   #$0005
         PLX
         STX   $F6
         CLC
         ADC   $F6
         CLC
         ADC   #$8000
         STA   $F0
         LDA   #$0001
         STA   $EE
         LDA   #$0001
         SEP   #$20
         STA   L020091
         REP   #$20
L0C0840  BRL   L0C08AE
L0C0843  BRL   L0C08AE
         BRL   L0C08AE
L0C0849  DA    L0C07ED
         DA    L0C07ED
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07D0
         DA    L0C07D0
         DA    L0C0843
         DA    L0C0843
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07ED
         DA    L0C07D0
         DA    L0C07D0
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C0843
         DA    L0C0802
         DA    L0C0843
L0C089D  SEC
         SBC   #$0012
         CMP   #$0029
         BCC   L0C08A9
         LDA   #$0029
L0C08A9  ASL
         TAX
         JMP   (L0C0849,X)

L0C08AE  LDA   $F0
         BNE   L0C08B5
         BRL   L0C091A
L0C08B5  LDA   $F0
         AND   #$8000
         TAY
         BEQ   L0C0908
         SEP   #$20
         STZ   L020081
         REP   #$20
         JSL   L080726
         AND   #$0003
         PHA
         LDA   #$0028
         PLX
         STX   $F6
         CLC
         ADC   $F6
         PHA
         PEI   $EE
         LDA   $F0
         AND   #$7FFF
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0306A3
         LDX   #^L0306A3
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         TAX
         LDA   [$F2]
         PHX
         PHA
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
         BRA   L0C091A
L0C0908  SEP   #$20
         STZ   L020081
         REP   #$20
         PEA   $0000
         PEI   $F0
         JSL   L0607F0
         PLY
         PLY
L0C091A  TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L0C0922  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00D9
         TCS
         SEP   #$20
         STZ   $F5
         REP   #$20
         PEA   ^L030861
         PEA   L030861
         LDA   L02010A
         PHA
         LDA   #$001F
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L030749
         LDX   #^L030749
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   $F6
         LDX   $F8
         CLC
         ADC   #$000A
         BCC   L0C0966
         INX
L0C0966  PHX
         PHA
         JSL   L0513A2
         PLY
         PLY
         PLY
         PLY
         SEP   #$20
         STA   $F4
         REP   #$20
         LDA   #$0001
         SEP   #$20
         STA   $F3
         REP   #$20
         LDA   $F4
         AND   #$00FF
         CMP   #$0000
         BNE   L0C098C
         BRL   L0C0DB7
L0C098C  SEP   #$20
         STZ   $F3
         REP   #$20
         LDA   #$000D
         STA   $EB
         LDA   #$000D
         STA   $E9
         LDA   #$0048
         STA   $E7
         LDA   #$0075
         STA   $E1
         STZ   $E5
         PEA   $000F
         LDA   $E9
         ASL
         ASL
         ASL
         CLC
         ADC   $E7
         CLC
         ADC   #$0001
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         CLC
         ADC   $E1
         PHA
         LDA   $E9
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         PEA   $000A
         LDA   $E9
         ASL
         ASL
         ASL
         CLC
         ADC   $E7
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         CLC
         ADC   $E1
         SEC
         SBC   #$0001
         PHA
         LDA   $E9
         ASL
         ASL
         ASL
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   #$0018
         STA   $E3
         LDA   #$0002
         STA   $DF
         LDA   #$0030
         STA   $DD
L0C0A1B  LDA   $E3
         DEC   $E3
         TAY
         BNE   L0C0A25
         BRL   L0C0ABA
L0C0A25  PEA   $0000
         LDA   $E7
         CLC
         ADC   #$0001
         PHA
         LDA   $E9
         ASL
         ASL
         ASL
         PLX
         STX   $FA
         CLC
         ADC   $FA
         SEC
         SBC   $DF
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         CLC
         ADC   $E1
         SEC
         SBC   $DF
         PHA
         LDA   $E9
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         CLC
         ADC   $DF
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         SEC
         SBC   #$0001
         CLC
         ADC   $DF
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         PEA   $0000
         LDA   $E9
         ASL
         ASL
         ASL
         CLC
         ADC   $E7
         SEC
         SBC   $DD
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         CLC
         ADC   $E1
         SEC
         SBC   #$0001
         SEC
         SBC   $DD
         PHA
         LDA   $E9
         ASL
         ASL
         ASL
         CLC
         ADC   $DD
         PHA
         LDA   $EB
         ASL
         ASL
         ASL
         CLC
         ADC   $DD
         PHA
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $DF
         CLC
         ADC   #$0002
         STA   $DF
         LDA   $DD
         SEC
         SBC   #$0002
         STA   $DD
         BRL   L0C0A1B
L0C0ABA  PEA   $0078
         PEA   $0046
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0046
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDA   L02010A
         PHA
         LDA   #$001F
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L030749
         LDX   #^L030749
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   $F6
         LDX   $F8
         CLC
         ADC   #$000A
         BCC   L0C0B0A
         INX
L0C0B0A  PHX
         PHA
         PEA   ^L03086E
         PEA   L03086E
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $006F
         PEA   $006E
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PEA   ^L030876
         PEA   L030876
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0079
         PEA   $006E
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PEA   ^L030888
         PEA   L030888
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0083
         PEA   $006E
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PEA   ^L03089B
         PEA   L03089B
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $008D
         PEA   $006E
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         LDA   L02010A
         PHA
         LDA   #$001F
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L030749
         LDX   #^L030749
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   $F6
         LDX   $F8
         CLC
         ADC   #$000A
         BCC   L0C0BB9
         INX
L0C0BB9  PHX
         PHA
         PEA   ^L0308AD
         PEA   L0308AD
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $006E
         PEA   $006F
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PEA   ^L0308B5
         PEA   L0308B5
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0078
         PEA   $006F
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PEA   ^L0308C7
         PEA   L0308C7
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0082
         PEA   $006F
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PEA   ^L0308DA
         PEA   L0308DA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $008C
         PEA   $006F
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PEA   $0078
         PEA   $0046
         PEA   $00E1
         PEA   $2000
         PEA   $0046
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   $000F
         PEA   $00AA
         PEA   $00C0
         PEA   $009C
         PEA   $0080
         JSL   L07052A
         PLY
         PLY
         PLY
         PLY
         PLY
         PEA   $0078
         PEA   $0046
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0046
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0C0C99  LDA   L0200B6
         AND   #$00FF
         BEQ   L0C0CA3
         BRA   L0C0C99
L0C0CA3  JSL   L01027C
         PEA   $0005
         PEA   $00A8
         PEA   $0082
         JSL   L050B3A
         PLY
         PLY
         PLY
         STX   $F1
         STA   $EF
         JSL   L0102B8
         PEA   ^L0308EC
         PEA   L0308EC
         LDA   L02010A
         PHA
         LDA   #$001F
         CLC
         JSL   L010FAB
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L030749
         LDX   #^L030749
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   $F6
         LDX   $F8
         CLC
         ADC   #$000A
         BCC   L0C0CF2
         INX
L0C0CF2  PHX
         PHA
         JSL   L0513A2
         PLY
         PLY
         PLY
         PLY
         SEP   #$20
         STA   $F4
         REP   #$20
         LDA   $F4
         AND   #$00FF
         BNE   L0C0D23
         PEI   $F1
         PEI   $EF
         PEA   ^L0308F9
         PEA   L0308F9
         JSL   L0513A2
         PLY
         PLY
         PLY
         PLY
         SEP   #$20
         STA   $F4
         REP   #$20
         BRA   L0C0D3B
L0C0D23  PEI   $F1
         PEI   $EF
         PEA   ^L0308FF
         PEA   L0308FF
         JSL   L0513A2
         PLY
         PLY
         PLY
         PLY
         SEP   #$20
         STA   $F4
         REP   #$20
L0C0D3B  LDA   $F4
         AND   #$00FF
         CMP   #$0000
         BNE   L0C0D81
         LDA   #$0001
         SEP   #$20
         STA   $F3
         REP   #$20
         PEA   ^L030905
         PEA   L030905
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00A0
         PEA   $008A
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         JSL   L0E0062
         STZ   $ED
         BRA   L0C0D78
L0C0D76  INC   $ED
L0C0D78  LDA   $ED
         CMP   #$C350
         BCC   L0C0D76
         BRA   L0C0DB7
L0C0D81  SEP   #$20
         STZ   $F3
         REP   #$20
         PEA   ^L030911
         PEA   L030911
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00A0
         PEA   $008A
         JSL   L0F0421
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         JSL   L0E0062
L0C0DAB  JSL   L100099
         AND   #$0080
         TAY
         BNE   L0C0DB7
         BRA   L0C0DAB
L0C0DB7  LDA   $F3
         TAY
         TSC
         CLC
         ADC   #$0021
         TCS
         TYA
         PLD
         RTL

