Subversion Repositories Kolibri OS

Rev

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