Here is your lab documentation for this week. Similar to last week, you will be doing exercises out of the book (Section 8.1). Each exercise has its own setup but uses the same body. When you finish an exercise, comment its setup code and then write the next setup. Make sure to use comments to clearly label what code goes to which exercise. Take a screenshot of the output or write them down for each exercise.
1. What will be the output of the following Windows 32 program?
.MODEL FLAT
.STACK 4096
INCLUDE io.h
.DATA
outLbl BYTE "The modified string is", 0
string BYTE "ABCDBFGHIJ", 0
.CODE
Mainproc PROC
; setup code 1
lea esi, string ; beginning of string
lea edi, string + 5 ; address of 'F'
cld ; forward movement
movsb ; move 4 characters
movsb
movsb
movsb
output outLbl, string ; display modified string
mov eax, 0 ; exit with return code 0
ret
Mainproc ENDP
END
Repeat Exercise 1, replacing the setup code with
; setup code 2
lea esi, string ; beginning of string
lea edi, string + 2 ; address of 'C'
cld ; forward movement
Repeat Exercise 1, replacing the setup code with
; setup code 3
lea esi, string + 9 ; end of string
lea edi, string + 4 ; address of 'E'
std ; backward movement
Repeat Exercise 1, replacing the setup code with
; setup code 4
lea esi, string + 9 ; end of string
lea edi, string + 7 ; address of 'H'
std ; backward movement
Please include output too
2. Repeat Exercise 1, replacing the setup code with
; setup code 2
lea esi, string ; beginning of string
lea edi, string+2; address of 'c'
cld ; forward movement
3. Repeat Exercise 1, replacing the setup code with
; setup code 3
lea esi, string+9 ; end of string
lea edi, string+4; address of 'E'
std ; backward movement
4. Repeat Exercise 1, replacing the setup code with
; setup code 4
lea esi, string+9; end of string
lea edi, string+7; address of 'H'
std ; backward movement