commit 2a1dca7c4f70d795ea2e9f403eec3075ab30538c
parent 502266a55c00d8e56637f58e990c030a0158d110
Author: Christian Ermann <christianermann@gmail.com>
Date: Fri, 1 Nov 2024 17:29:04 -0700
Add 'prompt' and 'okay' to indicate status to user
Diffstat:
| M | forth.s | | | 25 | +++++++++++++++++++++++-- |
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/forth.s b/forth.s
@@ -427,10 +427,23 @@ _branch_done:
addi ip, ip, cell
next
-defword "quit", 4, 0, 0x47878736, quit, q_branch
+defcode "prompt", 6, 0, 0xDFE6493B, prompt, q_branch
+ la w, _prompt
+ la x, _prompt_len
+ call uart_put_string
+ next
+
+defcode "okay", 6, 0, 0xBA9EEB49, okay, prompt
+ la w, _okay
+ la x, _okay_len
+ call uart_put_string
+ next
+
+defword "quit", 4, 0, 0x47878736, quit, okay
_quit_top:
+ .int prompt
.int refill, drop # TODO: What should happen when 'refill' fails?
- .int interpret
+ .int interpret, okay
.int branch, _quit_top
# -----------------------------------------------------------------------------
@@ -744,6 +757,14 @@ version_string:
.ascii "soup forth rv32\n"
version_string_len = (. - version_string)
+_prompt:
+ .ascii "> "
+ _prompt_len = (. - _prompt)
+
+_okay:
+ .ascii "ok\n"
+ _okay_len = (. - _okay)
+
word_buffer: .space 255
.balign cell
_latest: .int name_immediate