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

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

	 use	FNAPRO23.E.S
	 use	FNAPRO23.X.S
	 
*-----------------------

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

L0B0000  ENT
         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00EC
         TCS
         LDA   #$0001
         STA   L020143
         STZ   L020141
         STZ   L02014D
L0B0017  LDX   L0200B4
         LDA   L0200B2
         CLC
         ADC   #$2800
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         CLC
         ADC   #$0008
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   L020113
         STA   L020111
         PEA   $0000
         PEI   $FD
         PEI   $FB
         PEI   $F9
         JSL   L0A0EAE
         PLY
         PLY
         PLY
         PLY
         STZ   L02014D
         LDY   #$0008
         LDA   [$FB],Y
         PHA
         LDA   L020149
         ASL
         ASL
         ASL
         PHA
         LDA   #$0020
         PLX
         STX   $F2
         CLC
         ADC   $F2
         PLX
         STX   $EE
         SEC
         SBC   $EE
         BEQ   L0B0072
         BVS   L0B0070
         EOR   #$8000
L0B0070  BMI   L0B009C
L0B0072  LDY   #$0008
         LDA   [$FB],Y
         PHA
         LDA   L020149
         ASL
         ASL
         ASL
         PHA
         LDA   #$00C0
         PLX
         STX   $F2
         CLC
         ADC   $F2
         PLX
         STX   $EE
         SEC
         SBC   $EE
         BEQ   L0B009C
         BVS   L0B0095
         EOR   #$8000
L0B0095  BPL   L0B009C
         LDA   L02014D
         BEQ   L0B00A1
L0B009C  LDA   L020141
         BEQ   L0B00A3
L0B00A1  BRA   L0B00AB
L0B00A3  LDA   #$0001
         BEQ   L0B00AB
         BRL   L0B0017
L0B00AB  STZ   L02014D
         STZ   L020143
         STZ   L02013F
         LDX   L0200B4
         LDA   L0200B2
         CLC
         ADC   #$2800
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         CLC
         ADC   #$0008
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   L020113
         STA   L020111
         PEA   $0190
         LDX   L020113
         LDA   L020111
         PHX
         PHA
         PEA   $0007
         PEA   $000F
         LDX   L020131
         LDA   L02012F
         PHX
         PHA
         JSL   L050721
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDA   #$0001
         PHA
         LDA   L020149
         SEC
         JSL   L011179
         JSL   L010D58
         PLY
         PEI   $FF
         JSL   L0A0C86
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0B011B  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EC
         TCS
         SEP   #$20
         STZ   L020081
         REP   #$20
         SEP   #$20
         STZ   L020083
         REP   #$20
         PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         LDX   L020135
         LDA   L020133
         PHX
         PHA
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00C8
         PEA   $00B2
         PEA   $0000
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00C8
         PEA   $0130
         PEA   $0001
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $007D
         PEA   $00CD
         PEA   $0003
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00C1
         PEA   $0034
         PEA   $0000
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00A3
         PEA   $0079
         PEA   $0001
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L0E0062
         PEA   $00C8
         PEA   $0000
         LDX   L020135
         LDA   L020133
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L0B0250  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         LDA   L0200B6
         AND   #$00FF
         CMP   #$001B
         BNE   L0B0277
         LDA   #$0001
         SEP   #$20
         STA   L020096
         REP   #$20
         LDA   #$0001
         BRA   L0B027A
         BRA   L0B027A
L0B0277  LDA   #$0000
L0B027A  TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L0B0284  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00E8
         TCS
         PEA   $00C8
         PEA   $0000
         JSL   L05042F
         PLY
         PLY
         LDA   #$00C8
         STA   $F2
         LDA   #$0142
         STA   $F4
         PEA   $0078
         JSL   L0605D9
         PLY
         PEA   $0000
         PEA   $0001
         PEA   ^L0305E9
         PEA   L0305E9
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
         STZ   $F0
         LDA   #$002D
         STA   $EE
         LDAL  L033FA0
         STA   $EA
L0B02CE  LDA   $F4
         SEC
         SBC   #$00B4
         BEQ   L0B02DD
         BVS   L0B02DB
         EOR   #$8000
L0B02DB  BMI   L0B02E4
L0B02DD  LDA   $EE
         BNE   L0B02E4
         BRL   L0B04FB
L0B02E4  JSL   L0B0250
         AND   #$00FF
         BEQ   L0B02F0
         BRL   L0B04FB
L0B02F0  DEC   $EE
         LDA   $F4
         SEC
         SBC   #$00B4
         BEQ   L0B0309
         BVS   L0B02FF
         EOR   #$8000
L0B02FF  BPL   L0B0309
         LDA   $F4
         SEC
         SBC   #$0008
         STA   $F4
L0B0309  LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $F2
         PEI   $F4
         PEA   $0000
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $F2
         LDA   $F4
         CLC
         ADC   #$007E
         PHA
         PEA   $0001
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $F2
         SEC
         SBC   #$004B
         PHA
         LDA   $F4
         CLC
         ADC   #$001B
         PHA
         LDA   $F0
         CLC
         ADC   #$0002
         PHA
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         INC   $F0
         LDA   $F0
         SEC
         SBC   #$0003
         BVS   L0B039B
         EOR   #$8000
L0B039B  BPL   L0B039F
         STZ   $F0
L0B039F  LDA   $F4
         SEC
         SBC   #$00B4
         BNE   L0B03AA
         BRL   L0B041C
L0B03AA  BVS   L0B03AF
         EOR   #$8000
L0B03AF  BMI   L0B03B4
         BRL   L0B041C
L0B03B4  LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $F2
         LDA   $F4
         CLC
         ADC   #$0014
         PHA
         JSL   L080726
         AND   #$0001
         CLC
         ADC   #$0005
         PHA
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $F2
         LDA   $F4
         CLC
         ADC   #$0068
         PHA
         JSL   L080726
         AND   #$0001
         CLC
         ADC   #$0005
         PHA
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0B041C  LDA   #$0140
         SEC
         SBC   $F4
         PHA
         PEA   $0064
         LDA   #$0001
         PHA
         LDA   $F4
         SEC
         JSL   L011179
         PLA
         LDX   #$0000
         TAY
         BPL   L0B0439
         DEX
L0B0439  PHX
         PHA
         LDA   $EA
         LDX   #$0000
         PHX
         PHA
         LDX   #$00E1
         LDA   #$2000
         JSL   L010E15
         PLA
         PLX
         JSL   L010E15
         LDA   #$0001
         PHA
         LDA   $F4
         SEC
         JSL   L011179
         PLA
         LDX   #$0000
         TAY
         BPL   L0B0465
         DEX
L0B0465  PHX
         PHA
         LDA   $EA
         LDX   #$0000
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         JSL   L010E15
         PLA
         PLX
         JSL   L010E15
         JSL   L0F0B88
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         LDA   #$0140
         SEC
         SBC   $F4
         PHA
         PEA   $0064
         LDA   #$0001
         PHA
         LDA   $F4
         SEC
         JSL   L011179
         PLA
         LDX   #$0000
         TAY
         BPL   L0B04A7
         DEX
L0B04A7  PHX
         PHA
         LDA   $EA
         LDX   #$0000
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         JSL   L010E15
         PLA
         PLX
         JSL   L010E15
         LDA   #$0001
         PHA
         LDA   $F4
         SEC
         JSL   L011179
         PLA
         LDX   #$0000
         TAY
         BPL   L0B04D3
         DEX
L0B04D3  PHX
         PHA
         LDA   $EA
         LDX   #$0000
         PHX
         PHA
         LDX   L020135
         LDA   L020133
         JSL   L010E15
         PLA
         PLX
         JSL   L010E15
         JSL   L0F0B88
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         BRL   L0B02CE
L0B04FB  LDA   L020096
         AND   #$00FF
         BEQ   L0B0505
         BRA   L0B0558
L0B0505  PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $F2
         SEC
         SBC   #$004B
         PHA
         LDA   $F4
         CLC
         ADC   #$001B
         PHA
         PEA   $0003
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0B0558  LDA   L020096
         AND   #$00FF
         BEQ   L0B056E
         LDX   L020135
         LDA   L020133
         PHX
         PHA
         JSL   L0B011B
         PLY
         PLY
L0B056E  TSC
         CLC
         ADC   #$0012
         TCS
         PLD
         RTL

L0B0576  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         PEA   $004E
         PEA   $0047
         PEA   ^L033C1C
         PEA   L033C1C
         JSL   L080B27
         PLY
         PLY
         PLY
         PLY
         PEA   $00D2
         JSL   L0605D9
         PLY
         PEA   $0000
         PEA   $0000
         PEA   ^L030587
         PEA   L030587
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
         PEA   $006E
         PEA   $0000
         LDX   L020135
         LDA   L020133
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   $006E
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   $004E
         PEA   $0047
         PEA   ^L033C29
         PEA   L033C29
         JSL   L080B27
         PLY
         PLY
         PLY
         PLY
         PEA   $0000
         PEA   $0000
         PEA   ^L030587
         PEA   L030587
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
         PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0B0642  LDA   L020081
         AND   #$00FF
         BEQ   L0B064C
         BRA   L0B0642
L0B064C  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

*
* Check result of password protection
*

L0B0654  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00D7
         TCS
         LDX   L020135
         LDA   L020133
         STX   $F4
         STA   $F2
         JSL   L100429
         LDA   L02001D
         SEC
         SBC   #$0075
         CMP   #$0001
         BEQ   L0B0685
         JSL   GSOS
         DW    $0029      ; Quit
         ADRL  L03062F
         BRK   $00
L0B0685  PEA   ^L033CE9
         PEA   L033CE9
         PEA   $0006
         PEA   $00E1
         PEA   $2000
         PEA   ^L0337F3
         PEA   L0337F3
         JSL   L050342
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   ^L03383C
         PEA   L03383C
         JSL   L01044B
         PLY
         PLY
         PHA
         TXA
         STAL  L033DD7
         PLA
         STAL  L033DD5
         PEA   ^L033843
         PEA   L033843
         JSL   L01044B
         PLY
         PLY
         PHA
         TXA
         STAL  L033DC7
         PLA
         STAL  L033DC5
         PEA   ^L033859
         PEA   L033859
         JSL   L01044B
         PLY
         PLY
         PHA
         TXA
         STAL  L033DE7
         PLA
         STAL  L033DE5
         PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00AC
         PEA   $0000
         PEA   $0002
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L0E0062
         PEA   $00C8
         PEA   $0000
         PEI   $F4
         PEI   $F2
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $F4
         PEI   $F2
         JSL   L100798
         PLY
         PLY
         PLY
         PLY
         PEA   $00E1
         PEA   $2000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         JSL   L100798
         PLY
         PLY
         PLY
         PLY
         LDA   #$0091
         STA   $EA
         LDA   #$0005
         STA   $EC
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $EA
         PEI   $EC
         PEA   $0000
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   $005A
         JSL   L0605D9
         PLY
         PEA   $0000
         PEA   $0000
         JSL   L0607F0
         PLY
         PLY
         LDX   L0200F6
         LDA   L0200F4
         PHX
         PHA
         PEA   $002A
         PEA   $00E1
         PEA   $2000
         PEI   $F4
         PEI   $F2
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         PEA   $0000
         PEI   $EA
         PEA   $00AC
         PEA   $0000
         PEA   $0002
         JSL   L050000
         TAY
         TSC
         CLC
         ADC   #$001C
         TCS
         TYA
L0B0801  LDA   $EA
         SEC
         SBC   #$00C2
         BVS   L0B080C
         EOR   #$8000
L0B080C  BMI   L0B0833
         JSL   L0B0250
         AND   #$00FF
         BNE   L0B0833
         PEI   $EA
         PEI   $EC
         JSL   L050197
         PLY
         PLY
         LDA   $EC
         CLC
         ADC   #$0003
         STA   $EC
         LDA   $EA
         CLC
         ADC   #$0003
         STA   $EA
         BRA   L0B0801
L0B0833  LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEI   $F4
         PEI   $F2
         JSL   L100798
         PLY
         PLY
         PLY
         PLY
         LDA   L020096
         AND   #$00FF
         BEQ   L0B0852
         BRL   L0B0C2B
L0B0852  LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $EA
         SEC
         SBC   #$0003
         PHA
         LDA   $EC
         SEC
         SBC   #$0003
         PHA
         PEA   $0000
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00A3
         PEA   $0079
         PEA   $0001
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L0E0062
         PEA   $00C8
         PEA   $0000
         PEI   $F4
         PEI   $F2
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDA   #L033659
         LDX   #^L033659
         STX   $E2
         STA   $E0
         LDA   #L033741
         LDX   #^L033741
         STX   $DE
         STA   $DC
         LDA   #$0061
         STA   $E8
         PEA   $0050
         JSL   L0605D9
         PLY
         PEA   $0028
         PEA   $0001
         PEA   ^L0305D7
         PEA   L0305D7
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
         PEA   $00B4
         JSL   L100926
         PLY
         STZ   $E4
         BRL   L0B0B11
L0B0911  LDA   [$E0]
         CMP   #$8000
         BEQ   L0B091B
         BRL   L0B0988
