-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathnewss.src
152 lines (143 loc) · 3.26 KB
/
newss.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
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
.messg "newss"
.subttl "newss"
.page
;generate new ss & fix old ss's to
;reflect it..
newss jsr nxtts ; get t&s based on hdr
jsr dblbuf ; use inactive buffer
jsr scrub
jsr getact
pha
jsr clrbuf
ldx lindx
lda ss,x ; set regs for transfer
tay
pla
tax
jsr hugerel
bne newss1
jmp newss3
newss1
lda #ssioff ; # of chars
jsr b0tob0 ; transfer at buf(0)
lda #0
jsr ssdir
ldy #2
lda (dirbuf),y ; get ss #
pha
lda #0
jsr setpnt
pla
clc
adc #1
sta (dirbuf),y ; put ss # in new ss
asl a
adc #4
sta r3 ; save position
tay
sec
sbc #2
sta r4
newss2
lda track
sta r1 ; save for ss update
sta (dirbuf),y ; put track in ss
iny
lda sector
sta r2 ; save for ss update
sta (dirbuf),y ; put sector in ss
ldy #0
tya
sta (dirbuf),y ; null link
iny
lda #ssioff+1 ; ptr to last byte
sta (dirbuf),y
lda #ssioff
jsr setpnt
jsr wrtab
jsr watjob
.pag
ns20 ldx lindx
lda ss,x ; get ss buffer #
pha
jsr gaflgs
ldx lindx
sta ss,x ; swap act-buf & ss
pla
ldx lbused
sta buf0,x
lda #0
jsr setpnt ; set link to new ss
ldy #0
lda track
sta (dirbuf),y
iny
lda sector
sta (dirbuf),y
jsr hugerel
bne ns50
lda r0
cmp #all
bne ns50
lda sector
pha
lda track
pha
jsr wrtout ; write old ss
jsr watjob
jsr dblbuf
jsr rdsssa ; read sss
inc r5
lda r5 ; next group number
asl a
clc
adc #3 ; index into sss
jsr setssp ; point to it
pla
jsr putss ; set the track
pla
jsr putss ; set the sector
jsr wrtsss ; write out the sss
lda r5
pha
jmp rdss1d ; now read the ss back in
ns40 jsr getact
ldx lindx
jsr ibrd ; read next ss
lda #0
jsr setpnt ; ptr=0
ns50 dec r4
dec r4
ldy r3 ; get new ss link ptr
lda r1
sta (dirbuf),y ; put track in
iny
lda r2
sta (dirbuf),y ; put sector in
jsr wrtout ; write it back
jsr watjob ; ...& wait
ldy r4
cpy #3
bcs ns40 ; more ss to update!
jmp dblbuf ; reset active buffer
newss3
lda r0
cmp #nssl-1
bcs newss4
jmp newss1
newss4
lda #all
sta r0
lda #0
jsr setpnt
ldy #2
sta (dirbuf),y ; ss 0
ldx lindx
lda rs,x
iny
sta (dirbuf),y ; record size
iny
beq newss5
jmp newss2
newss5
jmp newss1