Reference no: EM132194694
Programming Assignments
These must be completed in the Microsoft environment. Only need to submit the ASM file.
Exercise 1
Integer Expression Calculation
Using the AddTwo program from Section 3.2 as a reference, write a program that calculates the
following expression, using registers: A = (A + B) - (C + D). Assign integer values to the EAX,
EBX, ECX, and EDX registers.
Exercise 2
Symbolic Integer Constants
Write a program that defines symbolic constants for all seven days of the week. Create an array
variable that uses the symbols as initializers.
Exercise 3
Data Definitions
Write a program that contains a definition of each data type listed in Table 3-2 in Section 3.4.
Initialize each variable to a value that is consistent with its data type.
Table 3-2 Intrinsic Data Types.
Type Usage
BYTE 8-bit unsigned integer. B stands for byte
SBYTE 8-bit signed integer. S stands for signed
WORD 16-bit unsigned integer
SWORD 16-bit signed integer
DWORD 32-bit unsigned integer. D stands for double
SDWORD 32-bit signed integer. SD stands for signed double
FWORD 48-bit integer (Far pointer in protected mode)
QWORD 64-bit integer. Q stands for quad
TBYTE 80-bit (10-byte) integer. T stands for Ten-byte
REAL4 32-bit (4-byte) IEEE short real
REAL8 64-bit (8-byte) IEEE long real
REAL10 80-bit (10-byte) IEEE extended real
These must be completed in the Microsoft environment. Only need to submit the ASM file.
Exercise 1
Converting from Big Endian to Little Endian
Write a program that uses the variables 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
Exercise 3
Summing the Gaps between Array Values
Write a program with a loop and indexed addressing that calculates the sum of all the gaps between successive array elements. The array elements are doublewords, sequenced in nondecreasing order. So, for example, the array {0, 2, 5, 9, 10} has gaps of 2, 3, 4, and 1, whose sum equals 10
Exercise 7
Copy a String in Reverse Order
Write a program with a loop and indirect addressing that copies a string from source to target, reversing the character order in the process. Use the following variables:
source BYTE "This is the source string",0
target BYTE SIZEOF source DUP('#')
These must be completed in the Microsoft environment. Only need to submit the ASM file.
Exercise 6
Random Strings
Create a procedure that generates a random string of length L, containing all capital letters.
When calling the procedure, pass the value of L in EAX, and pass a pointer to an array of byte that will hold the random string. Write a test program that calls your procedure 20 times and displays the strings in the console window
Exercise 8
Color Matrix
Write a program that displays a single character in all possible combinations of foreground and background colors (16 16 256). The colors are numbered from 0 to 15, so you can use a nested loop to generate all possible combinations.
Attachment:- Assembly Language.rar