From 341fc63ff791e08c7d0a00346080067c9bd1d5dd Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sat, 1 Nov 2025 13:27:41 +0100 Subject: Cours du 17 au 21 octobre --- .../architecture des ordinateurs/tme/tme5/exo4.asm | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 semestre 3/architecture des ordinateurs/tme/tme5/exo4.asm (limited to 'semestre 3/architecture des ordinateurs/tme/tme5/exo4.asm') diff --git a/semestre 3/architecture des ordinateurs/tme/tme5/exo4.asm b/semestre 3/architecture des ordinateurs/tme/tme5/exo4.asm new file mode 100644 index 0000000..bac6a30 --- /dev/null +++ b/semestre 3/architecture des ordinateurs/tme/tme5/exo4.asm @@ -0,0 +1,29 @@ +.data +val: .word 70 +tab: .word 42, 69, 420, 666, 1, 2, 0, -1 +.text + lui $8, 0x1001 + ori $9, $0, 0 # n + lw $12, 0($8) + addiu $8, $8, 4 + # cond d'arrĂȘt + or $13, $0, $0 + ori $14, $0, 1 + subu $13, $13, $14 +while: + # while tab[i] != '\0' + lw $10, 0($8) + beq $10, $13, end_while + slt $11, $10, $12 + # if tab[i] < val + beq $11, $0, end_if + addiu $9, $9, 1 +end_if: + addiu $8, $8, 4 + j while +end_while: + ori $2, $0, 1 + or $4, $0, $9 + syscall + ori $2, $0, 10 + syscall \ No newline at end of file -- cgit v1.2.3