adding TELL and EMIT
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Tue, 18 May 2021 08:21:22 +0000 (18:21 +1000)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Tue, 18 May 2021 08:21:22 +0000 (18:21 +1000)
stdio.asm

index f94b0cca194c707463e267dabecac247a7fb772f..7cf148dfca09e287db5bd7675efa64cd66524041 100644 (file)
--- a/stdio.asm
+++ b/stdio.asm
@@ -164,3 +164,34 @@ p_read_word_nomore:
        pop rax
        popr rsi
        next
+
+       WORD p_tell,'TELL',fasm
+       ;; ( chars* n -- )
+       ;; Write n bytes from chars* to stdout
+       pushr rsi
+       pop rbx
+       pop rax
+       push 1
+       push rax
+       push rbx
+       DOFORTH sys_write
+       pop rax
+       popr rsi
+       next
+
+p_emit_buffer: dq 0
+       
+       WORD p_emit,'EMIT',fasm
+       ;; ( c -- )
+       ;; Write byte to stdout
+       pushr rsi
+       pop rax
+       mov [p_emit_buffer],al
+       push 1
+       push p_emit_buffer
+       push 1
+       DOFORTH sys_write
+       pop rax
+        popr rsi
+       next
+