Subversion Repositories Kolibri OS

Rev

Rev 9568 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;=============================================================================
  2. ; Kolibri Graphics Benchmark 0.9
  3. ;--------------------------------------
  4. ; MGB - Menuet Graphics Benchmark 0.3
  5. ; Compile with FASM
  6. ;
  7. ;=============================================================================
  8. ; version:      0.9
  9. ; last update:  15/04/2019
  10. ; written by:   Kiril Lipatov aka Leency
  11. ; changes:      use big fonts, editing two comments, improve UI, show delta %
  12. ;               Russian translation by Daniel Ovchinnikov
  13. ;---------------------------------------------------------------------
  14. ; version:      0.82
  15. ; last update:  03/11/2014
  16. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  17. ; changes:      fix "benchmark GS selector" for 16bpp (support SVN r.5154)
  18. ;---------------------------------------------------------------------
  19. ; version:      0.81
  20. ; last update:  01/05/2014
  21. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  22. ; changes:      fix "benchmark GS selector" for some display sizes
  23. ;               (for example, 1366 by horizontal) and code optimization
  24. ;---------------------------------------------------------------------
  25. ; version:      0.8
  26. ; last update:  08/07/2013
  27. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  28. ; changes:      benchmark f4 with memory + f65
  29. ;---------------------------------------------------------------------
  30. ; version:      0.7
  31. ; last update:  05/04/2013
  32. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  33. ; changes:      benchmark GS selector - read screen area
  34. ;---------------------------------------------------------------------
  35. ; version:      0.6
  36. ; last update:  14/03/2013
  37. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  38. ; changes:      benchmark f36 - read screen area
  39. ;---------------------------------------------------------------------
  40. ; version:      0.5
  41. ; last update:  05/03/2013
  42. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  43. ; changes:      benchmark f73-blitter
  44. ;---------------------------------------------------------------------
  45. ; version:      0.4
  46. ; last update:  18/09//2010
  47. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  48. ; changes:      select path with OpenDialog,
  49. ;               use of Box_Lib and Proc_Lib,
  50. ;               support start with path for *.mgb file
  51. ;               optimization code and size of use memory
  52. ;---------------------------------------------------------------------
  53. ; Original author and copyrights holder:
  54. ;     Mikhail Lisovin a.k.a. Mihasik
  55. ;     lisovin@26.ru
  56. ;
  57. ; Disassembled with IDA 5.0.0.879:
  58. ;     http://www.datarescue.com/
  59. ; With use of 'ida.int' and 'kloader.ldw':
  60. ;     Eugene Grechnikov a.k.a. diamond
  61. ;     diamondz@land.ru
  62. ;     http://diamondz.land.ru/
  63. ;
  64. ; Modified for version 0.3:
  65. ;     Mike Semenako a.k.a mike.dld
  66. ;     mike.dld@gmail.com
  67. ;     http://www.mikedld.com/
  68. ;
  69. ;=============================================================================
  70.  
  71. org 0x0
  72. use32
  73.  
  74.         db 'MENUET01'
  75.         dd 1
  76.         dd start
  77.         dd IM_END
  78.         dd I_END        ;0x200000
  79.         dd stacktop     ;0x07FFF0
  80.         dd fname_buf
  81.         dd cur_dir_path
  82.  
  83. include '../../../config.inc'           ;for nightbuild
  84. include '../../../macros.inc'
  85. include '../../../proc32.inc'
  86. ;include '../../../debug.inc'
  87. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  88. include '../../../develop/libraries/box_lib/load_lib.mac'
  89. include 'lang.inc'      ;language support
  90.         @use_library
  91. ;---------------------------------------------------------------------
  92. start:
  93.         mcall   68,11
  94.  
  95.         mcall   68,12,8+9*6*38*4        ; 7352
  96.         mov     [text_scren_buffer],eax
  97.  
  98.         mcall   68,12,8+9*6*38*4        ; 8216
  99.         mov     [text_scren_buffer2],eax
  100.        
  101. load_libraries l_libs_start,end_l_libs
  102.  
  103.         cmp     eax,-1
  104.         jz      close
  105. ;---------------------------------------------------------------------
  106.         mov     edi,filename_area
  107.         mov     esi,start_temp_file_name
  108.         call    copy_str_1
  109.  
  110.         mov     edi,comment_string_1
  111.         mov     esi,aComment1
  112.         call    copy_str_1
  113.  
  114.         mov     edi,comment_string_2
  115.         mov     esi,aComment2
  116.         call    copy_str_1
  117.  
  118.         mov     edi,fname_buf
  119.         cmp     [edi],byte 0
  120.         jne     @f
  121.         mov     esi,path4
  122.         call    copy_str_1
  123.         jmp     .OpenDialog
  124. @@:
  125.         call    locLoadFile
  126.         xor     dword [wFlags],1
  127. .OpenDialog:
  128. ;OpenDialog     initialisation
  129.         push    dword OpenDialog_data
  130.         call    [OpenDialog_Init]
  131. ;---------------------------------------------------------------------
  132.         mcall   40,0x80000027
  133. red:
  134.         call    draw_window
  135. still:
  136.         mcall   10
  137.         cmp     eax,1
  138.         jz      red
  139.         cmp     eax,2
  140.         jz      key
  141.         cmp     eax,3
  142.         jz      button
  143.         jmp     still
  144. ;---------------------------------------------------------------------
  145. copy_str_1:
  146.         xor     eax,eax
  147.         cld
  148. @@:
  149.         lodsb
  150.         stosb
  151.         test    eax,eax
  152.         jnz     @b
  153.         ret
  154. ;---------------------------------------------------------------------
  155. key:
  156.         mcall   2
  157.         cmp     ah,'t'
  158.         jz      ActionTest
  159.         cmp     ah,'c'
  160.         jz      ActionComment
  161.         cmp     ah,'m'
  162.         jz      ActionPatternMove
  163.         cmp     ah,'o'
  164.         jz      ActionOpen
  165.         cmp     ah,'s'
  166.         jz      ActionSave
  167.         jmp     still
  168. ;---------------------------------------------------------------------
  169. button:
  170.         mcall   17
  171.         cmp     ah,1
  172.         jnz     NotClose
  173. close:
  174.         mcall   -1
  175. NotClose:
  176.         cmp     ah,2
  177.         jnz     locNotTest
  178. ActionTest:
  179.         test    dword [wFlags],1
  180.         jnz     still
  181.         mcall   51,1,TestWndProc,thread_stack1
  182.         jmp     still
  183. ;---------------------------------------------------------------------
  184. locNotTest:
  185.         cmp     ah,3
  186.         jnz     NotComment
  187. ActionComment:
  188.         test    dword [wFlags],1
  189.         jnz     still
  190.         mcall   51,1,thread_comment,thread_stack2
  191.         jmp     still
  192. ;---------------------------------------------------------------------
  193. NotComment:
  194.         cmp     ah,6
  195.         jnz     NotPatternCopy
  196. ActionPatternMove:
  197.         test    dword [wFlags],1
  198.         jnz     still
  199.         mov     esi,results_table
  200.         cld
  201. @@:
  202.         lodsd
  203.         mov     [esi],eax
  204.         add     esi,TEST_REC_SIZE-4
  205.         cmp     dword [esi+TEST_REC_SIZE-4],0
  206.         jne     @b
  207.         mov     esi,comment_string_1
  208.         mov     edi,comment_string_2
  209.         call    copy_str_1
  210.         call    DrawBars
  211.         jmp     still
  212. ;---------------------------------------------------------------------
  213. NotPatternCopy:
  214.         cmp     ah,4
  215.         jnz     NotOpen
  216. ActionOpen:
  217.         test    dword [wFlags],1
  218.         jnz     still
  219.         mov     [OpenDialog_data.type],0 ; open
  220.         call    OpenDialog_Start_1
  221.         jne     still
  222.         call    locLoadFile
  223.         call    DrawBars
  224. .1:
  225.         xor     dword [wFlags],1
  226.         jmp     still
  227. ;---------------------------------------------------------------------
  228. OpenDialog_Start_1:
  229.         push    dword OpenDialog_data
  230.         call    [OpenDialog_Start]
  231.         cmp     [OpenDialog_data.status],1
  232.         ret
  233. ;---------------------------------------------------------------------
  234. NotOpen:
  235.         cmp     ah,5
  236.         jnz     still
  237. ActionSave:
  238.         test    dword [wFlags],1
  239.         jnz     still
  240.         mov     [OpenDialog_data.type],1 ; save
  241.         call    OpenDialog_Start_1
  242.         jne     still
  243.         call    locSaveFile
  244.         jmp     ActionOpen.1
  245. ;---------------------------------------------------------------------
  246. TestWndProc:
  247.         mcall   68,12,90*123*3
  248.         mov     [area_for_f36],eax
  249.         or      dword [wFlags],1
  250.         mov     esi,results_table+8
  251. align 4
  252. .next_test:
  253.         xor     edi,edi
  254.         mcall    26,9
  255.         inc     eax
  256.         mov     ecx,eax
  257.         add     eax,100
  258.         mov     [dwTestEndTime],eax
  259. align 4
  260. @@:
  261.         mcall    26
  262.         cmp     eax,ecx
  263.         jb      @r
  264. align 4
  265. @@:
  266.         push    esi edi
  267.         call    dword [esi]
  268.         pop     edi esi
  269.         inc     edi
  270.         mcall   26,9
  271.         cmp     eax,[dwTestEndTime]
  272.         jb      @b
  273.         mov     [esi-8],edi
  274.  
  275.         add     esi,TEST_REC_SIZE
  276.         cmp     dword [esi], testDrawPicture_f73
  277.         jnz     @f
  278.         call    prepare_f73
  279. @@:
  280.         cmp     dword [esi],0
  281.         jnz     .next_test
  282.         xor     dword [wFlags],1
  283.         mcall   68,13,[area_for_f36]
  284.         mcall   -1
  285. ;---------------------------------------------------------------------
  286. draw_window:
  287.         mcall   12,1
  288.         mcall   48,4
  289.         mov     ebx,460*65536+(LINE_DESCRIPTION_CHARS+5)*8+16
  290.         mov     ecx,80*65536+TESTS_NUM*(LINE_HEIGHT+2)+15+38
  291.         add     cx,ax
  292.         xor     eax,eax
  293.         xor     esi,esi
  294.         mcall   ,,,34000000h,,aCaption
  295.  
  296.         mov     eax,8
  297.         mov     ebx,20*65536+84
  298.         mov     ecx,4*65536+24
  299.         mov     edx,2
  300.         mov     esi,0x00007F7F
  301. @@:
  302.         mcall
  303.         add     ebx,96*65536
  304.         inc     edx
  305.         cmp     edx,7
  306.         jb      @r
  307.  
  308.         mov     ecx,33
  309.         mov     edx,0x00007F7F
  310.         mov     esi,(LINE_DESCRIPTION_CHARS*8)/2+20
  311.         call    drawSeparator
  312.  
  313.         mcall   4,<46,9>,0x90DDEEFF,aButtonsText
  314.         call    DrawBars
  315.  
  316.         mov     ecx,TESTS_NUM*LINE_HEIGHT+15+23
  317.         mov     edx,0x00007F7F
  318.         mov     esi,(LINE_DESCRIPTION_CHARS*8)/2+20
  319.         call    drawSeparator
  320.         mcall   12,2
  321.         ret
  322. ;---------------------------------------------------------------------
  323. drawSeparator:
  324.         mov     eax,1
  325.         mov     ebx,3
  326. @@:
  327.         mcall
  328.         add     ebx,2
  329.         dec     esi
  330.         jnz     @b
  331.         ret
  332. ;---------------------------------------------------------------------
  333. align 4
  334. testDrawWindow:
  335.         xor     eax,eax
  336.         mcall   ,640145h,4F0190h,3000000h
  337.         ret
  338. ;---------------------------------------------------------------------
  339. align 4
  340. testDrawBar:
  341.         mcall   13,0A0064h,1E00FAh,6A73D0h
  342.         ret
  343. ;---------------------------------------------------------------------
  344. align 4
  345. testDrawPicture:
  346. ;       xor     ebx,ebx
  347.         mcall   7,[area_for_f36],<90,123>,<15,33>
  348.         ret
  349. ;---------------------------------------------------------------------
  350. prepare_f73:
  351.         mov     ecx, 90*123
  352.         mov     eax, params_f73.data
  353.         mov     ebx, [area_for_f36]
  354. @@:
  355.         mov     edx, [ebx]
  356.         and     edx, 0xFFFFFF
  357.         mov     [eax], edx
  358.         add     ebx, 3
  359.         add     eax, 4
  360.         dec     ecx
  361.         jnz     @b
  362.         ret
  363. align 4
  364. testDrawPicture_f73:
  365.         xor     ebx,ebx
  366.         mcall   73,,params_f73
  367.         ret
  368. ;---------------------------------------------------------------------
  369. align 4
  370. testGetScreen_f36:
  371.         xor     ebx,ebx
  372.         mcall   36,[area_for_f36],<90,123>,<15,33>
  373.         ret
  374. ;---------------------------------------------------------------------
  375. GS_start_x = 15
  376. GS_start_y = 33
  377. GS_size_x = 90
  378. GS_size_y = 123
  379. ;-----------------------------------------------------------------------------
  380. align 4
  381. testGetScreen_GS:
  382.         push    edi
  383.         mov     edi,[area_for_f36]
  384.  
  385.         mcall   61,2
  386.         cmp     eax,24
  387.         je      get_area_with_GS_24
  388.        
  389.         cmp     eax,16
  390.         je      get_area_with_GS_16
  391. ;-----------------------------------------------------------------------------
  392. align 4
  393. get_area_with_GS_32:
  394.         mcall   61,3
  395.         mov     ebx,eax
  396.  
  397.         mov     esi,GS_start_y
  398.         imul    esi,eax
  399.  
  400.         mov     eax,GS_start_x
  401.         shl     eax,2
  402.         add     esi,eax
  403.  
  404.         mov     ebp,GS_size_x
  405.         mov     eax,ebp
  406.         shl     eax,2
  407.         sub     ebx,eax
  408.  
  409.         mov     edx,GS_size_y
  410.         sub     esi,ebx
  411. ;--------------------------------------
  412. align 4
  413. .start_y:
  414.         add     esi,ebx
  415.         mov     ecx,ebp
  416. ;--------------------------------------
  417. align 4
  418. .start_x:
  419.         mov     eax,[gs:esi]
  420.         mov     [edi],eax
  421.         add     esi,4
  422.         add     edi,3
  423.  
  424.         dec     ecx
  425.         jnz     .start_x
  426.  
  427.         dec     edx
  428.         jnz     .start_y
  429.  
  430.         pop     edi
  431.         ret
  432. ;-----------------------------------------------------------------------------
  433. align 4
  434. get_area_with_GS_24:
  435.         mcall   61,3
  436.         mov     ebx,eax
  437.  
  438.         mov     esi,GS_start_y
  439.         imul    esi,eax
  440.  
  441.         mov     eax,GS_start_x
  442.         lea     eax,[eax*3]
  443.         add     esi,eax
  444.  
  445.         mov     ebp,GS_size_x
  446.         mov     eax,ebp
  447.         lea     eax,[eax*3]
  448.         sub     ebx,eax
  449.  
  450.         mov     edx,GS_size_y
  451.         sub     esi,ebx
  452. ;--------------------------------------
  453. align 4
  454. .start_y:
  455.         add     esi,ebx
  456.         mov     ecx,ebp
  457. ;--------------------------------------
  458. align 4
  459. .start_x:
  460.         mov     eax,[gs:esi]
  461.         mov     [edi],eax
  462.         add     esi,3
  463.         add     edi,3
  464.  
  465.         dec     ecx
  466.         jnz     .start_x
  467.  
  468.         dec     edx
  469.         jnz     .start_y
  470.  
  471.         pop     edi
  472.         ret
  473. ;-----------------------------------------------------------------------------
  474. align 4
  475. get_area_with_GS_16:
  476.         mcall   61,3
  477.         mov     ebx,eax
  478.  
  479.         mov     esi,GS_start_y
  480.         imul    esi,eax
  481.  
  482.         mov     eax,GS_start_x
  483.         shl     eax,1
  484.         add     esi,eax
  485.  
  486.         mov     ebp,GS_size_x
  487.         mov     eax,ebp
  488.         shl     eax,1
  489.         sub     ebx,eax
  490.  
  491.         mov     edx,GS_size_y
  492.         sub     esi,ebx
  493. ;--------------------------------------
  494. align 4
  495. .start_y:
  496.         add     esi,ebx
  497.         mov     ecx,ebp
  498. ;--------------------------------------
  499. align 4
  500. .start_x:
  501.         xor     eax,eax
  502.         mov     ax,[gs:esi]
  503.         shl     eax, 3
  504.         ror     eax, 8
  505.         shl     ax, 2
  506.         ror     eax, 8
  507.         shl     al, 3
  508.         rol     eax, 16
  509.         mov     [edi],eax
  510.         add     esi,2
  511.         add     edi,3
  512.  
  513.         dec     ecx
  514.         jnz     .start_x
  515.  
  516.         dec     edx
  517.         jnz     .start_y
  518.  
  519.         pop     edi
  520.         ret
  521. ;-----------------------------------------------------------------------------
  522. align 4
  523. testDrawVertLine:
  524.         mcall   38,<300,300>,<30,380>,1090207Fh
  525.         ret
  526. ;---------------------------------------------------------------------
  527. align 4
  528. testDrawHorzLine:
  529.         mcall   38,<30,300>,<380,380>,1090207Fh
  530.         ret
  531. ;---------------------------------------------------------------------
  532. align 4
  533. testDrawFreeLine:
  534.         mcall   38,<30,300>,<380,30>,1090207Fh
  535.         ret
  536. ;---------------------------------------------------------------------
  537. align 4
  538. testDrawText1:
  539.         mcall   4,<12,300>,0x0000AA66,aTestText,34
  540.         ret
  541. ;---------------------------------------------------------------------
  542. align 4
  543. testDrawText1m:
  544.         mov     eax,[text_scren_buffer]
  545.         mov     [eax],dword 6*34
  546.         mov     [eax+4],dword 9
  547.         mcall   4,<0,0>,0x0800AA66,aTestText,34,[text_scren_buffer]
  548.         xor     ebp,ebp
  549.         mov     ebx,[text_scren_buffer]
  550.         add     ebx,8
  551.         mcall   65,,<6*34,9>,<18,309>,32
  552.         ret
  553. ;---------------------------------------------------------------------
  554. align 4
  555. testDrawText2:
  556.         mcall   4,<27,315>,0x10E7B850,aTestText,34
  557.         ret
  558. ;---------------------------------------------------------------------
  559. align 4
  560. testDrawText2m:
  561.         mov     eax,[text_scren_buffer2]
  562.         mov     [eax],dword 6*38
  563.         mov     [eax+4],dword 9
  564.         mcall   4,<0,0>,0x18E7B850,aTestText,34,[text_scren_buffer2]
  565.         xor     ebp,ebp
  566.         mov     ebx,[text_scren_buffer2]
  567.         add     ebx,8
  568.         mcall   65,,<6*38,9>,<33,324>,32
  569.         ret
  570. ;---------------------------------------------------------------------
  571. align 4
  572. testDrawNumber:
  573.         mcall   47,0x80000,12345678,<42,333>,0x0E0B27B
  574.         ret
  575. ;---------------------------------------------------------------------
  576. align 4
  577. testDrawPixel:
  578.         mcall   1,100,100,0FFFFFFh
  579.         ret
  580. ;---------------------------------------------------------------------
  581. DrawBars:
  582.         mov     edi,results_table
  583.         mov     ebx,30+7
  584. .next_result:
  585.         cmp     dword[edi+TEST_REC_SIZE-4],0
  586.         je      .exit
  587.  
  588.         push    ebx
  589.         movzx   ecx,bx
  590.         add     ecx,-2
  591.         shl     ecx,16
  592.         mov     cx,LINE_HEIGHT
  593.         mov     ebx,0*65536+LINE_DESCRIPTION_CHARS*8+5
  594.         xor     edx,edx
  595.         mcall   13
  596.         pop     ebx
  597.  
  598.         and     ebx,0x0000FFFF
  599.         or      ebx,5*65536
  600.         mov     edx,[edi+TEST_REC_SIZE-4]
  601.         mcall   4,,0x9000CCCC
  602.  
  603.         push    '=' 0x00FFFF00 0x00FFFF7F 0x00FFFF7F
  604.         mov     eax,[edi+0]
  605.         cmp     eax,[edi+4]
  606.         je      @f
  607.         jb      .lp1
  608.         mov     dword[esp+0],0x007FFF7F
  609.         mov     dword[esp+4],0x00FF7F7F
  610.         mov     dword[esp+8],0x0000FF00
  611.         mov     byte[esp+12],'>'
  612. .lp1:
  613.         ja      @f
  614.         mov     dword[esp+0],0x00FF7F7F
  615.         mov     dword[esp+4],0x007FFF7F
  616.         mov     dword[esp+8],0x00FF0000
  617.         mov     byte[esp+12],'<'
  618. @@:
  619.         pop     ecx
  620.         call    int2str
  621.         add     ebx,(LINE_DESCRIPTION_CHARS*8-8*8*2-20)*65536 ; 196
  622.         add ecx,0x10000000 ;big font
  623.         mcall   4,,,textarea,8
  624.  
  625.         pop     ecx
  626.         mov     eax,[edi+4]
  627.         call    int2str
  628.         add     ebx,(6*8+26)*65536
  629.         add ecx,0x10000000 ;big font
  630.         mcall   4
  631.  
  632.         ;pop    ecx
  633.         ;add    ebx,(-15)*65536
  634.         ;mov    edx,esp
  635.         ;mov    esi,1
  636.         ;add ecx,0x10000000 ;big font
  637.         ;mcall
  638.        
  639.        
  640.         ; draw difference
  641.         pop ecx
  642.         add ecx,0x10000000 ;big font
  643.        
  644.         pusha
  645.         mov esi,ecx
  646.         mov eax,[edi+0]
  647.         mov ecx,[edi+4]
  648.         cmp ecx,0
  649.         je .difference_end ; no div by zero
  650.         imul eax,100
  651.         xor edx,edx
  652.         div ecx
  653.         mov ecx, eax
  654.         sub ecx,100
  655.         mov     [sign],'+'
  656.         cmp ecx,0
  657.         jge @f             ; no need to invert positive rumber
  658.         neg ecx
  659.         mov     [sign],'-'
  660.         @@:    
  661.         cmp ecx,1          ; do not show <=1% results
  662.         jle .difference_end
  663.         cmp ecx,100        ; do not show >=100% results
  664.         je .difference_end
  665.        
  666.         push ecx esi
  667.         add     ebx,(10*8)*65536
  668.         mov ecx,esi
  669.         mov edx,sign
  670.         mov     esi,1
  671.         mcall   4
  672.         pop esi ecx
  673.        
  674.         add     ebx,(1*8)*65536
  675.         mov edx,ebx
  676.         mcall   47, 10000000000001000000000000000000b
  677.                
  678.   .difference_end:
  679.         popa
  680.        
  681.         add     esp,4
  682.  
  683.         add     edi,TEST_REC_SIZE
  684.         add     bx,LINE_HEIGHT
  685.         jmp     .next_result
  686. .exit:
  687.  
  688.  
  689.         mov     ebx, 0*65536+LINE_DESCRIPTION_CHARS*8+5
  690.         mov     ecx, (TESTS_NUM*LINE_HEIGHT+15+27)*65536+LINE_HEIGHT*2
  691.         xor     edx, edx
  692.         mcall   13
  693.  
  694.         mov     ebx, 5*65536+(TESTS_NUM*LINE_HEIGHT+15+27)
  695.         mcall   4,,0x9000CCCC,aLeft
  696.  
  697.         add     ebx, (8*10)*65536
  698.         mcall   ,,0x90FFFF00,comment_string_1
  699.  
  700.         mov     ebx, 5*65536+(TESTS_NUM*LINE_HEIGHT+15+27+LINE_HEIGHT)
  701.         mcall   ,,0x9000CCCC,aRight
  702.  
  703.         add     ebx, (8*10)*65536
  704.         mcall   ,,0x90FFFF00,comment_string_2
  705.         ret
  706. ;---------------------------------------------------------------------
  707. int2str:
  708.         push    eax ecx edx edi
  709.         mov     edi,textarea+7
  710.         mov     dword[textarea+0],'    '
  711.         mov     dword[textarea+4],'    '
  712.         mov     ecx,10
  713. @@:
  714.         xor     edx,edx
  715.         div     ecx
  716.         add     dl,'0'
  717.         mov     [edi],dl
  718.         dec     edi
  719.         or      eax,eax
  720.         jnz     @b
  721.         pop     edi edx ecx eax
  722.         ret
  723. ;---------------------------------------------------------------------
  724. thread_comment:
  725.         or      dword [wFlags],1
  726.         mcall   40,0x80000027
  727.         mov     esi,comment_string_1
  728.         cld
  729. @@:
  730.         lodsb
  731.         test    al,al
  732.         jne     @r
  733.         sub     esi,comment_string_1
  734.         mov     eax,esi
  735.         dec     eax
  736.         mov     edi, edit1
  737.         mov     [edi+48], eax   ;ed_size
  738.         mov     [edi+52], eax   ;ed_pos
  739.        
  740.         mov     esi,comment_string_2
  741.         cld
  742. @@:
  743.         lodsb
  744.         test    al,al
  745.         jne     @r
  746.         sub     esi,comment_string_2
  747.         mov     eax,esi
  748.         dec     eax
  749.         mov     edi, edit2
  750.         mov     [edi+48], eax   ;ed_size
  751.         mov     [edi+52], eax   ;ed_pos
  752.  
  753.         ;---------------------------------------------------------------------
  754. .red:
  755.         call .draw_window
  756. .still:
  757.         mcall   10      ; wait here for event
  758.         cmp     eax,1   ; redraw request ?
  759.         je      .red
  760.         cmp     eax,2   ; key in buffer ?
  761.         je      .key
  762.         cmp     eax,3   ; button in buffer ?
  763.         je      .button
  764.  
  765.         push    dword edit1
  766.         call    [edit_box_mouse]
  767.         push    dword edit2
  768.         call    [edit_box_mouse]
  769.         jmp     .still
  770. ;---------------------------------------------------------------------
  771. .key:           ; key
  772.         mcall   2
  773.         cmp     ah,13
  774.         je      .close  ;.close_with_open_file
  775.         cmp     ah,27
  776.         je      .close
  777.  
  778.         push    dword edit1
  779.         call    [edit_box_key]
  780.         push    dword edit2
  781.         call    [edit_box_key]
  782.         jmp     .still
  783. ;---------------------------------------------------------------------
  784. .button:                ; button
  785.         mcall   17
  786.         cmp     ah,1    ; button id=1 ?
  787.         jne     .still
  788. .close:
  789.         xor     dword [wFlags],1
  790.         mcall   -1
  791. ;---------------------------------------------------------------------
  792. .draw_window:
  793.         mcall   12,1
  794.         xor     eax,eax
  795.         xor     esi,esi
  796.         mcall   ,<110,300>,<120,120>,0x34C0C0C0,,aCommentT ; 0x34780078
  797.         push    dword edit1
  798.         call    [edit_box_draw]
  799.         push    dword edit2
  800.         call    [edit_box_draw]
  801.         mcall   12,2
  802.         ret
  803. ;---------------------------------------------------------------------
  804. locLoadFile:
  805.         mov     [stFileInfoBlock], 0
  806.         or      dword [wFlags],1
  807.         mcall   70,stFileInfoBlock
  808.         mov     esi,mgb_data
  809.         mov     edi,results_table+4
  810.         cld
  811. @@:
  812.         cmp     dword[edi+TEST_REC_SIZE-8],0
  813.         je      @f
  814.         movsd
  815.         add     edi,TEST_REC_SIZE-4
  816.         jmp     @b
  817. @@:
  818.         mov     edi,comment_string_2
  819.         mov     ecx,44
  820.         rep     movsb
  821.         ret
  822. ;---------------------------------------------------------------------
  823. locSaveFile:
  824.         mov     [stFileInfoBlock], 2
  825.         or      dword [wFlags],1
  826.         mov     esi,results_table ;+4 to save Right Bar
  827.         mov     edi,mgb_data
  828.         cld
  829. @@:
  830.         cmp     dword[esi+TEST_REC_SIZE-8],0
  831.         je      @f
  832.         movsd
  833.         add     esi,TEST_REC_SIZE-4
  834.         jmp     @b
  835. @@:
  836.         mov     esi,comment_string_2
  837.         mov     ecx,44
  838.         rep     movsb
  839.         mcall   70,stFileInfoBlock
  840.         ret
  841. ;---------------------------------------------------------------------
  842. align 4
  843. stFileInfoBlock dd 0,0,0
  844. dwDataSize      dd TESTS_NUM*4+44       ;1
  845.                 dd mgb_data
  846.                 db 0
  847.                 dd fname_buf
  848. ;---------------------------------------------------------------------
  849. wFlags          dd 0
  850. ;---------------------------------------------------------------------
  851. align 4
  852. results_table dd \
  853.         ?,?,testDrawWindow,aDrawingWindow,\
  854.         ?,?,testDrawBar,aDrawingBar,\
  855.         ?,?,testGetScreen_f36,aGetScreenF36,\
  856.         ?,?,testGetScreen_GS,aGetScreen_GS,\
  857.         ?,?,testDrawPicture,aDrawingPicture,\
  858.         ?,?,testDrawPicture_f73,aDrawingPictF73,\
  859.         ?,?,testDrawVertLine,aDrawingVLine,\
  860.         ?,?,testDrawHorzLine,aDrawingHLine,\
  861.         ?,?,testDrawFreeLine,aDrawingFLine,\
  862.         ?,?,testDrawText1,aDrawingText1,\
  863.         ?,?,testDrawText1m,aDrawingText1m,\
  864.         ?,?,testDrawText2,aDrawingText2,\
  865.         ?,?,testDrawText2m,aDrawingText2m,\
  866.         ?,?,testDrawNumber,aDrawingNumber,\
  867.         ?,?,testDrawPixel,aDrawingPixel,\
  868.         0,0,0,0
  869. ;---------------------------------------------------------------------
  870. LINE_HEIGHT   = 17
  871. TEST_REC_SIZE = 16
  872. LINE_DESCRIPTION_CHARS = 58
  873. TESTS_NUM     = ($ - results_table) / TEST_REC_SIZE - 1
  874. ;---------------------------------------------------------------------
  875. if lang eq it
  876.         aDrawingWindow  db 'Window Of Type #3, 325x400 px',0
  877.         aDrawingBar     db 'Filled Rectangle, 100x250 px',0
  878.         aDrawingPicture db 'Picture, 90x123, px',0
  879.         aDrawingPictF73 db 'Picture for Blitter, 90x123, px',0
  880.         aGetScreenF36   db 'Get a piece of screen f.36, 90x123, px',0
  881.         aGetScreen_GS   db 'Get a piece of screen GS, 90x123, px',0
  882.         aDrawingVLine   db 'Linea verticale, 350 px',0
  883.         aDrawingHLine   db 'Linea orizzontale, 270 px',0
  884.         aDrawingFLine   db 'Free-angled Line, 350 px',0
  885.         aDrawingText1   db 'Fixed-width Text, 34 chars',0
  886.         aDrawingText1m  db 'Fixed-width Text(m), 34 chars',0
  887.         aDrawingText2   db 'Proportional Text, 34 chars',0
  888.         aDrawingText2m  db 'Proportional Text(m), 34 chars',0
  889.         aDrawingNumber  db 'Decimal Number, 8 digits',0
  890.         aDrawingPixel   db 'Singolo pixel',0
  891.  
  892.         aTestText    db 'This is a 34-charachters test text'
  893.         aButtonsText db 'Test      Commenti      Apri        Salva      Move >',0
  894.         aCaption     db 'Kolibri Graphical Benchmark 0.9',0
  895.  
  896.         aLeft   db 'Sinistra:',0
  897.         aRight  db 'Destra  :',0
  898.  
  899.         aComment1       db 'Attuale test',0
  900.         aComment2       db 'previous test',0
  901.         aCommentT       db 'Commenti',0
  902. else if lang eq ru
  903.         aDrawingWindow  db '‘¨á⥬­®¥ ®ª­® ᮠ᪨­®¬, 325x400 px',0
  904.         aDrawingBar     db '‡ ªà è¥­­ë© ¯àאַ㣮«ì­¨ª, 100x250 px',0
  905.         aDrawingPicture db 'Š à⨭ª , 90x123, px',0
  906.         aDrawingPictF73 db 'Š à⨭ª  ¤«ï ¡«¨ââ¥à , 90x123, px',0
  907.         aGetScreenF36   db '—⥭¨¥ íªà ­  ¨§ ¢¨¤¥®¯ ¬ïâ¨, 90x123, px',0
  908.         aGetScreen_GS   db '—⥭¨¥ íªà ­  ¨§ ¢¨¤¥®ª àâë, 90x123, px',0
  909.         aDrawingVLine   db '®«ì訩 ª â¥â, 350 px',0
  910.         aDrawingHLine   db 'Œ¥­ì訩 ª â¥â, 270 px',0
  911.         aDrawingFLine   db 'ƒ¨¯®â¥­ã§ , 350 px',0
  912.         aDrawingText1   db '‘¨á⥬­ë© ⥪áâ ¬ «¥­ìª¨©, 34 §­ ª ',0
  913.         aDrawingText1m  db '‘¨á⥬­ë© ⥪áâ ¬ «¥­ìª¨© (¡ãä), 34 §­ ª ',0
  914.         aDrawingText2   db '‘¨á⥬­ë© ⥪áâ ¡®«ì让, 34 §­ ª ',0
  915.         aDrawingText2m  db '‘¨á⥬­ë© ⥪áâ ¡®«ì让 (¡ãä), 34 §­ ª ',0
  916.         aDrawingNumber  db '„¥áïâ¨ç­®¥ ç¨á«®, 8 æ¨äà',0
  917.         aDrawingPixel   db 'Ž¤¨­®ç­ë© ¯¨ªá¥«ì',0
  918.  
  919.         aTestText    db 'This is a 34-charachters test text'
  920.         aButtonsText db '’¥áâ       §¢ ­¨ï    ˆ§ ä ©«      ‚ ä ©«     ‚¯à ¢® >',0
  921.         aCaption     db 'ƒà ä¨ç¥áª¨© ¡¥­ç¬ àª ¤«ï Š®«¨¡à¨ v0.9',0
  922.  
  923.         aLeft   db '‘«¥¢ :',0
  924.         aRight  db '‘¯à ¢ :',0
  925.  
  926.         aComment1       db 'íâ®â â¥áâ',0
  927.         aComment2       db '¯à¥¤ë¤ã騩 â¥áâ',0
  928.         aCommentT       db '¥¤ ªâ¨à®¢ âì ª®¬¬¥­â à¨¨',0
  929. else
  930.         aDrawingWindow  db 'Window Of Type #3, 325x400 px',0
  931.         aDrawingBar     db 'Filled Rectangle, 100x250 px',0
  932.         aDrawingPicture db 'Picture, 90x123, px',0
  933.         aDrawingPictF73 db 'Picture for Blitter, 90x123, px',0
  934.         aGetScreenF36   db 'Get a piece of screen f.36, 90x123, px',0
  935.         aGetScreen_GS   db 'Get a piece of screen GS, 90x123, px',0
  936.         aDrawingVLine   db 'Vertical Line, 350 px',0
  937.         aDrawingHLine   db 'Horizontal Line, 270 px',0
  938.         aDrawingFLine   db 'Free-angled Line, 350 px',0
  939.         aDrawingText1   db 'Fixed-width Text, 34 chars',0
  940.         aDrawingText1m  db 'Fixed-width Text(mem), 34 chars',0
  941.         aDrawingText2   db 'Proportional Text, 34 chars',0
  942.         aDrawingText2m  db 'Proportional Text(mem), 34 chars',0
  943.         aDrawingNumber  db 'Decimal Number, 8 digits',0
  944.         aDrawingPixel   db 'Single Pixel',0
  945.  
  946.         aTestText    db 'This is a 34-charachters test text'
  947.         aButtonsText db 'Test      Comments      Open        Save       Move >',0
  948.         aCaption     db 'Kolibri Graphical Benchmark 0.9',0
  949.  
  950.         aLeft   db 'Left    :',0
  951.         aRight  db 'Right   :',0
  952.  
  953.         aComment1       db 'current test',0
  954.         aComment2       db 'previous test',0
  955.         aCommentT       db 'Edit comments',0
  956. end if
  957. ;---------------------------------------------------------------------
  958. system_dir_Boxlib       db '/sys/lib/box_lib.obj',0
  959. system_dir_ProcLib      db '/sys/lib/proc_lib.obj',0
  960. ;---------------------------------------------------------------------
  961. head_f_i:
  962. if lang eq it
  963.         head_f_l        db 'Errore Sistema',0
  964. else
  965.         head_f_l        db 'System error',0
  966. end if
  967.  
  968. err_message_found_lib1  db 'box_lib.obj - Not found!',0
  969. err_message_found_lib2  db 'proc_lib.obj - Not found!',0
  970.  
  971. err_message_import1     db 'box_lib.obj - Wrong import!',0
  972. err_message_import2     db 'proc_lib.obj - Wrong import!',0
  973. ;---------------------------------------------------------------------
  974. align 4
  975. l_libs_start:
  976.  
  977. library01  l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \
  978. err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
  979.  
  980. library02  l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
  981. err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
  982.  
  983. end_l_libs:
  984. ;---------------------------------------------------------------------
  985. align 4
  986. OpenDialog_data:
  987. .type                   dd 1    ; Save
  988. .procinfo               dd procinfo     ;+4
  989. .com_area_name          dd communication_area_name      ;+8
  990. .com_area               dd 0    ;+12
  991. .opendir_pach           dd temp_dir_pach        ;+16
  992. .dir_default_pach       dd communication_area_default_pach      ;+20
  993. .start_path             dd open_dialog_path     ;+24
  994. .draw_window            dd draw_window  ;+28
  995. .status                 dd 0    ;+32
  996. .openfile_pach          dd fname_buf    ;+36
  997. .filename_area          dd filename_area        ;+40
  998. .filter_area            dd Filter
  999. .x:
  1000. .x_size                 dw 420 ;+48 ; Window X size
  1001. .x_start                dw 10 ;+50 ; Window X position
  1002. .y:
  1003. .y_size                 dw 320 ;+52 ; Window y size
  1004. .y_start                dw 10 ;+54 ; Window Y position
  1005.  
  1006. communication_area_name:
  1007.         db 'FFFFFFFF_open_dialog',0
  1008. open_dialog_path:
  1009. if __nightbuild eq yes
  1010.         db '/sys/MANAGERS/opendial',0
  1011. else
  1012.         db '/sys/File Managers/opendial',0
  1013. end if
  1014. communication_area_default_pach:
  1015.         db '/sys/',0
  1016.  
  1017. Filter:
  1018. dd      Filter.end - Filter
  1019. .1:
  1020. db      'MGB',0
  1021. .end:
  1022. db      0
  1023.  
  1024. sign db ?,0
  1025.  
  1026. start_temp_file_name:   db 'results.mgb',0
  1027.  
  1028. path4   db '/sys/results.mgb',0
  1029. ;---------------------------------------------------------------------
  1030. align 4
  1031. params_f73:
  1032. ; destination
  1033. .offset_X_dest  dd 0    ; +0
  1034. .offset_Y_dest  dd 0    ; +4
  1035. .width_dest     dd 90   ; +8
  1036. .height_dest    dd 123  ; +12
  1037. ; source
  1038. .offset_X_src   dd 0    ; +16
  1039. .offset_Y_src   dd 0    ; +20
  1040. .width_src      dd 90   ; +24
  1041. .height_src     dd 123  ; +28
  1042. ; other
  1043. .pointer        dd .data; 90*4  ; +32
  1044. .row_size       dd 90*4 ; +36
  1045. ;---------------------------------------------------------------------
  1046. align 4
  1047. ProcLib_import:
  1048. OpenDialog_Init         dd aOpenDialog_Init
  1049. OpenDialog_Start        dd aOpenDialog_Start
  1050. ;OpenDialog__Version    dd aOpenDialog_Version
  1051.         dd 0,0
  1052. aOpenDialog_Init        db 'OpenDialog_init',0
  1053. aOpenDialog_Start       db 'OpenDialog_start',0
  1054. ;aOpenDialog_Version    db 'Version_OpenDialog',0
  1055. ;---------------------------------------------------------------------
  1056. align 4
  1057. Box_lib_import:
  1058. ;init_lib               dd a_init
  1059. ;version_lib            dd a_version
  1060.  
  1061.  
  1062. edit_box_draw           dd aEdit_box_draw
  1063. edit_box_key            dd aEdit_box_key
  1064. edit_box_mouse          dd aEdit_box_mouse
  1065. ;version_ed             dd aVersion_ed
  1066.  
  1067. ;check_box_draw         dd aCheck_box_draw
  1068. ;check_box_mouse        dd aCheck_box_mouse
  1069. ;version_ch             dd aVersion_ch
  1070.  
  1071. ;option_box_draw        dd aOption_box_draw
  1072. ;option_box_mouse       dd aOption_box_mouse
  1073. ;version_op             dd aVersion_op
  1074.  
  1075. ;scrollbar_ver_draw     dd aScrollbar_ver_draw
  1076. ;scrollbar_ver_mouse    dd aScrollbar_ver_mouse
  1077. ;scrollbar_hor_draw     dd aScrollbar_hor_draw
  1078. ;scrollbar_hor_mouse    dd aScrollbar_hor_mouse
  1079. ;version_scrollbar      dd aVersion_scrollbar
  1080.  
  1081. ;dinamic_button_draw    dd aDbutton_draw
  1082. ;dinamic_button_mouse   dd aDbutton_mouse
  1083. ;version_dbutton        dd aVersion_dbutton
  1084.  
  1085. ;menu_bar_draw          dd aMenu_bar_draw
  1086. ;menu_bar_mouse         dd aMenu_bar_mouse
  1087. ;menu_bar_activate      dd aMenu_bar_activate
  1088. ;version_menu_bar       dd aVersion_menu_bar
  1089.  
  1090. ;FileBrowser_draw       dd aFileBrowser_draw
  1091. ;FileBrowser_mouse      dd aFileBrowser_mouse
  1092. ;FileBrowser_key        dd aFileBrowser_key
  1093. ;Version_FileBrowser    dd aVersion_FileBrowser
  1094.  
  1095. ;PathShow_prepare       dd sz_PathShow_prepare
  1096. ;PathShow_draw          dd sz_PathShow_draw
  1097. ;Version_path_show      dd szVersion_path_show
  1098.                         dd 0,0
  1099.  
  1100. ;a_init                 db 'lib_init',0
  1101. ;a_version              db 'version',0
  1102.  
  1103. aEdit_box_draw          db 'edit_box_draw',0
  1104. aEdit_box_key           db 'edit_box_key',0
  1105. aEdit_box_mouse         db 'edit_box_mouse',0
  1106. ;aVersion_ed            db 'version_ed',0
  1107.  
  1108. ;aCheck_box_draw        db 'check_box_draw',0
  1109. ;aCheck_box_mouse       db 'check_box_mouse',0
  1110. ;aVersion_ch            db 'version_ch',0
  1111.  
  1112. ;aOption_box_draw       db 'option_box_draw',0
  1113. ;aOption_box_mouse      db 'option_box_mouse',0
  1114. ;aVersion_op            db 'version_op',0
  1115.  
  1116. ;aScrollbar_ver_draw    db 'scrollbar_v_draw',0
  1117. ;aScrollbar_ver_mouse   db 'scrollbar_v_mouse',0
  1118. ;aScrollbar_hor_draw    db 'scrollbar_h_draw',0
  1119. ;aScrollbar_hor_mouse   db 'scrollbar_h_mouse',0
  1120. ;aVersion_scrollbar     db 'version_scrollbar',0
  1121.  
  1122. ;aDbutton_draw          db 'dbutton_draw',0
  1123. ;aDbutton_mouse         db 'dbutton_mouse',0
  1124. ;aVersion_dbutton       db 'version_dbutton',0
  1125.  
  1126. ;aMenu_bar_draw         db 'menu_bar_draw',0
  1127. ;aMenu_bar_mouse                db 'menu_bar_mouse',0
  1128. ;aMenu_bar_activate     db 'menu_bar_activate',0
  1129. ;aVersion_menu_bar      db 'version_menu_bar',0
  1130.  
  1131. ;aFileBrowser_draw      db 'FileBrowser_draw',0
  1132. ;aFileBrowser_mouse     db 'FileBrowser_mouse',0
  1133. ;aFileBrowser_key       db 'FileBrowser_key',0
  1134. ;aVersion_FileBrowser   db 'version_FileBrowser',0
  1135.  
  1136. ;sz_PathShow_prepare    db 'PathShow_prepare',0
  1137. ;sz_PathShow_draw       db 'PathShow_draw',0
  1138. ;szVersion_path_show    db 'version_PathShow',0
  1139. ;---------------------------------------------------------------------
  1140. ; for EDITBOX
  1141. align 4
  1142. editboxes:
  1143. edit1 edit_box 260,12,15,0xffffff,0xbbddff,0xFF00FF,0x7F7F7F,\
  1144.         0x90000000,43,comment_string_1,0,ed_focus,0
  1145. edit2 edit_box 260,12,50,0xffffff,0xbbddff,0xFF00FF,0x7F7F7F,\
  1146.         0x90000000,43,comment_string_2,0,0,0
  1147. editboxes_end:
  1148. ;---------------------------------------------------------------------
  1149.  
  1150. IM_END:
  1151. align 4
  1152. area_for_f36    rd 1
  1153. dwTestEndTime   rd 1
  1154. dwMainPID       rd 1
  1155. ;-----------------------------------------------------------------------------
  1156. text_scren_buffer       rd 1
  1157. text_scren_buffer2      rd 1
  1158. ;---------------------------------------------------------------------
  1159. textarea:
  1160.         rb 8
  1161. ;---------------------------------------------------------------------
  1162. comment_string_1:
  1163.         rb 44
  1164. ;---------------------------------------------------------------------
  1165. comment_string_2:
  1166.         rb 44
  1167. ;---------------------------------------------------------------------
  1168. mgb_data:
  1169.         rb 100
  1170. ;---------------------------------------------------------------------
  1171. procinfo:
  1172.         rb 1024
  1173. ;---------------------------------------------------------------------
  1174. cur_dir_path:
  1175.         rb 4096
  1176. ;---------------------------------------------------------------------
  1177. library_path:
  1178.         rb 4096
  1179. ;---------------------------------------------------------------------
  1180. temp_dir_pach:
  1181.         rb 4096
  1182. ;---------------------------------------------------------------------
  1183. fname_buf:
  1184.         rb 4096
  1185. ;---------------------------------------------------------------------
  1186. filename_area:
  1187.         rb 256
  1188. ;---------------------------------------------------------------------
  1189. align 4
  1190.         rb 4096
  1191. thread_stack2:
  1192. ;---------------------------------------------------------------------
  1193. align 4
  1194.         rb 4096
  1195. thread_stack1:
  1196. ;---------------------------------------------------------------------
  1197. align 4
  1198.         rb 4096
  1199. stacktop:
  1200. params_f73.data rb 123*90*4
  1201. I_END:
  1202.