summaryrefslogtreecommitdiff
path: root/src/sys/np/sample
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-01 16:39:20 -0400
committerIan Moffett <ian@osmora.org>2025-10-01 16:40:12 -0400
commit8c8d31ed2c4127ba2965bd6a40ff0293418bc1e2 (patch)
treeeccdb84b6b8f5da2ea55c7e7ccbe7419ce4cc3d0 /src/sys/np/sample
parentec3f0a41258099b4aa04ce236d062ffe0580f27d (diff)
np: parse: Add initial function parsing logic
Create basic parsing logic for functions, needs to be completed but provides great groundwork. We also added a better target to parse and we'll incrementally increase complexity as we advance Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/np/sample')
-rw-r--r--src/sys/np/sample/rev-0.np21
-rw-r--r--src/sys/np/sample/test-0.np16
2 files changed, 16 insertions, 21 deletions
diff --git a/src/sys/np/sample/rev-0.np b/src/sys/np/sample/rev-0.np
deleted file mode 100644
index c3f781f..0000000
--- a/src/sys/np/sample/rev-0.np
+++ /dev/null
@@ -1,21 +0,0 @@
-;;
-;; Program entrypoint
-;;
-proc
-main(u8 argc, u8 **argv) -> i8
-begin
- u8 *vga = ptr(0x8B000)
-
- if argc < 2 begin
- return -1
- end
-
- ;; Draw '*' chars
- for [i=0 : i<8 : i += 2] begin
- vga[i + 0] = '*' ;; char '*'
- vga[i + 1] = 0x07 ;; red
- end
-
- return 0
-end
-
diff --git a/src/sys/np/sample/test-0.np b/src/sys/np/sample/test-0.np
new file mode 100644
index 0000000..b4ad2c1
--- /dev/null
+++ b/src/sys/np/sample/test-0.np
@@ -0,0 +1,16 @@
+proc
+main() -> i8
+begin
+ u8 buf[8]
+
+ if argc < 2 begin
+ return -1
+ end
+
+ for [i=0 : i<8 : i += 2] begin
+ buf[i] = 0x07
+ end
+
+ return 0
+end
+