Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2474 → Rev 2473

/programs/system/disptest/trunk/disptest.ASM
1,16 → 1,10
;------------------------------------------------------------------------------
; Display Test for KolibriOS
;------------------------------------------------------------------------------
; version: 0.41
; last update: 17/03/2012
; written by: Marat Zakiyanov aka Mario79, aka Mario
; changes: some optimisations and code refactoring
;------------------------------------------------------------------------------
; <--- description --->
; compiler: FASM 1.50
; name: Display Test
; version: 0.4
; original author: barsuk
; author: barsuk
 
 
; <--- include all MeOS stuff --->
include "lang.inc"
include "../../../macros.inc"
23,17 → 17,21
 
; <--- start of code --->
CODE
mcall 37,4,cursor,2
mov eax, 37
mov ebx, 4
mov edx, 2
mov ecx, cursor
int 0x40
or eax, eax
jz exit
mov [cursorID], eax
;------------------------------------------------------------------------------
redraw:
 
call draw_window ; at first create and draw the window
;------------------------------------------------------------------------------
 
wait_event: ; main cycle
xor ebx, ebx
mcall 10
mov eax, 10
int 0x40
 
cmp eax, 1 ; if event == 1
je redraw ; jump to redraw handler
43,9 → 41,16
je button ; jump to button handler
 
jmp wait_event ; else return to the start of main cycle
;------------------------------------------------------------------------------
 
 
redraw: ; redraw event handler
call draw_window
jmp wait_event
 
 
key: ; key event handler
mcall 2 ; get key code
mov eax, 2 ; get key code
int 0x40
 
cmp ah, 27
jz exit
78,7 → 83,7
jz redraw
 
jmp wait_event
;------------------------------------------------------------------------------
 
next_test:
cmp dword [test_done], 1
jz wait_event
86,7 → 91,7
inc dword [test_num]
call draw_window
jmp wait_event
;------------------------------------------------------------------------------
 
prev_test:
cmp dword [test_num], ebx
jz wait_event
95,12 → 100,13
mov dword [test_done], ebx
call draw_window
jmp wait_event
;------------------------------------------------------------------------------
 
 
toggle_info:
xor dword [show_info], 1
call draw_window
jmp wait_event
;------------------------------------------------------------------------------
 
toggle_cursor:
mov eax, cursorVisible
cmp dword [eax], 0
109,27 → 115,34
mov dword [eax], 0
mov ecx, [cursorID]
jmp .set
;--------------------------------------
.no_cursor:
mov dword [eax], 1
xor ecx, ecx
;--------------------------------------
.set:
mcall 37,5
mcall 18,15 ; çâ®¡ë ®¡­®¢¨«áï
mov eax, 37
mov ebx, 5
int 0x40
mov eax, 18
mov ebx, 15
int 0x40 ; çâ®¡ë ®¡­®¢¨«áï
jmp wait_event
;------------------------------------------------------------------------------
 
button: ; button event handler
mcall 17 ; get button identifier
mov eax, 17 ; get button identifier
int 0x40
 
cmp ah, 1
jne wait_event ; return if button id != 1
;--------------------------------------
 
exit:
or eax, -1 ; exit application
mcall
;------------------------------------------------------------------------------
int 0x40
 
 
draw_window:
mcall 12,1
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
 
; ªãàá®à
;mov eax, 37
137,8 → 150,8
;mov ecx, cursorID
;int 0x40
 
mcall 14 ; screen size
 
mov eax, 14 ; screen size
int 0x40
mov ebx, eax
shr ebx, 16
mov ecx, eax
148,14 → 161,16
 
inc ebx
inc ecx
xor eax, eax ; create and draw the window
mov eax, 0 ; create and draw the window
mov edx, 0x01000000
mov esi, edx
mcall
int 0x40
 
; áâ¥à¥âì £à ­¨æë ®ª­ 
 
mov eax, 13 ; £àã¡® â ª
xor edx, edx
mcall 13 ; £àã¡® â ª
 
