-
Notifications
You must be signed in to change notification settings - Fork 82
/
scrtch
77 lines (77 loc) · 1.28 KB
/
scrtch
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 'SCRATCH'
; 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
.SKIP
LDA FILTRK,X ;DELETE BY LINKS
STA TRACK
LDA FILSEC,X
STA SECTOR
JSR DELFIL
.SKIP
SC20 INC R0
SC25 JSR FFRE
BPL SC15
.SKIP
SC30 LDA R0 ;FINISHED, SET
STA TRACK ; FILE COUNT
LDA #1
LDY #0
JMP SCREND ;END OF SCRATCH
.SKIP
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
.SKIP
DELDIR LDY #0 ;DELETE DIR ENTRY
TYA
STA (DIRBUF),Y
JSR WRTOUT
JMP WATJOB
.SKIP
.END