Programming 2 (SS 2023)
Saarland University
Faculty MI
Compiler Design Lab
Preparation
To be able to edit the project in Mars, you first have to checkout the repository and import the project:
1. Clone the project in any folder:
where $NAME has to be replaced with your CMS username.
2. Open the cloned directory in Mars.
Check that the settings Assemble all files in directory and Initialize Program Counter to global ‘main’ if defined
in the Settings menu in MARS are activated to compile the file src/main.asm and set the program entry point to
the label main.
In the following document, we refer to the term character as a single byte encoding of a character according to the
ASCII standard. The IBANs only contain ASCII upper case letters and digits. The KNRs and the BLZs consist of
ASCII digits only.
IBAN-Calculator (10 Points)
D E P P B B B B B B B B K K K K K K K K K K
Country code
Check digits
BLZ
KNR
In this project, you will implement an IBAN calculator that converts a bank account number (KNR) and a bank
code (BLZ) to a German IBAN according to the format shown above, or extracts the KNR and the BLZ from a
German IBAN. You can find a general introduction to IBANs in the Wikipedia (https://en.wikipedia.org/
wiki/International_Bank_Account_Number).
You will write the program in MIPS assembler. To make the project easier to handle, it is divided into several
tasks. Each task has its own file in which you will write the corresponding subroutine. Please also pay attention to
the hints at the end of the project description.
1 Extract BLZ and KNR (2 Points)
Write a subroutine 代 做iban2knr (file src/iban2knr.asm), which extracts the BLZ and the KNR from a German
IBAN. Your subroutine receives the following arguments:
1. A buffer with a German IBAN with 22 characters.
2. The target buffer for the BLZ with space for 8 characters.
3. The target buffer for the KNR with space for 10 characters.
2 Remainder calculation (4 Points)
Write a subroutine modulo_str (file src/moduloStr.asm), which calculates the remainder of a number given
as a string. Your subroutine receives the following arguments:
1. A buffer with a number.
1
2. The length of the number in the buffer.
3. The divisor.
The result is returned in the return register. The number in the buffer is the remainder of the division of the number
represented in the buffer by the divisor. The number in the buffer is a decimal number greater than zero represented
as a string of digits and has no sign. The least significant digit of the number is at position