Subversion Repositories Kolibri OS

Rev

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

  1. save_file:
  2. pusha
  3.         bt      dword [flags],0
  4.         jnc     .not_shooted
  5.  
  6.         cmp     byte [ed_buffer.1],0
  7.         je      .no_file_name
  8.  
  9.         mov     edi,sign_n_input
  10.         call    zstr_to_int
  11.         mov     [sign_n],al
  12.  
  13.         ; £¥­¥à¨à㥬 ¨¬ï ä ©« 
  14.         xor     eax,eax
  15.         mov     ecx,1056
  16.         mov     edi,file_name
  17.         rep     stosb   ; § ¯®«­ï¥¬ ­ã«ï¬¨
  18.  
  19.         mov     esi,ed_buffer.1
  20.         mov     edi,file_name
  21. .next:
  22.         mov     ah,[esi]
  23.         test    ah,ah
  24.         jz      .str_end
  25.         cmp     ah,'*'
  26.         jne     .no_insert_number
  27.         jmp     .insert_number
  28. .no_insert_number:
  29.         mov     [edi],ah
  30.         inc     edi
  31.         inc     esi
  32.         jmp     .next
  33. .insert_number:
  34.         bt      word [ch6.flags],1
  35.         jnc     @f
  36.         mov     eax,[cur_number]
  37.         ;mov     ebx,4
  38.         movsx   ebx,byte [sign_n]
  39.         push    ebx
  40.         call    int_to_str
  41.         pop     ebx
  42.         add     edi,ebx
  43. @@:
  44.         inc     esi
  45.         jmp     .next
  46. .str_end:
  47.  
  48. ; ‚ëç¨á«ï¥¬, ᪮«ìª® ¡ ©â ­ã¦­® ¯à¨¡ ¢«ïâì ª ª ¦¤®© áâப¥,
  49. ; ç⮡ë á«¥¤ãîé ï ¡ë«  ¢ëà ¢­¥­  ­  4 ¡ ©â .
  50. ; ¥§ã«ìâ â ¯®¬¥é ¥¬ ¢ edi.
  51.         xor     edx,edx
  52.         movzx   eax,word [scr_buf.width]  ; eax = è¨à¨­  ª à⨭ª¨
  53.         lea     eax,[eax*3]               ; eax = ¡ ©â ­  áâப㠪 à⨭ª¨
  54.         movr    ebx,4                     ; ebx = 4
  55.         mov     edi,ebx                   ; edi = 4
  56.         div     ebx                       ; eax = ¡ ©â ­  áâப㠪 à⨭ª¨ div 4  edx = ¡ ©â... mod 4
  57.         sub     edi,edx                   ; edi = ª®«¨ç¥á⢮ ¡ ©â
  58.         test    edx,edx
  59.         jnz     @f
  60.         xor     edi,edi
  61. @@:
  62.  
  63.         ; ¢ë¤¥«ï¥¬ ¯ ¬ïâì
  64.         mov     ecx,[scr_buf.end_ptr]
  65.         mov     [sf_buf.bmp_header],ecx
  66.         add     ecx,0x36
  67.         mov     [sf_buf.bmp_area],ecx
  68.         movsx   ebx,word [scr_buf.width]
  69.         movsx   edx,word [scr_buf.height]
  70.         ;imul    ebx,edx
  71.         lea     ebx,[ebx*3]
  72.         add     ebx,edi
  73.         imul    ebx,edx
  74.         add     ecx,ebx
  75.         mov     [sf_buf.end],ecx
  76.         add     ecx,4096
  77.         xor     ebx,ebx
  78.         inc     ebx
  79.         movr     eax,64
  80.         int     0x40
  81.  
  82.         push    edi
  83.         ; § ¯®«­ï¥¬ áâàãªâãàã ¤«ï á®åà ­¥­¨ï ä ©« 
  84.         mov     edi,fs_struc
  85.         mov     [edi],dword 2
  86.         mov     eax,[sf_buf.bmp_header]
  87.         mov     ebx,[sf_buf.end]
  88.         sub     ebx,eax
  89.         mov     [edi+12],ebx
  90.         mov     [edi+16],eax
  91.         mov     [edi+21],dword file_name
  92.  
  93.         ; § ¯®«­ï¥¬ § £®«®¢®ª bmp
  94.         mov     edi,[sf_buf.bmp_header]
  95.         mov     [edi],word 'BM'
  96.         mov     ebx,[sf_buf.end]
  97.         sub     ebx,[sf_buf.bmp_area]
  98.         mov     [edi+34],ebx    ; à §¬¥à ª à⨭ª¨
  99.         mov     [edi+10],dword 0x36     ; à §¬¥à § £®«®¢ª 
  100.         add     ebx,0x36
  101.         mov     [edi+2],ebx ; à §¬¥à ä ©« 
  102.         mov     [edi+14],dword 0x28
  103.         movzx   eax,word [scr_buf.width]
  104.         mov     [edi+18],eax ; £®à¨§®­â «ì­ë© à §¬¥à
  105.         movzx   eax,word [scr_buf.height]
  106.         mov     [edi+22],eax ; ¢¥à⨪«ì­ë© à §¬¥à
  107.         mov     [edi+26],word 1
  108.         mov     [edi+28],word 24
  109.  
  110.         ; ª®¯¨à㥬 ¨ ¯¥à¥¢®à ç¨¢ ¥¬
  111. ;        mov     esi,[scr_buf.ptr]
  112. ;        mov     edi,[sf_buf.bmp_area]
  113. ;        mov     edx,[sf_buf.end]
  114. ;        sub     edx,edi
  115. ;        movsx   ecx,word [scr_buf.height]
  116. ;.next_str:
  117. ;push    ecx
  118. ;
  119. ;        movsx   ecx,word [scr_buf.width]
  120. ;        lea     ecx,[ecx*3]
  121. ;        mov     ebx,ecx
  122. ;.next_byte:
  123. ;        mov     ah,[esi+ebx]
  124. ;        mov     [edi+edx],ah
  125. ;        dec     ebx
  126. ;        dec     edx
  127. ;        loop    .next_byte
  128. ;        movsx   ecx,word [scr_buf.width]
  129. ;        lea     ecx,[ecx*3]
  130. ;        add     esi,ecx
  131. ;pop     ecx
  132. ;        loop    .next_str
  133.  
  134.         mov     esi,[scr_buf.end_ptr]
  135.         mov     edi,[sf_buf.bmp_area]
  136.         movzx   ecx,word [scr_buf.height]
  137.         movzx   ebx,word [scr_buf.width]
  138.         lea     ebx,[ebx*3]
  139.         add     edi,ebx
  140. .next_str:
  141.         mov     edx,ebx
  142. .next_pixel:
  143.         mov     ah,[esi]
  144.         mov     [edi],ah
  145.         dec     esi
  146.         dec     edi
  147.         dec     edx
  148.         jnz     .next_pixel
  149.         lea     edi,[2*ebx+edi]
  150.         add     edi,[esp]
  151.         loop    .next_str
  152.  
  153.         pop     edi
  154.  
  155.         ; á®å࠭塞
  156.         draw_status saving
  157.         mov     eax,70
  158.         mov     ebx,fs_struc
  159.         int     0x40
  160.  
  161.         test    eax,eax
  162.         jne     save_error
  163.  
  164.         inc     dword [cur_number]
  165.         call    draw_number
  166.  
  167.         draw_status saved_ok
  168.  
  169. popa
  170. ret
  171.  
  172. .no_file_name:
  173.         draw_status no_file_name
  174. popa
  175. ret
  176.  
  177. .not_shooted:
  178.         draw_status not_shooted
  179. popa
  180. ret
  181.  
  182. save_error:
  183.         cmp     al,5
  184.         jne     @f
  185.         mov     [status.text],dword bad_file_name
  186. @@:
  187.         cmp     al,8
  188.         jne     @f
  189.         mov     [status.text],dword disk_filled
  190. @@:
  191.  
  192.         cmp     al,9
  193.         jne     @f
  194.         mov     [status.text],dword bad_fat_table
  195. @@:
  196.  
  197.         cmp     al,10
  198.         jne     @f
  199.         mov     [status.text],dword ac_den
  200. @@:
  201.  
  202.         cmp     al,11
  203.         jne     @f
  204.         mov     [status.text],dword device_er
  205. @@:
  206.         call    send_draw_status
  207. popa
  208. ret