int 0x40
dec ebx
dec ecx
 
165,21 → 180,30
jz end_of_test
call eax
jmp exit_draw
;--------------------------------------
end_of_test:
mcall 4,<8,8>,0xffffff,test_finish,test_finish.size
mov eax, 4
mov ebx, 8 * 65536 + 8
mov ecx, 0xffffff
mov edx, test_finish
mov esi, test_finish.size
int 0x40
mov dword [test_done], 1
jmp no_info
;--------------------------------------
 
exit_draw:
 
cmp dword [show_info], 1
jnz no_info
 
; á­®¢  à §¬¥àë íªà ­ 
mov ebx, [screenx]
mov ecx, [screeny]
 
; ᣥ­¥à¨âì áâà®çªã á à §à¥è¥­¨¥¬ íªà ­ . … ­ã¦­®, ¯®â®¬ã çâ® ¯¯æ
 
; ¯àאַ㣮«ì­¨ª 200å40 á ¨­ä®©
mov edx, 200
mov eax, 13
sub ebx, edx
shl ebx, 15
mov bx, dx
187,13 → 211,16
sub ecx, edx
shl ecx, 15
mov cx, dx
mcall 13,,,0xffffff
 
mov edx, 0xffffff
int 0x40
xor edx, edx
add ebx, 0x0000fffe ; ®ç¥­ì 㤮¡­® :))))
add ecx, 0x0000fffe
mcall
int 0x40
 
 
; ⥪áâ
mov eax, 4
shr ecx, 16
mov bx, cx
add ebx, 0x00010001
200,47 → 227,48
mov ecx, 0x80ffffff
mov edx, [test_num]
mov edx, [test_info + edx*4]
mcall 4
 
int 0x40
add ebx, 8
mcall ,,,press_space
 
mov edx, press_space
int 0x40
add ebx, 8
mcall ,,,press_i
mov edx, press_i
int 0x40
add ebx, 8
mov edx, press_c
int 0x40
 
add ebx, 8
mcall ,,,press_c
;--------------------------------------
no_info:
mcall 12,2
mov eax, 12 ; finish drawing
mov ebx, 2
int 0x40
 
ret
;------------------------------------------------------------------------------
 
; <---- procedures for various tests of display ----->
; in: ebx = screen_width, ecx = screen_height
;------------------------------------------------------------------------------
 
lsz i_image_size, ru, "Image Size and Placement"
db 0
;------------------------------------------------------------------------------
t_image_size:
mov eax, 38
mov esi, ebx
mov edi, ecx
mov edx, 0xffffff
; 6 ®â१ª®¢
xor ecx, ecx
mcall 38,,,0xffffff
 
int 0x40
mov ecx, edi
shl ecx, 16
xor ebx, ebx
mcall
 
int 0x40
mov ebx, esi
shl ebx, 16
add ecx, edi
mcall
int 0x40
sub ecx, edi
add ebx, esi
mcall
int 0x40
; à ¬ª  £®â®¢ 
mov ebx, esi
shl ebx, 16
248,19 → 276,18
shl ecx, 15
mov cx, di
shr cx, 1
mcall
 
int 0x40
shr ebx, 1
mov bx, si
shr bx, 1
mov ecx, edi
shl ecx, 16
mcall
int 0x40
 
ret
;------------------------------------------------------------------------------
 
lsz i_grid, ru, "Grid"
db 0
;------------------------------------------------------------------------------
t_grid:
; á¥âª  à §¬¥à®¬ ¢ 64 ¯¨ªá¥« 
mov eax, 38
273,32 → 300,29
; £®à¨§®­â «ì­ë¥ «¨­¨¨
shl ebx, 16
xor ecx, ecx
;--------------------------------------
grid_next_y:
mcall
 
int 0x40
add ecx, ebp
cmp cx, di
jnae grid_next_y
sub ecx, 0x00010001
mcall
int 0x40
; ¢¥à⨪ «ì­ë¥ «¨­¨¨
mov ecx, edi
shl ecx, 16
xor ebx, ebx
;--------------------------------------
grid_next_x:
mcall
int 0x40
add ebx, ebp
cmp bx, si
jnae grid_next_x
sub ebx, 0x00010001
mcall
int 0x40
 
ret
;------------------------------------------------------------------------------
 
lsz i_horstr, ru, "Horizontal Straightness"
db 0
;------------------------------------------------------------------------------
t_horstr:
mov eax, 38
mov edi, ecx
315,17 → 339,14
shr ecx, 1
mov cx, bp
shr cx, 1
;--------------------------------------
hor_next_y:
mcall
int 0x40
add ecx, ebp
cmp cx, di
jnae hor_next_y
ret
;------------------------------------------------------------------------------
lsz i_vertstr, ru, "Vertical Straightness",0
db 0
;------------------------------------------------------------------------------
t_vertstr:
mov eax, 38
mov edx, 0xffffff
340,25 → 361,25
shr ebx, 1
mov bx, bp
shr bx, 1
;--------------------------------------
vert_next_x:
mcall
int 0x40
add ebx, ebp
cmp bx, si
jnae vert_next_x
 
ret
;------------------------------------------------------------------------------
 
lsz i_distort, ru, "Distortion",0
db 0
;------------------------------------------------------------------------------
t_distort:
mov edx, 0xffffff
mov esi, ebx
mov edi, ecx
mov ebp, 3
 
xor ebx, ebx
;--------------------------------------
dist_next:
mov eax, 38
push ebp
mov ebp, ebx
shl ebx, 16
367,23 → 388,23
mov ecx, edi
shl ecx, 16
or ecx, ebp
mcall 38
int 0x40
 
mov ebx, esi
shl ebx, 16
mov bx, si
mcall
int 0x40
 
mov bx, bp
mov ecx, ebp
shl ecx, 16
or ecx, ebp
mcall
int 0x40
 
mov ecx, edi
shl ecx, 16
mov cx, di
mcall
int 0x40
 
mov eax, 30
sub esi, eax
393,11 → 414,11
pop ebp
dec ebp
jnz dist_next
 
ret
;------------------------------------------------------------------------------
 
lsz i_horres, ru, "Horizontal Resolution",0
db 0
;------------------------------------------------------------------------------
t_horres:
mov eax, 38
mov edx, 0xffffff
407,30 → 428,25
xor ebx, ebx
mov edi, 0x003A003A
mov ebp, 0x00030003
;--------------------------------------
 
horres_next:
add ebx, edi
mcall
 
int 0x40
add ebx, ebp
mcall
 
int 0x40
add ebx, ebp
mcall
 
int 0x40
add ebx, ebp
mcall
 
int 0x40
add ebx, ebp
mcall
 
int 0x40
cmp bx, si
jna horres_next
 
ret
;------------------------------------------------------------------------------
 
lsz i_vertres, ru, "Vertical Resolution",0
db 0
;------------------------------------------------------------------------------
t_vertres:
mov eax, 38
mov edx, 0xffffff
440,31 → 456,26
xor ecx, ecx
mov ebp, 0x00030003
mov esi, 0x002A002A
;--------------------------------------
 
vertres_next:
add ecx, esi
mcall
 
int 0x40
add ecx, ebp
mcall
 
int 0x40
add ecx, ebp
mcall
 
int 0x40
add ecx, ebp
mcall
 
int 0x40
add ecx, ebp
mcall
 
int 0x40
add ecx, 0x00540054
cmp cx, di
jna vertres_next
 
ret
;------------------------------------------------------------------------------
 
lsz i_moire, ru, "Moire Patterns",0
db 0
;------------------------------------------------------------------------------
t_moire:
mov eax, 38
mov edx, 0xffffff
473,22 → 484,23
mov esi, ebx
xor ebx, ebx
mov ebp, 0x00030003
;--------------------------------------
moire_next:
mcall
int 0x40
add ebx, ebp
cmp bx, si
jna moire_next
 
