diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-05-29 14:19:43 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-05-29 14:19:43 -0400 |
| commit | 843806d7c80bfec8fcea5fae81961fa35c91a804 (patch) | |
| tree | 32700c4a323d3fd9a81ba7f6d1663a5f7dfa28d0 /tests | |
| parent | 05d10fb3a941aa384340d2999033aacb31e5f32f (diff) | |
ELF Implementation
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/fibtest.asm | 70 | ||||
| -rwxr-xr-x | tests/fibtest.bin | bin | 0 -> 364 bytes | |||
| -rwxr-xr-x | tests/test5.bin | bin | 56 -> 140 bytes | |||
| -rwxr-xr-x | tests/test6.asm | 24 | ||||
| -rwxr-xr-x | tests/test6.bin | bin | 0 -> 246 bytes | |||
| -rwxr-xr-x | tests/test7.asm | 43 | ||||
| -rwxr-xr-x | tests/test7.bin | bin | 0 -> 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 Binary files differnew file mode 100755 index 0000000..167f491 --- /dev/null +++ b/tests/fibtest.bin diff --git a/tests/test5.bin b/tests/test5.bin Binary files differindex dd1cc83..78175de 100755 --- a/tests/test5.bin +++ b/tests/test5.bin 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 Binary files differnew file mode 100755 index 0000000..f9ed3d3 --- /dev/null +++ b/tests/test6.bin 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 Binary files differnew file mode 100755 index 0000000..daadfee --- /dev/null +++ b/tests/test7.bin |
