*
* Stickybear ABC
*
* (c) 1988, Optimum Resource
* (h) 2021, Antoine Vignau
*

* _NewHandle $C010 replaced with $C01C (not really)

	mx	%00
	rel
	dsk	ABC.HDD
	lst	off

*-----------------

	USE	4/ACE.MACS
	USE	4/EVENT.MACS
	USE	4/INT.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

GSOS	=	$E100A8

*-----------------

         PHK
         PLB
         _TLStartUp
         PEA   $0000
         _MMStartUp
         PLA
         STA   $2E
         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $8000
         pei   $2E
         PEA   $C003
         PEA   $0001
         PEA   $2000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         PLA

         _MTStartUp
         LDX   #$0002
         JSR   L020557

         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $0600
         pei   $2E
         PEA   $C001
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         STA   $00
         STA   L021148
         PLA
         STA   $02
         STA   L021148+2
         LDA   [$00]
         STA   $04

         pei   $04
         PEA   $0000
         PEA   $00A0
         pei   $2E
         _QDStartUp
         LDX   #$0004
         JSR   L020557

         LDA   $04
         CLC
         ADC   #$0300
         PHA
         PEA   $0014
         PEA   $0000
         PEA   $0140
         PEA   $0000
         PEA   $00C8
         pei   $2E
         _EMStartUp
         LDX   #$0005
         JSR   L020557

         PEA   ^L021132
         PEA   L021132
         _LoadTools

         LDA   $04
         CLC
         ADC   #$0400
         PHA
         _SoundStartUp
         LDX   #$0008	; AV 202103 - WAS 1C
         JSR   L020557

         LDA   $04
         CLC
         ADC   #$0500
         PHA
         _ACEStartUp
         LDX   #$001D
         JSR   L020557

         LDA   #$2000
         STA   $18
         LDA   #$00E1
         STA   $1A
         LDA   #$2000
         STA   $10
         STA   L02074C
         LDA   #$0001
         STA   $12
         STA   L02074C+2

         PEA   $0000
         PEA   $0000
         _GetPort
         PLA
         STA   L020746
         PLA
         STA   L020748
         PEA   ^L020786
         PEA   L020786
         _OpenPort
         PEA   ^L020786
         PEA   L020786
         _SetPort
         PEA   ^L02074A
         PEA   L02074A
         _SetPortLoc

         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $8000
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         PLX
         JSR   L020532
         STA   $14
         STX   $16
         STA   L02074C
         STX   L02074C+2
         PEA   ^L020844
         PEA   L020844
         _OpenPort
         PEA   ^L020844
         PEA   L020844
         _SetPort
         PEA   ^L02074A
         PEA   L02074A
         _SetPortLoc
         LDA   L020748
         PHA
         LDA   L020746
         PHA
         _SetPort
         JSR   L02104A
	 
         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $D881
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         PLX
         JSR   L020532
         STA   $42
         STX   $44
         STA   L0211ED
         STX   L0211ED+2
	 
         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $A000
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         PLX
         JSR   L020532
         STA   $6E
         STX   $70

         PEA   $0000	; Gfx.Font
         PEA   $0000
         PEA   $0000
         PEA   $6AB8
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         PLX
         JSR   L020532
         STA   $56
         STX   $58

         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $66EE
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         PLX
         JSR   L020532
         STA   $46
         STX   $48
         STA   L0211F1
         STX   L0211F1+2

         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $6000
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         STA   $62
         PLX
         STX   $64
         JSR   L020532
         STA   $66
         STX   $68

         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $3000
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         STA   $5A
         PLX
         STX   $5C
         JSR   L020532
         STA   $5E
         STX   $60

         PEA   $0000
         PEA   $0000
         PEA   $0000
         PEA   $1000
         pei   $2E
         PEA   $C010
         PEA   $0000
         PEA   $0000
         _NewHandle
         LDX   #$0003
         JSR   L020557
         PLA
         PLX
         JSR   L020532
         STA   $72
         STX   $74

         JSR   L020498	; load gfx.font
         JSR   L02115C	; load sounds1 & images1
         JSR   L020902	; set heartbeat
         JSR   L02156B	; sound / get table address
         LDAL  $E0C034	; black border
         AND   #$FFF0
         STAL  $E0C034
         STZ   L021144
         STZ   $82
         STZ   $86
         STZ   $88
         LDA   #$0000
         LDX   #$0099
         STX   $84
         JSR   L021D48	; load scene
         STZ   $84
*         JSR   L0218B6	; call protection
         JSR   L021919	; set prefix
         JSR   L0217EB	; 
         JSR   L020910	; del heartbeat

*	 _ACEBootInit
         _ACEShutDown

         _SoundShutDown
         _EMShutDown
         _QDShutDown
         _MTShutDown
         pei   $2E
         _DisposeAll
         LDA   L021148+2
         PHA
         LDA   L021148
         PHA
         _DisposeHandle
         pei   $2E
         _MMShutDown
         _TLShutDown
         JSL   GSOS
         DW    $0029      ; Quit
         ADRL  L02112C
	 brk	$bd
	 
L02036D  LDA   [$4E]
         BNE   L020375
         RTS

L020375  STA   L02048A
         LDA   $4E
         CLC
         ADC   #$0002
         STA   $4E
L020380  LDY   #$0000
         LDA   [$4E],Y
         ASL
         ASL
         TAX
         JSR   (L02048C,X)
         DEC   L02048A
         BNE   L020380
         LDA   #$9E20
         STA   $26
         LDA   #$00E1
         STA   $28
         LDY   #$001E
L02039D  LDA   [$4E],Y
         STA   [$26],Y
         DEY
         DEY
         BPL   L02039D
         RTS

L0203A6  LDY   #$0002
         LDA   [$4E],Y
         ASL
         TAY
         LDA   [$56],Y
         BEQ   L0203CC
         CLC
         ADC   $56
         ADC   #$0004
         STA   $38
         LDA   $58
         STA   $3A
         LDY   #$0004
         LDA   [$4E],Y
         TAX
         LDY   #$0006
         LDA   [$4E],Y
         TAY
         JSR   L020933
L0203CC  LDA   $4E
         CLC
         ADC   #$0008
         STA   $4E
         RTS

L0203D5  LDY   #$0004
         LDA   [$4E],Y
         STA   L020480
         INY
         INY
         LDA   [$4E],Y
         STA   L020484
         INY
         INY
         LDA   [$4E],Y
         STA   L020482
         INY
         INY
         LDA   [$4E],Y
         STA   L020488
         INY
         INY
         LDA   [$4E],Y
         STA   L020486
         PEA   ^L020786
         PEA   L020786
         _SetPort
         LDA   L020480
         PHA
         _SetSolidPenPat
         PEA   ^L020482
         PEA   L020482
         _PaintRect
         PEA   $0000
         _SetSolidPenPat
         LDA   L020748
         PHA
         LDA   L020746
         PHA
         _SetPort
         LDA   $4E
         CLC
         ADC   #$000E
         STA   $4E
         RTS

L020440  LDY   #$0004
         LDA   [$4E],Y
         BPL   L020451
         LDA   $6E
         STA   $38
         LDA   $70
         STA   $3A
         BRA   L02045E
L020451  ASL
         ASL
         TAX
         LDA   L0211ED,X
         STA   $38
         LDA   L0211ED+2,X
         STA   $3A
L02045E  LDY   #$0002
         LDA   [$4E],Y
         CLC
         ADC   $38
         STA   $38
         LDY   #$0006
         LDA   [$4E],Y
         TAX
         LDY   #$0008
         LDA   [$4E],Y
         TAY
         JSR   L020933
         LDA   $4E
         CLC
         ADC   #$000A
         STA   $4E
         RTS

L020480  DW    $0000
L020482  DW    $0000
L020484  DW    $0000
L020486  DW    $0000
L020488  DW    $0000
L02048A  DW    $0000
L02048C  ADRL  L0203A6
         ADRL  L0203D5
         ADRL  L020440

L020498  LDA   #L0204F4
         STA   $22
         LDA   #^L0204F4
         STA   $24
         LDA   #L0204FF
         STA   $52
         LDA   #^L0204FF
         STA   $54
         LDY   #$000E
L0204AF  LDA   [$22],Y
         STA   [$52],Y
         DEY
         DEY
         BPL   L0204AF
         LDA   $56
         STA   L02051D
         LDA   $58
         STA   L02051D+2
         LDA   #$6AB8
         STA   L020521
         JSL   GSOS
         DW    $0010      ; Open
         ADRL  L020511
         BCC   L0204D3
L0204D3  LDA   L020511
         STA   L02051B
         STA   L020529
         JSL   GSOS
         DW    $0012      ; Read
         ADRL  L02051B
*         BCC   L0204E8
L0204E8  JSL   GSOS
         DW    $0014      ; Close
         ADRL  L020529
         CLC
         RTS

L0204F4  STR   '1/Gfx.Font'

L0204FF  DS    $12

L020511  DW    $0000      ;  ref num
         ADRL  L0204FF    ;  path name
         ADRL  $00000000  ;  reserved
L02051B  DW    $0000      ;  ref num
L02051D  ADRL  $00000000  ;  buffer ptr
L020521  ADRL  $00008000  ;  request count
         ADRL  $00000000  ;  transfer count
L020529  DW    $0000      ;  ref num
         DW    $0000
         DW    $0000
         DW    $0000

L020531  RTS

L020532  STA   $00
         STX   $02
         LDY   #$0004
         LDA   [$00],Y
         ORA   #$8000
         STA   [$00],Y
         DEY
         DEY
         LDA   [$00],Y
         TAX
         LDA   [$00]
         RTS

         STA   $00
         STX   $02
         LDY   #$0004
         LDA   [$00],Y
         AND   #$7FFF
         STA   [$00],Y
         RTS

L020557  BCS   L02055A
         RTS

L02055A  PHX
         PEA   $0000
         PEA   $0000
         PHA
         _HexIt
         PLA
         STA   L02059B
         PLA
         STA   L02059B+2
         PLA
         ORA   #$FF00
         PHA
         PEA   ^L020583
         PEA   L020583
         _SysFailMgr
L020583  DB    $1C
         ASC   'Could not handle error '
L02059B  HEX   00000000
         ASC   ' '
L0205A0  LDA   $2C
         ASL
         TAY
         LDA   L0205B2,Y
         STA   $1C
         LDA   $2A
         LSR
         CLC
         ADC   $1C
         STA   $1C
         RTS

