From: Ralph Ronnquist Date: Sat, 22 May 2021 11:35:51 +0000 (+1000) Subject: capture command line arguments (inital rsp) X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=7401a81fed816c03935c7a922a76d74dd81f6695;p=rrq%2Frrqforth.git capture command line arguments (inital rsp) --- 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