[AC1] Add aula02

Signed-off-by: TiagoRG <tiago.rgarcia@ua.pt>
This commit is contained in:
Tiago Garcia 2023-10-23 11:09:58 +01:00
parent 304905fec1
commit 62b2507506
Signed by: TiagoRG
GPG Key ID: DFCD48E3F420DB42
7 changed files with 84 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,22 @@
.data
.text
.globl main
.eqv val_1, 0x5C1B
.eqv val_2, 0xA3E4
.eqv val_3, 0xE543
main: # a), b)
ori $t0, $0, val_1
ori $t1, $0, val_2
and $t2, $t0, $t1
or $t3, $t0, $t1
nor $t4, $t0, $t1
xor $t5, $t0, $t1
# c)
ori $t6, $0, val_3
nor $t7, $t6, $0
jr $ra

View File

@ -0,0 +1,11 @@
.data
.text
.globl main
.eqv Imm, 0x00000001
main: li $t0, 0x12345678
sll $t2,$t0,Imm
srl $t3,$t0,Imm
sra $t4,$t0,Imm
jr $ra

View File

@ -0,0 +1,8 @@
.data
.text
.globl main
main: li $a0,0x1010
li $v0,1
syscall
jr $ra

View File

@ -0,0 +1,12 @@
.data
str1: .asciiz "Hello world"
.eqv print_string,4
.text
.globl main
main: la $a0,str1
li $v0,print_string
syscall
jr $ra

View File

@ -0,0 +1,31 @@
.data
prompt: .asciiz "Introduza 2 numeros\n"
result: .asciiz "A soma dos dois numeros e: "
.eqv print_string,4
.eqv read_int,5
.eqv print_int10,1
.text
.globl main
main: li $v0,print_string
la $a0,prompt
syscall
li $v0,read_int
syscall
move $t0,$v0
li $v0,read_int
syscall
move $t1,$v0
add $t2,$t1,$t0
li $v0,print_string
la $a0,result
syscall
li $v0,print_int10
move $a0,$t2
syscall
jr $ra