⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tdeasm.c

📁 包括文件操作、图形系统、并口串口编程、鼠标编程、小型cad系统、编译器、病毒防火墙、海底大战等多个实例。
💻 C
字号:

#include "tdestr.h"
#include "common.h"
#include "tdefunc.h"


unsigned long ptoul( void far *s )
{
   ASSEMBLE {
        mov     ax, WORD PTR s          
        mov     dx, WORD PTR s+2        
        mov     bx, dx          
        mov     cl, 12          
        shr     dx, cl          
        mov     cl, 4           
        shl     bx, cl          
        add     ax, bx          
        adc     dx, 0           
   }
}



text_ptr tabout( text_ptr s, int *len )
{
text_ptr to;
int space;
int col;
int i;
int tab_size;
int show_tab;
int tab_len;


   tab_size = mode.ptab_size;
   show_tab = mode.show_eol;
   to  = (text_ptr)g_status.tabout_buff;
   i = tab_len  = *len;

   ASSEMBLE {
        push    si
        push    di
        push    ds
        push    es

        mov     bx, WORD PTR tab_size   
        xor     cx, cx                  

        mov     di, WORD PTR to
        mov     ax, WORD PTR to+2
        mov     es, ax                  
        mov     si, WORD PTR s
        mov     ax, WORD PTR s+2
        mov     ds, ax                  
   }
top:

   ASSEMBLE {
        cmp     cx, MAX_LINE_LENGTH     
        jge     get_out

        cmp     WORD PTR i, 0           
        jle     get_out

        lodsb                           
        cmp     al, 0x09                
        je      expand_tab

        stosb                           
        inc     cx                      
        dec     WORD PTR i              
        jmp     SHORT top
   }
expand_tab:

   ASSEMBLE {
        mov     ax, cx
        xor     dx, dx                  
        IDIV    bx                      
        mov     ax, bx                  
        sub     ax, dx                  
        mov     dx, ax                  
        add     cx, ax                  
        cmp     cx, MAX_LINE_LENGTH     
        jge     get_out                 
        mov     ax, ' '                 
        cmp     WORD PTR show_tab, 0    
        je      do_the_tab
        mov     ax, 0x09                
   }
do_the_tab:

   ASSEMBLE {
        stosb                           
        dec     dx
        cmp     dx, 0                   
        jle     end_of_space            
        add     WORD PTR tab_len, dx    
        mov     ax, ' '                 
   }
space_fill:

   ASSEMBLE {
        cmp     dx, 0                   
        jle     end_of_space            
        stosb                           
        dec     dx                      
        jmp     SHORT space_fill        
  }
end_of_space:

   ASSEMBLE {
        dec     WORD PTR i
        jmp     SHORT top
   }
get_out:

   ASSEMBLE {
        pop     es
        pop     ds
        pop     di
        pop     si
   }
   if (tab_len > MAX_LINE_LENGTH)
      tab_len = MAX_LINE_LENGTH;
   *len = g_status.tabout_buff_len = tab_len;
   return( (text_ptr)g_status.tabout_buff );


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -