Texts:
1.) Use Visual Studio to create a program written in MASM assembly language.
2.) Declare a 4-byte unsigned integer variable named "number" and initialize it with a value of 5.
Here is the number: 5. Display the value. Press any key to continue.
MASM HW#1b - Output a one-byte signed integer.
1. Change the variable "number" (in HW 1a) to a one-byte unsigned integer.
2.) Remember that the operands must be the same size. To move a one-byte value to the eax, which is 4 bytes, won't work. The one-byte value must be moved to the al register (1 byte).
3.) Now that the value is in the al register, the Writelnt procedure can be used to output the value.
Problem: The Writelnt procedure outputs the value as a 32-bit number, and although the al register has the correct value (5), the rest of the eax has 1's and 0's. So the output will not be correct.
Example: EAX register: 01001100000111010011010100000101
These 3 bytes of the eax have random 1's and 0's.
The al register holds a 5.
Solution: First, move 0 to the eax, which puts 32 0's in the eax. EAX register: 00000000000000000000000000000000
Then move the number (5) to the al. EAX register: 00000000000000000000000000000101
4.) Display the number as done in HW 1a.