ret
;------------------------------------------------------------------------------
 
lsz i_revsharp, ru, "Reverse Video Sharpness",0
db 0
;------------------------------------------------------------------------------
t_revsharp:
mov esi, ebx
mov edi, ecx
shr ecx, 1
mcall 13,,,0xffffff
mov eax, 13
mov edx, 0xffffff
int 0x40
;   ⥯¥àì - ¨­¢¥àá­ë¥ «¨­¨¨
mov eax, 38
mov ecx, edi
496,41 → 508,36
xor ebx, ebx
mov ebp, 0x00010001
mov edi, 0x003F003F
;--------------------------------------
revsharp_next:
add ebx, edi
mcall
 
int 0x40
add ebx, ebp
mcall
 
int 0x40
add ebx, ebp
mcall
 
int 0x40
add ebx, edi
sub ebx, ebp
mcall
 
int 0x40
cmp bx, si
jna revsharp_next
 
ret
;------------------------------------------------------------------------------
 
lsz i_flicker, ru, "Flicker Severity",0
db 0
;------------------------------------------------------------------------------
t_flicker:
mcall 13,,,0xffffff
mov eax, 13
mov edx, 0xffffff
int 0x40
ret
;------------------------------------------------------------------------------
 
lsz i_glare, ru, "Glare Severity",0
db 0
;------------------------------------------------------------------------------
t_glare: ; ®¯â¨¬¨§¨à®¢ âì ­¥ç¥£®
ret
;------------------------------------------------------------------------------
 
lsz i_interlace, ru, "Interlacing Detection",0
db 0
;------------------------------------------------------------------------------
t_interlace:
mov edi, ecx
mov eax, 38
537,30 → 544,32
mov edx, 0xffffff
xor ecx, ecx
mov ebp, 0x00020002
;--------------------------------------
interlace_next:
add ecx, ebp
mcall
int 0x40
cmp cx, di
jna interlace_next
 
ret
;------------------------------------------------------------------------------
 
lsz i_scrreg, ru, "Screen Regulation",0
db 0
;------------------------------------------------------------------------------
t_scrreg:
mov eax, 13
mov edx, 0xffffff
add ebx, 0x0018FFCD ; +25 ª ­ ç «ã ¨ -50 ®â ¤«¨­ë
shr ecx, 1
add ecx, 0x0013FFEC ; +19 ª ­ ç «ã ¨ -19 ®â ¤«¨­ë
mcall 13,,,0xffffff
int 0x40
ret
;------------------------------------------------------------------------------
 
lsz i_pricol, ru, "Primary Color Purity"
db 0
;------------------------------------------------------------------------------
t_pricol:
 
mov esi, ebx
mov edi, ecx
mov eax, 13
 
shr ebx, 4 ; /16
mov ebp, ebx
575,20 → 584,21
;shr cx, 1
 
shl bx, 2
mcall 13,,,0xff0000
mov edx, 0xff0000
int 0x40
 
add ebx, ebp
shr edx, 8
mcall
int 0x40
 
add ebx, ebp
shr edx, 8
mcall
int 0x40
 
ret
;------------------------------------------------------------------------------
 
lsz i_colint, ru, "Color Intensity Gradient"
db 0
;------------------------------------------------------------------------------
t_colint:
 
mov esi, ebx
642,16 → 652,15
 
mov dword [color_index], 0
jmp colint_next
;------------------------------------------------------------------------------
 
color_table dd 0x00ff0000, 0x0000ff00, 0x00ffff00, \
0x000000ff, 0x00ff00ff, 0x0000ffff, 0x00ffffff
color_index dd 0
;------------------------------------------------------------------------------
 
colint_next:
xor edx, edx
xor ebx, ebx
mov eax, 38
;--------------------------------------
colint_next_line:
push edx
push eax
663,7 → 672,7
mov eax, [color_table + eax * 4]
and edx, eax
pop eax
mcall
int 0x40
pop edx
add ebx, 0x00010001
add edx, edi
674,12 → 683,13
inc dword [color_index]
cmp dword [color_index], 7
jb colint_next
 
