Subversion Repositories Kolibri OS

Rev

Rev 1741 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2474 mario79 1
;------------------------------------------------------------------------------
2
; Display Test for KolibriOS
3
;------------------------------------------------------------------------------
4
; version:	0.41
5
; last update:  17/03/2012
6
; written by:   Marat Zakiyanov aka Mario79, aka Mario
7
; changes:      some optimisations and code refactoring
8
;------------------------------------------------------------------------------
9
; compiler:        FASM 1.50
10
; name:            Display Test
11
; version:         0.4
12
; original author: barsuk
894 barsuk 13
 
14
; <--- include all MeOS stuff --->
15
include "lang.inc"
1741 dunkaist 16
include "../../../macros.inc"
894 barsuk 17
 
18
; <--- start of MenuetOS application --->
19
MEOS_APP_START
20
 
1728 clevermous 21
;include "..\..\..\debug.inc"
894 barsuk 22
 
23
 
24
; <--- start of code --->
25
CODE
2474 mario79 26
	mcall	37,4,cursor,2
894 barsuk 27
	or      eax, eax
28
	jz      exit
29
	mov     [cursorID], eax
2474 mario79 30
;------------------------------------------------------------------------------
31
redraw:
894 barsuk 32
	call	draw_window		  ; at first create and draw the window
2474 mario79 33
;------------------------------------------------------------------------------
34
wait_event:				  ; main cycle
894 barsuk 35
	xor	ebx, ebx
2474 mario79 36
	mcall	10
894 barsuk 37
 
38
	cmp	eax, 1			  ;   if event == 1
39
	je	 redraw 		  ;     jump to redraw handler
40
	cmp	eax, 2			  ;   else if event == 2
41
	je	 key				;       jump to key handler
42
	cmp	eax, 3			  ;   else if event == 3
43
	je	 button 		  ;     jump to button handler
44
 
45
	jmp	wait_event		   ;   else return to the start of main cycle
2474 mario79 46
;------------------------------------------------------------------------------
47
key:						; key event handler
48
	mcall	2			  ;   get key code
894 barsuk 49
 
50
	cmp	ah, 27
51
	jz	exit
52
 
53
	cmp	ah, 0x20
54
	jz	next_test
55
 
56
	cmp	ah, 179 		; ->
57
	jz	next_test
58
 
59
	cmp	ah, 176 		; <-
60
	jz	prev_test
61
 
62
	cmp	ah, 'i'
63
	jz	toggle_info
64
 
65
	cmp	ah, 'I' 		; а вдруг у чела КАПСЛОК ))
66
	jz	toggle_info
67
 
68
	cmp	ah, 'c'
69
	jz	toggle_cursor
70
 
71
	cmp	ah, 'C'
72
	jz	toggle_cursor
73
 
74
	cmp	ah, 'd'
75
	jz	redraw
76
 
77
	cmp	ah, 'D'
78
	jz	redraw
79
 
80
	jmp	wait_event
2474 mario79 81
;------------------------------------------------------------------------------
894 barsuk 82
next_test:
83
	cmp	dword [test_done], 1
84
	jz	wait_event
85
 
86
	inc	dword [test_num]
87
	call	draw_window
88
	jmp	wait_event
2474 mario79 89
;------------------------------------------------------------------------------
894 barsuk 90
prev_test:
91
	cmp	dword [test_num], ebx
92
	jz	wait_event
93
 
94
	dec	dword [test_num]
95
	mov	dword [test_done], ebx
96
	call	draw_window
97
	jmp	wait_event
2474 mario79 98
;------------------------------------------------------------------------------
894 barsuk 99
toggle_info:
100
	xor	dword [show_info], 1
101
	call	draw_window
102
	jmp	wait_event
2474 mario79 103
;------------------------------------------------------------------------------
894 barsuk 104
toggle_cursor:
105
	mov	eax, cursorVisible
106
	cmp	dword [eax], 0
107
	jz	.no_cursor
108
 
109
	mov	dword [eax], 0
110
	mov	ecx, [cursorID]
111
	jmp	.set
2474 mario79 112
;--------------------------------------
894 barsuk 113
.no_cursor:
114
	mov	dword [eax], 1
115
	xor	ecx, ecx
2474 mario79 116
;--------------------------------------
894 barsuk 117
.set:
2474 mario79 118
	mcall	37,5
119
	mcall	18,15			; чтобы обновился
894 barsuk 120
	jmp	wait_event
2474 mario79 121
;------------------------------------------------------------------------------
894 barsuk 122
button: 				 ; button event handler
2474 mario79 123
	mcall	17		 ;   get button identifier
894 barsuk 124
	cmp	ah, 1
125
	jne	wait_event		   ;   return if button id != 1
2474 mario79 126
;--------------------------------------
894 barsuk 127
exit:
128
	or	 eax, -1			 ;   exit application
2474 mario79 129
	mcall
130
;------------------------------------------------------------------------------
894 barsuk 131
draw_window:
2474 mario79 132
	mcall	12,1
894 barsuk 133
 
134
	; курсор
135
	;mov     eax, 37
136
	;mov     ebx, 5
137
	;mov     ecx, cursorID
138
	;int     0x40
139
 
2474 mario79 140
	mcall	14 		; screen size
141
 
894 barsuk 142
	mov	ebx, eax
143
	shr	ebx, 16
144
	mov	ecx, eax
145
	and	ecx, 0xffff
146
	mov	[screenx], ebx
147
	mov	[screeny], ecx
148
 
149
	inc	ebx
150
	inc	ecx
2474 mario79 151
	xor	eax, eax			  ; create and draw the window
894 barsuk 152
	mov	edx, 0x01000000
153
	mov	esi, edx
2474 mario79 154
	mcall
894 barsuk 155
	; стереть границы окна
2474 mario79 156
	xor	edx, edx
157
	mcall	13 		; грубо так
894 barsuk 158
 
159
	dec	ebx
160
	dec	ecx
161
 
162
	mov	eax, [test_num]
163
	mov	eax, [test_proc + eax*4]
164
	or	eax, eax
165
	jz	end_of_test
166
	call	eax
167
	jmp	exit_draw
2474 mario79 168
;--------------------------------------
894 barsuk 169
end_of_test:
2474 mario79 170
	mcall	4,<8,8>,0xffffff,test_finish,test_finish.size
894 barsuk 171
	mov	dword [test_done], 1
172
	jmp	no_info
2474 mario79 173
;--------------------------------------
894 barsuk 174
exit_draw:
175
	cmp	dword [show_info], 1
176
	jnz	no_info
177
; снова размеры экрана
178
	mov	ebx, [screenx]
179
	mov	ecx, [screeny]
180
; сгенерить строчку с разрешением экрана. НЕ нужно, потому что ппц
181
	; прямоугольник 200х40 с инфой
182
	mov	edx, 200
183
	sub	ebx, edx
184
	shl	ebx, 15
185
	mov	bx, dx
186
	mov	edx, 40
187
	sub	ecx, edx
188
	shl	ecx, 15
189
	mov	cx, dx
2474 mario79 190
	mcall	13,,,0xffffff
191
 
894 barsuk 192
	xor	edx, edx
193
	add	ebx, 0x0000fffe 	; очень удобно :))))
194
	add	ecx, 0x0000fffe
2474 mario79 195
	mcall
894 barsuk 196
; текст
197
	shr	ecx, 16
198
	mov	bx, cx
199
	add	ebx, 0x00010001
200
	mov	ecx, 0x80ffffff
201
	mov	edx, [test_num]
202
	mov	edx, [test_info + edx*4]
2474 mario79 203
	mcall	4
204
 
894 barsuk 205
	add	ebx, 8
2474 mario79 206
	mcall	,,,press_space
207
 
894 barsuk 208
	add	ebx, 8
2474 mario79 209
	mcall	,,,press_i
210
 
894 barsuk 211
	add	ebx, 8
2474 mario79 212
	mcall	,,,press_c
213
;--------------------------------------
894 barsuk 214
no_info:
2474 mario79 215
	mcall	12,2
216
	ret
217
;------------------------------------------------------------------------------
894 barsuk 218
; <---- procedures for various tests of display ----->
219
; in: ebx = screen_width, ecx = screen_height
2474 mario79 220
;------------------------------------------------------------------------------
894 barsuk 221
lsz i_image_size, ru, "Image Size and Placement"
222
db	0
2474 mario79 223
;------------------------------------------------------------------------------
894 barsuk 224
t_image_size:
225
	mov	esi, ebx
226
	mov	edi, ecx
227
; 6 отрезков
228
	xor	ecx, ecx
2474 mario79 229
	mcall	38,,,0xffffff
230
 
894 barsuk 231
	mov	ecx, edi
232
	shl	ecx, 16
233
	xor	ebx, ebx
2474 mario79 234
	mcall
235
 
894 barsuk 236
	mov	ebx, esi
237
	shl	ebx, 16
238
	add	ecx, edi
2474 mario79 239
	mcall
240
 
894 barsuk 241
	sub	ecx, edi
242
	add	ebx, esi
2474 mario79 243
	mcall
894 barsuk 244
; рамка готова
245
	mov	ebx, esi
246
	shl	ebx, 16
247
	mov	ecx, edi
248
	shl	ecx, 15
249
	mov	cx, di
250
	shr	cx, 1
2474 mario79 251
	mcall
252
 
894 barsuk 253
	shr	ebx, 1
254
	mov	bx, si
255
	shr	bx, 1
256
	mov	ecx, edi
257
	shl	ecx, 16
2474 mario79 258
	mcall
894 barsuk 259
	ret
2474 mario79 260
;------------------------------------------------------------------------------
894 barsuk 261
lsz i_grid, ru, "Grid"
262
db	0
2474 mario79 263
;------------------------------------------------------------------------------
894 barsuk 264
t_grid:
265
;       сетка размером в 64 пиксела
266
	mov	eax, 38
267
	inc	ebx
268
	inc	ecx
269
	mov	esi, ebx
270
	mov	edi, ecx
271
	mov	edx, 0xffffff
272
	mov	ebp, 0x00400040
273
;       горизонтальные линии
274
	shl	ebx, 16
275
	xor	ecx, ecx
2474 mario79 276
;--------------------------------------
894 barsuk 277
grid_next_y:
2474 mario79 278
	mcall
279
 
894 barsuk 280
	add	ecx, ebp
281
	cmp	cx, di
282
	jnae	grid_next_y
283
	sub	ecx, 0x00010001
2474 mario79 284
	mcall
894 barsuk 285
;       вертикальные линии
286
	mov	ecx, edi
287
	shl	ecx, 16
288
	xor	ebx, ebx
2474 mario79 289
;--------------------------------------
894 barsuk 290
grid_next_x:
2474 mario79 291
	mcall
894 barsuk 292
	add	ebx, ebp
293
	cmp	bx, si
294
	jnae	grid_next_x
295
	sub	ebx, 0x00010001
2474 mario79 296
	mcall
894 barsuk 297
	ret
2474 mario79 298
;------------------------------------------------------------------------------
894 barsuk 299
lsz i_horstr, ru, "Horizontal Straightness"
300
db	0
2474 mario79 301
;------------------------------------------------------------------------------
894 barsuk 302
t_horstr:
303
	mov	eax, 38
304
	mov	edi, ecx
305
	mov	edx, 0xffffff
306
	mov	esi, ecx
307
	inc	esi
308
	shr	esi, 3
309
	mov	ebp, esi
310
	shl	ebp, 16
311
	mov	bp, si
312
;       горизонтальные линии
313
	shl	ebx, 16
314
	mov	ecx, ebp
315
	shr	ecx, 1
316
	mov	cx, bp
317
	shr	cx, 1
2474 mario79 318
;--------------------------------------
894 barsuk 319
hor_next_y:
2474 mario79 320
	mcall
894 barsuk 321
	add	ecx, ebp
322
	cmp	cx, di
323
	jnae	hor_next_y
324
	ret
2474 mario79 325
;------------------------------------------------------------------------------
894 barsuk 326
lsz i_vertstr, ru, "Vertical Straightness",0
327
db	0
2474 mario79 328
;------------------------------------------------------------------------------
894 barsuk 329
t_vertstr:
330
	mov	eax, 38
331
	mov	edx, 0xffffff
332
	mov	esi, ebx
333
	shl	ecx, 16
334
	mov	edi, esi
335
	shr	edi, 3
336
	mov	ebp, edi
337
	shl	ebp, 16
338
	mov	bp, di
339
	mov	ebx, ebp
340
	shr	ebx, 1
341
	mov	bx, bp
342
	shr	bx, 1
2474 mario79 343
;--------------------------------------
894 barsuk 344
vert_next_x:
2474 mario79 345
	mcall
894 barsuk 346
	add	ebx, ebp
347
	cmp	bx, si
348
	jnae	vert_next_x
349
	ret
2474 mario79 350
;------------------------------------------------------------------------------
894 barsuk 351
lsz i_distort, ru, "Distortion",0
352
db	0
2474 mario79 353
;------------------------------------------------------------------------------
894 barsuk 354
t_distort:
355
	mov	edx, 0xffffff
356
	mov	esi, ebx
357
	mov	edi, ecx
358
	mov	ebp, 3
359
	xor	ebx, ebx
2474 mario79 360
;--------------------------------------
894 barsuk 361
dist_next:
362
	push	ebp
363
	mov	ebp, ebx
364
	shl	ebx, 16
365
	or	ebx, ebp
366
 
367
	mov	ecx, edi
368
	shl	ecx, 16
369
	or	ecx, ebp
2474 mario79 370
	mcall	38
894 barsuk 371
 
372
	mov	ebx, esi
373
	shl	ebx, 16
374
	mov	bx, si
2474 mario79 375
	mcall
894 barsuk 376
 
377
	mov	bx, bp
378
	mov	ecx, ebp
379
	shl	ecx, 16
380
	or	ecx, ebp
2474 mario79 381
	mcall
894 barsuk 382
 
383
	mov	ecx, edi
384
	shl	ecx, 16
385
	mov	cx, di
2474 mario79 386
	mcall
894 barsuk 387
 
388
	mov	eax, 30
389
	sub	esi, eax
390
	sub	edi, eax
391
	mov	ebx, ebp
392
	add	ebx, eax
393
	pop	ebp
394
	dec	ebp
395
	jnz	dist_next
396
	ret
2474 mario79 397
;------------------------------------------------------------------------------
894 barsuk 398
lsz i_horres, ru, "Horizontal Resolution",0
399
db	0
2474 mario79 400
;------------------------------------------------------------------------------
894 barsuk 401
t_horres:
402
	mov	eax, 38
403
	mov	edx, 0xffffff
404
	mov	edi, ecx
405
	shl	ecx, 16
406
	mov	esi, ebx
407
	xor	ebx, ebx
408
	mov	edi, 0x003A003A
409
	mov	ebp, 0x00030003
2474 mario79 410
;--------------------------------------
894 barsuk 411
horres_next:
412
	add	ebx, edi
2474 mario79 413
	mcall
414
 
894 barsuk 415
	add	ebx, ebp
2474 mario79 416
	mcall
417
 
894 barsuk 418
	add	ebx, ebp
2474 mario79 419
	mcall
420
 
894 barsuk 421
	add	ebx, ebp
2474 mario79 422
	mcall
423
 
894 barsuk 424
	add	ebx, ebp
2474 mario79 425
	mcall
426
 
894 barsuk 427
	cmp	bx, si
428
	jna	horres_next
429
	ret
2474 mario79 430
;------------------------------------------------------------------------------
894 barsuk 431
lsz i_vertres, ru, "Vertical Resolution",0
432
db	0
2474 mario79 433
;------------------------------------------------------------------------------
894 barsuk 434
t_vertres:
435
	mov	eax, 38
436
	mov	edx, 0xffffff
437
;       mov     esi, ebx
438
	shl	ebx, 16
439
	mov	edi, ecx
440
	xor	ecx, ecx
441
	mov	ebp, 0x00030003
442
	mov	esi, 0x002A002A
2474 mario79 443
;--------------------------------------
894 barsuk 444
vertres_next:
445
	add	ecx, esi
2474 mario79 446
	mcall
447
 
894 barsuk 448
	add	ecx, ebp
2474 mario79 449
	mcall
450
 
894 barsuk 451
	add	ecx, ebp
2474 mario79 452
	mcall
453
 
894 barsuk 454
	add	ecx, ebp
2474 mario79 455
	mcall
456
 
894 barsuk 457
	add	ecx, ebp
2474 mario79 458
	mcall
459
 
894 barsuk 460
	add	ecx, 0x00540054
461
	cmp	cx, di
462
	jna	vertres_next
463
	ret
2474 mario79 464
;------------------------------------------------------------------------------
894 barsuk 465
lsz i_moire, ru, "Moire Patterns",0
466
db	0
2474 mario79 467
;------------------------------------------------------------------------------
894 barsuk 468
t_moire:
469
	mov	eax, 38
470
	mov	edx, 0xffffff
471
	mov	edi, ecx
472
	shl	ecx, 16
473
	mov	esi, ebx
474
	xor	ebx, ebx
475
	mov	ebp, 0x00030003
2474 mario79 476
;--------------------------------------
894 barsuk 477
moire_next:
2474 mario79 478
	mcall
894 barsuk 479
	add	ebx, ebp
480
	cmp	bx, si
481
	jna	moire_next
482
	ret
2474 mario79 483
;------------------------------------------------------------------------------
894 barsuk 484
lsz i_revsharp, ru, "Reverse Video Sharpness",0
485
db	0
2474 mario79 486
;------------------------------------------------------------------------------
894 barsuk 487
t_revsharp:
488
	mov	esi, ebx
489
	mov	edi, ecx
490
	shr	ecx, 1
2474 mario79 491
	mcall	13,,,0xffffff
894 barsuk 492
; а теперь - инверсные линии
493
	mov	eax, 38
494
	mov	ecx, edi
495
	mov	edx, 0x01000000
496
	xor	ebx, ebx
497
	mov	ebp, 0x00010001
498
	mov	edi, 0x003F003F
2474 mario79 499
;--------------------------------------
894 barsuk 500
revsharp_next:
501
	add	ebx, edi
2474 mario79 502
	mcall
503
 
894 barsuk 504
	add	ebx, ebp
2474 mario79 505
	mcall
506
 
894 barsuk 507
	add	ebx, ebp
2474 mario79 508
	mcall
509
 
894 barsuk 510
	add	ebx, edi
511
	sub	ebx, ebp
2474 mario79 512
	mcall
513
 
894 barsuk 514
	cmp	bx, si
515
	jna	revsharp_next
516
	ret
2474 mario79 517
;------------------------------------------------------------------------------
894 barsuk 518
lsz i_flicker, ru, "Flicker Severity",0
519
db	0
2474 mario79 520
;------------------------------------------------------------------------------
894 barsuk 521
t_flicker:
2474 mario79 522
	mcall	13,,,0xffffff
894 barsuk 523
	ret
2474 mario79 524
;------------------------------------------------------------------------------
894 barsuk 525
lsz i_glare, ru, "Glare Severity",0
526
db	0
2474 mario79 527
;------------------------------------------------------------------------------
894 barsuk 528
t_glare:		; оптимизировать нечего
529
	ret
2474 mario79 530
;------------------------------------------------------------------------------
894 barsuk 531
lsz i_interlace, ru, "Interlacing Detection",0
532
db	0
2474 mario79 533
;------------------------------------------------------------------------------
894 barsuk 534
t_interlace:
535
	mov	edi, ecx
536
	mov	eax, 38
537
	mov	edx, 0xffffff
538
	xor	ecx, ecx
539
	mov	ebp, 0x00020002
2474 mario79 540
;--------------------------------------
894 barsuk 541
interlace_next:
542
	add	ecx, ebp
2474 mario79 543
	mcall
894 barsuk 544
	cmp	cx, di
545
	jna	interlace_next
546
	ret
2474 mario79 547
;------------------------------------------------------------------------------
894 barsuk 548
lsz i_scrreg, ru, "Screen Regulation",0
549
db	0
2474 mario79 550
;------------------------------------------------------------------------------
894 barsuk 551
t_scrreg:
552
	add	ebx, 0x0018FFCD ; +25 к началу и -50 от длины
553
	shr	ecx, 1
554
	add	ecx, 0x0013FFEC ; +19 к началу и -19 от длины
2474 mario79 555
	mcall	13,,,0xffffff
894 barsuk 556
	ret