L0205B2  DW    $0000
         DW    $00A0
         DW    $0140
         DW    $01E0
         DW    $0280
         DW    $0320
         DW    $03C0
         DW    $0460
         DW    $0500
         DW    $05A0
         DW    $0640
         DW    $06E0
         DW    $0780
         DW    $0820
         DW    $08C0
         DW    $0960
         DW    $0A00
         DW    $0AA0
         DW    $0B40
         DW    $0BE0
         DW    $0C80
         DW    $0D20
         DW    $0DC0
         DW    $0E60
         DW    $0F00
         DW    $0FA0
         DW    $1040
         DW    $10E0
         DW    $1180
         DW    $1220
         DW    $12C0
         DW    $1360
         DW    $1400
         DW    $14A0
         DW    $1540
         DW    $15E0
         DW    $1680
         DW    $1720
         DW    $17C0
         DW    $1860
         DW    $1900
         DW    $19A0
         DW    $1A40
         DW    $1AE0
         DW    $1B80
         DW    $1C20
         DW    $1CC0
         DW    $1D60
         DW    $1E00
         DW    $1EA0
         DW    $1F40
         DW    $1FE0
         DW    $2080
         DW    $2120
         DW    $21C0
         DW    $2260
         DW    $2300
         DW    $23A0
         DW    $2440
         DW    $24E0
         DW    $2580
         DW    $2620
         DW    $26C0
         DW    $2760
         DW    $2800
         DW    $28A0
         DW    $2940
         DW    $29E0
         DW    $2A80
         DW    $2B20
         DW    $2BC0
         DW    $2C60
         DW    $2D00
         DW    $2DA0
         DW    $2E40
         DW    $2EE0
         DW    $2F80
         DW    $3020
         DW    $30C0
         DW    $3160
         DW    $3200
         DW    $32A0
         DW    $3340
         DW    $33E0
         DW    $3480
         DW    $3520
         DW    $35C0
         DW    $3660
         DW    $3700
         DW    $37A0
         DW    $3840
         DW    $38E0
         DW    $3980
         DW    $3A20
         DW    $3AC0
         DW    $3B60
         DW    $3C00
         DW    $3CA0
         DW    $3D40
         DW    $3DE0
         DW    $3E80
         DW    $3F20
         DW    $3FC0
         DW    $4060
         DW    $4100
         DW    $41A0
         DW    $4240
         DW    $42E0
         DW    $4380
         DW    $4420
         DW    $44C0
         DW    $4560
         DW    $4600
         DW    $46A0
         DW    $4740
         DW    $47E0
         DW    $4880
         DW    $4920
         DW    $49C0
         DW    $4A60
         DW    $4B00
         DW    $4BA0
         DW    $4C40
         DW    $4CE0
         DW    $4D80
         DW    $4E20
         DW    $4EC0
         DW    $4F60
         DW    $5000
         DW    $50A0
         DW    $5140
         DW    $51E0
         DW    $5280
         DW    $5320
         DW    $53C0
         DW    $5460
         DW    $5500
         DW    $55A0
         DW    $5640
         DW    $56E0
         DW    $5780
         DW    $5820
         DW    $58C0
         DW    $5960
         DW    $5A00
         DW    $5AA0
         DW    $5B40
         DW    $5BE0
         DW    $5C80
         DW    $5D20
         DW    $5DC0
         DW    $5E60
         DW    $5F00
         DW    $5FA0
         DW    $6040
         DW    $60E0
         DW    $6180
         DW    $6220
         DW    $62C0
         DW    $6360
         DW    $6400
         DW    $64A0
         DW    $6540
         DW    $65E0
         DW    $6680
         DW    $6720
         DW    $67C0
         DW    $6860
         DW    $6900
         DW    $69A0
         DW    $6A40
         DW    $6AE0
         DW    $6B80
         DW    $6C20
         DW    $6CC0
         DW    $6D60
         DW    $6E00
         DW    $6EA0
         DW    $6F40
         DW    $6FE0
         DW    $7080
         DW    $7120
         DW    $71C0
         DW    $7260
         DW    $7300
         DW    $73A0
         DW    $7440
         DW    $74E0
         DW    $7580
         DW    $7620
         DW    $76C0
         DW    $7760
         DW    $7800
         DW    $78A0
         DW    $7940
         DW    $79E0
         DW    $7A80
         DW    $7B20
         DW    $7BC0
         DW    $7C60
         DW    $0000
         DW    $0000
L020746  DW    $0000
L020748  DW    $0000
L02074A  DW    $0000
L02074C  ADRL  $00000000
         DB    $A0
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $C8
         DB    $00
         DB    $40
         DB    $01
L02075A  DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $C8
         DB    $00
         DB    $40
         DB    $01
         DB    $0D
         DB    $00
         DB    $00
         DB    $00
         DB    $C8
         DB    $00
         DB    $40
         DB    $01
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $1E
         DB    $00
         DB    $00
         DB    $00
         DB    $AF
         DB    $00
         DB    $40
         DB    $01
         DB    $0D
         DB    $00
         DB    $A8
         DB    $00
         DB    $80
         DB    $00
         DB    $40
         DB    $01
         DB    $00
         DB    $00
         DB    $00
         DB    $00
L020786  DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $C8
         DB    $00
         DB    $40
         DB    $01
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
L020844  DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $C8
         DB    $00
         DB    $40
         DB    $01
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00

L020902  PEA   ^L02091E
         PEA   L02091E
         _SetHeartBeat
         RTS

L020910  PEA   ^L02091E
         PEA   L02091E
         _DelHeartBeat
         RTS

L02091E  ADRL  $00000000
         DW    $0000
         DW    $A55A
         RTL

L020927  DW    $0000
L020929  DW    $0000
L02092B  DW    $0000
         DW    $0000
L02092F  DW    $0000
         DW    $0000

L020933  STY   $2C
         STX   $2A
         LDY   #$0000
         LDA   [$38],Y
         CLC
         ADC   $2A
         STA   $2A
         LDY   #$0002
         LDA   [$38],Y
         CLC
         ADC   $2C
         STA   $2C
         LDA   $38
         CLC
         ADC   #$0004
         STA   $38
         JSR   L0205A0
         LDA   $10
         CLC
         ADC   $1C
         STA   $22
         LDA   $12
         STA   $24
L020961  LDY   #$0000
         LDA   [$38],Y
         BNE   L02097C
         INY
         INY
         LDA   [$38],Y
         CLC
         ADC   $22
         STA   $22
         LDA   $38
         CLC
         ADC   #$0004
         STA   $38
         JMP   L020961

L02097C  BMI   L0209A4
         ASL
         TAX
         LDA   $38
         CLC
         ADC   #$0002
         STA   $38
         LDA   [$22]
         AND   L020A04,X
         ORA   [$38]
         STA   [$22]
         LDA   $22
         CLC
         ADC   #$0002
         STA   $22
         LDA   $38
         CLC
         ADC   #$0002
         STA   $38
         JMP   L020961

L0209A4  AND   #$7FFF
         BNE   L0209AA
         RTS

L0209AA  PHA
         AND   #$0F00
         BEQ   L0209D7
         PLA
         AND   #$00FF
         STA   $26
         LDA   $38
         CLC
         ADC   #$0002
         STA   $38
L0209BE  LDA   [$38],Y
         STA   [$22],Y
         INY
         INY
         DEC   $26
         BNE   L0209BE
         TYA
         CLC
         ADC   $22
         STA   $22
         TYA
         CLC
         ADC   $38
         STA   $38
         JMP   L020961

L0209D7  PLA
         AND   #$00FF
         STA   $26
         LDA   $38
         CLC
         ADC   #$0002
         STA   $38
         LDA   [$38]
         STA   $28
         LDA   $38
         CLC
         ADC   #$0002
         STA   $38
L0209F1  LDA   $28
         STA   [$22]
         LDA   $22
         CLC
         ADC   #$0002
         STA   $22
         DEC   $26
         BNE   L0209F1
         JMP   L020961

L020A04  HEX   FFFFFFF0
         HEX   FF0FFF00
         HEX   F0FFF0F0
         HEX   F00FF000
         HEX   0FFF0FF0
         HEX   0F0F0F00
         HEX   00FF00F0
         HEX   000F0000
L020A24  LDA   $34
         BNE   L020A29
         RTS

L020A29  LDA   #L020CB6
         STA   $30
         LDA   #^L020CB6
         STA   $32
L020A33  LDAL  $E0C035
         AND   #$FFF7
         STAL  $E0C035
L020A3E  LDY   #$0000
         LDA   [$30],Y
         STA   $2A
         LDY   #$0002
         LDA   [$30],Y
         STA   $2C
         LDY   #$0004
         LDA   [$30],Y
         STA   $1E
         LDY   #$0006
         LDA   [$30],Y
         STA   $20
         JSR   L0205A0
         LDA   #$0050
         SEC
         SBC   $1E
         ASL
         STA   $1E
         ASL
         CLC
         ADC   $1E
         ADC   #L020A7D
         STA   L020A7A+1
         LDY   $20
         LDX   $1C
         PHB
         PEA   $0101
         PLB
         PLB
L020A7A  JMP   L020A7D

L020A7D  LDA   $209E,X
         STA   $209E,X
         LDA   $209C,X
         STA   $209C,X
         LDA   $209A,X
         STA   $209A,X
         LDA   $2098,X
         STA   $2098,X
         LDA   $2096,X
         STA   $2096,X
         LDA   $2094,X
         STA   $2094,X
         LDA   $2092,X
         STA   $2092,X
         LDA   $2090,X
         STA   $2090,X
         LDA   $208E,X
         STA   $208E,X
         LDA   $208C,X
         STA   $208C,X
         LDA   $208A,X
         STA   $208A,X
         LDA   $2088,X
         STA   $2088,X
         LDA   $2086,X
         STA   $2086,X
         LDA   $2084,X
         STA   $2084,X
         LDA   $2082,X
         STA   $2082,X
         LDA   $2080,X
         STA   $2080,X
         LDA   $207E,X
         STA   $207E,X
         LDA   $207C,X
         STA   $207C,X
         LDA   $207A,X
         STA   $207A,X
         LDA   $2078,X
         STA   $2078,X
         LDA   $2076,X
         STA   $2076,X
         LDA   $2074,X
         STA   $2074,X
         LDA   $2072,X
         STA   $2072,X
         LDA   $2070,X
         STA   $2070,X
         LDA   $206E,X
         STA   $206E,X
         LDA   $206C,X
         STA   $206C,X
         LDA   $206A,X
         STA   $206A,X
         LDA   $2068,X
         STA   $2068,X
         LDA   $2066,X
         STA   $2066,X
         LDA   $2064,X
         STA   $2064,X
         LDA   $2062,X
         STA   $2062,X
         LDA   $2060,X
         STA   $2060,X
         LDA   $205E,X
         STA   $205E,X
         LDA   $205C,X
         STA   $205C,X
         LDA   $205A,X
         STA   $205A,X
         LDA   $2058,X
         STA   $2058,X
         LDA   $2056,X
         STA   $2056,X
         LDA   $2054,X
         STA   $2054,X
         LDA   $2052,X
         STA   $2052,X
         LDA   $2050,X
         STA   $2050,X
         LDA   $204E,X
         STA   $204E,X
         LDA   $204C,X
         STA   $204C,X
         LDA   $204A,X
         STA   $204A,X
         LDA   $2048,X
         STA   $2048,X
         LDA   $2046,X
         STA   $2046,X
         LDA   $2044,X
         STA   $2044,X
         LDA   $2042,X
         STA   $2042,X
         LDA   $2040,X
         STA   $2040,X
         LDA   $203E,X
         STA   $203E,X
         LDA   $203C,X
         STA   $203C,X
         LDA   $203A,X
         STA   $203A,X
         LDA   $2038,X
         STA   $2038,X
         LDA   $2036,X
         STA   $2036,X
         LDA   $2034,X
         STA   $2034,X
         LDA   $2032,X
         STA   $2032,X
         LDA   $2030,X
         STA   $2030,X
         LDA   $202E,X
         STA   $202E,X
         LDA   $202C,X
         STA   $202C,X
         LDA   $202A,X
         STA   $202A,X
         LDA   $2028,X
         STA   $2028,X
         LDA   $2026,X
         STA   $2026,X
         LDA   $2024,X
         STA   $2024,X
         LDA   $2022,X
         STA   $2022,X
         LDA   $2020,X
         STA   $2020,X
         LDA   $201E,X
         STA   $201E,X
         LDA   $201C,X
         STA   $201C,X
         LDA   $201A,X
         STA   $201A,X
         LDA   $2018,X
         STA   $2018,X
         LDA   $2016,X
         STA   $2016,X
         LDA   $2014,X
         STA   $2014,X
         LDA   $2012,X
         STA   $2012,X
         LDA   $2010,X
         STA   $2010,X
         LDA   $200E,X
         STA   $200E,X
         LDA   $200C,X
         STA   $200C,X
         LDA   $200A,X
         STA   $200A,X
         LDA   $2008,X
         STA   $2008,X
         LDA   $2006,X
         STA   $2006,X
         LDA   $2004,X
         STA   $2004,X
         LDA   $2002,X
         STA   $2002,X
         LDA   $2000,X
         STA   $2000,X
         TXA
         CLC
         ADC   #$00A0
         TAX
         DEY
         BEQ   L020C69
         JMP   L020A7A

L020C69  PLB
         DEC   $34
         BEQ   L020C79
         LDA   $30
         CLC
         ADC   #$0008
         STA   $30
         JMP   L020A3E

L020C79  LDAL  $E0C035
         ORA   #$0008
         STAL  $E0C035
         RTS

         LDA   L020D56
         BEQ   L020C99
         STA   $34
         LDA   #L020D58
         STA   $30
         LDA   #^L020D58
         STA   $32
         JSR   L020A33
L020C99  RTS

         LDA   #$0000
         STA   L020D58
         STA   L020D5A
         LDA   #$0050
         STA   L020D5C
         LDA   #$00C8
         STA   L020D5E
         LDA   #$0001
         STA   L020D56
         RTS

L020CB6  DB    $00
         DB    $00
L020CB8  DB    $00
         DB    $00
L020CBA  DB    $00
         DB    $00
L020CBC  DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
L020D56  DB    $00
         DB    $00
L020D58  DB    $00
         DB    $00
L020D5A  DB    $00
         DB    $00
L020D5C  DB    $00
         DB    $00
L020D5E  DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00

	 ds	64	; AV 202103 - Was it a too small buffer issue?
	 
L020DA8  LDA   $40
         BNE   L020DAD
         RTS

L020DAD  LDA   #L02108A
         STA   $3C
         LDA   #^L02108A
         STA   $3E
L020DB7  LDY   #$0000
         LDA   [$3C],Y
         STA   $2A
         LDY   #$0002
         LDA   [$3C],Y
         STA   $2C
         LDY   #$0004
         LDA   [$3C],Y
         STA   $1E
         LDY   #$0006
         LDA   [$3C],Y
         STA   $20
         JSR   L0205A0
         LDA   #$0050
         SEC
         SBC   $1E
         STA   $1E
         ASL
         PHA
         CLC
         ADC   $1E
         STA   $1E
         PLA
         ASL
         CLC
         ADC   $1E
         ADC   #L020DFD
         STA   L020DFA+1
         LDY   $20
         LDX   $1C
         PHB
         PEA   $0101
         PLB
         PLB
L020DFA  JMP   L020DFD

L020DFD  LDAL  $01209E,X
         STA   $209E,X
         LDAL  $01209C,X
         STA   $209C,X
         LDAL  $01209A,X
         STA   $209A,X
         LDAL  $012098,X
         STA   $2098,X
         LDAL  $012096,X
         STA   $2096,X
         LDAL  $012094,X
         STA   $2094,X
         LDAL  $012092,X
         STA   $2092,X
         LDAL  $012090,X
         STA   $2090,X
         LDAL  $01208E,X
         STA   $208E,X
         LDAL  $01208C,X
         STA   $208C,X
         LDAL  $01208A,X
         STA   $208A,X
         LDAL  $012088,X
         STA   $2088,X
         LDAL  $012086,X
         STA   $2086,X
         LDAL  $012084,X
         STA   $2084,X
         LDAL  $012082,X
         STA   $2082,X
         LDAL  $012080,X
         STA   $2080,X
         LDAL  $01207E,X
         STA   $207E,X
         LDAL  $01207C,X
         STA   $207C,X
         LDAL  $01207A,X
         STA   $207A,X
         LDAL  $012078,X
         STA   $2078,X
         LDAL  $012076,X
         STA   $2076,X
         LDAL  $012074,X
         STA   $2074,X
         LDAL  $012072,X
         STA   $2072,X
         LDAL  $012070,X
         STA   $2070,X
         LDAL  $01206E,X
         STA   $206E,X
         LDAL  $01206C,X
         STA   $206C,X
         LDAL  $01206A,X
         STA   $206A,X
         LDAL  $012068,X
         STA   $2068,X
         LDAL  $012066,X
         STA   $2066,X
         LDAL  $012064,X
         STA   $2064,X
         LDAL  $012062,X
         STA   $2062,X
         LDAL  $012060,X
         STA   $2060,X
         LDAL  $01205E,X
         STA   $205E,X
         LDAL  $01205C,X
         STA   $205C,X
         LDAL  $01205A,X
         STA   $205A,X
         LDAL  $012058,X
         STA   $2058,X
         LDAL  $012056,X
         STA   $2056,X
         LDAL  $012054,X
         STA   $2054,X
         LDAL  $012052,X
         STA   $2052,X
         LDAL  $012050,X
         STA   $2050,X
         LDAL  $01204E,X
         STA   $204E,X
         LDAL  $01204C,X
         STA   $204C,X
         LDAL  $01204A,X
         STA   $204A,X
         LDAL  $012048,X
         STA   $2048,X
         LDAL  $012046,X
         STA   $2046,X
         LDAL  $012044,X
         STA   $2044,X
         LDAL  $012042,X
         STA   $2042,X
         LDAL  $012040,X
         STA   $2040,X
         LDAL  $01203E,X
         STA   $203E,X
         LDAL  $01203C,X
         STA   $203C,X
         LDAL  $01203A,X
         STA   $203A,X
         LDAL  $012038,X
         STA   $2038,X
         LDAL  $012036,X
         STA   $2036,X
         LDAL  $012034,X
         STA   $2034,X
         LDAL  $012032,X
         STA   $2032,X
         LDAL  $012030,X
         STA   $2030,X
         LDAL  $01202E,X
         STA   $202E,X
         LDAL  $01202C,X
         STA   $202C,X
         LDAL  $01202A,X
         STA   $202A,X
         LDAL  $012028,X
         STA   $2028,X
         LDAL  $012026,X
         STA   $2026,X
         LDAL  $012024,X
         STA   $2024,X
         LDAL  $012022,X
         STA   $2022,X
         LDAL  $012020,X
         STA   $2020,X
         LDAL  $01201E,X
         STA   $201E,X
         LDAL  $01201C,X
         STA   $201C,X
         LDAL  $01201A,X
         STA   $201A,X
         LDAL  $012018,X
         STA   $2018,X
         LDAL  $012016,X
         STA   $2016,X
         LDAL  $012014,X
         STA   $2014,X
         LDAL  $012012,X
         STA   $2012,X
         LDAL  $012010,X
         STA   $2010,X
         LDAL  $01200E,X
         STA   $200E,X
         LDAL  $01200C,X
         STA   $200C,X
         LDAL  $01200A,X
         STA   $200A,X
         LDAL  $012008,X
         STA   $2008,X
         LDAL  $012006,X
         STA   $2006,X
         LDAL  $012004,X
         STA   $2004,X
         LDAL  $012002,X
         STA   $2002,X
         LDAL  $012000,X
         STA   $2000,X
         TXA
         CLC
         ADC   #$00A0
         TAX
         DEY
         BEQ   L021039
         JMP   L020DFA

L021039  PLB
         DEC   $40
         BEQ   L021049
         LDA   $3C
         CLC
         ADC   #$0008
         STA   $3C
         JMP   L020DB7
L021049  RTS

L02104A  LDA   #L020DFD
         INC
         STA   $22
         LDA   #^L020DFD
         STA   $24
         LDX   #$0050
         LDA   #$009E
         STA   L02112A
L02105E  LDY   #$0000
         LDA   $14
         CLC
         ADC   L02112A
         STA   [$22],Y
         SEP   #$20
         LDY   #$0002
         LDA   $16
         STA   [$22],Y
         REP   #$20
         LDA   $22
         CLC
         ADC   #$0007
         STA   $22
         LDA   L02112A
         SEC
         SBC   #$0002
         STA   L02112A
         DEX
         BNE   L02105E
         RTS

L02108A  DB    $00
         DB    $00
L02108C  DB    $00
         DB    $00
L02108E  DB    $00
         DB    $00
L021090  DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
L02112A  DB    $00
         DB    $00
L02112C  ADRL  $00000000  ;  path name
         DW    $4000      ;  flags

L021132  DW    $0004      ; number of tools
         DW    $0004      ; quickdraw II
         DW    $0101
         DW    $0006      ; event manager
         DW    $0100
         DW    $001C      ; list manager
         DW    $0000
         DW    $001D
         DW    $0000

L021144  DW    $0000
         DW    $0000
L021148  ADRL  $00000000

L02114C  DW    $0000      ; event code
L02114E  ADRL  $00000000  ; event message
         ADRL  $00000000  ; tick count
         DW    $0000      ; mouse location
         DW    $0000
         DW    $0000      ; modifiers

L02115C  LDX   #$000E
L02115F  LDA   L0211F5,X
         STA   L0204FF,X
         DEX
         DEX
         BPL   L02115F
         LDA   $42
         STA   L02051D
         LDA   $44
         STA   L02051D+2
         LDA   #$D881
         STA   L020521
         JSL   GSOS
         DW    $0010      ; Open
         ADRL  L020511
         BCC   L021185
L021185  LDA   L020511
         STA   L02051B
         STA   L020529
         JSL   GSOS
         DW    $0012      ; Read
         ADRL  L02051B
         BCC   L02119A
L02119A  JSL   GSOS
         DW    $0014      ; Close
         ADRL  L020529
         LDX   #$000E
L0211A7  LDA   L0211FF,X
         STA   L0204FF,X
         DEX
         DEX
         BPL   L0211A7
         LDA   $46
         STA   L02051D
         LDA   $48
         STA   L02051D+2
         LDA   #$66EE
         STA   L020521
         JSL   GSOS
         DW    $0010      ; Open
         ADRL  L020511
         BCC   L0211CD
L0211CD  LDA   L020511
         STA   L02051B
         STA   L020529
         JSL   GSOS
         DW    $0012      ; Read
         ADRL  L02051B
         BCC   L0211E2
L0211E2  JSL   GSOS
         DW    $0014      ; Close
         ADRL  L020529
         RTS

L0211ED  ADRL  $00000042
L0211F1  ADRL  $00000046
L0211F5  STR   '1/Sounds1'
L0211FF  STR   '1/Images1'

L021209  STZ   $36
         LDY   #$0000
         LDA   [$76],Y
         STA   L021E34
         DEC   L021E34
         BPL   L021219
         RTS

L021219  LDA   L021E34
         ASL
         CLC
         ADC   #$0002
         ADC   $76
         STA   $7E
         LDA   $78
         STA   $80
         LDY   #$0000
         LDA   [$7E],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         JSR   L021242
         DEC   L021E34
         BPL   L021219
         JMP   L0229F7

L021242  LDY   #$0004
         LDA   [$7A],Y
         LDY   #$0002
         STA   [$7A],Y
         LDY   #$0008
         LDA   [$7A],Y
         LDY   #$0006
         STA   [$7A],Y
         CLC
         ADC   $7A
         STA   $22
         LDA   $7C
         STA   $24
         LDY   #$0000
         LDA   [$22],Y
         CLC
         ADC   $36
         LDY   #$000A
         STA   [$7A],Y
         LDA   #$0000
         LDY   #$000C
         STA   [$7A],Y
         LDY   #$0000
         LDA   [$7A],Y
         BNE   L021284
         JSR   L0212DA
         JSR   L0212F9
         JMP   L0212D9

L021284  CMP   #$0001
         BNE   L021295
         JSR   L0212DA
         JSR   L0212F9
         JSR   L021368
         JMP   L0212D9

L021295  CMP   #$0002
         BNE   L0212A6
         JSR   L0212DA
         JSR   L0212F9
         JSR   L021368
         JMP   L0212D9

L0212A6  CMP   #$0003
         BNE   L0212C1
         JSR   L0212DA
         JSR   L0212F9
         JSR   L021368
         LDY   #$006C
         LDA   [$7A],Y
         LDY   #$006A
         STA   [$7A],Y
         JMP   L0212D9

L0212C1  CMP   #$0004
         BNE   L0212C9
         JMP   L0212D9

L0212C9  CMP   #$0005
         BNE   L0212D1
         JMP   L0212D9

L0212D1  CMP   #$0006
         BNE   L0212D9
         JSR   L0213AF
L0212D9  RTS

L0212DA  LDY   #$0010
         LDA   [$7A],Y
         LDY   #$0012
         STA   [$7A],Y
         LDY   #$0014
         STA   [$7A],Y
         LDY   #$0016
         LDA   [$7A],Y
         LDY   #$0018
         STA   [$7A],Y
         LDY   #$001A
         STA   [$7A],Y
         RTS

L0212F9  LDY   #$0022
         LDA   [$7A],Y
         LDY   #$0020
         STA   [$7A],Y
         LDY   #$001E
         LDA   [$7A],Y
         LDY   #$001C
         STA   [$7A],Y
         LDY   #$002A
         LDA   [$7A],Y
         LDY   #$0028
         STA   [$7A],Y
         LDY   #$002E
         LDA   [$7A],Y
         LDY   #$002C
         STA   [$7A],Y
         LDY   #$0034
         LDA   [$7A],Y
         LDY   #$0032
         STA   [$7A],Y
         LDY   #$0030
         STA   [$7A],Y
         LDY   #$0038
         LDA   [$7A],Y
         LDY   #$0036
         STA   [$7A],Y
         LDY   #$003C
         LDA   [$7A],Y
         LDY   #$003A
         STA   [$7A],Y
         LDY   #$0040
         LDA   [$7A],Y
         LDY   #$003E
         STA   [$7A],Y
         LDY   #$0046
         LDA   [$7A],Y
         LDY   #$0044
         STA   [$7A],Y
         LDY   #$0042
         STA   [$7A],Y
         LDY   #$004A
         LDA   [$7A],Y
         LDY   #$0048
         STA   [$7A],Y
         RTS

L021368  LDY   #$004E
         LDA   [$7A],Y
         LDY   #$004C
         STA   [$7A],Y
         LDY   #$0052
         LDA   [$7A],Y
         LDY   #$0050
         STA   [$7A],Y
         LDY   #$0060
         STA   [$7A],Y
         LDY   #$0056
         LDA   [$7A],Y
         LDY   #$0054
         STA   [$7A],Y
         LDY   #$005A
         LDA   [$7A],Y
         LDY   #$0058
         STA   [$7A],Y
         LDY   #$0062
         STA   [$7A],Y
         LDY   #$005E
         LDA   [$7A],Y
         LDY   #$005C
         STA   [$7A],Y
         LDY   #$0066
         LDA   [$7A],Y
         LDY   #$0064
         STA   [$7A],Y
         RTS

L0213AF  LDY   #$0014
         LDA   [$7A],Y
         LDY   #$0012
         STA   [$7A],Y
         LDY   #$0018
         LDA   [$7A],Y
         LDY   #$0016
         STA   [$7A],Y
         LDY   #$001C
         LDA   [$7A],Y
         LDY   #$001A
         STA   [$7A],Y
         LDY   #$0020
         LDA   [$7A],Y
         LDY   #$001E
         STA   [$7A],Y
         LDY   #$0026
         STA   [$7A],Y
         LDY   #$0024
         LDA   [$7A],Y
         LDY   #$0022
         STA   [$7A],Y
         LDY   #$002A
         LDA   [$7A],Y
         LDY   #$0028
         STA   [$7A],Y
         LDY   #$002E
         LDA   [$7A],Y
         LDY   #$002C
         STA   [$7A],Y
         LDY   #$0032
         LDA   [$7A],Y
         LDY   #$0030
         STA   [$7A],Y
         LDY   #$0038
         STA   [$7A],Y
         LDY   #$0036
         LDA   [$7A],Y
         LDY   #$0034
         STA   [$7A],Y
         LDY   #$0010
         LDA   [$7A],Y
         TAX
         LDY   #$0028
         LDA   [$7A],Y
         JSR   L0215A7
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$0020
         TAX
         LDY   #$0028
         LDA   [$7A],Y
         XBA
         JSR   L0215A7
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$0040
         TAX
         LDY   #$0016
         LDA   [$7A],Y
         JSR   L0215A7
         RTS

         PEA   ^L020844
         PEA   L020844
         PEA   ^L02075A
         PEA   L02075A
         PEA   $0000
         PEA   $0000
         PEA   $0000
         _PPToPort
         RTS

         PEA   ^L020786
         PEA   L020786
         _SetPort
         PEA   ^L020844
         PEA   L020844
         PEA   ^L02075A
         PEA   L02075A
         PEA   $0000
         PEA   $0000
         PEA   $0000
         _PPToPort
         LDA   L020748
         PHA
         LDA   L020746
         PHA
         _SetPort
         RTS

L02149D  PEA   ^L020786
         PEA   L020786
         PEA   ^L02075A
         PEA   L02075A
         PEA   $0000
         PEA   $0000
         PEA   $0000
         _PPToPort
         RTS

         PEA   ^L020844
         PEA   L020844
         _SetPort
         LDA   L020748
         PHA
         LDA   L020746
         PHA
         PEA   ^L02075A
         PEA   L02075A
         PEA   $0000
         PEA   $0000
         PEA   $0000
         _PPToPort
         LDA   L020748
         PHA
         LDA   L020746
         PHA
         _SetPort
         RTS

L0214F5  PEA   ^L020844
         PEA   L020844
         _SetPort
         PEA   ^L020786
         PEA   L020786
         PEA   ^L02075A
         PEA   L02075A
         PEA   $0000
         PEA   $0000
         PEA   $0000
         _PPToPort
         LDA   L020748
         PHA
         LDA   L020746
         PHA
         _SetPort
         RTS

L02152E  LDX   #$00A0
         JSR   L0215B2
         ORA   #$0001
         LDX   #$00A0
         JSR   L0215A7
         LDX   #$00A1
         JSR   L0215B2
         ORA   #$0001
         LDX   #$00A1
         JSR   L0215A7
         LDX   #$00A2
         JSR   L0215B2
         ORA   #$0001
         LDX   #$00A2
         JSR   L0215A7
         LDX   #$00A3
         JSR   L0215B2
         ORA   #$0001
         LDX   #$00A3
         JSR   L0215A7
         RTS

L02156B  PEA   $0000
         PEA   $0000
         _GetTableAddress
         PLA
         STA   $6A
         PLA
         STA   $6C
         LDY   #$0004
         LDA   [$6A],Y
         STA   L0215AA+1
         LDY   #$0006
         LDA   [$6A],Y
         SEP   #$20
         STA   L0215AA+3
         REP   #$20
         LDY   #$0000
         LDA   [$6A],Y
         STA   L0215B5+1
         LDY   #$0002
         LDA   [$6A],Y
         SEP   #$20
         STA   L0215B5+3
         REP   #$20
         RTS

L0215A7  SEP   #$20
         SEI
L0215AA  JSL   $123456
         CLI
         REP   #$20
         RTS

L0215B2  SEP   #$20
         SEI
L0215B5  JSL   $123456
         CLI
         REP   #$20
         RTS

L0215BD  _ACEExpBegin
         BCS   L0215BD
         pei   $5C
         pei   $5A
         PEA   $0000
         PEA   $0000
         pei   $64
         pei   $62
         PEA   $0000
         PEA   $0000
         LDA   L02163C
         ASL
         TAX
         LDA   L02164C,X
         PHA
         PEA   $0002
         _ACEExpand
         RTS

L0215F2  _ACEExpBegin
         BCS   L0215F2
         pei   $5C
         pei   $5A
         PEA   $0000
         PEA   $0000
         pei   $64
         pei   $62
         PEA   $0000
         PEA   $0000
         LDA   L02163C
         ASL
         TAX
         LDA   L02164C,X
         PHA
         PEA   $0001
         _ACEExpand
         RTS

L021627  LDY   L02163A
         LDX   #$0003
         LDA   #$0000
L021630  STA   [$66],Y
         INY
         INY
         DEX
         BPL   L021630
         RTS

L021638  DW    $0006
L02163A  DW    $0000
L02163C  DW    $0000
L02163E  DW    $0000
         DW    $0009
         DW    $0012
         DW    $001B
         DW    $0024
         DW    $002D
         DW    $0036
L02164C  DW    $0001
         DW    $0001
         DW    $0002
         DW    $0004
         DW    $0008
         DW    $0010
         DW    $0020
L02165A  DW    $0100
         DW    $0200
         DW    $0400
         DW    $0800
         DW    $1000
         DW    $2000
         DW    $4000
L021668  DW    $0000
         DW    $4000
         DW    $8000
         DW    $C000
L021670  DW    $0000
         DW    $0040
         DW    $0080
         DW    $00C0
         DW    $000F

L02167A  LDY   #$0006
         LDA   [$7A],Y
         CLC
         ADC   $7A
         STA   $22
         LDA   $7C
         STA   $24
         LDY   #$0002
         LDA   [$22],Y
         STA   L0217E9
         LDA   $22
         CLC
         ADC   #$0004
         STA   $22
         LDA   L0217E9
         BNE   L0216A0
         JMP   L0217AC

L0216A0  LDY   #$0000
         LDA   [$22],Y
         BNE   L0216AA
         JMP   L0217CD

L0216AA  BPL   L0216AF
         JMP   L0217E0

L0216AF  TAX
         LDY   #$0002
         LDA   [$22],Y
         TXY
         STA   [$7A],Y
         CPX   #$0002
         BNE   L021712
         CMP   #$0000
         BEQ   L0216C5
         JMP   L02179C

L0216C5  LDY   #$0000
         LDA   [$7A],Y
         CMP   #$0006
         BNE   L0216E7
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$00A0
         TAX
         PHX
         JSR   L0215B2
         ORA   #$0001
         PLX
         JSR   L0215A7
         JMP   L02179C

L0216E7  LDA   $34
         ASL
         ASL
         ASL
         TAX
         LDY   #$0014
         LDA   [$7A],Y
         STA   L020CB6,X
         LDY   #$001A
         LDA   [$7A],Y
         STA   L020CB8,X
         LDY   #$0024
         LDA   [$7A],Y
         STA   L020CBA,X
         LDY   #$0026
         LDA   [$7A],Y
         STA   L020CBC,X
         INC   $34
         JMP   L02179C

