[AC1] Add aula02
Signed-off-by: TiagoRG <tiago.rgarcia@ua.pt>
This commit is contained in:
parent
304905fec1
commit
62b2507506
Binary file not shown.
Binary file not shown.
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
.data
|
||||
.text
|
||||
.globl main
|
||||
main: li $a0,0x1010
|
||||
li $v0,1
|
||||
syscall
|
||||
|
||||
jr $ra
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue