Intel 210200-002 Baby Furniture User Manual


 
ARCHITECTURE
AND
INSTRUCTIONS
Sample Four:
Move
50
bytes between two overlapping
strings.
MY
_DATA
SEGMENT
STRING
DB 1000 DUP (?)
STRING _1
EQU
STRING+?
STRING_2
EQU STRING+25
MY_DATA
ENDS
MY_CODE
SEGMENT
ASSUME
CS:MY
_CODE,
DS:MY
_DATA
STRING_SIZE
EQU
50
GO:
MOV
AX,MY_DATA
MOV DS,AX
MOV ES,AX
MOV
CX,STRING_SIZE
MOV
SI,OFFSET
STRING_1
MOV
DI,OFFSET
STRING_2
CLD
CMP SI,DI
JLT
OK
STD
ADD
SI,STRING_SIZE-1
ADD
DI,STRING_SIZE-1
OK: REPEAT MOVS
STRING_2,STRING_1
HLT
MY_CODE
ENDS
END
GO
2-42
;number
of bytes to move
;establish data segment
;source string
;destination
string
;assume a forward move
;if source string comes first
;
...
we need backwards move
;set
SI
and
01
to
;
...
end of stri ngs
;move the string