L0B091B  LDA   #$0061
         STA   $E8
         LDA   #L033659
         LDX   #^L033659
         STX   $E2
         STA   $E0
         LDA   #L033741
         LDX   #^L033741
         STX   $DE
         STA   $DC
         PEA   $003C
         PEA   $0046
         LDAL  L033FC8
         LDX   #$0000
         PHX
         PHA
         LDX   #$00E1
         LDA   #$2000
         JSL   L010E15
         PLA
         PLX
         SEC
         SBC   #$0006
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDAL  L033FC8
         LDX   #$0000
         PHX
         PHA
         LDX   $F4
         LDA   $F2
         JSL   L010E15
         PLA
         PLX
         SEC
         SBC   #$0006
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         PHX
         PHA
         JSL   L0F0B88
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
L0B0988  LDA   [$DC]
         CMP   #$8000
         BNE   L0B0999
         LDA   #L033741
         LDX   #^L033741
         STX   $DE
         STA   $DC
L0B0999  STZ   $E6
         BRL   L0B0ACF
L0B099E  LDY   #$0004
         LDA   [$E0],Y
         BEQ   L0B09D9
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00B4
         LDY   #$0002
         LDA   [$DC],Y
         PHA
         LDA   $E8
         PLX
         STX   $FA
         CLC
         ADC   $FA
         PHA
         LDA   [$DC]
         PHA
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0B09D9  LDA   [$E0]
         BEQ   L0B0A0D
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         LDA   $EA
         SEC
         SBC   #$0003
         PHA
         LDA   $EC
         SEC
         SBC   #$0003
         PHA
         PEA   $0000
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0B0A0D  LDY   #$0002
         LDA   [$E0],Y
         BEQ   L0B0A3C
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $00A3
         PEA   $0079
         PEA   $0001
         JSL   L0F06F8
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
L0B0A3C  LDA   #$0001
         PHA
         LDY   #$0002
         LDA   [$DC],Y
         PHA
         LDA   $E8
         PLX
         STX   $FA
         CLC
         ADC   $FA
         SEC
         JSL   L011179
         LDAL  L033FC8
         PLX
         STX   $FA
         CLC
         ADC   $FA
         SEC
         SBC   #$0005
         STA   $DA
         JSL   L100969
         PEA   $003C
         PEA   $003C
         LDA   $DA
         LDX   #$0000
         PHX
         PHA
         LDX   #$00E1
         LDA   #$2000
         JSL   L010E15
         LDA   $DA
         LDX   #$0000
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         JSL   L010E15
         JSL   L0F0B88
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PEA   $003C
         PEA   $003C
         LDA   $DA
         LDX   #$0000
         PHX
         PHA
         LDX   L0200B4
         LDA   L0200B2
         JSL   L010E15
         LDA   $DA
         LDX   #$0000
         PHX
         PHA
         LDX   $F4
         LDA   $F2
         JSL   L010E15
         JSL   L0F0B88
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         INC   $E6
L0B0ACF  LDA   $E6
         CMP   #$0002
         BEQ   L0B0AD9
         BRL   L0B099E
L0B0AD9  LDY   #$0002
         LDA   [$DC],Y
         PHA
         LDA   $E8
         PLX
         STX   $FA
         CLC
         ADC   $FA
         STA   $E8
         LDX   $DE
         LDA   $DC
         CLC
         ADC   #$0004
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $DE
         STA   $DC
         LDX   $E2
         LDA   $E0
         CLC
         ADC   #$000A
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $E2
         STA   $E0
         INC   $E4
L0B0B11  LDA   $E4
         SEC
         SBC   #$0046
         BVS   L0B0B1C
         EOR   #$8000
L0B0B1C  BMI   L0B0B2A
         JSL   L0B0250
         AND   #$00FF
         BNE   L0B0B2A
         BRL   L0B0911
L0B0B2A  PEA   $FFFF
         JSL   L100926
         PLY
         PEA   $003C
         PEA   $0046
         LDAL  L033FC8
         LDX   #$0000
         PHX
         PHA
         LDX   #$00E1
         LDA   #$2000
         JSL   L010E15
         PLA
         PLX
         SEC
         SBC   #$0006
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDAL  L033FC8
         LDX   #$0000
         PHX
         PHA
         LDX   $F4
         LDA   $F2
         JSL   L010E15
         PLA
         PLX
         SEC
         SBC   #$0006
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         PHX
         PHA
         JSL   L0F0B88
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         LDA   L020096
         AND   #$00FF
         BEQ   L0B0B91
         BRL   L0B0C2B
L0B0B91  PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   $00C8
         PEA   $0000
         PEI   $F4
         PEI   $F2
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         SEP   #$20
         STZ   L020081
         REP   #$20
         PEA   $0003
         PEA   $0000
         PEA   $000E
         PEA   $000D
         PEA   $0000
         PEA   ^L0338C8
         PEA   L0338C8
         JSL   L090000
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEI   $F4
         PEI   $F2
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L0E0062
         JSL   L0B0284
         SEP   #$20
         STZ   L020081
         REP   #$20
L0B0C2B  STZ   L020097
         LDA   L020096
         AND   #$00FF
         BEQ   L0B0C40
         PEI   $F4
         PEI   $F2
         JSL   L0B011B
         PLY
         PLY
L0B0C40  JSL   L0B0576
         PEA   $0050
         JSL   L0605D9
         PLY
         PEA   $001E
         PEA   $0001
         PEA   ^L03058F
         PEA   L03058F
         JSL   L060719
         PLY
         PLY
         PLY
         PLY
         PEA   $00C8
         PEA   $0000
         PEI   $F4
         PEI   $F2
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         SEP   #$20
         STZ   $D9
         REP   #$20
L0B0C85  PEA   $0006
         PEA   $0008
         PEA   $0004
         PEA   $0006
         PEA   $000A
         PEA   $000F
         PEA   $000D
         PEA   $000A
         JSL   L0C03ED
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEI   $F4
         PEI   $F2
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L0C0922
         SEP   #$20
         STA   $D9
         REP   #$20
         PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEI   $F4
         PEI   $F2
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDA   $D9
         AND   #$00FF
         BEQ   L0B0C85
         SEP   #$20
         STZ   L020081
         REP   #$20
         PEA   $00C8
         PEA   $0000
         LDX   L0200B4
         LDA   L0200B2
         PHX
         PHA
         PEA   $0000
         PEI   $F4
         PEI   $F2
         JSL   L1007BF
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L0E0062
         JSL   L06061C
         PEA   $0007
         JSL   L0607BC
         PLY
         PEA   $0006
         JSL   L0607BC
         PLY
         PEA   $0005
         JSL   L0607BC
         PLY
         PEA   $0004
         JSL   L0607BC
         PLY
         PEA   $0003
         JSL   L0607BC
         PLY
         PEA   $0002
         JSL   L0607BC
         PLY
         PEA   $0001
         JSL   L0607BC
         PLY
         PEA   $0000
         JSL   L0607BC
         PLY
         JSL   L0605F8
         LDAL  L033DE7
         TAX
         LDAL  L033DE5
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDAL  L033DC7
         TAX
         LDAL  L033DC5
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         LDAL  L033DD7
         TAX
         LDAL  L033DD5
         PHX
         PHA
         JSL   L0E0045
         PLY
         PLY
         TSC
         CLC
         ADC   #$0023
         TCS
         PLD
         RTL

L0B0DAB  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F2
         TCS
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L0B0DBE  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F0
         TCS
         LDA   $FF
         ASL
         ASL
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L033CE9
         LDX   #^L033CE9
         JSL   L010E15
         JSL   L0E0279
         PLY
         PLY
         JSL   L100429
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L0B0DF1  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F0
         TCS
         PEA   $0002
         LDA   $FF
         ASL
         ASL
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L033CE9
         LDX   #^L033CE9
         JSL   L010E15
         JSL   L10056D
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L0B0E24  ENT
         PHD
         TSC
         SEC
         SBC   #$00F1
         TCD
         ADC   #$00EA
         TCS
L0B0E2F  LDA   $FF
         DEC   $FF
         TAY
         BEQ   L0B0E5E
         LDX   $F9
         LDA   $F7
         INC   $F7
         BNE   L0B0E40
         INC   $F9
L0B0E40  STA   $EC
         STX   $EE
         LDA   [$EC]
         PHA
         LDX   $FD
         LDA   $FB
         INC   $FB
         BNE   L0B0E51
         INC   $FD
L0B0E51  STA   $EC
         STX   $EE
         PLA
         SEP   #$20
         STA   [$EC]
         REP   #$20
         BRA   L0B0E2F
L0B0E5E  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00EC
         TCS
L0B0E71  LDA   $FF
         DEC   $FF
         TAY
         BEQ   L0B0E97
         LDX   $FB
         LDA   $F9
         PHX
         PHA
         CLC
         ADC   #$0002
         STA   $F9
         LDA   $FB
         BCC   L0B0E89
         INC
L0B0E89  STA   $FB
         PLA
         PLX
         STA   $EE
         STX   $F0
         LDA   $FD
         STA   [$EE]
         BRA   L0B0E71
L0B0E97  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

