Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1599 | art_zh | 1 | $Revision: 1598 $ |
2 | |||
3 | use32 ; |
||
4 | org 0x0 ; |
||
5 | |||
6 | db 'MENUET01' ; |
||
7 | dd 0x01 ; |
||
8 | dd START ; |
||
9 | dd I_END ; |
||
10 | dd 0x1000 ; |
||
11 | dd 0x1000 ; |
||
12 | dd 0x0 ; |
||
13 | dd 0x0 ; |
||
14 | |||
15 | include 'MACROS.INC' ; |
||
16 | |||
17 | SB_SIO_INDEX equ 0x2e |
||
18 | SB_SIO_DATA equ 0x2f |
||
19 | BOX_COLOR equ 0xD0C8C0 |
||
20 | |||
21 | START: |
||
22 | |||
23 | call enter_cfg_mode ; call this once |
||
24 | |||
25 | |||
26 | |||
27 | red: |
||
28 | |||
29 | call draw_window |
||
30 | |||
31 | still: |
||
32 | mcall 10 ; event waiting |
||
33 | |||
34 | cmp eax,1 ; redraw window |
||
35 | je red ; |
||
36 | cmp eax,2 ; key pressed? |
||
37 | je key ; |
||
38 | cmp eax,3 ; button hit? |
||
39 | je button ; |
||
40 | |||
41 | jmp still ; none of that |
||
42 | |||
43 | ;--------------------------------------------------------------------- |
||
44 | |||
45 | key: ; key pressed |
||
46 | jmp red |
||
47 | |||
48 | ;--------------------------------------------------------------------- |
||
49 | |||
50 | button: |
||
51 | mcall 17 ; get the button ID |
||
52 | cmp ah, 1 |
||
53 | jne .bt2 |
||
54 | |||
55 | mov byte[Reg], 2 |
||
56 | mov byte[Rct], 2 |
||
57 | call write_sio_cfg ; exit config-mode on exit |
||
58 | mcall -1 |
||
59 | ; -------------- |
||
60 | .bt2: |
||
61 | cmp ah, 2 |
||
62 | jne .bt3 |
||
63 | dec [Reg] ; Rg# decrement |
||
64 | jmp red |
||
65 | .bt3: |
||
66 | cmp ah, 3 |
||
67 | jne .bt4 |
||
68 | inc [Reg] ; Rg# increment |
||
69 | jmp red |
||
70 | .bt4: |
||
71 | cmp ah, 4 |
||
72 | jne .bt5 |
||
73 | add [Reg],16 ; PgDn |
||
74 | jmp red |
||
75 | .bt5: |
||
76 | cmp ah, 5 |
||
77 | jne .bt6 |
||
78 | mov edx, [Reg] |
||
79 | cmp edx, 16 |
||
80 | jb @f |
||
81 | sub edx, 16 |
||
82 | mov [Reg],edx ; PgUp |
||
83 | jmp red |
||
84 | @@: |
||
85 | xor edx, edx |
||
86 | mov [Reg], edx |
||
87 | jmp red |
||
88 | |||
89 | .bt6: |
||
90 | cmp ah, 6 |
||
91 | jne still |
||
92 | mcall 37, 1 ; get the mouse pointer |
||
93 | shr eax, 16 ; only X needed |
||
94 | sub eax, 124 ; check the left border |
||
95 | jb red |
||
96 | xor edx, edx |
||
97 | mov ebx, 12 |
||
98 | div ebx |
||
99 | cmp eax, 32 ; check the right border |
||
100 | jnb red |
||
101 | mov ecx, 31 |
||
102 | sub ecx, eax ; reverse the bit order |
||
103 | mov ebx, [Rct] |
||
104 | btc ebx, ecx ; invert the bit |
||
105 | mov eax, [Reg] |
||
106 | mov [Rct], ebx |
||
107 | call write_sio_cfg |
||
108 | |||
109 | jmp red |
||
110 | |||
111 | |||
112 | ;------------------------------------------------ |
||
113 | print_config_reg: |
||
114 | ;------------------------------------------------ |
||
115 | mov eax, [Reg] |
||
116 | ; and eax, 0x0FF |
||
117 | mov ebx, 3*65536+256 ; 3 hex digits |
||
118 | mov ecx, eax |
||
119 | mov dx,[stX] |
||
120 | shl edx,16 ; = X*65536 |
||
121 | mov dx,[stY] ; = edx + Y |
||
122 | mov esi,0 |
||
123 | mcall 47 ; print reg# |
||
124 | mov ecx, edx |
||
125 | call read_sio_cfg |
||
126 | mov edx, ecx |
||
127 | mov ecx, eax |
||
128 | add edx, 36*65536 ; right column |
||
129 | mov ebx, 8*65536+256 ; 8 hex digits |
||
130 | mcall 47 ; print config data |
||
131 | ret |
||
132 | |||
133 | ;------------------------------------------------ |
||
134 | read_sio_cfg: |
||
135 | ; in: [Reg] = reg# | out: eax = [Rct] = data |
||
136 | ;------------------------------------------------ |
||
137 | mov dx, SB_SIO_INDEX |
||
138 | xor eax, eax |
||
139 | mov al, byte [Reg] |
||
140 | out dx, al |
||
141 | inc dl |
||
142 | in al, dx |
||
143 | mov [Rct], eax |
||
144 | ret |
||
145 | |||
146 | ;------------------------------------------------ |
||
147 | write_sio_cfg: |
||
148 | ; in: [Reg] = reg#; [Rct] = data |
||
149 | ;------------------------------------------------ |
||
150 | mov dx, SB_SIO_INDEX |
||
151 | mov eax, [Reg] |
||
152 | out dx, al |
||
153 | inc dl |
||
154 | mov eax, [Rct] |
||
155 | out dx, al |
||
156 | ret |
||
157 | ;------------------------------------------------ |
||
158 | enter_cfg_mode: |
||
159 | ; the magic sequence to unlock the port |
||
160 | ;------------------------------------------------ |
||
161 | mov dx, SB_SIO_INDEX |
||
162 | mov eax, 0x55550187 ; low byte first |
||
163 | out dx, al |
||
164 | shr eax, 8 |
||
165 | out dx, al |
||
166 | shr eax, 8 |
||
167 | out dx, al |
||
168 | shr eax, 8 |
||
169 | out dx, al |
||
170 | ret |
||
171 | |||
172 | ;------------------------------------------------ |
||
173 | draw_window: |
||
174 | ;------------------------------------------------ |
||
175 | |||
176 | |||
177 | mcall 12, 1 |
||
178 | mcall 0, 600*65536+530, 410*65536+290, 0x14748090,,title |
||
179 | ; ----------------------------------------------------------------- |
||
180 | ; BUTTONS: Xleft Xwid, Ytop Yheig |
||
181 | mcall 8, 370*65536+ 40, 26*65536+ 18, 2, 0x94A0B0 ; << |
||
182 | mcall , , 51*65536+ 18, 3, ; >> |
||
183 | mcall , 425*65536+ 90, 26*65536+ 18, 4, ; Next Page |
||
184 | mcall , , 51*65536+ 18, 5, ; Prev Page |
||
185 | mcall , 117*65536+400, 97*65536+ 40, 6, ; Bits |
||
186 | |||
187 | call read_sio_cfg |
||
188 | |||
189 | mov ebx, bitstr2 |
||
190 | inc ebx |
||
191 | mov edx, [Rct] |
||
192 | mov ecx, 0x80000000 |
||
193 | xor eax, eax |
||
194 | .stringtest: |
||
195 | test edx, ecx |
||
196 | jz @f |
||
197 | mov byte [ebx+eax*2],'I' ; bit dump |
||
198 | jmp .nextbit |
||
199 | @@: |
||
200 | mov byte [ebx+eax*2],'0' |
||
201 | .nextbit: |
||
202 | inc eax |
||
203 | shr ecx, 1 |
||
204 | jnz .stringtest |
||
205 | |||
206 | ; button txt: X *65536+ Y |
||
207 | mcall 4, 378*65536+32 ,0x10000000, butstr2,3 |
||
208 | mcall , 378*65536+57 , , butstr3, |
||
209 | mcall , 436*65536+32 , , butstr4,9 |
||
210 | mcall , 436*65536+57 , , butstr5, |
||
211 | |||
212 | mcall 4, 122*65536+101,0 , bitstr0,65 |
||
213 | mcall , 122*65536+110,0 , bitstr1,65 |
||
214 | mcall , 122*65536+117,0 , bitstr2,65 |
||
215 | mcall , 122*65536+126,0 , bitstr3,65 |
||
216 | ; ----------------------------------------------------------------- |
||
217 | ; draw the reg-value box |
||
218 | mov ebx, 10*65536+100 ; Xleft | Xwidth |
||
219 | mov ecx, 26*65536+250 ; Ytop | Yheight |
||
220 | mov edx, BOX_COLOR |
||
221 | mcall 13 |
||
222 | ; draw the reg-address box |
||
223 | mov ebx, 206*65536+146 ; Xleft | Xwidth |
||
224 | mov cx, 44 ; Yheight only |
||
225 | mcall 13 |
||
226 | |||
227 | ; fill the data box |
||
228 | mov bx, 40 ; upper position |
||
229 | mov [stY],bx |
||
230 | mov eax, [Reg] |
||
231 | mov [reg], eax ; store original# |
||
232 | .print_reg_names: |
||
233 | call print_config_reg |
||
234 | add [stY],14 |
||
235 | inc [Reg] |
||
236 | mov edx,[reg] |
||
237 | mov eax, 16 |
||
238 | add eax, edx |
||
239 | cmp eax,[Reg] |
||
240 | ja .print_reg_names |
||
241 | mov [Reg], edx ; restore original# |
||
242 | |||
243 | ; fill the status box |
||
244 | mcall 4, 210*65536+30,0,str1,12 |
||
245 | mcall , 210*65536+44, ,str2, |
||
246 | mcall , 210*65536+56, ,str3, |
||
247 | call read_sio_cfg |
||
248 | mov ecx, SB_SIO_DATA |
||
249 | mov edx, 300*65536+30 |
||
250 | mov ebx, 8*65536+256 |
||
251 | mcall 47 |
||
252 | add dx, 14 |
||
253 | mov ecx,[Reg] |
||
254 | mov esi, 0 |
||
255 | mcall 47 |
||
256 | add dx,14 |
||
257 | mov ecx, [Rct] |
||
258 | mcall 47 |
||
259 | |||
260 | ; print extra info |
||
261 | mov ebx, 120*65536+170 |
||
262 | xor ecx, ecx |
||
263 | mov edx, info1 |
||
264 | @@: |
||
265 | mcall 4,,,,66 |
||
266 | add edx, 66 |
||
267 | add ebx, 14 |
||
268 | cmp edx, info_end |
||
269 | jb @b |
||
270 | |||
271 | |||
272 | mcall 12, 2 ; функция 12: сообщить ОС об отрисовке окна |
||
273 | |||
274 | ret |
||
275 | |||
276 | |||
277 | align 4 |
||
278 | ;------------------------------------------------- |
||
279 | |||
280 | pix dd 0x55AACC33 |
||
281 | pxX dd 200 |
||
282 | pxY dd 160 |
||
283 | stX dw 18 |
||
284 | stY dw 0 |
||
285 | reg dd 0 |
||
286 | |||
287 | Rct dd 0 ; reg content |
||
288 | Reg dd 0x00 ; reg number |
||
289 | |||
290 | |||
291 | title db ' IT8712F -- Super IO control - SIO_Reg',0 |
||
292 | ;------------------------------------------------------------------------------------ |
||
293 | reg_str db 'Reg#| hex.Value ' |
||
294 | ;------------------------------------------------------------------------------------ |
||
295 | str1 db 'bdf address:' |
||
296 | str2 db 'Reg. number:' |
||
297 | str3 db 'Reg.content:' |
||
298 | |||
299 | butstr2 db ' << ' |
||
300 | butstr3 db ' >> ' |
||
301 | butstr4 db 'Next Page' |
||
302 | butstr5 db 'Prev Page' |
||
303 | |||
304 | bitstr0 db '31',209,205,209,205,209,205,209,205,209,205,209,205,'24',\ |
||
305 | 209,205,209,205,209,205,209,205,209,205,209,205,209,205,'16',\ |
||
306 | 209,'15',205,209,205,209,205,209,205,209,205,209,205,209,'8',\ |
||
307 | 205,'7',209,205,209,205,209,205,209,205,209,205,209,205,209,'0',184 |
||
308 | bitstr1 db 179,' | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ',179 |
||
309 | bitstr2 db 179,'1 0 9 8',179,'7 6 5 4',179,'3 2 1 0',179,'9 8 7 6',\ |
||
310 | 179,'5 4 3 2',179,'1 0 9 8',179,'7 6 5 4',179,'3 2 1 0',179 |
||
311 | bitstr3 db 212,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,\ |
||
312 | 205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,\ |
||
313 | 205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,\ |
||
314 | 205,207,205,207,205,207,205,207,205,207,205,190 |
||
315 | |||
316 | info1 db '------------- SIO REG -------------' |
||
317 | db '| see AMD SB700/710/750 Register Reference Guide, pp. |' |
||
318 | info2 db '| |' |
||
319 | db '| reg |' |
||
320 | db '| reg |' |
||
321 | db '| reg |' |
||
322 | db '| reg |' |
||
323 | db '------------------------------------------------------------------' |
||
324 | info_end: |
||
325 | |||
326 | I_END: ; end of program |
||
327 | |||
328 | rd 256 |
||
329 | |||
330 | align 256 |
||
331 | st_0:><> |