-
Notifications
You must be signed in to change notification settings - Fork 85
/
addrel
179 lines (179 loc) · 2.82 KB
/
addrel
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
.PAGE 'ADDREL'
ADDREL
JSR ADRELS
JSR FNDREL ; CALC SS PTRS
ADDR1
JSR NUMFRE ; CALC AVAILABLE...
LDY LINDX ; RECORD SPAN?
LDX RS,Y
DEX
TXA
CLC
ADC RELPTR
BCC AR10 ; NO SPAN
INC SSIND ; INC SS PTRS & CHECK
INC SSIND
BNE AR10
INC SSNUM
LDA #SSIOFF
STA SSIND
AR10
LDA R1
CLC
ADC #2
JSR SETSSP
LDA SSNUM
CMP #NSSL
BCC AR25 ; VALID RANGE
LDA #0
STA SSNUM ; .A = 0
INC GRPNUM
BNE AR25 ; JUMP
AR20
LDA #BIGFIL
JSR CMDERR ; TOO MANY SS'S
AR25
LDA SSIND ; CALC # BLOCKS NEEDED...
SEC ; ...& CHECK AGAINST AVAIL.
SBC R1
BCS AR30
SBC #SSIOFF-1
CLC
AR30
STA T3
LDA SSNUM
SBC R0
BCS ADDBI1
INC R3
ADC #6
ADDBI1
STA T4
LDA GRPNUM
SEC
SBC R3
STA R3
JSR SSSCAL
LDA RESULT+1
BNE AR35
LDX RESULT
BNE ADDBI2
RTS
ADDBI2
DEX
BNE AR35
AR34
INC R2
AR35
CMP NBTEMP+1
BCC AR40 ; OK!!
BNE AR20
LDA NBTEMP
CMP T1
BCC AR20 ; NOT ENOUGH BLOCKS
AR40
LDA #1
JSR DRDBYT ; LOOK AT SECTOR LINK
CLC
ADC #1 ; +1 IS NR
LDX LINDX
STA NR,X
JSR NXTTS ; GET NEXT BLOCK...
JSR SETLNK ; ...& SET LINK.
LDA R2
BNE AR50 ; ADD ONE BLOCK
JSR WRTOUT ; WRITE CURRENT LAST REC
AR45
JSR DBLBUF ; SWITCH BUFS
JSR SETHDR ; SET HDR FROM T & S
JSR NXTTS ; GET ANOTHER
JSR SETLNK ; SET UP LINK
JSR NULBUF ; CLEAN IT OUT
JMP AR55
AR50
JSR DBLBUF ; SWITCH BUFS
JSR SETHDR ; SET HDR FROM T & S
JSR NULBUF ; CLEAN BUFFER
JSR NULLNK ; LAST BLOCK = 0, LSTCHR
AR55
JSR WRTOUT ; WRITE BUFFER
JSR GETLNK ; GET T&S FROM LINK
LDA TRACK
PHA ; SAVE 'EM
LDA SECTOR
PHA
JSR GETHDR ; NOW GET HDR T&S
LDA SECTOR
PHA ; SAVE 'EM
LDA TRACK
PHA
JSR GSSPNT ; CHECK SS PTR
TAX
BNE AR60
JSR NEWSS ; NEED ANOTHER SS
LDA #SSIOFF
JSR SETSSP ; .A = BT VAL
INC R0 ; ADVANCE SS COUNT
AR60
PLA
JSR PUTSS ; RECORD T&S...
PLA
JSR PUTSS ; ...IN SS.
PLA ; GET T&S FROM LINK
STA SECTOR
PLA
STA TRACK
BEQ AR65 ; T = 0, THAT'S ALL!!
LDA R5
CMP GRPNUM
BCC AR45
AR61
LDA R0
CMP SSNUM
BNE AR45 ; NOT DONE YET
JSR GSSPNT
CMP SSIND
BCC AR45 ; ALMOST DONE
BCS AR50 ; ONE MORE BLOCK LEFT
AR65
JSR GSSPNT
PHA
LDA #0
JSR SSDIR
LDA #0
TAY
STA (DIRBUF),Y
INY
PLA
SEC
SBC #1
STA (DIRBUF),Y
JSR WRTSS ; WRITE SS
JSR WATJOB
JSR MAPOUT
JSR FNDREL
JSR DBLBUF ; GET BACK TO LEADING BUFFER
JSR SSPOS
BVS AR70
JMP POSITN
AR70
LDA #LRF
JSR SETFLG
LDA #NOREC
JSR CMDERR
ADRELS
JSR SETDRN
JSR SSEND ; SET UP END OF FILE
JSR POSBUF
LDA GRPNUM
STA R5
STA R3
ADREL1
LDA SSIND
STA R1 ; SAVE SS INDEX
LDA SSNUM
STA R0 ; SAVE SS NUMBER
LDA #0
STA R2 ; CLEAR FLAG FOR ONE BLOCK
STA RECPTR ; TO 1ST BYTE IN RECORD
RTS
.END