From 7401a81fed816c03935c7a922a76d74dd81f6695 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Sat, 22 May 2021 21:35:51 +1000 Subject: [PATCH] capture command line arguments (inital rsp) --- rrqforth.asm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rrqforth.asm b/rrqforth.asm index da94d05..ab4fd99 100644 --- a/rrqforth.asm +++ b/rrqforth.asm @@ -176,18 +176,28 @@ include 'stdio.asm' include 'compile.asm' WORD p_program_version,'PROGRAM_VERSION',dostring - STRING 'RRQ Forth version 0.1 - 2021-05-13',10 + STRING 'RRQ Forth version 0.1 - 2021-05-22',10 WORD p_stdin,'STDIN',dovalue ;; Initialised to hold a STREAM for fd 0 dq 0 + WORD p_args,'ARGS',dostring + ;; Pointer to initial argument block + dq 0 ; *(int argc,(char*[argc]) argv) + ;;; The main entry point. +main: + ;; Initial rsp points to the arguments block of size (64 bits) + ;; followed by the argument pointers. + mov qword [p_args_DFA],rsp + jmp p_quit_DFA ; QUIT + ;;; This word is also the last word before syscalls last_forth_word: WORD p_quit,'QUIT',fasm ;; QUIT is the program entry point ******************** -main: + mov rsp,DS_TOP mov rbp,RS_TOP cmp qword [p_stdin_DFA],0 -- 2.39.2