Skip to content

Instantly share code, notes, and snippets.

@tanayseven
Created August 4, 2012 07:44
Show Gist options
  • Save tanayseven/3255614 to your computer and use it in GitHub Desktop.
Save tanayseven/3255614 to your computer and use it in GitHub Desktop.
program to copy from one string to another string without using string instructions using 8086 compatible assembly language
;program to copy from one string to another string without using string instructions
INCLUDE io.h
Cr EQU 0ah
Lf EQU 0dh
data SEGMENT
p_str1 DB Cr, Lf, 'Enter the string: ',0
p_str2 DB Cr, Lf, 'The copied string is: ',0
str1 DB 100 DUP (?)
str2 DB 100 DUP (?)
data ENDS
code SEGMENT
ASSUME cs:code, ds:data
start: mov ax, data
mov ds, ax
;input str1
output p_str1
inputs str1, 100
;initalize
lea si, str1
lea di, str2
;copy str1 to str2
cpy_nxt:mov bl, [si];copy source to destination
mov [di], bl
inc si;increment source and destination
inc di
dec cx;decrement count
jnz cpy_nxt;if not zero goto next bit
;output str2
output p_str2
output str2
quit: mov al, 00h
mov ah, 4ch
int 21h
code ENDS
END start
@KuretiNaga
Copy link

how to run command and how to give input

@tanayseven
Copy link
Author

@KuretiNaga You need 8086 WASM for this code I believe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment