-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathnew
122 lines (122 loc) · 1.93 KB
/
new
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
.PAGE 'NEW'
;
; NEW: INITIALIZE A DISK, DISK IS
; SOFT-SECTORED, BIT AVAIL. MAP,
; DIRECTORY, & 1ST BLOCK ARE ALL INITED
;
NEW
JSR ONEDRV
LDA FILDRV ; SET UP DRIVE #
BPL N101
LDA #BADFN
JMP CMDERR
N101
AND #1
STA DRVNUM
JSR SETLDS
JSR SETBMP
LDA DRVNUM
ASL A
TAX
LDY FILTBL+1 ; GET DISK ID
CPY CMDSIZ ; IS THIS NEW OR CLEAR?
BEQ N108 ; END OF CMD STRING
LDA CMDBUF,Y
STA DSKID,X ; STORE IN PROPER DRIVE
LDA CMDBUF+1,Y ; Y = 0
STA DSKID+1,X
JSR CLRCHN
LDX #1
STX TRACK
JSR FORMAT ; TRANSFER FORMAT TO RAM
JMP N110
N108
JSR INITDR
LDY #2
LDA (BMPNT),Y ; USE CURRENT VERSION #
CMP VERNUM
BEQ N110
JMP VNERR
N110
JSR NEWMAP ; CREATE A NEW BAM
LDA DOS
BNE NEW1 ; JUMP AROUND 4040 BAM STUFF
JSR TRNHDR ; TRANSFER DIRECTORY HEADER
LDY #0
LDA DIRTRK
STA (BMPNT),Y
STA TRACK
STY SECTOR
JSR DRTWRT ; WRITE 4040 BAM
JSR NM70 ; CLEAR MDIRTY
NEW1
JSR CLRBAM
LDA DIRTRK
STA TRACK
LDY #1
STY SECTOR
LDA #$FF
STA (BMPNT),Y
JSR DRTWRT ; CLEAR THE DIRECTORY SECTOR
LDA DOS
BNE NEW2
DEC SECTOR ; SECTOR = 0
BEQ NEW3 ; JUMP
NEW2
JSR TRNHDR ; TRANSFER DIRECTORY HEADER
DEC SECTOR ; SECTOR = 0
LDA JOBNUM
JSR SETH
LDA #0
STA TRACK
STA R0
JSR BAMOUT
NEW3
LDA DIRTRK
STA TRACK
JSR SETBMP
JSR USEDTS ; TRACK = DIRTRK, SECTOR = 0
JSR OPNIRD
N150 LDA #0
JSR SETPNT
JSR GETBYT
STA TRACK
JSR GETBYT
STA SECTOR
LDA TRACK
BEQ N160 ; AT THE DIRECTORY
JSR USEDTS ; MARK THE LINKS USED
JSR NXTBUF
JMP N150
N160
JSR SCRBAM
JSR NF05 ; COUNT BLOCKS FREE
JMP ENDCMD
TRNHDR
LDA JOBNUM
TAY
ASL A
TAX
LDA DSKNAM
STA BUFTAB,X
LDX FILTBL
LDA #27
JSR TRNAME ; TRANSFER CMD BUF TO BUF0
LDY #$12
LDA DRVNUM ; SET UP CURRENT I.D.
ASL A
TAX
LDA DSKID,X
STA (DIRBUF),Y
INY
LDA DSKID+1,X
STA (DIRBUF),Y
INY
INY
LDA #DOSVER+$30
STA (DIRBUF),Y
INY
LDA VERNUM ; SHOW VER #
STA (DIRBUF),Y
RTS
.END