summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/fibtest.asm70
-rwxr-xr-xtests/fibtest.binbin0 -> 364 bytes
-rwxr-xr-xtests/test5.binbin56 -> 140 bytes
-rwxr-xr-xtests/test6.asm24
-rwxr-xr-xtests/test6.binbin0 -> 246 bytes
-rwxr-xr-xtests/test7.asm43
-rwxr-xr-xtests/test7.binbin0 -> 306 bytes
7 files changed, 137 insertions, 0 deletions
diff --git a/tests/fibtest.asm b/tests/fibtest.asm
new file mode 100755
index 0000000..bd053b9
--- /dev/null
+++ b/tests/fibtest.asm
@@ -0,0 +1,70 @@
+.data
+
+str:
+ .asciiz "Fibinacci Number "
+
+str2:
+ .asciiz " is: "
+
+fib:
+ .space 40
+
+.text
+
+main:
+ addi $t0, $zero, 0
+ addi $t1, $zero, 1
+ add $t3, $zero, $zero
+ la $t6, fib
+ addi $t5, $zero, 9
+
+ loop:
+ add $t2, $t1, $t0
+ add $t1, $zero, $t0
+ add $t0, $zero, $t2
+ sw $t2, 00($t6)
+ addi $t3, $t3, 1
+ addi $t6, $t6, 4
+ bne $t3, $t5, loop
+ nop
+ addi $t6, $t6, -4
+ loop2:
+ la $a0, str
+ jal PrintStr
+ nop
+
+ add $a0, $zero, $t3
+ jal PrintInt
+ nop
+
+ la $a0, str2
+ jal PrintStr
+ nop
+
+ lw $a0, 00($t6)
+ jal PrintInt
+ nop
+
+ addi $a0, $zero, 10
+ addi $v0, $zero, 11
+ syscall
+
+ addi $t3, $t3, -1
+ addi $t6, $t6, -4
+ bne $t3, $zero, loop2
+ nop
+
+ addi $v0, $zero, 10
+ syscall
+
+PrintInt:
+ addi $v0, $zero, 1
+ syscall
+ jr $ra
+ nop
+
+PrintStr:
+ addi $v0, $zero, 4
+ syscall
+ jr $ra
+ nop \ No newline at end of file
diff --git a/tests/fibtest.bin b/tests/fibtest.bin
new file mode 100755
index 0000000..167f491
--- /dev/null
+++ b/tests/fibtest.bin
Binary files differ
diff --git a/tests/test5.bin b/tests/test5.bin
index dd1cc83..78175de 100755
--- a/tests/test5.bin
+++ b/tests/test5.bin
Binary files differ
diff --git a/tests/test6.asm b/tests/test6.asm
new file mode 100755
index 0000000..3c9ab62
--- /dev/null
+++ b/tests/test6.asm
@@ -0,0 +1,24 @@
+.text
+
+addi $t0, $zero, x
+addi $v0, $zero, 1
+lw $a0, 0($t0)
+syscall
+addi $v0, $zero, 10
+syscall
+
+.data
+
+x: .word 0xFFFFFFFF
+cats: .asciiz "cats are cool\n"
+c: .byte 0
+
+.rodata
+
+g: .word 50
+dogs: .ascii "Dogs are cool\n"
+h: .half 255
+
+.bss
+fib: .space 40
+
diff --git a/tests/test6.bin b/tests/test6.bin
new file mode 100755
index 0000000..f9ed3d3
--- /dev/null
+++ b/tests/test6.bin
Binary files differ
diff --git a/tests/test7.asm b/tests/test7.asm
new file mode 100755
index 0000000..158bf75
--- /dev/null
+++ b/tests/test7.asm
@@ -0,0 +1,43 @@
+.text
+
+la $t0, x
+lw $a0, 0($t0)
+jal PrintInt
+nop
+la $a0, cats
+jal PrintStr
+nop
+j exit
+nop
+
+PrintInt:
+ addi $v0, $zero, 1
+ syscall
+ jr $ra
+ nop
+
+PrintStr:
+ addi $v0, $zero, 4
+ syscall
+ jr $ra
+ nop
+
+exit:
+ addi $v0, $zero, 10
+ syscall
+
+.data
+
+x: .word 0xFFFFFFFF
+cats: .asciiz "cats are cool\n"
+c: .byte 0
+
+.rodata
+
+g: .word 50
+dogs: .ascii "Dogs are cool\n"
+h: .half 255
+
+.bss
+fib: .space 40
+
diff --git a/tests/test7.bin b/tests/test7.bin
new file mode 100755
index 0000000..daadfee
--- /dev/null
+++ b/tests/test7.bin
Binary files differ