-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiag-entry.src
228 lines (180 loc) · 2.67 KB
/
diag-entry.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
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
228
; Highspeed SIO patch entry point test
;
.include "hisio.inc"
.include "hipatch.inc"
.include "cio.inc"
DRIVENO = 2
TBYT = $100
TCMD = 'R
TDIR = $40
; highspeed SIO mode to use
HIMODE = $08
START = $1000
BUF = $0800
TMPVEC = $E0
* = START-16
;************************************
; ATR file header
.WORD $0296 ; magic
.WORD (END-START+15)/16
.WORD 128
.WORD 0,0,0,0,0
;************************************
; boot header complete file
.BYTE 0
.BYTE (END-START+127)/128
.WORD START
.WORD XRTS
; check for highspeed patch presence in OS
MAIN
BPUT 0, MTXTL, MTXT
LDA PVER
CMP #'H
BNE NOPATCH
LDA PVER+1
CMP #'i
BNE NOPATCH
LDA PVER+2
CMP #'a
BNE NOPATCH
LDA PVER+3
CMP #'s
BNE NOPATCH
LDA PVER+4
CMP #32
BNE NOPATCH
LDA PVER+5
CMP #'0
BCC NOPATCH
CMP #'9+1
BCS NOPATCH
LDA PVER+6
CMP #'.
BNE NOPATCH
LDA PVER+7
CMP #'0
BCC NOPATCH
CMP #'9+1
BCS NOPATCH
LDA PVER+8
CMP #'0
BCC NOPATCH
CMP #'9+1
BCS NOPATCH
LDA PVER+9
CMP #32
BEQ FOUNDPATCH
NOPATCH
BPUT 0, TNOPATCHL, TNOPATCH
JMP TEND
FOUNDPATCH
BPUT 0, TFOUNDL, TFOUND
BPUT 0, 11, PVER+5
LDA #155
JSR PUTCHR
; now check if version >= 1.32
LDA PVER+5
CMP #'1
BCC OLDPATCH
BNE PATCHOK
LDA PVER+7
CMP #'3
BCC OLDPATCH
BNE PATCHOK
LDA PVER+8
CMP #'2
BCS PATCHOK
OLDPATCH
BPUT 0, TOLDL, TOLD
JMP TEND
PATCHOK
BPUT 0, TVEROKL, TVEROK
; set SIO parameters
LDA #$31
STA DDEVIC
LDA #DRIVENO
STA DUNIT
LDA #TCMD
STA DCOMND
LDA #<BUF
STA DBUFLO
LDA #>BUF
STA DBUFHI
LDA #7
STA DTIMLO
LDA #<TBYT
STA DBYTLO
LDA #>TBYT
STA DBYTHI
; read sectors 4-720 in a loop forever
TLOOP0
LDA #4
STA DAUX1
LDA #0
STA DAUX2
TLOOP LDA 53279
CMP #6
BEQ TLOOP
LDA #TDIR
STA DSTATS
LDA #HIMODE
JSR PHISIO
BMI TERROR
LDA 53279
CMP #3
BEQ TEND
INC DAUX1
BNE TLOOP1
INC DAUX2
TLOOP1 LDA DAUX2
CMP #2
BNE TLOOP
LDA DAUX1
CMP #$D1
BNE TLOOP
JMP TLOOP0
TERROR
BPUT 0, TERRL, TERR
TEND BPUT 0, TAGAL, TAGA
JSR GETKEY
CMP #27
BEQ EXIT
JMP MAIN
EXIT JMP $E477
PUTCHR TAY
LDA $E407
PHA
LDA $E406
PHA
TYA
RTS
GETKEY LDA $E425
PHA
LDA $E424
PHA
XRTS RTS
MTXT .BYTE 125
.BYTE "highspeed SIO entry test",155
MTXTL = * - MTXT
TNOPATCH
.BYTE "patch not detected",155
TNOPATCHL = * - TNOPATCH
TFOUND
.BYTE "patch detected: "
TFOUNDL = * - TFOUND
TOLD
.BYTE "patch is too old", 155
TOLDL = * - TOLD
TVEROK
.BYTE "Version OK, starting test",155
TVEROKL = * - TVEROK
TERR .BYTE "Error, aborting test",155
TERRL = * - TERR
TAGA .BYTE 155, "press ESC to reboot or any",155
.BYTE "other key to restart test",155
TAGAL = * - TAGA
; assemble highspeed code at identical page-boundaries as hipatch code
.IF (*&127)<>0
.DC (128-(*&127)) 0
.ENDIF
END = *