-
Notifications
You must be signed in to change notification settings - Fork 85
/
init
204 lines (204 loc) · 3.19 KB
/
init
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
.PAG 'INIT'
;RAM & ROM TEST, I/O-DATA INIT
.SKI 3
* = $E040+$141
F7 =$38 ;FAIL STATES
F6 =F7-8
F5 =F6-8
F4 =F5-8
F3 =F4-8
F2 =F3-8
F1 =F2-8
DROMTS LDX #0 ;TEST FOR DROM
LDA #$55 ; TEST FOR $55
DRT05 CMP $D000
BNE DRT10
DEX
BNE DRT05
DRT10 RTS
.SKIP
; RESET ENTRY ON POWER ON
INIT CLD
SEI
LDX #$FF
TXS
STX IEEEDO ;FREE DATA LINES
STX PBDD1
LDA #DAVO+EOIO+RFDO
STA PAD2 ;FREE CONTROL LINES
LDA #%00011111
STA PADD2 ;THEN SET DDR
LDA #ERRLED+ACTLDB+ACTLDA
STA PBD2
;LDA #%00111000
STA PBDD2
.SKIP
;ZERO PAGE TEST
ZPTST LDX #0
TXA
ZPT10 LDY #$55 ;ALTERNATING BITS
STY 0,X
DEX
BNE ZPT10
TAX
ZPT20 LDA #$AA
ASL 0,X
EOR 0,X
STA 0,X
BNE ZPBAD
.SKIP
DEX
BNE ZPT20
.SKIP
JSR DROMTS
BNE EROMCK ;NOT HERE, GOTO E-ROM TEST
JMP $D005 ;DIAGNOSTICS HOOK
.SKIP
ROMTST ;ROM CHECK SUBROUTINE
;SET IP AS INDIR. PNTR
LDX #16 ;CHECKSUM RETURNED IN .A
LDY #0
TYA
CLC
.SKI
ROMT10 ADC (IP)Y
INY
BNE ROMT10
.SKIP
DEX
BEQ ROMT20
.SKIP
INC IP+1
BNE ROMT10
.SKIP
ROMT20 RTS
ZPBAD LDA #$FF
STA 0,X
BNE ZPBAD
.SKIP
;E-ROM CHECK
EROMCK LDA #F6
STA PBD2
LDA #$E0 ;E-ROM
STA IP+1
LDA #0
STA IP
JSR ROMTST
.SKI
CMP #0
BEQ FROMCK ;OK, GOTO F-ROM TEST
.SKIP
BADE
STA $E000
JMP BADE
.SKIP
;F-ROM CHECK
FROMCK LDA #F5
STA PBD2
LDA #$F0
STA IP+1
JSR ROMTST
CMP #0
BEQ DIAGOK ;OK, GOTO 4K TEST
.SKIP
BADF
STA $F000
JMP BADF
.SKIP
DIAGOK LDA #0
STA PBD2
LDA PBD2 ;COMPUTE PRIMARY ADDR
AND #7
ORA #$48 ;TALK ADDRESS
STA TLKADR
EOR #$60 ;LISTEN ADDRESS
STA LSNADR
;INIT COMMAND CHANNEL
LDA #TALKER+LISNER
STA CHNRDY+CMDCHN
LDA #'0
STA CHNDAT+CMDCHN
DSKINT JSR INTTAB
LDA #$FF
LDX #33
DSKIN1 STA LINTAB,X
DEX
BPL DSKIN1
LDA #CMDRD
STA LINTAB+30
LDA #CMDWRT
STA LINTAB+31
LDA #$3F ;LINDX 0 TO 5 FREE
STA LINUSE
.SKIP
LDA #$0F
STA BUFNUM+12
LDA #$10
STA BUFNUM+14
LDA #$FF
STA BUFNUM+13
STA BUFNUM+15
LDA #$88
STA CHNRDY+CMDRD
LDA #$01
STA CHNRDY+CMDWRT
LDA #0
STA BUFUSE
LDA #$E0
STA BUFUSE+1
JSR USRINT ;INIT USER JMP
LDA #10 ;SET UP SECTOR OFFSET
STA SECINC
.SKIP
;ALLOW ATN TO INTERRUPT
STA ATNPE
.SKIP3
; IDLE LOOP, WAITING FOR SOMETHING TO DO
IDLE LDA CMDWAT ; TEST FOR PENDING COMMAND
BEQ IDLE2 ; NO COMMAND WAITING
LDA #0
STA CMDWAT
SEI
JSR PARSXQ ; PARSE AND XEQ COMMAND
IDLE2 CLI ;TEST FOR DRIVE RUNNING OR OPENFILE
LDA #29
STA TEMP+3
LDA #0 ;IF FILE OPEN, TURN ON ACT LED
STA TEMP
STA TEMP+1
FILO1 LDX TEMP+3 ;LOOK THRU LINTAB
LDA LINTAB,X ;FOR ACTIVE FILE
CMP #$FF
BEQ FILO2
STA LINDX
JSR GETACT
TAX
LDA LSTJOB,X ;DETERMINE WHICH DRV IT IS ON
AND #1
TAX
INC TEMP,X
FILO2 DEC TEMP+3 ;SET FLAG INDICATING DRV
BPL FILO1 ;HAS FILE OPEN
TSTFIL LDY #14 ;LOOK THRU JOB QUE FOR
FIL5 LDA JOBS,Y ; FOR JOBS STILL RUNNING
BPL FIL6
AND #1
TAX
INC TEMP,X ;SET FLAG INDICATING DRIVE
FIL6 DEY ;IS ACTIVE
BPL FIL5
LDA PBD2
AND #255-ACTLDA-ACTLDB
STA PBD2
LDA TEMP
BEQ FILO3
LDA PBD2 ;TURN ON LED IF DRIVE FLAG
ORA #ACTLDB ; IF NOT 0
STA PBD2
FILO3 LDA TEMP+1
BEQ FILO4
LDA PBD2
ORA #ACTLDA
STA PBD2
FILO4 JMP IDLE2 ;BACK TO TOP OF LOP
.END