Partly documented Turbo-ASS source code of the transfer system »FCopy-PC v1.0« (only C64 part)



;   The Whiz-zards Association 1988
;          FCOPY III source
;      changed for 256K system
;             by Merlin.

tel      = 7
topo     = 8
gepo     = 9
ca6      = $a6
ca7      = $a7
caa      = $aa
cab      = $ab
led0c    = $ed0c
ledb9    = $edb9
leddd    = $eddd
ledfe    = $edfe

coff     = $2100
doffs    = $3800
xtra     = $4000

         *= $3600

l4070    lda #<doffs+$0700
         ldy #>doffs+$0700
         sta ca6
         sty ca7
         lda #$00
         ldy #$07
         sta caa
         sty cab
l4085    jsr l401d
         ldy #$02
l408a    lda l4100,y
         jsr leddd
         dey
         bpl l408a
         lda caa
         jsr leddd
         lda cab
         jsr leddd
         lda #$22
         jsr leddd
         ldy #$00
         tax
l40a5    lda (ca6),y
         jsr leddd
         inc ca6
         bne l40b0
         inc ca7
l40b0    inc caa
         bne l40b6
         inc cab
l40b6    dex
         bne l40a5
         jsr ledfe
         lda caa
         cmp #$60
         bcc l4085
         jsr l401d
         ldy #$04
l40c7    lda l4104,y
         jsr leddd
         dey
         bpl l40c7
         jsr ledfe
         sei
         lda #<doffs
         ldy #>doffs
         sta ca6
         sty ca7
         ldx #$07
         ldy #$00
         sty caa
l40e2    ldy caa
         lda (ca6),y
         sty caa
         jsr l4000
         inc caa
         bne l40e2
         inc ca7
         dex
         bne l40e2
         lda #$1b
         sta $d011
         jmp l6000

l4000    ldy #$ff
         sty $dd03
         ldy #$0b
         sty $dd00
         ldy #$03
l400c    bit $dd00
         bpl l400c
         sta $dd01
         sty $dd00
l4017    bit $dd00
         bmi l4017
         rts

l401d    lda #$08
         jsr led0c
         lda #$6f
         jmp ledb9

l4100    .byte $57,$2d,$4d

l4104    .byte $07,$00,$45,$2d,$4d

llo      = 2
lhi      = 3
klo      = 4
khi      = 5
lfr      = 6
getbn    = 7
hfhr     = 8
ltab     = 9

l6000    sei
         lda #$3c
         sta $dd02
         lda #$80
         sta $dd07
         ldx #$2e
         lda #0
l6019    sta $d000,x
         dex
         bpl l6019
         lda #$7f
         sta $dc0d
         lda $dc0d
         lda #$27
         sta $d018
         lda #$c8
         sta $d016
         lda #$0d
         sta $d021
         lda #$05
         sta $d020
         ldx #$00
l6042    sta $d800,x
         sta $d900,x
         sta $da00,x
         sta $dae8,x
         inx
         bne l6042
         ldx #$18
l6063    lda l5f80,x
         sta $d400,x
         dex
         bpl l6063

         ldy #0
         lda #<coff
         sta 2
         lda #>(coff+$0100)
         sta 3
         sty 4
         lda #>$0100
         sta 5
         ldx #$20
xjjxj    lda (2),y
         sta (4),y
         iny
         bne xjjxj
         inc 3
         inc 5
         dex
         bne xjjxj
xxjj     lda l6100,y
         sta l1237,y
         iny
         bne xxjj
xjsi     lda coff+1,y
         sta 1,y
         iny
         bne xjsi
         lda #$1b
         sta $d011
         jmp begin


dd676    = $d676
df24b    = $f24b
df40b    = $f40b
df41e    = $f41e
df497    = $f497
df4f0    = $f4f0
df505    = $f505
df50a    = $f50a
df556    = $f556
df6c5    = $f6c5
df8ec    = $f8ec
df934    = $f934
df940    = $f940
df969    = $f969
dfda3    = $fda3
dfe00    = $fe00
dfe0e    = $fe0e
dfedb    = $fedb

         *= $00
         .offs doffs

d00      .byte $01,$01,$01,$01,$01
         .byte $00
d06      .byte $06,$00
d08      .byte $06
d09      .byte $01
d0a      .byte $06
d0b      .byte $0e
d0c      .byte $02
d0d      .byte $06
d0e      .byte $00
d0f      .byte $0d
d10      .byte $00,$00
d12      .byte $00
d13      .byte $07
d14      .byte $01
d15      .byte $04
d16      .byte $ee
d17      .byte $0d
d18      .byte $00
d19      .byte $00
d1a      .byte $00
d1b      .byte $00,$00
d1d      .byte $01,$00,$00
d20      .byte $30
d21      .byte $00
d22      .byte $06
d23      .byte $00
d24      .byte $52
d25      .byte $65,$25,$29,$52,$54
         .byte $e5,$35
d2c      .byte $29,$4a
d2e      .byte $00
d2f      .byte $04
d30      .byte $00
d31      .byte $03,$06,$00
d34      .byte $0a
d35      .byte $00
d36      .byte $ff
d37      .byte $00,$07,$08,$7b
d3b      .byte $00
d3c      .byte $00,$00,$00,$00,$06
         .byte $00,$01
d43      .byte $15,$60,$60
d46      .byte $00,$07,$fe,$18,$00
         .byte $02,$04,$00
d4e      .byte $01,$ba,$00
d51      .byte $07,$03,$23,$00,$00
         .byte $0a,$13,$12
         .byte $13,$0a,$0a,$0a,$0a
         .byte $02,$12,$00
         .byte $00,$05,$fa,$05

d65      dex
         bne d9a
         lda #$f2
         inx
         stx d35
         ldx d19
         sta d06a5,x
         jmp d01cc

d75      lda #$c0
         sta d2c
         bne d7b
d7b      sta d00
         cli
d7e      lda d00
         bmi d7e
d82      bit d20
         bvs d82
         bmi d82
         sei
         rts

d8a      stx d19
         txa
         eor d18
         eor d17   ; disk id!
         eor d16   ; disk id 2!
         sta d1a
         jsr df934 ; gcr header
         ldx #$5a
d9a      jsr df556 ; find sync
d9d      bvc d9d
         clv
         lda $1c01
         cmp d24,y
         bne d65
         iny
         cpy #$08
         bne d9d
         jsr df556
         lda #$06
         sta d31
         ldy #$ba
db6      bvc db6
         clv
         lda $1c01
         sta (d30),y
         iny
         bne db6
dc1      bvc dc1
         clv
         lda $1c01
         sta d0700,y
         iny
         bne dc1
         sty d23
         ldy #$bd
dd1      ldx #$05
dd3      lda (d30),y
         cmp d02ee-1,x
         bne def
         iny
         cpy d23
         beq de4
ddf      dex
         bne dd3
         beq dd1
de4      tya
         bne df1
         inc d31
         lda #$fb
         sta d23
         bne ddf
def      ldx #$00
df1      stx d37
         jmp d0168

df6      lda #$08
         jsr or1c00
         lda d09    ; scrn code
         cmp #$4c
         beq d010a  ; L?? error
         cmp #$46
         bne d0116  ; F?? error
         jsr dfda3
         beq d010d
d010a    jsr dfe0e
d010d    jsr dfe00
         jsr or1c00
         jmp df505

d0116    lda #$07 ; normal data header?
         sta d31 ; hi GCR code ptr
         sta d2f
         lda d12 ; copy disk id
         ldx d13
         sta d16 ; to 16/17
         stx d17
         eor d18
         eor d17
         sta d09  ; bereken hdr chk
         lda #$00
         sta d0a
         sta d34
         sta d19  ; se=0

d0132    eor d09  ; chk eor se
         sta d1a  ; checksum
         jsr df940 ;code headers for
                  ; every sector
                  ; written at (d30)
         inc d19  ; write header?
         lda d19
         cmp d43  ; max se p tr
         bcc d0132; do nxt se
         jmp d0550

d0144    lda #$ff
d0146    bvc d0146
         clv
         sta $1c01
         dex
         bne d0146
         rts

         *= $0168
dstc     = *-$0101

d0168    ldy d3c
         bmi d0188
         lda #$ff
         sta d3c
         jsr getcb ;$f1(ok),5=c,$f4
         tax
         jsr waitfc
         txa
         bmi d0181
         ldx d06a5,y
         beq d0181
         ora #$f0
d0181    sta d06a5,y
         bmi d0188
         inc d0a
d0188    lda d0a   ; te c. se's
         bne d018f
         jmp df505
d018f    ldy d37
         bmi d01cc
         lda d19   ; gelezen se.
         sta d3c
         jsr putcb
         stx d37
         tya
         jsr putcb2 ; 0=+,2=-
         ldy #$ba
         ldx d06ba
         bne d01af