L021712  CPX   #$0012
         BNE   L021746
         LDY   #$0000
         LDA   [$7A],Y
         CMP   #$0006
         BNE   L021746
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$0040
         TAX
         LDY   #$0012
         LDA   [$7A],Y
         BNE   L02173D
         LDY   #$0016
         LDA   [$7A],Y
         JSR   L0215A7
         JMP   L02179C

L02173D  LDA   #$0000
         JSR   L0215A7
         JMP   L02179C

L021746  CPX   #$0032
         BNE   L021753
         LDY   #$0030
         STA   [$7A],Y
         JMP   L02179C

L021753  CPX   #$0044
         BNE   L021760
         LDY   #$0042
         STA   [$7A],Y
         JMP   L02179C

L021760  CPX   #$0050
         BNE   L02176D
         LDY   #$0060
         STA   [$7A],Y
         JMP   L02179C

L02176D  CPX   #$0058
         BNE   L021777
         LDY   #$0062
         STA   [$7A],Y
L021777  LDY   #$004C
         LDA   [$7A],Y
         BNE   L02179C
         CPX   #$0064
         BNE   L021785
         BRA   L021794
L021785  LDY   #$0000
         LDA   [$7A],Y
         CMP   #$0003
         BNE   L02179C
         CPX   #$006A
         BNE   L02179C
L021794  LDY   #$0064
         LDA   [$7A],Y
         DEC
         STA   [$7A],Y
L02179C  LDA   $22
         CLC
         ADC   #$0004
         STA   $22
         DEC   L0217E9
         BEQ   L0217AC
         JMP   L0216A0

L0217AC  LDY   #$0000
         LDA   [$22],Y
         BEQ   L0217B6
         CLC
         ADC   $36
L0217B6  LDY   #$000A
         STA   [$7A],Y
         LDY   #$0006
         LDA   $22
         SEC
         SBC   $7A
         STA   [$7A],Y
         LDA   $36
         LDY   #$000C
         STA   [$7A],Y
         RTS

L0217CD  LDY   #$0002
         LDA   [$22],Y
         LDY   #$0008
         CLC
         ADC   [$7A],Y
         LDY   #$0006
         STA   [$7A],Y
         JMP   L02167A

L0217E0  LDA   #$0001
         STA   L021E34
         JMP   L021242

L0217E9  DW    $0000

L0217EB  STZ   L021846
         LDX   #$0001
         LDA   #$0001
         STA   $84
         JSR   L021D48
         STZ   $84
L0217FB  LDX   #$0FA0
         STX   $86
         JSR   L021848
         BCC   L02180B
         CMP   #$001B
         BNE   L021828
         RTS

L02180B  INC   L021846
         LDA   L021846
         CMP   #$0004
         BNE   L02181C
         LDA   #$0000
         STA   L021846
L02181C  LDX   #$000B
         STX   $84
         JSR   L02241D
         STZ   $84
         BRA   L0217FB
L021828  STZ   $86
         LDX   L021846
         BNE   L021835
         JSR   L021D16
         JMP   L0217EB

L021835  CPX   #$0002
         BNE   L021840
         JSR   L021A08
         JMP   L0217EB

L021840  JSR   L0220D3
         JMP   L0217EB

L021846  DW    $0000
L021848  STX   L021897
L02184B  PEA   $0000
         PEA   $0408
         PEA   ^L02114C
         PEA   L02114C
         _GetNextEvent
         PLA
         BNE   L021868
L021861  DEC   L021897
         BNE   L02184B
         CLC
         RTS

L021868  LDX   $84
         BEQ   L02186E
         BRA   L021861
L02186E  LDA   L02114E
         CMP   #$0011
         BNE   L02187F
         LDA   $82
         EOR   #$0001
         STA   $82
         BRA   L021861
L02187F  LDX   $86
         BNE   L021895
         CMP   #$001B
         BEQ   L021895
         AND   #$005F
         CMP   #$0041
         BCC   L02184B
         CMP   #$005B
         BCS   L02184B
L021895  SEC
         RTS

L021897  DW    $0000

L021899  LDX   #$0001
         JSR   L021848
         BCC   L021899
         RTS
         JMP   L021899

L0218A5  LDA   L020927
         AND   #$00FF
L0218AB  SEC
         SBC   #$0019
         BPL   L0218AB
         CLC
         ADC   #$0019
         RTS

*L0218B6  JSL   GSOS
*         DW    $0020      ; GetDevNumber
*         ADRL  L021901
*         BCC   L0218C7
*         JSR   L0218DC
*         BRA   L0218B6
*L0218C7  LDA   L021905
*         STA   L02190F
*         JSL   GSOS
*         DW    $0022      ; READ_BLOCK
*         ADRL  L02190F
*         BCS   L0218DB
*         BRA   L0218B6
*L0218DB  RTS
*
*L0218DC  LDA   $46
*         CLC
*         ADC   #$647C
*         STA   $38
*         LDA   $48
*         STA   $3A
*         LDX   #$005C
*         LDY   #$0064
*         JSR   L020933
*         JSR   L0219A6
*         INC   $86
*         JSR   L021899
*         STZ   $86
*         JSR   L0219C6
*         JMP   L0219A6
*
*L021901  ADRL  L021907    ;  device name
*L021905  DW    $0000      ;  device num
*L021907  STR   '/SB.ABC'
*L02190F  DW    $0000      ;  device num
*         ADRL  $00000014  ;  buffer ptr
*         DW    $0055      ;  block num
*         DW    $0000

L021919  JSL   GSOS
         DW    $0009      ; SetPrefix for HDD
         ADRL  L0219F9
*         JSR   L02193E	; check it
*         BCS   L021929
*         RTS
*
*L021929  JSL   GSOS	; try disk 2
*         DW    $0009      ; SetPrefix
*         ADRL  L0219E6

L021933  JSR   L02193E	; check it
         BCC   L02193D	; ok
         JSR   L021981	; error
         BRA   L021933	; loop
L02193D  RTS

L02193E  LDA   #$0005
         ASL
         ASL
         TAX
         LDA   L021E36,X
         STA   L021957+1
         SEP   #$20
         LDA   L021E36+2,X
         STA   L021957+3
         REP   #$20
         LDX   #$000E
L021957  LDAL  $111111,X
         STA   L0204FF,X
         DEX
         DEX
         BPL   L021957
         JSL   GSOS
         DW    $0010      ; Open
         ADRL  L020511
         BCC   L02196F
         RTS

L02196F  LDA   L020511
         STA   L020529
         JSL   GSOS
         DW    $0014      ; Close
         ADRL  L020529
         CLC
         RTS

L021981  LDA   $46
         CLC
         ADC   #$6204
         STA   $38
         LDA   $48
         STA   $3A
         LDX   #$005C
         LDY   #$0064
         JSR   L020933
         JSR   L0219A6
         INC   $86
         JSR   L021899
         STZ   $86
         JSR   L0219C6
         JMP   L0219A6

L0219A6  LDA   #$005C
         STA   L020CB6
         LDA   #$0064
         STA   L020CB8
         LDA   #$0022
         STA   L020CBA
         LDA   #$000F
         STA   L020CBC
         LDA   #$0001
         STA   $34
         JMP   L020A24

L0219C6  LDA   #$005C
         STA   L02108A
         LDA   #$0064
         STA   L02108C
         LDA   #$0022
         STA   L02108E
         LDA   #$000F
         STA   L021090
         LDA   #$0001
         STA   $40
         JMP   L020DA8

L0219E6  DW    $0004      ;  prefix num
         ADRL  L0219EC    ;  prefix ptr
L0219EC  STR   '/ABC2/SCENES'

L0219F9  DW    $0004      ;  prefix num
         ADRL  L0219FF    ;  prefix ptr
L0219FF  STR   '1/SCENES'

L021A08  LDX   #$003A
         STX   $84
         LDA   #$0037
         JSR   L021D48
         STZ   $84
         JSR   L021209
L021A18  LDY   #$0004
         LDA   [$72],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         JSR   L021899
         CMP   #$001B
         BNE   L021A2F
         RTS

L021A2F  SEC
         SBC   #$0041
         STA   L022200
         ASL
         TAX
         LDA   L021BD5,X
         LDY   #$0026
         STA   [$7A],Y
         LDY   #$0038
         LDA   #$0000
         STA   [$7A],Y
         JSR   L0222CA
         LDA   L022200
         ASL
         STA   $7A
         ASL
         CLC
         ADC   $7A
         TAX
         LDY   #$0006
         LDA   [$72],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         LDY   #$0008
         LDA   [$7A],Y
         CLC
         ADC   $7A
         STA   $22
         LDA   $7C
         STA   $24
         LDA   L021AC3,X
         LDY   #$0006
         STA   [$22],Y
         LDA   L021AC5,X
         LDY   #$000E
         STA   [$22],Y
         LDA   L021AC7,X
         LDY   #$0016
         STA   [$22],Y
         JSR   L021AA0
         JSR   L02218E
         LDX   #$0026
         STX   $84
         JSR   L02241D
         STZ   $84
         JSR   L021209
         JMP   L021A18

L021AA0  LDA   #$000A
         STA   L02108A
         LDA   #$000A
         STA   L02108C
         LDA   #$0028
         STA   L02108E
         LDA   #$0032
         STA   L021090
         LDA   #$0001
         STA   $40
         JSR   L020DA8
         JMP   L0221E1

L021AC3  DW    $0001
L021AC5  DW    $0005
L021AC7  DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0000
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0000
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0003
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0001
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0003
         DW    $0005
         DW    $0005
         DW    $0000
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0002
         DW    $0005
         DW    $0005
         DW    $0001
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0003
         DW    $0005
         DW    $0005
         DW    $0001
         DW    $0005
         DW    $0005
         DW    $0003
         DW    $0005
         DW    $0005
         DW    $0002
         DW    $0005
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0003
         DW    $0002
         DW    $0005
         DW    $0004
         DW    $0005
         DW    $0005
         DW    $0002
         DW    $0005
         DW    $0005
         DW    $0000
         DW    $0005
         DW    $0005
         DW    $27A0
         DW    $0016
         DW    $024E
         DW    $0488
         DW    $06CE
         DW    $08FC
         DW    $0B34
L021B6D  DW    $0028
L021B6F  DW    $000E
         DW    $0024
         DW    $0003
         DW    $0024
         DW    $000E
         DW    $0026
         DW    $0003
         DW    $0022
         DW    $000E
         DW    $0020
         DW    $0003
         DW    $0026
         DW    $000F
         DW    $0028
         DW    $0003
         DW    $0016
         DW    $0009
         DW    $001C
         DW    $000A
         DW    $0026
         DW    $0003
         DW    $0022
         DW    $0003
         DW    $0030
         DW    $000E
         DW    $0026
         DW    $000E
         DW    $002C
         DW    $000E
         DW    $001E
         DW    $0010
         DW    $002C
         DW    $000E
         DW    $0026
         DW    $000E
         DW    $0024
         DW    $000E
         DW    $0022
         DW    $000A
         DW    $0026
         DW    $000E
         DW    $0026
         DW    $000E
         DW    $0038
         DW    $000E
         DW    $0024
         DW    $000E
         DW    $0020
         DW    $0012
         DW    $0024
         DW    $000E
L021BD5  DW    $0000
         DW    $055F
         DW    $0B18
         DW    $1392
         DW    $1A9A
         DW    $2142
         DW    $26FE
         DW    $2E93
         DW    $364D
         DW    $3C22
         DW    $433D
         DW    $495F
         DW    $4F52
         DW    $5604
         DW    $5D04
         DW    $62D5
         DW    $688F
         DW    $6E0A
         DW    $7417
         DW    $7B2E
         DW    $80DA
         DW    $85DC
         DW    $8AC0
         DW    $9236
         DW    $99A8
         DW    $A042

L021C09  LDAL  $E0C035
         AND   #$FFF7
         STAL  $E0C035
         LDA   #$000F
         STA   L021D0C
L021C1A  LDX   #$001E
L021C1D  STZ   L021D0E
         LDAL  $E19E00,X
         STA   L021D12
         LDAL  $E19E20,X
         STA   L021D14
         LDA   L021D14
         AND   #$000F
         STA   L021D10
         LDA   L021D12
         AND   #$000F
         CMP   L021D10
         BEQ   L021C46
         CLC
         ADC   #$0001
L021C46  STA   L021D0E
         LDA   L021D14
         AND   #$00F0
         STA   L021D10
         LDA   L021D12
         AND   #$00F0
         CMP   L021D10
         BEQ   L021C61
         CLC
         ADC   #$0010
L021C61  ORA   L021D0E
         STA   L021D0E
         LDA   L021D14
         AND   #$0F00
         STA   L021D10
         LDA   L021D12
         AND   #$0F00
         CMP   L021D10
         BEQ   L021C7F
         CLC
         ADC   #$0100
L021C7F  ORA   L021D0E
         STA   L021D0E
         STAL  $019E00,X
         DEX
         DEX
         BPL   L021C1D
         LDY   #$4000
L021C90  DEY
         BNE   L021C90
         DEC   L021D0C
         BPL   L021C1A
         LDAL  $E0C035
         ORA   #$0008
         STAL  $E0C035
         RTS

L021CA4  LDAL  $E0C035
         AND   #$FFF7
         STAL  $E0C035
         LDA   #$000F
         STA   L021D0C
L021CB5  LDX   #$001E
L021CB8  STZ   L021D0E
         LDAL  $E19E00,X
         PHA
         AND   #$000F
         BEQ   L021CCC
         SEC
         SBC   #$0001
         STA   L021D0E
L021CCC  PLA
         PHA
         AND   #$00F0
         BEQ   L021CDD
         SEC
         SBC   #$0010
         ORA   L021D0E
         STA   L021D0E
L021CDD  PLA
         AND   #$0F00
         BEQ   L021CED
         SEC
         SBC   #$0100
         ORA   L021D0E
         STA   L021D0E
L021CED  STAL  $019E00,X
         DEX
         DEX
         BPL   L021CB8
         LDY   #$4000
L021CF8  DEY
         BNE   L021CF8
         DEC   L021D0C
         BPL   L021CB5
         LDAL  $E0C035
         ORA   #$0008
         STAL  $E0C035
         RTS

L021D0C  DW    $0000
L021D0E  DW    $0000
L021D10  DW    $0000
L021D12  DW    $0000
L021D14  DW    $0000

L021D16  AND   #$005F
         SEC
         SBC   #$0041
         BMI   L021D26
         CMP   #$001A
         BCS   L021D26
         BRA   L021D29
L021D26  JSR   L0218A5
L021D29  ASL
         STA   $22
         TAX
         LDA   L02209F,X
         EOR   #$0001
         STA   L02209F,X
         CLC
         ADC   $22
         ADC   #$0002
         LDX   #$0000
         JSR   L021D48
         CMP   #$001B
         BNE   L021D16
         RTS

L021D48  PHX
         JSR   L021D6D
         LDA   $14
         STA   $4E
         LDA   $16
         STA   $50
         JSR   L02036D
         JSR   L0214F5
         JSR   L022202
         JSR   L021209
         JSR   L021CA4
         JSR   L02149D
         JSR   L021C09
         PLX
         JMP   L02241D

L021D6D  ASL
         ASL
         TAX
         LDA   L021E36,X
         STA   L021D83+1
         SEP   #$20
         LDA   L021E36+2,X
         STA   L021D83+3
         REP   #$20
         LDX   #$000E
L021D83  LDAL  $111111,X
         STA   L0204FF,X
         DEX
         DEX
         BPL   L021D83

         LDA   #L021E2E
         STA   L02051D
         LDA   #^L021E2E
         STA   L02051D+2
         LDA   #$0006
         STA   L020521
         JSL   GSOS
         DW    $0010      ; Open
         ADRL  L020511
         BCC   L021DAC
L021DAC  LDA   L020511
         STA   L02051B
         STA   L020529
         JSL   GSOS
         DW    $0012      ; Read
         ADRL  L02051B
         BCC   L021DC1
L021DC1  LDA   $72
         STA   L02051D
         LDA   $74
         STA   L02051D+2
         LDA   L021E2E
         STA   L020521
         JSL   GSOS
         DW    $0012      ; Read
         ADRL  L02051B
         LDA   $14
         STA   L02051D
         LDA   $16
         STA   L02051D+2
         LDA   L021E30
         STA   L020521
         JSL   GSOS
         DW    $0012      ; Read
         ADRL  L02051B
         LDA   $6E
         STA   L02051D
         LDA   $70
         STA   L02051D+2
         LDA   L021E32
         STA   L020521
         JSL   GSOS
         DW    $0012      ; Read
         ADRL  L02051B
         JSL   GSOS
         DW    $0014      ; Close
         ADRL  L020529
         LDY   #$0000
         LDA   [$72],Y
         STA   L02092F
         LDA   $72
         CLC
         ADC   #$0002
         STA   $76
         LDA   $74
         STA   $78
         RTS

L021E2E  DW    $0000
L021E30  DW    $0000
L021E32  DW    $0000
L021E34  DW    $0000

L021E36  ADRL  L021F16
         ADRL  L021F1C
         ADRL  L021F23
         ADRL  L021F2A
         ADRL  L021F30
         ADRL  L021F37
         ADRL  L021F3D
         ADRL  L021F43
         ADRL  L021F49
         ADRL  L021F50
         ADRL  L021F57
         ADRL  L021F5D
         ADRL  L021F63
         ADRL  L021F6A
         ADRL  L021F71
         ADRL  L021F78
         ADRL  L021F7F
         ADRL  L021F87
         ADRL  L021F8E
         ADRL  L021F95
         ADRL  L021F9B
         ADRL  L021FA2
         ADRL  L021FA9
         ADRL  L021FB1
         ADRL  L021FB8
         ADRL  L021FBF
         ADRL  L021FC6
         ADRL  L021FCD
         ADRL  L021FD4
         ADRL  L021FDB
         ADRL  L021FE2
         ADRL  L021FE9
         ADRL  L021FF0
         ADRL  L021FF7
         ADRL  L021FFE
         ADRL  L022006
         ADRL  L02200E
         ADRL  L022016
         ADRL  L02201D
         ADRL  L022023
         ADRL  L02202A
         ADRL  L022031
         ADRL  L022039
         ADRL  L02203F
         ADRL  L022046
         ADRL  L02204D
         ADRL  L022054
         ADRL  L02205C
         ADRL  L022063
         ADRL  L02206A
         ADRL  L022071
         ADRL  L022078
         ADRL  L02207E
         ADRL  L022087
         ADRL  L02208F
         ADRL  L022097

L021F16  STR   '1/Wel'
L021F1C  STR   '4/Game'
L021F23  STR   '4/Acro'
L021F2A  STR   '4/Air'
L021F30  STR   '4/Bird'
L021F37  STR   '4/Bee'
L021F3D  STR   '4/Car'
L021F43  STR   '4/Cow'
L021F49  STR   '4/Duck'
L021F50  STR   '4/Door'
L021F57  STR   '4/Ele'
L021F5D  STR   '4/Egg'
L021F63  STR   '4/Fire'
L021F6A  STR   '4/Fish'
L021F71  STR   '4/Goat'
L021F78  STR   '4/Goph'
L021F7F  STR   '4/House'
L021F87  STR   '4/Heli'
L021F8E  STR   '4/Isle'
L021F95  STR   '4/Ice'
L021F9B  STR   '4/Jump'
L021FA2  STR   '4/Jung'
L021FA9  STR   '4/Kanga'
L021FB1  STR   '4/Kiss'
L021FB8  STR   '4/Ladd'
L021FBF  STR   '4/Lion'
L021FC6  STR   '4/Moon'
L021FCD  STR   '4/Monk'
L021FD4  STR   '4/Nest'
L021FDB  STR   '4/Nose'
L021FE2  STR   '4/Octo'
L021FE9  STR   '4/Ostr'
L021FF0  STR   '4/Peng'
L021FF7  STR   '4/Pupp'
L021FFE  STR   '4/Queen'
L022006  STR   '4/Quiet'
L02200E  STR   '4/Roost'
L022016  STR   '4/Rabb'
L02201D  STR   '4/Saw'
L022023  STR   '4/Sail'
L02202A  STR   '4/Turt'
L022031  STR   '4/Tiger'
L022039  STR   '4/Uni'
L02203F  STR   '4/Umbr'
L022046  STR   '4/Viol'
L02204D  STR   '4/Volc'
L022054  STR   '4/Wagon'
L02205C  STR   '4/Wind'
L022063  STR   '4/Xylo'
L02206A  STR   '4/Xray'
L022071  STR   '4/Yoyo'
L022078  STR   '4/Yak'
L02207E  STR   '4/Zipper'
L022087  STR   '4/Zebra'
L02208F  STR   '4/Game2'
L022097  STR   '4/Game3'

L02209F  DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00
         DB    $00

         MX    %00
L0220D3  LDX   #$0001
         STX   $84
         LDA   #$0036
         JSR   L021D48
         STZ   $84
L0220E0  LDY   #$0008
         LDA   [$72],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         JSR   L0218A5
         STA   L022200
         ASL
         TAX
         LDA   L021BD5,X
         LDY   #$0026
         STA   [$7A],Y
         LDY   #$0038
         LDA   #$0000
         STA   [$7A],Y
         JSR   L0222CA
         LDX   #$0037
         STX   $84
         JSR   L02241D
         STZ   $84
         JSR   L021899
         CMP   #$001B
         BNE   L02211C
         RTS

L02211C  SEC
         SBC   #$0041
         CMP   L022200
         BEQ   L022164
         JSR   L02218E
         LDX   #$0096
         STX   $84
         JSR   L02241D
         STZ   $84
         JSR   L021209
         LDX   #$0037
         STX   $84
         JSR   L02241D
         STZ   $84
         JSR   L021899
         CMP   #$001B
         BNE   L022148
         RTS

L022148  SEC
         SBC   #$0041
         CMP   L022200
         BEQ   L022164
         LDX   #$0096
         STX   $84
         JSR   L02241D
         STZ   $84
         JSR   L021209
         JSR   L021AA0
         JMP   L0220E0

L022164  ASL
         STA   $22
         TAX
         LDA   L02209F,X
         EOR   #$0001
         STA   L02209F,X
         CLC
         ADC   $22
         ADC   #$0002
         LDX   #$001E
         STX   $88
         STX   $86
         JSR   L021D48
         STZ   $86
         STZ   $88
         CMP   #$001B
         BEQ   L02218D
         JMP   L0220D3
L02218D  RTS

L02218E  LDA   L022200
         CLC
         ADC   #$0041
         ASL
         TAY
         LDA   [$56],Y
         CLC
         ADC   $56
         ADC   #$0004
         STA   $38
         LDA   $58
         STA   $3A
         LDY   #$000A
         LDX   #$000A
         JSR   L020933
         LDA   L022200
         CLC
         ADC   #$0061
         ASL
         TAY
         LDA   [$56],Y
         CLC
         ADC   $56
         ADC   #$0004
         STA   $38
         LDA   $58
         STA   $3A
         LDA   L022200
         ASL
         ASL
         TAX
         LDA   L021B6F,X
         CLC
         ADC   #$000A
         TAY
         LDA   L021B6D,X
         CLC
         ADC   #$000A
         TAX
         JSR   L020933
         JMP   L0221E1

L0221E1  STZ   $34
         LDA   #$000A
         STA   L020CB6
         LDA   #$000A
         STA   L020CB8
         LDA   #$0028
         STA   L020CBA
         LDA   #$0032
         STA   L020CBC
         INC   $34
         JMP   L020A24

L022200  DW    $0000

L022202  LDY   #$0000
         LDA   [$76],Y
         STA   L021E34
         DEC   L021E34
         BPL   L022210
         RTS

L022210  LDA   L021E34
         ASL
         CLC
         ADC   #$0002
         ADC   $76
         STA   $7E
         LDA   $78
         STA   $80
         LDY   #$0000
         LDA   [$7E],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         LDY   #$0000
         LDA   [$7A],Y
         ASL
         TAX
         JSR   (L02240B,X)
         DEC   L021E34
         BPL   L022210
         RTS

L02223E  LDA   #$004C
         CLC
         ADC   $7A
         STA   $22
         LDA   $7C
         STA   $24
         JSR   L0223D8
         CLC
         RTS

L02224F  LDA   #$006A
         CLC
         ADC   $7A
         STA   $22
         LDA   $7C
         STA   $24
         JSR   L0223D8
         CLC
         RTS

L022260  LDY   #$0068
         LDA   [$7A],Y
         STA   $26
         DEC   $26
L022269  LDA   $26
         ASL
         STA   $28
         ASL
         ASL
         CLC
         ADC   $28
         ADC   #$006A
         ADC   $7A
         STA   $22
         LDA   $7C
         STA   $24
         JSR   L0223D8
         DEC   $26
         BPL   L022269
         RTS

L022286  LDY   #$0068
         LDA   [$7A],Y
         STA   $4E
         LDA   $7A
         CLC
         ADC   #$006E
         STA   $26
         LDA   $7C
         STA   $28
L022299  LDY   #$0000
         LDA   [$26],Y
         STA   $52
         LDA   $26
         CLC
         ADC   #$0002
         STA   $22
         LDA   $28
         STA   $24
L0222AC  JSR   L0223D8
         LDA   $22
         CLC
         ADC   #$000A
         STA   $22
         DEC   $52
         BNE   L0222AC
         DEC   $4E
         BEQ   L0222C9
         LDA   $26
         CLC
         ADC   #$00A2
         STA   $26
         BRA   L022299
L0222C9  RTS

L0222CA  LDY   #$0026
         LDA   [$7A],Y
         STA   L022419
         LDY   #$0038
         LDA   [$7A],Y
         STA   L02241B
         LDA   #L022419
         STA   $22
         LDA   #^L022419
         STA   $24
         JSR   L0223D8
         LDA   L022419
         STA   $22
         LDA   L02241B
         STA   $24
         LDY   #$0002
         LDA   [$22],Y
         STA   L02163A
         LDY   #$0004
         LDA   [$22],Y
         STA   L02163C
         LDA   $22
         CLC
         ADC   L021638
         STA   $26
         LDA   $24
         STA   $28
         LDY   #$3FFE
         LDA   #$8080
L022313  STA   [$66],Y
         DEY
         DEY
         BPL   L022313
         LDY   #$0000
         LDA   [$22],Y
         BNE   L022336
         LDY   L02163A
         DEY
         SEP   #$20
L022326  LDA   [$26],Y
         STA   [$66],Y
         DEY
         BNE   L022326
         LDA   [$26],Y
         STA   [$66],Y
         REP   #$20
         JMP   L022362

L022336  LDA   L02163C
         ASL
         TAX
         LDA   L02165A,X
         TAY
         DEY
         SEP   #$20
L022342  LDA   [$26],Y
         STA   [$5E],Y
         DEY
         BNE   L022342
         LDA   [$26],Y
         STA   [$5E],Y
         REP   #$20
         LDY   #$0000
         LDA   [$22],Y
         CMP   #$0001
         BNE   L02235F
         JSR   L0215F2
         JMP   L022362

L02235F  JSR   L0215BD
L022362  LDY   #$000E
         LDA   [$7A],Y
         BNE   L02236C
         JSR   L021627
L02236C  LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$00A0
         TAX
         PHX
         JSR   L0215B2
         JSR   L0215B2
         ORA   #$0001
         PLX
         JSR   L0215A7
         SEI
         pei   $68
         pei   $66
         LDY   #$0010
         LDA   [$7A],Y
         ASL
         TAX
         LDA   L021668,X
         PHA
         LDA   L02163C
         ASL
         TAX
         LDA   L02165A,X
         PHA
         _WriteRamBlock
         CLI
         LDY   #$0010
         LDA   [$7A],Y
         ASL
         TAX
         LDA   L021670,X
         PHA
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$0080
         TAX
         PLA
         JSR   L0215A7
         LDA   L02163C
         ASL
         TAX
         LDA   L02163E,X
         PHA
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$00C0
         TAX
         PLA
         JSR   L0215A7
         RTS

L0223D8  LDY   #$0002
         LDA   [$22],Y
         BPL   L0223E9
         LDA   $6E
         STA   $38
         LDA   $70
         STA   $3A
         BRA   L0223F6
L0223E9  ASL
         ASL
         TAX
         LDA   L0211ED,X
         STA   $38
         LDA   L0211ED+2,X
         STA   $3A
L0223F6  LDY   #$0000
         LDA   [$22],Y
         CLC
         ADC   $38
         LDY   #$0000
         STA   [$22],Y
         LDY   #$0002
         LDA   $3A
         STA   [$22],Y
         RTS

L02240B  DA    L02223E
         DA    L02224F
         DA    L022260
         DA    L022286
         DA    L020531
         DA    L020531
         DA    L0222CA

L022419  DW    $0000
L02241B  DW    $0000

L02241D  LDA   $88
         BEQ   L02244E
         PEA   $0000
         PEA   $0000
         PHX
         PEA   $003C
         _Multiply
         PLA
         STA   $22
         PLA
         STA   $24
         PEA   $0000
         PEA   $0000
         pei   $22
         LDA   L02092F
         PHA
         _UDivide
         PLX
         PLA
L02244E  CPX   #$0000
         BNE   L02245C
         LDA   #$0001
         STA   L022A3C
         JMP   L022462

L02245C  STX   L022A3E
         STZ   L022A3C
L022462  PEA   $0000
         PEA   $0008
         PEA   $0000
         _FlushEvents
         PLA
L022473  PEA   $0000
         PEA   $0000
         _GetTick
         PLA
         STA   L020927
         PLA
         STA   L020929
         LDA   L020927
         CLC
         ADC   L02092F
         STA   L02092B
         JSR   L022503
         LDA   L022A3C
         BNE   L0224A5
         DEC   L022A3E
         BNE   L0224A5
         PHA
         CLC
         PHP
         JMP   L0224B0

L0224A5  LDX   #$0001
         JSR   L021848
         BCC   L0224B6
         PHA
         SEC
         PHP
L0224B0  JSR   L02152E
         PLP
         PLA
         RTS

L0224B6  LDA   L020927
         BPL   L0224E0
         PEA   $0000
         PEA   $0000
         _GetTick
         PLA
         STA   L020927
         PLA
         STA   L020929
         LDA   L020927
         BMI   L0224D8
         JMP   L022473

L0224D8  CMP   L02092B
         BCC   L0224A5
         JMP   L022473

L0224E0  PEA   $0000
         PEA   $0000
         _GetTick
         PLA
         STA   L020927
         PLA
         STA   L020929
         LDA   L020927
         CMP   L02092B
         BCS   L022500
         JMP   L0224A5
L022500  JMP   L022473

L022503  JSR   L022987
         STZ   $34
         LDY   #$0000
         LDA   [$76],Y
         STA   L021E34
         DEC   L021E34
         BPL   L022518
         JMP   L022562

L022518  LDA   L021E34
         PHA
         ASL
         CLC
         ADC   #$0002
         ADC   $76
         STA   $7E
         LDA   $78
         STA   $80
         LDY   #$0000
         LDA   [$7E],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         LDY   #$000A
         LDA   [$7A],Y
         BEQ   L022545
         CMP   $36
         BNE   L022545
         JSR   L02167A
L022545  LDY   #$0002
         LDA   [$7A],Y
         BEQ   L022556
         LDY   #$0000
         LDA   [$7A],Y
         ASL
         TAX
         JSR   (L022A40,X)
L022556  PLA
         STA   L021E34
         DEC   L021E34
         BPL   L022518
         JSR   L020A24
L022562  INC   $36
         RTS

L022565  JSR   L022888
         JMP   L02256B

L02256B  LDY   #$004C
         LDA   [$7A],Y
         STA   $38
         INY
         INY
         LDA   [$7A],Y
         STA   $3A
         LDY   #$0012
         LDA   [$7A],Y
         STA   $2A
         LDY   #$0018
         LDA   [$7A],Y
         STA   $2C
         JMP   L02275E

L022589  JSR   L0227FF
         JMP   L02258F

L02258F  LDY   #$0064
         LDA   [$7A],Y
         ASL
         CLC
         ADC   #$006E
         TAY
         LDA   [$7A],Y
         LDY   #$006A
         CLC
         ADC   [$7A],Y
         STA   $38
         INY
         INY
         LDA   [$7A],Y
         STA   $3A
         LDY   #$0012
         LDA   [$7A],Y
         STA   $2A
         LDY   #$0018
         LDA   [$7A],Y
         STA   $2C
         JMP   L02275E

L0225BB  JSR   L0227FF
         JSR   L022888
         JMP   L0225C4

L0225C4  LDY   #$0064
         LDA   [$7A],Y
         ASL
         STA   $38
         ASL
         ASL
         CLC
         ADC   $38
         ADC   #$006A
         ADC   $7A
         STA   $4E
         LDA   $7C
         STA   $50
         LDY   #$0000
         LDA   [$4E],Y
         STA   $38
         LDY   #$0002
         LDA   [$4E],Y
         STA   $3A
         JMP   L022744

L0225ED  JSR   L0227FF
         JSR   L022888
         JMP   L0225F6

L0225F6  LDY   #$006A
         LDA   [$7A],Y
         TAY
         BEQ   L022608
         LDA   #$0000
L022601  CLC
         ADC   #$00A2
         DEY
         BNE   L022601
L022608  CLC
         ADC   #$006E
         ADC   $7A
         STA   $22
         LDA   $7C
         STA   $24
         LDY   #$0000
         LDA   [$22],Y
         STA   L022A3A
         LDY   #$0064
         LDA   [$7A],Y
         ASL
         STA   $38
         ASL
         ASL
         CLC
         ADC   $38
         ADC   $22
         ADC   #$0002
         STA   $4E
         LDA   $7C
         STA   $50
         LDY   #$0000
         LDA   [$4E],Y
         STA   $38
         LDY   #$0002
         LDA   [$4E],Y
         STA   $3A
         JMP   L022744

L022645  LDA   $82
         BEQ   L02264A
         RTS

L02264A  LDY   #$000E
         LDA   [$7A],Y
         BNE   L022674
         LDY   #$0002
         LDA   #$0000
         STA   [$7A],Y
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$00A0
         TAX
         PHX
         JSR   L0215B2
         AND   #$00F8
         ORA   #$0002
         PLX
         JSR   L0215A7
         JMP   L02269B

L022674  LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$00A0
         TAX
         JSR   L0215B2
         AND   #$0001
         BEQ   L02269B
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$00A0
         TAX
         PHX
         JSR   L0215B2
         AND   #$00F8
         PLX
         JSR   L0215A7
L02269B  LDY   #$0016
         LDA   [$7A],Y
         LDY   #$0022
         CMP   [$7A],Y
         BEQ   L0226D2
         LDY   #$001A
         LDA   [$7A],Y
         BEQ   L0226D2
         LDY   #$0026
         LDA   [$7A],Y
         BEQ   L0226BB
         DEC
         STA   [$7A],Y
         JMP   L0226D2

L0226BB  LDY   #$001E
         LDA   [$7A],Y
         LDY   #$0026
         STA   [$7A],Y
         LDY   #$001A
         LDA   [$7A],Y
         LDY   #$0016
         CLC
         ADC   [$7A],Y
         STA   [$7A],Y
L0226D2  LDY   #$0012
         LDA   [$7A],Y
         BNE   L0226EB
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$0040
         TAX
         LDY   #$0016
         LDA   [$7A],Y
         JSR   L0215A7
L0226EB  LDY   #$0028
         LDA   [$7A],Y
         LDY   #$0034
         CMP   [$7A],Y
         BEQ   L022722
         LDY   #$002C
         LDA   [$7A],Y
         BEQ   L022722
         LDY   #$0038
         LDA   [$7A],Y
         BEQ   L02270B
         DEC
         STA   [$7A],Y
         JMP   L022722

L02270B  LDY   #$0030
         LDA   [$7A],Y
         LDY   #$0038
         STA   [$7A],Y
         LDY   #$002C
         LDA   [$7A],Y
         LDY   #$0028
         CLC
         ADC   [$7A],Y
         STA   [$7A],Y
L022722  LDY   #$0010
         LDA   [$7A],Y
         TAX
         LDY   #$0028
         LDA   [$7A],Y
         JSR   L0215A7
         LDY   #$0010
         LDA   [$7A],Y
         CLC
         ADC   #$0020
         TAX
         LDY   #$0028
         LDA   [$7A],Y
         XBA
         JSR   L0215A7
         RTS

L022744  LDY   #$0012
         LDA   [$7A],Y
         LDY   #$0006
         CLC
         ADC   [$4E],Y
         STA   $2A
         LDY   #$0018
         LDA   [$7A],Y
         LDY   #$0008
         CLC
         ADC   [$4E],Y
         STA   $2C
L02275E  LDY   #$000E
         LDA   [$7A],Y
         BNE   L022768
         JMP   L0227EC

L022768  LDA   $34
         ASL
         ASL
         ASL
         TAX
         LDY   #$0014
         LDA   [$7A],Y
         CMP   $2A
         BEQ   L0227A4
         BCS   L02278F
         STA   L020CB6,X
         LDA   $2A
         SEC
         SBC   [$7A],Y
         LSR
         LSR
         INC
         LDY   #$0024
         CLC
         ADC   [$7A],Y
         STA   L020CBA,X
         BRA   L0227AF
L02278F  SBC   $2A
         LSR
         LSR
         INC
         LDY   #$0024
         CLC
         ADC   [$7A],Y
         STA   L020CBA,X
         LDA   $2A
         STA   L020CB6,X
         BRA   L0227AF
L0227A4  STA   L020CB6,X
         LDY   #$0024
         LDA   [$7A],Y
         STA   L020CBA,X
L0227AF  LDY   #$001A
         LDA   [$7A],Y
         CMP   $2C
         BEQ   L0227DF
         BCS   L0227CD
         STA   L020CB8,X
         LDA   $2C
         SEC
         SBC   [$7A],Y
         LDY   #$0026
         CLC
         ADC   [$7A],Y
         STA   L020CBC,X
         BRA   L0227EA
L0227CD  SBC   $2C
         LDY   #$0026
         CLC
         ADC   [$7A],Y
         STA   L020CBC,X
         LDA   $2C
         STA   L020CB8,X
         BRA   L0227EA
L0227DF  STA   L020CB8,X
         LDY   #$0026
         LDA   [$7A],Y
         STA   L020CBC,X
L0227EA  INC   $34
L0227EC  LDA   $2A
         LDY   #$0014
         STA   [$7A],Y
         TAX
         LDA   $2C
         LDY   #$001A
         STA   [$7A],Y
         TAY
         JMP   L020933

L0227FF  LDY   #$004C
         LDA   [$7A],Y
         BNE   L02286E
         LDY   #$0060
         LDA   [$7A],Y
         BEQ   L022813
         DEC
         STA   [$7A],Y
         JMP   L02286E

L022813  LDY   #$0050
         LDA   [$7A],Y
         LDY   #$0060
         STA   [$7A],Y
         LDY   #$005C
         CMP   [$7A],Y
         BEQ   L02284A
         LDY   #$0062
         LDA   [$7A],Y
         BEQ   L022830
         DEC
         STA   [$7A],Y
         BRA   L02284A
L022830  LDY   #$0058
         LDA   [$7A],Y
         LDY   #$0062
         STA   [$7A],Y
         LDY   #$0050
         LDA   [$7A],Y
         LDY   #$0054
         CLC
         ADC   [$7A],Y
         LDY   #$0050
         STA   [$7A],Y
L02284A  LDY   #$0000
         LDA   [$7A],Y
         CMP   #$0003
         BEQ   L02286F
         LDY   #$0064
         LDA   [$7A],Y
         INC
         STA   $22
         LDY   #$0068
         LDA   [$7A],Y
         CMP   $22
         BNE   L022867
         STZ   $22
L022867  LDY   #$0064
         LDA   $22
         STA   [$7A],Y
L02286E  RTS

L02286F  LDY   #$0064
         LDA   [$7A],Y
         INC
         STA   $22
         LDA   L022A3A
         CMP   $22
         BNE   L022880
         STZ   $22
L022880  LDY   #$0064
         LDA   $22
         STA   [$7A],Y
         RTS

L022888  LDY   #$0020
         LDA   [$7A],Y
         BEQ   L022890
         RTS

L022890  LDY   #$0028
         LDA   [$7A],Y
         LDY   #$0012
         CLC
         ADC   [$7A],Y
         STA   [$7A],Y
         LDY   #$003A
         LDA   [$7A],Y
         LDY   #$0018
         CLC
         ADC   [$7A],Y
         STA   [$7A],Y
         LDY   #$0036
         LDA   [$7A],Y
         LDY   #$0028
         CMP   [$7A],Y
         BEQ   L0228DA
         LDY   #$0030
         LDA   [$7A],Y
         BEQ   L0228C3
         DEC
         STA   [$7A],Y
         JMP   L0228DA

L0228C3  LDY   #$002C
         LDA   [$7A],Y
         CLC
         LDY   #$0028
         ADC   [$7A],Y
         STA   [$7A],Y
         LDY   #$0032
         LDA   [$7A],Y
         LDY   #$0030
         STA   [$7A],Y
L0228DA  LDY   #$0048
         LDA   [$7A],Y
         LDY   #$003A
         CMP   [$7A],Y
         BEQ   L02290A
         LDY   #$0042
         LDA   [$7A],Y
         BEQ   L0228F3
         DEC
         STA   [$7A],Y
         JMP   L02290A

L0228F3  LDY   #$003E
         LDA   [$7A],Y
         CLC
         LDY   #$003A
         ADC   [$7A],Y
         STA   [$7A],Y
         LDY   #$0044
         LDA   [$7A],Y
         LDY   #$0042
         STA   [$7A],Y
L02290A  LDY   #$0028
         LDA   [$7A],Y
         BPL   L022922
         LDY   #$0012
         LDA   [$7A],Y
         LDY   #$0028
         CLC
         ADC   [$7A],Y
         BEQ   L022940
         BMI   L022940
         BRA   L02294B
L022922  LDY   #$0012
         LDA   [$7A],Y
         STA   L022985
         LDY   #$0024
         LDA   [$7A],Y
         ASL
         ASL
         CLC
         ADC   L022985
         LDY   #$0028
         CLC
         ADC   [$7A],Y
         CMP   #$013F
         BCC   L02294B
L022940  LDY   #$0028
         LDA   [$7A],Y
         EOR   #$FFFF
         INC
         STA   [$7A],Y
L02294B  LDY   #$003A
         LDA   [$7A],Y
         BPL   L022963
         LDY   #$0018
         LDA   [$7A],Y
         LDY   #$003A
         CLC
         ADC   [$7A],Y
         BEQ   L022979
         BMI   L022979
         BRA   L022984
L022963  LDY   #$0018
         LDA   [$7A],Y
         LDY   #$0026
         CLC
         ADC   [$7A],Y
         LDY   #$003A
         CLC
         ADC   [$7A],Y
         CMP   #$00C7
         BCC   L022984
L022979  LDY   #$003A
         LDA   [$7A],Y
         EOR   #$FFFF
         INC
         STA   [$7A],Y
L022984  RTS

L022985  DW    $0000
L022987  STZ   $40
         LDY   #$0000
         LDA   [$76],Y
         STA   L021E34
         DEC   L021E34
         BPL   L022997
         RTS

L022997  LDA   L021E34
         ASL
         CLC
         ADC   #$0002
         ADC   $76
         STA   $7E
         LDA   $78
         STA   $80
         LDY   #$0000
         LDA   [$7E],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         LDY   #$0002
         LDA   [$7A],Y
         BEQ   L0229C6
         LDY   #$0000
         LDA   [$7A],Y
         ASL
         TAX
         JSR   (L022A4E,X)
L0229C6  DEC   L021E34
         BPL   L022997
         JMP   L020DA8

L0229CE  LDA   $40
         ASL
         ASL
         ASL
         TAX
         LDY   #$0014
         LDA   [$7A],Y
         STA   L02108A,X
         LDY   #$001A
         LDA   [$7A],Y
         STA   L02108C,X
         LDY   #$0024
         LDA   [$7A],Y
         STA   L02108E,X
         LDY   #$0026
         LDA   [$7A],Y
         STA   L021090,X
         INC   $40
         RTS

L0229F7  LDY   #$0000
         LDA   [$76],Y
         STA   L021E34
         DEC   L021E34
         BPL   L022A05
         RTS

L022A05  LDA   L021E34
         ASL
         CLC
         ADC   #$0002
         ADC   $76
         STA   $7E
         LDA   $78
         STA   $80
         LDY   #$0000
         LDA   [$7E],Y
         CLC
         ADC   $72
         STA   $7A
         LDA   $74
         STA   $7C
         LDY   #$0002
         LDA   [$7A],Y
         BEQ   L022A34
         LDY   #$0000
         LDA   [$7A],Y
         ASL
         TAX
         JSR   (L022A5C,X)
L022A34  DEC   L021E34
         BPL   L022A05
         RTS

L022A3A  DW    $0000
L022A3C  DW    $0000
L022A3E  DW    $0000
L022A40  DA    L022565
         DA    L022589
         DA    L0225BB
         DA    L0225ED
         DA    L020531
         DA    L020531
         DA    L022645
L022A4E  DA    L0229CE
         DA    L0229CE
         DA    L0229CE
         DA    L0229CE
         DA    L020531
         DA    L020531
         DA    L020531
L022A5C  DA    L02256B
         DA    L02258F
         DA    L0225C4
         DA    L0225F6
         DA    L020531
         DA    L020531
         DA    L020531
