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

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

	 use	DIGITAL.X.S
	 
*-----------------------

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

L060000  PHA
         REP   #$20
         TXA
         STAL  $E1C03E
         SEP   #$20
         LDA   #$60
         ORAL  $E100CA
         STAL  $E1C03C
         PLA
         RTL

L060016  PHA
         TXA
         STAL  $E1C03E
         LDA   #$20
         ORAL  $E100CA
         STAL  $E1C03C
         PLA
         RTL

L060028  SEP   #$20
         JSL   L060016
         JSL   L06003B
         REP   #$20
         RTL

L060035  SEP   #$20
         JSL   L060000
L06003B  LDAL  $E1C03D
         SEP   #$20
         LDAL  $E1C03D
         REP   #$20
         RTL

L060048  SEP   #$20
         JSL   L060016
         JSL   L06005B
         REP   #$20
         RTL

L060055  SEP   #$20
         JSL   L060000
L06005B  SEP   #$20
         STAL  $E1C03D
         REP   #$20
         RTL

L060064  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F2
         TCS
         STZ   $F4
         BRA   L060092
L060073  LDA   $F4
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03032A
         LDX   #^L03032A
         JSL   L010E15
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         STA   [$F6]
         INC   $F4
L060092  LDA   $F4
         CMP   #$0100
         BNE   L060073
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L0600A1  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E8
         TCS
         STZ   $F0
         LDA   #$FFFF
         STA   $EE
         LDA   #$01F4
         STA   $EC
         STZ   $F2
         BRA   L060106
L0600BC  LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03032A
         LDX   #^L03032A
         JSL   L010E15
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0000
         BNE   L0600EA
         INC   $F0
         LDA   $F0
         CMP   #$0001
         BNE   L0600E8
         LDA   $F2
         STA   $EA
L0600E8  BRA   L060104
L0600EA  LDA   $F0
         BEQ   L060104
         LDA   $F0
         CMP   $EC
         BCS   L060102
         LDA   $F0
         CMP   $FF
         BCC   L060102
         LDA   $F0
         STA   $EC
         LDA   $EA
         STA   $EE
L060102  STZ   $F0
L060104  INC   $F2
L060106  LDA   $F2
         CMP   #$0100
         BNE   L0600BC
         LDA   $F0
         BEQ   L060127
         LDA   $F0
         CMP   $EC
         BCS   L060125
         LDA   $F0
         CMP   $FF
         BCC   L060125
         LDA   $F0
         STA   $EC
         LDA   $EA
         STA   $EE
L060125  STZ   $F0
L060127  LDA   $EE
         CMP   #$FFFF
         BEQ   L06015A
         STZ   $F2
         BRA   L060154
L060132  LDA   $F2
         CLC
         ADC   $EE
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03032A
         LDX   #^L03032A
         JSL   L010E15
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         STA   [$F4]
         INC   $F2
L060154  LDA   $F2
         CMP   $FF
         BNE   L060132
L06015A  LDA   $EE
         CMP   #$FFFF
         BEQ   L060168
         LDA   $FF
         XBA
         ORA   $EE
         STA   $EE
L060168  LDA   $EE
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PLD
         RTL

L060174  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EE
         TCS
         LDA   $FF
         AND   #$FF00
         XBA
         STA   $F0
         LDA   $FF
         AND   #$00FF
         STA   $FF
         STZ   $F2
         BRA   L0601B4
L060192  LDA   $F2
         CLC
         ADC   $FF
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L03032A
         LDX   #^L03032A
         JSL   L010E15
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         INC   $F2
L0601B4  LDA   $F2
         CMP   $F0
         BNE   L060192
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L0601C2  PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00EA
         TCS
         LDY   #$0000
         LDA   $FD
         AND   #$FF00
         TAX
L0601D6  REP   #$20
         LDA   [$F9],Y
         AND   #$00FF
         BNE   L0601E2
         LDA   #$0001
L0601E2  STA   $EC
         JSL   L060055
         JSL   L060035
         SEP   #$20
         CMP   $EC
         BNE   L0601D6
         REP   #$20
         INX
         INY
         CPY   $FF
         BNE   L0601D6
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L060202  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EE
         TCS
         LDA   $FD
         CLC
         ADC   $FF
         TAX
         AND   #$FF00
         ADC   #$0200
         AND   #$FE00
         STA   $F0
