Home » Codes » Assembly » 8086 » Char-by-Char String Concatenation in Assembly 8086

Char-by-Char String Concatenation in Assembly 8086

Mar 18, 2013 by     No Comments    Placed under: 8086, Assembly
a2 Char by Char String Concatenation in Assembly 8086 fb share Char by Char String Concatenation in Assembly 8086 tweet Char by Char String Concatenation in Assembly 8086

8086 Char by Char String Concatenation in Assembly 8086

Char-by-Char String Concatenation in Assembly 8086. The Following assembly language code provides Char-by-Char String Concatenation for Intel 8086 Microprocessor.

[asm]org 100h

.data

string_1 DB 5 DUP(0)
string_2 DB 5 DUP(0)
string_3 DB 10 DUP(0)
info1 DB "Enter 1st 5-digits String : $"
info2 DB "Enter 2nd 5-digits String : $"
info3 DB "Resultant Char-by-Char String Concatenation : $"

.code

lea dx, info1
mov ah, 09h
int 21h

mov cx, 5

l1:
mov ah, 01h
int 21h
push ax
loop l1

mov cx, 5
mov di, 0

l2:
pop ax
mov string_1[di], al
inc di
loop l2

mov dl, 0ah
mov ah, 02h
int 21h

mov dl, 0dh
mov ah, 02h
int 21h

lea dx, info2
mov ah, 09h
int 21h

mov cx, 5h

l3:
mov ah, 01h
int 21h
push ax
loop l3

mov cx, 5h
mov di, 0h

l4:
pop ax
mov string_2[di], al
inc di
loop l4

mov dl, 0ah
mov ah, 02h
int 21h

mov dl, 0dh
mov ah, 02h
int 21h

mov cx, 5h
mov si, 0h
mov di, 0h

l5:
mov dl, string_1[si]
mov dh, string_2[si]
mov string_3[di], dl
inc di
mov string_3[di], dh
inc si
inc di
loop l5

lea dx, info3
mov ah, 09h
int 21h

mov cx, 9
lea bx, string_3
mov si, 9

l7:
mov dl, [bx+si]
mov ah, 02h
int 21h
dec si
loop l7

ret[/asm]

Loading Disqus Comments ...
Loading Facebook Comments ...

Subscribe to our Newsletter

To subscribe to our newsletter simply add your email below. A confirmation email will be sent to you!