2474 mario79 557
;------------------------------------------------------------------------------
894 barsuk 558
lsz i_pricol, ru, "Primary Color Purity"
559
db	0
2474 mario79 560
;------------------------------------------------------------------------------
894 barsuk 561
t_pricol:
562
	mov	esi, ebx
563
	mov	edi, ecx
564
 
565
	shr	ebx, 4	; /16
566
	mov	ebp, ebx
567
	shl	ebx, 16
568
	mov	bx, bp
569
	shl	ebp, 16
570
	lea	ebp, [ebp + ebp * 4]		; ebp *= 5
571
 
572
	mov	ecx, 0x00280000
573
	mov	cx, di
574
	sub	cx, 80
575
	;shr     cx, 1
576
 
577
	shl	bx, 2
2474 mario79 578
	mcall	13,,,0xff0000
894 barsuk 579
 
580
	add	ebx, ebp
581
	shr	edx, 8
2474 mario79 582
	mcall
894 barsuk 583
 
584
	add	ebx, ebp
585
	shr	edx, 8
2474 mario79 586
	mcall
894 barsuk 587
	ret
2474 mario79 588
;------------------------------------------------------------------------------
894 barsuk 589
lsz i_colint, ru, "Color Intensity Gradient"
590
db	0
2474 mario79 591
;------------------------------------------------------------------------------
894 barsuk 592
t_colint:
593
 
594
	mov	esi, ebx
595
	mov	edi, ecx
596
 
597
;        mov     eax, ecx
598
;        shr     ecx, 2          ; end y coord
599
;        and     ecx, 0xffffff80         ; это not 7F
600
;        shr     eax, 7                  ; / 128
601
;        mov     ebp, eax
602
;        mov     edx, eax
603
;        lea     eax, [eax + eax * 2]    ; eax *= 5
604
;        shl     ebp, 4
605
;        add     eax, ebp
606
 
607
;        shl     eax, 16
608
;        add     ecx, eax
609
;        mov     edx, ebp
610
;        shl     ebp, 16
611
;        mov     bp, dx          ; йа больной
612
 
613
	; я не понял, что там делалось, и решил написать снова о_О
614
 
615
	; надо здесь сгенерить ecx (начальный сдвиг) и ebp (шаг по у)
616
 
617
	mov	eax, edi
618
	lea	eax, [eax + 2 * eax]
619
	shr	eax, 5			; eax = 3/32 высоты
620
	mov	ebp, eax
621
	shl	ebp, 16
622
	mov	bp, ax			; ebp = ax в обоих словах
623
 
624
	mov	ebx, eax		; сохраним это значение
625
 
626
	mov	eax, edi
627
	inc	eax
628
	shr	eax, 4		; 3/16 высоты - начальное значение
629
				; всего полосы займут 3/4 высоты, итого по 3/32 высоты на полосу (для ровного счета)
630
	lea	eax, [eax + eax * 2]
631
	mov	ecx, eax
632
	shl	ecx, 16
633
	shr	ebx, 2
634
	lea	ebx, [ebx + ebx * 2]	; ebx = 3/4 ebx, т.е. 3/4 высоты полосы
635
	add	eax, ebx
636
	mov	cx, ax
637
 
638
	xor	edx, edx
639
	mov	eax, 0xffff
640
	div	esi
641
	mov	edi, eax	; edi = 64K/width
642
 
643
	mov	dword [color_index], 0
644
	jmp	colint_next
2474 mario79 645
;------------------------------------------------------------------------------
894 barsuk 646
color_table	dd	0x00ff0000, 0x0000ff00, 0x00ffff00, \
647
			0x000000ff, 0x00ff00ff, 0x0000ffff, 0x00ffffff
648
color_index	dd	0
2474 mario79 649
;------------------------------------------------------------------------------
894 barsuk 650
colint_next:
651
	xor	edx, edx
652
	xor	ebx, ebx
653
	mov	eax, 38
2474 mario79 654
;--------------------------------------
894 barsuk 655
colint_next_line:
656
	push	edx
657
	push	eax
658
	movzx	eax, dh
659
	shl	eax, 16
660
	mov	dl, dh
661
	or	edx, eax
662
	mov	eax, [color_index]
663
	mov	eax, [color_table + eax * 4]
664
	and	edx, eax
665
	pop	eax
2474 mario79 666
	mcall
894 barsuk 667
	pop	edx
668
	add	ebx, 0x00010001
669
	add	edx, edi
670
	cmp	bx, si
671
	jna	colint_next_line
672
 
673
	add	ecx, ebp
674
	inc	dword [color_index]
675
	cmp	dword [color_index], 7
676
	jb	colint_next
677
	ret
2474 mario79 678
;------------------------------------------------------------------------------
894 barsuk 679
lsz i_colalign, ru, "Color Alignment Grid"
680
db	0
2474 mario79 681
;------------------------------------------------------------------------------
894 barsuk 682
t_colalign:
683
; красная сетка
684
	inc	ebx		; так нужно
685
	inc	ecx
686
	mov	esi, ebx
687
	mov	edi, ecx
688
	mov	edx, 0xff0000
689
;       горизонтальные линии
690
	shl	ebx, 16
691
	xor	ecx, ecx
692
	push	edi
693
	shr	edi, 3
694
	mov	ebp, edi
695
	shl	ebp, 16
696
	mov	bp, di
697
	pop	edi
698
	mov	[yshift], ebp
699
	mov	eax, 38
2474 mario79 700
;--------------------------------------
894 barsuk 701
cgrid_next_y:
2474 mario79 702
	mcall
894 barsuk 703
	add	ecx, ebp
704
	cmp	cx, di
705
	jnae	cgrid_next_y
706
	; последняя линия:
707
	sub	ecx, 0x00010001
2474 mario79 708
	mcall
894 barsuk 709
 
710
;       вертикальные линии
711
	mov	ecx, edi
712
	shl	ecx, 16
713
	xor	ebx, ebx
714
	push	esi
715
	shr	esi, 3
716
	mov	ebp, esi
717
	shl	ebp, 16
718
	mov	bp, si
719
	mov	[xshift], ebp
720
	pop	esi
721
	mov	eax, 38
2474 mario79 722
;--------------------------------------
894 barsuk 723
cgrid_next_x:
2474 mario79 724
	mcall
894 barsuk 725
	add	ebx, ebp
726
	cmp	bx, si
727
	jnae	cgrid_next_x
728
	; последняя линия
729
	sub	ebx, 0x00010001
2474 mario79 730
	mcall
894 barsuk 731
	jmp	cgrid_green
2474 mario79 732
;------------------------------------------------------------------------------
894 barsuk 733
	xshift	dd	0
734
	yshift	dd	0
735
	shift	dd	0
2474 mario79 736
;------------------------------------------------------------------------------
894 barsuk 737
cgrid_green:
738
; зеленые линии: горизонтальные
739
	mov	edx, esi
740
	shr	edx, 5
741
	lea	eax, [edx + edx * 2]
742
	shl	edx, 16
743
	or	edx, eax
744
	mov	[shift], edx
745
	mov	eax, 38
746
	mov	edx, 0x00ff00
747
	xor	ecx, ecx
748
	mov	ebp, [xshift]
2474 mario79 749
;--------------------------------------
894 barsuk 750
ggrid_next_yy:
751
	mov	ebx, [shift]
2474 mario79 752
;--------------------------------------
894 barsuk 753
ggrid_next_yx:
2474 mario79 754
	mcall
894 barsuk 755
	add	ebx, ebp
756
	cmp	bx, si
757
	jnae	ggrid_next_yx
758
	sub	ebx, 0x00010001
2474 mario79 759
	mcall
894 barsuk 760
 
761
	add	ecx, [yshift]
762
	cmp	cx, di
763
	jnae	ggrid_next_yy
764
	; last row of lines
765
	mov	ebx, [shift]
766
	dec	ecx
2474 mario79 767
;--------------------------------------
894 barsuk 768
ggrid_last_yx:
2474 mario79 769
	mcall
894 barsuk 770
	add	ebx, ebp
771
	cmp	bx, si
772
	jnae	ggrid_last_yx
773
 
774
; и вертикальные
775
	mov	edx, edi
776
	shr	edx, 5
777
	lea	eax, [edx + edx * 2]
778
	shl	edx, 16
779
	or	edx, eax
780
	mov	[shift], edx
781
 
782
	mov	eax, 38
783
	mov	edx, 0x00ff00
784
	mov	ecx, [shift]
785
	mov	ebp, [xshift]
2474 mario79 786
;--------------------------------------
894 barsuk 787
ggrid_next_xy:
788
	xor	ebx, ebx
2474 mario79 789
;--------------------------------------
894 barsuk 790
ggrid_next_xx:
2474 mario79 791
	mcall
792
 
894 barsuk 793
	add	ebx, ebp
794
	cmp	bx, si
795
	jnae	ggrid_next_xx
796
	sub	ebx, 0x00010001
2474 mario79 797
	mcall
894 barsuk 798
 
799
	add	ecx, [yshift]
800
	cmp	cx, di
801
	jnae	ggrid_next_xy
802
	xor	ebx, ebx
803
	dec	ecx
2474 mario79 804
;--------------------------------------
894 barsuk 805
ggrid_last_xy:
806
	;int     0x40
807
	;add     ebx, ebp
808
	;cmp     bx, si
809
	;jnae    ggrid_last_xy
810
	ret
2474 mario79 811
;------------------------------------------------------------------------------
894 barsuk 812
lsz i_colsyn, ru, "Color Synchronization"
813
db	0
2474 mario79 814
;------------------------------------------------------------------------------
894 barsuk 815
t_colsyn:
816
	inc	ebx
817
	inc	ecx
818
	mov	esi, ebx
819
	mov	edi, ecx
820
 
821
	shr	ebx, 5
822
	mov	eax, ebx
823
	lea	ebx, [ebx + ebx * 4]
824
	shl	ebx, 1			; 10/32
825
	mov	ebp, ebx
826
	shl	eax, 16
827
	or	ebx, eax
828
	shl	ebp, 16
829
 
830
	mov	edi, 0x0000ffff
831
	add	ecx, 0x003FFF7F
832
	mov	edx, edi
2474 mario79 833
	mcall	13
894 barsuk 834
 
835
	mov	edx, 0x00ff0000
836
	add	ebx, ebp
2474 mario79 837
	mcall
894 barsuk 838
 
839
	mov	edx, edi
840
	add	ebx, ebp
2474 mario79 841
	mcall
894 barsuk 842
	ret
2474 mario79 843
;------------------------------------------------------------------------------
894 barsuk 844
; <--- initialised data --->
845
DATA
846
	screenx 	dd	0
847
	screeny 	dd	0
848
 
849
	test_num	dd	0
850
	test_done	dd	0
851
	show_info	dd	1
852
	test_proc	dd	t_image_size, t_grid, t_horstr, t_vertstr,\
853
		t_distort, t_horres, t_vertres, t_moire, t_revsharp, \
854
		t_flicker, t_glare, t_interlace, t_scrreg, t_pricol, \
855
		t_colint, t_colalign, t_colsyn, 0
856
	test_info	dd	i_image_size, i_grid, i_horstr, i_vertstr, \
857
		i_distort, i_horres, i_vertres, i_moire, i_revsharp, \
858
		i_flicker, i_glare, i_interlace, i_scrreg, i_pricol, \
859
		i_colint, i_colalign, i_colsyn, 0
860
 
861
	lsz press_space, ru, "Нажмите пробел для продолжения,"
862
	db	0
863
	lsz press_i, ru, "I для переключения сведений,"
864
	db	0
865
	lsz press_c, ru, "и C для переключения курсора"
866
	db	0
867
	lsz header, ru, "Тест монитора"
868
	lsz test_finish, ru, "Конец теста. Нажмите ESC."
869
 
870
	cursor  dd 32*32 dup(0x00000000)	; все равно сожмется
871
 
872
	cursorVisible	dd	1
873
	cursorID	dd	0
2474 mario79 874
;------------------------------------------------------------------------------
894 barsuk 875
; <--- uninitialised data --->
876
UDATA
2474 mario79 877
;------------------------------------------------------------------------------
894 barsuk 878
MEOS_APP_END
1741 dunkaist 879
; <--- end of MenuetOS application --->
2474 mario79 880
;------------------------------------------------------------------------------