summaryrefslogtreecommitdiff
path: root/04b/in04b
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-11-19 23:27:08 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-11-19 23:28:18 -0500
commitdfd06106983d7a512f0e8aa3da2084f85f2261e5 (patch)
treebd135ead950650a44aff4c9f8bdb8ef412dea317 /04b/in04b
parent9760d898b7f3e4b43337bac18c842d95c9f3ea6c (diff)
mork work on 04b compiler
Diffstat (limited to '04b/in04b')
-rw-r--r--04b/in04b31
1 files changed, 21 insertions, 10 deletions
diff --git a/04b/in04b b/04b/in04b
index f312b54..d208fb7 100644
--- a/04b/in04b
+++ b/04b/in04b
@@ -52,38 +52,49 @@ global char x
global short y ;123
global long z
-function strlen(*char s)
+:strlen
+function
+ argument *char s
local long len
local char c
len = 0
- :strlen.loop
+ :strlen_loop
c = s[len]
- if c == 0 goto strlen.loop_end
+ if c == 0 goto strlen_loop_end
len += 1
- goto strlen.loop
- :strlen.loop_end
+ goto strlen_loop
+ :strlen_loop_end
return len
-function putc(char c)
- local char *p
+:putc
+function
+ argument char c
+ local *char p
p = &c
syscall(1, 1, p, 1, 0, 0, 0, 0)
return
-function puts(*char s)
+:puts
+function
+ argument *char s
local long len
len = strlen(s)
syscall(1, 1, s, len, 0, 0, 0, 0)
return
-function main()
+:main
+function
local *char hello
hello = `Hello, world!
`
puts(hello)
syscall(0x3c, 0, 0, 0, 0, 0, 0, 0)
-function f(*long x, *long y)
+
+:f
+function
+ argument *long x
+ argument *long y
local long v
local *long p
v = *x