The intent of this Lab assignment is to introduce you to more asm instructions/r
ID: 670334 • Letter: T
Question
The intent of this Lab assignment is to introduce you to more asm instructions/rules including working with different size data, variations of the move command, the XCHG instruction, and simple LOOP and ARRAY manipulations.
General Instructions: C++
1.Create a BYTE array containing the integers 2-4-6-8-10
2.Use a loop to move these integers into an array of DWORD
3.Use another loop to display the contents of this DWORD array to the console.
4.Use the XCHG instruction to reorder the integers to 10-8-6-4-2
5.Display contents again.
Explanation / Answer
.data
byteArray BYTE 2, 4, 6, 8, 10
intArray DWORD lengthof byteArray dup (?)
.code
main PROC
xor ecx, ecx ; index into arrays, 0 on start
mov esi, offset byteArray ; address of byteArray
mov edi, offset intArray ; address of intArray
MoveEm:
movzx eax, byte ptr [esi + ecx] ; move byte from (address) byteArray + ecx into eax, zero extending eax
mov dword ptr [edi + 4 * ecx], eax ; move byte in eax, into (address) intArray + 4 * ecx
inc ecx
cmp ecx, lengthof byteArray
jne MoveEm
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.