Institute for Computer Science Janine Golov
Markus Brenneis
Computer architecture Exercise for the lecture
On this and the next exercise sheet, you will write and copy assembly language programs. give. Therefore, different conditions apply than for the previous taxes. Lead as usual Deviations from the format specifications for point deductions.
Please create a folder in which you can put an assembler file (this is create a simple text file (plain text) with the extension .asm).
Please name the assembler files exactly according to the following scheme:
sheet
For exercise 3 on this exercise sheet, the name would be sheet12_task3.asm. We check
SoSe 2021 Sheet 12
Submission July 6th, 2021
You submit your submissions semi-automatically, which is why you do not deviate from this naming scheme allowed to!
Remove all other files from the folder and create a zip archive (more on this further down). Your submission must consist of a single zip file.
Alternatively, you can use our default folder and create your archive with it. For that you should install the programs make and zip.
• To build all of your programs, just run the make command. Warning: should do not assemble / compile one of the programs, the process is aborted.
• With make zip, all files relevant to the submission are saved in a zip archive.
• With make clean you can clean up the directory a little, created object files and directories are thereby deleted.
Your submissions must run on Linux (32-bit).
Page 1
Task 1 register
Write an assembly language program in which you give a sequence of instructions each that make the
(5 points)
Page 2
Set ZF, PF, OF, CF or SF. In the comments, briefly indicate which flag is set and why it is set.
1
Exercise 2 Output 3 numbers
Write an assembly language program that reads three whole numbers one after the other and converts them to in the same order in which they were read in. Each number should be in a
own line.
Task 3 Check numbers
(4 points)
(5 points)
Write an assembly language program that reads three whole numbers one after the other, followed by the following Output makes:
• Output of the string “correct”, if all entered numbers are in the amount 10.1l.
• Output of the string “wrong entry” if at least one number is not in the amount 10.1l is.
Your program should always read three numbers.
Exercise 4 parity
(4 points)
Write an assembly language program that reads three whole numbers one after the other, followed by the following Output makes:
• Output of the even parity of the three numbers if all entered numbers are in the amount 10.1l are.
• Output of the string “wrong entry” if at least one number is not in the amount 10.1l is.
For example, if your program If, for example, you read in the numbers 0, 0 and 1, your program should output 1. Your program should always read three numbers.
Exercise 5 parity with a loop
Write an assembly language program that reads three whole numbers in sequence. If a number
is not in the amount 10.1l, the input of all three numbers should be repeated. Then should Your program will output the even parity of the three read-in numbers.
Example: If 0, 1, 2, 0, 1, 1 is entered, 0 should be output.
(4 points)
Page 3
2
Include your solution for the following exercise in the zip file (e.g. as an additional PDF or Text file).
Task 6 Valid commands
Note: Read the task completely before you start working on it.
Look at the Mic-1. Complete the following two MAL commands so that they are valid are . . .
H= H+
H= 1 +
. . . and complete the following instruction so that it is invalid:
H= +
In the last two gaps you may only enter the two values that you used above
to have. (Example: If you have entered H and SP above, then you can only enter H + SP and
Enter SP + H; So you have to choose the first two gaps so that the condition for the last gap is fulfilled.)
Now look at NASM assembler. Complete the following two assembler commands, so that they are valid. . .
add eax,
add ebx,
. . . and complete the following instruction so that it is invalid:
add ,
In the last two gaps you may only enter the two values that you used above to have.
For the last instruction, enter a valid x86 instruction sequence that carries out the described operation. ration.
(3 points)
3