add stdio module

This commit is contained in:
2020-10-08 00:42:24 +02:00
parent e3fe3c6d72
commit 9d7f3d25c8
8 changed files with 208 additions and 3 deletions
+17
View File
@@ -0,0 +1,17 @@
(
; we don't have strings yet 👌
(ld @stdout 'H') (ld @stdout 'e') (ld @stdout 'l') (ld @stdout 'l') (ld @stdout 'o')
(ld @stdout 32) (ld @stdout 'c') (ld @stdout 'r') (ld @stdout 's') (ld @stdout 'n')
(ld @stdout '…') (ld @stdout 32)
(:loop)
(ld r0 @stdin)
(cmp r0 'a' (<? (j :badchar)))
(cmp r0 'z' (>? (j :badchar)))
(sub r0 32) ; to uppercase
(ld @stdout r0)
(j :loop)
(:badchar)
(ld @stdout '🐈')
(j :loop)
)