L06021E  LDA   #$0000
         JSL   L060055
         JSL   L060035
         AND   #$00FF
         BNE   L06021E
         INX
         CPX   $F0
         BNE   L06021E
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L06023B  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00F0
         TCS
         LDX   $FD
         LDA   $FF
         JSL   L060048
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L060256  PHP
         SEP   #$20
         LDA   #^L020077
         PHB
         PHA
         PLB
         REP   #$30
         LDX   #$00E0
         JSL   L060028
         LDA   L020075
         BNE   L06026F
         BRL   L0602AB
L06026F  CMP   #$0001
         BNE   L060277
         BRL   L0602AF
L060277  DEC
         STA   L020075
         LDA   L02007F
         ORA   #$0080
         TAX
         LDA   L02007D
         JSL   L060048
         LDA   L02007F
         ORA   #$00A0
         TAX
         LDA   #$000F
         JSL   L060048
         LDA   L02007F
         EOR   #$0001
         STA   L02007F
         LDA   L02007D
         INC
         STA   L02007D
         PLB
         PLP
         CLC
         RTL

L0602AB  PLB
         PLP
         CLC
         RTL

L0602AF  LDA   #$0000
         STA   L020075
         LDA   L02007B
         CMP   #$0001
         BNE   L0602C2
         LDA   L020081
         BNE   L0602EB
L0602C2  LDA   L02007F
         ORA   #$0080
         TAX
         LDA   L02007D
         JSL   L060048
         LDA   L02007F
         ORA   #$00A0
         TAX
         LDA   #$0003
         JSL   L060048
         LDA   #$FFFF
         STA   L020077
         STZ   L020081
         PLB
         PLP
         CLC
         RTL

L0602EB  PHD
         TSC
         TAX
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         PHX
         CLC
         LDA   L020085
         ADC   #$0002
         STA   $F6
         LDA   L020087
         ADC   #$0000
         STA   $F8
         LDA   [$F6]
         CMP   #$FFFF
         BNE   L06031A
         LDA   L020089
         STA   $F6
         LDA   L02008B
         STA   $F8
L06031A  LDA   L02007F
         ORA   #$0080
         TAX
         LDA   L02007D
         JSL   L060048
         LDA   L02007F
         ORA   #$00A0
         TAX
         LDA   #$000F
         JSL   L060048
         LDA   L02007F
         EOR   #$0001
         STA   L02007F
         LDA   [$F6]
         CMP   #$FFFF
         BEQ   L06035E
         ASL
         ASL
         TAX
         LDAL  L0302AE,X
         TAX
         AND   #$00FF
         STA   L02007D
         TXA
         XBA
         AND   #$00FF
         STA   L020075
         BRA   L060361
L06035E  STZ   L020081
L060361  LDA   $F6
         STA   L020085
         LDA   $F8
         STA   L020087
         PLA
         TCS
         PLD
         PLB
         PLP
         CLC
         RTL

L060372  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00EE
         TCS
         JSL   L060064
         PEA   $00CF
         PEA   $00E1
         JSL   L06023B
         PLY
         PLY
         STZ   $F0
         BRA   L0603A3
L060391  PEA   $0001
         LDA   #$00A0
         CLC
         ADC   $F0
         PHA
         JSL   L06023B
         PLY
         PLY
         INC   $F0
L0603A3  LDA   $F0
         CMP   #$0020
         BNE   L060391
         STZ   L020075
         LDA   #$FFFF
         STA   L020077
         PEA   ^L060256
         PEA   L060256
         _SetSoundMIRQV
         BCS   L0603C5
         LDA   #$0000
L0603C5  STAL  L020010
         TSC
         CLC
         ADC   #$000C
         TCS
         PLD
         RTL

L0603D1  PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00EC
         TCS
         LDX   #$0000
         LDA   #$C036
         STA   $EE
         STX   $F0
         LDA   [$EE]
         AND   #$00FF
         AND   #$007F
         SEP   #$20
         STA   [$EE]
         REP   #$20
         PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         JSL   L0601C2
         PLY
         PLY
         PLY
         PLY
         PEI   $FF
         PEI   $FD
         JSL   L060202
         PLY
         PLY
         LDX   #$0000
         LDA   #$C036
         STA   $EE
         STX   $F0
         LDA   [$EE]
         AND   #$00FF
         ORA   #$0080
         SEP   #$20
         STA   [$EE]
         REP   #$20
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L06042E  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         LDA   #$0002
         STA   L02007B
L06043F  LDA   L020081
         BEQ   L060446
         BRA   L06043F
L060446  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L06044E  PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00E8
         TCS
         LDA   $FF
         XBA
         AND   #$00FF
         INC
         INC
         AND   #$00FE
         STA   $EC
         PEI   $EC
         JSL   L0600A1
         PLY
         STA   $EE
         LDA   $EE
         XBA
         AND   #$FF00
         STA   $EA
         PEI   $FF
         PEI   $EA
         PEI   $FD
         PEI   $FB
         JSL   L0603D1
         PLY
         PLY
         PLY
         PLY
         LDA   $EE
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PLD
         RTL

L060493  PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00EC
         TCS
         LDA   $FB
         TAY
         AND   #$00FF
         STA   $EE
         TYA
         XBA
         AND   #$00FF
         DEC
         DEC
         STAL  L020075
         LDA   $FD
         AND   #$00FF
         PHA
         PEA   $0000
         JSL   L06023B
         PLY
         PLY
         LDA   $FD
         AND   #$00FF
         PHA
         PEA   $0001
         JSL   L06023B
         PLY
         PLY
         LDA   $FD
         XBA
         STA   $FD
         LDA   $FD
         AND   #$00FF
         PHA
         PEA   $0020
         JSL   L06023B
         PLY
         PLY
         LDA   $FD
         AND   #$00FF
         PHA
         PEA   $0021
         JSL   L06023B
         PLY
         PLY
         PEI   $FF
         PEA   $0040
         JSL   L06023B
         PLY
         PLY
         PEI   $FF
         PEA   $0041
         JSL   L06023B
         PLY
         PLY
         PEI   $EE
         PEA   $0080
         JSL   L06023B
         PLY
         PLY
         LDA   $EE
         CLC
         ADC   #$0001
         PHA
         PEA   $0081
         JSL   L06023B
         PLY
         PLY
         PEA   $0000
         PEA   $00C0
         JSL   L06023B
         PLY
         PLY
         PEA   $0000
         PEA   $00C1
         JSL   L06023B
         PLY
         PLY
         LDA   $EE
         INC
         INC
         AND   #$00FF
         STA   $EE
         LDA   $EE
         STA   L02007D
         STZ   L02007F
         STZ   L020077
         LDA   L020075
         CMP   #$0000
         BEQ   L060573
         BCC   L060573
         PEA   $000F
         PEA   $00A1
         JSL   L06023B
         PLY
         PLY
         PEA   $000E
         PEA   $00A0
         JSL   L06023B
         PLY
         PLY
         BRA   L0605A9
L060573  LDA   L020075
         CMP   #$0000
         BNE   L060595
         PEA   $0003
         PEA   $00A1
         JSL   L06023B
         PLY
         PLY
         PEA   $000E
         PEA   $00A0
         JSL   L06023B
         PLY
         PLY
         BRA   L0605A9
L060595  LDA   L020075
         CMP   #$FFFF
         BNE   L0605A9
         PEA   $0002
         PEA   $00A0
         JSL   L06023B
         PLY
         PLY
L0605A9  TAY
         TSC
         CLC
         ADC   #$0008
         TCS
         TYA
         PLD
         RTL

L0605B3  PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         PEA   $00C0
         LDA   L020079
         PHA
         LDAL  L030326
         PHA
         JSL   L060493
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0605D9  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         LDA   $FF
         CMP   L020079
         BEQ   L0605F0
         LDA   $FF
         STA   L020079
L0605F0  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0605F8  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F2
         TCS
         JSL   L060372
         STZ   L020081
         LDA   #$0002
         STA   L02007B
         JSL   L06042E
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L06061C  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         JSL   L0605F8
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L060633  ENT
         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00C8
         TCS
         PEA   ^L030284
         PEA   L030284
         PEA   $0000
         TDC
         CLC
         ADC   #$00CC
         PHA
         JSL   L011248
         PLY
         PLY
         PLY
         PLY
         PEI   $FB
         PEI   $F9
         PEA   $0000
         TDC
         CLC
         ADC   #$00CC
         PHA
         JSL   L01119D
         PLY
         PLY
         PLY
         PLY
         PEA   ^L03028B
         PEA   L03028B
         PEA   $0000
         TDC
         CLC
         ADC   #$00CC
         PHA
         JSL   L01119D
         PLY
         PLY
         PLY
         PLY
         PEA   $0000
         TDC
         CLC
         ADC   #$00CC
         PHA
         JSL   L1002E2
         PLY
         PLY
         STX   $EC
         STA   $EA
         LDX   L02016E
         LDA   L02016C
         PHA
         PEI   $EC
         PEI   $EA
         JSL   L06044E
         PLY
         PLY
         PLY
         STA   $CA
         LDA   $FD
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0302AE
         LDX   #^L0302AE
         JSL   L010E15
         PLA
         PLX
         STA   $EE
         STX   $F0
         LDA   $CA
         STA   [$EE]
         LDX   L02016E
         LDA   L02016C
         PHA
         LDA   $FD
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0302AE
         LDX   #^L0302AE
         JSL   L010E15
         PLA
         PLX
         STA   $EE
         STX   $F0
         PLA
         LDY   #$0002
         STA   [$EE],Y
         LDA   $FD
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L030290
         LDX   #^L030290
         JSL   L010E15
         PLA
         PLX
         STA   $EE
         STX   $F0
         LDA   $FF
         STA   [$EE]
         PEI   $EC
         PEI   $EA
         JSL   L100210
         PLY
         PLY
         TSC
         CLC
         ADC   #$002A
         TCS
         PLD
         RTL

L060719  ENT
         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00EC
         TCS
         LDA   $FD
         CMP   #$0002
         BNE   L06072E
         BRL   L0607AD
L06072E  LDX   $FB
         LDA   $F9
         STX   L020087
         STA   L020085
         STX   L02008B
         STA   L020089
         LDA   [$F9]
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0302AE
         LDX   #^L0302AE
         JSL   L010E15
         PLA
         PLX
         STA   $EE
         STX   $F0
         LDA   $EE
         LDX   $F0
         PHX
         PHA
         PEA   ^L030326
         PEA   L030326
         PEA   $0004
         JSL   L0110A2
         PLA
         PLA
         PLA
         PLA
         PLX
         LDA   $FD
         STA   L02007B
         LDA   #$0001
         STA   L020081
         LDA   $FF
         BEQ   L060787
         PEI   $FF
         JSL   L0605D9
         PLY
         BRA   L0607A7
L060787  LDA   [$F9]
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L030290
         LDX   #^L030290
         JSL   L010E15
         PLA
         PLX
         STA   $EE
         STX   $F0
         LDA   [$EE]
         PHA
         JSL   L0605D9
         PLY
L0607A7  JSL   L0605B3
         BRA   L0607B4
L0607AD  STZ   L020081
         JSL   L06042E
L0607B4  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0607BC  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         LDA   $FF
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0302AE
         LDX   #^L0302AE
         JSL   L010E15
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         JSL   L060174
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L0607F0  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00F0
         TCS
         JSL   L06042E
         LDA   $FD
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0302AE
         LDX   #^L0302AE
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   $F2
         LDX   $F4
         PHX
         PHA
         PEA   ^L030326
         PEA   L030326
         PEA   $0004
         JSL   L0110A2
         PLA
         PLA
         PLA
         PLA
         PLX
         STZ   L02007B
         LDA   #$0001
         STA   L020081
         LDA   $FF
         BEQ   L060846
         PEI   $FF
         JSL   L0605D9
         PLY
         BRA   L060866
L060846  LDA   $FD
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L030290
         LDX   #^L030290
         JSL   L010E15
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         PHA
         JSL   L0605D9
         PLY
L060866  JSL   L0605B3
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F4
         TCS
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

