capture command line arguments (inital rsp)
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Sat, 22 May 2021 11:35:51 +0000 (21:35 +1000)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Sat, 22 May 2021 11:35:51 +0000 (21:35 +1000)
rrqforth.asm

index da94d056d7ca7da435815ab01f465ab39b64e380..ab4fd997cb32f85c2b1c767ea5945347ab369449 100644 (file)
@@ -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