; Attack of the Mutant Camels
; ported to the Plus/4 by Ulrich Hecht <ulrich.hecht@gmail.com>

bogus1 = $1
L2 = $02
L3 = $03
L4 = $04
L5 = $05
L6 = $06
L7 = $07
L8 = $08
L9 = $09
LA = $0A
LB = $0B
LC = $0C
LD = $0D
LE = $0E
L10 = $10
L11 = $11
L12 = $12
L13 = $13
L14 = $14
L15 = $15
L16 = $16
L17 = $17
L18 = $18
L19 = $19
L1A = $1A
L1B = $1B
L1C = $1C
L1D = $1D
L1E = $1E
L22 = $22
L23 = $23
L24 = $24
L25 = $25
L26 = $26
L27 = $27
L28 = $28
L29 = $29
L2A = $2A
L2B = $2B
L2C = $2C
L2D = $2D
L2E = $2E
L2F = $2F
L30 = $30
L31 = $31
L32 = $32
L33 = $33
L34 = $34
L35 = $35
L36 = $36
L37 = $37
L38 = $38
L39 = $39
L3A = $3A
L3B = $3B
L3C = $3C
L3D = $3D
L3E = $3E
L3F = $3F
L40 = $40
L41 = $41
L48 = $48
L49 = $49
L50 = $50
L5A = $5A
CurrentKeyPressed = $7f6 ; check
boguse6 = $E6
bogusee = $EE
bogusef = $EF
bogusf1 = $F1
bogusf3 = $F3
bogusf4 = $F4
bogusfa = $FA
SHFLAG = $543 ; check
MODE = $547 ; check
TapeBuf4h = $336 ; check
TapeBuf24h = $356 ; check
VideoMatrixMinus1 = $bff ; check
VideoMatrix = $c00 ; check
VideoMatrix9h = $c09 ; check
VideoMatrix15h = $c15 ; check
VideoMatrix78h = $c78 ; check
VideoMatrix100h = $d00 ; check
VideoMatrix200h = $e00 ; check
VideoMatrix226h = $e26 ; check
VideoMatrix300h = $f00 ; check
L1300 = $6300
L1320 = $6320
L14F0 = $64F0
L14F1 = $64F1
L1509 = $6509
L18FF = $68FF
L1900 = $6900
L1901 = $6901
L197F = $697F
L1980 = $6980
L1981 = $6981
L19FF = $69FF
L1A00 = $6A00
L1A01 = $6A01
L1A80 = $6A80
L1A81 = $6A81
L1B00 = $6B00
L1B01 = $6B01
L1B80 = $6B80
L1B81 = $6B81
L1C00 = $6C00
L1C80 = $6C80
L1D00 = $6D00
CustomCharSetMinus1 = $3fff
CustomCharSet = $4000
CustomCharSet7h = $4007
CustomCharSet100h = $4100
CustomCharSet109h = $4109
CustomCharSet200h = $4200
CustomCharSet2d8h = $42D8
CustomCharSet300h = $4300
CustomCharSet3b7h = $43B7
CustomCharSet3c7h = $43C7
CustomCharSet3ffh = $43FF
CustomCharSet400h = $4400
L4000 = $5000
L4001 = $5001
L4002 = $5002
L4003 = $5003
L4004 = $5004
VICRasterReg = $ff0b ; check
;VICContROL_AReg2 = $D016
;VICMemoryContROL_AReg = $D018
TEDReg12h = $ff12
TEDReg13h = $ff13
VICBorderColor = $ff19 ; check
VICBGColor0 = $ff15 ; check
SIDVoc1FreqLo = $FD40
SIDVoc1FreqHi = $FD41
SIDVoc1ContROL_AReg = $FD44
SIDVoc1EnvSusRel = $FD46
SIDVoc2FreqHi = $FD48
SIDVoc2ContROL_AReg = $FD4B
SIDVoc2EnvAttDec = $FD4C
SIDVoc2EnvSusRel = $FD4D
SIDVoc3FreqHi = $FD4F
SIDVoc3ContROL_AReg = $FD52
SIDVoc3EnvAttDec = $FD53
SIDVoc3EnvSusRel = $FD54
SIDFilterModeVolume = $FD58
ColorRAMMinus1 = $7ff ; check
ColorRAM78h = $878 ; check
ColorRAM100h = $900 ; check
ColorRAM200h = $a00 ; check
ColorRAM300h = $b00 ; check
;Joy1 = $DC01
	      ; used by cold-start code (we don't need that)
;LE518 = $E518
;LFD15 = $FD15
;LFD50 = $FD50
;LFDA3 = $FDA3
;LFFD2 = $FFD2

	ORG $1001-2
	DW  $1001
	
	DW $100B,0
	DB $9E,"4112",0,0,0
	
; cart header
;   DB $D3,$9B,$BC
;   DB $FE,$C3,$C2
;   DB $CD,$38,$30

	DB $0,$0,$0
L8009:
   NOP
   NOP
   NOP
L800C:
   LDA #$1
   STA L13
   JMP L9BB3
L8013:
   LDA #$8
   STA L5A
L8017:
   DEY
   BNE L8017
L801A:
   DEC L5A
   BNE L8017
L801E:
   RTS
L801F:
   BNE L8013
L8021:
   RTS
L8022:
   ;LDA #$4
   LDA #$c
   STA L49
   LDA #$0
   STA L48
   LDX #$0
L802C:
   LDA L48
   STA TapeBuf4h,X
   LDA L49
   STA TapeBuf24h,X
   LDA L48
   CLC
   ADC #$28
   STA L48
   LDA L49
   ADC #$0
   STA L49
   INX
   CPX #$18
   BNE L802C
L8048:
   RTS
L8049:
   LDX L3
   LDY L2
   LDA TapeBuf4h,X
   STA L48
   LDA TapeBuf24h,X
   STA L49
   RTS
L8058:
   JSR L8049
   LDA (L48),Y
   RTS
L805E:
   JSR L8049
   LDA L4
   STA (L48),Y
   LDA L49
   ;CLC
   ;ADC #$D4
   SEC
   SBC #$4
   CLC
   STA L49
   LDA L5
   STA (L48),Y
   RTS
L8071:
   LDX #$0
L8073:
   LDA #$20
   STA VideoMatrix,X
   STA VideoMatrix100h,X
   STA VideoMatrix200h,X
   STA VideoMatrix300h,X
   DEX
   BNE L8073
L8084:
   RTS
L8085:
   LDA #$0
   LDX #$18
L8089:
   STA SIDVoc1FreqLo,X
   DEX
   BNE L8089
L808F:
   LDA #$0
   STA L4000
   STA SIDVoc2EnvAttDec
   STA SIDVoc3EnvAttDec
   LDA #$30
   LDX #$7
L809E:
   STA L14F0,X
   DEX
   BNE L809E
L80A4:
   LDA #$A0
   STA SIDVoc1EnvSusRel
   STA SIDVoc2EnvSusRel
   STA SIDVoc3EnvSusRel
   LDA #$80
   STA MODE
   LDA #$0
   NOP
   STA VICBGColor0
   STA VICBorderColor
   ;LDA #$18
   ;STA VICMemoryContROL_AReg
   LDA #$40	; charset at $4000
   STA TEDReg13h
   LDA #$c0	; charset in RAM
   STA TEDReg12h
   LDA $ff07
   ORA #$88
   STA $ff07 ; reverse mode off
   JSR L8071
   JSR L8022
   JMP L80FB
L80CB:
   LDA #$11
   STA SIDVoc2ContROL_AReg
   RTS
L80D1:
   LDA #$21
   STA SIDVoc3ContROL_AReg
   RTS
L80D7:
   LDA #$81
   STA SIDVoc1ContROL_AReg
   RTS
shutUp:
   LDA #$0
   STA SIDVoc3ContROL_AReg
   STA SIDVoc1ContROL_AReg
   STA SIDVoc2ContROL_AReg
   RTS
L80E9:
   LDX #$2E
L80EB:
   LDA L8103,X
   STA VideoMatrixMinus1,X
   LDA L8131,X
   STA ColorRAMMinus1,X
   DEX
   BNE L80EB
L80FA:
   RTS
L80FB:
   JSR L80E9
   JSR L9880
L8103 = * + 2
   JMP L81BC
   DB $23,$24,$22
   DB $25,$26,$27
   DB $20,$19,$1A
   DB $20,$30,$30
   DB $30,$30,$30
   DB $30,$30,$20
   DB $20,$7,$20
   DB $35,$20,$20
   DB $3F,$20,$31
   DB $39,$38,$33
   DB $20,$20,$48
   DB $20,$45,$20
   DB $53,$20,$20
   DB $20,$21,$21
   DB $21,$21,$21
L8131:
   DB $21
   ; colors
   DB $63,$63
   DB $63,$63,$63
   DB $63,$00,$44
   DB $44,$00,$77
   DB $77,$77,$77
   DB $77,$77,$77
   DB $00,$00,$45
   DB $00,$63,$00
   DB $44,$71,$44
   DB $44,$44,$44
   DB $44,$77,$77
   DB $77,$77,$77
   DB $77,$77,$77
   DB $77,$77,$44
   DB $44,$44,$44
L815F = * + 1
   DB $44,$44,$36
   DB $32,$44,$45
   DB $63,$77,$71
L8167:
   JSR shutUp
   LDA #$F
   STA SIDFilterModeVolume
   RTS
L8170:
   LDX L2
L8172:
   LDY L3
L8174:
   DEY
   BNE L8174
L8177:
   DEX
   BNE L8172
L817A:
   RTS
L817B:
   ;LDA #$4
   LDA #$c
   STA L49
   LDA #$A0
   STA L48
L8183:
   LDA #$0
   LDY #$26
L8187:
   STA (L48),Y
   DEY
   BNE L8187
L818C:
   LDA L49
   PHA
   ;CLC
   ;ADC #$D4
   SEC
   SBC #$4
   CLC
   STA L49
   LDX L6
   LDA L815F,X
   LDY #$26
L819B:
   STA (L48),Y
   DEY
   BNE L819B
L81A0:
   LDA L48
   ADC #$28
   STA L48
   PLA
   ADC #$0
   STA L49
   INC L6
   LDA L6
   CMP #$8
   BNE L81B7
L81B3:
   LDA #$1
   STA L6
L81B7:
   DEC L7
   BNE L8183
L81BB:
   RTS
L81BC:
   LDA #$2
   STA SIDVoc3FreqHi
   LDA #$3
   STA SIDVoc2FreqHi
   JSR L80CB
   JSR L80D1
   LDA #$0
   LDX #$8
L81D0:
   STA CustomCharSetMinus1,X
   DEX
   BNE L81D0
L81D6:
   LDA #$13
   STA L8
   LDA #$1
   STA L9
L81DE:
   LDA L9
   STA L6
   LDA #$14
   SEC
   SBC L8
   STA L7
   LDA L4000
   STA SIDFilterModeVolume
   INC L4000
   LDA L4000
   CMP #$10
   BNE L81FC
L81F9:
   DEC L4000
L81FC:
   JSR L817B
   LDX #$0
L8201:
   LDA #$FF
   STA CustomCharSet,X
   TXA
   PHA
   LDA #$80
   STA L2
   LDA #$10
   STA L3
   JSR L8170
   PLA
   TAX
   JSR L8013
   LDA #$0
   STA CustomCharSet,X
   INX
   CPX #$8
   BNE L8201
L8222:
   DEC L9
   BNE L822A
L8226:
   LDA #$7
   STA L9
L822A:
   DEC L8
   BNE L81DE
L822E:
   LDX #$8
L8230:
   LDA #$FF
   STA CustomCharSetMinus1,X
   TXA
   PHA
   LDA #$F0
   STA L2
   LDA #$10
   STA L3
   JSR L8170
   PLA
   TAX
   DEX
   BNE L8230
L8247:
   ;LDA #$66
   LDA #$36
   LDX #$0
L824B:
   STA ColorRAM78h,X
   STA ColorRAM100h,X
   STA ColorRAM200h,X
   STA ColorRAM300h,X
   INX
   BNE L824B
L825A:
   LDA #$3
   STA L6
   LDA #$0
   STA L7
   JSR shutUp
   JSR L80CB
L8268:
   LDX #$60
   LDA #$F
   STA L4000
L826F:
   STX SIDVoc2FreqHi
   LDY #$0
L8274:
   DEY
   BNE L8274
L8277:
   DEX
   BNE L826F
L827A:
   LDY #$8
L827C:
   LDX L7
   LDA CustomCharSet2d8h,X
   STA CustomCharSetMinus1,Y
   INC L7
   DEY
   BNE L827C
L8289:
   LDA L4000
   SBC #$4
   STA L4000
   STA SIDFilterModeVolume
   DEC L6
   BNE L8268
L8298:
   JSR L9300
   JSR shutUp
   JSR L9382
   LDA #$90
   STA L4001
   STA SIDVoc1FreqHi
   JSR L80D7
   LDA #$15
   STA LB
   LDA #$14
   STA LA
   LDA #$9
   STA L6
L82B8:
   LDA #$F
   SEC
   SBC L6
   STA SIDFilterModeVolume
   LDA LA
   SEC
   SBC L6
   STA L2
   LDA LB
   SBC L6
   SEC
   STA L3
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   JSR L805E
   LDA LA
   CLC
   ADC L6
   STA L2
   JSR L805E
   DEC L6
   DEC L2
   INC L3
   LDA #$17
   STA L4
   ;LDA #$3
   LDA #$63
   STA L5
   JSR L805E
   LDA LA
   SEC
   SBC L6
   STA L2
   DEC L4
   JSR L805E
   LDA L6
   CLC
   ADC #$1
   ASL A
   ASL A
   ASL A
   STA L2
   LDA #$0
   STA L3
   JSR L8170
   LDA L6
   CMP #$0
   BNE L82B8
L8317:
   JSR shutUp
   LDA #$F
   STA L4000
   JSR L80D1
   LDA #$3
   STA L6
L8326:
   LDA #$35
   CLC
   ADC L6	; FIXME need a color translation table here
   LDX #$0
L832D:
   STA ColorRAM78h,X
   STA ColorRAM100h,X
   STA ColorRAM200h,X
   STA ColorRAM300h,X
   DEX
   BNE L832D
L833C:
   LDA LA
   STA L2
   LDA LB
   STA L3
   LDA #$7
   STA L4
   ;LDA #$5
   LDA #$45
   STA L5
   JSR L805E
   LDA #$C0
   STA L4004
L8354:
   LDY #$0
L8356:
   DEY
   BNE L8356
L8359:
   DEC L4004
   LDA L4004
   STA SIDVoc3FreqHi
   CMP #$80
   BNE L8354
L8366:
   LDA L4000
   SBC #$5
   STA L4000
   STA SIDFilterModeVolume
   DEC L6
   BNE L8326
L8375:
   JSR L8167
   LDA #$0
   LDX #$20
L837C:
   STA L1320,X
   DEX
   BNE L837C
L8382:
   STA L10
   STA L17
   STA L39
   STA L1E
   STA L28
   STA L31
   STA L36
   STA L3D
   STA L40
   STA LE
   LDA #$3
   STA L15
   LDA #$1
   STA L14
   STA L16
   LDA #$2
   STA L35
   LDA #$20
   STA L26
   STA L27
   STA L2D
   STA L2E
   LDA #$13
   STA L29
   LDA #$40
   STA L2B
   STA L2C
   LDA #$4
   STA L41
   LDA #$F
   STA L4000
   STA SIDFilterModeVolume
L83C4:
   JSR L83F5
   JSR L8530
   JSR L85C6
   JSR L8699
   JSR L893E
   JSR L90E5
   JSR L850A
   JMP L83C4
L83DC:
   ;LDA Joy1
   LDA #$fb
   STA $ff08
   LDA $ff08
   TAX
   AND #$40
   BNE nobutton
   TXA
   AND #$f
   ORA #$e0
   JMP feddich
nobutton:
   TXA
   ORA #$f0
feddich:
   ;lda #$ef	; auto fire (for debugging)
   EOR #$1F
L83E2 = * + 1
   STA LD
L83E3:
   RTS
L83E4:
   DB $2,$D,$E
   DB $F,$10,$11
L83EC = * + 2
   DB $12,$A,$8
   DB $3,$4,$5
   DB $6,$A,$13
   DB $14,$15
L83F5:
   DEC LE
   DEC LE
   BEQ L8405
L83FB:
   LDA LE
   CMP #$80
   BEQ L8402
L8401:
   RTS
L8402:
   JMP L84EB
L8405:
   JSR L83DC
   JSR L94A6
   LDA LA
   STA L2
   CMP #$3
   BEQ L8417
L8413:
   CMP #$25
   BNE L841D
L8417:
   LDA L41
   AND #$FB
   STA L41
L841D:
   LDA LB
   STA L3
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   JSR L805E
   LDA LD
   AND #$1
   BEQ L843C
L8432:
   DEC L3
   LDA L3
   CMP #$6
   BNE L843C
L843A:
   INC L3
L843C:
   LDA LD
   AND #$2
   BEQ L844C
L8442:
   INC L3
   LDA L3
   CMP #$16
   BNE L844C
L844A:
   DEC L3
L844C:
   LDA #$0
   STA LC
   LDA LD
   AND #$4
   BEQ L8464
L8456:
   LDA #$1
   STA LC
   DEC L2
   BNE L8464
L845E:
   INC L2
   LDA #$0
   STA LC
L8464:
   LDA LD
   AND #$8
   BEQ L847C
L846A:
   LDA #$2
   STA LC
   INC L2
   LDA L2
   CMP #$27
   BNE L847C
L8476:
   DEC L2
   LDA #$0
   STA LC
L847C:
   JSR L882E
   LDA LD
   AND #$10
   BEQ L84A2
L8485:
   LDA L10
   BNE L84A2
L8489:
   LDA LA
   STA L11
   LDA LB
   STA L12
   DEC L12
   LDA #$1
   STA L10
   LDA #$70
   STA L4001
   STA SIDVoc1FreqHi
   JSR L80D7
L84A2:
   LDA LC
   BNE L84B9
L84A6:
   LDA LA
   STA L2
   LDA LB
   STA L3
   LDA #$7
   STA L4
   ;LDA #$5
   LDA #$45
   STA L5
   JMP L805E
L84B9:
   LDA LB
   STA L3
   ;LDA #$5
   LDA #$45
   STA L5
   LDA LC
   CMP #$2
   BEQ L84D9
L84C7:
   LDA #$B
   STA L4
   LDA LA
   STA L2
   JSR L805E
   INC L4
   INC L2
   JMP L805E
L84D9:
   LDA #$C
   STA L4
   LDA LA
   STA L2
   JSR L805E
   DEC L4
   DEC L2
   JMP L805E
L84EB:
   LDA LC
   BNE L84F0
L84EF:
   RTS
L84F0:
   JSR L84A6
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   INC L2
   LDA LC
   CMP #$2
   BNE L8507
L8503:
   DEC L2
   DEC L2
L8507:
   JMP L805E
L850A:
   LDA #$6
   LDA CurrentKeyPressed
   CMP #$40
   BNE L8513
L8512:
   RTS
L8513:
   LDA SHFLAG
   AND #$7
   CMP #$7
   BEQ L852D
L851C:
   CMP #$2
   BNE L8512
L8520:
   LDA CurrentKeyPressed
   CMP #$40
   BNE L8520
L8526:
   LDA CurrentKeyPressed
   CMP #$40
   BEQ L8526
L852C:
   RTS
L852D:
   JMP L94B6
L8530:
   DEC L13
   BEQ L8535
L8534:
   RTS
L8535:
   LDA #$30
   STA L13
   LDA L4001
   BEQ L8551
L853E:
   DEC L4001
   DEC L4001
   LDA L4001
   STA SIDVoc1FreqHi
   BNE L8551
L854C:
   LDA #$0
   STA SIDVoc1ContROL_AReg
L8551:
   LDA L10
   BEQ L8534
L8555:
   AND #$F0
   BEQ L856E
L8559:
   CMP #$10
   BNE L8560
L855D:
   JMP L9010
L8560:
   CMP #$20
   BNE L8567
L8564:
   JMP L90A4
L8567:
   CMP #$30
   BNE L856E
L856B:
   JMP L905F
L856E:
   LDA L10
   AND #$2
   BNE L8590
L8574:
   ;LDA #$1
   LDA #$71
   STA L5
   LDA L11
   STA L2
   LDA L12
   STA L3
   JSR L8856
   LDA #$9
   STA L4
   LDA L10
   EOR #$2
   STA L10
   JMP L805E
L8590:
   LDA L11
   STA L2
   LDA L12
   STA L3
   ;LDA #$66
   LDA #$36
   STA L5
   LDA #$0
   STA L4
   JSR L805E
   DEC L12
   DEC L3
   LDA L3
   CMP #$2
   BNE L85B2
L85AD:
   LDA #$0
   STA L10
   RTS
L85B2:
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$8
   STA L4
   LDA L10
   EOR #$2
   STA L10
   JSR L8856
   JMP L805E
L85C6:
   LDA LE
   CMP #$30
   BEQ L85CD
L85CC:
   RTS
L85CD:
   DEC L16
   BNE L85CC
L85D1:
   JSR L88AE
   LDA #$2
   STA L16
   JSR L93F3
   JSR L8794
   LDA L17
   BNE L8616
L85E2:
   LDA #$3C
   STA L4
   ;LDA #$3
   LDA #$63
   STA L5
   LDA #$0
   STA L2
   LDA L15
   STA L3
   JSR L805E
   INC L4
   INC L3
   JSR L805E
   LDA #$16
   STA L3
   LDA #$3A
   STA L4
   LDA L14
   STA L2
   JSR L805E
   INC L2
   INC L4
   LDA #$1
   STA L17
   JMP L805E
L8616:
   LDA #$20
   STA L4
   LDA #$0
   STA L2
   LDA L15
   STA L3
   JSR L805E
   INC L3
   JSR L805E
   LDA #$16
   STA L3
   LDA L14
   STA L2
   JSR L805E
   INC L2
   JSR L805E
   INC L14
   LDA L14
   CMP #$27
   BNE L8646
L8642:
   LDA #$1
   STA L14
L8646:
   INC L15
   LDA L15
   CMP #$16
   BNE L8652
L864E:
   LDA #$3
   STA L15
L8652:
   LDA #$0
   STA L17
   ;LDA #$3
   LDA #$63
   STA L5
   LDA L14
   STA L2
   LDA #$2
   STA L4
   JSR L805E
   LDA #$0
   STA L2
   LDA L15
   STA L3
   LDA #$1
   STA L4
   JSR L805E
   LDA L36
   AND #$80
   BEQ L8684
L867A:
   LDA L14
   CMP LA
   BNE L8684
L8680:
   LDA #$1
   STA L18
L8684:
   LDA L18
   BEQ L869F
L8688:
   DEC L18
   BNE L869F
L868C:
   LDA L14
   STA L1B
   LDA L15
   STA L1C
   LDA #$1
   STA L1A
   RTS
L8699:
   LDA L13
   CMP #$2
   BEQ L86A0
L869F:
   RTS
L86A0:
   JSR L88B8
   JSR L8CDB
   LDA L18
   BNE L869F
L86AA:
   LDA L1A
   CMP L1B
   BEQ L86DF
L86B0:
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   LDA L1A
   STA L2
   LDA L1C
   STA L3
   JSR L805E
   INC L1A
   INC L2
   JMP L86CD
L86CA:
   JMP L94D3
L86CD:
   ;LDA #$1
   LDA #$71
   STA L5
   INC L1D
   LDA L1D
   AND #$1
   CLC
   ADC #$3
   STA L4
   JSR L805E
L86DF:
   LDA #$15
   STA L3
   LDA L1B
   STA L2
   LDA L1D
   AND #$1
   CLC
   ADC #$5
   STA L4
L86F0:
   JSR L805E
   DEC L3
   LDA L3
   CMP #$2
   BNE L86F0
L86FB:
   LDA L1B
   CMP LA
   BEQ L86CA
L8701:
   LDA L1A
   CMP L1B
   BEQ L8708
L8707:
   RTS
L8708:
   LDA #$15
   STA L3
   ;LDA #$66
   LDA #$36
   STA L5
   LDA #$0
   STA L4
   LDA L1B
   STA L2
L8718:
   JSR L805E
   DEC L3
   LDA L3
   CMP #$2
   BNE L8718
L8723:
   LDA L1C
   STA L3
   ;LDA #$7
   LDA #$77
   STA L5
   LDA #$F
   STA L4
   JSR L805E
   LDA L19
   STA L18
   LDA #$A0
   STA L6
   ;LDA #$4
   LDA #$c
   STA L7
   LDA L41
   ORA #$8
   STA L41
   LDY #$0
L8746:
   LDA (L6),Y
   BEQ L874D
L874A:
   JSR L875A
L874D:
   INC L6
   BNE L8746
L8751:
   INC L7
   LDA L7
   ;CMP #$8
   CMP #$10
   BNE L8746
L8759:
   RTS
L875A:
   CMP #$20
   BNE L875F
L875E:
   RTS
L875F:
   LDX #$7
L8761:
   CMP L83E3,X
   BEQ L876A
L8766:
   DEX
   BNE L8761
L8769:
   RTS
L876A:
   LDA L83E4,X
   STA (L6),Y
   LDA L41
   AND #$F7
   STA L41
   CPX #$7
   BEQ L877A
L8779:
   RTS
L877A:
   LDX #$20
L877C:
   LDA L1320,X
   BEQ L8789
L8781:
   DEX
   BNE L877C
L8784:
   LDA #$D
   STA (L6),Y
   RTS
L8789:
   LDA L6
   STA L1300,X
   LDA L7
   STA L1320,X
   RTS
L8794:
   LDX #$20
L8796:
   LDA L1320,X
   BEQ L879E
L879B:
   JSR L87AA
L879E:
   DEX
   BNE L8796
L87A1:
   RTS
   DB $7,$B,$C
L87A5:
   DB $C,$20,$2
   DB $3A,$3B
L87AA:
   STX L8
   LDA L1300,X
   STA L6
   LDA L1320,X
   STA L7
   LDY #$0
   TYA
   STA (L6),Y
   LDA L7
   PHA
   ;CLC
   ;ADC #$D4
   SEC
   SBC #$4
   CLC
   STA L7
   ;LDA #$66
   LDA #$36
   STA (L6),Y
   PLA
   STA L7
   LDA L6
   CLC
   ADC #$28
   STA L6
   LDA L7
   ADC #$0
   STA L7
   LDA (L6),Y
   LDX #$4
L87DB:
   CMP L87A1,X
   BNE L87E3
L87E0:
   JMP L86CA
L87E3:
   CMP L87A5,X
   BEQ L8807
L87E8:
   DEX
   BNE L87DB
L87EB:
   LDA #$A
   STA (L6),Y
   LDA L7
   PHA
   ;CLC
   ;ADC #$D4
   SEC
   SBC #$4
   CLC
   STA L7
   LDA #$1
   STA (L6),Y
   LDX L8
   LDA L6
   STA L1300,X
   PLA
   STA L1320,X
   RTS
L8807:
   LDX L8
   LDA #$0
   STA L1320,X
   RTS
L880F:
   JSR L8058
   BEQ L8825
L8814:
   LDX L83EC
L8817:
   CMP L83EC,X
   BEQ L8822
L881C:
   DEX
   BNE L8817
L881F:
   STX LC
   RTS
L8822:
   JMP L86CA
L8825:
   LDA L2
   STA LA
   LDA L3
   STA LB
   RTS
L882E:
   LDA L2
   CMP LA
   BEQ L880F
L8834:
   LDA L3
   CMP LB
   BEQ L880F
L883A:
   LDA L2
   PHA
   LDA LA
   STA L2
   JSR L8058
   BNE L884C
L8846:
   PLA
   STA L2
   JMP L880F
L884C:
   LDA LB
   STA L3
   PLA
   STA L2
   JMP L880F
L8856:
   JSR L8058
   CMP #$8
   BEQ L8893
L885D:
   LDX #$7
L885F:
   CMP L83E3,X
   BEQ L886A
L8864:
   DEX
   BNE L885F
L8867:
   JMP L8B81
L886A:
   LDA L83E2,X
   STA L4
   ;LDA #$7
   LDA #$77
   STA L5
   CPX #$2
   BNE L888A
L8877:
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   LDX #$6
   LDY #$1
   JSR L8894
   LDA #$4
   STA L1E
L888A:
   JSR L805E
   LDA #$0
   STA L10
   PLA
   PLA
L8893:
   RTS
L8894:
   TXA
   PHA
L8896:
   INC VideoMatrix9h,X
   LDA VideoMatrix9h,X
   CMP #$3A
   BNE L88A8
L88A0:
   LDA #$30
   STA VideoMatrix9h,X
   DEX
   BNE L8896
L88A8:
   PLA
   TAX
   DEY
   BNE L8894
L88AD:
   RTS
L88AE:
   LDA CustomCharSet109h
   ROL A
   ADC #$0
   STA L1509
   RTS
L88B8:
   JSR L88FD
   LDA L1E
   BNE L88C0
L88BF:
   RTS
L88C0:
   LDA L4003
   CMP #$16
   BNE L88DD
L88C7:
   LDA L1E
   ASL A
   ASL A
   CLC
   ADC L1E
   STA SIDFilterModeVolume
   LDA #$10
   STA L4003
   STA SIDVoc2FreqHi
   JSR L80CB
   RTS
L88DD:
   INC L4003
   LDA L4003
   STA SIDVoc2FreqHi
   CMP #$16
   BEQ L88EB
L88EA:
   RTS
L88EB:
   DEC L1E
   BNE L88EA
L88EF:
   LDA #$F
   STA SIDFilterModeVolume
   STA L4003
   LDA #$0
   STA SIDVoc2ContROL_AReg
   RTS
L88FD:
   LDA L3D
   BNE L892A
L8901:
   LDA L39
   BNE L8906
L8905:
   RTS
L8906:
   LDA L4004
   CMP #$30
   BEQ L8917
L890D:
   DEC L4004
   LDA L4004
   STA SIDVoc3FreqHi
   RTS
L8917:
   DEC L39
   BEQ L8924
L891B:
   LDA #$40
   STA L4004
   JSR L80D1
   RTS
L8924:
   LDA #$0
   STA SIDVoc3ContROL_AReg
L8929:
   RTS
L892A:
   DEC L3D
   LDA L3D
   STA SIDFilterModeVolume
   BNE L8929
L8933:
   LDA #$0
   STA SIDVoc3ContROL_AReg
   LDA #$F
   STA SIDFilterModeVolume
   RTS
L893E:
   DEC L22
   LDA L22
   CMP #$1
   BEQ L8947
L8946:
   RTS
L8947:
   LDA #$0
   STA L22
   JSR L8F3D
   LDA L25
   BNE L8955
L8952:
   JMP L89CC
L8955:
   LDA L26
   BEQ L8946
L8959:
   CMP #$1
   BEQ L8962
L895D:
   DEC L26
   JMP L89CC
L8962:
   LDA L24
   CMP L23
   BNE L89A3
L8968:
   INC L28
   LDX L28
   LDA #$3
   STA L1980,X
   LDA VICRasterReg
   ; uses only the LSB, no correction necessary
   AND #$1
   BEQ L8985
L8978:
   LDA #$1A
   STA L1900,X
   LDA #$81
   STA L1A00,X
   JMP L898F
L8985:
   LDA #$1C
   STA L1900,X
   LDA #$80
   STA L1A00,X
L898F:
   LDA L3F
   AND #$80
   BEQ L89A3
L8995:
   LDA L25
   AND #$1
   BEQ L89A3
L899B:
   LDA L1A00,X
   ORA #$4
   STA L1A00,X
L89A3:
   INC L28
   LDX L28
   LDA #$1B
   STA L1900,X
   LDA #$3
   STA L1980,X
   LDA #$0
   STA L1A00,X
   DEC L24
   BEQ L89BD
L89BA:
   JMP L89CC
L89BD:
   LDA #$40
   STA L1A00,X
   LDA L27
   STA L26
   LDA L23
   STA L24
   DEC L25
L89CC:
   INC L29
   LDA L29
   CMP #$15
   BNE L89D8
L89D4:
   LDA #$13
   STA L29
L89D8:
   LDX L28
   LDA L28
   BNE L89DF
L89DE:
   RTS
L89DF:
   LDA L1A00,X
   AND #$80
   BNE L89E9
L89E6:
   JMP L8A92
L89E9:
   JSR L8C73
   LDA L1A00,X
   AND #$4
   BEQ L89F6
L89F3:
   JMP L8AE2
L89F6:
   LDA L1900,X
   STA L2
   LDA L1980,X
   STA L3
   LDA L1A00,X
   AND #$40
   BEQ L8A16
L8A07:
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   STX L7
   JSR L805E
   LDX L7
L8A16:
   LDA L1A00,X
   AND #$1
   BEQ L8A21
L8A1D:
   DEC L2
   DEC L2
L8A21:
   INC L2
   LDA L2
   BEQ L8A2E
L8A27:
   CMP #$27
   BEQ L8A2E
L8A2B:
   JMP L8A31
L8A2E:
   JMP L8A6E
L8A31:
   STX L7
   JSR L8058
   LDX L7
   CMP #$0
   BEQ L8A4E
L8A3C:
   CMP #$7
   BEQ L8A4B
L8A40:
   CMP #$B
   BEQ L8A4B
L8A44:
   CMP #$C
   BEQ L8A4B
L8A48:
   JMP L8A6E
L8A4B:
   JMP L86CA
L8A4E:
   LDA L2
   STA L1900,X
   LDA L3
   STA L1980,X
   ;LDA #$3
   LDA #$63
   STA L5
   LDA L29
   STA L4
   STX L7
   JSR L805E
   LDX L7
L8A67:
   DEX
   BEQ L8A6D
L8A6A:
   JMP L89DF
L8A6D:
   RTS
L8A6E:
   INC L3
   LDA L1900,X
   STA L2
   LDA L1A00,X
   EOR #$1
   STA L1A00,X
   LDA L3
   CMP #$15
   BNE L8A4E
L8A83:
   DEC L3
   LDA L1A00,X
   EOR #$1
   ORA #$6
   STA L1A00,X
   JMP L8A4E
L8A92:
   LDA L1900,X
   STA L2
   LDA L1980,X
   STA L3
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   LDA L1A00,X
   AND #$40
   BEQ L8AB2
L8AAB:
   STX L7
   JSR L805E
   LDX L7
L8AB2:
   LDA L18FF,X
   STA L1900,X
   STA L2
   LDA L197F,X
   STA L1980,X
   STA L3
   STX L7
   JSR L8058
   LDX L7
   CMP #$7
   BNE L8AD0
L8ACD:
   JMP L86CA
L8AD0:
   ;LDA #$3
   LDA #$63
   STA L5
   LDA #$13
   STA L4
   STX L7
   JSR L805E
   LDX L7
   JMP L8A67
L8AE2:
   LDA L1900,X
   STA L2
   LDA L1980,X
   STA L3
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   LDA L1A00,X
   AND #$40
   BEQ L8B02
L8AFB:
   STX L7
   JSR L805E
   LDX L7
L8B02:
   LDA L1A00,X
   STA L8
   AND #$1
   BEQ L8B0F
L8B0B:
   DEC L2
   DEC L2
L8B0F:
   INC L2
   LDA L8
   AND #$2
   BEQ L8B1B
L8B17:
   DEC L3
   DEC L3
L8B1B:
   INC L3
   STX L7
   JSR L8058
   LDX L7
   CMP #$7
   BEQ L8B37
L8B28:
   CMP #$B
   BEQ L8B37
L8B2C:
   CMP #$C
   BNE L8B3A
L8B30:
   CMP #$0
   BEQ L8B3A
L8B34:
   JMP L8B5A
L8B37:
   JMP L86CA
L8B3A:
   LDA #$0
   STA L9
   LDA L2
   BEQ L8B5A
L8B42:
   CMP #$27
   BEQ L8B5A
L8B46:
   LDA L3
   CMP #$2
   BEQ L8B6D
L8B4C:
   CMP #$16
   BEQ L8B6D
L8B50:
   LDA L9
   BNE L8B57
L8B54:
   JMP L8A4E
L8B57:
   JMP L8B02
L8B5A:
   LDA L8
   EOR #$1
   STA L1A00,X
   LDA L1980,X
   STA L3
   LDA #$1
   STA L9
   JMP L8B46
L8B6D:
   LDA L1A00,X
   EOR #$2
   STA L1A00,X
   LDA L1900,X
   STA L2
   LDA #$1
   STA L9
   JMP L8B50
L8B81:
   CMP #$13
   BEQ L8B90
L8B85:
   CMP #$14
   BEQ L8B90
L8B89:
   CMP #$15
   BEQ L8B90
L8B8D:
   JMP L8E68
L8B90:
   PHA
   LDA L3
   CMP #$3
   BNE L8BA1
L8B97:
   LDA L24
   CMP L23
   BEQ L8BA1
L8B9D:
   PLA
   JMP L8E68
L8BA1:
   PLA
   LDX L28
L8BA4:
   LDA L1900,X
   CMP L2
   BEQ L8BAF
L8BAB:
   DEX
   BNE L8BA4
L8BAE:
   RTS
L8BAF:
   LDA L1980,X
   CMP L3
   BNE L8BAB
L8BB6:
   LDA L10
   AND #$30
   BEQ L8BC2
L8BBC:
   LDA L41
   ORA #$80
   STA L41
L8BC2:
   LDA #$0
   STA L10
   LDA #$4
   STA L39
   LDA #$36
   STA L4004
   JSR L80D1
   LDA L1A00,X
   AND #$C0
   CMP #$C0
   BNE L8BE2
L8BDB:
   LDA #$4
   STA L8
   JMP L8C43
L8BE2:
   CMP #$40
   BNE L8BF6
L8BE6:
   LDA L1A00,X
   ORA L19FF,X
   STA L19FF,X
   LDA #$1
   STA L8
   JMP L8C43
L8BF6:
   CMP #$80
   BEQ L8C2A
L8BFA:
   STX L7
L8BFC:
   DEX
   LDA L1A00,X
   AND #$80
   BEQ L8BFC
L8C04:
   LDA L1A00,X
   LDX L7
   ORA L1A01,X
   STA L1A01,X
   AND #$4
   BEQ L8C1B
L8C13:
   LDA L1A01,X
   EOR #$1
   STA L1A01,X
L8C1B:
   LDA #$1
   STA L8
   LDA #$40
   ORA L19FF,X
   STA L19FF,X
   JMP L8C43
L8C2A:
   LDA L1A00,X
   ORA L1A01,X
   STA L1A01,X
   AND #$4
   BEQ L8C3F
L8C37:
   LDA L1A01,X
   EOR #$1
   STA L1A01,X
L8C3F:
   LDA #$4
   STA L8
L8C43:
   LDA L1901,X
   STA L1900,X
   LDA L1981,X
   STA L1980,X
   LDA L1A01,X
   STA L1A00,X
   CPX L28
   BEQ L8C5D
L8C59:
   INX
   JMP L8C43
L8C5D:
   DEC L28
   LDX #$5
   LDY L8
   JSR L8894
   ;LDA #$7
   LDA #$77
   STA L5
   LDA #$E
   STA L4
   PLA
   PLA
   JMP L805E
L8C73:
   LDA L2A
   CMP #$2
   BPL L8C7A
L8C79:
   RTS
L8C7A:
   DEC L2B
   BEQ L8C94
L8C7E:
   LDA L2A
   CMP L4
   BMI L8C79
L8C84:
   LDA L1900,X
   CMP LA
   BNE L8C79
L8C8B:
   DEC L2D
   BEQ L8C90
L8C8F:
   RTS
L8C90:
   LDA L2E
   STA L2D
L8C94:
   LDA L2C
   STA L2B
   LDA LB
   SEC
   SBC L1980,X
   BVS L8C8F
L8CA0:
   CMP #$4
   BMI L8C8F
L8CA4:
   STX L7
   LDX #$20
L8CA8:
   LDA L1320,X
   BEQ L8CB1
L8CAD:
   DEX
   BNE L8CA8
L8CB0:
   RTS
L8CB1:
   STX L8
   LDX L7
   LDA L1900,X
   STA L2
   LDA L1980,X
   STA L3
   STX L7
   JSR L8049
   TYA
   CLC
   ADC L48
   STA L48
   LDA L49
   ADC #$0
   LDX L8
   STA L1320,X
   LDA L48
   STA L1300,X
   LDX L7
   RTS
L8CDB:
   DEC L2F
   BEQ L8CE0
L8CDF:
   RTS
L8CE0:
   LDA L30
   STA L2F
   LDA L23
   BNE L8CEB
L8CE8:
   JSR L9B30
L8CEB:
   LDA L32
   BNE L8CF0
L8CEF:
   RTS
L8CF0:
   LDA L34
   BNE L8CF7
L8CF4:
   JMP L8D20
L8CF7:
   DEC L32
   BEQ L8CFE
L8CFB:
   JMP L8D20
L8CFE:
   LDA L33
   STA L32
   INC L31
   LDX L31
   LDA #$3
   STA L1B00,X
   LDA VICRasterReg
   ; uses only the lower nybble, no correction necessary
   AND #$F
   CLC
   ADC #$4
   STA L1A80,X
   LDA VICRasterReg
   CLC
   ADC #$30	; raster line offset between C64 and P4
   AND #$40
   STA L1B80,X
   DEC L34
L8D20:
   LDX L31
   CPX #$0
   BNE L8D27
L8D26:
   RTS
L8D27:
   LDA L1B80,X
   AND #$20
   BEQ L8D31
L8D2E:
   JMP L8EF0
L8D31:
   LDA L1B80,X
   AND #$1
   BEQ L8D3B
L8D38:
   JMP L8DF4
L8D3B:
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   LDA L1A80,X
   STA L2
   LDA L1B00,X
   STA L3
   LDA L1B80,X
   AND #$40
   BEQ L8D58
L8D54:
   INC L2
   INC L2
L8D58:
   DEC L2
   STX L7
   JSR L805E
   LDX L7
L8D61:
   LDA L1A80,X
   STA L2
   ;LDA #$7
   LDA #$77
   STA L5
   LDA #$5E
   STA L4
   LDA L1B80,X
   AND #$40
   BEQ L8D79
L8D75:
   LDA #$61
   STA L4
L8D79:
   STX L7
   JSR L805E
   LDX L7
   LDA L1B80,X
   AND #$40
   BEQ L8D8B
L8D87:
   DEC L2
   DEC L2
L8D8B:
   INC L2
   JSR L8058
   BEQ L8DD9
L8D92:
   LDX L7
   LDA L1A80,X
   STA L2
   INC L3
   LDA L1B80,X
   EOR #$40
   STA L1B80,X
   LDA L1A80,X
   STA L2
   DEC L3
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   JSR L805E
   LDX L7
   INC L1B00,X
   INC L3
   LDA L3
   CMP #$16
   BNE L8DD6
L8DC2:
   LDA L28
   BNE L8DD0
L8DC6:
   LDA L25
   BNE L8DD0
L8DCA:
   LDA L41
   ORA #$2
   STA L41
L8DD0:
   JSR L8E33
   JMP L8DE5
L8DD6:
   JMP L8D61
L8DD9:
   LDA L2
   LDX L7
   STA L1A80,X
   LDA L3
   STA L1B00,X
L8DE5:
   LDA L1B80,X
   EOR #$1
   STA L1B80,X
   DEX
   BEQ L8DF3
L8DF0:
   JMP L8D27
L8DF3:
   RTS
L8DF4:
   ;LDA #$7
   LDA #$77
   STA L5
   LDA L1A80,X
   STA L2
   LDA L1B00,X
   STA L3
   LDA L1B80,X
   AND #$40
   BNE L8E1E
L8E09:
   LDA #$60
   STA L4
   STX L7
   JSR L805E
   DEC L2
   DEC L4
   JSR L805E
   LDX L7
   JMP L8DE5
L8E1E:
   LDA #$63
   STA L4
   STX L7
   JSR L805E
   INC L2
   DEC L4
   JSR L805E
   LDX L7
   JMP L8DE5
L8E33:
   STX L7
L8E35:
   LDA L1A81,X
   STA L1A80,X
   LDA L1B01,X
   STA L1B00,X
   LDA L1B81,X
   STA L1B80,X
   CPX L31
   BEQ L8E4F
L8E4B:
   INX
   JMP L8E35
L8E4F:
   LDX L7
   DEC L31
   LDA L23
   BEQ L8E61
L8E57:
   LDA L34
   BNE L8E61
L8E5B:
   LDA L41
   ORA #$40
   STA L41
L8E61:
   RTS
   DB $5E,$5F,$60
   DB $61,$62,$63
L8E68:
   LDX #$6
L8E6A:
   CMP L8E61,X
   BEQ L8E75
L8E6F:
   DEX
   BNE L8E6A
L8E72:
   JMP L913B
L8E75:
   CMP #$62
   BNE L8E7B
L8E79:
   DEC L2
L8E7B:
   CMP #$5F
   BNE L8E81
L8E7F:
   INC L2
L8E81:
   CMP #$5E
   BNE L8E87
L8E85:
   INC L2
L8E87:
   CMP #$61
   BNE L8E8D
L8E8B:
   DEC L2
L8E8D:
   LDX L31
   LDA L2
L8E91:
   CMP L1A80,X
   BEQ L8E9A
L8E96:
   DEX
   BNE L8E91
L8E99:
   RTS
L8E9A:
   LDA L3
   CMP L1B00,X
   BNE L8E96
L8EA1:
   LDA #$0
   STA L10
   STX L7
   LDX #$5
   LDY #$1
   JSR L8894
   LDX #$7
   LDY #$6
   JSR L8894
   LDX L7
   LDA #$4
   STA L39
   LDA #$36
   STA L4004
   JSR L80D1
   LDA L1B80,X
   AND #$40
   BNE L8ED7
L8ECA:
   LDA L1A80,X
   CMP #$1
   BEQ L8EE8
L8ED1:
   DEC L1A80,X
   JMP L8EE8
L8ED7:
   LDA L2
   STA L1A80,X
   JMP L8EE8
   DB $80,$1B
L8EE1:
   AND #$1
   BEQ L8EE8
L8EE5:
   INC L1A80,X
L8EE8:
   LDA #$2F
   STA L1B80,X
   PLA
   PLA
   RTS
L8EF0:
   LDA L1A80,X
   STA L2
   LDA L1B00,X
   STA L3
   LDA L1B80,X
   AND #$F
   BEQ L8F27
L8F01:
   AND #$7
   ORA #$40 ; unsure...
   STA L5
   LDA L1B80,X
   SEC
   SBC #$1
   STA L1B80,X
   LDA #$64
   STA L4
   STX L7
   JSR L805E
   INC L4
   INC L2
   JSR L805E
L8F1E:
   LDX L7
   DEX
   BEQ L8F26
L8F23:
   JMP L8D27
L8F26:
   RTS
L8F27:
   JSR L8E33
   ;LDA #$66
   LDA #$36
   STA L5
   LDA #$0
   STA L4
   JSR L805E
   INC L2
   JSR L805E
   JMP L8F1E
L8F3D:
   LDA L37
   BEQ L8F45
L8F41:
   DEC L37
   BEQ L8F46
L8F45:
   RTS
L8F46:
   LDA L38
   STA L37
   LDA L36
   EOR #$1
   STA L36
   AND #$80
   BEQ L8F57
L8F54:
   JMP L8FEA
L8F57:
   LDA #$2
   STA L3
   ;LDA #$1
   LDA #$71
   STA L5
   LDA L35
   STA L2
   LDA L36
   AND #$40
   BNE L8F8F
L8F69:
   LDA #$20
   STA L4
   DEC L2
   JSR L805E
   INC L2
   LDA #$66
   STA L4
   LDA L36
   AND #$1
   BEQ L8F82
L8F7E:
   LDA #$68
   STA L4
L8F82:
   JSR L805E
   INC L2
   INC L4
   JSR L805E
   JMP L8FB4
L8F8F:
   LDA #$20
   STA L4
   INC L2
   JSR L805E
   DEC L2
   LDA #$6B
   STA L4
   LDA L36
   AND #$1
   BEQ L8FA8
L8FA4:
   LDA #$6D
   STA L4
L8FA8:
   DEC L2
   JSR L805E
   INC L2
   DEC L4
   JSR L805E
L8FB4:
   LDA L36
   AND #$1
   BEQ L8FC7
L8FBA:
   LDA L36
   AND #$40
   BNE L8FC4
L8FC0:
   INC L35
   INC L35
L8FC4:
   DEC L35
   RTS
L8FC7:
   LDA L35
   CMP LA
   BNE L8FD2
L8FCD:
   LDA #$80
   STA L36
L8FD1:
   RTS
L8FD2:
   BMI L8FDF
L8FD4:
   LDA L36
   AND #$40
   BNE L8FD1
L8FDA:
   LDA #$41
   STA L36
L8FDE:
   RTS
L8FDF:
   LDA L36
   AND #$40
   BEQ L8FDE
L8FE5:
   LDA #$1
   STA L36
   RTS
L8FEA:
   LDA L36
   AND #$1
   CLC
   ADC #$6E
   STA L4
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$2
   STA L3
   LDA L35
   STA L2
   JSR L805E
   LDA L35
   CMP LA
   BNE L9009
L9008:
   RTS
L9009:
   LDA #$0
   STA L36
   JMP L8FC7
L9010:
   LDA L10
   AND #$2
   BNE L902F
L9016:
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$71
   STA L4
   LDA L11
   STA L2
   LDA L12
   STA L3
L9026:
   LDA L10
   EOR #$2
   STA L10
   JMP L805E
L902F:
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   LDA L11
   STA L2
   LDA L12
   STA L3
   JSR L805E
   INC L2
   LDA L2
   CMP #$27
   BNE L904F
L904A:
   LDA #$0
   STA L10
   RTS
L904F:
   INC L11
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$70
   STA L4
   JSR L8856
   JMP L9026
L905F:
   LDA L10
   AND #$2
   BNE L9078
L9065:
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$70
   STA L4
   LDA L11
   STA L2
   LDA L12
   STA L3
   JMP L9026
L9078:
   LDA L11
   STA L2
   LDA L12
   STA L3
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   JSR L805E
   DEC L2
   DEC L11
   BNE L9096
L9091:
   LDA #$0
   STA L10
   RTS
L9096:
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$71
   STA L4
   JSR L8856
   JMP L9026
L90A4:
   LDA L11
   STA L2
   LDA L12
   STA L3
   LDA L10
   AND #$2
   BNE L90BD
L90B2:
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$8
   STA L4
   JMP L9026
L90BD:
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   JSR L805E
   INC L3
   LDA L3
   CMP #$16
   BNE L90D5
L90D0:
   LDA #$0
   STA L10
   RTS
L90D5:
   INC L12
   ;LDA #$1
   LDA #$71
   STA L5
   LDA #$9
   STA L4
   JSR L8856
   JMP L9026
L90E5:
   DEC L3A
   BEQ L90EA
L90E9:
   RTS
L90EA:
   LDA #$80
   STA L3A
   INC L3C
   LDX L3B
   CPX #$0
   BNE L90F7
L90F6:
   RTS
L90F7:
   LDA #$0
   STA L7
   LDA L1D00,X
   AND #$30
   TAY
   LDA #$72
   CPY #$10
   BNE L9109
L9107:
   LDA #$75
L9109:
   CPY #$20
   BNE L910F
L910D:
   LDA #$78
L910F:
   CLC
   ADC L7
   STA L4
   LDA L3C
   AND #$7
   ORA #$40 ; unsure...
   STA L5
   LDA L1C00,X
   STA L2
   LDA L1C80,X
   STA L3
   STX L7
   JSR L805E
   LDX L7
   DEX
   BNE L90F7
L912E:
   RTS
L9131 = * + 2
   DB $72,$73,$74
L9134 = * + 2
   DB $75,$76,$77
L9137 = * + 2
   DB $78,$79,$7A
   DB $7,$B,$C
L913B:
   LDX #$3
L913D:
   CMP L912E,X
   BEQ L916B
L9142:
   CMP L9131,X
   BEQ L9187
L9147:
   CMP L9134,X
   BEQ L9158
L914C:
   CMP L9137,X
   BNE L9154
L9151:
   JMP L86CA
L9154:
   DEX
   BNE L913D
L9157:
   RTS
L9158:
   LDA L10
   AND #$10
   BNE L9157
L915E:
   LDA L10
   EOR #$20
   STA L10
   CPX #$1
   BNE L9157
L9168:
   JMP L9197
L916B:
   LDA L10
   AND #$30
   STA L7
   LDA #$50
   SEC
   SBC L7
   AND #$30
   STA L7
L917A:
   LDA L10
   AND #$8F
   ORA L7
   STA L10
   CPX #$1
   BEQ L9197
L9186:
   RTS
L9187:
   LDA L10
   AND #$30
   STA L7
   LDA #$30
   SEC
   SBC L7
   STA L7
   JMP L917A
L9197:
   LDX L3B
L9199:
   LDA L2
   CMP L1C00,X
   BEQ L91A4
L91A0:
   DEX
   BNE L9199
L91A3:
   RTS
L91A4:
   LDA L3
   CMP L1C80,X
   BNE L91A0
L91AB:
   LDA L1D00,X
   JSR L91C5
   STA L1D00,X
   LDA #$F
   STA L3D
   LDA #$90
   STA SIDVoc3FreqHi
   JSR L80D1
   LDA #$0
   STA L39
   RTS
L91C5:
   AND #$30
   CMP #$20
   BEQ L91DA
L91CB:
   CMP #$10
   BEQ L91D5
L91CF:
   LDA #$1F
   STA L1D00,X
   RTS
L91D5:
   LDA #$F
   STA L1D00,X
L91DA:
   LDA L1D00,X
   RTS
L91DE:
   LDX L3E
   STX L3B
L91E2:
   LDA L91F7,X
   STA L1C00,X
   LDA L9213,X
   STA L1C80,X
   LDA L922F,X
   STA L1D00,X
   DEX
   BNE L91E2
L91F7:
   RTS
   DB $13,$14,$13
   DB $14,$1,$4
   DB $7,$A,$26
   DB $23,$20,$1D
   DB $13,$14,$7
   DB $20,$5,$5
   DB $22,$22,$2
   DB $4,$6,$8
   DB $26,$24,$22
L9213:
   DB $20,$D,$D
   DB $E,$E,$A
   DB $A,$A,$A
   DB $A,$A,$A
   DB $A,$6,$6
   DB $6,$6,$E
   DB $15,$E,$15
   DB $8,$8,$8
   DB $8,$8,$8
L922F = * + 1
   DB $8,$8,$1F
   DB $F,$F,$1F
   DB $1F,$F,$1F
   DB $F,$F,$1F
   DB $F,$1F,$2F
   DB $2F,$2F,$2F
   DB $F,$1F,$1F
   DB $F,$2F,$2F
   DB $2F,$2F,$2F
L924B = * + 2
   DB $2F,$2F,$2F
   DB $1,$2,$3
   DB $0,$2,$2
   DB $2,$2,$0
   DB $3,$3,$3
   DB $2,$3,$3
   DB $0,$3,$3
L925F = * + 1
   DB $3,$3,$6
   DB $6,$6,$0
   DB $7,$7,$7
   DB $7,$0,$8
   DB $8,$8,$9
   DB $A,$B,$0
   DB $B,$B,$C
L9273:
   DB $D,$0,$0
   DB $0,$14,$0
   DB $8,$9,$0
   DB $19,$A,$0
   DB $B,$C,$0
   DB $F,$1E,$0
L9287 = * + 2
   DB $14,$14,$14
   DB $0,$0,$0
   DB $6,$0,$6
   DB $6,$0,$4
   DB $6,$0,$4
   DB $4,$0,$4
   DB $3,$0,$4
L929B = * + 1
   DB $3,$3,$0
   DB $0,$0,$4
   DB $0,$7,$7
   DB $0,$3,$6
   DB $0,$5,$5
   DB $0,$4,$3
   DB $0,$3,$3
L92AF:
   DB $3,$10,$F
   DB $E,$D,$D
   DB $D,$C,$C
   DB $B,$B,$A
   DB $9,$9,$8
   DB $9,$8,$7
L92C3 = * + 2
   DB $7,$6,$6
   DB $0,$0,$4
   DB $4,$3,$3
   DB $3,$3,$2
   DB $2,$2,$2
   DB $2,$2,$2
   DB $2,$2,$2
L92D7 = * + 1
   DB $2,$2,$0
   DB $0,$0,$0
   DB $4,$0,$0
   DB $C,$0,$0
   DB $10,$0,$0
   DB $14,$0,$0
   DB $0,$1C,$0
L92EB:
   DB $1C,$0,$0
   DB $0,$1,$1
   DB $0,$82,$1
   DB $1,$0,$1
   DB $82,$0,$1
   DB $82,$82,$0
   DB $1,$82,$82
L9300:
   LDX L2A
   LDA L924B,X
   STA L25
   LDA L925F,X
   STA L23
   STA L24
   LDA L9273,X
   STA L34
   LDA L9287,X
   STA L33
   STA L32
   LDA L929B,X
   STA L30
   STA L2F
   LDA L92AF,X
   STA L18
   STA L19
   LDA L92C3,X
   STA L37
   STA L38
   LDA L92D7,X
   STA L3E
   LDA L92EB,X
   STA L3F
   JMP L91DE
L933C:
   LDA #$2
   STA L3
   JSR L9469
   LDA #$20
   STA L4
L9347:
   LDA #$0
   STA L2
L934B:
   JSR L805E
   INC L2
   LDA L2
   CMP #$28
   BNE L934B
L9356:
   INC L3
   LDA L3
   CMP #$17
   BNE L9347
L935E:
   LDA #$0
   STA L4
   LDA #$3
   STA L3
   ;LDA #$66
   LDA #$36
   STA L5
L936A:
   LDA #$1
   STA L2
L936E:
   JSR L805E
   INC L2
   LDA L2
   CMP #$27
   BNE L936E
L9379:
   INC L3
   LDA L3
   CMP #$16
   BNE L936A
L9381:
   RTS
L9382:
   JSR L933C
   LDA #$B
   STA L3
   LDA #$20
   STA L4
L938D:
   LDA #$D
   STA L2
L9391:
   JSR L805E
   INC L2
   LDA L2
   CMP #$1C
   BNE L9391
L939C:
   INC L3
   LDA L3
   CMP #$E
   BNE L938D
L93A4:
   LDA #$E
   STA L2
   LDA #$C
   STA L3
   JSR L8049
   LDX #$0
   ;LDA #$1
   LDA #$71
   STA L5
L93B5:
   LDA L9412,X
   STA L4
   STX LA
   JSR L805E
   LDX LA
   INC L2
   INX
   CPX #$D
   BNE L93B5
L93C8:
   DEC L2
   DEC L2
   JSR L8049
   INY
   LDX L2A
L93D2:
   LDA (L48),Y
   CLC
   ADC #$1
   STA (L48),Y
   CMP #$3A
   BNE L93EA
L93DD:
   LDA #$30
   STA (L48),Y
   DEY
   LDA (L48),Y
   CLC
   ADC #$1
   STA (L48),Y
   INY
L93EA:
   DEX
   BNE L93D2
L93ED:
   JMP L941F
L93F0:
   JSR L8013
L93F3:
   LDA CustomCharSet7h
   STA L50
   LDX #$7
L93FA:
   LDA CustomCharSetMinus1,X
   STA CustomCharSet,X
   DEX
   BNE L93FA
L9403:
   LDA L50
   STA CustomCharSet
   LDA L3F
   AND #$80
   BEQ L9411
L940E:
   JMP L9496
L9411:
   RTS
L9412:
   DB $45,$4E,$54
   DB $45,$52,$20
   DB $5A,$4F,$4E
   DB $45,$20,$30
   DB $30
L941F:
   LDA #$F
   STA L4000
   STA SIDFilterModeVolume
   JSR shutUp
   LDA #$E8
   STA L4001
   JSR L80CB
L9432:
   LDA L4001
   STA SIDVoc1FreqHi
   STA L4002
L943B:
   JSR L93F0
   INC L4002
   LDA L4002
   SBC #$E0
   STA SIDVoc2FreqHi
   LDA L4002
   BNE L943B
L944E:
   INC L4001
   BNE L9432
L9453:
   JSR shutUp
L9458 = * + 2
   JMP L933C
   DB $30,$30,$30
   DB $30,$FF,$30
L9460 = * + 1
   DB $30,$30,$0
   DB $0,$3C,$3C
   DB $3C,$3C,$0
   DB $0
L9469:
   LDA L3F
   BNE L9479
L946D:
   LDX #$8
L946F:
   LDA L9458,X
   STA CustomCharSetMinus1,X
   DEX
   BNE L946F
L9478:
   RTS
L9479:
   LDA L3F
   CMP #$1
   BNE L948A
L947F:
   LDX #$8
   LDA #$0
L9483:
   STA CustomCharSetMinus1,X
   DEX
   BNE L9483
L9489:
   RTS
L948A:
   LDX #$8
L948C:
   LDA L9460,X
   STA CustomCharSetMinus1,X
   DEX
   BNE L948C
L9495:
   RTS
L9496:
   LDX #$8
L9498:
   CLC
   LDA CustomCharSetMinus1,X
   ROL A
   ADC #$0
   STA CustomCharSetMinus1,X
   DEX
   BNE L9498
L94A5:
   RTS
L94A6:
   LDA L25
   BNE L94A5
L94AA:
   LDA L28
   BNE L94A5
L94AE:
   LDA L34
   BNE L94A5
L94B2:
   LDA L31
   BNE L94A5
L94B6:
   INC L2A
   LDA L2A
   CMP #$15
   BNE L94C0
L94BE:
   DEC L2A
L94C0:
   LDX #$F8
   TXS
   INC VideoMatrix15h
   LDA VideoMatrix15h
   CMP #$3A
   BNE L94D0
L94CD:
   DEC VideoMatrix15h
L94D0:
   JMP L9852
L94D3:
   LDA LB
   STA L3
   LDA #$1
   STA L2
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
L94E3:
   JSR L805E
   INC L2
   LDA L2
   CMP #$27
   BNE L94E3
L94EE:
   JSR shutUp
   LDA #$8
   STA L4000
   STA SIDFilterModeVolume
   JSR L80D1
   LDA #$10
   STA L7
L9500:
   LDA #$60
   JSR L9BAA
L9505:
   LDY #$E0
L9507:
   DEY
   BNE L9507
L950A:
   LDA L4004
   STA SIDVoc3FreqHi
   INC L4004
   LDA L4004
   CMP #$80
   BNE L9505
L951A:
   JSR L8013
   LDA #$0
   LDX VICBGColor0
   CPX #$F0
   BNE L9528
L9526:
   LDA #$6
L9528:
   STA VICBGColor0
   LDA LA
   STA L2
   LDA LB
   STA L3
   LDA L7
   AND #$3
   TAX
   LDA L9623,X
   STA L4
   LDA L7
   AND #$7
   ORA #$40 ; unsure...
   STA L5
   JSR L805E
   DEC L7
   BNE L9500
L954A:
   LDA #$F
   STA L4000
   STA SIDFilterModeVolume
   JSR shutUp
   LDA #$4
   STA L4001
   STA SIDVoc1FreqHi
   LDX #$8
   JSR L80D7
   LDA #$0
L9564:
   STA CustomCharSetMinus1,X
   DEX
   BNE L9564
L956A:
   LDA #$F
   SEC
   SBC L4000
   STA L8
   LDA #$7
   STA L9
   LDX L8
   INX
L9579:
   JSR L8013
   DEX
   BNE L9579
L957F:
   JSR L95AA
   LDA L8
   BEQ L959F
L9586:
   DEC L8
   BEQ L958E
L958A:
   LDA L9
   BNE L957F
L958E:
   LDA #$0
   STA L4
   ;LDA #$66
   LDA #$36
   STA L5
   JSR L95B7
   LDA L4000
   STA SIDFilterModeVolume
L959F:
   DEC L4000
   BNE L956A
L95A4:
   JSR shutUp
   JMP L962F
L95AA:
   LDX L9
   DEC L9
   LDA L9627,X
   STA L5
   LDA #$40
   STA L4
L95B7:
   LDA LA
   SEC
   SBC L8
   STA L2
   LDA LB
   STA L3
   JSR L95FF
   LDA L3
   CLC
   ADC L8
   STA L3
   JSR L95FF
   LDA LB
   SEC
   SBC L8
   STA L3
   JSR L95FF
   LDA LA
   STA L2
   JSR L95FF
   LDA L2
   CLC
   ADC L8
   STA L2
   JSR L95FF
   LDA LB
   STA L3
   JSR L95FF
   LDA L3
   CLC
   ADC L8
   STA L3
   JSR L95FF
   LDA LA
   STA L2
L95FF:
   LDA L2
   AND #$80
   BEQ L9606
L9605:
   RTS
L9606:
   LDA L2
   BEQ L9605
L960A:
   CMP #$27
   BPL L9605
L960E:
   LDA L3
   AND #$80
   BNE L9605
L9614:
   LDA L3
   CMP #$16
   BPL L9605
L961A:
   LDA L3
   AND #$FC
   BEQ L9605
L9620:
   JMP L805E
L9623:
   DB $73,$74,$76
L9627 = * + 1
   DB $40
   ; colors
   DB $0,$36
   DB $32,$44,$45
   DB $63,$77,$71
L962F:
   DEC VideoMatrix15h
   LDA VideoMatrix15h
   CMP #$30
   BEQ L963C
L9639:
   JMP L966C
L963C:
   JMP L9A56
L963F:
   LDA #$20
   LDX #$0
L9643:
   STA VideoMatrix78h,X
   STA VideoMatrix100h,X
   STA VideoMatrix200h,X
   STA VideoMatrix300h,X
   DEX
   BNE L9643
L9652:
   LDA #$0
   LDX #$0
L9656:
   STA CustomCharSet400h,X
   DEX
   BNE L9656
L965C:
   STA L4002
   STA L4003
   STA L4004
   STA L4001
   JSR shutUp
   RTS
L966C:
   JSR L963F
   LDA #$A
   STA L3
   LDA #$10
   STA L2
   ;LDA #$3
   LDA #$63
   STA L5
   LDX #$0
L967D:
   LDA L96E9,X
   STX L7
   STA L4
   JSR L805E
   LDX L7
   INC L2
   INX
   CPX #$8
   BNE L967D
L9690:
   JSR shutUp
   LDA #$F
   STA L4000
   STA SIDFilterModeVolume
   JSR L80D1
   LDX #$A
L96A0:
   LDA #$20
   STA L4004
L96A5:
   LDY #$0
L96A7:
   DEY
   BNE L96A7
L96AA:
   LDA L4004
   STA SIDVoc3FreqHi
   INC L4004
   LDA L4004
   CMP #$40
   BNE L96A5
L96BA:
   DEX
   BNE L96A0
L96BD:
   LDX #$7
L96BF:
   LDA #$80
   STA L4004
L96C4:
   LDY #$0
L96C6:
   DEY
   BNE L96C6
L96C9:
   LDA L4004
   STA SIDVoc3FreqHi
   JSR L80D1
   DEC L4004
   BNE L96C4
L96D7:
   LDA L4000
   SEC
   SBC #$2
   STA L4000
   STA SIDFilterModeVolume
   DEX
   BNE L96BF
L96E6:
   JMP L8298
L96E9:
   DB $47,$4F,$54
   DB $20,$59,$4F
   DB $55,$7A
L96F1:
   JSR L963F
   LDA #$F
   STA L4000
   JSR shutUp
   LDA #$0
   STA L7
L9700:
   LDA #$4
   STA L3
L9704:
   LDA #$E
   STA L2
   LDA L7
   AND #$7
   TAX
   LDA L9627,X
   STA L5
   LDX #$0
L9714:
   LDA L9784,X
   STA L4
   STX L8
   JSR L805E
   INC L2
   LDX L8
   INX
   CPX #$C
   BNE L9714
L9727:
   INC L7
   INC L3
   LDA L3
   CMP #$B
   BNE L9704
L9731:
   LDA #$8
   STA L4003
   JSR L80CB
L9739:
   DEY
   BNE L9739
L973C:
   LDA L4003
   STA SIDVoc2FreqHi
   INC L4003
   LDA L4003
   CMP #$48
   BNE L9739
L974C:
   LDA L7
   AND #$C0
   CMP #$C0
   BNE L9700
L9754:
   LDX #$7
L9756:
   LDA #$60
   STA L4003
L975B:
   DEY
   BNE L975B
L975E:
   LDA L4003
   STA SIDVoc2FreqHi
   DEC L4003
   LDA L4003
   CMP #$30
   BNE L975B
L976E:
   LDA L4000
   SEC
   SBC #$2
   STA L4000
   STA SIDFilterModeVolume
   DEX
   BNE L9756
L977D:
   LDA L40
   BNE L9790
L9781:
   JMP L8298
L9784:
   DB $5A,$4F,$4E
   DB $45,$20,$43
   DB $4C,$45,$41
   DB $52,$45,$44
L9790:
   LDA #$F
   STA L4000
   STA SIDFilterModeVolume
   JSR shutUp
   LDX #$8
   LDA #$FF
L979F:
   STA CustomCharSetMinus1,X
   DEX
   BNE L979F
L97A5:
   ;LDA #$4
   LDA #$44
   STA L5
   LDA #$F
   STA L3
L97AD:
   LDA #$9
   STA L2
   LDA #$0
   STA L4
L97B5:
   JSR L805E
   INC L2
   LDA L2
   CMP #$1F
   BNE L97B5
L97C0:
   INC L3
   LDA L3
   CMP #$12
   BNE L97AD
L97C8:
   LDA #$10
   STA L3
   LDA #$B
   STA L2
   LDX #$0
   ;LDA #$7
   LDA #$77
   STA L5
L97D6:
   LDA L9840,X
   STA L4
   STX L8
   JSR L805E
   LDX L8
   INC L2
   INX
   CPX #$12
   BNE L97D6
L97E9:
   DEC L2
   DEC L2
   DEC L2
   LDA #$30
   CLC
   ADC L40
   STA L4
   ;LDA #$3
   LDA #$63
   STA L5
   JSR L805E
   LDX #$4
   LDY L40
   JSR L8894
   LDA #$D0
   STA L7
   JSR L80CB
L980B:
   LDA L7
   STA L4003
L9810:
   DEY
   BNE L9810
L9813:
   LDA L4003
   SBC #$80
   STA SIDVoc2FreqHi
   INC L4003
   BNE L9810
L9820:
   JSR L8013
   LDA L7
   AND #$7
   TAX
   LDA #$FF
   STA CustomCharSet,X
   INC L7
   LDA L7
   AND #$7
   TAX
   LDA #$0
   STA CustomCharSet,X
   LDA L7
   BNE L980B
L983D:
   JMP L8298
L9840:
   DB $20,$4D,$59
   DB $53,$54,$45
   DB $52,$59,$20
   DB $42,$4F,$4E
   DB $55,$53,$20
   DB $20,$20,$20
L9852:
   LDX #$4
L9854:
   LDA L1D00,X
   CMP L987B,X
   BNE L9869
L985C:
   DEX
   BNE L9854
L985F:
   LDA L3B
   BEQ L9869
L9863:
   LDA L41
   ORA #$20
   STA L41
L9869:
   LDA #$8
   STA L40
L986D:
   LDA L41
   CLC
   ROL A
   STA L41
   BCS L9879
L9875:
   DEC L40
   BNE L986D
L9879:
L987B = * + 2
   JMP L96F1
   DB $F,$1F,$1F
   DB $F
L9880:
   JSR L963F
   ;LDA #$3
   LDA #$63
   STA L5
   LDA #$9
   STA L2
   LDX #$0
L988D:
   LDA #$5
   STA L3
   LDA L9903,X
   STA L4
   STX L7
   JSR L805E
   INC L3
   INC L3
   ;LDA #$7
   LDA #$77
   STA L5
   LDX L7
   LDA L9919,X
   STA L4
   JSR L805E
   ;LDA #$1
   LDA #$71
   STA L5
   INC L3
   INC L3
   LDX L7
   LDA L992F,X
   STA L4
   JSR L805E
   INC L5
   LDX L7
   INC L3
   INC L3
   INC L5
   LDA L9945,X
   STA L4
   JSR L805E
   INC L5
   LDX L7
   INC L3
   INC L3
   LDA L995B,X
   STA L4
   JSR L805E
   LDX L7
   ;LDA #$1
   LDA #$71
   STA L5
   INC L3
   INC L3
   LDA L9971,X
   STA L4
   JSR L805E
   LDX L7
   ;LDA #$3
   LDA #$63
   STA L5
   INC L2
   INX
   CPX #$16
   BNE L988D
L9900:
   JMP L9AF7
L9903:
   DB $44,$45,$53
   DB $49,$47,$4E
   DB $20,$41,$4E
   DB $44,$20,$50
   DB $52,$4F,$47
   DB $52,$41,$4D
   DB $4D,$49,$4E
L9919 = * + 1
   DB $47,$20,$20
   DB $20,$42,$59
   DB $20,$20,$4A
   DB $45,$46,$46
   DB $20,$20,$4D
   DB $49,$4E,$54
   DB $45,$52,$20
L992F = * + 2
   DB $20,$20,$20
   DB $20,$20,$20
   DB $3F,$20,$20
   DB $20,$31,$39
   DB $38,$33,$20
   DB $20,$20,$48
   DB $45,$53,$20
   DB $20,$20,$20
L9945:
   DB $20,$50,$52
   DB $45,$53,$53
   DB $20,$46,$49
   DB $52,$45,$20
   DB $46,$4F,$52
   DB $20,$53,$54
   DB $41,$52,$54
L995B = * + 1
   DB $20,$53,$45
   DB $4C,$45,$43
   DB $54,$20,$53
   DB $54,$41,$52
   DB $54,$20,$4C
   DB $45,$56,$45
   DB $4C,$20,$20
L9971 = * + 2
   DB $20,$31,$96
   DB $95,$94,$93
   DB $92,$91,$90
   DB $8F,$8E,$8D
   DB $8C,$8B,$8A
   DB $89,$88,$87
   DB $86,$85,$84
   DB $83,$82,$81
L9987:
   LDX #$0
L9989:
   JSR L8013
   LDA L9B5A,X
   AND #$3F
   CMP #$20
   BNE L9998
L9995:
   JMP L99F7
L9998:
   CMP #$2E
   BNE L999F
L999C:
   JMP L9A06
L999F:
   CMP #$0
   BNE L99A6
L99A3:
   JMP L9987
L99A6:
   CLC
   ASL A
   ASL A
   ASL A
   TAY
   STX L9
   LDX #$0
L99AF:
   LDA CustomCharSet200h,Y
   STA CustomCharSet400h,X
   INY
   INX
   CPX #$8
   BNE L99AF
L99BB:
   LDX L9
   LDA #$8
   STA L8
L99C1:
   LDY #$0
L99C3:
   LDA #$18
   STA L7
   TYA
   TAX
   CLC
L99CA:
   ROL CustomCharSet400h,X
   PHP
   TXA
   CLC
   ADC #$8
   TAX
   DEC L7
   BEQ L99DB
L99D7:
   PLP
   JMP L99CA
L99DB:
   PLP
   INY
   CPY #$8
   BNE L99C3
L99E1:
   LDX #$A
L99E3:
   DEY
   BNE L99E3
L99E6:
   DEX
   BNE L99E3
L99E9:
   JSR L8013
   DEC L8
   BNE L99C1
L99F0:
   LDX L9
   INX
   JMP L9A26
   DB $0
L99F7:
   STX L9
   LDA #$0
   LDX #$8
L99FD:
   STA CustomCharSet3ffh,X
   DEX
   BNE L99FD
L9A03:
   JMP L99BB
L9A06:
   STX L9
   LDX #$8
L9A0A:
   LDA CustomCharSet3b7h,X
   STA CustomCharSet3ffh,X
   DEX
   BNE L9A0A
L9A13:
   JMP L99BB
L9A16:
   STX L9
   LDX #$8
L9A1A:
   LDA CustomCharSet3c7h,X
   STA CustomCharSet3ffh,X
   DEX
   BNE L9A1A
L9A23:
   JMP L99BB
L9A26:
   STX L9
   JSR L83DC
   LDA CurrentKeyPressed
   CMP #$4
   BNE L9A40
L9A31:
   INC VideoMatrix226h
   LDA VideoMatrix226h
   CMP #$37
   BNE L9A40
L9A3B:
   LDA #$31
   STA VideoMatrix226h
L9A40:
   LDA LD
   AND #$10
   BNE L9A4B
L9A46:
   LDX L9
   JMP L9989
L9A4B:
   LDA VideoMatrix226h
   SEC
   SBC #$30
   STA L2A
   JMP L963F
L9A56:
   JSR L963F
   ;LDA #$7
   LDA #$77
   STA L5
   LDX #$0
   LDA #$A
   STA L3
   LDA #$10
   STA L2
L9A67:
   LDA L9AEE,X
   STA L4
   STX L7
   JSR L805E
   LDX L7
   INC L2
   INX
   CPX #$9
   BNE L9A67
L9A7A:
   LDA #$F
   STA L4000
   STA SIDFilterModeVolume
   LDX #$F
L9A84:
   LDA #$80
   STA L4002
   STA L4003
   STA L4004
   JSR L80CB
   JSR L80D1
L9A95:
   LDY #$0
L9A97:
   DEY
   BNE L9A97
L9A9A:
   LDA L4003
   SBC #$70
   STA SIDVoc2FreqHi
   ADC #$80
   STA SIDVoc3FreqHi
   INC L4002
   INC L4003
   INC L4004
   BNE L9A95
L9AB2:
   LDA L4000
   SEC
   SBC #$1
   STA L4000
   STA SIDFilterModeVolume
   DEX
   BNE L9A84
L9AC1:
   LDX #$1
L9AC3:
   LDA VideoMatrix9h,X
   CMP L14F0,X
   BEQ L9ACF
L9ACB:
   BMI L9AD4
L9ACD:
   BPL L9AE0
L9ACF:
   INX
   CPX #$8
   BNE L9AC3
L9AD4:
   JSR L9880
   JSR L80E9
   LDX #$F8
   TXS
   JMP L81BC
L9AE0:
   LDX #$7
L9AE2:
   LDA VideoMatrix9h,X
   STA L14F0,X
   DEX
   BNE L9AE2
L9AEB:
   JMP L9AD4
L9AEE:
   DB $47,$41,$4D
   DB $45,$20,$4F
   DB $56,$45,$52
L9AF7:
   LDA #$14
   STA L3
   LDX #$0
L9AFD:
   LDA L9B53,X
   STA L4
   ;LDA #$4
   LDA #$44
   STA L5
   TXA
   CLC
   ADC #$C
   STA L2
   STX L7
   JSR L805E
   LDX L7
   LDA L2
   CLC
   ADC #$9
   STA L2
   ;LDA #$3
   LDA #$63
   STA L5
   LDA L14F1,X
   STA L4
   JSR L805E
   LDX L7
   INX
   CPX #$7
   BNE L9AFD
L9B2D:
   JMP L9987
L9B30:
   LDA #$4
   STA L39
   LDX #$6
L9B36:
   DEC VideoMatrix9h,X
   LDA VideoMatrix9h,X
   CMP #$2F
   BNE L9B52
L9B40:
   LDA #$39
   STA VideoMatrix9h,X
   DEX
   BNE L9B36
L9B48:
   LDX #$7
   LDA #$30
L9B4C:
   STA VideoMatrix9h,X
   DEX
   BNE L9B4C
L9B52:
   RTS
L9B53:
   DB $48,$49,$53
   DB $43,$4F,$52
L9B5A = * + 1
   DB $45,$8,$15
   DB $D,$1,$E
   DB $20,$5,$E
   DB $7,$9,$E
   DB $5,$5,$12
   DB $5,$4,$20
   DB $13,$F,$6
   DB $14,$17,$1
   DB $12,$5,$20
   DB $10,$12,$5
   DB $13,$5,$E
   DB $14,$13,$2E
   DB $2E,$2E,$20
   DB $20,$1,$14
   DB $14,$1,$3
   DB $B,$20,$F
   DB $6,$20,$14
   DB $8,$5,$20
   DB $D,$15,$14
   DB $1,$E,$14
   DB $20,$3,$1
   DB $D,$5,$C
   DB $13,$20,$20
   DB $20,$20,$20
   DB $20,$20,$20
   DB $20,$20,$20
   DB $20,$20,$0
L9BAA:
   STA L4004
   LDA #$F
   STA SIDFilterModeVolume
   RTS
L9BB3:
   LDX #$0
L9BB5:
   LDA L9C00,X
   STA CustomCharSet,X
   LDA L9D00,X
   STA CustomCharSet100h,X
   LDA L9E00,X
   STA CustomCharSet200h,X
   LDA L9F00,X
   STA CustomCharSet300h,X
   INX
   BNE L9BB5
L9BD0:
   JMP L8085
; cold start code, not needed when starting from tape/disk
;L9BD3:
;   LDX #$FF
;   SEI
;   TXS
;   CLD
;   STX VICContROL_AReg2
;   JSR LFDA3
;   JSR LFD50
;   JSR LFD15
;   JSR LE518
;   CLI
;   LDX #$FB
;   TXS
;   LDA #$8
;   JSR LFFD2
;   JMP L800C
   DB $16,$31,$2E
   DB $31,$20,$36
   DB $2F,$31,$2F
   DB $38,$33,$EA
L9C00 = * + 1
   DB $EA,$18,$18
   DB $18,$E7,$E7
   DB $18,$18,$18
   DB $F0,$20,$10
   DB $BF,$5F,$10
   DB $20,$F0,$18
   DB $18,$18,$18
   DB $BD,$D3,$89
   DB $91,$0,$20
   DB $60,$A3,$2C
   DB $30,$0,$0
   DB $0,$2,$5
   DB $C8,$30,$0
   DB $0,$0,$8
   DB $4,$3E,$20
   DB $10,$10,$8
   DB $8,$8,$8
   DB $10,$10,$8
   DB $4,$2,$4
   DB $18,$3C,$7E
   DB $3C,$7E,$FF
   DB $FF,$E7,$18
   DB $18,$18,$18
   DB $3C,$3C,$3C
   DB $18,$18,$3C
   DB $3C,$3C,$18
   DB $18,$18,$18
   DB $24,$24,$24
   DB $3C,$18,$3C
   DB $3C,$18,$1
   DB $3,$7,$3
   DB $7,$F,$F
   DB $E,$80,$C0
   DB $E0,$C0,$E0
   DB $F0,$F0,$70
   DB $0,$0,$0
   DB $18,$18,$0
   DB $0,$0,$0
   DB $0,$18,$3C
   DB $3C,$18,$0
   DB $0,$0,$0
   DB $3C,$24,$24
   DB $3C,$0,$0
   DB $81,$42,$3C
   DB $24,$24,$3C
   DB $42,$81,$FF
   DB $C3,$BD,$A5
   DB $A5,$BD,$C3
   DB $FF,$E7,$C3
   DB $A5,$18,$18
   DB $A5,$C3,$E7
   DB $30,$46,$48
   DB $FF,$FF,$12
   DB $62,$C,$C0
   DB $FC,$72,$F8
   DB $1F,$4E,$3F
   DB $3,$B,$2F
   DB $4E,$5E,$7A
   DB $72,$F4,$D0
   DB $3,$6,$D
   DB $1B,$36,$6D
   DB $DB,$B6,$C0
   DB $60,$B0,$D8
   DB $6C,$B6,$DB
   DB $6D,$30,$30
   DB $48,$48,$84
   DB $84,$2,$2
   DB $0,$3F,$63
   DB $60,$3E,$3
   DB $63,$7E,$0
   DB $3F,$63,$60
   DB $60,$60,$63
   DB $3F,$0,$45
   DB $6D,$55,$45
   DB $45,$0,$0
   DB $0,$D2,$1A
   DB $96,$12,$D2
   DB $0,$0,$0
   DB $55,$55,$75
   DB $55,$55,$0
   DB $0,$0,$D4
   DB $14,$5C,$54
   DB $D4,$0,$0
   DB $0,$10,$8
   DB $7C,$8,$10
L9D00 = * + 2
   DB $0,$0,$0
   DB $0,$0,$0
   DB $0,$0,$0
   DB $0,$0,$9A
   DB $0,$0,$0
   DB $0,$0,$0
   DB $70,$7C,$6F
   DB $63,$60,$60
   DB $60,$60,$0
   DB $1,$7,$1F
   DB $7F,$7F,$60
   DB $60,$7C,$FC
   DB $CC,$C,$FC
   DB $FC,$C,$C
   DB $E,$3E,$F6
   DB $C6,$6,$6
   DB $6,$6,$1F
   DB $3F,$70,$60
   DB $60,$70,$3F
   DB $1F,$F8,$FC
   DB $C,$0,$0
   DB $C,$FC,$F8
   DB $0,$0,$0
   DB $1D,$1E,$1F
   DB $B0,$B0,$B0
   DB $B0,$B0,$B0
   DB $B0,$B0,$B0
   DB $B0,$0,$1
   DB $2,$6,$4
   DB $6,$7,$4
   DB $5,$B,$7
   DB $8,$9,$7
   DB $6,$6,$7
   DB $8,$7,$8
   DB $9,$0,$0
   DB $7,$7,$5
   DB $7,$6,$6
   DB $9,$9,$3
   DB $0,$0,$0
   DB $0,$0,$0
   DB $0,$0,$B
   DB $B,$B,$0
   DB $0,$0,$0
   DB $0,$7C,$FE
   DB $E,$D6,$E6
   DB $C6,$FE,$7C
   DB $8,$8,$0
   DB $8,$8,$18
   DB $18,$18,$FC
   DB $FE,$2,$6
   DB $1C,$70,$FE
   DB $FE,$FC,$FE
   DB $2,$3C,$3C
   DB $2,$FE,$FC
   DB $18,$18,$D8
   DB $D8,$FE,$18
   DB $18,$18,$FE
   DB $FE,$0,$80
   DB $FC,$6,$FE
   DB $FC,$7C,$FE
   DB $0,$C0,$FC
   DB $C6,$FE,$7C
   DB $FE,$FE,$6
   DB $C,$18,$10
   DB $30,$30,$7C
   DB $FE,$6,$C6
   DB $7C,$C6,$FE
   DB $7C,$7C,$FE
   DB $6,$C6,$7E
   DB $6,$FE,$7C
   DB $1,$1,$1
   DB $1,$B,$C
   DB $9,$8,$80
   DB $80,$80,$80
   DB $D0,$B0,$10
   DB $90,$0,$0
   DB $0,$0,$F0
   DB $20,$10,$5F
   DB $BF,$10,$20
   DB $F0,$0,$0
   DB $0,$0,$0
   DB $87,$92,$89
   DB $84,$20,$9A
   DB $81,$3C,$42
   DB $99,$A1,$A1
   DB $99,$42,$3C
L9E00:
   DB $88,$22,$18
   DB $7D,$BC,$10
   DB $42,$14,$6
   DB $E,$2,$1E
   DB $3E,$66,$C6
   DB $0,$FC,$FE
   DB $2,$FC,$86
   DB $FE,$FC,$0
   DB $7C,$FE,$0
   DB $C0,$C0,$FE
   DB $7C,$0,$FC
   DB $FE,$2,$C6
   DB $C6,$FE,$FC
   DB $0,$FE,$FE
   DB $0,$F0,$C0
   DB $FE,$FE,$0
   DB $FE,$FE,$0
   DB $F8,$C0,$C0
   DB $C0,$0,$7C
   DB $FE,$0,$DE
   DB $C6,$FE,$7C
   DB $0,$C6,$C6
   DB $2,$FE,$C6
   DB $C6,$C6,$0
   DB $3C,$3C,$0
   DB $18,$18,$3C
   DB $3C,$0,$FE
   DB $FE,$0,$18
   DB $D8,$F8,$70
   DB $0,$CC,$D8
   DB $0,$F0,$D8
   DB $CC,$C6,$0
   DB $C0,$C0,$0
   DB $C0,$C0,$FE
   DB $FE,$0,$C6
   DB $EE,$2,$D6
   DB $C6,$C6,$C6
   DB $0,$C6,$C6
   DB $2,$D6,$CE
   DB $C6,$C6,$0
   DB $7C,$FE,$2
   DB $C6,$C6,$FE
   DB $7C,$0,$FC
   DB $FE,$2,$FC
   DB $C0,$C0,$C0
   DB $0,$7C,$FE
   DB $2,$C6,$C6
   DB $CE,$7E,$1
   DB $FC,$FE,$2
   DB $FC,$D8,$CC
   DB $C6,$0,$7C
   DB $FE,$0,$FC
   DB $6,$FE,$7C
   DB $0,$7E,$7E
   DB $0,$18,$18
   DB $18,$18,$0
   DB $C6,$C6,$2
   DB $C6,$C6,$FE
   DB $7C,$0,$C6
   DB $C6,$2,$C6
   DB $C6,$6C,$38
   DB $0,$C6,$C6
   DB $2,$C6,$D6
   DB $EE,$C6,$0
   DB $C6,$6C,$0
   DB $30,$38,$6C
   DB $C6,$0,$CC
   DB $CC,$0,$78
   DB $30,$30,$30
   DB $0,$FE,$FE
   DB $0,$38,$70
   DB $FE,$FE,$0
   DB $7E,$FF,$FF
   DB $FF,$FF,$FF
   DB $FF,$7E,$3C
   DB $3C,$FF,$EF
   DB $F7,$FF,$3C
   DB $3C,$18,$18
   DB $18,$E7,$E7
   DB $18,$18,$18
   DB $32,$7B,$FA
   DB $BC,$88,$88
   DB $88,$CC,$3
   DB $7,$F,$B
   DB $18,$10,$10
L9F00 = * + 1
   DB $18,$10,$98
   DB $90,$E0,$80
   DB $40,$40,$60
   DB $4C,$DE,$5F
   DB $3D,$11,$11
   DB $11,$33,$C0
   DB $E0,$F0,$D0
   DB $18,$8,$8
   DB $18,$8,$19
   DB $9,$7,$1
   DB $2,$2,$6
   DB $0,$6F,$6D
   DB $6D,$6D,$6D
   DB $6F,$0,$0
   DB $BE,$B0,$BE
   DB $B6,$B6,$BE
   DB $0,$18,$10
   DB $18,$7E,$18
   DB $78,$44,$6
   DB $0,$0,$0
   DB $0,$0,$0
   DB $0,$0,$1
   DB $1,$1,$3
   DB $5,$1,$2
   DB $2,$80,$0
   DB $80,$C0,$A0
   DB $80,$40,$40
   DB $18,$8,$18
   DB $7E,$18,$1E
   DB $22,$60,$0
   DB $0,$0,$0
   DB $0,$0,$0
   DB $0,$80,$80
   DB $80,$C0,$A0
   DB $80,$40,$40
   DB $1,$0,$1
   DB $3,$5,$1
   DB $2,$2,$10
   DB $28,$10,$F8
   DB $94,$10,$28
   DB $28,$10,$28
   DB $12,$3C,$50
   DB $90,$A8,$24
   DB $0,$0,$70
   DB $FF,$FF,$70
   DB $0,$0,$0
   DB $0,$E,$FF
   DB $FF,$E,$0
   DB $0,$3,$7
   DB $E,$1C,$38
   DB $70,$E0,$C0
   DB $0,$0,$14
   DB $7C,$26,$7C
   DB $8,$0,$0
   DB $62,$56,$2A
   DB $24,$54,$6E
   DB $40,$C0,$E0
   DB $70,$38,$1C
   DB $E,$7,$3
   DB $44,$AA,$91
   DB $7A,$BC,$A2
   DB $D5,$8A,$0
   DB $0,$0,$0
   DB $0,$60,$60
   DB $0,$0,$0
   DB $7E,$FF,$FF
   DB $7E,$0,$0
   DB $0,$0,$0
   DB $0,$0,$60
   DB $20,$40,$3
   DB $7,$E,$1C
   DB $18,$0,$C0
   DB $C0,$CE,$CF
   DB $EC,$CE,$C8
   DB $CE,$EC,$40
   DB $8D,$96,$9C
   DB $CD,$8C,$8D
   DB $EC,$58,$8E
   DB $81,$E8,$D9
   DB $DC,$D4,$CC
   DB $46,$31,$32
   DB $73,$29,$5
   DB $37,$B3,$53
   DB $37,$C4,$BB
   DB $70,$37,$27
   DB $32,$43,$0
