;
;
;删除空格:代码1
; author: wangguolaing
; date: revised 4/14.386
.MODEL FLATINCLUDE io.h
includelib Kernel32.lib
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORDcr EQU 0dh
Lf EQU 0ah .STACK 4096.DATA
Array DWORD 's',' ','w',' ',' ','r','r','t' count DWORD ?
value DWORD ?.CODE
_start:lea ebx,Arraywhileup :mov ecx,countcmp ecx,7je endwhileadd ebx,4inc countmov eax,[ebx]cmp eax,' 'je spacejmp whileupspace : mov eax,0mov [ebx],eaxjmp whileupendwhile :lea ebx,Arraymov count,0
upwhile : mov eax,countcmp eax,8je quitoutput [ebx]add ebx,4inc countjmp upwhilequit: INVOKE ExitProcess, 0 ; exit with return code 0PUBLIC _start ; make entry point publicEND ; end of source code ;
;
;删除空格:代码2
; author: wangguolaing
; date: revised 4/14
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
INCLUDE io.h
includelib lib\kernel32.lib
cr equ 0dh
lf equ 0ah.STACK 4096
.DATA
array byte 50 dup(?)
prompt1 byte "input a string ending with 0:",0
string byte 100 dup(?)
label1 byte cr,lf,"the length of the string is:"
leng dword 11 dup(?)byte cr,lf,0.code
_start:output prompt1
input string,40
lea esi,string
mov eax,0
lea edi,arrayloop1:
mov dl,byte ptr[esi]
cmp dl,0
je end1
cmp dl,20h
je next
mov byte ptr[edi],dl
inc edi
next:
inc eaxadd esi,1 ;指向下一个字符
jmp loop1end1:
output array
dec eax
dtoa leng,eax
output label1INVOKE ExitProcess,0
PUBLIC _start
END _start