Subversion Repositories Kolibri OS

Rev

Rev 7449 | Rev 8236 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;      h2d2b v0.5 big fonts by Leency      ;;
  2. ;;      09.11.2016                          ;;
  3.  
  4. ;;      h2d2b v0.4 use editbox by IgorA     ;;
  5. ;;      30.08.2011                          ;;
  6.  
  7. ;;      h2d2b v0.3 system colors by Leency  ;;
  8. ;;      21.08.2011                          ;;
  9.  
  10. ;;      hex2dec2bin 0.2 by Alexei Ershov    ;;
  11. ;;      16.11.2006                          ;;
  12.  
  13. WIN_W = 364
  14.  
  15. use32
  16.     org 0x0
  17.     db  'MENUET01'
  18.     dd  0x01,start,i_end,e_end,e_end,0,sys_path
  19.  
  20. include '../../../proc32.inc'
  21. include '../../../macros.inc' ; ¬ ªà®áë ®¡«¥£ç îâ ¦¨§­ì  áᥬ¡«¥à騪®¢!
  22. include '../../../develop/libraries/box_lib/load_lib.mac'
  23. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  24. include 'lang.inc'
  25.  
  26. @use_library
  27.  
  28. start:
  29.         load_libraries l_libs_start,l_libs_end
  30.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  ¡¨¡«¨®â¥ª 
  31.         mov     ebp,lib_0
  32.         cmp     dword [ebp+ll_struc_size-4],0
  33.         jz      @f
  34.                 mcall -1 ;exit not correct
  35.         @@:
  36.         mcall 40,0x80000027
  37.         mcall 48, 3, sys_colors, 40
  38.         edit_boxes_set_sys_color edit1,editboxes_end,sys_colors
  39.  
  40. red:
  41.     call draw_window
  42.  
  43. still:
  44.     mcall 10            ; äã­ªæ¨ï 10 - ¦¤ âì ᮡëâ¨ï
  45.  
  46.     cmp  eax,1          ; ¯¥à¥à¨á®¢ âì ®ª­® ?
  47.     je   red            ; ¥á«¨ ¤  - ­  ¬¥âªã red
  48.     cmp  eax,2          ; ­ ¦ â  ª« ¢¨è  ?
  49.     je   key            ; ¥á«¨ ¤  - ­  key
  50.     cmp  eax,3          ; ­ ¦ â  ª­®¯ª  ?
  51.     je   button         ; ¥á«¨ ¤  - ­  button
  52.     cmp  eax,6
  53.     je   mouse
  54.  
  55.     jmp  still          ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
  56.  
  57. ;---------------------------------------------------------------------
  58.  
  59. key:                   ; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
  60.     mcall 2
  61.         cmp ah,13 ;®¡à ¡®âª  ª­®¯ª¨ Enter
  62.         je @f
  63.                 stdcall [edit_box_key], dword edit1
  64.                 jmp still
  65.         @@:
  66.         mov edi,string1
  67.         add edi,[edit1.size] ;ãáâ ­ ¢«¨¢ ¥¬ ¢ edi ª®­¥æ áâப¨
  68.         jmp read_str
  69.     jmp still           ; ¢¥à­ãâìáï ª ­ ç «ã 横« 
  70.  
  71. read_str:
  72.     dec   edi
  73.     mov   esi, string1
  74.  
  75.     call  GetBase
  76.  
  77.     xor   ecx, ecx
  78.     inc   ecx           ; ecx = 1
  79.  
  80. make_bin:
  81.     xor   eax, eax
  82.  
  83. next_digit:
  84.     xor   edx, edx
  85.     cmp   edi, esi
  86.     jb    .done
  87.  
  88.     mov   dl, [edi]
  89.     cmp   dl, '-'
  90.     jne   @f
  91.     neg   eax
  92.     jmp   .done
  93. @@:
  94.     cmp   dl, 'F'
  95.     jbe   @f
  96.     and   dl, 11011111b
  97. @@:
  98.     sub   dl, '0'
  99.     cmp   dl, 9
  100.     jbe   @f
  101.     sub   dl, 'A'-'9'-1
  102. @@:
  103.     cmp   dl, bl
  104.     jb    @f
  105.     ; ‡¤¥áì ®¡à ¡®â âì ®è¨¡ªã
  106.  
  107.     jmp   .done
  108. @@:
  109.     push  ecx
  110.     xchg  eax, ecx
  111.     mul   edx ;        edx:eax = eax * edx
  112.     add   ecx, eax
  113.     pop   eax
  114.     mul   ebx
  115.     xchg  eax, ecx
  116.     dec   edi
  117.     jmp   next_digit
  118.  
  119. .done:
  120.    mov    [num], eax    ; á®å࠭塞 ¢¢¥¤¥­­®¥ ç¨á«®
  121.    jmp    red
  122.  
  123. ;---------------------------------------------------------------------
  124.  
  125. button:
  126.         mcall 17                ; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
  127.         cmp   ah, 1     ; ¥á«¨ … ­ ¦ â  ª­®¯ª  á ­®¬¥à®¬ 1,
  128.         jne   @f
  129.                 mcall -1
  130.         @@:
  131.         cmp ah, 2
  132.         jne @f
  133.                 shl [num], 1
  134.                 jmp red
  135.         @@:
  136.         cmp ah, 3
  137.         jne @f
  138.                 shr [num], 1
  139.                 jmp red
  140.         @@:
  141.         cmp ah, 4
  142.         jne @f
  143.                 sar [num], 1
  144.                 jmp red
  145.         @@:
  146.         cmp ah, 5
  147.         jne @f
  148.                 mov edi,string1
  149.                 add edi,[edit1.size] ;ãáâ ­ ¢«¨¢ ¥¬ ¢ edi ª®­¥æ áâப¨
  150.                 jmp read_str
  151.                 ;jmp red
  152.         @@:
  153.         jmp still
  154.  
  155. mouse:
  156.         stdcall [edit_box_mouse], edit1
  157.         jmp still
  158.  
  159. ;------------------------------------------------
  160.     draw_window:
  161. ;------------------------------------------------
  162.         mcall   48, 3, sys_colors, 40
  163.  
  164.     mcall 12, 1
  165.         mov     edx, 0x14000000
  166.         or      edx, [sys_colors.work]
  167.         ;mov    esi, 0x80000000
  168.         ;or     esi, [sys_colors.grab_text]
  169.     mcall 0, 200*65536+WIN_W, 200*65536+179, ,,title
  170.  
  171.        
  172.     mcall  8,         15*65536+42,106*65536+ 21, 2, [sys_colors.work_button] ; ª­®¯ª  shl
  173.     mcall   ,         70*65536+42,             ,  , ; ª­®¯ª  sal
  174.     mcall   , (WIN_W-55)*65536+42,             , 3, ; ª­®¯ª  shr
  175.     mcall   ,(WIN_W-111)*65536+42,             , 4, ; ª­®¯ª  sar
  176.     mcall   , (WIN_W-72)*65536+58,145*65536+ 21, 5, ; ª­®¯ª  Ok
  177.  
  178.         mov     ecx, 0x90000000
  179.         or      ecx, [sys_colors.work_text]
  180.     mcall  4, 15*65536+30,   , binstr,
  181.     mcall   , 15*65536+46,   , decstr,
  182.     mcall   , 15*65536+62,   ,sdecstr,
  183.     mcall   , 15*65536+78,   , hexstr,
  184.     mcall   , 15*65536+150,  , numstr,
  185.  
  186.         mov     ecx, 0x90000000
  187.         or      ecx, [sys_colors.work_button_text]
  188.     mcall  , 23*65536+109, , shl_sal_sar_shr_button_caption
  189.         mcall  , (WIN_W-59)*65536+149,  , Okstr,
  190.     mov    ecx, [num]
  191.  
  192.         mov esi, [sys_colors.work_text]
  193.         or  esi, 0x90000000
  194.  
  195.     mcall  47, 10*65536,   ,(WIN_W-92)*65536+62,    ; 10-­ ï á® §­ ª®¬
  196.         BIN_LINE_BLOCK_W = 76
  197.     mcall 47, 8*65536+512,,(WIN_W-BIN_LINE_BLOCK_W)*65536+30 ; 2-­ ï   
  198.     ror    ecx, 8
  199.         mov    edx, (WIN_W-BIN_LINE_BLOCK_W*2)*65536+30
  200.         mcall
  201.     ror    ecx, 8
  202.     mov    edx, (WIN_W-BIN_LINE_BLOCK_W*3)*65536+30
  203.         mcall
  204.     ror    ecx, 8
  205.     mov    edx, (WIN_W-BIN_LINE_BLOCK_W*4)*65536+30
  206.         mcall
  207.     ror    ecx, 8
  208.     mov    [minus], '+'
  209.     jnc    @f
  210.     mov    [minus], '-'
  211.     neg    ecx
  212. @@:
  213.     mcall   , 10*65536,   ,(WIN_W-92)*65536+46,    ; 10-­ ï
  214.         mcall   , 8*65536+256,,(WIN_W-76)*65536+78,    ; 16-­ ï
  215.         mov   ecx,esi
  216.     mcall  4, (WIN_W-102)*65536+61, , minus, 1
  217.     mcall 38, 15*65536+WIN_W-15, 137*65536+137, [sys_colors.work_graph]
  218.         stdcall [edit_box_draw], edit1
  219.     mcall 12, 2                    ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
  220.  
  221. ret
  222.  
  223.  
  224. ;-------------------------------------------------
  225.     GetBase:
  226. ;-------------------------------------------------
  227.     mov   ebx, 10
  228.     cmp   edi, esi
  229.     jb    .done
  230.  
  231.     mov   al, [edi]
  232.     cmp   al, 'H'
  233.     jbe   @f
  234.     and   al, 11011111b
  235. @@:
  236.     cmp   al, 'H'
  237.     jne   @f
  238.     mov   ebx, 16
  239.     dec   edi
  240.     jmp   .done
  241.  
  242. @@:
  243.     cmp   al, 'D'
  244.     jne   @f
  245.     mov   ebx, 10
  246.     dec   edi
  247.     jmp   .done
  248.  
  249. @@:
  250.     cmp   al, 'B'
  251.     jne   .done
  252.     mov   ebx, 2
  253.     dec   edi
  254.  
  255. .done:
  256. ret
  257.  
  258. ;-------------------------------------------------
  259. string1:
  260.   db  34 dup(' ')
  261. string1_end:
  262.   num   dd  0
  263.  
  264.  
  265.  title db 'hex2dec2bin 0.5',0
  266.  minus  db '-',0
  267.  hexstr db 'hex:',0
  268.  binstr db 'bin:',0
  269.  decstr db 'dec:',0
  270.  sdecstr db 'signed dec:',0
  271.  shl_sal_sar_shr_button_caption db 'shl    sal                    sar    shr',0
  272.  
  273. if lang eq ru
  274.         numstr db '—¨á«®:',0
  275.         Okstr db '‚¢®¤',0
  276.         head_f_i:
  277.         head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
  278. else
  279.         numstr db 'Number:',0
  280.         Okstr db 'Enter',0
  281.         head_f_i:
  282.         head_f_l db 'System error',0
  283. end if
  284.  
  285. mouse_dd dd 0
  286. edit1 edit_box (WIN_W-67-82), 67, 146, 0xffffff, 0xff, 0x80ff, 0, 0x90000000, (string1_end-string1), string1 , mouse_dd, ed_focus+ed_always_focus
  287.  
  288. editboxes_end:
  289.  
  290. system_dir_0 db '/sys/lib/'
  291. lib_name_0 db 'box_lib.obj',0
  292. err_msg_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,0
  293. err_msg_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,0
  294.  
  295. l_libs_start:
  296.         lib_0 l_libs lib_name_0, sys_path, library_path, system_dir_0,\
  297.                 err_msg_found_lib_0,head_f_l,import_box_lib,err_msg_import_0,head_f_i
  298. l_libs_end:
  299.  
  300. align 4
  301. import_box_lib:
  302.         ;dd sz_init1
  303.         edit_box_draw dd sz_edit_box_draw
  304.         edit_box_key dd sz_edit_box_key
  305.         edit_box_mouse dd sz_edit_box_mouse
  306.         ;edit_box_set_text dd sz_edit_box_set_text
  307. dd 0,0
  308.         ;sz_init1 db 'lib_init',0
  309.         sz_edit_box_draw db 'edit_box',0
  310.         sz_edit_box_key db 'edit_box_key',0
  311.         sz_edit_box_mouse db 'edit_box_mouse',0
  312.         ;sz_edit_box_set_text db 'edit_box_set_text',0
  313.  
  314. i_end:
  315.  sys_colors             system_colors
  316.  rb 0x400                                       ;stack
  317.  sys_path rb 4096
  318.  library_path rb 4096
  319. e_end:                             ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë
  320.