Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- str1 db "Zhukov$"
- str1Len dw $-str1
- str2 db "Artuom "
- str2Len dw $-str2
- str3 db "Volodymyrovich "
- str3Len dw $-str3
- result db 100 dup(" ")
- length dw ?
- lengthText db 10, 13, "Length: $"
- pkey db 10, 13, "press any key...$"
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- ; add your code here
- ;result = str2
- cld
- lea si, str2
- lea di, result
- mov cx, str2Len
- rep movsb
- ;result += str3
- cld
- lea si, str3
- lea di, result
- add di, str2Len
- mov cx, str3Len
- rep movsb
- ;result += str1
- cld
- lea si, str1
- lea di, result
- add di, str2Len
- add di, str3Len
- mov cx, str1Len
- rep movsb
- ;find result length
- cld
- lea di, result
- mov si, di
- mov cx, 0ffffffffh
- mov al, '$'
- repne scasb
- sub di, si
- dec di
- mov length, di
- ;output result
- lea dx, result
- mov ah, 9
- int 21h
- ;output result length
- lea dx, lengthText
- mov ah, 9
- int 21h
- mov ax, length
- call OutInt
- lea dx, pkey
- mov ah, 9
- int 21h ; output string at ds:dx
- ; wait for any key....
- mov ah, 1
- int 21h
- mov ax, 4c00h ; exit to operating system.
- int 21h
- ;Output Int(0 - 99)
- OutInt proc
- aam
- add ax,3030h
- mov dl,ah
- mov dh,al
- mov ah,02
- cmp dl,48 ;is the number starts as 0
- je next
- int 21h
- next:
- mov dl,dh
- int 21h
- ret
- OutInt endp
- ends
- end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment