Experiment 6
Experiment 6
Submitted by Submitted to
.MODEL SMALL
.DATA
.CODE
MOV AX,@DATA
MOV DS,AX
MOV ES,AX
MOV AH,0H
MOV [BX],'A'
MOV DI,BX
LODSB
STOSB:
.MODEL SMALL
.DATA
.CODE
MOV AX,@DATA
MOV ES,AX
MOV DI,0H
MOV AL,'A'
STOSB
MOVSB:
.MODEL SMALL
.DATA
STR1 DB 'AB'
STR2 DB 2 DUP (?)
.CODE
MOV AX,@DATA
MOV ES,AX
MOV DS,AX
LEA SI,STR1
LEA DI,STR2
CLD
MOVSB
MOVSB
CMPSB:
.MODEL SMALL
.DATA
STR1 DB 'AB'
STR2 DB 'AD'
.CODE
MOV AX,@DATA
MOV ES,AX
MOV DS,AX
LEA SI,STR1
LEA DI,STR2
CLD
CMPSB
CMPSB
SCASB:
.MODEL SMALL
.DATA
STR1 DB 'ABC'
.CODE
MOV AX,@DATA
MOV ES,AX
LEA DI,STR1
MOV AL,'A'
CLD
SCASB
SCASB
HLT
Discussion & Conclusion: The assembly instructions movsb, lodsb, stosb, cmpsb, and
scasb play essential roles in byte-level operations. movsb facilitates the transfer of a
byte from the source address to the destination address, incrementing both pointers in
the process. Conversely, lodsb loads a byte from the source address into the AL register,
advancing the source address. stosb stores the byte in the AL register at the destination
address while incrementing the destination pointer. The cmpsb instruction compares the
byte at the source address with the byte at the destination address, updating flags
accordingly. Finally, scasb compares the byte in the AL register with the byte at the
destination address, updating flags and advancing the destination address.