d01a7    ldx d06ba-$ba,y
d01aa    bit $180d
         beq d01aa
d01af    stx $1801
         bit $1800
         iny
         bne d01a7
d01b8    ldx d0700,y
d01bb    bit $180d
         beq d01bb
         stx $1801
         bit $1800
         iny
         bne d01b8
         jsr waitfc
d01cc    lda $1c00
         eor #$08
         sta $1c00
         ldx d19
         dec d0a
         bne d01dd
         jmp d0168  ; tr. ready
d01dd    txa
         clc
         adc d35    ;????

d01e1    cmp d43    ; maxse
         bcc d01e7
         sbc d43
d01e7    tax        ; next se
d01e8    cpx d3c    ; last se
         beq d01f1
         lda d06a5,x ; sector done?
         bpl d01f5
d01f1    inx         ; yes
         txa
         bpl d01e1
d01f5    lda #$03    ; no
         sta d35
         jmp d8a

d01fc    ldx #$ff
         stx d3c
         stx d37
         inx
         lda d0e
         bne d01e8
         lda d43 ; tot no.se's
         sta d23
d020b    lda #$5a
         sta d46   ; sync present ??
d020f    ldy #$ff
         sty $1805
         ldx #$64
d0216    lda $1c00
         bpl d0225
         lda $1805
         bne d0216
         lda #$06  ; no (L?-error)
         jmp df969

d0225    lda $1c01
         clv
d0229    bvs d0234
         dey
         bne d0229
         dex
         bne d0229
         jmp df6c5 ; no data .

d0234    clv
         ldy $1c01
         cpy #$52  ; header
         beq d0243
         dec d46
         bne d020f
d0240    jmp df40b ; bad header.(H)

d0243    ldx #$00
d0245    bvc d0245
         clv
         lda $1c01
         sta d25,x
         inx
         cpx #$07
         bcc d0245
         stx d0c
         jsr df497 ; de-gcr header
         ldx d19
         txa
         eor d16
         eor d17
         eor d18
         eor d1a
         beq d026b
         dec d23
         bne d020b
         jmp df41e ; h. checksum (I)

d026b    lda d06   ; tr
         cmp d18   ; he. tr
         bne d0240
         lda d0b   ; get ID?
         bne d027d
         lda d16   ; yes
         sta d12
         lda d17
         sta d13
d027d    inx       ; sector+1
         stx d0b   ; never 0
         txa
         jmp d01e1

d0284    lda #$ff
         jsr putcb
         lda d06
         sta d18   ; track
         jsr putcb2
         lda $1801
         jsr getcb
         bne getcb2
         jmp d0346 ; r/s gedrukt.

getcb    lda #$00
         sta $1803
getcb2   lda #$10
d02a2    bit $180d
         beq d02a2
         lda $1800
         lda $1801
         rts

putcb    ldx #$ff
         stx $1803
putcb2   sta $1801
waitfc   lda #$10
d02b8    bit $180d
         beq d02b8
         lda $1800
         rts

d02c1    lda #$00
         sta d1d
         sta d0e
         rts

ledoff   lda #$00
or1c00   sta d21
         lda $1c00
         and #$f7
         ora d21
         sta $1c00
         rts

d02d7    lda d0e
         sec
         sbc dfedb,y
         sta d0e
         lda dfedb,y
         inc d1d
         bne d02e8
d02e6    lda d0e
d02e8    cli
         jsr dd676
         sei
         rts

d02ee    .byte $b5,$d4
         .byte $52
         .byte $4b
         .byte $2d

         *= $0300

d0300    lda d00
         and #$06
         beq d0317
         cmp #$02
         beq d0314
         cmp #$06
         beq d0311
         jmp df6
d0311    jmp df505
d0314    jmp d01fc
d0317    ldx #$07
         stx d31
         dex
         stx d4e
         jsr df50a
d0321    bvc d0321
         clv
         lda $1c01
         sta (d30),y
         iny
         bne d0321
         ldy #$ba
d032e    bvc d032e
         clv
         lda $1c01
         sta d06ba-$ba,y
         iny
         bne d032e
         sty d36
         sty d34
         sty d2e
         jsr df8ec
         jmp df4f0

d0346    ldx #dstc
         txs
         jsr d02c1
         sta d2c
         lda #$04
         jsr or1c00 ;led off,motor on
         jsr getcb
         sta d3b ; tries
         jsr getcb2
         sta d10 ; track to go to
         jsr getcb2
         beq d0364
         lda #$f1
d0364    sta d08   ;All=0,Used=$f1
         lda #$08
         jsr or1c00 ;led on
         lda d08
         sta d0b  ; get id once if 0
         beq d03ca
         lda #$12
         sta d06   ; read track 18
d0375    ldx #$03
d0377    lda #$b0  ; read header?
         jsr d7b   ; get curr.tr
         lda #$e0
         jsr d7b   ; exec $300
         cmp #$01
         beq d03a6
         lda d2c
         bne d038e
         jsr d75   ; goto tr?
         bpl d0377
d038e    dex
         bne d0377
         ldy d1d
         lda dfedb,y
         bne d03a0
         jsr d02e6
         ldx #$81
         jmp d04f8
d03a0    jsr d02d7
         jmp d0375

d03a6    jsr d02e6
         ldx #$05
         ldy #$00
d03ad    txa
         and #$03
         beq d03b9
         lda d0700,x
         sta d0639,y
         iny
d03b9    inx
         cpx #$91
         bcc d03ad
         lda #$00
         sta d066c
         sta d066d
         sta d066e
;         nop      ;??????
d03ca    lda d10   ; tr. to go to
         sta d06
d03ce    jsr ledoff
         lda #$80
         jsr putcb ; eerste byte.
         lda d06
         sta d14   ; first track
d03da    jsr df24b
         sta d43   ; no. of sects
         lda d06
         asl a
         adc d06
         tax       ; x=tr*3
         ldy #$00
         sty d0a
d03e9    lda #$08
         sta d23
d03ed    lsr d0639-3,x ;bam, used se?
         bcs d03f5
         lda #$00
         .byte $2c
d03f5    lda d08    ; all=0/used=$f1
         sta d06a5,y;bij all b.alles 0
         and #$80
         bne d0400
         inc d0a   ; no. te zenden secs
d0400    iny
         cpy d43   ; no.se per tr
         bcs d040c
         dec d23   ; 8 bits
         bne d03ed
         inx
         bne d03e9
d040c    lda d0a   ; te copyen se's
         bne d0413
         jmp d04b5 ; klaar met tr.
d0413    jsr d0284 ; r/s en haal hi adr
         clc
         adc d0a   ; st.adr+te c.se's
         jsr waitfc
         bcc d0423
;       ldx #$88  ; geh. adr overflow
         jmp dsnid
d0423    jsr d02c1 ;d1d=0,d0e=0
         sta d0c   ;=0
d0428    sta d19
         lda d3b
         sta d0f
d042e    ldx #$03
d0430    lda #$e2
         jsr d7b   ;start $300
         ldy d3c
         bmi d0442
         jsr getcb ;error code
         sta d06a5,y ;sector done?
         jsr waitfc
d0442    lda d00
         cmp #$03  ; error? no track??
         bne d044b
         dex
         bne d0430
d044b    cmp #$01
         beq d0458
         ldx d19
         sta d06a5,x
         lda d0c
         beq d0490
d0458    ldy d1d
         lda dfedb,y
         beq d048d
         ldx #$00
         stx d0a
         ldx d43
d0465    lda d06a4,x
         cmp #$f1   ; unused se?
         beq d0473
         inc d0a    ; sectors to send.
         lda #$00
         sta d06a4,x
d0473    dex
         bne d0465
         lda d0a
         beq d048d
         dec d0f
         bne d042e
         lda d2c
         beq d0488
         jsr d02d7
d0485    jmp d0428

d0488    jsr d75
         bpl d0485
d048d    jsr d02e6
d0490    ldy #0  ;#1
 ;        dey
  ;       beq d04a0
   ;      lda #$82
    ;     jsr putcb
     ;    lda $1801
      ;   jmp d0346

d04a0    lda d06a5,y
         ora #$f0
         cmp #$f1
         beq d04b0
         jsr putcb
         tya
         jsr putcb2
d04b0    iny
         cpy d43
         bne d04a0
d04b5    inc d06  ; next track
         lda d06
;         cmp #$30 ; 48?
;         bcs d04f0
         jmp d03da

d04c0    lda d14   ; start write
         sta d06  ; get first tr

         jsr getcb2
         sta d12 ; set id1
         jsr getcb2
         sta d13 ; set id2

         jsr waitfc

         lda #$e6
         jsr d7b   ; goto first track
d04c9    jsr d0284 ; send track,r/s
         sta d09   ; scherm error code
         jsr waitfc
