INCLUDE Irvine32.inc
.data
buffer BYTE 128 DUP(?)
.code
main PROC
mov edx, OFFSET buffer
mov ecx, (SIZEOF buffer) - 1
call ReadString ; Read an input string.
mov ecx, OFFSET buffer
add ecx, eax ; EAX = the string length
mov esi, OFFSET buffer ; ESI = the original string position
mov edi, OFFSET buffer ; EDI = the final string position
L1: call SkipSpaces
cmp ecx, esi
je L2 inc edi
inc esi
cmp ecx, esi
jg L1
L2: mov BYTE PTR [edi], 0 ; 0 is the end-of-string symbol
mov edx, OFFSET buffer
call WriteString
call Crlf
call Crlf
exit
main ENDP
SkipSpaces PROC
L1: mov dl, [esi]
cmp dl, ' '
jne L2
inc esi
jmp L1
L2: ret
SkipSpaces ENDP
END main
|
|