aboutsummaryrefslogtreecommitdiff
path: root/semestre 3/architecture des ordinateurs/tme/tme4/exo5.asm
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-10-10 23:15:18 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2025-10-10 23:15:18 +0200
commit4ed8060318b1807638c12b8b43660bb98fc99fba (patch)
tree976f9b6be6cfbb72c3c908e2e1e60069f5a4296a /semestre 3/architecture des ordinateurs/tme/tme4/exo5.asm
parent85fbaa4d9381e435be129aa7bc4ea6a472acb2b2 (diff)
Cours du 6 au 10 octobre
Diffstat (limited to 'semestre 3/architecture des ordinateurs/tme/tme4/exo5.asm')
-rw-r--r--semestre 3/architecture des ordinateurs/tme/tme4/exo5.asm30
1 files changed, 30 insertions, 0 deletions
diff --git a/semestre 3/architecture des ordinateurs/tme/tme4/exo5.asm b/semestre 3/architecture des ordinateurs/tme/tme4/exo5.asm
new file mode 100644
index 0000000..c63dc69
--- /dev/null
+++ b/semestre 3/architecture des ordinateurs/tme/tme4/exo5.asm
@@ -0,0 +1,30 @@
+.data
+tab: .word 4, 23, 12, 3, 8, 1
+ .align 2
+s: .space 4
+ .align 2
+p: .space 4
+.text
+ lui $8, 0x1001 # @tab
+ addiu $9, $8, 24 # @s
+ addiu $10, $9, 4 # @p
+ # s = tab[3]
+ lw $11, 12($8)
+ sw $11, 0($9)
+ # p = tab[4]
+ lw $12, 16($8)
+ sw $12, 0($10)
+
+ # tab[0] = s + 1
+ addi $13, $11, 1
+ sw $13, 0($8)
+ # tab[1] = s + p
+ add $13, $11, $12
+ sw $13, 4($8)
+ # tab[2] = tab[5]
+ lw $13, 20($8)
+ sw $13, 8($8)
+
+ # exit()
+ ori $2, $0, 10
+ syscall \ No newline at end of file