d04d1    lda d3b
         sta d0f
d04d5    lda #$e4
         jsr d7b   ; write track.
         cmp #$01
         bne d0527
d04de    lda $1800
         inc d06
         lda d06
         cmp #$24
         bcs d0500
 ;        cmp d1b
 ;        beq d04fd ; never.
         jmp d04c9 ; next track

dsnid    lda #$91
         jsr putcb
         lda d12  ;disk id1
         jsr putcb2
         lda d13  ;disk id2
         jsr putcb2
         ldx #$88
;         .byte $2c
;d04f0    ldx #$fe

;d04f2
         lda d06   ; last track read
         sta d1b    ; end track
d04f6    lda #$08
d04f8    jsr or1c00  ; led on
         txa
;         .byte $2c
;d04fd    lda #$fd
         .byte $2c
d0500    lda #$fd
d0502    jsr putcb
         lda $1801
         jsr getcb  ; status?
         tax
         bne d0511
         jmp d0346  ; kappen
d0511    cpx #$06
         bcs d04c0
         jsr waitfc
         cpx #$01
         beq d04d1 ; re-write tr
         cpx #$02
         beq d04de ; write next tr
         cpx #$05
         beq d04f6 ; led on
;         cpx #$04
 ;        bne d04c0 ; no, start write
         jmp d03ce ; start reading

d0527    ldx d0a
         beq d0544
         lda d15
d052d    clc
         adc #$ba
         tay
         ldx #$02
d0533    jsr getcb2
         iny
         bne d0533
         dex
         bne d0533
         txa
         dec d0a
         bne d052d
d0541    inx
         bpl d0541
d0544    lda $1800
         lda #$fb
         dec d0f
         beq d0502
         jmp d04d5

d0550    lda #$01
         sta d46
         lda #$00
         sta d0d
         jsr putcb ; klaar formatteren?
         inc $1803
         jsr d0628 ; ledje
d0561    lda #$55
         jsr d0146 ;write $55 255 maal
         ldx #$06
         jsr d0144 ;write $ff six times
d056b    bvc d056b
         clv
         lda $1801 ; header byte
         sta $1c01
         ldx #$09
         ldy d46
d0578    bvc d0578
         clv
         lda (d30),y ;write header
         sta $1c01
         iny
         dex
         bne d0578
         lda #$55
         ldx #$09
         jsr d0146 ;write $55 10 maal
         ldx #$05  ; gap
         jsr d0144 ; sync
         dex
         ldy #$bb
d0593    bvc d0593
         clv
         lda $1801 ; 364 GCR coded
         sta $1c01
         iny
         bne d0593
         inx
         beq d0593
         ldx d51
         lda d46
         clc
         adc #$0a
         sta d46
         dec d19
         bne d0561
d05af    bvc d05af
         jsr dfe00
         lda $1800
         jsr ledoff
         lda d43
         sta d0a
         lda #$00
         sta d46
         sta d15
         jsr putcb
         inc $1803
d05ca    jsr df556
         ldy d46
         ldx #$09
d05d1    bvc d05d1
         clv
         lda $1c01
         sta d09
d05d9    bvc d05d9
         clv
         iny
         lda $1c01
         eor d0700,y
         beq d05e7
         sta d0d
d05e7    dex
         bne d05d9
         inc d15
         lda $1801
         eor d09
         bne d0621
         iny
         sty d46
         jsr df556
         sty d15
         dey
         ldx #$bc
d05fe    bvc d05fe
         clv
         lda $1801
         eor $1c01
         bne d0624
d0609    inx
         bne d05fe
         iny
         beq d05fe
d060f    bvc d060f
         lda $1801
         dec d0a
         lda d0d
         bne d0621
         lda d0a
         bne d05ca
         jmp df505
d0621    jmp df6c5

d0624    sta d0d
         bne d0609
d0628    lda $1c0c
         and #$1f
         ora #$c0
         sta $1c0c
         lda #$ff
         sta $1c03
         rts

         *= $0638


d0638    .byte $00
d0639    .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00
         .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00
         .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00
         .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00
         .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00
         .byte $00,$00,$00,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06
d066c    .byte $06
d066d    .byte $06
d066e    .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06
d06a4    .byte $06
d06a5    .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
d06ba    .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06,$06,$06
         .byte $06,$06,$06,$06,$06
         .byte $06

         *= $0700

d0700    lda #$06
         sta d06
d0704    ldx #$b0
         stx d00
d0708    ldx d00
         bmi d0708
         cmp d22
         bne d0704
         sei
         nop
         ldx #$00
         stx $1803
d0717    ldy #$10
d0719    bit $1800
         bpl d0719
         sty $1800
         ldy #$0f
d0723    bit $1800
         bmi d0723
         lda $1801
         .byte $9d,0,0
d072d    = *-1
         sty $1800
         inx
         bne d0717
         inc d072d
         lda d072d
         cmp #$07
         bne d0717
         lda #$0b
         sta $180c
         lda #$10
         sta $1800
         lda #$e0
         sta $1807
         lda #$ff
         sta $1806
         jmp d0346

; The Whiz-zards Association 1988

         *= $00
         .offs coff

l00      .byte $df
l01      .byte $dd,$42
te1      .byte $01,$04,$20
         .byte $42,$41,$4d
         .byte $2d,$50,$12,$05,$13
         .byte $13,$20,$53
         .byte $54,$4f,$50,$00
te2      .byte $43,$0f,$10,$19,$20
         .byte $44,$09,$13,$0b,$00
te3      .byte $44,$09,$12,$05,$03
         .byte $14,$0f,$12,$19,$00
te4      .byte $45,$0e,$04,$20,$0f
         .byte $06,$20,$43
         .byte $0f,$10,$19,$00
te5      .byte $52,$05,$01,$04,$19
         .byte $2e,$2e,$2e,$00
 ;        .byte $49,$0e,$13,$05
  ;       .byte $12,$14,$20,$4f,$12
   ;      .byte $09,$07,$09
    ;     .byte $0e,$01,$0c,$00
te6      .byte $55,$13,$05,$12
         .byte $20,$42,$12,$05
         .byte $01,$0b,$00
te8      .byte $49,$0e,$13,$05,$12
         .byte $14,$20,$42,$01,$03
         .byte $0b,$15,$10,$00
te9      .byte $42,$01,$04,$20
         .byte $54,$12,$01
         .byte $03,$0b,$00
te10     .byte $47,$05,$14,$20
         .byte $44,$09,$13,$0b,$00
te11     .byte $53,$05,$0e,$04
         .byte $20,$44,$09
         .byte $13,$0b,$00
teini    .byte $57,$01,$09,$14
         .byte $09,$0e,$07,$20
         .byte $43,$0f,$0e,$0e
         .byte $05,$03,$14,$09
         .byte $0f,$0e,$00
te12     .byte $d5,$93,$85,$84,$00
te13     .byte $a0,$c1,$8c,$8c,$00
te14     .byte $d9,$85,$93,$00
te15     .byte $ce,$8f,$a0

l9d      .byte $00
l9e      .byte $a9
l9f      .byte $ea
la0      .byte $00 ; all bl.
la1      .byte $79
la2      .byte $00
la3      .byte $f4
la4      .byte $00
la5      .byte $00
la6      .byte $10
la7      .byte $02
la8      .byte $00
la9      .byte $04
laa      .byte $bf
lab      .byte $a9
lac      .byte $01
lad      .byte $00
lae      .byte $00
chksum
laf      .byte $b1  ;,$0
lb1      .byte 0
lb2      .byte $20
lb3      .byte $40
lb4      .byte $00
lb5      .byte $00
lb6      .byte $00
lb7      .byte $10
lb8      .byte $01
lb9      .byte $01
lba      .byte $00 ; repair no
lbb      .byte $e2
lbc      .byte $00
lbd      .byte $00
lbe      .byte $a0
lbf      .byte $01
lc0      .byte $20
lc1      .byte $f6
lc2      .byte $e0
lc3      .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00,$00
         .byte $00,$00,$00,$00
         .byte $00,$00,$00,$00
         .byte $00,$00,$00,$00
ld9      .byte $00
llda     .byte $00
ldb      .byte $00
ldc      .byte $00
begtr    .byte 1
endtr    .byte 36
putmode  .byte 0
tmp      .byte 0
lid1     .byte 0
lid2     .byte 0

lfc      ldx #$00
                      ; x=sector
lfe      lda seadr,x  ;se in geheugen?
         beq l0118    ; nee
         ldy lab
         sta l1067,y
         lda hdrda,x  ; bewaar data hdr
         sta sehdr,y
         lda chksm,x  ; bewaar chksum
         sta sechk,y
         inc lab      ; se data ptr ++
         bne l0126
l0118    lda seemp,x  ; se empty?
         beq l0126    ; nee,niet gelezen
         lda em1st,x  ; bewaar 1st byte
         ldy lac      ; in extra buffer
         sta (la1),y  ; (a1/a2)
         dec lac
l0126    inx
         cpx #$15    ; max.sects+1
         bcc lfe
         lda lbb     ; scan=1
         beq l0135
         lda #$18
         sta la3     ; herstel hi-adress
         lda #0
         sta lab     ; en se data ptr
l0135    rts

l0136    ldx #te1  ; Bad bam-press stop
         jsr l0c06
         lda #$7f
         sta $dc00
l0140    cmp $dc01
         bne l0140
l0145    ldx #te6  ; User break
         bne l0156
l0149    lda lbb   ; scan=1
         bne l0159
         ldx #te4  ; End of copy
l0156    jsr l0c1c
l0159    jsr waitfd
         and #$00
         jsr putdb ; send 0
         jmp begin

         *= *+20
cstack   = *-$0101

l0186    ldx #te5   ; insert source
         jsr l0c06
         lda #$7f
         sta $dc00
         ldx #$ef
l0192    cmp $dc01
         beq readt  ; run/stop
         cpx $dc01  ; space
         bne l0192
readt    jsr clrln  ; clear comndline
l01a0    lda #$18
         clc
         adc lbc  ; m=$15,s=1
         sta la3  ; $18=c,d $19=s $2d=m
         sta la4  ; read mode > 0
         ldx #$00
         stx lab
         stx la1
         dex
         stx la2
         stx lac
         lda la0
         beq l01b9
         lda #$01
l01b9    sta lb9  ;all=0,used=1

l01bb    lda #$00
         tax
l01be    sta hdrda,x
         inx
         bpl l01be  ;clear sector tables

nxtse    jsr getdb  ; wacht op een disk
         bpl l01cc  ; actie. Error ?
         jmp l0446  ; ja

l01cc    sta lae  ; gelezen sector
         tay
         jsr getdb2 ;0=volle s,2=lege s
         sta la7
         lda seadr,y ; al gelezen?
         beq l01df   ; neu
         ldy #$00    ; joa, dan geen
         sty la7     ; extra geh. nodig
         beq l01e8
l01df    inc la3    ; hi teller
         lda la3
         sta seadr,y ; waar staat se?
         ldy #$00
l01e8    sta l9e    ; hi van se.
         sta l03a8
l01ed    lda $dd0d
         beq l01ed
         lda $dd01
         sta sbuf0,y
         iny
         bne l01ed
         ldy #$ba
l01fd    lda $dd0d
         beq l01fd
         lda $dd01
         sta sbuf1,y
         iny
         bne l01fd
         dec l01     ; I/O off
         ldy #$00
         sty lb4
         ldx #$00
         beq l021a   ; decodeer se
l0215    jmp l02c1

l0218    ldx laf
l021a    lda sbuf0,x ; de-GCR.
         inx
         beq l0215
         sta lc2
         lsr a
         lsr a
         lsr a
         tay
         lda l0f4f,y
         sta la6
         lda sbuf0,x
         asl a
         rol lc2
         asl a
         rol lc2
         lda sbuf0,x
         lsr a
         and #$1f
         tay
         lda l0f4f,y
         sta la9
         inx
         lda sbuf0,x
         ror a
         lsr a
         lsr a
         lsr a
         tay
         lda l0f2f,y
         ora la9
         sta lc1
         inx
         lda sbuf0,x
         asl a
         rol l13ff,x
         lsr a
         lsr a
         lsr a
         tay
         lda l0f2f,y
         sta laa
         inx
         lda sbuf0,x
         sta la5
         and #$1f
         tay
         lda l0f2f,y
         sta l9f
         lda l13ff,x
         asl la5
         rol a
         asl la5
         rol a
         asl la5
         rol a
         and #$1f
         tay
         lda l0f4f,y
         sta ld9
         stx laf
         lda lc2
         and #$1f
         tay
         lda l0f2f,y
         ora la6
         ldy lb4
         beq l02b7
         sta (l9d),y
         iny
l0296    lda lc1
         sta (l9d),y
         iny
         lda l13fe,x
         and #$1f
         tax
         lda l0f4f,x
         ora laa
         sta (l9d),y
         iny
         lda ld9
         ora l9f
         sta (l9d),y
         iny
         sty lb4
         inc laf
         jmp l0218

l02b7    sta lbe
         beq l0296

l02bb    ldx laf
         lda l13ba,x
         inx
l02c1    sta lc2
         lsr a
         lsr a
         lsr a
         tay
         lda l0f4f,y
         sta la6
         lda l13ba,x
         asl a
         rol lc2
         asl a
         rol lc2
         lda l13ba,x
         lsr a
         and #$1f
         tay
         lda l0f4f,y
         sta la9
         inx
         lda l13ba,x
         ror a
         lsr a
         lsr a
         lsr a
         tay
         lda l0f2f,y
         ora la9
         sta lc1
         inx
         lda l13ba,x
         asl a
         rol l13b9,x
         lsr a
         lsr a
         lsr a
         tay
         lda l0f2f,y
         sta laa
         inx
         lda l13ba,x
         sta la5
         and #$1f
         tay
         lda l0f2f,y
         sta l9f
         lda l13b9,x
         asl la5
         rol a
         asl la5
         rol a
         asl la5
         rol a
         and #$1f
         tay
         lda l0f4f,y
         sta ld9
         stx laf
         lda lc2
         and #$1f
         tay
         lda l0f2f,y
         ora la6
         ldy lb4
         sta (l9d),y
         lda lc1
         iny
         beq l0358
         sta (l9d),y
         iny
         lda l13b8,x
         and #$1f
         tax
         lda l0f4f,x
         ora laa
         sta (l9d),y
         iny
         lda ld9
         ora l9f
         sta (l9d),y
         inc laf
         iny
         sty lb4
         jmp l02bb

l0358    sta lbf   ; checksum
         lda la7   ; 0=volle s,2=lege s
         beq l0395
         lda lbe   ; data header byte
         cmp #$07
         bne l0395 ;  niet goed.
         ldy #$ff
         lda (l9d),y
         ldy #$01
         cmp (l9d),y
         bne l0395
         tya
         eor lbf
         dey
         cmp (l9d),y ; 1st byte
         bne l0395
         ldx la1     ; empty se.
         bne l037c   ;lege se data ptr--
         dec la2
l037c    dec la1
         inc lac     ; aantal lege se.
         ldx lae     ; se
         sta em1st,x ; 1st byte
         dec la3     ; hi mem ptr-1
         lda #$00
         sta seadr,x
         lda #$01
         sta lb9
         sta seemp,x
         bne l03ba
l0395    ldx lae   ; normal se
         lda lbf    ; chksum
         sta chksm,x
         lda lbe    ; data (7)
         sta hdrda,x
         ldy #$00
         sty la7
         tya
l03a8    = *+2
l03a6    eor $ff00,y
         iny
         bne l03a6
         ldy #$f4
         ldx lbe
         cpx #$07
         bne l03bc ; no data(7)
         ldy #$05
         cmp lbf
         bne l03bc ; chksum err.
l03ba    ldy #$f1  ; okidoki
l03bc    inc l01
         dec $dd03
         sty $dd01  ; error code
l03c4    lda $dd0d
         beq l03c4
         lda $dd01
         lda ldc    ; dir=1
 ;    bne l03e2  ;geen code op scherm
         lda #$2d
         ldx la7    ; 2= lege s.
         bne l03dd
         tya
         and #$0f
         tay
         lda l0c5a,y
l03dd    ldx lae
         jsr l0cf1
l03e2    jmp nxtse  ; volgende se

l03e5    jsr lfc   ; bewaar se data
l03f1    ldx #te8  ;insert destination
         jsr l0c06
         jsr getblk1
         sta lid1
         jsr getblk1
         sta lid2
;l03fc    lda lbc   ; m=$15 (s=1)
        ; beq l0416
;         lda #$fd
 ;        sta $dc00
  ;       lda $dc01
   ;      cmp #$bf
    ;     bne l0416 ; nog eens schrijven
     ;    jmp l04d6 ; E=end, weer lezen.
;l0416
         lda #$7f
 ;        sta $dc00
  ;       ldx $dc01
   ;      cpx #$ef
    ;     beq l042a ; starten,$7f
     ;    cmp $dc01
      ;   bne l03fc
       ;  jmp l0145 ; kappen
         bne l042a  ; starten met $7f


l042a    jsr waitfd
         jsr putdb ; write:$7f
         jsr l0c7c ; scherm uit
         ldx #$ff
         stx la2
         inx
         stx la1
         stx la8
         stx la4   ; write mode=0
         stx lb9
         lda lid1
         jsr putdb2
         lda lid2
         jsr putdb2

         lda $dd01  ; switch mode

