Skip to content
Snippets Groups Projects
Commit cf1d6243 authored by Robert Grancsa's avatar Robert Grancsa
Browse files

Final readme changes


Signed-off-by: default avatarRobert Grancsa <robert.grancsa2002@gmail.com>
parent 3ad67b5d
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
**Deadline hard**: 9 aprilie 2025, 11:55PM **Deadline hard**: 9 aprilie 2025, 11:55PM
**Responsabili** **Authors**
* Robert Grancsa * Robert Grancsa
* Adelina Alexe * Adelina Alexe
...@@ -27,15 +27,13 @@ The translation should be as simple as possible while covering basic arithmetic ...@@ -27,15 +27,13 @@ The translation should be as simple as possible while covering basic arithmetic
## Conventions and Guidelines ## Conventions and Guidelines
Because we want to prevent you from having to juggle with registers and allocate memory for vectors. Because we want to prevent you from having to juggle with registers, we'll use some simple conventions.
- **Basic Register Mapping:** - **Basic Register Mapping:**
- `A``eax` - `A``eax`
- `B``ebx` - `B``ebx`
- `C``ecx` - `C``ecx`
- `D``edx` - `D``edx`
- When
- **Data types** - **Data types**
- We'll assume all of the data types are **4 bytes** - We'll assume all of the data types are **4 bytes**
- When you see a number, we will treat it as a int (4 bytes) - When you see a number, we will treat it as a int (4 bytes)
...@@ -105,9 +103,9 @@ Similar to MUL, DIV works with EAX as the primary operand, but it also considers ...@@ -105,9 +103,9 @@ Similar to MUL, DIV works with EAX as the primary operand, but it also considers
| **C Code** | **ASM Code** | | **C Code** | **ASM Code** |
|------------ |---------------- | |------------ |---------------- |
| `a = a * 3;` | `MUL 3` | | `a = a * 3;` | `MUL 3` |
| `b = b * c;` | `MOV eax, ebx` | | `b = b * c;` | `MOV eax, ebx` |
| | `MUL ecx` | | | `MUL ecx` |
| | `MOV ebx, eax` | | | `MOV ebx, eax` |
| `a = a / 3;` | `MOV eax, a` | | `a = a / 3;` | `MOV eax, a` |
| | `DIV 3` | | | `DIV 3` |
| | `MOV a, eax` | | | `MOV a, eax` |
...@@ -134,17 +132,14 @@ SHL (Shift left) and SHR (Shift right) are bitwise shift instructions. ...@@ -134,17 +132,14 @@ SHL (Shift left) and SHR (Shift right) are bitwise shift instructions.
- SHL: Moves bits to the left, filling the rightmost bits with zeros. Each shift effectively **multiplies** the value by 2. - SHL: Moves bits to the left, filling the rightmost bits with zeros. Each shift effectively **multiplies** the value by 2.
- Example: `00001100` (`12` in decimal) shifted left by 1 becomes `00011000` (`24` in decimal). - Example: `00001100` (`12` in decimal) shifted left by 1 becomes `00011000` (`24` in decimal).
- SHR: Moves bits to the right, filling the leftmost bits with zeros. Each shift effectively **divides** the value by 2. - SHR: Moves bits to the right, filling the leftmost bits with zeros. Each shift effectively **divides** the value by 2.
- Example: `00001100` (`12` in decimal) shifted left by 1 becomes `00000110` (`6` in decimal). - Example: `00001100` (`12` in decimal) shifted left by 1 becomes `00000110` (`6` in decimal).
| **C Code** | **ASM Code** | | **C Code** | **ASM Code** |
|------------- |---------------- | |------------- |---------------- |
| `a = a << 1` | `SHL eax, 1` | | `a = a << 1` | `SHL eax, 1` |
| `b = b >> 2` | `SHR ebx, 2` | | `b = b >> 2` | `SHR ebx, 2` |
### Conditional Statements ### Conditional Statements
#### CMP Instrunction #### CMP Instrunction
...@@ -235,7 +230,7 @@ Coding style can be run directly in the checker, by pressing `C`, or by using th ...@@ -235,7 +230,7 @@ Coding style can be run directly in the checker, by pressing `C`, or by using th
- \>= 5 of `WARNING` => -5 points - \>= 5 of `WARNING` => -5 points
- \>= 1 of `ERROR` => -10 points - \>= 1 of `ERROR` => -10 points
## Mentiuni ## Notes
- The implementation can be done in any file, and the executable must be named - The implementation can be done in any file, and the executable must be named
`transpiler`, situated in the root of the folder, same as the initial makefile does `transpiler`, situated in the root of the folder, same as the initial makefile does
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment