aboutsummaryrefslogtreecommitdiff
path: root/driver.s
diff options
context:
space:
mode:
Diffstat (limited to 'driver.s')
-rw-r--r--driver.s28
1 files changed, 25 insertions, 3 deletions
diff --git a/driver.s b/driver.s
index 44520b2..d717270 100644
--- a/driver.s
+++ b/driver.s
@@ -1,11 +1,21 @@
.data
+ .align 2
+heap:
+ .space 0x80000 # 512KiB
+
.align 1
_cINT:
.byte 0 # pointer arity
.byte 1 # basic value arity
.byte 0 # number of arguments that still have to be curried in
+ .align 1
+_cCHAR:
+ .byte 0 # pointer arity
+ .byte 1 # basic value arity
+ .byte 0 # number of arguments that still have to be curried in
+
.align 2
PRINTROOT:
.word _nroot
@@ -14,9 +24,6 @@ EVALROOT:
.word _nroot
.word 0 # to be filled in
- .align 2
-heap:
-
.text
main:
la $gp,heap
@@ -56,6 +63,8 @@ print_hnf:
lw $t0,($s1)
la $t1,_cINT
beq $t0,$t1,print_int
+ la $t1,_cCHAR
+ beq $t0,$t1,print_char
li $a0,'('
li $v0,11 # print_char
syscall
@@ -76,6 +85,19 @@ print_int:
b print_rewind
nop
+print_char:
+ li $a0,39 # '
+ li $v0,11 # print_char
+ syscall
+ lw $a0,4($s1)
+ li $v0,11 # print_char
+ syscall
+ li $a0,39 # '
+ li $v0,11 # print_char
+ syscall
+ b print_rewind
+ nop
+
print_rewind:
la $t5,PRINTROOT
beq $s0,$t5,print_rewind_root