-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathscrtch.src
More file actions
101 lines (85 loc) · 2.3 KB
/
scrtch.src
File metadata and controls
101 lines (85 loc) · 2.3 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.messg "scrtch"
.subttl "scrtch"
.page
; 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 - don't scratch
ldy #0
lda (dirbuf),y
sta lo ; save type
and #$40 ; lock bit
bne sc25 ; it's locked
jsr deldir ; delete directory
lda lo ; recall type
and #typmsk
cmp #partyp ; par file?
bne sc16
iny
lda (dirbuf),y
sta track
iny
lda (dirbuf),y
sta sector
ldy #$1c
lda (dirbuf),y
sta lo
iny
lda (dirbuf),y
sta hi
1$ jsr tschk ; check track
jsr frets ; free it
jsr calcpar
bne 1$
jmp scrtch_patch ; update BAM and move on to next file
sc16 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
ldy #0
lda #1
jmp scrend ; end of scratch
delfil jsr frets ; delete file by links
jsr opnird ; update bam
del1 lda #0
jsr setpnt
jsr rdbyt
sta track
jsr rdbyt
sta sector
lda track
bne del2
jsr mapout
jmp frechn
del2 jsr frets
jsr nxtbuf
jmp del1
deldir ldy #0 ; delete dir entry
tya
sta (dirbuf),y
jsr wrtout
jmp watjob