l0443    jsr getdb
l0446    cmp #$80   ; decode error
         beq l03e2  ; next sector
         cmp #$ff
         beq l0450  ; track start
         jmp l04bd

l0450

   ;      lda #$7f   ; check r/s
    ;     sta $dc00
     ;    cmp $dc01
      ;   bne l045e

    ;     beq l045e
     ;    jsr getdb2 ; skip tr
      ;   jmp l0145  ; stoppen
l045e    jsr getdb2
         ldx ldc
         beq sdnas
         cmp #18
         beq noscn
         bne snee
sdnas    ldx lbc
         beq noscn
         ldx lbb
         bne yoscn
         ldx la4
         bne noscn    ; write mode?
         pha
         cmp begtr
         beq sisfqf
         lda #0      ; retry=no
         jsr putblk1
sisfqf   jsr getblk1
         cmp #0
         bne sdkaka
         beq ckcks

yoscn    cmp begtr
         beq noscn; scan skip 1st tr
snee     pha
         jsr getblk1
         cmp #0     ; ack ?
         beq goonwut
sdkaka   pla
         jmp l0145  ; stoppen
goonwut  jsr sendtr ; send track
ckcks    pla
         ldx ldc
         beq noscn
         jsr l0e47; clr tr/se
         jmp l0e6f ; print directory

noscn    sta lad    ; curr.tr
         jsr l0c64
         stx lc0    ; no. of sectrs
         dec $dd03  ; output
         jsr waitfd
         txa
         jsr putdb2 ;sect (niet 0)
         ldx la4    ;read mode ?
         bne l0495  ; ja
         jmp l052a
l0495    ldx ldc    ; dir=1
         bne l049a
         ldx lbb    ; scan?
         bne sjsjs
         ldx lbc    ; multi?
         bne cucu
sjsjs    lda #$ff
         ldx lad
         cpx endtr
         beq l04a0
l049a    lda lb9    ;0=all
         beq l049e
         lda #$00   ;used..
         sec
         sbc la2    ;hi-adr extra buffer
l049e    clc        ; van 1st bytes
         adc la3    ;$18,$19,$2d
         clc        ; memory bottom
         adc lc0    ;no.sectors
         lda #$7f
         bcc l04a0  ;< ffff ?
cucu     jsr lfc        ;bewaar se data
         lda #$ff
         bne l04a4

l04a0    jsr putdb2  ;lees volgende tr
         lda $dd01   ;(7f)
         jsr lfc     ;bewaar se data
         jmp l01bb

l04a4    jsr putdb2  ;start schrijven.
         lda $dd01   ;(ff)
         jmp l01bb

l04b3    lda lbb   ; scan =1
         bne l04ba
filled   jmp l03e5 ;schrijven
l04ba    lda lid1 ; send id1
         jsr putblk1
         lda lid2 ; send id2
         jsr putblk1
         jmp l0149 ; end disk.

l04bd    cmp #$fd   ; end write
         bne l04f5
         lda lbc    ; multi=1
         beq l04d6
         lda #0     ; no retry
         jsr putblk1
         jmp l0149  ; end disk.

;l04c5    bne l04ba
;         jsr waitfd ; multi inst source
 ;        lda #$05
  ;       jsr putdb
   ;      lda $dd01
    ;     jsr getdb
     ;    jmp l03f1

l04d6    ldx lad
         inx
         cpx endtr
         bcs l04ba
         jsr waitfd ; normal inst source
         lda #$04
         jsr putdb
         lda $dd01
         jmp l0186

l04f5    cmp #$fb
         bne l04fc
         jmp l0c91  ; bad track

l04fc    cmp #$f0
         bcc l051c
         and #$0f
         tay
         jsr getdb2
         tax
         lda seemp,x
         bne l0519
         lda seadr,x
         bne l0519
         lda l0c5a,y
         sta lb9
         jsr l0cf1
l0519    jmp nxtse

l051c    cmp #$91
         bne nodid
         jsr getdb2
         sta lid1
         jsr getdb2
         sta lid2
         jmp l0443

nodid    cmp #$88  ; geh. vol, of tr=36
         beq l04b3
l0527    jmp l0136 ; bad bam.

l052a    ldx #$00  ; write mode
         stx lae   ; se=0
         jsr l0d59 ;haal scherm ptr op
         ldx #$ff
         stx la2
         inx
         stx la1
         stx la8
         stx la4
         stx lb9
l0533    ldy lad
         lda (llda),y ; haal error code
         ora lba    ; van tr van scherm.
         tay        ;lba=repair.
         jsr putdb2
         lda $dd01
         cpy #$4c   ;'l' error
         beq l0546
         cpy #$46   ;'f' error
         bne l0549
l0546    jmp l0443  ; volgende tr

l0549    lda #<l1337 ; start zenden
         ldx #>l1337
         sta lb5   ; buffer voor
         stx lb6   ; GCR gecodeerde info
         lda #$19
         sta la3   ; hi ptr multi
         bne l0555

regtr    jsr jinit

l0555    lda lb5   ; volgende sector
         ldx lb6   ; coderen
         sta lb2
         stx lb3
         lda #0
         sta chksum
         jsr getbjoy
         bcs regtr ; skip track
         jsr getbjoy
         bcs regtr ; skip sector
         ldx lae   ; sector
         jsr l0d59 ; zet scherm ptr
         jsr getbjoy
         bcs regtr ; scrncode
         ldy lad   ; track
         sta (llda),y
;l05aa    jmp l06de

;l05ad    .byte $b5,$d4,$52,$4b,$2d

l05b2    jsr getbjoy
         bcs regtr
         sta sehdr+1  ; data header
         ldy #0
dosct    jsr getbjoy
         bcs regtr
         sta $7f00,y ; data
         iny
         bne dosct
         jsr getbjoy
         bcs regtr
         sta sechk+1   ; se chk
         ldy chksum
         jsr getbjoy
         bcs regtr
         sty chksum  ; transmission
         sec
         sbc chksum  ; chksum
         beq okchs
         lda #$ff
okchs    jsr putbjoy ; ack/nak
         bcs regtr
         cmp #0
         bne l0555

         lda #$0e  ; schrijf se +,c,i
         sta lb4
         lda l0628 ; haal goede codes
         ldx l0629
         jsr pegcr ; prepare GCR coder

         dec l01
         lda #$7f ; hi-adr se
         sta l9e
         sta l05eb
         bmi l05d8
         ldx lbc   ; multi=1
         beq l05dc
l05d8    lda la3
         inc la3   ; next hibyte
l05dc    ldx lae
         sta lc3,x
         sta ldb
         lda lba   ; repair
         bpl l05f6 ; no
         ldx #$00
         txa
l05eb    = *+2
l05e9    eor $ff00,x
         inx
         bne l05e9
         sta sechk+1 ; repair chksum
         ldx #$07  ; repair data hdr
         bne l05f9
l05f6    ldx sehdr+1
l05f9    ldy #$00
         sty lb7
         lda l1237,x
         asl a
         asl a
         asl a
         sta la6
         txa
         and #$0f
         tax
         lda l0f6f,x
         lsr a
         ror lc1
         lsr a
         ror lc1
         ora la6
         sta la6
         jmp l0647
l0619    lda #$a9   ; lda #0
         ldx #$00
         jsr pegcr  ; prepare GCR coder
         lda sechk+1
         jmp l0649

l0629    = *+1
l0628    lda (l9d),y
         tax
         lda l1237,x
         asl a
         asl a
         asl a
         sta la6
         txa
         and #$0f
         tax
         lda l0f6f,x
         lsr a
         ror lc1
         lsr a
         ror lc1
         ora la6
         sta la6
         iny
         beq l0619
l0647    lda (l9d),y
l0649    tax
         lda l1237,x
         sta l9f
         txa
         and #$0f
         tax
         lda l0f6f,x
         asl a
         asl a
         asl a
         asl a
         sta la9
         rol l9f
         lda lc1
         and #$c0
         ora l9f
         sta lc1
         iny
l0668    = *+1
l0667    lda #$40
         tax
         lda l1237,x
         lsr a
         ora la9
         sta la9
         txa
         and #$0f
         tax
         lda l0f6f,x
         php
         asl a
         asl a
         asl a
         plp
         ror a
         sta laa
         iny
l0683    = *+1
l0682    lda #$c0
         tax
         lda l1237,x
         lsr a
         ror ld9
         lsr a
         ror ld9
         lsr a
         ror ld9
         ora laa
         sta laa
         txa
         and #$0f
         tax
         lda ld9
         and #$e0
         ora l0f6f,x
         sta ld9
         sty lb1
         ldy lb7
         lda la6
         sta (lb2),y
         iny
         lda lc1
         sta (lb2),y
         iny
         lda la9
         sta (lb2),y
         iny
         lda laa
         sta (lb2),y
         iny
         lda ld9
         sta (lb2),y
         iny
         sty lb7
         dec lb4
         bne l06cf
         lda #$00
         sta lb7
         sta lb2
         lda ldb
         sta lb3
l06cf    lda l0668
         beq l06da
         ldy lb1
         iny
         jmp l0628
l06da   ; inc la8  ; se data ptr ++
         inc l01
l06de    inc lae  ; curr. se++
         lda #$46 ;GCR extra buffer
         clc      ; +=70 (326-256)
         adc lb5
         sta lb5
         bcc l06eb
         inc lb6
l06eb    lda lae  ; sector
         cmp lc0  ; no.sectors p tr
         beq l06f8
         jmp l0555 ; volgende se GCR'en

l06f4    cpy lc0   ;volgende s schrijven
         bcc l070b

l06f8    jsr getdb ; schrijven track
         beq l0700 ; ok
         jmp l0446 ; alle s gehad
l0700    ldy #$00
         sty lae     ; sector=0
         lda #<l1337
         ldx #>l1337
         dec $dd03
l070b    sec
         sbc #$ba
         bcs l0711
         dex
l0711    sta lb5     ; GCR ptr -$ba
         stx lb6
         sta l07cf
         stx l07d0
         lda lba     ;repair?
         bmi l0738   ; ja
         ldx lae
         jsr l0d59
         ldy lad
         lda (llda),y;haal schermcode
         cmp #$3f    ;'?'
         beq l0734
         cmp #$53    ;'s'
         beq l0734
         cmp #$48    ;'h'
         bne l0738
l0734    ldx #$55    ; error
         bne l073a
l0738    ldx #$52    ; normaal
l073a    stx $dd01
         ldy lae
         ldx lc3,y   ; hi-adr se
         bmi l0746   ; lege se?
         jmp l07c8

l0746    ldy #$ba    ; lege s schrijven
         lda #$55
l074a    ldx $dd0d
         beq l074a
         sta $dd01
         lda (lb5),y ; 1st byte
l0754    ldx $dd0d
         beq l0754
         sta $dd01
         iny
         lda (lb5),y ; 1st byte
l075f    ldx $dd0d
         beq l075f
         sta $dd01
         ldy #$00
l0769    lda $ff00,y ; lege s buffer
l076c    ldx $dd0d
         beq l076c
         sta $dd01
         iny
         bne l0769
         ldy #$c4
l0779    lda $ff00,y
l077c    ldx $dd0d
         beq l077c
         sta $dd01
         iny
         bne l0779
         lda #$4b
l0789    ldx $dd0d
         beq l0789
         sta $dd01
         lda #$52
l0793    ldx $dd0d
         beq l0793
         sta $dd01
         ldy #$bc
         lda (lb5),y ; checksum
l079f    ldx $dd0d
         beq l079f
         sta $dd01
         iny
         lda (lb5),y ; checksum
l07aa    ldx $dd0d
         beq l07aa
         sta $dd01
         lda #$29
l07b4    ldx $dd0d
         beq l07b4
         sta $dd01
         lda #$4a
l07be    ldx $dd0d
         beq l07be
         sta $dd01
         bne l07eb

l07c8    dex         ; volle s schrijven
         stx l07df
         ldy #$ba
l07cf    = *+1
l07d0    = *+2
l07ce    lda $ffff,y
l07d1    ldx $dd0d
         beq l07d1
         sta $dd01
         iny
         bne l07ce
         iny
l07df    = *+2
l07dd    lda $ffff,y
l07e0    ldx $dd0d
         beq l07e0
         sta $dd01
         iny
         bne l07dd
l07eb    inc lae     ; sector ++;
         ldy lae
l07ef    lda $dd0d
         beq l07ef
         ldx lb6     ; b5/b6 +=$100
         lda lb5
         inx
         jmp l06f4   ; volgende s

pegcr    sta l0667
         stx l0668
         sta l0682
         stx l0683
         rts

normlo
         *= xtra
         .offs 0

jinit    ldx #0
         ldy #10
         bne scndi

snsn     lda $dc01
         cmp $dc01
         bne snsn
         and #$1f
         cmp chksum
         beq donoth
         sec
         sbc #1
         and #$1f
         cmp chksum
         beq heygot1
scndi    lda #0
         sta chksum

donoth   dey
         bne snsn   ; about 450 us
         ldy #10
         stx $dc00
         inx
         cpx #32
         bne snsn
         ldx #0
         beq snsn

heygot1  inc chksum
         lda chksum
         cmp #32
         bne snsn
         dec chksum

sjzie    lda $dc01
         cmp $dc01
         bne sjzie
         eor #$1f
         and #$1f
         sta $dc00
fndk     cmp chksum
         beq sjzie
         dec chksum
         cmp chksum
         bne jinit
         lda chksum
         bne sjzie

sisi     lda $dc01
         cmp $dc01
         bne sisi
         and #$1f
         cmp #$1f
         beq sisi
         cmp #$1a  ; init end
         bne jinit
         lda #$0f
         sta $dc00
         lda #0
         sta putmode ; getmode=true
         rts

putbjoy  pha
         ldx putmode
         bne puttrue
         tax
dtat     lda $dc01
         and #$10
         bne dtat
         lda #$1f
         sta $dc00
dtat2    lda $dc01
         and #$08
         bne dtat2
         lda #$ff
         sta putmode
         txa
puttrue  ldx $dc01
         pha
         clc
         adc chksum
         sta chksum
         pla
         pha
         lsr a
         lsr a
         lsr a
         lsr a
         sta $dc00
clr1     cpx $dc01
         beq clr1
         eor $dc01
         and #$1f
         cmp #$1f   ; goed
         bne qqqr
         pla
         ora #$10
         ldx $dc01
         sta $dc00  ; a

clr2     cpx $dc01
         beq clr2
         eor $dc01
         and #$1f
         cmp #$1f
         bne qqqt
         pla
         clc
         rts

qqqr     pla
qqqt     pla
         sec
         rts

getbjoy  lda putmode
         beq putfalse
         lda #$08
         sta $dc00
rrstw    lda $dc01
         and #$10
         beq rrstw
         lda #0
         sta $dc00
         sta putmode
putfalse lda $dc01
         and #$10
         bne getbjoy
         lda $dc01
         tax
         asl a
         asl a
         asl a
         asl a
         sta lb4
         txa
         eor #$1f
         sta $dc00
getj2    cpx $dc01
         beq getj2
         lda $dc01
         tax
         and #$10
         beq qqqt
         txa
         eor #$1f
         sta $dc00
         txa
         and #$0f
         ora lb4
         pha
         clc
         adc chksum
         sta chksum
         pla
         clc
         rts


sendtr

sesea    ldx #$fe
         stx la2
         inx
         stx la1
         inx
         stx la8
         stx lae
         beq putse

retrans  jsr jinit

putse    lda #0
         sta chksum
         lda lad     ; track
         jsr putbjoy
         bcs retrans
         lda lae     ;sector
         jsr putbjoy
         bcs retrans

         tax
         jsr l0d59 ; zet scherm ptr
         ldy lad   ; track
         lda (llda),y
         jsr putbjoy  ;send scrncode
         bcs retrans

         cmp #$2b  ;'+'
         beq sendful
         cmp #$43  ;'c'
         beq sendful
         cmp #$49  ;'i'
         beq sendful
         tay
         lda #7
         jsr putbjoy ; data header
         bcs retrans
         tya
         tax
         ldy #$00
         lda #$41  ;'a'
         cpx #$2d  ;'-'
         bne otherer

         ldx lae
         lda em1st,x  ; haal 1st byte

otherer  jsr putbjoy ; 1st byte
         bcs retrans
         iny
         tya
dobuf    jsr putbjoy ; 255 * '$1'
retrans2 bcs retrans
         iny
         bne dobuf
         ldy lae
         lda em1st,y
         eor #$01 ;  chksum
         jmp dolasr

sendful  ldy lae
         lda seadr,y ;se in geheugen?
         sta l9e
         lda hdrda,y
         jsr putbjoy
         bcs retrans2
         ldy #0
dodat    dec l01
         lda (l9d),y
         inc l01
         jsr putbjoy
         bcs retrans2
         iny
         bne dodat
         ldy lae
         lda chksm,y
dolasr   jsr putbjoy
         bcs retrans2
         lda chksum
         jsr putbjoy
         bcs retrans2
         jsr getbjoy
         bcs retrans2
         beq nxtpp
         jmp putse
nxtpp    inc lae ; curr. se++
         lda lae ; sector
         cmp lc0 ; no.sectors p tr
         beq ssslaar
         jmp putse
ssslaar  rts             ; klaar


         *= $0800
         .offs coff

l0800    .byte $a0,$20,$46,$43
         .byte $4f,$50,$59
         .byte $20,$50,$43,$20,$56
         .byte $31,$2e,$30
         .byte $20,$20,$04
         .byte $0f,$0e,$05,$20
         .byte $02,$19,$20
         .byte $54,$57,$41,$20
         .byte $21,$20,$20
         .byte $20,$20,$20,$20
         .byte $20,$20,$20
l0827    .byte $20
l0828    .byte $a0
l0829    .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20
l084d    .byte $20
l084e    .byte $20
l084f    .byte $20,$a0,$a0
l0852    .byte $a0,$b0,$b0,$b0,$b0
         .byte $b0,$b0,$b0
         .byte $b0,$b0,$b1,$b1,$b1
         .byte $b1,$b1,$b1
         .byte $b1,$b1,$b1,$b1,$b2
         .byte $b2,$b2,$b2
         .byte $b2,$b2,$b2,$b2,$b2
         .byte $b2,$b3,$b3
         .byte $b3,$b3,$b3,$b3,$a0
         .byte $a0,$a0,$a0
l087a    .byte $a0,$b1,$b2,$b3,$b4
         .byte $b5,$b6,$b7
         .byte $b8,$b9,$b0,$b1,$b2
         .byte $b3,$b4,$b5
         .byte $b6,$b7,$b8,$b9,$b0
         .byte $b1,$b2,$b3
         .byte $b4,$b5,$b6,$b7,$b8
         .byte $b9,$b0,$b1
         .byte $b2,$b3,$b4,$b5,$a0
         .byte $a0,$a0,$b0
         .byte $b0
l08a3    .byte $20
l08a4    .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b0,$a0
         .byte $b0,$b1,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b1,$a0
         .byte $b0,$b2,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b2,$a0
         .byte $b0,$b3,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b3,$a0
         .byte $b0,$b4,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b4,$a0
         .byte $b0,$b5,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b5,$a0
         .byte $b0,$b6,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b6,$a0
         .byte $b0,$b7,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b7,$a0
         .byte $b0,$b8,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b8,$a0
         .byte $b0,$b9,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b0,$b9,$a0
         .byte $b1,$b0,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b1,$b0,$a0
         .byte $b1,$b1,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b1,$b1,$a0
         .byte $b1,$b2,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b1,$b2,$a0
         .byte $b1,$b3,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b1,$b3,$a0
         .byte $b1,$b4,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b1,$b4,$a0
         .byte $b1,$b5,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b1,$b5,$a0
         .byte $b1,$b6,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$b1,$b6,$a0
         .byte $b1,$b7,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $a0,$a0,$a0
         .byte $a0,$a0,$b1,$b7,$a0
         .byte $b1,$b8,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$a0
         .byte $a0,$a0,$d4,$92,$89
         .byte $85,$93,$ba
l0b94    .byte $b1,$a0,$b1,$b8,$a0
         .byte $b1,$b9,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $a0,$d2
         .byte $85,$90,$81,$89,$92
         .byte $ba
l0bba    .byte $ce,$8f,$a0,$a0,$a0
l0bda    .byte $a0,$c1,$8c,$8c,$a0
         .byte $b1,$b9,$a0,$b2
         .byte $b0,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$20,$20,$20
         .byte $20,$20,$20
         .byte $20,$20,$a0,$c2
         .byte $85,$87,$89,$8e,$ba
lbegpo   .byte $b0,$b1,$a0
         .byte $a0,$c5,$8e,$84,$ba
lendpo   .byte $b3,$b5,$a0,$b2,$b0


ldd      tax
         lda l1237,x
         ora #$60
         sta la6
         txa
         and #$0f
         tax
         lda l0f6f,x
         asl a
         asl a
         asl a
         asl a
         rol la6
         ora #$05
         sta (lb5),y
         dey
         lda la6
         sta (lb5),y
         rts

l0bf5    ldx #$14
         .byte $2c

clrln    ldx #$01
         lda #$20
         ldy #$13
l0bfe    sta l0828,x
         inx
         dey
         bne l0bfe
l0c05    rts

l0c06    stx llda
         jsr clrln
         lda #$1b
         sta $d011
         lda #$11
         sta $d404
         dec $d404
         ldy #$01
         bne l0c23

l0c1c    stx llda
         jsr l0bf5
         ldy #$14
l0c23    ldx llda
l0c25    lda l00,x
         beq l0c05
         sta l0828,y
         inx
         iny
         bne l0c25

l0c30    .byte $a2,$ca
l0c32    .byte $f2,$1a,$42,$6a,$92
         .byte $ba,$e2,$0a
         .byte $32,$5a,$82,$aa,$d2
         .byte $fa,$22,$4a
         .byte $72,$9a,$c2
l0c45    .byte $08,$08,$08,$09,$09
         .byte $09,$09,$09
         .byte $09,$0a,$0a,$0a,$0a
         .byte $0a,$0a,$0a
         .byte $0b,$0b,$0b,$0b,$0b

l0c5a    .byte $3f,$2b,$48,$53,$49
         .byte $43,$4c,$46,$50,$48

l0c64    cmp #$1f
         bcs l0c79
         cmp #$19
         bcs l0c76
         cmp #$12
         bcs l0c73
         ldx #$15
         .byte $2c
l0c73    ldx #$13
         .byte $2c
l0c76    ldx #$12
         .byte $2c
l0c79    ldx #$11
         rts

l0c7c    lda #$0b
         sta $d011
l0c81    bit $d011
         bpl l0c81
l0c86    bit $d011
         bmi l0c86
l0c8b    bit $d011
         bpl l0c8b
         rts

l0c91    ldx #te9   ; Bad track r/i
         jsr l0c06
l0c96    lda #$ff   ; retry
         jsr putblk1
         jsr getblk1
;         lda #$7f
 ;        sta $dc00
  ;       cmp $dc01 ;run/stop
   ;      beq l0ce0
    ;     lda #$ef
     ;    sta $dc00
      ;   lda $dc01
;         cmp #$fd   ;i
         cmp #"i"
         beq l0ccc
  ;       lda #$fb
   ;      sta $dc00
    ;     lda $dc01
     ;    cmp #$fd   ;r
         cmp #"r"
         bne l0ce0  ; abort

         jsr clrln  ;retry
         jsr waitfd
         lda #$01
         jsr putdb
         lda $dd01
         jsr l0c7c
         jmp l06f8

l0ccc    jsr clrln  ;ignore
         jsr waitfd
         lda #$02
         jsr putdb
         lda $dd01
         jsr l0c7c
         jmp l0443

l0ce0   ; lda lbc   ;multi=1
       ;  bne l0ce7
         jmp l0145 ;abort write.
;l0ce7    lda #$ff
;l0ce9    cmp $dc01
;        bne l0ce9 ;wait for key release
;         jmp l03f1 ;next write.

l0cf1    pha
         jsr l0d59
         ldy lad
l0cf6    lda (llda),y
         bmi l0cff
         pla
         sta (llda),y
         rts
l0cff    pla
         rts

getdb    lda #$00
         sta $dd03
getdb2   lda $dd0d
         beq getdb2
         lda $dd01
         rts

putdb    ldx #$ff
         stx $dd03
putdb2   sta $dd01
waitfd   lda $dd0d
         beq waitfd
         rts

l0d59    lda l0c30,x
         sta llda
         lda l0c45,x
         sta ldb
         rts

getblini jsr jinit
getblk1  lda #0
         sta chksum
         jsr getbjoy
         bcs getblini
         sta tmp
         ldy chksum
         jsr getbjoy
         bcs getblini
         sec
         sty chksum
         sbc chksum
         beq cchkok ; ack
         lda #$ff   ; nak
         jsr putbjoy
         jmp getblini
cchkok   jsr putbjoy
         bcs getblini
         lda tmp
         rts

putblini jsr jinit
         lda tmp
putblk1  sta tmp
         ldx #0
         stx chksum
         jsr putbjoy
         bcs putblini
         lda chksum
         jsr putbjoy
         bcs putblini
         jsr getbjoy
         bcs putblini
         cmp #0
         bne putblini
         lda tmp
         rts

begin    ldy #$00
         sty lbd
         sty ldc
         ldx #cstack
         txs
         jsr l0bf5
         ldx #teini
         jsr l0c06  ;Waiting conn.
         jsr jinit
         ldx #te5   ; Insert source
         jsr l0c06
l0d89

nond     jsr getblk1
         tay
         lda #$ff
         cpy #"u"
         bne l0df0
         sta la0
         ldx #te12
l0de3    ldy #$00
l0de5    lda l00,x
         beq l0dd0
         sta l0bda,y
         inx
         iny
         bne l0de5
l0df0    cpy #"y"
         bne l0d90
         sta lba
         ldx #te14
l0df8    ldy #$00
l0dfa    lda l00,x
         beq l0dd0
         sta l0bba,y
         inx
         iny
         bne l0dfa
l0d90    cpy #"n"
         bne l0d9d
         ldy #0
         sty lba
         ldx #te15
         bne l0df8
l0d9d    cpy #"m"
         beq l0e05
         cpy #"s"
         beq l0e0f
         cpy #"a"
         bne l0db9
         ldy #0
         sty la0
         ldx #te13
         bne l0de3
l0db9    cpy #"d"
         bne l0dcb
         sta ldc
         ldx #te3
         bne l0e17
l0dcb    cpy #"c"
         beq l0e15
         cpy #"t"
         bne l0dd0
         lda lb8
         eor #$04
         sta lb8
         ora #$b0
         sta l0b94
         jmp nond
l0dd0    jmp begin

l0e05    lda #$15
         sta lbc
         ldx #te10 ; get disk
         ldy #$00
         beq l0e1b
l0e0f    ldx #te11
         ldy #$01
         bne l0e19
l0e15    ldx #te2
l0e17    ldy #$00
l0e19    sty lbc   ; c,d=0 s=1 m=$15
l0e1b    sty lbb   ; c,d,m=0 s=1
         jsr l0c1c ; show command
         jsr l0e47
         lda ldc
         bne l0e39   ; dir=1
         lda lb8     ; tries
         jsr putdb
         lda begtr   ; begin track
         jsr putdb2
         lda la0     ; all=0
l0e33    jsr putdb2
         jmp readt

l0e39    lda #$02
         jsr putdb   ; tries =2
         lda #$12
         jsr putdb2  ; track 18
         lda #$00
         beq l0e33   ; all sectors

l0e47    lda #$23
         sta lad
l0e4e    ldx #$14
         stx la8
l0e52    lda #$20
         ldx la8
         jsr l0cf1
         dec la8
         bpl l0e52
         dec lad
         bne l0e4e
         ldx #$20
         txa
l0e68    sta l08a3,x
         dex
         bpl l0e68
         rts

l0e6f    jsr waitfd
         lda #0
         jsr putdb   ; kappen
         lda seadr
         beq l0e90
         sta l9e
         ldy #$90
         ldx #$00
l0e80    lda (l9d),y
         jsr l0f0a
         ora #$80
         sta l08a4,x
         inx
         iny
         cpx #$14
         bcc l0e80
l0e90    jsr l0f20
         ldy #$01
l0e95    sty lae
         lda seadr,y
         beq l0f07
         sta l9e
         ldy #$02
l0ea0    sty lab
         lda (l9d),y
         bpl l0ef3
         dec lb4
         bne l0ed0
;         lda #$7f
;         sta $dc00
;l0eaf    lda $dc01   ; run/stop?
;         cmp #$7f
;         beq l0f07
;         cmp #$ef    ; space ?
;         bne l0eaf
;         ldx #$00
;l0ebc    dex
;         bne l0ebc
;l0ebf    cmp $dc01
;         beq l0ebf
         sty lac
         jsr l0e47
         jsr l0f20
         ldy lac
         dec lb4
l0ed0    lda l0eeb
         sec
         adc #$27
         sta l0eeb
         bcc l0ede
         inc l0eec
l0ede    iny
         iny
         iny
         ldx #$00
l0ee3    lda (l9d),y
         jsr l0f0a
         and #$7f
l0eeb    = *+1
l0eec    = *+2
         sta $1a44,x
         iny
         inx
         cpx #$10
         bcc l0ee3
l0ef3    lda lab
         clc
         adc #$20
         tay
         bcc l0ea0
         ldy #$00
         lda (l9d),y
         beq l0f07
         iny
         lda (l9d),y
         tay
         bne l0e95
l0f07    jmp begin

l0f0a    bmi l0f1b
         cmp #$20
         bcc l0f1a
         cmp #$60
         bcc l0f18
         and #$df
         bcs l0f1a
l0f18    and #$3f
l0f1a    rts
l0f1b    and #$7f
         ora #$40
         rts

l0f20    lda #<l08a4
         ldx #>l08a4
         sta l0eeb
         stx l0eec
         lda #$15
         sta lb4
         rts

         *= $0f2f

l0f2f    .byte $ff,$ff,$ff,$ff,$ff
         .byte $ff,$ff,$ff
         .byte $ff,$08,$00,$01,$ff
         .byte $0c,$04,$05
         .byte $ff,$ff,$02,$03,$ff
         .byte $0f,$06,$07
         .byte $ff,$09,$0a,$0b,$ff
         .byte $0d,$0e,$ff
l0f4f    .byte $ff,$ff,$ff,$ff,$ff
         .byte $ff,$ff,$ff
         .byte $ff,$80,$00,$10,$ff
         .byte $c0,$40,$50
         .byte $ff,$ff,$20,$30,$ff
         .byte $f0,$60,$70
         .byte $ff,$90,$a0,$b0,$ff
         .byte $d0,$e0,$ff
l0f6f    .byte $0a,$0b,$12,$13,$0e
         .byte $0f,$16,$17
         .byte $09,$19,$1a,$1b,$0d
         .byte $1d,$1e,$15

sehdr    = $0f7f
l1067    = $1067
sechk    = $114f
l1237    = $1237
l1337    = l1237+$0100
sbuf1    = $1300
l13b8    = $13b8
l13b9    = $13b9
l13ba    = $13ba
l13fe    = $13fe
l13ff    = $13ff
sbuf0    = $1400
hdrda    = $1500
chksm    = $1515
seadr    = $152a
em1st    = $153f
seemp    = $1554

endnorm
         *= endnorm+coff
         .offs 0

l5f80    .byte $13,$0f,$00,$00,$00
         .byte $60,$f9,$00,$00,$00
         .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00,$00,$00
         .byte $00,$00,$00,$00,$0f

l6100    .byte $0a,$0a,$0a,$0a,$0a
         .byte $0a,$0a,$0a
         .byte $0a,$0a,$0a,$0a,$0a
         .byte $0a,$0a,$0a
         .byte $0b,$0b,$0b,$0b,$0b
         .byte $0b,$0b,$0b
         .byte $0b,$0b,$0b,$0b,$0b
         .byte $0b,$0b,$0b
         .byte $12,$12,$12,$12,$12
         .byte $12,$12,$12
         .byte $12,$12,$12,$12,$12
         .byte $12,$12,$12
         .byte $13,$13,$13,$13,$13
         .byte $13,$13,$13
         .byte $13,$13,$13,$13,$13
         .byte $13,$13,$13
         .byte $0e,$0e,$0e,$0e,$0e
         .byte $0e,$0e,$0e
         .byte $0e,$0e,$0e,$0e,$0e
         .byte $0e,$0e,$0e
         .byte $0f,$0f,$0f,$0f,$0f
         .byte $0f,$0f,$0f
         .byte $0f,$0f,$0f,$0f,$0f
         .byte $0f,$0f,$0f
         .byte $16,$16,$16,$16,$16
         .byte $16,$16,$16
         .byte $16,$16,$16,$16,$16
         .byte $16,$16,$16
         .byte $17,$17,$17,$17,$17
         .byte $17,$17,$17
         .byte $17,$17,$17,$17,$17
         .byte $17,$17,$17
         .byte $09,$09,$09,$09,$09
         .byte $09,$09,$09
         .byte $09,$09,$09,$09,$09
         .byte $09,$09,$09
         .byte $19,$19,$19,$19,$19
         .byte $19,$19,$19
         .byte $19,$19,$19,$19,$19
         .byte $19,$19,$19
         .byte $1a,$1a,$1a,$1a,$1a
         .byte $1a,$1a,$1a
         .byte $1a,$1a,$1a,$1a,$1a
         .byte $1a,$1a,$1a
         .byte $1b,$1b,$1b,$1b,$1b
         .byte $1b,$1b,$1b
         .byte $1b,$1b,$1b,$1b,$1b
         .byte $1b,$1b,$1b
         .byte $0d,$0d,$0d,$0d,$0d
         .byte $0d,$0d,$0d
         .byte $0d,$0d,$0d,$0d,$0d
         .byte $0d,$0d,$0d
         .byte $1d,$1d,$1d,$1d,$1d
         .byte $1d,$1d,$1d
         .byte $1d,$1d,$1d,$1d,$1d
         .byte $1d,$1d,$1d
         .byte $1e,$1e,$1e,$1e,$1e
         .byte $1e,$1e,$1e
         .byte $1e,$1e,$1e,$1e,$1e
         .byte $1e,$1e,$1e
         .byte $15,$15,$15,$15,$15
         .byte $15,$15,$15
         .byte $15,$15,$15,$15,$15
         .byte $15,$15,$15
ttoten