Subversion Repositories Kolibri OS

Rev

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_PM_INDEX	equ	0xC50
18
SB_PM_DATA	equ	0xC51
19
BOX_COLOR	equ	0xD0C8C0
20
 
21
START:
22
 
23
 
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
    mcall -1
55
.bt2:
56
	cmp	ah, 2
57
	jne	.bt3
58
	dec	[Reg]		; Rg# decrement
59
	jmp	red
60
.bt3:
61
	cmp	ah, 3
62
	jne	.bt4
63
	inc	[Reg]		; Rg# increment
64
	jmp	red
65
.bt4:
66
	cmp	ah, 4
67
	jne	.bt5
68
	add	[Reg],16	; PgDn
69
	jmp	red
70
.bt5:
71
	cmp	ah, 5
72
	jne	.bt6
73
	mov	edx, [Reg]
74
	cmp	edx, 16
75
	jb	@f
76
	sub	edx, 16
77
	mov	[Reg],edx      ; PgUp
78
	jmp	red
79
@@:
80
	xor	edx, edx
81
	mov	[Reg], edx
82
	jmp	red
83
 
84
.bt6:
85
	cmp	ah, 6
86
	jne	still
87
	mcall	37, 1		; get the mouse pointer
88
	shr	eax, 16 	; only X needed
89
	sub	eax, 124	; check the left border
90
	jb	red
91
	xor	edx, edx
92
	mov	ebx, 12
93
	div	ebx
94
	cmp	eax, 32 	; check the right border
95
	jnb	red
96
	mov	ecx, 31
97
	sub	ecx, eax	 ; reverse the bit order
98
	mov	ebx, [Rct]
99
	btc	ebx, ecx	; invert the bit
100
	mov	eax, [Reg]
101
	mov	[Rct], ebx
102
	call	write_sb_pm_reg
103
 
104
    jmp   red
105
 
106
 
107
;------------------------------------------------
108
print_config_reg:
109
;------------------------------------------------
110
	mov	eax, [Reg]
111
;        and     eax, 0x0FF
112
	mov	ebx, 3*65536+256   ; 3 hex digits
113
	mov	ecx, eax
114
	mov	dx,[stX]
115
	shl	edx,16		   ; = X*65536
116
	mov	dx,[stY]	   ; = edx + Y
117
	mov	esi,0
118
	mcall 47		   ; print reg#
119
	mov	ecx, edx
120
	call	read_sb_pm_reg
121
	mov	edx, ecx
122
	mov	ecx, eax
123
	add	edx, 36*65536	   ; right column
124
	mov	ebx, 8*65536+256   ; 8 hex digits
125
	mcall 47		   ; print config data
126
	ret
127
 
128
;------------------------------------------------
129
read_sb_pm_reg:
130
; in:  [Reg] = reg#  |  out: eax = [Rct] = data
131
;------------------------------------------------
132
	mov	dx,  SB_PM_INDEX
133
	xor	eax, eax
134
	mov	al,  byte [Reg]
135
	out	dx, al
136
	inc	dl
137
	in	al, dx
138
	mov	[Rct], eax
139
	ret
140
 
141
;------------------------------------------------
142
write_sb_pm_reg:
143
; in:  [Reg] = reg#; [Rct] = data
144
;------------------------------------------------
145
	mov	dx,  SB_PM_INDEX
146
	xor	eax, eax
147
	mov	al,  byte [Reg]
148
	out	dx, al
149
	inc	dl
150
	mov	eax, [Rct]
151
	out	dx, al
152
	ret
153
 
154
 
155
;------------------------------------------------
156
    draw_window:
157
;------------------------------------------------
158
 
159
 
160
    mcall 12, 1
161
    mcall 0, 600*65536+530, 410*65536+290, 0x14748090,,title
162
; -----------------------------------------------------------------
163
; BUTTONS:   Xleft    Xwid,  Ytop    Yheig
164
    mcall 8, 370*65536+ 40,  26*65536+ 18, 2, 0x94A0B0 ;  <<
165
    mcall  ,		  ,  51*65536+ 18, 3,	       ;  >>
166
    mcall  , 425*65536+ 90,  26*65536+ 18, 4,	       ; Next Page
167
    mcall  ,		  ,  51*65536+ 18, 5,	       ; Prev Page
168
    mcall  , 117*65536+400,  97*65536+ 40, 6,	       ; Bits
169
 
170
	call	read_sb_pm_reg
171
 
172
	mov	ebx, bitstr2
173
	inc	ebx
174
	mov	edx, [Rct]
175
	mov	ecx, 0x80000000
176
	xor	eax, eax
177
.stringtest:
178
	test	edx, ecx
179
	jz	@f
180
	mov	byte [ebx+eax*2],'I'	; bit dump
181
	jmp	.nextbit
182
@@:
183
	mov	byte [ebx+eax*2],'0'
184
.nextbit:
185
	inc	eax
186
	shr	ecx, 1
187
	jnz	.stringtest
188
 
189
; button txt:  X *65536+ Y
190
    mcall  4, 378*65536+32 ,0x10000000, butstr2,3
191
    mcall  ,  378*65536+57 ,	      , butstr3,
192
    mcall  ,  436*65536+32 ,	      , butstr4,9
193
    mcall  ,  436*65536+57 ,	      , butstr5,
194
 
195
    mcall  4, 122*65536+101,0	       , bitstr0,65
196
    mcall  ,  122*65536+110,0	       , bitstr1,65
197
    mcall  ,  122*65536+117,0	       , bitstr2,65
198
    mcall  ,  122*65536+126,0	       , bitstr3,65
199
; -----------------------------------------------------------------
200
;    draw the reg-value box
201
	mov	ebx, 10*65536+100	; Xleft | Xwidth
202
	mov	ecx, 26*65536+250	; Ytop  | Yheight
203
	mov	edx, BOX_COLOR
204
	mcall	13
205
;    draw the reg-address box
206
	mov	ebx, 206*65536+146	; Xleft | Xwidth
207
	mov	cx, 44			; Yheight only
208
	mcall	13
209
 
210
;    fill the data box
211
	mov	bx, 40	       ; upper position
212
	mov	[stY],bx
213
	mov	eax, [Reg]
214
	mov	[reg], eax     ; store original#
215
.print_reg_names:
216
	call	print_config_reg
217
	add	[stY],14
218
	inc	[Reg]
219
	mov	edx,[reg]
220
	mov	eax, 16
221
	add	eax, edx
222
	cmp	eax,[Reg]
223
	ja	.print_reg_names
224
	mov	[Reg], edx	; restore original#
225
 
226
;   fill the status box
227
	mcall	4, 210*65536+30,0,str1,12
228
	mcall	,  210*65536+44, ,str2,
229
	mcall	,  210*65536+56, ,str3,
230
	call	read_sb_pm_reg
231
	mov	ecx, SB_PM_DATA
232
	mov	edx, 300*65536+30
233
	mov	ebx, 8*65536+256
234
	mcall	47
235
	add	dx, 14
236
	mov	ecx,[Reg]
237
	mov	esi, 0
238
	mcall	47
239
	add	dx,14
240
	mov	ecx, [Rct]
241
	mcall	47
242
 
243
;    print extra info
244
	mov	ebx, 120*65536+170
245
	xor	ecx, ecx
246
	mov	edx, info1
247
@@:
248
	mcall	4,,,,66
249
	add	edx, 66
250
	add	ebx, 14
251
	cmp	edx, info_end
252
	jb	@b
253
 
254
 
255
    mcall 12, 2 		   ; функция 12: сообщить ОС об отрисовке окна
256
 
257
ret
258
 
259
 
260
align 4
261
;-------------------------------------------------
262
 
263
  pix	dd  0x55AACC33
264
  pxX	dd  200
265
  pxY	dd  160
266
  stX	dw  18
267
  stY	dw  0
268
  reg	dd  0
269
 
270
  Rct	dd  0	     ; reg content
271
  Reg	dd  0x00     ; reg number
272
 
273
 
274
 title db '          SB710 Client Management Registers - IO_CM_Reg',0
275
;------------------------------------------------------------------------------------
276
 reg_str   db	'Reg#| hex.Value  '
277
;------------------------------------------------------------------------------------
278
str1	db	'bdf address:'
279
str2	db	'Reg. number:'
280
str3	db	'Reg.content:'
281
 
282
 butstr2 db ' << '
283
 butstr3 db ' >> '
284
 butstr4 db 'Next Page'
285
 butstr5 db 'Prev Page'
286
 
287
bitstr0  db	'31',209,205,209,205,209,205,209,205,209,205,209,205,'24',\
288
		209,205,209,205,209,205,209,205,209,205,209,205,209,205,'16',\
289
		209,'15',205,209,205,209,205,209,205,209,205,209,205,209,'8',\
290
		205,'7',209,205,209,205,209,205,209,205,209,205,209,205,209,'0',184
291
bitstr1  db	179,' | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ',179
292
bitstr2  db	179,'1 0 9 8',179,'7 6 5 4',179,'3 2 1 0',179,'9 8 7 6',\
293
		179,'5 4 3 2',179,'1 0 9 8',179,'7 6 5 4',179,'3 2 1 0',179
294
bitstr3  db	212,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,\
295
		205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,\
296
		205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,\
297
		205,207,205,207,205,207,205,207,205,207,205,190
298
 
299
info1	db	'-------------                PM REG                  -------------'
300
	db	'|   see AMD SB700/710/750 Register Reference Guide, pp.172-173   |'
301
info2	db	'| reg 00 - IdRegister                                            |'
302
	db	'| reg 02 [0]: logical status of TALERT/GPIO64 input (read-clears)|'
303
	db	'| reg 03 [1]: generate SMI# ipon TALERT                          |'
304
	db	'| reg 12 - I2C Control                                           |'
305
	db	'| reg 13 [7:6]: GpmPortStatus (00=read; 01=OE; 10=output)        |'
306
	db	'------------------------------------------------------------------'
307
info_end:
308
 
309
I_END:		; end of program
310
 
311
	rd 256
312
 
313
align 256
314
st_0: