Subversion Repositories Kolibri OS

Rev

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

  1. idbChange       equ 2
  2. idbCreate       equ 3
  3. idbLeft         equ 4
  4. idbRight        equ 5
  5. idbCancel       equ 1
  6.  
  7. DlgAdd:
  8. DlgProp:
  9.  
  10.         mov     eax,[SelIcon]
  11.         mov     [DlgSelIcon],eax
  12.         cmp     eax,-1
  13.         jne     SetProp
  14.  
  15.     ;-----------
  16.         mov     eax,[MouseX]
  17.         mov     ebx,[MouseY]
  18.  
  19.         cmp     ax,[wsX]
  20.         jae     @f
  21.         mov     ax,[wsX]
  22.       @@:
  23.  
  24.         cmp     bx,[wsY]
  25.         jae     @f
  26.         mov     bx,[wsY]
  27.       @@:                           ;eax,ebx - ॠ«ì­ ï ª®®à¤¨­ â . ‚ᥠª®®à¤¨­ âë ¢ ¯à®£¥ ®â­®á¨â¥«ì­® «¥¢®£® ¢¥àå­¥£® 㣫  à ¡®ç¥© ®¡« áâ¨
  28.  
  29.         xor     edx,edx
  30.         mov     dx,[wsXe]
  31.         sub     edx,ICON_SIZE
  32.         cmp     eax,edx
  33.         jbe     @f
  34.         mov     eax,edx
  35.       @@:
  36.  
  37.         mov     dx,[wsYe]
  38.         sub     edx,ICON_SIZE
  39.         cmp     ebx,edx
  40.         jbe     @f
  41.         mov     ebx,edx
  42.       @@:
  43.  
  44.         xor     edx,edx              ;¯à¥®¡à §®¢ë¢ ¥¬ ¢ ®â­®á¨â¥«ì­ë¥
  45.         mov     dx,[wsW]
  46.         shr     edx,1
  47.         add     dx,[wsX]
  48.         cmp     eax,edx
  49.         jbe     @f
  50.         sub     ax,[wsXe]
  51.         inc     ax
  52.         jmp     .dlg1
  53.       @@:
  54.         sub     ax,[wsX]
  55.     .dlg1:
  56.  
  57.         xor     edx,edx
  58.         mov     dx,[wsH]
  59.         shr     edx,1
  60.         add     dx,[wsY]
  61.         cmp     ebx,edx
  62.         jbe     @f
  63.         sub     bx,[wsYe]
  64.         inc     bx
  65.         jmp     .dlg2
  66.       @@:
  67.         sub     bx,[wsY]
  68.     .dlg2:
  69.  
  70.         mov     [AddX],eax
  71.         mov     [AddY],ebx
  72.     ;-----------
  73.  
  74.         mov     ecx,NAME_LENGTH
  75.         mov     edi,DAreaName
  76.         xor     al,al
  77.         rep     stosb
  78.         mov     dword[edtName.size],0
  79.         mov     dword[edtName.pos],0
  80.  
  81.         mov     ecx,256
  82.         mov     edi,DAreaPath
  83.         rep     stosb
  84.         mov     dword[edtExePath.size],0
  85.         mov     dword[edtExePath.pos],0
  86.  
  87.         mov     ecx,256
  88.         mov     edi,DAreaParams
  89.         rep     stosb
  90.         mov     dword[edtParams.size],0
  91.         mov     dword[edtParams.pos],0
  92.  
  93.         mov     ecx,256
  94.         mov     edi,DAreaIcon
  95.  
  96.         mov     [DAreaIcon],'0'
  97.         mov     dword[edtIcon.size],1
  98.         mov     dword[edtIcon.pos],1
  99.  
  100.         jmp     startDlg
  101.     ;--------
  102. SetProp:
  103.         mov     esi,[IconsOffs+eax*4]
  104.         mov     edi,DAreaName
  105.         xor     ecx,ecx
  106.      @@:
  107.         lodsb
  108.         stosb
  109.         inc     ecx
  110.         test    al,al
  111.         jnz     @b
  112.         dec     ecx
  113.         mov     dword[edtName.size],ecx
  114.         mov     dword[edtName.pos],ecx
  115.  
  116.         xor     ecx,ecx
  117.         mov     edi,DAreaPath
  118.      @@:
  119.         lodsb
  120.         stosb
  121.         inc     ecx
  122.         test    al,al
  123.         jnz     @b
  124.         dec     ecx
  125.         mov     dword[edtExePath.size],ecx
  126.         mov     dword[edtExePath.pos],ecx
  127.  
  128.         xor     ecx,ecx
  129.         mov     edi,DAreaParams
  130.      @@:
  131.         lodsb
  132.         stosb
  133.         inc     ecx
  134.         test    al,al
  135.         jnz     @b
  136.         dec     ecx
  137.         mov     dword[edtParams.size],ecx
  138.         mov     dword[edtParams.pos],ecx
  139.  
  140.         xor     ecx,ecx
  141.         mov     edi,DAreaIcon
  142.      @@:
  143.         lodsb
  144.         stosb
  145.         inc     ecx
  146.         test    al,al
  147.         jnz     @b
  148.         dec     ecx
  149.         mov     dword[edtIcon.size],ecx
  150.         mov     dword[edtIcon.pos],ecx
  151.  
  152.  
  153. startDlg:
  154.         mcall   9,RBProcInfo,-1
  155.         mcall   18,21,dword[RBProcInfo+30]
  156.         mov     [slotDlgAdd],eax
  157.  
  158.         or      [edtName.flags],ed_focus
  159.  
  160.         mcall   40,EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER
  161.         xor     eax,eax
  162.         mov     dword[MaxPage],0
  163.       @@:
  164.         add     eax,ICONS_DRAW_COUNTW
  165.         inc     dword[MaxPage]
  166.         cmp     eax,[icon_count]
  167.         jb      @b
  168.         dec     dword[MaxPage]
  169.         cmp     dword[MaxPage],0
  170.         jne     @f
  171.         mov     dword[MaxPage],1
  172.       @@:
  173.  
  174. DReDraw:
  175.         mcall   48,3,sc,40
  176.  
  177.         mov     eax,[sc.work]
  178.         rol     eax,16
  179.         add     al,9
  180.         jnc     @f
  181.         mov     al,0FFh
  182.       @@:
  183.         rol     eax,16
  184.         add     al,9
  185.         jnc     @f
  186.         mov     al,0FFh
  187.       @@:
  188.         add     ah,9
  189.         jnc     @f
  190.         mov     ah,0FFh
  191.       @@:
  192.  
  193.         mov     [sbIcons.bckg_col],eax
  194.         m2m     [sbIcons.frnt_col],[sc.work]
  195.         m2m     [sbIcons.line_col],[sc.work_graph]
  196.  
  197.         ;edit_boxes_set_sys_color edtIcon,endEdits,sc
  198.         edit_boxes_set_sys_color edtName,endEdits,sc
  199.  
  200.         m2m     [edtIcon.color],[sc.work]
  201.         m2m     [edtIcon.blur_border_color],[sc.work]
  202.  
  203.         call    DRedrawWin
  204.  
  205. DMessages:
  206.         mcall   10              ;WaitMessage
  207.  
  208.         dec     eax
  209.         jz      DReDraw
  210.         dec     eax
  211.         jz      DKey
  212.         dec     eax
  213.         jz      DButton
  214.         sub     eax,3
  215.         jz      DMouse
  216.  
  217.         jmp  DMessages
  218.  
  219.  
  220. ;---------------------------------------------------------------------
  221. DKey:
  222.         mcall   2               ;GetKeyPressed
  223.         cmp     ah,1Bh
  224.         je      DExit
  225.         cmp     ah,9  ;Tab
  226.         je      DNextEdit
  227.         stdcall [edit_box_key],edtName
  228.         stdcall [edit_box_key],edtExePath
  229.         stdcall [edit_box_key],edtParams
  230.         ;stdcall [edit_box_key],edtIcon
  231.  
  232.         jmp     DMessages
  233.  
  234.  
  235. DNextEdit:
  236.         test    [edtName.flags],ed_focus
  237.         jne      .DNE1
  238.         test    [edtExePath.flags],ed_focus
  239.         jne      .DNE2
  240.         test    [edtParams.flags],ed_focus
  241.         jne      .DNE3
  242.         ;test    [edtIcon.flags],ed_focus
  243.         ;jne      .DNE4
  244.         jmp     DMessages
  245.  
  246.     .DNE1:
  247.         and     [edtName.flags],not ed_focus
  248.         or      [edtExePath.flags],ed_focus
  249.         stdcall [edit_box_draw],edtName
  250.         stdcall [edit_box_draw],edtExePath
  251.         jmp     DMessages
  252.  
  253.     .DNE2:
  254.         and     [edtExePath.flags],not ed_focus
  255.         or      [edtParams.flags],ed_focus
  256.         stdcall [edit_box_draw],edtExePath
  257.         stdcall [edit_box_draw],edtParams
  258.         jmp     DMessages
  259.  
  260.     .DNE3:
  261.         and     [edtParams.flags],not ed_focus
  262.         or      [edtName.flags],ed_focus
  263.         stdcall [edit_box_draw],edtParams
  264.         stdcall [edit_box_draw],edtName
  265.         jmp     DMessages
  266.  
  267.     ;.DNE4:
  268.     ;    and     [edtIcon.flags],not ed_focus
  269.     ;    or      [edtName.flags],ed_focus
  270.     ;    stdcall [edit_box_draw],edtName
  271.     ;    stdcall [edit_box_draw],edtIcon
  272.     ;    jmp     DMessages
  273. ;---------------------------------------------------------------------
  274. DButton:
  275.         mcall   17              ;GetButtonPressed
  276.         cmp     ah, idbCancel
  277.         je      DExit
  278.         cmp     ah,idbChange
  279.         je      DSetExePath
  280.         cmp     ah,idbCreate
  281.         je      DSaveIcon
  282.  
  283.         jmp     DMessages
  284. ;-------------------------------------------------------------------------------
  285. DMouse:
  286.         stdcall [edit_box_mouse],edtName
  287.         stdcall [edit_box_mouse],edtExePath
  288.         stdcall [edit_box_mouse],edtParams
  289. ;        stdcall [edit_box_mouse],edtIcon
  290.  
  291.         push    [sbIcons.position]
  292.         stdcall [scrollbar_h_mouse],sbIcons
  293.         pop     eax
  294.         cmp     eax,[sbIcons.position]
  295.         je      @f
  296.         call    DrawStdIcons
  297.       @@:
  298.  
  299.         mcall   37,2            ;GetMouseKey
  300.         test    eax,1
  301.         jz      DMessages
  302.         mcall   37,1            ;GetMouseWinPos
  303.  
  304.         test    eax,10001000h
  305.         jne     DMessages
  306.         xor     edx,edx
  307.         mov     dx,ax     ;y
  308.         shr     eax,16    ;x
  309.  
  310.         sub     eax,ICONSX
  311.         js      DMessages
  312.         sub     edx,ICONSY
  313.         js      DMessages
  314.  
  315.         cmp     eax,(IMG_SIZE+SPCW)*ICONS_DRAW_COUNTW-SPCW
  316.         ja      DMessages
  317.         cmp     edx,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH-SPCH
  318.         ja      DMessages
  319.  
  320.         xor     ebx,ebx
  321.         mov     ecx,[sbIcons.position]
  322.         test    ecx,ecx
  323.         jz      .DM
  324.      @@:
  325.         add     ebx,ICONS_DRAW_COUNTH
  326.         loop    @b
  327.      .DM:
  328.  
  329.         sub     eax,IMG_SIZE+SPCW
  330.         js     .DM1
  331.      @@:
  332.         add     ebx,ICONS_DRAW_COUNTH
  333.         sub     eax,IMG_SIZE+SPCW
  334.         jns     @b
  335.      .DM1:
  336.  
  337.  
  338.         sub     edx,IMG_SIZE+SPCH
  339.         js     .DM2
  340.      @@:
  341.         inc     ebx
  342.         sub     edx,IMG_SIZE+SPCH
  343.         jns     @b
  344.      .DM2:
  345.  
  346.         mov     eax,ebx
  347.  
  348.         cmp     eax,[icon_count]
  349.         jae     DMessages
  350.  
  351. ;       stdcall byteToHex,al,DAreaIcon  ;2
  352.         stdcall intToStr,eax,DAreaIcon
  353.         mov     dword[edtIcon.size],edx
  354.  
  355.     ; stdcall [edit_box_draw],edtIcon
  356.  
  357.         call DrawSelIcon
  358.         jmp      DMessages
  359. ;-------------------------------------------------------------------------------
  360. DSetExePath:
  361.         stdcall [OpenDialog_Start],OpenDialog_data
  362.         mov     edi,DAreaPath
  363.         xor     al,al
  364.         or      ecx,-1
  365.         repne   scasb
  366.         sub     edi,DAreaPath
  367.         dec     edi
  368.         mov     dword[edtExePath+12*4],edi
  369.  
  370.         jmp     DMessages;DReDraw;
  371.  
  372. DSaveIcon:
  373.         mov     edi,DAreaName
  374.         mov     esi,secRButt
  375.     @@: lodsb
  376.         scasb
  377.         jne     @f
  378.         test    al,al
  379.         jnz     @b
  380.  
  381.         mov     dword[fiRunProg+8],ErrName
  382.         mov     dword[fiRunProg+21],pthNotify
  383.         mcall   70,fiRunProg
  384.  
  385.         jmp     DMessages
  386.     @@:
  387.         mov     dword[fiRunProg+8],WarningSave
  388.         mov     dword[fiRunProg+21],pthNotify
  389.         mcall   70,fiRunProg
  390.  
  391.  
  392.         cmp     [DlgSelIcon],-1
  393.         je      @f
  394.  
  395.         stdcall EditIcon,[DlgSelIcon],DAreaIcon,DAreaName,DAreaPath,DAreaParams
  396.         mov     ebx,[DlgSelIcon]
  397.         mov     eax,[IconsID+ebx*4]
  398.         jmp     DExitAndSave
  399.      @@:
  400.  
  401.         call    GenerateID
  402.  
  403.         mov     ebx,[MaxNumIcon]
  404.         mov     [IconsID+ebx*4],eax
  405.         push    eax
  406.         stdcall AddIcon,[AddX],[AddY],DAreaIcon,DAreaName,DAreaPath,DAreaParams
  407.         pop     eax
  408.  
  409. ;-------------------------------------------------------------------------------
  410. DExitAndSave:
  411.  
  412.         mov     dword[nameSection],eax
  413.         stdcall [ini_set_str],IconIni,nameSection,keyName,DAreaName,dword[edtName.size]
  414.         stdcall [ini_set_str],IconIni,nameSection,keyPath,DAreaPath,dword[edtExePath.size]
  415.         stdcall [ini_set_str],IconIni,nameSection,keyParams,DAreaParams,dword[edtParams.size]
  416.         stdcall [ini_set_str],IconIni,nameSection,keyIco,DAreaIcon,dword[edtIcon.size]
  417.  
  418.         cmp     [DlgSelIcon],-1
  419.         jne     @f
  420.         stdcall [ini_set_int],IconIni,nameSection,keyX,[MouseX]
  421.         stdcall [ini_set_int],IconIni,nameSection,keyY,[MouseY]
  422.       @@:
  423. DExit:
  424.         mov     [DlgAddActiv],0
  425.         mov     [slotDlgAdd],0
  426.         mcall   -1              ;ExitThread
  427.  
  428. ;##################################################################
  429. proc DRedrawWin
  430.         mcall   12,1            ;RedrawWinBeg
  431.         mov     edx,[sc.work]
  432.         or      edx,34000000h
  433.         cmp     [DlgSelIcon],-1
  434.         jne      @f
  435.         mov     edi,DTitleAdd
  436.         jmp     .l1
  437.       @@:
  438.         mov     edi,DTitleProp
  439.       .l1:
  440.         mcall   0,<100,END_ICONS_AREAW+ICONSX+10>,<100,(IMG_SIZE+SPCH)*ICONS_DRAW_COUNTH+178>,,,
  441.  
  442.         stdcall [edit_box_draw],edtName
  443.         stdcall [edit_box_draw],edtExePath
  444.         stdcall [edit_box_draw],edtParams
  445.  
  446.         call    DrawStdIcons
  447.  
  448.  
  449.         stdcall [scrollbar_h_draw],sbIcons
  450.         mcall 38,<ICONSX+1,END_ICONS_AREAW-2>,<END_ICONS_AREAH+3,END_ICONS_AREAH+3>,[sc.work_graph]
  451.         mcall   ,<ICONSX+1,END_ICONS_AREAW-2>,<END_ICONS_AREAH+3+15,END_ICONS_AREAH+3+15>,[sc.work_graph]
  452.  
  453.         mcall   ,<ICONSX,ICONSX>,<END_ICONS_AREAH+3+1,END_ICONS_AREAH+3+15-1>,[sc.work_graph]
  454.         mcall   ,<END_ICONS_AREAW-1,END_ICONS_AREAW-1>,<END_ICONS_AREAH+3+1,END_ICONS_AREAH+3+15-1>,[sc.work_graph]
  455.  
  456.         ;BUTTONS
  457.         mcall   8,<265,75>,<30+END_ICONS_AREAH,24>,idbCreate,[sc.work_button]
  458.         mcall    ,<360,77>,                       ,idbCancel
  459.         mcall    ,<END_ICONS_AREAW-30,30>,<30,20> ,idbChange
  460.  
  461.         ;CAPTIONS
  462.         mov     ecx,[sc.work_text]
  463.         or      ecx,90000000h
  464.         mcall   4,<30+IMG_SIZE,10>,,DCaptName
  465.         mcall    ,<30+IMG_SIZE,35>,,DCaptPath
  466.         mcall    ,<30+IMG_SIZE,59>,,DCaptParams
  467.  
  468. if lang eq ru
  469.         mov     ecx,[sc.work_button_text]
  470.         or      ecx,90000000h
  471.         mcall    ,<369,35+END_ICONS_AREAH>,,DCaptCancel
  472.  
  473.         cmp     [DlgSelIcon],-1
  474.         jne     @f
  475.         mpack   ebx,275,35+END_ICONS_AREAH
  476.         mov     edx,DCaptCreate
  477.         jmp     .DRD1
  478.       @@:
  479.         mpack   ebx,272,35+END_ICONS_AREAH
  480.         mov     edx,DCaptProperties
  481.      .DRD1:
  482. else
  483.         mov     ecx,[sc.work_button_text]
  484.         or      ecx,90000000h
  485.         mcall    ,<372,35+END_ICONS_AREAH>,,DCaptCancel
  486.  
  487.  
  488.         cmp     [DlgSelIcon],-1
  489.         jne     @f
  490.         mpack   ebx,277,35+END_ICONS_AREAH
  491.         mov     edx,DCaptCreate
  492.         jmp     .DRD1
  493.       @@:
  494.         mpack   ebx,277,35+END_ICONS_AREAH
  495.         mov     edx,DCaptProperties
  496.      .DRD1:
  497. end if
  498.         mcall
  499.  
  500.         pusha
  501.         mov     ecx,[sc.work_button_text]
  502.         or      ecx,90000000h
  503.         mcall 4,<END_ICONS_AREAW-30+4,33>,,DCaptDots
  504.         popa
  505.  
  506.         call DrawSelIcon
  507.  
  508.         mcall   12,2            ;RedrawWinEnd
  509.         ret
  510. endp
  511.  
  512.  
  513. proc DrawStdIcons
  514. local IcoX:DWORD,\
  515.       IcoY:DWORD,\
  516.       iIcon:DWORD
  517.  
  518.         mov     ecx,[sbIcons.position]
  519.         xor     eax,eax
  520.         m2m     dword[iIcon],0
  521.  
  522.         test    ecx,ecx
  523.         jz      .DST1
  524.      @@:
  525.         add     [iIcon],ICONS_DRAW_COUNTH
  526.         add     eax,IMG_SIZE*IMG_SIZE*4*ICONS_DRAW_COUNTH
  527.         loop    @b
  528.    .DST1:
  529.  
  530.         lea     esi,[eax+44]
  531.         add     esi,[raw_pointer]
  532.  
  533.         mov     [IcoX],ICONSX
  534.  
  535.         mov     ecx,ICONS_DRAW_COUNTW
  536.   .DrawIcons:
  537.         push    ecx
  538.  
  539.         mov     [IcoY],ICONSY
  540.  
  541.         mov     ecx,ICONS_DRAW_COUNTH
  542.   .DrawIcoStolb:
  543.         push    ecx
  544.  
  545.         mov     edi,DlgBufImg
  546.         mov     edx,IMG_SIZE
  547.  
  548.     .DrawLine:
  549.  
  550.  
  551.         mov     ecx,IMG_SIZE
  552.      .DrawPix:
  553.  
  554.         lodsd
  555.         test    eax,0FF000000h
  556.         jnz     @f
  557.         mov     eax,[sc.work]
  558.      @@:
  559.  
  560.         mov     [edi],ax
  561.         shr     eax,16
  562.         mov     [edi+2],al
  563.         add     edi,3
  564.  
  565.         loop    .DrawPix
  566.  
  567.         dec     edx
  568.         jnz    .DrawLine
  569.  
  570.         mov     edx,[IcoX]
  571.         shl     edx,16
  572.         mov     dx,word[IcoY]
  573.         mcall   7,DlgBufImg,<IMG_SIZE,IMG_SIZE>
  574.  
  575.         inc     [iIcon]
  576.         mov     eax,[iIcon]
  577.         cmp     eax,[icon_count]
  578.         jae     .endDrawIcon
  579.  
  580.         add     dword[IcoY],IMG_SIZE+SPCH
  581.         pop     ecx
  582.         loop    .DrawIcoStolb
  583.  
  584.         add     dword[IcoX],IMG_SIZE+SPCW
  585.         pop     ecx
  586.         loop    .DrawIcons
  587.         jmp     .endProc
  588.  
  589.     .endDrawIcon:
  590.  
  591.         mov     ecx,IMG_SIZE*IMG_SIZE
  592.         mov     edi,DlgBufImg
  593.         mov     eax,[sc.work]
  594.         mov     ebx,eax
  595.         shr     ebx,16
  596.      @@:
  597.         mov     word[edi],ax
  598.         mov     [edi+2],bl
  599.         add     edi,3
  600.         loop    @b
  601.  
  602.                                      ;§ â¨à ­¨¥ ­¥ ¨á¯®«ì§®¢ ­ëå ¬¥áâ
  603.         jmp     .Dalee
  604.  
  605.   .DrawIcons2:
  606.         push    ecx
  607.  
  608.         mov     [IcoY],ICONSY
  609.         mov     ecx,ICONS_DRAW_COUNTH
  610.   .DrawIcoStolb2:
  611.         push    ecx
  612.  
  613.         mov     edx,[IcoX]
  614.         shl     edx,16
  615.         mov     dx,word[IcoY]
  616.         mcall   7,DlgBufImg,<IMG_SIZE,IMG_SIZE>
  617.  
  618.      .Dalee:
  619.         add     dword[IcoY],IMG_SIZE+SPCH
  620.         pop     ecx
  621.         loop    .DrawIcoStolb2
  622.  
  623.         add     dword[IcoX],IMG_SIZE+SPCW
  624.         pop     ecx
  625.         loop    .DrawIcons2
  626.  
  627.    .endProc:
  628.  
  629.         ret
  630. endp
  631.  
  632. proc DrawSelIcon
  633.         mov     edx,[sc.work]
  634.         mcall 13,<ICONSX+18,3*8>,<59,12>
  635.  
  636.         mov     ecx,[sc.work_text]
  637.         or      ecx,90000000h
  638.         mcall 4,<ICONSX+18,59>,,DAreaIcon
  639.  
  640.         mov     edi,DAreaIcon
  641.         cmp     byte[edi],0
  642.         jne     @f
  643.         ret
  644.       @@:
  645.  
  646.         ;stdcall hexToInt, edi
  647.         stdcall strToInt, edi
  648.      @@:             ;eax=num icon
  649.         cmp     eax,[icon_count]
  650.         jb      @f
  651.         xor     eax,eax
  652.      @@:
  653.         test    eax,eax
  654.         je      .DI1
  655.         mov     ecx,eax
  656.         xor     eax,eax
  657.       @@:
  658.         add     eax,IMG_SIZE*IMG_SIZE*4
  659.         loop    @b
  660.      .DI1:
  661.         mov     esi,eax
  662.         add     esi,[raw_pointer]
  663.         add     esi,44
  664.  
  665.         mov     edi,DlgBufImg
  666.         mov     edx,IMG_SIZE
  667.     .DrawLine:
  668.  
  669.         mov     ecx,IMG_SIZE
  670.      .DrawPix:
  671.  
  672.         lodsd
  673.         test    eax,0FF000000h
  674.         jnz     @f
  675.         mov     eax,[sc.work]
  676.      @@:
  677.  
  678.         mov     word[edi],ax
  679.         shr     eax,16
  680.         mov     [edi+2],al
  681.         add     edi,3
  682.  
  683.         loop    .DrawPix
  684.  
  685.         dec     edx
  686.         jnz     .DrawLine
  687.  
  688.         mcall   7,DlgBufImg,<IMG_SIZE,IMG_SIZE>,<30,15>
  689.  
  690.         ret
  691. endp
  692.  
  693. ;NOT USED
  694. proc hexToInt strz:DWORD
  695.         push    ebx
  696.         mov     ebx,[strz]
  697.         mov     al,[ebx]
  698.         xor     edx,edx
  699. .loop:
  700.         xor     ecx,ecx
  701.         inc     ebx
  702.         shl     edx,4
  703.         cmp     al,'0'
  704.         jb      .err
  705.         cmp     al,'9'
  706.         jbe     .conv
  707.         mov     ecx,10
  708.         sub     al,11h
  709.         cmp     al,'0'
  710.         jb      .err
  711.         cmp     al,'6'
  712.         ja      .err
  713. .conv:
  714.         sub     al,30h
  715.         add     dl,al
  716.         mov     al,[ebx]
  717.         add     dl,cl
  718.         test    al,al
  719.         jnz     .loop
  720.         mov     eax,edx
  721.         pop     ebx
  722.         ret
  723. .err:
  724.         xor     eax,eax
  725.         pop     ebx
  726.         ret
  727. endp
  728.  
  729.  
  730. ;NOT USED
  731. proc byteToHex byti:BYTE,target:DWORD
  732.         push    ebx
  733.         mov     ebx,[target]
  734.         mov     dl,[byti]
  735.         rol     dl,4
  736.         mov     ecx,2
  737. .loop:
  738.         mov     al,dl
  739.         and     al,0xF
  740.         cmp     al,10
  741.         jae     @f
  742.         add     al,0x30
  743.         jmp     .n
  744. @@:
  745.         add     al,0x41-10
  746. .n:
  747.         mov     [ebx],al
  748.         inc     ebx
  749.         rol     dl,4
  750.         loop    .loop
  751.  
  752.         mov     byte[ebx],0
  753. @@:     pop     ebx
  754.         ret
  755.         jmp     @b
  756. endp
  757.  
  758.  
  759. proc strToInt strz:DWORD
  760.         push    ebx edi esi
  761.         stdcall strLen, [strz]
  762.         xor     edx,edx
  763.         xor     ebx,ebx
  764.         xor     edi,edi
  765.         std
  766.         inc     ebx
  767.         mov     esi,[strz]
  768.         lea     esi,[esi+eax-2]
  769. .loop:
  770.         xor     eax,eax
  771.         lodsb
  772.         cmp     al,'0'
  773.         jb      .err
  774.         cmp     al,'9'
  775.         ja      .err
  776.  
  777.         sub     al,0x30
  778.         mul     ebx
  779.         lea     ebx,[ebx*4+ebx]         ;ebx = ebx*10
  780.         shl     ebx,1
  781.         add     edi,eax
  782.         cmp     esi,[strz]
  783.         jae     .loop
  784.         cld
  785.         mov     eax,edi
  786.         pop     esi edi ebx
  787.         ret
  788. .err:
  789.         cld
  790.         or      eax,-1
  791.         pop     esi edi ebx
  792.         ret
  793. endp
  794.  
  795.  
  796. ;ret: target - string, edx - length string
  797. proc intToStr inti:DWORD, target:DWORD
  798. locals
  799.    resl rb 16
  800. endl
  801.         lea     edi,[resl]
  802.         mov     eax,[inti]
  803.         xor     ecx,ecx
  804.         mov     ebx,10
  805.         jmp     .stlp
  806. .loop:
  807.         xor     edx,edx
  808.         div     ebx
  809.         mov     [edi],dl
  810.         inc     edi
  811.         inc     ecx
  812. .stlp:  cmp     eax,10
  813.         jae     .loop
  814.         mov     [edi],al
  815.         inc     ecx
  816.         mov     edx,ecx
  817.         mov     ebx,[target]
  818. .conv:
  819.         mov     al,[edi]
  820.         add     al,0x30
  821.         mov     [ebx],al
  822.         inc     ebx
  823.         dec     edi
  824.         loop    .conv
  825.         mov     byte[ebx],0
  826.         ret
  827. endp
  828.  
  829. ;for 'ab',0  strLen = 3
  830. proc strLen stringZ:DWORD
  831.         push    edi
  832.         xor     al,al
  833.         mov     edi,[stringZ]
  834.         or      ecx,-1
  835.         repne   scasb
  836.         sub     edi,[stringZ]
  837.         mov     eax,edi
  838.         pop     edi
  839.         ret
  840. endp
  841.  
  842.  
  843.