Skip to content

Instantly share code, notes, and snippets.

@Karl-Han
Last active April 15, 2019 14:28
Show Gist options
  • Save Karl-Han/c6134fd246ec240e4fd0d3ec0b9a5556 to your computer and use it in GitHub Desktop.
Save Karl-Han/c6134fd246ec240e4fd0d3ec0b9a5556 to your computer and use it in GitHub Desktop.
data segment
string1 db 'Hello - Wor ld !',0
data ends
stack1 segment para stack
dw 10h dup(0)
stack1 ends
codeseg segment
start:
assume cs:codeseg, ds:data, ss:stack1
mov ax, data
mov ds, ax
mov di, offset string1
outlp:
cmp byte ptr [di], 0
jz done
again:
cmp byte ptr [di], ' '
jnz next
mov si, di
inlp:
inc si
mov ah, [si]
mov [si-1], ah
cmp byte ptr [si], 0
jnz inlp
jmp again
next:
inc di
jmp outlp
done:
mov byte ptr [di], '$'
mov dx, offset string1
mov ah, 09h
int 21h
mov ah, 4ch
int 21h
codeseg ends
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment