-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathbegin
227 lines (227 loc) · 3.81 KB
/
begin
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
.PAGE 'BEGIN DOS'
BEGIN
LDX #$FF
TXS ; INITIALIZE STACK
LDA PBD2
AND #255-ERRLED-LED0-LED1
STA PBD2 ; TURN LEDS OFF
LDA PBD2 ; COMPUTE PRIMARY ADDR
AND #7
ORA #$48 ; TALK ADDRESS
STA TLKADR
EOR #$60 ; LISTEN ADDRESS
STA LSNADR
;
; INITIALIZE BUFFER POINTER TABLE
;
INTTAB
LDX #0
LDY #0
INTT1
LDA #0
STA BUFTAB,X
INX
LDA BUFIND,Y
STA BUFTAB,X
INX
INY
CPY #BFCNT+2
BNE INTT1
LDA #<CMDBUF ; SET POINTER TO COMMAND BUFFER
STA BUFTAB,X
INX
LDA #>CMDBUF
STA BUFTAB,X
INX
LDA #<ERRBUF ; SET POINTER TO ERROR BUFFER
STA BUFTAB,X
INX
LDA #>ERRBUF
STA BUFTAB,X
LDA #$FF
LDX #MAXSA
DSKIN1 STA LINTAB,X
DEX
BPL DSKIN1
LDX #MXCHNS-1
DSKIN2
STA BUF0,X ; SET BUFFERS AS UNUSED
STA BUF1,X
STA SS,X
DEX
BPL DSKIN2
LDA #BFCNT+2 ; SET BUFFER POINTERS
STA BUF0+CMDCHN
LDA #BFCNT+3
STA BUF0+ERRCHN
LDA #ERRCHN
STA LINTAB+ERRSA
LDA #CMDCHN+$80
STA LINTAB+CMDSA
LDA #LXINT ; LINDX 0 TO 5 FREE
STA LINUSE
LDA #RDYLST
STA CHNRDY+CMDCHN
LDA #RDYTLK
STA CHNRDY+ERRCHN
LDA #0
STA BUFUSE
LDA #$F0
STA BUFUSE+1
JSR USRINT ; INITIALIZE USER JUMP TABLE
;
; SET INDIRECT VECTORS
;
LDA #<DIAGOK
STA VNMI
LDA #>DIAGOK
STA VNMI+1
LDA #5 ; SET UP SECTOR ALLOCATE
STA SECINC
LDA #5
STA REVCNT ; SET UP RECOVERY COUNT
;
; CONFIGURE THE TABLES ACCORDING TO DOS
;
CONFIG
LDX DOS
LDA BMSIZE,X
STA BAMSIZ ; SET BAM SIZE
LDA MPOFF,X
STA MAPOFF ; SET MAP OFFSET
LDA LOWTRK,X
STA LOTRK ; SET LOW TRACK IN BAM
LDA DISKNM,X
STA DSKNAM ; DISK NAME OFFSET
LDA DOS
BEQ CONFI6 ; 4040 DOS
;
; 8050/8250 DOS
;
LDA #39
STA DIRTRK ; DIRECTORY TRACK
LDA #'C
STA VERNUM ; 8050/8250 VERSION
LDX #4
LDA NSIDES ; # OF SIDES ON DISK
LSR A
BNE CONFI1 ; DOUBLE SIDED 8250
DEX ; SINGLE SIDED 8050
DEX ; .X = 2
BNE CONFI2 ; JUMP AROUND DOUBLE SIDED STUFF
.PAGE
;
; 8250, DOUBLE SIDED
;
CONFI1
LDA BMT80D,X
STA BAMTRK,X ; BAM TRACK TABLE
LDA BMS80D,X
STA BAMSEC,X ; BAM SECTOR TABLE
DEX
BPL CONFI1
INX ; .X = 0
STX SWITCH ; 8250, BIG RELATIVE FILE
LDA #155
STA MAXTRK ; MAX TRACK+1 ON DISK
LDA #77
STA MTRACK ; # OF TRACKS PER SIDE
BNE CONFI3 ; JUMP AROUND SINGLE SIDED STUFF
;
; 8050, SINGLE SIDED
;
CONFI2
LDA BMT80S,X
STA BAMTRK,X ; BAM TRACK TABLE
LDA BMS80S,X
STA BAMSEC,X ; BAM SECTOR TABLE
DEX
BPL CONFI2
STX SWITCH ; 8050, NO BIG RELATIVE FILE
LDA #78
STA MAXTRK ; MAX TRACK+1 ON DISK
LDX #0
STX MTRACK ; 0 FOR SINGLE SIDED
;
; 8050/8250 COMMON STUFF
;
CONFI3
LDX #6
LDA NSEC80,X
STA TLGAP ; MAX TAIL GAP
DEX
CONFI4
LDA NSEC80,X
STA NUMSEC,X ; # OF SECTORS/ZONE AND GAPS
DEX
BPL CONFI4
LDX #7
CONFI5
LDA NTRK80,X
STA TRKNUM,X ; TRACK ZONE BOUNDARIES
DEX
BPL CONFI5
BMI CONFI9 ; JUMP AROUND 4040 STUFF
;
; 4040 DOS
;
CONFI6
LDA #1
STA NSIDES ; SINGLE SIDED ONLY FOR 4040
LDA #18
STA DIRTRK ; DIRECTORY TRACK
STA BAMTRK ; BAM TRACK FOR 4040
LDA #'A
STA VERNUM ; 4040 VERSION
LDA #36
STA MAXTRK ; MAX TRACK+1 ON DISK
LDA #0
STA MTRACK ; 0 FOR SINGLE SIDED
STA BAMSEC ; BAM SECTOR FOR 4040
LDX #6
LDA NSEC40,X
STA TLGAP ; MAX TAIL GAP
DEX
CONFI7
LDA NSEC40,X
STA NUMSEC,X ; # OF SECTORS/ZONE AND GAPS
DEX
BPL CONFI7
LDX #3
CONFI8
LDA NTRK40,X
STA TRKNUM,X ; TRACK ZONE BOUNDARIES
DEX
BPL CONFI8
;
; COMMON DOS VARIABLES
;
CONFI9
LDX #7
CONF10
LDA MSCCOM,X
STA NZONES,X ; COMMON DOS VARIABLES
DEX
BPL CONF10
;
; SET VECTOR TO IDLE LOOP
;
LDA #<VIDLE
STA VECIDL
LDA #>VIDLE
STA VECIDL+1
;
; SET UP POWER UP MESSAGE
;
MESAGE
LDA #CBMVER ; DOS VERSION NUMBER
JSR ERRTS0 ; TRANSFER MESSAGE
;
; ALLOW 'ATN' TO INTERRUPT
;
STA ATNPE
JMP BOOT ; CHECK POWER UP BOOT
;
; MUST BE CONTIGUOUS TO IDLE ROUTINE
;
.END