-
Notifications
You must be signed in to change notification settings - Fork 1
/
hisiodet.src
149 lines (123 loc) · 2.82 KB
/
hisiodet.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
; highsiodet.src - check for highspeed drives
;
; Copyright (c) 2006-2023 by Matthias Reichl <[email protected]>
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
HISIO
; the highspeed SIO patch checks for valid DUNIT values
; before, so skip this test to save some memory
.if .not .def HIPATCH
LDA DUNIT
BNE ?DOSIO ; DUNIT = 0 clears speed table
.if .def MAXDRIVENO
LDX #MAXDRIVENO-1
.else
LDX #7
.endif
?CLRLP
?ABS01 STA SPEEDTB,X
DEX
BPL ?CLRLP
RTS
.endif
?DOSIO LDX DUNIT
?ABS02 LDA SPEEDTB-1,X
BEQ ?DOCHK
SEC ; bytes in SIO table are now speed+1
SBC #1 ; to prevent endless loop in case device sends speed byte 0
DOHIENTRY
?ABS03 STA SIOSPEED
?ABS04 JMP DOHISIO
?DOCHK
LDA SOUNDR
PHA
LDA #0
STA SOUNDR
LDA #STDSPD
?ABS05 STA SIOSPEED
LDY #$09
?SAVCMD LDA DCOMND,Y
PHA
?ABS06 LDA ?CMD3F,Y ; Happy/Speedy Ultra SIO mode?
STA DCOMND,Y
DEY
BPL ?SAVCMD
?ABS07 JSR ?DODET
; for testing happy 810 mode, change BMI into JMP and connect a happy 1050
BMI ?NOULTRA
?ABS08 LDA HIBUF
CMP #$0A ; speed byte $0A is most certainly a Happy 1050
BNE ?SETSP2
; enable fast write for Happy 1050 (but not for other drives),
; otherwise data might be corrupted
; stupid, stupid Happy...
?ABS09 JSR ?CHKHAP
?ABS10 LDA HIBUF
?ABS11 JMP ?SETSP2
?NOULTRA
.if .not .def USONLY
?ABS12A JSR ?GETST2
BMI ?CHKNOHI ; bail out early if drive is not responding
LDA #TURFLG ; Turbo 1050?
?ABS12 JSR ?GETST
BPL ?SETSPD
LDA #XFFLG ; XF551?
?ABS13 JSR ?GETST
BPL ?SETSPD
LDA #HAPFLG ; Happy 810?
?ABS14 STA SIOSPEED
?ABS15 JSR ?CHKHAP
BPL ?SETSPD
.endif
?CHKNOHI
LDA #STDSPD ; no, just use standard SIO speed
BNE ?SETSP2
.if .not .def USONLY
?GETST
?ABS16 STA SIOSPEED
?GETST2
LDA #4
STA DBYTLO
LDX #$53
LDA #$40
.endif
?DOIMM STX DCOMND
STA DSTATS
?DODET LDA #1
LDX #DETCRETRY
?ABS17 JMP DOHIDET
?CHKHAP LDX #$48 ; check for happy 810
LDA #0
BEQ ?DOIMM
.if .not .def USONLY
?SETSPD
?ABS18 LDA SIOSPEED
.endif
?SETSP2 LDX DUNIT
CLC ; add 1 to value to prevent endless loop
ADC #1 ; if device sends a speed byte of 0
?ABS19 STA SPEEDTB-1,X
?RESCMD LDY #$00
?RESLP PLA
STA DCOMND,Y
INY
CPY #$0A
BCC ?RESLP
PLA
STA SOUNDR
?ABS20 JMP ?DOSIO
?CMD3F .BYTE $3F,$40
?ABS21 .WORD HIBUF,2,1,$20