Subversion Repositories Kolibri OS

Rev

Rev 2474 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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
  13.  
  14. ; <--- include all MeOS stuff --->
  15. include "lang.inc"
  16. include "../../../macros.inc"
  17.  
  18. ; <--- start of MenuetOS application --->
  19. MEOS_APP_START
  20.  
  21. ;include "..\..\..\debug.inc"
  22.  
  23.  
  24. ; <--- start of code --->
  25. CODE
  26.         mcall   37,4,cursor,2
  27.         or      eax, eax
  28.         jz      exit
  29.         mov     [cursorID], eax
  30. ;------------------------------------------------------------------------------
  31. redraw:
  32.         call    draw_window               ; at first create and draw the window
  33. ;------------------------------------------------------------------------------
  34. wait_event:                               ; main cycle
  35.         xor     ebx, ebx
  36.         mcall   10
  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
  46. ;------------------------------------------------------------------------------
  47. key:                                            ; key event handler
  48.         mcall   2                         ;   get key code
  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
  81. ;------------------------------------------------------------------------------
  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
  89. ;------------------------------------------------------------------------------
  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
  98. ;------------------------------------------------------------------------------
  99. toggle_info:
  100.         xor     dword [show_info], 1
  101.         call    draw_window
  102.         jmp     wait_event
  103. ;------------------------------------------------------------------------------
  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
  112. ;--------------------------------------
  113. .no_cursor:
  114.         mov     dword [eax], 1
  115.         xor     ecx, ecx
  116. ;--------------------------------------
  117. .set:
  118.         mcall   37,5
  119.         mcall   18,15                   ; çâ®¡ë ®¡­®¢¨«áï
  120.         jmp     wait_event
  121. ;------------------------------------------------------------------------------
  122. button:                                  ; button event handler
  123.         mcall   17               ;   get button identifier
  124.         cmp     ah, 1
  125.         jne     wait_event                 ;   return if button id != 1
  126. ;--------------------------------------
  127. exit:
  128.         or       eax, -1                         ;   exit application
  129.         mcall
  130. ;------------------------------------------------------------------------------
  131. draw_window:
  132.         mcall   12,1
  133.  
  134.         ; ªãàá®à
  135.         ;mov     eax, 37
  136.         ;mov     ebx, 5
  137.         ;mov     ecx, cursorID
  138.         ;int     0x40
  139.  
  140.         mcall   14              ; screen size
  141.  
  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
  151.         xor     eax, eax                          ; create and draw the window
  152.         mov     edx, 0x01000000
  153.         mov     esi, edx
  154.         mcall
  155.         ; áâ¥à¥âì £à ­¨æë ®ª­ 
  156.         xor     edx, edx
  157.         mcall   13              ; £àã¡® â ª
  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
  168. ;--------------------------------------
  169. end_of_test:
  170.         mcall   4,<8,8>,0xffffff,test_finish,test_finish.size
  171.         mov     dword [test_done], 1
  172.         jmp     no_info
  173. ;--------------------------------------
  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
  190.         mcall   13,,,0xffffff
  191.  
  192.         xor     edx, edx
  193.         add     ebx, 0x0000fffe         ; ®ç¥­ì 㤮¡­® :))))
  194.         add     ecx, 0x0000fffe
  195.         mcall
  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]
  203.         mcall   4
  204.  
  205.         add     ebx, 12
  206.         mcall   ,,,press_space
  207.  
  208.         add     ebx, 8
  209.         mcall   ,,,press_i
  210.  
  211.         add     ebx, 8
  212.         mcall   ,,,press_c
  213. ;--------------------------------------
  214. no_info:
  215.         mcall   12,2
  216.         ret
  217. ;------------------------------------------------------------------------------
  218. ; <---- procedures for various tests of display ----->
  219. ; in: ebx = screen_width, ecx = screen_height
  220. ;------------------------------------------------------------------------------
  221. lsz i_image_size,\
  222.   ru, " §¬¥à ¨§®¡à ¦¥­¨ï ¨ à §¬¥é¥­¨¥",\
  223.   en, "Image Size and Placement"
  224. db      0
  225. ;------------------------------------------------------------------------------
  226. t_image_size:
  227.         mov     esi, ebx
  228.         mov     edi, ecx
  229. ; 6 ®â१ª®¢
  230.         xor     ecx, ecx
  231.         mcall   38,,,0xffffff
  232.  
  233.         mov     ecx, edi
  234.         shl     ecx, 16
  235.         xor     ebx, ebx
  236.         mcall
  237.  
  238.         mov     ebx, esi
  239.         shl     ebx, 16
  240.         add     ecx, edi
  241.         mcall
  242.        
  243.         sub     ecx, edi
  244.         add     ebx, esi
  245.         mcall
  246. ; à ¬ª  £®â®¢ 
  247.         mov     ebx, esi
  248.         shl     ebx, 16
  249.         mov     ecx, edi
  250.         shl     ecx, 15
  251.         mov     cx, di
  252.         shr     cx, 1
  253.         mcall
  254.  
  255.         shr     ebx, 1
  256.         mov     bx, si
  257.         shr     bx, 1
  258.         mov     ecx, edi
  259.         shl     ecx, 16
  260.         mcall
  261.         ret
  262. ;------------------------------------------------------------------------------
  263. lsz i_grid,\
  264.   ru, "‘¥âª ",\
  265.   en, "Grid"
  266. db      0
  267. ;------------------------------------------------------------------------------
  268. t_grid:
  269. ;       á¥âª  à §¬¥à®¬ ¢ 64 ¯¨ªá¥« 
  270.         mov     eax, 38
  271.         inc     ebx
  272.         inc     ecx
  273.         mov     esi, ebx
  274.         mov     edi, ecx
  275.         mov     edx, 0xffffff
  276.         mov     ebp, 0x00400040
  277. ;       £®à¨§®­â «ì­ë¥ «¨­¨¨
  278.         shl     ebx, 16
  279.         xor     ecx, ecx
  280. ;--------------------------------------
  281. grid_next_y:
  282.         mcall
  283.  
  284.         add     ecx, ebp
  285.         cmp     cx, di
  286.         jnae    grid_next_y
  287.         sub     ecx, 0x00010001
  288.         mcall
  289. ;       ¢¥à⨪ «ì­ë¥ «¨­¨¨
  290.         mov     ecx, edi
  291.         shl     ecx, 16
  292.         xor     ebx, ebx
  293. ;--------------------------------------
  294. grid_next_x:
  295.         mcall
  296.         add     ebx, ebp
  297.         cmp     bx, si
  298.         jnae    grid_next_x
  299.         sub     ebx, 0x00010001
  300.         mcall
  301.         ret
  302. ;------------------------------------------------------------------------------
  303. lsz i_horstr,\
  304.   ru, "ƒ®à¨§®­â «ì­ë¥ ¯àï¬ë¥ «¨­¨¨",\
  305.   en, "Horizontal Straightness"
  306. db      0
  307. ;------------------------------------------------------------------------------
  308. t_horstr:
  309.         mov     eax, 38
  310.         mov     edi, ecx
  311.         mov     edx, 0xffffff
  312.         mov     esi, ecx
  313.         inc     esi
  314.         shr     esi, 3
  315.         mov     ebp, esi
  316.         shl     ebp, 16
  317.         mov     bp, si
  318. ;       £®à¨§®­â «ì­ë¥ «¨­¨¨
  319.         shl     ebx, 16
  320.         mov     ecx, ebp
  321.         shr     ecx, 1
  322.         mov     cx, bp
  323.         shr     cx, 1
  324. ;--------------------------------------
  325. hor_next_y:
  326.         mcall
  327.         add     ecx, ebp
  328.         cmp     cx, di
  329.         jnae    hor_next_y
  330.         ret
  331. ;------------------------------------------------------------------------------
  332. lsz i_vertstr,\
  333.   ru, "‚¥à⨪ «ì­ë¥ ¯àï¬ë¥ «¨­¨¨",\
  334.   en, "Vertical Straightness"
  335. db      0
  336. ;------------------------------------------------------------------------------
  337. t_vertstr:
  338.         mov     eax, 38
  339.         mov     edx, 0xffffff
  340.         mov     esi, ebx
  341.         shl     ecx, 16
  342.         mov     edi, esi
  343.         shr     edi, 3
  344.         mov     ebp, edi
  345.         shl     ebp, 16
  346.         mov     bp, di
  347.         mov     ebx, ebp
  348.         shr     ebx, 1
  349.         mov     bx, bp
  350.         shr     bx, 1
  351. ;--------------------------------------
  352. vert_next_x:
  353.         mcall
  354.         add     ebx, ebp
  355.         cmp     bx, si
  356.         jnae    vert_next_x
  357.         ret
  358. ;------------------------------------------------------------------------------
  359. lsz i_distort,\
  360.   ru, "à®¢¥àª  ­  ¨áª ¦¥­¨ï",\
  361.   en, "Distortion",
  362. db      0
  363. ;------------------------------------------------------------------------------
  364. t_distort:
  365.         mov     edx, 0xffffff
  366.         mov     esi, ebx
  367.         mov     edi, ecx
  368.         mov     ebp, 3
  369.         xor     ebx, ebx
  370. ;--------------------------------------
  371. dist_next:
  372.         push    ebp
  373.         mov     ebp, ebx
  374.         shl     ebx, 16
  375.         or      ebx, ebp
  376.  
  377.         mov     ecx, edi
  378.         shl     ecx, 16
  379.         or      ecx, ebp
  380.         mcall   38
  381.  
  382.         mov     ebx, esi
  383.         shl     ebx, 16
  384.         mov     bx, si
  385.         mcall
  386.  
  387.         mov     bx, bp
  388.         mov     ecx, ebp
  389.         shl     ecx, 16
  390.         or      ecx, ebp
  391.         mcall
  392.  
  393.         mov     ecx, edi
  394.         shl     ecx, 16
  395.         mov     cx, di
  396.         mcall
  397.  
  398.         mov     eax, 30
  399.         sub     esi, eax
  400.         sub     edi, eax
  401.         mov     ebx, ebp
  402.         add     ebx, eax
  403.         pop     ebp
  404.         dec     ebp
  405.         jnz     dist_next
  406.         ret
  407. ;------------------------------------------------------------------------------
  408. lsz i_horres,\
  409.   ru, " §à¥è¥­¨¥ ¯® £®à¨§®­â «¨",\
  410.   en, "Horizontal Resolution",
  411. db      0
  412. ;------------------------------------------------------------------------------
  413. t_horres:
  414.         mov     eax, 38
  415.         mov     edx, 0xffffff
  416.         mov     edi, ecx
  417.         shl     ecx, 16
  418.         mov     esi, ebx
  419.         xor     ebx, ebx
  420.         mov     edi, 0x003A003A
  421.         mov     ebp, 0x00030003
  422. ;--------------------------------------
  423. horres_next:
  424.         add     ebx, edi
  425.         mcall
  426.  
  427.         add     ebx, ebp
  428.         mcall
  429.  
  430.         add     ebx, ebp
  431.         mcall
  432.  
  433.         add     ebx, ebp
  434.         mcall
  435.  
  436.         add     ebx, ebp
  437.         mcall
  438.  
  439.         cmp     bx, si
  440.         jna     horres_next
  441.         ret
  442. ;------------------------------------------------------------------------------
  443. lsz i_vertres,\
  444.   ru, " §à¥è¥­¨¥ ¯® ¢¥à⨪ «¨",\
  445.   en, "Vertical Resolution",
  446. db      0
  447. ;------------------------------------------------------------------------------
  448. t_vertres:
  449.         mov     eax, 38
  450.         mov     edx, 0xffffff
  451. ;       mov     esi, ebx
  452.         shl     ebx, 16
  453.         mov     edi, ecx
  454.         xor     ecx, ecx
  455.         mov     ebp, 0x00030003
  456.         mov     esi, 0x002A002A
  457. ;--------------------------------------
  458. vertres_next:
  459.         add     ecx, esi
  460.         mcall
  461.  
  462.         add     ecx, ebp
  463.         mcall
  464.  
  465.         add     ecx, ebp
  466.         mcall
  467.  
  468.         add     ecx, ebp
  469.         mcall
  470.  
  471.         add     ecx, ebp
  472.         mcall
  473.  
  474.         add     ecx, 0x00540054
  475.         cmp     cx, di
  476.         jna     vertres_next
  477.         ret
  478. ;------------------------------------------------------------------------------
  479. lsz i_moire,\
  480.   ru, "˜ ¡«®­ë Œã à ",\
  481.   en, "Moire Patterns",
  482. db      0
  483. ;------------------------------------------------------------------------------
  484. t_moire:
  485.         mov     eax, 38
  486.         mov     edx, 0xffffff
  487.         mov     edi, ecx
  488.         shl     ecx, 16
  489.         mov     esi, ebx
  490.         xor     ebx, ebx
  491.         mov     ebp, 0x00030003
  492. ;--------------------------------------
  493. moire_next:
  494.         mcall
  495.         add     ebx, ebp
  496.         cmp     bx, si
  497.         jna     moire_next
  498.         ret
  499. ;------------------------------------------------------------------------------
  500. lsz i_revsharp,\
  501.   ru, "¥¢¥àᨢ­ ï १ª®áâì ¢¨¤¥®",\
  502.   en, "Reverse Video Sharpness",
  503. db      0
  504. ;------------------------------------------------------------------------------
  505. t_revsharp:
  506.         mov     esi, ebx
  507.         mov     edi, ecx
  508.         shr     ecx, 1
  509.         mcall   13,,,0xffffff
  510. ;   ⥯¥àì - ¨­¢¥àá­ë¥ «¨­¨¨
  511.         mov     eax, 38
  512.         mov     ecx, edi
  513.         mov     edx, 0x01000000
  514.         xor     ebx, ebx
  515.         mov     ebp, 0x00010001
  516.         mov     edi, 0x003F003F
  517. ;--------------------------------------
  518. revsharp_next:
  519.         add     ebx, edi
  520.         mcall
  521.  
  522.         add     ebx, ebp
  523.         mcall
  524.  
  525.         add     ebx, ebp
  526.         mcall
  527.  
  528.         add     ebx, edi
  529.         sub     ebx, ebp
  530.         mcall
  531.  
  532.         cmp     bx, si
  533.         jna     revsharp_next
  534.         ret
  535. ;------------------------------------------------------------------------------
  536. lsz i_flicker,\
  537.         ru, "“஢¥­ì ¬¥àæ ­¨ï",\
  538.         en, "Flicker Severity",
  539. db      0
  540. ;------------------------------------------------------------------------------
  541. t_flicker:
  542.         mcall   13,,,0xffffff
  543.         ret
  544. ;------------------------------------------------------------------------------
  545. lsz i_glare,\
  546.         ru, "“஢¥­ì ¡«¨ª®¢ ¯®¤á¢¥âª¨",\
  547.         en, "Glare Severity",
  548. db      0
  549. ;------------------------------------------------------------------------------
  550. t_glare:                ; ®¯â¨¬¨§¨à®¢ âì ­¥ç¥£®
  551.         ret
  552. ;------------------------------------------------------------------------------
  553. lsz i_interlace,\
  554.         ru, "Ž¡­ à㦥­¨¥ ¨­â¥à«¥©á¨­£ ",\
  555.         en, "Interlacing Detection",
  556. db      0
  557. ;------------------------------------------------------------------------------
  558. t_interlace:
  559.         mov     edi, ecx
  560.         mov     eax, 38
  561.         mov     edx, 0xffffff
  562.         xor     ecx, ecx
  563.         mov     ebp, 0x00020002
  564. ;--------------------------------------
  565. interlace_next:
  566.         add     ecx, ebp
  567.         mcall
  568.         cmp     cx, di
  569.         jna     interlace_next
  570.         ret
  571. ;------------------------------------------------------------------------------
  572. lsz i_scrreg,\
  573.         ru, "¥£ã«¨à®¢ª  íªà ­ ",\
  574.         en, "Screen Regulation",
  575. db      0
  576. ;------------------------------------------------------------------------------
  577. t_scrreg:
  578.         add     ebx, 0x0018FFCD ; +25 ª ­ ç «ã ¨ -50 ®â ¤«¨­ë
  579.         shr     ecx, 1
  580.         add     ecx, 0x0013FFEC ; +19 ª ­ ç «ã ¨ -19 ®â ¤«¨­ë
  581.         mcall   13,,,0xffffff
  582.         ret
  583. ;------------------------------------------------------------------------------
  584. lsz i_pricol,\
  585.         ru, "—¨áâ®â  ®á­®¢­ëå 梥⮢",\
  586.         en, "Primary Color Purity",
  587. db      0
  588. ;------------------------------------------------------------------------------
  589. t_pricol:
  590.         mov     esi, ebx
  591.         mov     edi, ecx
  592.  
  593.         shr     ebx, 4  ; /16
  594.         mov     ebp, ebx
  595.         shl     ebx, 16
  596.         mov     bx, bp
  597.         shl     ebp, 16
  598.         lea     ebp, [ebp + ebp * 4]            ; ebp *= 5
  599.  
  600.         mov     ecx, 0x00280000
  601.         mov     cx, di
  602.         sub     cx, 80
  603.         ;shr     cx, 1
  604.  
  605.         shl     bx, 2
  606.         mcall   13,,,0xff0000
  607.  
  608.         add     ebx, ebp
  609.         shr     edx, 8
  610.         mcall
  611.  
  612.         add     ebx, ebp
  613.         shr     edx, 8
  614.         mcall
  615.         ret
  616. ;------------------------------------------------------------------------------
  617. lsz i_colint,\
  618.         ru, "ƒà ¤¨¥­â ¨­â¥­á¨¢­®á⨠梥â ",\
  619.         en, "Color Intensity Gradient",
  620. db      0
  621. ;------------------------------------------------------------------------------
  622. t_colint:
  623.  
  624.         mov     esi, ebx
  625.         mov     edi, ecx
  626.  
  627. ;        mov     eax, ecx
  628. ;        shr     ecx, 2          ; end y coord
  629. ;        and     ecx, 0xffffff80         ; íâ® not 7F
  630. ;        shr     eax, 7                  ; / 128
  631. ;        mov     ebp, eax
  632. ;        mov     edx, eax
  633. ;        lea     eax, [eax + eax * 2]    ; eax *= 5
  634. ;        shl     ebp, 4
  635. ;        add     eax, ebp
  636.  
  637. ;        shl     eax, 16
  638. ;        add     ecx, eax
  639. ;        mov     edx, ebp
  640. ;        shl     ebp, 16
  641. ;        mov     bp, dx          ; ©  ¡®«ì­®©
  642.  
  643.         ; ï ­¥ ¯®­ï«, çâ® â ¬ ¤¥« «®áì, ¨ à¥è¨« ­ ¯¨á âì á­®¢  ®_Ž
  644.  
  645.         ; ­ ¤® §¤¥áì ᣥ­¥à¨âì ecx (­ ç «ì­ë© ᤢ¨£) ¨ ebp (è £ ¯® ã)
  646.  
  647.         mov     eax, edi
  648.         lea     eax, [eax + 2 * eax]
  649.         shr     eax, 5                  ; eax = 3/32 ¢ëá®âë
  650.         mov     ebp, eax
  651.         shl     ebp, 16
  652.         mov     bp, ax                  ; ebp = ax ¢ ®¡®¨å á«®¢ å
  653.  
  654.         mov     ebx, eax                ; á®åà ­¨¬ íâ® §­ ç¥­¨¥
  655.  
  656.         mov     eax, edi
  657.         inc     eax
  658.         shr     eax, 4          ; 3/16 ¢ëá®âë - ­ ç «ì­®¥ §­ ç¥­¨¥
  659.                                 ; ¢á¥£® ¯®«®áë § ©¬ãâ 3/4 ¢ëá®âë, ¨â®£® ¯® 3/32 ¢ëá®âë ­  ¯®«®áã (¤«ï ஢­®£® áç¥â )
  660.         lea     eax, [eax + eax * 2]
  661.         mov     ecx, eax
  662.         shl     ecx, 16
  663.         shr     ebx, 2
  664.         lea     ebx, [ebx + ebx * 2]    ; ebx = 3/4 ebx, â.¥. 3/4 ¢ëá®âë ¯®«®áë
  665.         add     eax, ebx
  666.         mov     cx, ax
  667.  
  668.         xor     edx, edx
  669.         mov     eax, 0xffff
  670.         div     esi
  671.         mov     edi, eax        ; edi = 64K/width
  672.  
  673.         mov     dword [color_index], 0
  674.         jmp     colint_next
  675. ;------------------------------------------------------------------------------
  676. color_table     dd      0x00ff0000, 0x0000ff00, 0x00ffff00, \
  677.                         0x000000ff, 0x00ff00ff, 0x0000ffff, 0x00ffffff
  678. color_index     dd      0
  679. ;------------------------------------------------------------------------------
  680. colint_next:
  681.         xor     edx, edx
  682.         xor     ebx, ebx
  683.         mov     eax, 38
  684. ;--------------------------------------
  685. colint_next_line:
  686.         push    edx
  687.         push    eax
  688.         movzx   eax, dh
  689.         shl     eax, 16
  690.         mov     dl, dh
  691.         or      edx, eax
  692.         mov     eax, [color_index]
  693.         mov     eax, [color_table + eax * 4]
  694.         and     edx, eax
  695.         pop     eax
  696.         mcall
  697.         pop     edx
  698.         add     ebx, 0x00010001
  699.         add     edx, edi
  700.         cmp     bx, si
  701.         jna     colint_next_line
  702.  
  703.         add     ecx, ebp
  704.         inc     dword [color_index]
  705.         cmp     dword [color_index], 7
  706.         jb      colint_next
  707.         ret
  708. ;------------------------------------------------------------------------------
  709. lsz i_colalign,\
  710.         ru, "–¢¥â®¢®¥ ¢ëà ¢­¨¢ ­¨¥",\
  711.         en, "Color Alignment Grid",
  712. db      0
  713. ;------------------------------------------------------------------------------
  714. t_colalign:
  715. ; ªà á­ ï á¥âª 
  716.         inc     ebx             ; â ª ­ã¦­®
  717.         inc     ecx
  718.         mov     esi, ebx
  719.         mov     edi, ecx
  720.         mov     edx, 0xff0000
  721. ;       £®à¨§®­â «ì­ë¥ «¨­¨¨
  722.         shl     ebx, 16
  723.         xor     ecx, ecx
  724.         push    edi
  725.         shr     edi, 3
  726.         mov     ebp, edi
  727.         shl     ebp, 16
  728.         mov     bp, di
  729.         pop     edi
  730.         mov     [yshift], ebp
  731.         mov     eax, 38
  732. ;--------------------------------------
  733. cgrid_next_y:
  734.         mcall
  735.         add     ecx, ebp
  736.         cmp     cx, di
  737.         jnae    cgrid_next_y
  738.         ; ¯®á«¥¤­ïï «¨­¨ï:
  739.         sub     ecx, 0x00010001
  740.         mcall
  741.  
  742. ;       ¢¥à⨪ «ì­ë¥ «¨­¨¨
  743.         mov     ecx, edi
  744.         shl     ecx, 16
  745.         xor     ebx, ebx
  746.         push    esi
  747.         shr     esi, 3
  748.         mov     ebp, esi
  749.         shl     ebp, 16
  750.         mov     bp, si
  751.         mov     [xshift], ebp
  752.         pop     esi
  753.         mov     eax, 38
  754. ;--------------------------------------
  755. cgrid_next_x:
  756.         mcall
  757.         add     ebx, ebp
  758.         cmp     bx, si
  759.         jnae    cgrid_next_x
  760.         ; ¯®á«¥¤­ïï «¨­¨ï
  761.         sub     ebx, 0x00010001
  762.         mcall
  763.         jmp     cgrid_green
  764. ;------------------------------------------------------------------------------
  765.         xshift  dd      0
  766.         yshift  dd      0
  767.         shift   dd      0
  768. ;------------------------------------------------------------------------------
  769. cgrid_green:
  770. ; §¥«¥­ë¥ «¨­¨¨: £®à¨§®­â «ì­ë¥
  771.         mov     edx, esi
  772.         shr     edx, 5
  773.         lea     eax, [edx + edx * 2]
  774.         shl     edx, 16
  775.         or      edx, eax
  776.         mov     [shift], edx
  777.         mov     eax, 38
  778.         mov     edx, 0x00ff00
  779.         xor     ecx, ecx
  780.         mov     ebp, [xshift]
  781. ;--------------------------------------
  782. ggrid_next_yy:
  783.         mov     ebx, [shift]
  784. ;--------------------------------------
  785. ggrid_next_yx:
  786.         mcall
  787.         add     ebx, ebp
  788.         cmp     bx, si
  789.         jnae    ggrid_next_yx
  790.         sub     ebx, 0x00010001
  791.         mcall
  792.  
  793.         add     ecx, [yshift]
  794.         cmp     cx, di
  795.         jnae    ggrid_next_yy
  796.         ; last row of lines
  797.         mov     ebx, [shift]
  798.         dec     ecx
  799. ;--------------------------------------
  800. ggrid_last_yx:
  801.         mcall
  802.         add     ebx, ebp
  803.         cmp     bx, si
  804.         jnae    ggrid_last_yx
  805.  
  806. ; ¨ ¢¥à⨪ «ì­ë¥
  807.         mov     edx, edi
  808.         shr     edx, 5
  809.         lea     eax, [edx + edx * 2]
  810.         shl     edx, 16
  811.         or      edx, eax
  812.         mov     [shift], edx
  813.  
  814.         mov     eax, 38
  815.         mov     edx, 0x00ff00
  816.         mov     ecx, [shift]
  817.         mov     ebp, [xshift]
  818. ;--------------------------------------
  819. ggrid_next_xy:
  820.         xor     ebx, ebx
  821. ;--------------------------------------
  822. ggrid_next_xx:
  823.         mcall
  824.  
  825.         add     ebx, ebp
  826.         cmp     bx, si
  827.         jnae    ggrid_next_xx
  828.         sub     ebx, 0x00010001
  829.         mcall
  830.  
  831.         add     ecx, [yshift]
  832.         cmp     cx, di
  833.         jnae    ggrid_next_xy
  834.         xor     ebx, ebx
  835.         dec     ecx
  836. ;--------------------------------------
  837. ggrid_last_xy:
  838.         ;int     0x40
  839.         ;add     ebx, ebp
  840.         ;cmp     bx, si
  841.         ;jnae    ggrid_last_xy
  842.         ret
  843. ;------------------------------------------------------------------------------
  844. lsz i_colsyn,\
  845.         ru, "‘¨­åà®­¨§ æ¨ï 梥â ",\
  846.         en, "Color Synchronization",
  847. db      0
  848. ;------------------------------------------------------------------------------
  849. t_colsyn:
  850.         inc     ebx
  851.         inc     ecx
  852.         mov     esi, ebx
  853.         mov     edi, ecx
  854.  
  855.         shr     ebx, 5
  856.         mov     eax, ebx
  857.         lea     ebx, [ebx + ebx * 4]
  858.         shl     ebx, 1                  ; 10/32
  859.         mov     ebp, ebx
  860.         shl     eax, 16
  861.         or      ebx, eax
  862.         shl     ebp, 16
  863.  
  864.         mov     edi, 0x0000ffff
  865.         add     ecx, 0x003FFF7F
  866.         mov     edx, edi
  867.         mcall   13
  868.  
  869.         mov     edx, 0x00ff0000
  870.         add     ebx, ebp
  871.         mcall
  872.  
  873.         mov     edx, edi
  874.         add     ebx, ebp
  875.         mcall
  876.         ret
  877. ;------------------------------------------------------------------------------
  878. ; <--- initialised data --->
  879. DATA
  880.         screenx         dd      0
  881.         screeny         dd      0
  882.  
  883.         test_num        dd      0
  884.         test_done       dd      0
  885.         show_info       dd      1
  886.         test_proc       dd      t_image_size, t_grid, t_horstr, t_vertstr,\
  887.                 t_distort, t_horres, t_vertres, t_moire, t_revsharp, \
  888.                 t_flicker, t_glare, t_interlace, t_scrreg, t_pricol, \
  889.                 t_colint, t_colalign, t_colsyn, 0
  890.         test_info       dd      i_image_size, i_grid, i_horstr, i_vertstr, \
  891.                 i_distort, i_horres, i_vertres, i_moire, i_revsharp, \
  892.                 i_flicker, i_glare, i_interlace, i_scrreg, i_pricol, \
  893.                 i_colint, i_colalign, i_colsyn, 0
  894.  
  895.         lsz press_space,\
  896.                 ru, " ¦¬¨â¥ ¯à®¡¥« ¤«ï ¯à®¤®«¦¥­¨ï,",\
  897.                 en, "Press 'Space' key to continue",
  898.         db      0
  899.  
  900.         lsz press_i,\
  901.                 ru, "I ¤«ï ¯¥à¥ª«î祭¨ï ᢥ¤¥­¨©,",\
  902.                 en, "I to turn details on and off ",
  903.         db      0
  904.  
  905.         lsz press_c,\
  906.                 ru, "¨ C ¤«ï ¯¥à¥ª«î祭¨ï ªãàá®à ",\
  907.                 en, "and C to show and hide cursor",
  908.         db      0
  909.  
  910.         lsz header,\
  911.                 ru, "’¥áâ ¬®­¨â®à ",\
  912.                 en, "Display test",
  913.         db      0
  914.  
  915.         lsz test_finish,\
  916.                 ru, "Š®­¥æ â¥áâ .  ¦¬¨â¥ ESC.",\
  917.                 en, "Test has been finished. Press ESC.",
  918.         db      0
  919.  
  920.         cursor  dd 32*32 dup(0x00000000)        ; ¢á¥ à ¢­® ᮦ¬¥âáï
  921.  
  922.         cursorVisible   dd      1
  923.         cursorID        dd      0
  924. ;------------------------------------------------------------------------------
  925. ; <--- uninitialised data --->
  926. UDATA
  927. ;------------------------------------------------------------------------------
  928. MEOS_APP_END
  929. ; <--- end of MenuetOS application --->
  930. ;------------------------------------------------------------------------------
  931.