diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-11-01 13:27:41 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-11-01 13:27:41 +0100 |
| commit | 341fc63ff791e08c7d0a00346080067c9bd1d5dd (patch) | |
| tree | 817638957893aa4899da4386483a29baa6e99151 /semestre 3/architecture des ordinateurs/tme/tme5/exo2.asm | |
| parent | b47e5b1518d7089a2f6fdba439cf35dcf29e6089 (diff) | |
Cours du 17 au 21 octobre
Diffstat (limited to 'semestre 3/architecture des ordinateurs/tme/tme5/exo2.asm')
| -rw-r--r-- | semestre 3/architecture des ordinateurs/tme/tme5/exo2.asm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/semestre 3/architecture des ordinateurs/tme/tme5/exo2.asm b/semestre 3/architecture des ordinateurs/tme/tme5/exo2.asm new file mode 100644 index 0000000..00354a7 --- /dev/null +++ b/semestre 3/architecture des ordinateurs/tme/tme5/exo2.asm @@ -0,0 +1,33 @@ +.data +a: .word 0 # 0x1001 0000 +b: .word 0 # 0x1001 0004 +.text + lui $8, 0x1001 # $8 <- 0x1001 0000 + ori $2, $0, 5 + syscall + lui $8, 0x1001 # $8 <- 0x1001 0000 + sw $2, 0($8) + ori $2, $0, 5 + syscall + lui $8, 0x1001 # $8 <- 0x1001 0000 + sw $2, 4($8) + + lw $9, 0($8) # tmpa + lw $10, 4($8) # tmpb +while: + beq $9, $10, end_while + # tmpb < tmpa -> else + slt $11, $10, $9 + beq $11, $0, else + subu $9, $9, $10 + j end_if +else: + subu $10, $10, $9 +end_if: + j while +end_while: + ori $2, $0, 1 + or $4, $0, $9 + syscall + ori $2, $0, 10 + syscall
\ No newline at end of file |
