+
+ WORD p_double_quote,'"',fasm ;; " (fool emacs)
+ ;; ( -- char* n )
+ ;; Scan to double quote in stream buffer, putting thr string on PAD
+ pushr rsi
+ push p_pad_DFA
+ push 0
+p_double_quote_loop:
+ DOFORTH p_stdin, p_read_stream_char
+ pop rax
+ cmp rax,0
+ jl p_double_quote_endstream
+ cmp rax,'"' ; " (fool emacs)
+ je p_double_quote_endquote
+ lea rdi,[p_pad_DFA]
+ add rdi,qword [rsp]
+ stosb
+ inc qword [rsp]
+ jmp p_double_quote_loop
+p_double_quote_endquote:
+p_double_quote_endstream:
+ 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
+
+ WORD p_emit,'EMIT',fasm
+ ;; ( c -- )
+ ;; Write byte to stdout
+ pushr rsi
+ mov rax,rsp
+ push 1
+ push rax
+ push 1
+ DOFORTH sys_write
+ pop rax ; ignore return value
+ pop rax ; drop input data
+ popr rsi
+ next
+
+ WORD p_nl,'NL',dovalue
+ ;; ( -- c )
+ ;; Pushes a newline character on the stack
+ dq 10
+
+ WORD p_sp,'SP',dovalue
+ ;; ( -- c )
+ ;; Pushes a space character on the stack
+ dq 10
+
+ WORD p_digits,'DIGITS',dovariable
+ db '0123456789abcdef'
+
+ WORD p_dot,'.',fasm
+ ;; ( v -- )
+ ;; Print TOP value as unsigned BASE integer
+ pushr rsi
+ mov rax,qword [rsp]
+ cmp rax,0
+ jge p_dot_positive
+ cmp qword [p_base_DFA],10
+ jne p_dot_positive
+ push '-'
+ DOFORTH p_emit
+ mov rax,qword [rsp]
+ neg rax
+p_dot_positive:
+ xor rdx,rdx
+ div qword [p_base_DFA] ; rdx:rax / BASE => q=rax, r=rdx
+ mov qword [rsp],rdx
+ cmp rax,0
+ je p_dot_remainder
+ push rax
+ DOFORTH p_dot
+p_dot_remainder:
+ pop rdx
+ xor rax,rax
+ mov al,[p_digits_DFA+rdx]
+ push rax
+ DOFORTH p_emit
+ popr rsi
+ next