-
Notifications
You must be signed in to change notification settings - Fork 85
/
scrtch.src
77 lines (70 loc) · 2.07 KB
/
scrtch.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.page
.subttl 'scrtch.src'
; scratch file(s)
scrtch jsr fs1set ; set up for 1 stream
jsr alldrs
jsr optsch
lda #0
sta r0 ; used as file count
jsr ffst
bmi sc30
sc15 jsr tstchn ; is it active ?
bcc sc25 ; yes - dont scratch
ldy #0
lda (dirbuf),y
and #$40 ; lock bit
bne sc25 ; it's locked
jsr deldir ; delete directory
ldy #19 ; is this a relative ?
lda (dirbuf),y ; has a ss ?
beq sc17 ; no
sta track ; yes - save track
iny
lda (dirbuf),y ; get sector
sta sector
jsr delfil ; delete by links
sc17 ldx entfnd
lda #$20
and pattyp,x
bne sc20 ; created, not closed
lda filtrk,x ; delete by links
sta track
lda filsec,x
sta sector
jsr delfil
sc20 inc r0
sc25 jsr ffre
bpl sc15
sc30 lda r0 ; finished, set
sta track ; file count
lda #1
ldy #0
jmp scrend ; end of scratch
delfil jsr frets ; delete file by links
jsr opnird ; update bam
jsr bam2x
lda buf0,x
cmp #$ff
beq del10
lda wbam
ora #$40
sta wbam
del10
del2 lda #0
jsr setpnt
jsr rdbyt
sta track
jsr rdbyt
sta sector
lda track
bne del1
jsr mapout
jmp frechn
del1 jsr frets
jsr nxtbuf
jmp del2
deldir ldy #0 ; delete dir entry
tya
sta (dirbuf),y
jsr wrtout
jmp watjob