-
Notifications
You must be signed in to change notification settings - Fork 85
/
map.src
133 lines (114 loc) · 3.24 KB
/
map.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
.page
.subttl 'map.src'
; build a new map on diskette
newmap
newmpv
jsr clnbam
ldy #0
lda #18 ; set link to 18.1
sta (bmpnt),y
iny
tya
sta (bmpnt),y
iny
iny
iny ; .y=4
nm10
lda #0 ; clear track map
sta t0
sta t1
sta t2
tya ; 4=>1
lsr a
lsr a ; .a=track #
jsr maxsec ; store blks free byte away
sta (bmpnt),y
iny
tax
nm20
sec ; set map bits
rol t0 ; t0 t1 t2
rol t1 ; 76543210 111111 xxx21111
rol t2 ; 54321098 09876
dex ; 11111111 11111111 11111
bne nm20
nm30 ; .x=0
lda t0,x
sta (bmpnt),y ; write out bit map
iny
inx
cpx #3
bcc nm30
cpy #$90 ; end of bam, 4-143
bcc nm10
jmp nfcalc ; calc # free sectors
; write out the bit map to
; the drive in lstjob(active)
mapout jsr getact
tax
lda lstjob,x
mo10 and #1
sta drvnum ; check bam before writing
; write bam according to drvnum
scrbam
ldy drvnum
lda mdirty,y
bne sb10
rts ; not dirty
sb10
lda #0 ; set to clean bam
sta mdirty,y
jsr setbpt ; set bit map ptr
lda drvnum
asl a
pha
;put memory images to bam
jsr putbam
pla
clc
adc #1
jsr putbam
; verify the bam block count
; matches the bits
lda track
pha ; save track var
lda #1
sta track
sb20
asl a
asl a
sta bmpnt
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
jsr ptch39 ; *** rom ds 02/25/85 ***
; jsr avck ; check available blocks
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
inc track
lda track
cmp maxtrk
bcc sb20
pla ; restore track var
sta track
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
jmp wrt_bam
; jmp dowrit ; write it out
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
.page
; set bit map ptr, read in bam if nec.
setbpt
jsr bam2a
tax
jsr redbam ; read bam if not in
ldx jobnum
lda bufind,x ; set the ptr
sta bmpnt+1
lda #0
sta bmpnt
rts
; calc the number of free blocks on drvnum
numfre
ldx drvnum
lda ndbl,x
sta nbtemp
lda ndbh,x
sta nbtemp+1
rts