annotate keiko/lib.k @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
1 ! keiko/lib.c
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
2 ! Copyright (c) 2017 J. M. Spivey
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
4 MODULE Lib 0 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
5 ENDHDR
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
6
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
7 ! Primitives for labs 1--3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
8 PROC lib.print 0 0 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9 CONST 32
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10 CONST 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11 GLOBAL lib.print_char
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 PCALL 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13 LDLW 16
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14 CONST 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15 GLOBAL lib.print_num
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16 PCALL 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17 RETURN
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18 END
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20 PROC lib.newline 0 0 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21 CONST 10
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22 CONST 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23 GLOBAL lib.print_char
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24 PCALL 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 RETURN
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 END
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 ! Primitives for ppc
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 PRIMDEF lib.new scratch_alloc PSI
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30 PRIMDEF lib.open_in lib_open_in ISP
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31 PRIMDEF lib.close_in lib_close_in VS
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32 PRIMDEF lib.read_har lib_read_char VSP
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
33 PRIMDEF lib.print_num lib_print_num VSI
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
34 PRIMDEF lib.print_string lib_print_string VSP
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
35 PRIMDEF lib.print_char lib_print_char VSC
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
36 PRIMDEF lib.argc lib_argc IS
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
37 PRIMDEF lib.argv lib_argv VSIP
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
38 PRIMDEF lib.exit exit VSI