ret
;------------------------------------------------------------------------------
 
lsz i_colalign, ru, "Color Alignment Grid"
db 0
;------------------------------------------------------------------------------
t_colalign:
 
; ªà á­ ï á¥âª 
inc ebx ; â ª ­ã¦­®
inc ecx
697,15 → 707,14
pop edi
mov [yshift], ebp
mov eax, 38
;--------------------------------------
cgrid_next_y:
mcall
int 0x40
add ecx, ebp
cmp cx, di
jnae cgrid_next_y
; ¯®á«¥¤­ïï «¨­¨ï:
sub ecx, 0x00010001
mcall
int 0x40
 
; ¢¥à⨪ «ì­ë¥ «¨­¨¨
mov ecx, edi
719,21 → 728,19
mov [xshift], ebp
pop esi
mov eax, 38
;--------------------------------------
cgrid_next_x:
mcall
int 0x40
add ebx, ebp
cmp bx, si
jnae cgrid_next_x
; ¯®á«¥¤­ïï «¨­¨ï
sub ebx, 0x00010001
mcall
int 0x40
jmp cgrid_green
;------------------------------------------------------------------------------
 
xshift dd 0
yshift dd 0
shift dd 0
;------------------------------------------------------------------------------
cgrid_green:
; §¥«¥­ë¥ «¨­¨¨: £®à¨§®­â «ì­ë¥
mov edx, esi
746,17 → 753,15
mov edx, 0x00ff00
xor ecx, ecx
mov ebp, [xshift]
;--------------------------------------
ggrid_next_yy:
mov ebx, [shift]
;--------------------------------------
ggrid_next_yx:
mcall
int 0x40
add ebx, ebp
cmp bx, si
jnae ggrid_next_yx
sub ebx, 0x00010001
mcall
int 0x40
 
add ecx, [yshift]
cmp cx, di
764,9 → 769,8
; last row of lines
mov ebx, [shift]
dec ecx
;--------------------------------------
ggrid_last_yx:
mcall
int 0x40
add ebx, ebp
cmp bx, si
jnae ggrid_last_yx
783,18 → 787,15
mov edx, 0x00ff00
mov ecx, [shift]
mov ebp, [xshift]
;--------------------------------------
ggrid_next_xy:
xor ebx, ebx
;--------------------------------------
ggrid_next_xx:
mcall
 
int 0x40
add ebx, ebp
cmp bx, si
jnae ggrid_next_xx
sub ebx, 0x00010001
mcall
int 0x40
 
add ecx, [yshift]
cmp cx, di
801,18 → 802,20
jnae ggrid_next_xy
xor ebx, ebx
dec ecx
;--------------------------------------
ggrid_last_xy:
;int 0x40
;add ebx, ebp
;cmp bx, si
;jnae ggrid_last_xy
 
 
 
ret
;------------------------------------------------------------------------------
 
lsz i_colsyn, ru, "Color Synchronization"
db 0
;------------------------------------------------------------------------------
t_colsyn:
 
inc ebx
inc ecx
mov esi, ebx
830,19 → 833,22
mov edi, 0x0000ffff
add ecx, 0x003FFF7F
mov edx, edi
mcall 13
mov eax, 13
int 0x40
 
mov edx, 0x00ff0000
add ebx, ebp
mcall
int 0x40
 
mov edx, edi
add ebx, ebp
mcall
int 0x40
 
ret
;------------------------------------------------------------------------------
 
; <--- initialised data --->
DATA
 
screenx dd 0
screeny dd 0
 
871,10 → 877,11
 
cursorVisible dd 1
cursorID dd 0
;------------------------------------------------------------------------------
 
 
; <--- uninitialised data --->
UDATA
;------------------------------------------------------------------------------
 
 
MEOS_APP_END
; <--- end of MenuetOS application --->
;------------------------------------------------------------------------------