diff --git a/2ano/1semestre/ac1/aula02/AC1-P-Aula2-Intro.pdf b/2ano/1semestre/ac1/aula02/AC1-P-Aula2-Intro.pdf new file mode 100644 index 0000000..3592e80 Binary files /dev/null and b/2ano/1semestre/ac1/aula02/AC1-P-Aula2-Intro.pdf differ diff --git a/2ano/1semestre/ac1/aula02/AC1-P-Aula2.pdf b/2ano/1semestre/ac1/aula02/AC1-P-Aula2.pdf new file mode 100644 index 0000000..ebe27ef Binary files /dev/null and b/2ano/1semestre/ac1/aula02/AC1-P-Aula2.pdf differ diff --git a/2ano/1semestre/ac1/aula02/ex01.asm b/2ano/1semestre/ac1/aula02/ex01.asm new file mode 100644 index 0000000..9b1dd7b --- /dev/null +++ b/2ano/1semestre/ac1/aula02/ex01.asm @@ -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 diff --git a/2ano/1semestre/ac1/aula02/ex02_a.asm b/2ano/1semestre/ac1/aula02/ex02_a.asm new file mode 100644 index 0000000..54733d6 --- /dev/null +++ b/2ano/1semestre/ac1/aula02/ex02_a.asm @@ -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 diff --git a/2ano/1semestre/ac1/aula02/ex02_d-e.asm b/2ano/1semestre/ac1/aula02/ex02_d-e.asm new file mode 100644 index 0000000..0050cf7 --- /dev/null +++ b/2ano/1semestre/ac1/aula02/ex02_d-e.asm @@ -0,0 +1,8 @@ + .data + .text + .globl main +main: li $a0,0x1010 + li $v0,1 + syscall + + jr $ra \ No newline at end of file diff --git a/2ano/1semestre/ac1/aula02/ex03_c.asm b/2ano/1semestre/ac1/aula02/ex03_c.asm new file mode 100644 index 0000000..2ae30cb --- /dev/null +++ b/2ano/1semestre/ac1/aula02/ex03_c.asm @@ -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 \ No newline at end of file diff --git a/2ano/1semestre/ac1/aula02/ex03_d.asm b/2ano/1semestre/ac1/aula02/ex03_d.asm new file mode 100644 index 0000000..1ad2827 --- /dev/null +++ b/2ano/1semestre/ac1/aula02/ex03_d.asm @@ -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