-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathcompress-dir
103 lines (103 loc) · 2.42 KB
/
compress-dir
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
102
103
;***************************************
;***************************************
;
; COMPRESS DIRECTORY
; CALLED DURING VERIFY
;
;***************************************
COMPRS
LDX DRVNUM ;GET THE DRIVE #
LDA #0 ;CLEAR FLAG
STA HDDFLG,X ;*
JSR HDLDTS ;GET T&S OF DIR
JSR OPNIRD ;OPEN INTERNAL RD CHNL
LDA LINDX ;SAVE LINDX
STA TEMP+4 ;*
JSR OPNIWR ;OPEN INTERNAL WRITE CHNL
LDA LINDX ;SAVE WRITE CHNL
STA TEMP+5 ;*
LDA SECTOR ;SAVE NEW DIR SEC & TRK
STA NDSEC ;*
LDA TRACK ;*
STA NDTRK ;*
;
; GET DIRECTORY FLAG
;
CMPRA
LDA TEMP+4 ;INPUT LINDX
STA LINDX
LDA #LRF ;EOF
JSR TSTFLG ;CHK IF EOF
BNE CMPR5 ;BR IF EOF
JSR GETPRE ;SET UP
LDA BUFTAB,X ;CHK IF AT BEG OF SECTOR
CMP #2 ;*
BEQ CMPR1 ;BR IF SO
INC BUFTAB,X ;SKIP FIRST TWO BYTES
INC BUFTAB,X ;SKIP FIRST TWO BYTES
CMPR1
JSR GIBYTE ;GET NEXT BYTE
LDA DATA ;LOOK AT IT
BEQ CMPR2 ;BR IF DELETED ENTRY
;
; COPY THIS DIRECTORY ENTRY TO NEW DIR
;
LDA TEMP+5 ;OUTPUT LINDX
STA LINDX ;*
JSR GETPRE ;SETUP
LDA BUFTAB,X ;CHK IF AT BEG OF SECTOR
CMP #2 ;*
BEQ CMPR3A ;BR IF AT BEG OF SECT
INC BUFTAB,X ;SKIP T&S
INC BUFTAB,X ;*
CMPR3A
LDA #30 ;COPY 30 BYTES
PHA ;*
CMPR3
LDA TEMP+5 ;OUTPUT LINDX
STA LINDX
LDA DATA ;DATA BYTE
JSR WRTBYT ;PUT IT
PLA ;DECR # BYTES TO COPY
SEC ;*
SBC #1 ;*
BEQ CMPRA ;BR IF DONE
PHA ;SAVE COUNT TO GO
JSR GIBYTE ;GET NEXT BYTE
JMP CMPR3 ;LOOP
;
; DELETED DIRECTORY ENTRY SO SKIP IT
;
CMPR2
LDA #29 ;SKIP THIRTY BYTES
CMPR4
PHA ;SAVE # TO SKIP
JSR GIBYTE ;GET & TOSS BYTE
PLA ;RESTORE # TO SKIP
SEC ;DEC BY 1
SBC #1
BNE CMPR4 ;LOOP TILL DONE
BEQ CMPRA ;BRA
;
; EOR ON INPUT SO WRAP UP
;
CMPR5
LDA TEMP+5 ;OUTPUT LINDX
STA LINDX
LDA #0 ;NULL REST OF DIR BUF
CMPR6
JSR PUTBYT ;PUT IN BUFR
BNE CMPR6 ;LOOP TILL BUFR FULL
LDA #255 ;SET LINK = FFFF
STA (BUFTAB,X) ;*
INC BUFTAB,X
STA (BUFTAB,X)
JSR WRTBUF ;WRITE LAST BUFR
JSR DBLBUF ;SWAP & WAIT
JSR DBLBUF ;SWAP & WAIT
JSR HDLDTS ;GET DIR T&S ADDR
JSR DELFIL ;DELETE OLD DIR SECTORS
LDX DRVNUM
JSR MAPOU1 ;WRITE OUT THE BAM
JMP FREICH ;FREE INTERNAL CHNLS
.END