Assignment 1- ASM programs -copy from big Endian to little Endian
Click Here to enroll in this course now
Question #1 (30 points)
Write an ASM program that calculates the following expression, using registers:
A = (A – B) + (C – D)
Assign 32-bit signed integer values to EAX, EBX, ECX, and EDX registers. Display their values.
Answer(partial):
INCLUDE Irvine32.inc; contains library procedures for IA - 32 .data; data segment, read and write varA SDWORD 10 varB SDWORD 20 varC SDWORD 30 varD SDWORD 40 .code; code segment, read - only main PROC call DumpRegs exit main ENDP END main
Question #2 (30 points)
Write an ASM program that calculates the following expression, using variables:
A = (A + B) – (C + D)
Assign 8-bit unsigned integer values to variables A, B, C, and D. Display their values.
Answer(partial):
INCLUDE Irvine32.inc; contains library procedures for IA - 32 .data; data segment, read and write varA BYTE 10 varB BYTE 20 varC BYTE 30 varD BYTE 40 finalVal BYTE ? .code; code segment, read - only main PROC call DumpRegs exit main ENDP END main
Question #3 (30 points)
Write an ASM program that uses the variable below and MOV instructions to copy the value from bigEndian to littleEndian, reversing the order of the bytes. The number’s 32-bit value is understood to be 12345678 hexadecimal.
.data
bigEndian BYTE 12h, 34h, 56h, 78h
littleEndian DWORD ?
Display the values of bigEndian and littleEndian.
Answer(partial):
INCLUDE Irvine32.inc .data bigEndian BYTE 12h, 34h, 56h, 78h littleEndian DWORD ? Array BYTE ? .code main proc L1: loop L1 call DumpRegs EXIT MAIN ENDP END MAIN
Leave a reply