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

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

	 use	INTPERUS.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
	
*-----------------------

L0C0000  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E6
         TCS
         LDA   #$0003
         STA   $E8
         BRL   L0C0111
L0C0013  LDA   $E8
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0004
         STA   [$F4],Y
         LDA   $E8
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         STA   $EA
         LDA   #L0307A2
         LDX   #^L0307A2
         STX   $EE
         STA   $EC
         LDA   $E8
         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   L0C008C
         EOR   #$8000
L0C008C  BMI   L0C0091
         BRL   L0C010F
L0C0091  LDA   #L030636
         LDX   #^L030636
         STX   $F2
         STA   $F0
         BRA   L0C00D4
L0C009D  LDY   #$0002
         LDA   [$F0],Y
         CMP   $EA
         BNE   L0C00C8
         LDA   $E8
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0001
         LDY   #$0004
         STA   [$F4],Y
L0C00C8  LDA   $F0
         CLC
         ADC   #$001A
         STA   $F0
         BCC   L0C00D4
         INC   $F2
L0C00D4  SEC
         LDA   $F0
         SBC   $EC
         BNE   L0C00E1
         LDA   $F2
         SBC   $EE
         BRA   L0C00E7
L0C00E1  LDA   $F2
         SBC   $EE
         REP   #$02
L0C00E7  BVS   L0C00EC
         EOR   #$8000
L0C00EC  BMI   L0C010F
         LDA   $E8
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         BEQ   L0C009D
L0C010F  INC   $E8
L0C0111  LDA   $E8
         SEC
         SBC   #$0006
         BVS   L0C011C
         EOR   #$8000
L0C011C  BMI   L0C0121
         BRL   L0C0013
L0C0121  TSC
         CLC
         ADC   #$0012
         TCS
         PLD
         RTL

L0C0129  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F0
         TCS
         STZ   $F2
         BRL   L0C02E8
L0C0139  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   L0C015D
         BRL   L0C0250
L0C015D  LDA   $F2
         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   L0C018B
         BRL   L0C0250
L0C018B  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   L0C01AF
         BRL   L0C024D
L0C01AF  LDA   L0200D1
         BNE   L0C01B7
         BRL   L0C024D
L0C01B7  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]
         SEC
         SBC   #$00E8
         CLC
         ADC   #$0034
         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
         CLC
         ADC   #$0001
         PHA
         LDA   $F2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$00F0
         PHA
         JSL   L1503A9
         PLY
         PLY
         PLY
         PLY
         PLY
L0C024D  BRL   L0C02E6
L0C0250  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]
         SEC
         SBC   #$00E8
         CLC
         ADC   #$0034
         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
         CLC
         ADC   #$0001
         PHA
         LDA   $F2
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031602
         LDX   #^L031602
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$00F0
         PHA
         JSL   L1503A9
         PLY
         PLY
         PLY
         PLY
         PLY
L0C02E6  INC   $F2
L0C02E8  LDA   $F2
         SEC
         SBC   #$0006
         BVS   L0C02F3
         EOR   #$8000
L0C02F3  BMI   L0C02F8
         BRL   L0C0139
L0C02F8  TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L0C0300  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E6
         TCS
         STZ   $E8
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   L0200D3
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         STA   $EE
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$000B
         LDY   #$000A
         STA   [$F4],Y
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$000C
         STA   [$F4],Y
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$00BE
         LDY   #$000E
         STA   [$F4],Y
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0092
         LDY   #$0010
         STA   [$F4],Y
         LDA   #$0006
         STA   $F2
         BRL   L0C0523
L0C0400  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   L0C0424
         BRL   L0C0521
L0C0424  LDA   $F2
         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   #$0000
         BNE   L0C0452
         BRL   L0C0521
L0C0452  LDA   $F2
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $EC
         STA   $EA
         LDY   #$0002
         LDA   [$EA],Y
         CMP   $EE
         BNE   L0C04B8
         PEI   $F2
         JSL   L0F085E
         PLY
         LDY   #$0014
         LDA   [$EA],Y
         CMP   #$0005
         BEQ   L0C0497
         LDY   #$0014
         LDA   [$EA],Y
         CMP   #$0001
         BNE   L0C04B6
L0C0497  LDA   L0200D3
         CMP   #$0003
         BNE   L0C04B6
         LDA   #$0001
         LDY   #$000A
         STA   [$EA],Y
         LDA   $FF
         LDY   #$0012
         STA   [$EA],Y
         LDA   #$0000
         LDY   #$000C
         STA   [$EA],Y
L0C04B6  BRA   L0C0521
L0C04B8  LDY   #$0012
         LDA   [$EA],Y
         CMP   $FF
         BNE   L0C0521
         LDY   #$0014
         LDA   [$EA],Y
         CMP   #$0005
         BEQ   L0C0521
         LDA   #$0002
         LDY   #$000A
         STA   [$EA],Y
         LDY   #$0014
         LDA   [$EA],Y
         CMP   #$0003
         BEQ   L0C0521
         LDY   #$0014
         LDA   [$EA],Y
         CMP   #$0001
         BEQ   L0C0521
         LDA   $F2
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0006
         STA   [$F4],Y
         LDA   #$0000
         LDY   #$0012
         STA   [$EA],Y
         LDA   #$0002
         LDY   #$000A
         STA   [$EA],Y
         LDA   #$0000
         LDY   #$000C
         STA   [$EA],Y
L0C0521  INC   $F2
L0C0523  LDA   $F2
         SEC
         SBC   #$0014
         BVS   L0C052E
         EOR   #$8000
L0C052E  BMI   L0C0533
         BRL   L0C0400
L0C0533  TSC
         CLC
         ADC   #$0012
         TCS
         PLD
         RTL

L0C053B  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E8
         TCS
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         STA   $EC
         LDA   #$0001
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],Y
         SEC
         JSL   L01076A
         PLA
         STA   $F0
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EC
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L0C05D4
         INX
L0C05D4  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $F2
         STZ   L02007E
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0003
         BEQ   L0C0609
         BRL   L0C0785
L0C0609  LDA   #$0003
         STA   $EE
         BRL   L0C0772
L0C0611  LDA   $EE
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0003
         BEQ   L0C0635
         BRL   L0C0770
L0C0635  LDA   $EE
         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   L0C0659
         BRL   L0C0770
L0C0659  LDA   $EE
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         CMP   $F2
         BEQ   L0C0686
         BRL   L0C0770
L0C0686  LDA   L02007E
         LDX   #$0000
         TAY
         BPL   L0C0690
         DEX
L0C0690  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03170C
         LDX   #^L03170C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         LDA   L02007E
         PHA
         INC
         STA   L02007E
         PLA
         LDX   #$0000
         TAY
         BPL   L0C06BE
         DEX
L0C06BE  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L031700
         LDX   #^L031700
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   $EE
         STA   [$F4]
         LDA   $EE
         SEC
         SBC   #$0014
         BVS   L0C06E6
         EOR   #$8000
L0C06E6  BMI   L0C06EB
         BRL   L0C0770
L0C06EB  LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0C06F8
         DEX
L0C06F8  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BNE   L0C0770
         LDA   $EE
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L0C0722
         DEX
L0C0722  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BNE   L0C0770
         LDA   $EE
         ORA   #$8000
         PHA
         LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0C0754
         DEX
L0C0754  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
L0C0770  INC   $EE
L0C0772  LDA   $EE
         SEC
         SBC   #$0018
         BVS   L0C077D
         EOR   #$8000
L0C077D  BMI   L0C0782
         BRL   L0C0611
L0C0782  BRL   L0C0AAD
L0C0785  LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0004
         BEQ   L0C07A9
         BRL   L0C0AAD
L0C07A9  LDA   $F2
         SEC
         SBC   #$0000
         BNE   L0C07B4
         BRL   L0C0AAD
L0C07B4  BVS   L0C07B9
         EOR   #$8000
L0C07B9  BMI   L0C07BE
         BRL   L0C0AAD
L0C07BE  LDA   #$0001
         STA   $EA
L0C07C3  LDA   #$0003
         STA   $EE
         BRL   L0C0A34
L0C07CB  LDA   $EE
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0004
         BEQ   L0C07EF
         BRL   L0C0A32
L0C07EF  LDA   $EE
         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   L0C0813
         BRL   L0C0A32
L0C0813  LDA   $EE
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         CMP   $F2
         BEQ   L0C0840
         BRL   L0C0A32
L0C0840  LDA   L02007E
         LDX   #$0000
         TAY
         BPL   L0C084A
         DEX
L0C084A  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03170C
         LDX   #^L03170C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   $EA
         STA   [$F4]
         LDA   L02007E
         PHA
         INC
         STA   L02007E
         PLA
         LDX   #$0000
         TAY
         BPL   L0C0877
         DEX
L0C0877  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L031700
         LDX   #^L031700
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   $EE
         STA   [$F4]
         LDA   $EE
         SEC
         SBC   #$0014
         BVS   L0C089F
         EOR   #$8000
L0C089F  BMI   L0C08A4
         BRL   L0C0A32
L0C08A4  LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0C08B1
         DEX
L0C08B1  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BEQ   L0C08D1
         BRL   L0C0A32
L0C08D1  LDA   $EE
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L0C08DE
         DEX
L0C08DE  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BEQ   L0C0900
         BRL   L0C0A32
L0C0900  LDA   $EA
         CMP   #$0001
         BEQ   L0C090A
         BRL   L0C0A32
L0C090A  LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0C0917
         DEX
L0C0917  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   $EE
         STA   [$F4]
         LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0C0941
         DEX
L0C0941  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L0C0967
         DEX
L0C0967  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0001
         STA   [$F4]
         LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0C0994
         DEX
L0C0994  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L0C09BA
         DEX
L0C09BA  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   $FF
         LDY   #$0002
         STA   [$F4],Y
         LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0C09E9
         DEX
L0C09E9  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L0C0A0F
         DEX
L0C0A0F  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0016
         LDY   #$0004
         STA   [$F4],Y
L0C0A32  INC   $EE
L0C0A34  LDA   $EE
         SEC
         SBC   #$0018
         BVS   L0C0A3F
         EOR   #$8000
L0C0A3F  BMI   L0C0A44
         BRL   L0C07CB
L0C0A44  LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F2
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L0C0A78
         INX
L0C0A78  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $F2
         LDA   $EA
         CLC
         ADC   #$0001
         STA   $EA
         LDA   $EA
         SEC
         SBC   #$0004
         BVS   L0C0A99
         EOR   #$8000
L0C0A99  BMI   L0C0AAD
         LDA   $F2
         SEC
         SBC   #$0000
         BEQ   L0C0AAD
         BVS   L0C0AA8
         EOR   #$8000
L0C0AA8  BPL   L0C0AAD
         BRL   L0C07C3
L0C0AAD  TSC
         CLC
         ADC   #$0010
         TCS
         PLD
         RTL

L0C0AB5  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EA
         TCS
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         STA   $F0
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$000E
         CLC
         ADC   $F4
         BCC   L0C0B14
         INX
L0C0B14  STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDX   L020078
         LDA   L020076
         PHX
         PHA
         CLC
         ADC   #$0002
         STA   L020076
         LDA   L020078
         BCC   L0C0B30
         INC
L0C0B30  STA   L020078
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDX   L020078
         LDA   L020076
         PHX
         PHA
         CLC
         ADC   #$0002
         STA   L020076
         LDA   L020078
         BCC   L0C0B51
         INC
L0C0B51  STA   L020078
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         TSC
         CLC
         ADC   #$000E
         TCS
         PLD
         RTL

L0C0B67  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EA
         TCS
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         STA   $EE
         LDA   #$0001
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],Y
         SEC
         JSL   L01076A
         PLA
         STA   $F0
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EE
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L0C0C00
         INX
L0C0C00  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $F2
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EE
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$000E
         CLC
         ADC   $F4
         BCC   L0C0C42
         INX
L0C0C42  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDX   L020078
         LDA   L020076
         PHX
         PHA
         CLC
         ADC   #$0002
         STA   L020076
         LDA   L020078
         BCC   L0C0C64
         INC
L0C0C64  STA   L020078
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDA   $F2
         SEC
         SBC   #$0000
         BVS   L0C0C7B
         EOR   #$8000
L0C0C7B  BPL   L0C0C80
         BRL   L0C0D33
L0C0C80  LDA   $F0
         EOR   #$0002
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EE
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L0C0CB7
         INX
L0C0CB7  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $EC
         LDA   $EC
         SEC
         SBC   #$0000
         BEQ   L0C0D0E
         BVS   L0C0CD2
         EOR   #$8000
L0C0CD2  BPL   L0C0D0E
         LDA   $EC
         CMP   #$0027
         BEQ   L0C0D0E
         LDA   $EC
         CMP   #$0078
         BNE   L0C0CE9
         LDA   $F0
         CMP   #$0002
         BEQ   L0C0D0E
L0C0CE9  LDX   L020078
         LDA   L020076
         PHX
         PHA
         CLC
         ADC   #$0002
         STA   L020076
         LDA   L020078
         BCC   L0C0CFE
         INC
L0C0CFE  STA   L020078
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0001
         STA   [$F4]
         BRA   L0C0D31
L0C0D0E  LDX   L020078
         LDA   L020076
         PHX
         PHA
         CLC
         ADC   #$0002
         STA   L020076
         LDA   L020078
         BCC   L0C0D23
         INC
L0C0D23  STA   L020078
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         STA   [$F4]
L0C0D31  BRA   L0C0D56
L0C0D33  LDX   L020078
         LDA   L020076
         PHX
         PHA
         CLC
         ADC   #$0002
         STA   L020076
         LDA   L020078
         BCC   L0C0D48
         INC
L0C0D48  STA   L020078
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0001
         STA   [$F4]
L0C0D56  TSC
         CLC
         ADC   #$000E
         TCS
         PLD
         RTL

L0C0D5E  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E6
         TCS
         STZ   $F0
         LDA   $FD
         SEC
         SBC   #$0006
         BVS   L0C0D76
         EOR   #$8000
L0C0D76  BPL   L0C0D7B
         BRL   L0C0DCC
L0C0D7B  LDA   #L0307A2
         LDX   #^L0307A2
         STX   $EA
         STA   $E8
         LDA   #L030636
         LDX   #^L030636
         STX   $EE
         STA   $EC
         BRA   L0C0DAB
L0C0D91  LDY   #$0004
         LDA   [$EC],Y
         CMP   $FF
         BNE   L0C0D9F
         LDA   #$0001
         STA   $F0
L0C0D9F  LDA   $EC
         CLC
         ADC   #$001A
         STA   $EC
         BCC   L0C0DAB
         INC   $EE
L0C0DAB  SEC
         LDA   $EC
         SBC   $E8
         BNE   L0C0DB8
         LDA   $EE
         SBC   $EA
         BRA   L0C0DBE
L0C0DB8  LDA   $EE
         SBC   $EA
         REP   #$02
L0C0DBE  BVS   L0C0DC3
         EOR   #$8000
L0C0DC3  BMI   L0C0DC9
         LDA   $F0
         BEQ   L0C0D91
L0C0DC9  BRL   L0C0E1A
L0C0DCC  LDA   #L030636
         LDX   #^L030636
         STX   $EA
         STA   $E8
         LDA   #L0305E8
         LDX   #^L0305E8
         STX   $EE
         STA   $EC
         BRA   L0C0DFC
L0C0DE2  LDY   #$0004
         LDA   [$EC],Y
         CMP   $FF
         BNE   L0C0DF0
         LDA   #$0001
         STA   $F0
L0C0DF0  LDA   $EC
         CLC
         ADC   #$001A
         STA   $EC
         BCC   L0C0DFC
         INC   $EE
L0C0DFC  SEC
         LDA   $EC
         SBC   $E8
         BNE   L0C0E09
         LDA   $EE
         SBC   $EA
         BRA   L0C0E0F
L0C0E09  LDA   $EE
         SBC   $EA
         REP   #$02
L0C0E0F  BVS   L0C0E14
         EOR   #$8000
L0C0E14  BMI   L0C0E1A
         LDA   $F0
         BEQ   L0C0DE2
L0C0E1A  LDA   $F0
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PLD
         RTL

L0C0E26  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E4
         TCS
         LDA   $FD
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $E8
         STA   $E6
         LDA   #$FFFF
         STA   $EE
         LDA   $FD
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         BRL   L0C1485
L0C0E76  LDA   $FF
         BRL   L0C12B2
L0C0E7B  LDA   #$0001
         PHA
         LDY   #$0008
         LDA   [$E6],Y
         CLC
         ADC   #$0002
         AND   #$0007
         SEC
         JSL   L01076A
         PLA
         STA   $EC
         LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDY   #$0004
         LDA   [$E6],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L0C0ECA
         INX
L0C0ECA  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EA
         PEI   $EA
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BNE   L0C0F1E
         LDA   $EA
         LDY   #$0004
         STA   [$E6],Y
         LDA   #$0001
         PHA
         LDY   #$0008
         LDA   [$E6],Y
         SEC
         JSL   L01076A
         PLA
         STA   $F0
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031FBB
         LDX   #^L031FBB
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         LDY   #$0008
         STA   [$E6],Y
         STZ   $EE
L0C0F1E  BRL   L0C12C0
L0C0F21  LDA   #$0001
         PHA
         LDY   #$0008
         LDA   [$E6],Y
         SEC
         SBC   #$0002
         AND   #$0007
         SEC
         JSL   L01076A
         PLA
         STA   $EC
         LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDY   #$0004
         LDA   [$E6],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L0C0F70
         INX
L0C0F70  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EA
         PEI   $EA
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BNE   L0C0FCC
         LDA   $EA
         LDY   #$0004
         STA   [$E6],Y
         LDA   #$0001
         PHA
         LDY   #$0008
         LDA   [$E6],Y
         SEC
         JSL   L01076A
         LDA   #$0004
         PLX
         STX   $F6
         CLC
         ADC   $F6
         STA   $F0
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031FBB
         LDX   #^L031FBB
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         LDY   #$0008
         STA   [$E6],Y
         STZ   $EE
L0C0FCC  BRL   L0C12C0
L0C0FCF  LDY   #$0008
         LDA   [$E6],Y
         EOR   #$0004
         STA   $EC
         LDA   #$0001
         PHA
         LDA   $EC
         SEC
         JSL   L01076A
         PLA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDY   #$0004
         LDA   [$E6],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L0C101A
         INX
L0C101A  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EA
         LDA   $EA
         CMP   #$FFFF
         BNE   L0C1032
         BRL   L0C10EF
L0C1032  LDA   $EA
         AND   #$7FFF
         STA   $EA
         PEI   $EA
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BEQ   L0C1049
         BRL   L0C10EF
L0C1049  LDA   $EC
         LDY   #$0008
         STA   [$E6],Y
         LDA   $EA
         LDY   #$0004
         STA   [$E6],Y
         LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         STA   [$E6]
         LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         STA   $EE
         LDA   $EE
         LDY   #$0002
         STA   [$E6],Y
         LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         PHA
         LDA   $FD
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         STA   [$F2]
L0C10EF  BRL   L0C12C0
L0C10F2  LDA   #$0001
         PHA
         LDY   #$0008
         LDA   [$E6],Y
         SEC
         JSL   L01076A
         PLA
         STA   $EC
         LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDY   #$0004
         LDA   [$E6],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L0C113A
         INX
L0C113A  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EA
         LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L0C117C
         INX
L0C117C  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $F0
         LDA   $F0
         CMP   #$FFFF
         BNE   L0C1194
         BRL   L0C125C
L0C1194  LDA   $F0
         AND   #$7FFF
         STA   $F0
         PEI   $F0
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BEQ   L0C11AB
         BRL   L0C125A
L0C11AB  PEI   $EA
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BEQ   L0C11BB
         BRL   L0C125A
L0C11BB  LDA   $F0
         LDY   #$0004
         STA   [$E6],Y
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         STA   [$E6]
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         STA   $EE
         LDA   $EE
         LDY   #$0002
         STA   [$E6],Y
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         PHA
         LDA   $FD
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         STA   [$F2]
L0C125A  BRA   L0C127F
L0C125C  PEI   $EA
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BNE   L0C127F
         LDA   $EA
         LDY   #$0004
         STA   [$E6],Y
         LDY   #$0008
         LDA   [$E6],Y
         EOR   #$0004
         LDY   #$0008
         STA   [$E6],Y
         STZ   $EE
L0C127F  LDA   $FD
         SEC
         SBC   #$0006
         BVS   L0C128A
         EOR   #$8000
L0C128A  BMI   L0C1298
         PEA   $0000
         PEA   $4E20
         JSL   L060013
         PLY
         PLY
L0C1298  BRL   L0C12C0
L0C129B  BRL   L0C12C0
L0C129E  DA    L0C10F2
         DA    L0C129B
         DA    L0C0F21
         DA    L0C129B
         DA    L0C0FCF
         DA    L0C129B
         DA    L0C0E7B
         DA    L0C129B
         DA    L0C10F2
         DA    L0C129B
L0C12B2  DEC
         CMP   #$0009
         BCC   L0C12BB
         LDA   #$0009
L0C12BB  ASL
         TAX
         JMP   (L0C129E,X)

L0C12C0  BRL   L0C1495
L0C12C3  LDY   #$0008
         LDA   [$E6],Y
         STA   $EC
         LDA   $FF
         BRL   L0C146B
L0C12CF  LDA   #$0001
         PHA
         LDA   $EC
         SEC
         JSL   L01076A
         PLA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDY   #$0004
         LDA   [$E6],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L0C1310
         INX
L0C1310  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EA
         LDA   $EA
         CMP   #$FFFF
         BNE   L0C1328
         BRL   L0C1413
L0C1328  LDA   $EA
         AND   #$8000
         TAY
         BNE   L0C1333
         BRL   L0C13FD
L0C1333  LDA   $EA
         AND   #$7FFF
         STA   $EA
         PEI   $EA
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BEQ   L0C134A
         BRL   L0C13FB
L0C134A  LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         STA   $EE
         LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0002
         LDA   [$F2],Y
         STA   [$E6]
         LDA   $EE
         LDY   #$0002
         STA   [$E6],Y
         LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         PHA
         LDA   $FD
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         STA   [$F2]
         CMP   #$0004
         BNE   L0C13F4
         LDY   #$0008
         LDA   [$E6],Y
         EOR   #$0004
         LDY   #$0008
         STA   [$E6],Y
L0C13F4  LDA   $EA
         LDY   #$0004
         STA   [$E6],Y
L0C13FB  BRA   L0C1413
L0C13FD  PEI   $EA
         PEI   $FD
         JSL   L0C0D5E
         PLY
         PLY
         TAY
         BNE   L0C1413
         LDA   $EA
         LDY   #$0004
         STA   [$E6],Y
         STZ   $EE
L0C1413  BRL   L0C1479
L0C1416  LDY   #$0008
         LDA   [$E6],Y
         EOR   #$0004
         LDY   #$0008
         STA   [$E6],Y
         STZ   $EE
         BRL   L0C1479
L0C1428  LDY   #$0008
         LDA   [$E6],Y
         STA   $EC
         LDA   $FF
         CMP   #$0003
         BNE   L0C1441
         LDA   $EC
         CLC
         ADC   #$0002
         AND   #$0007
         BRA   L0C144A
L0C1441  LDA   $EC
         SEC
         SBC   #$0002
         AND   #$0007
L0C144A  STA   $EC
         LDA   $EC
         LDY   #$0008
         STA   [$E6],Y
         STZ   $EE
         BRL   L0C1479
L0C1458  BRL   L0C1479
L0C145B  DA    L0C12CF
         DA    L0C1458
         DA    L0C1428
         DA    L0C1458
         DA    L0C1416
         DA    L0C1458
         DA    L0C1428
         DA    L0C1458
L0C146B  DEC
         CMP   #$0007
         BCC   L0C1474
         LDA   #$0007
L0C1474  ASL
         TAX
         JMP   (L0C145B,X)

L0C1479  BRL   L0C1495
L0C147C  BRL   L0C1495
L0C147F  DA    L0C0E76
         DA    L0C12C3
         DA    L0C147C
L0C1485  DEC
         DEC
         DEC
         CMP   #$0002
         BCC   L0C1490
         LDA   #$0002
L0C1490  ASL
         TAX
         JMP   (L0C147F,X)

L0C1495  LDA   $EE
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         PLD
         RTL

