📄 codei86.asm
字号:
inc si ; - increment pointer
mov al,[si] ; - get next char
cmp al,dl ; - quit if char found
je short E_C_strchr ; - ...
inc si ; - increment pointer
cmp al,0 ; - check for end of string
_until e ; until end of string
sub si,si ; return NULL
E_C_strchr:
public _DF_strchr
_DF_strchr_name: db "DF_strchr",0
_DF_strchr_defs:
db "/* dx:si strchr( ds:si, cl ) zaps ds,si,ax */",0
db "#define DF_strchr_ret HW_D_2( HW_DX, HW_SI )",0
db "#define DF_strchr_parms P_DSSI_CL",0
db "#define DF_strchr_saves HW_NotD_3( HW_DX, HW_SI, HW_AX )",0
db 0
;
; DX:SI strchr( DS:SI, CL )
; AX,DX and SI are modified
;
_DF_strchr: ; large data model strchr for -ot
db E_DF_strchr - _DF_strchr - 1
mov dx,ds ; save ds
_loop ; loop
mov al,[si] ; - get char from src
cmp al,cl ; - quit if char found
je short E_DF_strchr ; - ...
inc si ; - increment pointer
cmp al,0 ; - check for end of string
_until e ; until end of string
sub si,si ; return NULL
sub dx,dx ; ...
E_DF_strchr:
public _DP_strchr
_DP_strchr_name: db "DP_strchr",0
_DP_strchr_defs:
db "/* dx:si strchr( dx:si, cl ) zaps dx,si,ax */",0
db "#define DP_strchr_ret HW_D_2( HW_DX, HW_SI )",0
db "#define DP_strchr_parms P_DXSI_CL",0
db "#define DP_strchr_saves HW_NotD_3( HW_DX, HW_SI, HW_AX )",0
db 0
;
; DX:SI strchr( DX:SI, CL )
; AX,DX and SI are modified
;
_DP_strchr: ; large data model strchr for -ot
db E_DP_strchr - _DP_strchr - 1
push ds ; save ds
mov ds,dx ; set ds
_loop ; loop
mov al,[si] ; - get char from src
cmp al,cl ; - quit if char found
je short _DP_strchr9 ; - ...
inc si ; - increment pointer
cmp al,0 ; - check for end of string
_until e ; until end of string
sub si,si ; return NULL
sub dx,dx ; ...
_DP_strchr9:
pop ds ; restore ds
E_DP_strchr:
;=======================================================================
public _C_strcpy
_C_strcpy_name: db "C_strcpy",0
_C_strcpy_defs:
db "/* di strcpy( di, si ) zaps ax,si */",0
db "#define C_strcpy_ret HW_D( HW_DI )",0
db "#define C_strcpy_parms P_DI_SI",0
db "#define C_strcpy_saves HW_NotD_2( HW_AX, HW_SI )",0
db 0
;
; DI strcpy( DI, SI )
; AX and SI are modified
;
_C_strcpy: ; small data model strcpy for -ot
db E_C_strcpy - _C_strcpy - 1
push di ; save destination address
_loop ; loop
mov al,[si] ; - get char from src
mov [di],al ; - store in output buffer
cmp al,0 ; - quit if end of string
_quif e ; - ...
mov al,1[si] ; - get next char
add si,2 ; - bump up pointer
mov 1[di],al ; - copy it
add di,2 ; - bump up pointer
cmp al,0 ; - check for end of string
_until e ; until end of string
pop di ; restore destination address
E_C_strcpy:
public _S_strcpy
_S_strcpy_name: db "S_strcpy",0
_S_strcpy_defs:
db "/* di strcpy( di, si ) zaps ax,si */",0
db "#define S_strcpy_ret HW_D( HW_DI )",0
db "#define S_strcpy_parms P_DI_SI",0
db "#define S_strcpy_saves HW_NotD_2( HW_AX, HW_SI )",0
db 0
;
; DI strcpy( DI, SI )
; AX and SI are modified
;
_S_strcpy: ; small data model strcpy for -os
db E_S_strcpy - _S_strcpy - 1
push di ; save destination address
_loop ; loop
lodsb ; - get char from src
mov [di],al ; - store in output buffer
inc di ; - increment pointer
cmp al,0 ; - check for end of string
_until e ; until end of string
pop di ; restore destination address
E_S_strcpy:
public _ZF_strcpy
_ZF_strcpy_name: db "ZF_strcpy",0
_ZF_strcpy_defs:
db "/* es:di strcpy( es:di, ds:si ) zaps ax,si */",0
db "#define ZF_strcpy_ret HW_D_2( HW_ES, HW_DI )",0
db "#define ZF_strcpy_parms P_ESDI_DSSI",0
db "#define ZF_strcpy_saves HW_NotD_2( HW_AX, HW_SI )",0
db 0
;
; ES:DI strcpy( ES:DI, DS:SI )
; AX and SI are modified
;
_ZF_strcpy: ; large data model strcpy for -os
db E_ZF_strcpy - _ZF_strcpy - 1
push di ; save destination address
_loop ; loop
lodsb ; - get char from src
stosb ; - store in output buffer
cmp al,0 ; - check for end of string
_until e ; until end of string
pop di ; restore destination address
E_ZF_strcpy:
public _ZP_strcpy
_ZP_strcpy_name: db "ZP_strcpy",0
_ZP_strcpy_defs:
db "/* es:di strcpy( es:di, si:ax ) zaps ax,si */",0
db "#define ZP_strcpy_ret HW_D_2( HW_ES, HW_DI )",0
db "#define ZP_strcpy_parms P_ESDI_SIAX",0
db "#define ZP_strcpy_saves HW_NotD_2( HW_AX, HW_SI )",0
db 0
;
; ES:DI strcpy( ES:DI, SI:AX )
; AX and SI are modified
;
_ZP_strcpy: ; large data model strcpy for -os
db E_ZP_strcpy - _ZP_strcpy - 1
push ds ; save ds
push di ; save destination address
xchg si,ax ; get offset into si, segment into ax
mov ds,ax ; load segment
_loop ; loop
lodsb ; - get char from src
stosb ; - store in output buffer
cmp al,0 ; - check for end of string
_until e ; until end of string
pop di ; restore destination address
pop ds ; restore ds
E_ZP_strcpy:
public _DF_strcpy
_DF_strcpy_name: db "DF_strcpy",0
_DF_strcpy_defs:
db "/* es:di strcpy( es:di, ds:si ) zaps ax,si */",0
db "#define DF_strcpy_ret HW_D_2( HW_ES, HW_DI )",0
db "#define DF_strcpy_parms P_ESDI_DSSI",0
db "#define DF_strcpy_saves HW_NotD_2( HW_AX, HW_SI )",0
db 0
;
; ES:DI strcpy( ES:DI, DS:SI )
; AX and SI are modified
;
_DF_strcpy: ; large data model strcpy for -ot
db E_DF_strcpy - _DF_strcpy - 1
push di ; save destination address
_loop ; loop
mov al,[si] ; - get char from src
mov es:[di],al ; - store in output buffer
cmp al,0 ; - quit if end of string
_quif e ; - ...
mov al,1[si] ; - get next char
add si,2 ; - bump up pointer
mov es:1[di],al ; - copy it
add di,2 ; - bump up pointer
cmp al,0 ; - check for end of string
_until e ; until end of string
pop di ; restore destination address
E_DF_strcpy:
public _DP_strcpy
_DP_strcpy_name: db "DP_strcpy",0
_DP_strcpy_defs:
db "/* es:di strcpy( es:di, si:ax ) zaps ax,si */",0
db "#define DP_strcpy_ret HW_D_2( HW_ES, HW_DI )",0
db "#define DP_strcpy_parms P_ESDI_SIAX",0
db "#define DP_strcpy_saves HW_NotD_2( HW_AX, HW_SI )",0
db 0
;
; ES:DI _fstrcpy( ES:DI, SI:AX )
; AX and SI are modified
;
_DP_strcpy: ; model-independent _fstrcpy
db E_DP_strcpy - _DP_strcpy - 1
push ds ; save ds
push di ; save destination address
xchg si,ax ; get offset into si, segment into ax
mov ds,ax ; load segment
_loop ; loop
mov al,[si] ; - get char from src
mov es:[di],al ; - store in output buffer
cmp al,0 ; - quit if end of string
_quif e ; - ...
mov al,1[si] ; - get next char
add si,2 ; - bump up pointer
mov es:1[di],al ; - copy it
add di,2 ; - bump up pointer
cmp al,0 ; - check for end of string
_until e ; until end of string
pop di ; restore destination address
pop ds ; restore ds
E_DP_strcpy:
;=======================================================================
public _S_memset
_S_memset_name: db "S_memset",0
_S_memset_defs:
db "/* di memset( di, al, cx ) zaps es,cx */",0
db "#define S_memset_ret HW_D( HW_DI )",0
db "#define S_memset_parms P_DI_AL_CX",0
db "#define S_memset_saves HW_NotD_2( HW_ES, HW_CX )",0
db 0
_S_memset:
db E_S_memset - _S_memset - 1
push di ; save destination address
push ds ; set ES=DS
pop es ; ...
rep stosb ; do repeat store
pop di ; restore destination address
E_S_memset:
public _C_memset
_C_memset_name: db "C_memset",0
_C_memset_defs:
db "/* di memset( di, al, cx ) zaps es,ah,cx */",0
db "#define C_memset_ret HW_D( HW_DI )",0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -