From 6feac19e9a7e003a0f47890bf39a9a8324697e4b Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Sun, 30 May 2021 23:28:09 +1000 Subject: [PATCH 01/16] installed SEGV capture --- rrqforth.asm | 6 +++++- signals.asm | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 signals.asm diff --git a/rrqforth.asm b/rrqforth.asm index f5d6269..dc37774 100644 --- a/rrqforth.asm +++ b/rrqforth.asm @@ -106,6 +106,8 @@ DS_TOP: ; The initial rsp ;segment readable executable +include 'signals.asm' + ;;; At fasm compilation: reset previous_word to make a new word list ;;; Words above belong to the SYSTEM wordlist, and the following ;;; belong to the FORTH wordlist. @@ -204,6 +206,8 @@ main: ;; Initial rsp points to the arguments block of size (64 bits) ;; followed by the argument pointers. mov qword [p_args_DFA],rsp + mov rbp,RS_TOP + call p_setup_signals_DFA call main_is_verbose mov qword [p_verboseQ_DFA],rdx jmp p_quit_DFA ; QUIT @@ -275,7 +279,7 @@ p_quit_ERROR: dq p_tell ENDFORTH mov rbp,RS_TOP ; reset the return stack - jmp main + jmp p_quit_INITIALIZED ;;; ======================================== diff --git a/signals.asm b/signals.asm new file mode 100644 index 0000000..cb39df5 --- /dev/null +++ b/signals.asm @@ -0,0 +1,39 @@ +;;; Handle some signals + + WORD p_setup_signals,'[p_setup_signals]',dovariable + ;; Set up signal handling; + mov rdi,11 + mov rsi,sigaction_data + mov rdx,0 + sigsetsize = sigset.end - sigset.start + mov r10,sigsetsize + mov rax,13 + syscall + ret + +signal_handler_SEGV_message: + STRING 10,'*** signal SEGV - restarting ***',10 + +signal_handler_SEGV: + mov rdi,2 + mov rsi,signal_handler_SEGV_message + 8 + mov rdx,qword [signal_handler_SEGV_message] + mov rax,1 + syscall + jmp p_quit_DFA + +signal_handler_SEGV_restorer: + mov rax,15 + syscall + +sigaction_data: + dq signal_handler_SEGV ; void (*sa_handler)(int); + ;dq 0 ; void (*sa_sigaction)(int, siginfo_t *, void *); + dq 0x44000000 ; unsigned long sa_flags + dq 0 ;signal_handler_SEGV_restorer ; void (*sa_restorer)(void); +sigset.start: ; sigset_t sa_mask; + rept 8 x { + db 0 + } +sigset.end: + -- 2.39.2 From 764d368fcefee647569660b167624506c35175aa Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Sun, 30 May 2021 23:58:42 +1000 Subject: [PATCH 02/16] fixed END to resolve properly --- control.asm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/control.asm b/control.asm index f46d7d4..b6bfe0f 100644 --- a/control.asm +++ b/control.asm @@ -146,17 +146,18 @@ p_ifagain_resolve: ;; Resolves all open branches for the preceding BEGIN and ;; optional several IFBREAK mov rax,rsp +p_end_scan: cmp qword [rax],0 je p_end_resolve add rax,8 - jmp p_end_DFA + jmp p_end_scan p_end_resolve: mov rax,qword [rax+8] ; address of BEGIN p_end_next: pop rbx cmp rbx,0 je p_end_ending - mov rcx,rax + mov rcx,qword [p_here_DFA] sub rcx,rbx mov qword [rbx-8],rcx jmp p_end_next -- 2.39.2 From 46336a44b2da0ba4f141665e2709885b7b85d566 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Tue, 1 Jun 2021 23:49:43 +1000 Subject: [PATCH 03/16] added generated files --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index f1d43c6..d2b2e19 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ archive +gdbinit +reference.html +rrqforth +rrqforth.fas +rrqforth.map -- 2.39.2 From 69f36d333521b482b3b92349c1dccb654f43b65b Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 2 Jun 2021 00:04:47 +1000 Subject: [PATCH 04/16] added tfa2namez --- memory.asm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/memory.asm b/memory.asm index 7d5f144..ff88893 100644 --- a/memory.asm +++ b/memory.asm @@ -17,11 +17,17 @@ next WORD p_tfa2flags_get,'TFA>FLAGS@',fasm - ;; ( cfa -- flags ) + ;; ( tfa -- flags ) pop rax push qword[rax+16] next + WORD p_tfa2namez,'TFA>NAMEZ',fasm + ;; ( tfa -- char* ) + pop rax + push qword[rax+32] + next + WORD p_cfa2flags_get,'CFA>FLAGS@',fasm ;; ( cfa -- flags ) pop rax -- 2.39.2 From bfb48545dd4310c422007dfc1dc3b9eb2897d125 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 2 Jun 2021 00:05:11 +1000 Subject: [PATCH 05/16] added open-file" and load-file" --- compile.asm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/compile.asm b/compile.asm index d5fee48..fe19b20 100644 --- a/compile.asm +++ b/compile.asm @@ -340,3 +340,25 @@ p_evaluate_stream_BAD: mov rax,qword [rax] ; tfa of most recent word mov qword [rax+16],1 ; set the flags field to 1 next + + WORD p_open_file_quote,'OPEN-FILE"' + ;; ( "name" -- fd ) + dq p_double_quote + dq p_create + dq p_tfa2namez + dq p_literal,0 + dq p_literal,0 + dq sys_open + dq p_exit + + WORD p_load_file_quote,'LOAD-FILE"' + ;; ( "name" -- ) + ;; Create a word for the nominated file for a stream to, + ;; and store that stream pointer, then invoke evaluate-stream + dq p_open_file_quote ; fd + dq p_literal, 15000 ; buffer size + dq p_stream + dq p_dup + dq p_comma + dq p_evaluate_stream + dq p_exit -- 2.39.2 From fe3fcf6fadcb1ede09e8eaa6eb227899fc3fd6ab Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 2 Jun 2021 01:28:26 +1000 Subject: [PATCH 06/16] renaming --- rrqforth.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rrqforth.asm b/rrqforth.asm index dc37774..1928fbb 100644 --- a/rrqforth.asm +++ b/rrqforth.asm @@ -73,7 +73,7 @@ dostring: pushpname rax next - WORD p_calltrace,'calltrace',dovalue + WORD p_calltrace,'[calltrace]',dovalue ;; Common call point for debugging ;; rax = cfa of called word ;; rsi = cell* of next forth word -- 2.39.2 From 241c3dd0c465fb45a6ab240aa088268b8743cff4 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 2 Jun 2021 01:29:44 +1000 Subject: [PATCH 07/16] consolidatation --- adoc/data_stack.adoc | 2 +- adoc/p_0branch.adoc | 2 +- adoc/p_2put.adoc | 2 +- adoc/p_bracketed_quote.adoc | 13 ++ adoc/p_break.adoc | 11 ++ adoc/p_calltrace.adoc | 8 ++ adoc/p_dfa2tfa.adoc | 2 +- adoc/p_end.adoc | 4 +- adoc/p_erase.adoc | 2 - adoc/p_load_file_quote.adoc | 15 +++ adoc/p_lparen.adoc | 5 +- adoc/p_open_file_quote.adoc | 13 ++ adoc/p_setup_signals.adoc | 14 +++ adoc/p_tfa2namez.adoc | 20 +++ adoc/p_verboseQ.adoc | 15 +++ reference.adoc | 245 +++++++++++++++++++++--------------- wordindex.adoc | 23 +++- 17 files changed, 281 insertions(+), 115 deletions(-) create mode 100644 adoc/p_bracketed_quote.adoc create mode 100644 adoc/p_break.adoc create mode 100644 adoc/p_calltrace.adoc create mode 100644 adoc/p_load_file_quote.adoc create mode 100644 adoc/p_open_file_quote.adoc create mode 100644 adoc/p_setup_signals.adoc create mode 100644 adoc/p_tfa2namez.adoc create mode 100644 adoc/p_verboseQ.adoc diff --git a/adoc/data_stack.adoc b/adoc/data_stack.adoc index 3d536a9..1ee7168 100644 --- a/adoc/data_stack.adoc +++ b/adoc/data_stack.adoc @@ -1,6 +1,6 @@ // rrqforth.asm: WORD data_stack,'DATA-STACK',dovariable -anchor:data_stack +anchor:data_stack[] === Word: DATA-STACK diff --git a/adoc/p_0branch.adoc b/adoc/p_0branch.adoc index 27d338d..a11ec49 100644 --- a/adoc/p_0branch.adoc +++ b/adoc/p_0branch.adoc @@ -1,6 +1,6 @@ // contorl.asm: WORD p_zero_branch,'0BRANCH',fasm -anchor:p_zero_branch[] +anchor:p_0branch[] === Word: 0BRANCH diff --git a/adoc/p_2put.adoc b/adoc/p_2put.adoc index ce3b294..b801fc8 100644 --- a/adoc/p_2put.adoc +++ b/adoc/p_2put.adoc @@ -1,6 +1,6 @@ // memory.asm: WORD p_2put, '2!',fasm -anchor:p_2out[] +anchor:p_2put[] === Word: 2! diff --git a/adoc/p_bracketed_quote.adoc b/adoc/p_bracketed_quote.adoc new file mode 100644 index 0000000..74e15a3 --- /dev/null +++ b/adoc/p_bracketed_quote.adoc @@ -0,0 +1,13 @@ +// compile.asm: WORD p_bracketed_quote,"[']",doforth,IMMEDIATE + +anchor:p_bracketed_quote[] + +=== Word: ['] + +.... +Data stack: ( -- cfa ) Input stream: word +.... + +"[']" is an immediate function word that reads the next word on the +input stream and pushes its cfa. + diff --git a/adoc/p_break.adoc b/adoc/p_break.adoc new file mode 100644 index 0000000..f7da196 --- /dev/null +++ b/adoc/p_break.adoc @@ -0,0 +1,11 @@ +// control.asm: WORD p_break,'BREAK',fasm,IMMEDIATE + +anchor:p_break[] + +=== Word: BREAK + +"BREAK" is an immediate function word that lays out an unconditional +branch out of an enclosing xef:p_begin[BEGIN]-xref:p_end[END] block. +Similar to xref:p_ifbreak[IFBREAK] it lays out the branch cell +followed by a reserved cell for the branch offset, and inserts the +resolution address just above the required 0 on the data stack. diff --git a/adoc/p_calltrace.adoc b/adoc/p_calltrace.adoc new file mode 100644 index 0000000..aaa1a3f --- /dev/null +++ b/adoc/p_calltrace.adoc @@ -0,0 +1,8 @@ +// rrqforth.asm: WORD p_calltrace,'[calltrace]',dovariable + +anchor:p_calltrace[] + +=== Word: [calltrace] + +"[calltrace]" is a variable word that ccontains a small assembly +snippet that may be used for debugging when running under +gdb+. diff --git a/adoc/p_dfa2tfa.adoc b/adoc/p_dfa2tfa.adoc index 5d1fcda..2a343f6 100644 --- a/adoc/p_dfa2tfa.adoc +++ b/adoc/p_dfa2tfa.adoc @@ -2,7 +2,7 @@ anchor:p_dfa2tfa[] -=== Word: TFA>DFA +=== Word: DFA>TFA .... Data stack: ( dfa -- tfa ) diff --git a/adoc/p_end.adoc b/adoc/p_end.adoc index 7421502..26f4954 100644 --- a/adoc/p_end.adoc +++ b/adoc/p_end.adoc @@ -1,8 +1,8 @@ // control.asm: WORD p_begin,'BEGIN',fasm -anchor:p_begin[] +anchor:p_end[] -=== Word: BEGIN +=== Word: END .... Data stack: Compiling: ( a 0 * -- ) diff --git a/adoc/p_erase.adoc b/adoc/p_erase.adoc index 83b26fe..3461a7e 100644 --- a/adoc/p_erase.adoc +++ b/adoc/p_erase.adoc @@ -9,5 +9,3 @@ Data stack: ( a n -- ) .... "ERASE" is a function word that stores n NUL bytes at address a an up. - - diff --git a/adoc/p_load_file_quote.adoc b/adoc/p_load_file_quote.adoc new file mode 100644 index 0000000..8e0b4b3 --- /dev/null +++ b/adoc/p_load_file_quote.adoc @@ -0,0 +1,15 @@ +// compile.asm: WORD p_load_file_quote,'LOAD-FILE"' + +anchor:p_load_file_quote[] + +=== Word: LOAD-FILE" + +.... +data stack: ( "name" -- ) +.... + +"LOAD-FILE"" is a function word that opens a file via +xref:p_open_file_quote[OPEN-FILE"], allocates a stream buffer of 15000 +bytes for reading it, saves the stream pointer as value for the newly +created filename variable, and then it invokes +xref:p_evaluate_stream[EVALUATE-STREAM] for processing the file. diff --git a/adoc/p_lparen.adoc b/adoc/p_lparen.adoc index 027d3d4..6aa8460 100644 --- a/adoc/p_lparen.adoc +++ b/adoc/p_lparen.adoc @@ -1,6 +1,6 @@ // stdio.asm: WORD p_lparen,'(',fasm,IMMEDIATE -anchor:p_tell[] +anchor:p_lparen[] === Word: ( .... @@ -10,3 +10,6 @@ Data stack: ( -- ) "(" (left parenthesis) is a function word that scans and ignores words until the next right parenthesis, or the end of the stream. This is used for comments in RRQFORTH code. + +Note that the terminating right parenthesis is a word, i.e. must have +whitespace before and after it. diff --git a/adoc/p_open_file_quote.adoc b/adoc/p_open_file_quote.adoc new file mode 100644 index 0000000..988bf6a --- /dev/null +++ b/adoc/p_open_file_quote.adoc @@ -0,0 +1,13 @@ +// compile.asm: WORD p_open_file_quote,'OPEN-FILE"' + +anchor:p_open_file_quote[] + +=== Word: OPEN-FILE" + +.... +Data stack: ( "name" -- fd ) +.... + +"OPEN-FILE"" is a function word that reads the intputstream for a +filename, adds that to the dictionary as a no-content variable, opens +that file and returns the input file descriptor. diff --git a/adoc/p_setup_signals.adoc b/adoc/p_setup_signals.adoc new file mode 100644 index 0000000..256efe3 --- /dev/null +++ b/adoc/p_setup_signals.adoc @@ -0,0 +1,14 @@ +//signals.asm: WORD p_setup_signals,'[p_setup_signals]',dovariable + +anchor:p_setup_signals[] + +=== Word: [p_setup_signals] + +.... +Data stack: ( -- a ) +.... + +"[p_setup_signals]" is a variable word that contains the assembly code +sniippet for setting up the signal handling. rrqforth handles SEGV by +restarting the interpreter loop on xref:p_stdin[STDIN]. + diff --git a/adoc/p_tfa2namez.adoc b/adoc/p_tfa2namez.adoc new file mode 100644 index 0000000..074ead9 --- /dev/null +++ b/adoc/p_tfa2namez.adoc @@ -0,0 +1,20 @@ +// memory.asm: WORD p_tfa2namez, 'TFA>NAMEZ',fasm + +anchor:p_tfa2namez[] + +=== Word: TFA>NAMEZ + +.... +Data stack: ( tfa -- char* ) +.... + +"TFA>NAMEZ" is a function word that pushes changes a tfa pointer to a +pointer to the word pname's character sequence, which is zero +terminated as well as preceded by a length cell. + +==== +.Defintion concept for TFA>NAMEZ +---- +: TFA>NAMEZ 32 + ; +---- +==== diff --git a/adoc/p_verboseQ.adoc b/adoc/p_verboseQ.adoc new file mode 100644 index 0000000..4745fbc --- /dev/null +++ b/adoc/p_verboseQ.adoc @@ -0,0 +1,15 @@ +// rrqforth.asm: WORD p_verboseQ,'VERBOSE?',dovariable + +anchor:p_verboseQ[] + +=== Word: VERBOSE? + +.... +Data stack: ( -- a ) +.... + +"VERBOSE?" is a variable word that is assigned at start up to -1 or 0 +signify whether or not the command line arguments includes "-v". When +non-zero (i.e. running rrqforth with "-v") the evaluation loop is more +verbose. + diff --git a/reference.adoc b/reference.adoc index caeedbc..9175d73 100644 --- a/reference.adoc +++ b/reference.adoc @@ -1,241 +1,285 @@ = RRQFORTH Reference Documentation :author: Ralph Ronnquist :mult: * +:quote: " -== Words Descriptions +include::wordindex.adoc[] + +== Word Descriptions include::adoc/inline_code.adoc[] +include::separator.adoc[] include::adoc/p_0branch.adoc[] +include::separator.adoc[] include::adoc/p_0equal.adoc[] +include::separator.adoc[] include::adoc/p_0less.adoc[] +include::separator.adoc[] include::adoc/p_1branch.adoc[] +include::separator.adoc[] include::adoc/p_2drop.adoc[] +include::separator.adoc[] include::adoc/p_2dup.adoc[] +include::separator.adoc[] include::adoc/p_2get.adoc[] +include::separator.adoc[] include::adoc/p_2over.adoc[] +include::separator.adoc[] include::adoc/p_2put.adoc[] +include::separator.adoc[] include::adoc/p_2swap.adoc[] +include::separator.adoc[] include::adoc/p_Ccomma.adoc[] +include::separator.adoc[] include::adoc/p_Cget.adoc[] +include::separator.adoc[] include::adoc/p_Cput.adoc[] +include::separator.adoc[] include::adoc/p_Rget.adoc[] +include::separator.adoc[] include::adoc/p_Rgt.adoc[] +include::separator.adoc[] include::adoc/p_abs.adoc[] +include::separator.adoc[] include::adoc/p_allot.adoc[] +include::separator.adoc[] include::adoc/p_and.adoc[] +include::separator.adoc[] include::adoc/p_args.adoc[] +include::separator.adoc[] include::adoc/p_base.adoc[] +include::separator.adoc[] include::adoc/p_begin.adoc[] +include::separator.adoc[] +include::adoc/p_bracketed_quote.adoc[] +include::separator.adoc[] include::adoc/p_branch.adoc[] +include::separator.adoc[] +include::adoc/p_break.adoc[] +include::separator.adoc[] +include::adoc/p_calltrace.adoc[] +include::separator.adoc[] include::adoc/p_cfa2flags_get.adoc[] +include::separator.adoc[] include::adoc/p_clear_stream.adoc[] +include::separator.adoc[] include::adoc/p_colon.adoc[] +include::separator.adoc[] include::adoc/p_comma.adoc[] +include::separator.adoc[] include::adoc/p_create.adoc[] +include::separator.adoc[] include::adoc/p_current_wordlist.adoc[] +include::separator.adoc[] include::adoc/data_stack.adoc[] +include::separator.adoc[] include::adoc/p_decimal.adoc[] -include::adoc/p_depth.adoc[] -include::adoc/p_dfa2tfa.adoc[] -include::adoc/p_digits.adoc[] -include::adoc/p_div.adoc[] -include::adoc/p_divmod.adoc[] -include::adoc/p_dodoes.adoc[] -include::adoc/p_does.adoc[] -include::adoc/p_dofasm.adoc[] -include::adoc/p_doforth.adoc[] -include::adoc/p_dostring.adoc[] -include::adoc/p_dot.adoc[] -include::adoc/p_double_quote.adoc[] -include::adoc/p_dovalue.adoc[] -include::adoc/p_dovariable.adoc[] -include::adoc/p_drop.adoc[] -include::adoc/p_dup.adoc[] -include::adoc/p_else.adoc[] -include::adoc/p_emit.adoc[] -include::adoc/p_end.adoc[] -include::adoc/p_equal.adoc[] -include::adoc/p_erase.adoc[] -include::adoc/p_evaluate_stream.adoc[] -include::adoc/p_execute.adoc[] -include::adoc/p_exit.adoc[] -include::adoc/p_false.adoc[] -include::adoc/p_find.adoc[] -include::adoc/p_forth.adoc[] -include::adoc/p_get.adoc[] -include::adoc/p_get_n_decrement.adoc[] -include::adoc/p_get_n_increment.adoc[] -include::adoc/p_greaterequal.adoc[] -include::adoc/p_greaterthan.adoc[] -include::adoc/p_gtR.adoc[] -include::adoc/p_here.adoc[] -include::adoc/p_hex.adoc[] -include::adoc/p_if.adoc[] -include::adoc/p_ifagain.adoc[] -include::adoc/p_ifbreak.adoc[] -include::adoc/p_immediate.adoc[] -include::adoc/p_left_bracket.adoc[] -include::adoc/p_lessequal.adoc[] -include::adoc/p_lessthan.adoc[] -include::adoc/p_literal.adoc[] -include::adoc/p_literal_string.adoc[] -include::adoc/p_lparen.adoc[] -include::adoc/p_malloc.adoc[] -include::adoc/p_minus.adoc[] -include::adoc/p_mult.adoc[] -include::adoc/p_negate.adoc[] -include::adoc/p_nip.adoc[] -include::adoc/p_nl.adoc[] -include::adoc/p_not.adoc[] -include::adoc/p_number.adoc[] -include::adoc/p_or.adoc[] -include::adoc/p_over.adoc[] -include::adoc/p_pad.adoc[] -include::adoc/p_pick.adoc[] -include::adoc/p_plus.adoc[] -include::adoc/p_program_version.adoc[] -include::adoc/p_put.adoc[] -include::adoc/p_put_plus.adoc[] -include::adoc/p_quit.adoc[] -include::adoc/p_quote.adoc[] -include::adoc/p_read_stream_char.adoc[] -include::adoc/p_read_word.adoc[] -include::adoc/p_realloc.adoc[] -include::adoc/p_right_bracket.adoc[] -include::adoc/p_roll.adoc[] -include::adoc/p_rot.adoc[] -include::adoc/p_rsp.adoc[] -include::adoc/p_semicolon.adoc[] -include::adoc/p_shift_left.adoc[] -include::adoc/p_shift_right.adoc[] -include::adoc/p_shift_signed_right.adoc[] -include::adoc/p_sp.adoc[] -include::adoc/p_state.adoc[] -include::adoc/p_stdin.adoc[] -include::adoc/p_stream.adoc[] -include::adoc/p_stream_nchars.adoc[] -include::adoc/p_strlen.adoc[] -include::adoc/p_strncmp.adoc[] -include::adoc/p_strncpy.adoc[] -include::adoc/p_swap.adoc[] -include::adoc/p_system.adoc[] -include::adoc/p_tell.adoc[] -include::adoc/p_terminate0.adoc[] -include::adoc/p_tfa2cfa.adoc[] -include::adoc/p_tfa2dfa.adoc[] -include::adoc/p_tfa2flags_get.adoc[] -include::adoc/p_then.adoc[] -include::adoc/p_this_word.adoc[] -include::adoc/p_true.adoc[] -include::adoc/p_tuck.adoc[] -include::adoc/p_unequal.adoc[] -include::adoc/p_within.adoc[] -include::adoc/p_words.adoc[] -include::adoc/p_xor.adoc[] -include::adoc/return_stack.adoc[] include::separator.adoc[] +include::adoc/p_depth.adoc[] include::separator.adoc[] +include::adoc/p_dfa2tfa.adoc[] include::separator.adoc[] +include::adoc/p_digits.adoc[] include::separator.adoc[] +include::adoc/p_div.adoc[] include::separator.adoc[] +include::adoc/p_divmod.adoc[] include::separator.adoc[] +include::adoc/p_dodoes.adoc[] include::separator.adoc[] +include::adoc/p_does.adoc[] include::separator.adoc[] +include::adoc/p_dofasm.adoc[] include::separator.adoc[] +include::adoc/p_doforth.adoc[] include::separator.adoc[] +include::adoc/p_dostring.adoc[] include::separator.adoc[] +include::adoc/p_dot.adoc[] include::separator.adoc[] +include::adoc/p_double_quote.adoc[] include::separator.adoc[] +include::adoc/p_dovalue.adoc[] include::separator.adoc[] +include::adoc/p_dovariable.adoc[] include::separator.adoc[] +include::adoc/p_drop.adoc[] include::separator.adoc[] +include::adoc/p_dup.adoc[] include::separator.adoc[] +include::adoc/p_else.adoc[] include::separator.adoc[] +include::adoc/p_emit.adoc[] include::separator.adoc[] +include::adoc/p_end.adoc[] include::separator.adoc[] +include::adoc/p_equal.adoc[] include::separator.adoc[] +include::adoc/p_erase.adoc[] include::separator.adoc[] +include::adoc/p_evaluate_stream.adoc[] include::separator.adoc[] +include::adoc/p_execute.adoc[] include::separator.adoc[] +include::adoc/p_exit.adoc[] include::separator.adoc[] +include::adoc/p_false.adoc[] include::separator.adoc[] +include::adoc/p_find.adoc[] include::separator.adoc[] +include::adoc/p_forth.adoc[] include::separator.adoc[] +include::adoc/p_get.adoc[] include::separator.adoc[] +include::adoc/p_get_n_decrement.adoc[] include::separator.adoc[] +include::adoc/p_get_n_increment.adoc[] include::separator.adoc[] +include::adoc/p_greaterequal.adoc[] include::separator.adoc[] +include::adoc/p_greaterthan.adoc[] include::separator.adoc[] +include::adoc/p_gtR.adoc[] include::separator.adoc[] +include::adoc/p_here.adoc[] include::separator.adoc[] +include::adoc/p_hex.adoc[] include::separator.adoc[] +include::adoc/p_if.adoc[] include::separator.adoc[] +include::adoc/p_ifagain.adoc[] include::separator.adoc[] +include::adoc/p_ifbreak.adoc[] include::separator.adoc[] +include::adoc/p_immediate.adoc[] include::separator.adoc[] +include::adoc/p_left_bracket.adoc[] include::separator.adoc[] +include::adoc/p_lessequal.adoc[] include::separator.adoc[] +include::adoc/p_lessthan.adoc[] include::separator.adoc[] +include::adoc/p_literal.adoc[] include::separator.adoc[] +include::adoc/p_literal_string.adoc[] include::separator.adoc[] +include::adoc/p_load_file_quote.adoc[] include::separator.adoc[] +include::adoc/p_lparen.adoc[] include::separator.adoc[] +include::adoc/p_malloc.adoc[] include::separator.adoc[] +include::adoc/p_minus.adoc[] include::separator.adoc[] +include::adoc/p_mult.adoc[] include::separator.adoc[] +include::adoc/p_negate.adoc[] include::separator.adoc[] +include::adoc/p_nip.adoc[] include::separator.adoc[] +include::adoc/p_nl.adoc[] include::separator.adoc[] +include::adoc/p_not.adoc[] include::separator.adoc[] +include::adoc/p_number.adoc[] include::separator.adoc[] +include::adoc/p_open_file_quote.adoc[] include::separator.adoc[] +include::adoc/p_or.adoc[] include::separator.adoc[] +include::adoc/p_over.adoc[] include::separator.adoc[] +include::adoc/p_pad.adoc[] include::separator.adoc[] +include::adoc/p_pick.adoc[] include::separator.adoc[] +include::adoc/p_plus.adoc[] include::separator.adoc[] +include::adoc/p_program_version.adoc[] include::separator.adoc[] +include::adoc/p_put.adoc[] include::separator.adoc[] +include::adoc/p_put_plus.adoc[] include::separator.adoc[] +include::adoc/p_quit.adoc[] include::separator.adoc[] +include::adoc/p_quote.adoc[] include::separator.adoc[] +include::adoc/p_read_stream_char.adoc[] include::separator.adoc[] +include::adoc/p_read_word.adoc[] include::separator.adoc[] +include::adoc/p_realloc.adoc[] include::separator.adoc[] +include::adoc/p_right_bracket.adoc[] include::separator.adoc[] +include::adoc/p_roll.adoc[] include::separator.adoc[] +include::adoc/p_rot.adoc[] include::separator.adoc[] +include::adoc/p_rsp.adoc[] include::separator.adoc[] +include::adoc/p_semicolon.adoc[] include::separator.adoc[] +include::adoc/p_setup_signals.adoc[] include::separator.adoc[] +include::adoc/p_shift_left.adoc[] include::separator.adoc[] +include::adoc/p_shift_right.adoc[] include::separator.adoc[] +include::adoc/p_shift_signed_right.adoc[] include::separator.adoc[] +include::adoc/p_sp.adoc[] include::separator.adoc[] +include::adoc/p_state.adoc[] include::separator.adoc[] +include::adoc/p_stdin.adoc[] include::separator.adoc[] +include::adoc/p_stream.adoc[] include::separator.adoc[] +include::adoc/p_stream_nchars.adoc[] include::separator.adoc[] +include::adoc/p_strlen.adoc[] include::separator.adoc[] +include::adoc/p_strncmp.adoc[] include::separator.adoc[] +include::adoc/p_strncpy.adoc[] include::separator.adoc[] +include::adoc/p_swap.adoc[] include::separator.adoc[] +include::adoc/p_system.adoc[] include::separator.adoc[] +include::adoc/p_tell.adoc[] include::separator.adoc[] +include::adoc/p_terminate0.adoc[] include::separator.adoc[] +include::adoc/p_tfa2cfa.adoc[] include::separator.adoc[] +include::adoc/p_tfa2dfa.adoc[] include::separator.adoc[] +include::adoc/p_tfa2flags_get.adoc[] include::separator.adoc[] +include::adoc/p_tfa2namez.adoc[] include::separator.adoc[] +include::adoc/p_then.adoc[] include::separator.adoc[] +include::adoc/p_this_word.adoc[] include::separator.adoc[] +include::adoc/p_true.adoc[] include::separator.adoc[] +include::adoc/p_tuck.adoc[] include::separator.adoc[] +include::adoc/p_unequal.adoc[] include::separator.adoc[] +include::adoc/p_verboseQ.adoc[] include::separator.adoc[] +include::adoc/p_within.adoc[] include::separator.adoc[] +include::adoc/p_words.adoc[] include::separator.adoc[] +include::adoc/p_xor.adoc[] include::separator.adoc[] +include::adoc/return_stack.adoc[] == System calls //include::syscalls.adoc[] @@ -246,6 +290,3 @@ arguments fro the data stack in reverse order, i.e. the first argument is deepest. Use +SYSTEM WORDS+ to get a list of all (321) available syscalls. - - -include::wordindex.adoc[] diff --git a/wordindex.adoc b/wordindex.adoc index 6ab01d4..8623a0b 100644 --- a/wordindex.adoc +++ b/wordindex.adoc @@ -1,7 +1,7 @@ -== Index of word links +== Word Index -xref:p_lparen[(] {nbsp} +xref:p_lparen[( (left parenthesis)] {nbsp} xref:p_colon[: (colon)] {nbsp} xref:p_semicolon[: (semi-colon)] {nbsp} xref:p_comma[, (comma)] {nbsp} @@ -26,6 +26,7 @@ xref:p_div[/] {nbsp} xref:p_shift_left[<<] {nbsp} xref:p_shift_right[>>] {nbsp} xref:p_shift_signed_right[s>>] {nbsp} +<> {nbsp} xref:p_get[@] {nbsp} @@ -59,11 +60,13 @@ xref:p_2swap[2SWAP] {nbsp} xref:p_abs[ABS] {nbsp} xref:p_allot[ALLOT] {nbsp} xref:p_and[AND] {nbsp} -xref:inline_code[[ASM]] {nbsp} +<> {nbsp} xref:p_base[BASE] {nbsp} xref:p_begin[BEGIN] {nbsp} +xref:p_break[BREAK] {nbsp} +xref:p_cfa2flags_get[CFA>FLAGS@] {nbsp} xref:p_clear_stream[CLEAR-STREAM] {nbsp} xref:p_create[CREATE] {nbsp} xref:p_current_wordlist[CURRENT-WORDLIST] {nbsp} @@ -72,6 +75,7 @@ xref:p_decimal[DECIMAL] {nbsp} xref:p_depth[DEPTH] {nbsp} xref:p_digits[DIGITS] {nbsp} xref:p_divmod[/MOD] {nbsp} +xref:p_dfa2tfa[DFA>TFA] {nbsp} xref:p_dodoes[doDOES] {nbsp} xref:p_does[DOES>] {nbsp} xref:p_dofasm[doFASM] {nbsp} @@ -85,6 +89,7 @@ xref:p_dup[DUP] {nbsp} xref:p_else[ELSE] {nbsp} xref:p_emit[EMIT] {nbsp} xref:p_end[END] {nbsp} +xref:p_erase[ERASE] {nbsp} xref:p_evaluate_stream[EVALUATE-STREAM] {nbsp} xref:p_execute[EXECUTE] {nbsp} xref:p_exit[EXIT] {nbsp} @@ -102,6 +107,7 @@ xref:p_ifbreak[IFBREAK] {nbsp} xref:p_immediate[IMMEDIATE] {nbsp} xref:p_literal[LIT] {nbsp} +xref:p_load_file_quote[LOAD-FILE"] {nbsp} xref:p_args[MAIN-ARGS] {nbsp} xref:p_malloc[MALLOC] {nbsp} @@ -112,6 +118,7 @@ xref:p_nl[NL] {nbsp} xref:p_not[NOT] {nbsp} xref:p_number[NUMBER] {nbsp} +xref:p_open_file_quote[OPEN-FILE"] {nbsp} xref:p_or[OR] {nbsp} xref:p_over[OVER] {nbsp} @@ -140,13 +147,21 @@ xref:p_system[SYSTEM] {nbsp} xref:p_tell[TELL] {nbsp} xref:p_terminate0[TERMINATE0] {nbsp} -xref:p_cfa2flags_get[TFA>FLAGS@] {nbsp} +xref:p_tfa2cfa[TFA>CFA] {nbsp} +xref:p_tfa2dfa[TFA>DFA] {nbsp} +xref:p_tfa2flags_get[TFA>FLAGS@] {nbsp} +xref:p_tfa2namez[TFA>NAMEZ] {nbsp} xref:p_then[THEN] {nbsp} xref:p_this_word[THIS-WORD] {nbsp} xref:p_true[TRUE] {nbsp} xref:p_tuck[TUCK] {nbsp} +xref:p_verboseQ[VERBOSE?] {nbsp} + xref:p_within[WITHIN] {nbsp} xref:p_words[WORDS] {nbsp} xref:p_xor[XOR] {nbsp} + +<> {nbsp} +<> {nbsp} -- 2.39.2 From c8819ee75b180664d649f542f4448122f6c4cdce Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 2 Jun 2021 13:45:35 +1000 Subject: [PATCH 08/16] saving prebuilt binaries --- .gitignore | 2 - reference.html | 3342 ++++++++++++++++++++++++++++++++++++++++++++++++ rrqforth | Bin 0 -> 2148423 bytes 3 files changed, 3342 insertions(+), 2 deletions(-) create mode 100644 reference.html create mode 100755 rrqforth diff --git a/.gitignore b/.gitignore index d2b2e19..cc6b724 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ archive gdbinit -reference.html -rrqforth rrqforth.fas rrqforth.map diff --git a/reference.html b/reference.html new file mode 100644 index 0000000..f57f5c8 --- /dev/null +++ b/reference.html @@ -0,0 +1,3342 @@ + + + + + + +RRQFORTH Reference Documentation + + + + + +
+
+

Word Index

+
+ +

<   +<=   +=   +!=   +>   +>=   +0=   +0<   +-   +*   ++   +/   +<<   +>>   +s>>   +[']  

+

@   +!   +C@   +C!   +2@   +2!   +!+   +@n++   +@n--   +C,   +S"   +>R   +R@   +R>   +R[n]  

+

DATA-STACK   +RETURN-STACK   +  +BRANCH   +0BRANCH   +1BRANCH   +  +2DROP   +2DUP   +2OVER   +2SWAP  

+

ABS   +ALLOT   +AND   +[ASM]  

+

BASE   +BEGIN   +BREAK  

+ +

DECIMAL   +DEPTH   +DIGITS   +/MOD   +DFA>TFA   +doDOES   +DOES>   +doFASM   +doFORTH   +doSTRING   +doVALUE   +doVARIABLE   +DROP   +DUP  

+

ELSE   +EMIT   +END   +ERASE   +EVALUATE-STREAM   +EXECUTE   +EXIT  

+

FALSE   +FIND   +FORTH  

+

HERE   +HEX  

+

IF   +IFAGAIN   +IFBREAK   +IMMEDIATE  

+ + +

NEGATE   +NIP   +NL   +NOT   +NUMBER  

+

OPEN-FILE"   +OR   +OVER  

+ +

QUIT  

+ +

SP   +STATE   +STDIN   +STREAM   +STREAM-NCHARS   +STRLEN   +STRNCMP   +STRNCPY   +SWAP   +SYSTEM  

+

TELL   +TERMINATE0   +TFA>CFA   +TFA>DFA   +TFA>FLAGS@   +TFA>NAMEZ   +THEN   +THIS-WORD   +TRUE   +TUCK  

+ +

WITHIN   +WORDS  

+

XOR  

+ +
+
+
+

Word Descriptions

+
+

+
+

Word: [ASM]

+
+
+
data stack: ( -- )
+
+

"[ASM]" is a function word that introduces inline assembly in an +RRQFORTH definition. Such assembly code may return to subsequence +RRQFORTH executon by means of the following instruction sequence:

+
+
+
+
+
        mov rsi,forthcode
+        lodsq
+        jmp qword [rax]
+forthcode:
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: 0BRANCH

+
+
+
Data stack: ( v -- )
+
+

"0BRANCH" is a function word that implements execution conditional by +means of optionally adding the subsequent branch offset, or not, to +the point of execution. If the value, v, is 0 then the branch offset +is added, and otherwise execution continues with the cell following +the branch offset in the definition.

+
+_______________________________________________________ +
+

+
+
+

Word: 0=

+
+
+
Data stack: ( v -- 0/-1 )
+
+

"0=" is a function word that replaces a value with its logical +complement; the result is zero if the value non-zero, and the result +is non-zero if the value is zero.

+

Compare with NOT.

+
+_______________________________________________________ +
+

+
+
+

Word: 0<

+
+
+
Data stack: ( v -- 0/-1 )
+
+

"0<" is a function word that replaces a value with -1 if the value is +less than 0, and 0 otherwise.

+
+
+
+
Definition concept 1: Word: 0<
+
+
: 0= 0 SWAP < ;
+
+
+

See also SWAP and +<.

+
+_______________________________________________________ +
+

+
+
+

Word: 1BRANCH

+
+
+
Data stack: ( v -- )
+
+

"1BRANCH" is a function word that implements execution conditional by +means of optionally adding the subsequent branch offset, or not, to +the point of execution. If the value, v, is non-zero then the branch +offset is added, and otherwise execution continues with the cell +following the branch offset in the definition.

+
+_______________________________________________________ +
+

+
+
+

Word: 2DROP

+
+
+
Data stack: ( v1 v2 -- )
+
+

"2DROP" is a function word that plainly discards the top 2 cells from +the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: 2DUP

+
+
+
Data stack: ( v1 v2 -- v1 v2 v1 v2 )
+
+

"2DUP" is a function word that duplicates the top 2 cells on the data +stack.

+
+
+
+
Definition concept 2: Word: 2DUP
+
+
: 2DUP OVER OVER ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: 2@

+
+
+
Data stack: ( a -- v2 v1 )
+
+

"2@" is a function word that pushes the two concecutive values v1 and +v2 from the address a onto the data stack. Value v1 is from address a +and value v2 is from address a + 8.

+
+_______________________________________________________ +
+

+
+
+

Word: 2OVER

+
+
+
Data stack: ( v1 v2 v3 v4 -- v1 v2 v3 v4 v1 v2 )
+
+

"2OVER" is a function word that replicates the second duble-cell pair +onto the top of the data stack. This is similar to OVER but +working with cell pairs rather than single cells.

+
+
+
+
Definition concept 3: Word: 2OVER
+
+
: 2OVER 3 PICK 3 PICK ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: 2!

+
+
+
Data stack: ( v2 v1 a -- )
+
+

"2!" is a function word that stors two concecutive values v1 and v2 to +the address a from the data stack. Value v1 is stored at address a and +value v2 is stored at address a + 8.

+
+_______________________________________________________ +
+

+
+
+

Word: 2SWAP

+
+
+
Data stack: ( v1 v2 v3 v4 -- v3 v4 v1 v2 )
+
+

"2SWAP" is a function word the reorgnizes the top 4 cells swappping +the upper and lower pair. This is similar to SWAP but +working with cell pairs rather than single cells.

+
+
+
+
Definition concept 4: Word: 2SWAP
+
+
: 2SWAP 3 ROLL 3 ROOL ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: C,

+
+
+
Data stack: ( v -- )
+
+

"C," (C-comma) is a function word that puts a byte on the +HERE heap. The least significant byte of the value is put +at the current free head address, which also is incremented.

+
+
+
+
Definition concept 5: Word: C,
+
+
: C, HERE @ 1 ALLOT C! ;  ( v -- ; Claim 1 byte and put lsb value there )
+
+
+

See also :, [p_comma]. HERE, @, +ALLOT, C! and ;.

+
+_______________________________________________________ +
+

+
+
+

Word: C@

+
+
+
Data stack: ( a -- v )
+
+

"C@" is a function word that pushes the byte value v from the address a.

+
+_______________________________________________________ +
+

+
+
+

Word: C!

+
+
+
Data stack: ( v a -- )
+
+

"C!" is a function word that stores the byte value v (the least +significant byte of the cell) at the address a.

+
+_______________________________________________________ +
+

+
+
+

Word: R@

+
+
+
Data stack: ( -- v )   Return stack: ( v -- v )
+
+

"R@" is a function word that "copies" the top return stack value onto +the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: R>

+
+
+
Data stack: ( -- v )   Return stack: ( v -- )
+
+

"R>" is a function word that "moves" the top return stack value onto +the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: ABS

+
+
+
Data stack: ( v1 -- v2 )
+
+

"ABS" is a function word that replaces a value with its absolute +value. To that end, the values are 64-bit signed integers.

+
+_______________________________________________________ +
+

+
+
+

Word: ALLOT

+
+
+
Data stack: ( n -- )
+
+

"ALLOT" is a function word that merely increments the HERE +variable with n so as to claim that amount of the heap.

+
+
+
+
+
Defintion concept for ALLOT
+

( n — ) : ALLOT HERE @ + HERE ! ;

+
+
+
+
+
Usage example 1: claim 16 bytes for variable FOO

CREATE FOO DROP HERE @ 16 ALLOT

+
+
+_______________________________________________________ +
+

+
+
+

Word: AND

+
+
+
Data stack: ( v1 v2 -- v3 )
+
+

"AND" is a function word that replaces a value pair with their bitwise +conjunction; each bit is 1 if the corresponding bits of both operands +are 1 and 0 if not.

+
+_______________________________________________________ +
+

+
+
+

Word: MAIN-ARGS

+
+
+
Data stack: ( -- p[argv** argc] )
+
+

"ARGS" is a value word that holds a pointer to the command line data +block which consists of a count cell followed by that many asciiz +pointers and then a 0 cell.

+
+
+
+
Usage example 2: the command line argument block
+
+
ARGS -> 8 bytes: count of non-zero asciiz pointers following
+        8 bytes: command name string
+        8 bytes: first argument string
+        8* ...
+        8 zero
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: BASE

+
+
+
Data stack: ( -- a )
+
+

"BASE" is a variable word for the numerical base used by input and +output functions, NUMBER and [p_dot], when +translating numbers between cell value form and text form. The +numerical base is set to 10 or 16 by DECIMAL and +HEX respectively, and those are the only two bases currently +supported.

+

See also DIGITS, which holds the mapping table from +digits to text.

+
+
+
Usage example 3: claim 16 bytes for variable FOO

CREATE FOO BASE

+
+
+_______________________________________________________ +
+

+
+
+

Word: BEGIN

+
+
+
Data stack: Compiling: ( -- a 0 )
+
+

"BEGIN" is an immediate function word that is used together with +IFBREAK, IFAGAIN and END to +implement structured execution control. BEGIN simply places the +address for resolving branches back to this point during execution, +and then a 0 as a marker so as to allow for an unknown number of block +exit points.

+
+_______________________________________________________ +
+

+
+
+

Word: [']

+
+
+
Data stack: ( -- cfa )   Input stream: word
+
+

"[']" is an immediate function word that reads the next word on the +input stream and pushes its cfa.

+
+_______________________________________________________ +
+

+
+
+

Word: BRANCH

+
+
+
Data stack: ( -- )
+
+

"BRANCH" is a function word that implements execution transfer by +means of adding the subsequent branch offset to the point of +execution.

+
+_______________________________________________________ +
+

+
+
+

Word: BREAK

+

"BREAK" is an immediate function word that lays out an unconditional +branch out of an enclosing xef:p_begin[BEGIN]-END block. +Similar to IFBREAK it lays out the branch cell +followed by a reserved cell for the branch offset, and inserts the +resolution address just above the required 0 on the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: [calltrace]

+

"[calltrace]" is a variable word that ccontains a small assembly +snippet that may be used for debugging when running under gdb.

+
+_______________________________________________________ +
+

+
+
+

Word: CFA>FLAGS@

+
+
+
Data stack: ( cfa -- flags )
+
+

"CFA>FLAGS@" is a function word that pushes word flags of the given cfa.

+
+
+
+
+
Defintion concept for CFA>FLAGS@
+

: CFA>FLAGS@ 16 - @ 16 + ;

+
+
+
+_______________________________________________________ +
+

+
+
+

Word: CLEAR-STREAM

+
+
+
Data stack: ( stream -- )
+
+

"CLEAR-STREAM" is a function word that discards whatever is currently +remaining in the buffer for the stream, so that a subsequent read will +pull in more data from its source.

+ +
+_______________________________________________________ +
+

+
+
+

Word: :

+
+
+
Data stack: ( -- )    Input stream: word
+
+

":" (colon) is a function word that starts a new forth definition. +This includes reading the next word for making a new dictionary entry +and setting evaluation state to compiling mode.

+
+
+
+
Definition concept 6: Word: :
+
+
: : doFORTH READ-WORD CREATE TFA>CFA ! ] ;
+
+
+

See also doFORTH, READ-WORD, +CREATE, TFA>CFA, !, +] and ;.

+
+_______________________________________________________ +
+

+
+
+

Word: ,

+
+
+
Data stack: ( v -- )
+
+

"," (comma) is a function word that puts a cell value on the +HERE heap.

+
+
+
+
Definition concept7: Word: ,
+
+
: , HERE @ 8 ALLOT ! ; ( v -- ; Claim 8 bytes and put value there )
+
+
+

See also :, [p_Ccomma]. HERE, @, +ALLOT, ! and ;.

+
+_______________________________________________________ +
+

+
+
+

Word: CREATE

+
+
+
Data stack: ( char* n -- tfa )
+
+

"CREATE" is a function word that allocates a "word header" with the +indicated [n:char*] print name, and returns the "TFA" (Token Field +Address) of the word. The header memory layout is as follows:

+
+
+
+
+
struct WORD
+TFA  8 link ; tfa of previous word
+pCFA 8 cfap ; CFA = Code Field Address of this word
+     8 flags ;
+PFA  8 length ; length of pname representation
+     ? pname ; the pname bytes
+     1 nul ; a forced nul byte following the pname
+pTFA 8 tfap ; TFA = Token Field Address of this word
+OFF  8 doff ; entry offset for FORTH level execution
+CFA  8 doer ; word execution semantics
+DFA  0 content ; DFA = Data Field Address
+end_struct
+
+
+

A "word" is generally understod as a marker in memory for some content +as held in the memory space following the DFA (Data Field Address).

+

The words CFA (Code Field Address) is the most important field for +RRQFORTH execution, as holding a jump address to the assembly code +that implements the particular execution semantics for the word. +"CREATE" will assign this as "dovariable", which makes the word push +its DFA when executed. This is changed to "doforth" for RRQFORTH +function words initiated by ":" (aka "COLON") or changed to "dovalue" +for RRQFORTH constants created by "CONSTANT".

+
+
+
+
Definition concept 8: Word: CREATE
+
+
HERE @ R> ( save tfa on RS )
+  R@ CURRENT-WORD @ DUP @ , ! ( link in a new word )
+  DUP 49 + R@ + ,             ( pCFA )
+  0 ,                         ( flags )
+  DUP , ( length )
+  HERE @ ROT ROT MEMCPY 0 C,  ( pname + NUL )
+  R@ ,                        ( pTFA )
+  0 ,                         ( OFF )
+  doVARIABLE                  ( CFA, default semantics )
+
+
+
+
+
Usage example: a possible definition of CONSTANT
+

: CONSTANT READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! ! ;

+
+

See also !, +, [p_comma], @, +[p_Ccomma], CURRENT-WORD, DUP, +HERE, HERE, R@, ROT, +and doVARIABLE, +as well as EXECUTE +about the range of "doer" assignments and their meanings.

+
+_______________________________________________________ +
+

+
+
+

Word: CURRENT-WORDLIST

+
+
+
Data stack: ( -- a )
+
+

"CURRENT-WORDLIST" is a variable word that points out the DFA of the +current word list word for FIND to use finding words. The +word list word content is as follows:

+
+
+
+
Layout 1: word list word content
+
+
  8 TFA of latest word in the word list
+  8 DFA of the/a subsequent word list to search through
+
+
+

Note that word lists are chained by "extension" and in general it ends +with the FORTH word list. Initially the +SYSTEM word list is the only other word list.

+
+_______________________________________________________ +
+

+
+
+

Word: DATA-STACK

+
+
+
Data stack: ( -- a )
+
+

"DATA-STACK" is a variable word that harbours the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: DECIMAL

+
+
+
Data stack: ( -- )
+
+

"DECIMAL" is a function word that sets BASE to 10.

+
+
+
+
Definition concept 9: Word: DECIMAL
+
+
: DECIMAL 10 BASE ! ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: DEPTH

+
+
+
Data stack: ( -- v )
+
+

"DEPTH" is a function word that pushes the count of data stack cells +onto the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: DFA>TFA

+
+
+
Data stack: ( dfa -- tfa )
+
+

"DFA>TFA" is a function word that pushes word tfa of the given dfa.

+
+
+
+
+
Definition concept for DFA>TFA
+

: DFA>TFA 24 - @ ;

+
+
+
+_______________________________________________________ +
+

+
+
+

Word: DIGITS

+
+
+
Data stack: ( -- a )
+
+

"DIGITS" is a variable word that holds the character array for mapping +digit values to characters. It contains the 16 characters 0-9 and a-f.

+
+_______________________________________________________ +
+

+
+
+

Word: /

+
+
+
Data stack: ( v1 v2 -- q )
+
+

"/" (div) is a function word that replaces a pair of values with the +results of signed integer division of the first, v1, divided by the +second, v2. To that end, the values are 64-bit signed integers. The +result is the integer quotient, q, and the discarded remainder, r, +where q and r are the respectively largest and smallest integers to +satisfy the formula:

+
+
+
       v1 = q * v2 + r
+
+
+_______________________________________________________ +
+

+
+
+

Word: /MOD

+
+
+
Data stack: ( v1 v2 -- q r )
+
+

"/MOD" (div-mod) is a function word that replaces a pair of values +with the results of signed integer division of the first, v1, divided +by the second, v2. To that end, the values are 64-bit signed integers. +The result is the integer quotient, q, and the remainder, r, where q +and r are the respectively largest and smallest integers to satisfy +the formula:

+
+
+
       v1 = q * v2 + r
+
+
+_______________________________________________________ +
+

+
+
+

Word: doDOES

+
+
+
Data stack: ( -- a )
+
+

"doDOES" is a variable word whose value is the implementation of the +[p_does] execution semantics. This is the same as +doFORTH but it starts at an offset into the word +concerned.

+
+_______________________________________________________ +
+

+
+
+

WORD: DOES>

+
+
+
Data stack: ( -- )
+
+

"DOES>" is a function that in execution mode does nothing but in +compilation mode it changes the execution semantics assignments for +the most recent word to use the dodoes sematics with adjustment +offset to the current heap address. I.e., the word being defined will +have its execution start at whatever comes after "DOES>".

+
+
+
+
Word: DOES>
+
+
: DOES> IMMEDIATE
+STATE @ != IF ( only for compilation mode )
+  CURRENT-WORDLIST @ @ TFA>CFA    ( cfa of current word )
+    doDOES OVER !                 ( set up doer )
+    HERE @ OVER 8 + - SWAP 8 - !  ( set up offset
+  THEN
+;
+
+
+

See also +!, +!⇒>, +→>, +@, +CURRENT-WORDLIST, +HERE, +IF, +IMMEDIATE, +OVER, +STATE, +SWAP, +TFA>CFA, +THEN, +doDOES, +as well as EXECUTE +about the range of "doer" assignments and their meanings.

+
+_______________________________________________________ +
+

+
+
+

Word: doFASM

+
+
+
Data stack: ( -- a )
+
+

"doFASM" is a variable word whose value is the implementation of the +execution semantics for assembly code content.

+
+_______________________________________________________ +
+

+
+
+

Word: doFORTH

+
+
+
Data stack: ( -- a )
+
+

"doFORTH" is a variable word whose value is the implementation of the +RRQFORTH execution semantics.

+
+_______________________________________________________ +
+

+
+
+

Word: doSTRING

+
+
+
Data stack: ( -- a )
+
+

"doFASM" is a variable word whose value is the implementation of the +execution semantics for assembly code implemented words. In those +cases the execution leads to the word content.

+

The register context at entry to an assembly code implemented word is +as follows:

+
+
+
    rax = cfa* of word to execute
+    rsi = cell* in the calling definition, after calling cell
+    rsp = data stack pointer
+    rbp = return stack pointer
+
+

The assembly code must ensure that rsi is preserved and that rsp +and rbp are used according to their roles.

+
+_______________________________________________________ +
+

+
+
+

Word: .

+
+
+
Data stack: ( v -- )
+
+

"." is a function word that prints the top stack value to stdout using +the current BASE (either DECIMAL or +HEX).

+
+_______________________________________________________ +
+

+
+
+

Word: "

+
+
+
data stack: ( -- char n )    Input stream: ...."
+
+

""" (double quote) is a function word that copies the input stream +text up to next double quote to PAD, and returns the +[n:char*] cell pair for that string.

+
+_______________________________________________________ +
+

+
+
+

Word: doVALUE

+
+
+
Data stack: ( -- a )
+
+

"doVALUE" is a variable word whose value is the implementation of the +execution semantics for cell values, which are variables with a single +64-bit cell holding the value.

+

The execution of this result in pushing the value:

+
+
+
Resulting data stack: ( -- v )
+
+
+_______________________________________________________ +
+

+
+
+

Word: doVARIABLE

+
+
+
Data stack: ( -- a )
+
+

"doVARIABLE" is a variable word whose value is the implementation of +the execution semantics for "variables", which basically are markers +into the heap for some number block of memory.

+

The execution of a variable results in pushing its content address:

+
+
+
Resulting data stack: ( -- a )
+
+
+_______________________________________________________ +
+

+
+
+

Word: DROP

+
+
+
Data stack: ( v -- )
+
+

"DROP" is a function word that discards the top stack cell.

+
+_______________________________________________________ +
+

+
+
+

Word: DUP

+
+
+
Data stack: ( v -- v v )
+
+

"DUP" is a function word that duplicates the top stack cell.

+
+_______________________________________________________ +
+

+
+
+

Word: ELSE

+
+
+
Data stack: Compiling: ( a -- a )
+
+

"ELSE" is an immediate function word that is used together with +IF and THEN to implement structured execution +control. ELSE lays out an unresolved unconditional branch as an ending +for the "then-part" of the structured statement, and it then performs +the branch resolution for the "else-part". To that end it replaces the +stacked address which pin-points the foot address the branch offset to +resolve, so that at execution time there is an appropriate conditional +branch past the "then-part" and the "else-part" of the "structured +statement".

+
+_______________________________________________________ +
+

+
+
+

Word: EMIT

+
+
+
Data stack: ( c -- )
+
+

"EMIT" is a function word that puts the given character code to +standard output (file descriptor 1). The character is the least +significant byte of the top cell.

+
+_______________________________________________________ +
+

+
+
+

Word: END

+
+
+
Data stack: Compiling: ( a 0 * -- )
+
+

"END" is an immediate function word that is used together with +BEGIN, IFBREAK and IFAGAIN to +implement structured execution control. END processes the data stack +to resolve any dangling IFBREAK branch offset for the +block of the matching BEGIN.

+
+_______________________________________________________ +
+

+
+
+

Word: =

+
+
+
Data stack: ( v1 v2 -- 0/-1 )
+
+

"=" is a function word that replaces a pair of values with -1 of the +values are equal, and 0 otherwise.

+
+_______________________________________________________ +
+

+
+
+

Word: ERASE

+
+
+
Data stack: ( a n -- )
+
+

"ERASE" is a function word that stores n NUL bytes at address a an up.

+
+_______________________________________________________ +
+

+
+
+

Word: EVALUATE-STREAM

+
+
+
Data stack: ( stream -- ??? 0/1 )     Input stream: ......
+
+

"EVALUATE-STREAM" is a function word that reads words separated by +whitespace from the stream until it discovers an unknown word, or the +stream is exhausted. Depending on STATE, the words are +either executed or compiled, and all ther stack and heap effects are +preserved. "EVALUATE-STREAM" returns with an additional 0 or 1 on the +stack to respectively indicate that the last word was unkown, i.e. not +found (FIND) in the current word list +(CURRENT-WORDLIST) and not a +NUMBER of the current BASE.

+

Note that numbers in the current BASE are treated as known +words that are parsed into cell values. If interpreting, then the +value is left on the stack. If compiling, then the value is added to +the heap subsequent to first adding LIT, which is done +so as to make that value be push to the data stack upon a later +execution.

+

In the DECIMAL base, the number word may begin with a +minus sign.

+

The words are read and executed one by one, accounting for whether its +a number word or not, whether it is an IMMEDIATE word +or not, and whether the state at the time of execution indicates +"compiling" of "interpreting". Immediate words are executed in both +interpreting and compiling state, while other words have their CFA get +added to the heap so as to gain their execution effect upon a later +execution.

+

Note that "EVALUATE-STREAM" keeps the stream (pointer) on the return +stack while reading, parsing and executing.

+

If "EVALUATE-STREAM" ends with 0, then THIS-WORD holds +the [n:chars] reference of the offending word in the stream buffer.

+
+
+
+
Definition concept 10: Word: EVALUATE-STREAM
+
+
( too complex to include here )
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: EXECUTE

+
+
+
Data stack: ( cfa -- )
+
+

"EXECUTE" is a function word that transfers the execution to the +indicated "Code Field Address", which typically is the CFA of an +RRQFORTH word with the CFA cell containing a jump address for the code +that implements the execution semnatics of the word.

+

The following execution semantics are predefined:

+
    +
  • +

    +assembler implemented words constitute their own execution + semantics; +

    +
  • +
  • +

    +[p_doforth] implements the FORTH machine. This treats the word + content as a succession of cells that hold the cfa pointers for the + words that make of the definition. As is customary in FORTH + machines, the advance through that succession is provided by each + word code ending making an explicit jump to its successor. The + RETURN-STACK serves as a call stack for tracking + the nesting of FORTH executions by saving the "addresses" of the + successor cells. +

    +
  • +
  • +

    +[p_dodoes] implements the variation of starting the FORTH + execution somewhere within a definition rather than at the + beginning. +

    +
  • +
  • +

    +[p_dostring], [p_dovalue] and [p_dovariable] implement + different common ways of using word content other the as FORTH + definitions. +

    +
  • +
+
+_______________________________________________________ +
+

+
+
+

Word: EXIT

+
+
+
Data stack: ( -- )
+
+

"EXIT" is a function word that implements the ending of a FORTH +definition and its threading to the subsequent step of the calling +definition.

+
+_______________________________________________________ +
+

+
+
+

Word: FALSE

+
+
+
Data stack: ( -- 0 )
+
+

"FALSE" is a value word representing logical false.

+
+_______________________________________________________ +
+

+
+
+

Word: FIND

+
+
+
Data stack: ( char* n -- [ char* n 0 ]/[ tfa ] )
+
+

"FIND" is a function word that searches the current word list search +path for the given [n:char*] word, and returns the TFA of the matching +word if any. Otherwise FIND preserves the initial data stack but adds +0 to it.

+

The word is sought starting with the +CURRENT-WORDLIST word list, for the first +occurence of a match. If not found, the search continues with the +subsequent word list, and so on.

+

When a word is found, then the data stack is changed by discarding the +[n:char*] double cell string pointer and pushing (only) the TFA of the +matching word instead.

+
+_______________________________________________________ +
+

+
+
+

Word: FORTH

+
+
+
data stack: ( -- a )
+
+

"FORTH" is a variable word for the FORTH word list, which does not +have any subsequent word list.

+
+_______________________________________________________ +
+

+
+
+

Word: @

+
+
+
Data stack: ( a -- v )
+
+

"@" is a function word that pushes the value v from the address a.

+
+_______________________________________________________ +
+

+
+
+

Word: @n--

+
+
+
Data stack: ( a n -- v )
+
+

"@n--" is a function word that pushes the value from the address, a, +then decrements the cell at that address by n.

+
+
+
+
Defintion concept 11Word: @n++
+
+
: @n++ OVER @ DUP ROT - ROT ! ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: @n++

+
+
+
Data stack: ( a n -- v )
+
+

"@n++" is a function word that pushes the value from the address, a, +then increments the cell at that address by n.

+
+
+
+
+
Defintion concept for @n++
+

( a n — v ) : @n++ OVER @ DUP ROT + ROT ! ;

+
+
+
+_______________________________________________________ +
+

+
+
+

Word: >=

+
+
+
Data stack: ( v1 v2 -- 0/-1 )
+
+

">=" is a function word that replaces a pair of values with -1 if the +first, v1, is greater than or equal to the second, v1, otherwise 0. To +that end, the values are 64-bit signed integers.

+
+_______________________________________________________ +
+

+
+
+

Word: >

+
+
+
Data stack: ( v1 v2 -- 0/-1 )
+
+

">" is a function word that replaces a pair of values with -1 if the +first, v1, is greater than the second, v1, otherwise 0. To that end, +the values are 64-bit signed integers.

+
+_______________________________________________________ +
+

+
+
+

Word: >R

+
+
+
Data stack: ( v -- )   Return stack: ( -- v )
+
+

">R" is a function word that "moves" the top data stack value onto the +return stack.

+
+_______________________________________________________ +
+

+
+
+

Word: HERE

+
+
+
Data stack: ( -- a )
+
+

"HERE" is a variable word that keeps the lowest address of the free +allocation space. It get updated by all words that allocate memory.

+
+
+
Usage example
+

1024 HEAP @ + HEAP ! ( allocate 1024 bytes on the heap )

+
+

See also ALLOT.

+
+_______________________________________________________ +
+

+
+
+

Word: HEX

+
+
+
Data stack: ( -- )
+
+

"HEX" is a function word that sets BASE to 16, which uses +letters a-f as additional digits. (Uppercase letter are also accepted +on input).

+
+
+
+
Definition concept 12: Word: HEX
+
+
: HEX 16 BASE ! ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: IF

+
+
+
Data stack: Compiling: ( -- a )
+
+

"IF" is an immediate function word that is used together with +ELSE and THEN to implement structured execution +control. IF results in layout of a 0BRANCH instruction +with an unresolved branch offset, and places the address for resolving +this instruction on the datastack. This address will then be resolved +and asssigned by a subsequent ELSE or THEN so +that at execution time there is an appropriate conditional branch past +the "then-part" of the "structured statement".

+
+_______________________________________________________ +
+

+
+
+

Word: IFAGAIN

+
+
+
Data stack: Compiling: ( -- a )
+
+

"IFAGAIN" is an immediate function word that is used together with +BEGIN, BREAK and END to implement +structured execution control. IFAGAIN scans the datastack for the +nearest preceding BEGIN marker and lays out a branch from this point +the beginning of the block during execution.

+
+_______________________________________________________ +
+

+
+
+

Word: IFBREAK

+
+
+
Data stack: Compiling: ( -- a )
+
+

"IFBREAK" is an immediate function word that is used together with +BEGIN, IFAGAIN and END to +implement structured execution control. IFBREAK simply places the +address for resolving branches from this point the end of the block +during execution.

+
+_______________________________________________________ +
+

+
+
+

Word: IMMEDIATE

+
+
+
Data stack: ( -- )
+
+

"IMMEDIATE" is an immediate function word that sets the flags field of +the most recent word to 1, thereby making that word an immediate word.

+
+
+
+
Definition concept 13:Word: IMMEDIATE
+
+
: IMMEDIATE IMMEDIATE 1 CURRENT-WORDLIST @ @ 16 + ! ;
+
+
+

See also :, CURRENT-WORDLIST, +@, +, !, and [p_semicolon;].

+
+_______________________________________________________ +
+

+
+
+

Word: [

+
+
+
Data stack: ( -- )
+
+

"[" (left bracket) is a function word that sets the stream evaluation +mode to be intepreting. In this mode, words are executed immediately +after parsing, by invoking their "doer".

+
+
+
+
Definition concept 14: Word: [
+
+
: [ IMMEDIATE 0 STATE ! ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: <=

+
+
+
Data stack: ( v1 v2 -- 0/-1 )
+
+

"<=" is a function word that replaces a pair of values with -1 if the +first, v1, is less than or equal to the second, v1, otherwise 0. To +that end, the values are 64-bit signed integers.

+
+_______________________________________________________ +
+

+
+
+

Word: <

+
+
+
Data stack: ( v1 v2 -- 0/-1 )
+
+

"<" is a function word that replaces a pair of values with -1 if the +first, v1, is less than the second, v1, otherwise 0. To that end, the +values are 64-bit signed integers.

+
+_______________________________________________________ +
+

+
+
+

Word: LIT

+
+
+
Data stack: ( -- v )
+
+

"LIT" is a function word that pushes the cell subsequent and moves +excution past that. The literal value is thus layed out as if a +subsequent CFA pointer in the containing definition, and the LIT +execution will make the execution skip past that and instead contine +with the CFA pointer following the value.

+

It’s not a good idea to use "LIT" interactively.

+
+
+
+
Definition concept 15: Word: LIT
+
+
: LIT R> DUP 8 + >R @ ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: S"

+
+
+
Data stack: ( -- chars* n )
+
+

"S"" is a function word that pushes the [n:char] pointer for a string +inlined subsequently to it in the containing definition. This is +similar to LIT but for a string literal.

+
+
+
+
Definition concept 16: Word: LIT
+
+
: LIT R> DUP @ 2DUP + 8 + >R SWAP 8 + SWAP ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: LOAD-FILE"

+
+
+
data stack: ( "name" -- )
+
+

"LOAD-FILE"" is a function word that opens a file via +OPEN-FILE", allocates a stream buffer of 15000 +bytes for reading it, saves the stream pointer as value for the newly +created filename variable, and then it invokes +EVALUATE-STREAM for processing the file.

+
+_______________________________________________________ +
+

+
+
+

Word: (

+
+
+
Data stack: ( -- )
+
+

"(" (left parenthesis) is a function word that scans and ignores words +until the next right parenthesis, or the end of the stream. This is +used for comments in RRQFORTH code.

+

Note that the terminating right parenthesis is a word, i.e. must have +whitespace before and after it.

+
+_______________________________________________________ +
+

+
+
+

Word: MALLOC

+
+
+
Data stack: ( n -- a )
+
+

"MALLOC" is a word that allocates memory using mmap of at least n +bytes and returns the lowest address of the allocated block.

+

Note that this makes new page allocations for the process from the +kernel, and the granularity is in pages, i.e. a multiple of 4 kb.

+

The memory is allocated with READ and WRITE access but not EXEC +access, and flagged as PRIVATE, ANONYMOUS and LOCKED. See the "man +page" of mmap for details.

+

See also STREAM

+
+_______________________________________________________ +
+

+
+
+

Word: -

+
+
+
Data stack: ( v1 v2 -- v3 )
+
+

"-" (minus) is a function word that replaces a pair of values with the +result of reducing the first, v1, with the second, v2. To that end, +the values are 64-bit signed integers.

+
+_______________________________________________________ +
+

+
+
+

Word: *

+
+
+
Data stack: ( v1 v2 -- v3 )
+
+

"*" is a function word that replaces a pair of values with the result +of multiplying them. To that end, the values are 64-bit signed +integers, and clipping the result to the least signifcant 64 bits.

+
+_______________________________________________________ +
+

+
+
+

Word: NEGATE

+
+
+
Data stack: ( v1 -- v2 )
+
+

"NEGATE" is a function word that replaces a value with its +2’s-complement negation. To that end, the values are 64-bit signed +integers.

+
+_______________________________________________________ +
+

+
+
+

Word: NIP

+
+
+
Data stack: ( v1 v2 -- v2 )
+
+

"NIP" is a function word that discards the second of the top two cells +on the data stack.

+
+
+
+
Definition concept 17: Word: NIP
+
+
: NIP SWAP DROP ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: NL

+
+
+
Data stack: ( -- v )
+
+

"NL" is a value word pushing a newline character onto the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: NOT

+
+
+
Data stack: ( v1 -- v2 )
+
+

"NOT" is a function word that replaces a value with its bitwise +complement; each bit is zero if non-zero, and non-zero if zero.

+

Compare with <<p_0equal,0⇒>.

+
+_______________________________________________________ +
+

+
+
+

Word: NUMBER

+
+
+
Data stack: ( char n -- [ 0 ]/[ v 1 ] )
+
+

"NUMBER" is a function word that parses a text number using +BASE as numerical base, then returns the result number and +a 1 on top, or just a 0 if the word didn’t parse.

+

A number consists of, first an optional minus sign, if in +DECIMAL base, then digits 0-9 and, if in HEX +base, letters a-f or A-F for values 10-15. I.e. the normal positive or +negative decimal integers or normal (positive only) hexadecimal +integers.

+
+
+
+
Definition concept 18: Word: NUMBER
+
+
( too complex to include here )
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: OPEN-FILE"

+
+
+
Data stack: ( "name" -- fd )
+
+

"OPEN-FILE"" is a function word that reads the intputstream for a +filename, adds that to the dictionary as a no-content variable, opens +that file and returns the input file descriptor.

+
+_______________________________________________________ +
+

+
+
+

Word: OR

+
+
+
Data stack: ( v1 v2 -- v3 )
+
+

"OR" is a function word that replaces a value pair with their bitwise +disjunction; each bit is 1 if the corresponding bits of any operand +is 1 and 0 if not.

+
+_______________________________________________________ +
+

+
+
+

Word: OVER

+
+
+
Data stack: ( v1 v2 -- v1 v2 v1 )
+
+

"OVER" is a function word that duplicates the second top stack cell on +the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: PAD

+
+
+
Data stack: ( -- a )
+
+

"PAD" is a variable word for a 1 kb data space that is used by +[p_double_quote] (only), and otherwise free for temporary use.

+
+_______________________________________________________ +
+

+
+
+

Word: PICK

+
+
+
Data stack: ( vu...v1 v0 u -- vu...v1 v0 vu )
+
+

"PICK" is a function word that pushes the u:th data stack cell down +from top onto the data stack. 0 indicates the top cell making it the +same as DUP, and 1 indicates the second top cell making it +the same as OVER.

+
+_______________________________________________________ +
+

+
+
+

Word: +

+
+
+
Data stack: ( v1 v2 -- v3 )
+
+

"+" (plus) is a function word that replaces a pair of values with the +result of adding them. To that end, the values are 64-bit signed +integers.

+
+_______________________________________________________ +
+

+
+
+

Word: PROGRAM_VERSION

+
+
+
Data stack: ( -- char* length )
+
+

"PROGRAM_VERSION" is a string variable hilding the version string.

+
+_______________________________________________________ +
+

+
+
+

Word: !

+
+
+
Data stack: ( v a -- )
+
+

"!" is a function word that stores the cell value v at the address a.

+
+_______________________________________________________ +
+

+
+
+

Word: !+

+
+
+
Data stack: ( a n -- )
+
+

"!+" is a function word that adds n to the cell value at a.

+
+
+
+
+
definition concept for !+
+

( a n — ) : !+ OVER @ + SWAP ! ;

+
+
+
+_______________________________________________________ +
+

+
+
+

Word: QUIT

+
+
+
Data stack: ??
+
+

"QUIT" is a function word that implements the root execution loop of +RRQFORTH. First it resets the stacks to their original settings, and +thereafter it enters loop of reading words from STDIN and +executing them.

+
+_______________________________________________________ +
+

+
+
+

Word: '

+
+
+
data stack: ( -- cfa )    Input stream: word
+
+

"'" (single quote) is a function word that reads and find the next +word on the input stream and pushes its cfa.

+
+_______________________________________________________ +
+

+
+
+

Word: READ-STREAM-CHAR

+
+
+
Data stack: ( stream -- c )
+
+

"READ-STREAM-CHAR" is a function word that gets the next character +from the given stream buffer, possibly refilling the buffer if it is +backed by a file descriptor. The refill is done by a SYS_READ call +when more characters are needed. The next character is pushed on the +stack, unless the stream is exhausted in which case the -1 is pushed +instead.

+

See also STREAM.

+
+_______________________________________________________ +
+

+
+
+

Word: READ-WORD

+
+
+
Data stack: ( stream -- char* n )
+
+

"READ-WORD" is a function word that "reads" the next whitespace +separated word from the given stream and returns the [n:char*] duoble +cell pointer for it. The characters of the word are copied to +PAD, and there is a limit of 1024 characters.

+

At the end of the stream READ-WORD returns 0 length.

+
+_______________________________________________________ +
+

+
+
+

Word: REALLOC

+
+
+
Data stack: ( a m n -- a )
+
+

"REALLOC" is a word that reallocates memory using mremap of address a +of size m to be size n bytes and returns the lowest address of the +allocated block.

+

Note that this makes new page allocations for the process from the +kernel, and the granularity is in pages, i.e. a multiple of 4 kb.

+

The memory is reampped using the MREMAP_MAYMOVE flag,

+

See also MALLOC

+
+_______________________________________________________ +
+

compile.asm: WORD p_right_bracket,],fasm

+

+
+
+

Word: ]

+
+
+
Data stack: ( -- )
+
+

"]" (right bracket) is a function word that sets the stream evaluation +mode to be compiling. In this mode words parsed into CFA pointers +which are placed on the heap in the given order, unless the word is +flagged as IMMEDIATE or a NUMBER. An +immediate word is executed immediately, and a number is parsed and +left on the stack.

+

Note that a word is parsed as a number only if it is not found in the +wordlist; i.e., the word list may contain definitions for numbers.

+
+
+
+
Definition concept 19: Word: ]
+
+
: ] 1 STATE ! ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: ROLL

+
+
+
Data stack: ( vu...v1 v0 u -- ...v1 v0 vu )
+
+

"ROLL" is a function word that "moves" the u:th data stack cell down +from top onto the data stack while discarding it. 0 indicates the top +cell; 1 indicates the second top cell making it the same as +SWAP; 2 indicates the third top cell making it the same as +ROT.

+
+_______________________________________________________ +
+

+
+
+

Word: ROT

+
+
+
Data stack: ( v1 v2 v3 -- v2 v3 v1 )
+
+

"ROT" is a function word that "rotates" the top three data stack cells +such that the third becomes the first while the second becomes third +and the first becomes the second.

+

See also ROLL.

+
+_______________________________________________________ +
+

+
+
+

Word: R[n]

+
+
+
Data stack: ( n -- a )
+
+

"R[n]" is a function word that pushes the address for the n:th cell on +the top return stack value onto the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: ;

+
+
+
Data stack: ( -- )
+
+

";" (semi-colon) is a function word that ends a new forth definition +by means of adding an EXIT

+
+
+
+
Definition concept 20: Word: :
+
+
: ; IMMEDIATE ' EXIT , ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: [p_setup_signals]

+
+
+
Data stack: ( -- a )
+
+

"[p_setup_signals]" is a variable word that contains the assembly code +sniippet for setting up the signal handling. rrqforth handles SEGV by +restarting the interpreter loop on STDIN.

+
+_______________________________________________________ +
+

+
+
+

Word: <<

+
+
+
Data stack: ( v1 n -- v2 )
+
+

"<<" is a function word that shifts value v1 n steps left (i.e. +"moving" bits towards more significant bits) to form value v2.

+
+_______________________________________________________ +
+

+
+
+

Word: >>

+
+
+
Data stack: ( v1 n -- v2 )
+
+

">>" is a function word that shifts value v1 n steps right (i.e. +"moving" bits towards less significant bits) to form value v2.

+
+_______________________________________________________ +
+

+
+
+

Word: s>>

+
+
+
Data stack: ( v1 n -- v2 )
+
+

"s>>" is a function word that shifts value v1 n steps right (i.e. +"moving" bits towards less significant bits) to form value v2, but +preserving (and copying) the sign bit.

+
+_______________________________________________________ +
+

+
+
+

Word: SP

+
+
+
Data stack: ( -- v )
+
+

"SP" is a value word pushing a space character onto the data stack.

+
+_______________________________________________________ +
+

+
+
+

Word: STATE

+
+
+
Data stack: ( -- a )
+
+

"STATE" is a variable word marking whether the stream evaluator is in +compiling mode (1) or interpreting (0) mode.

+
+_______________________________________________________ +
+

+
+
+

Word: STDIN

+
+
+
Data stack: ( -- stream )
+
+

"STDIN" is a value word referring to the stream buffer for the +standard input file descriptor.

+
+_______________________________________________________ +
+

+
+
+

Word: STREAM

+
+
+
Data stack: ( fd size -- addr ) or ( block -1 -- addr )
+
+

"STREAM" is a function word that sets up a buffer for an input file +descriptor or for a memory block (of size+data).

+
+

File descriptor backed STREAM

+

A file descriptor backed STREAM gains a buffer of the given size +prefixed by a 32 byte STREAM header of the following layout:

+
+
+
+
Stream layout 2, for file descriptor
+
+
  8 bytes = size of buffer (excluding the 32 byte header)
+  8 bytes source file descriptor
+  8 bytes current fill
+  8 current read position
+
+
+
+
+

Memory block backed STREAM

+

A memory block stream is only the header (though allocated via +MALLOC which reserves a full kernel page) with the +following layout:

+
+
+
+
Stream layout 3, for memory block
+
+
  8 bytes = block address
+  8 -1 (indicates memory block)
+  8 size of block (taken from the block's first 8 bytes)
+  8 current read position
+
+
+
+_______________________________________________________ +
+

+
+
+
+

Word: STREAM-NCHARS

+
+
+
Data stack: ( stream -- n )
+
+

"STREAM-NCHARS" is a function word that scans ahead in the stream +buffer for the next non-whitespace character, and returns its position +relative to the end of the buffer. This is done without changing the +stream (or filling it by reading the backing file).

+
+_______________________________________________________ +
+

+
+
+

Word: STRLEN

+
+
+
Data stack: ( s -- n )
+
+

"STRLEN" is a function words that counts how many bytes there are from +s to the first NUL byte and returns that count, n, not including the +NUL byte.

+
+_______________________________________________________ +
+

+
+
+

Word: STRNCMP

+
+
+
Data stack: ( s1 s2 n -- v )
+
+

"STRNCMP" is a function words that compares up to n characters of +character sequences s1 and s2, and returns the difference of the first +differing characters, as in s2[i] - s1[i], or 0 if all n characters +are the same.

+

I.e., the value v is less than 0 if string [n:s1] is alpha-numerically +less than [n:s2], +v is greater than 0 if [n:s1] is greater than [n:s2], +and v is 0 if [n:s1] and [n:s2] are equal.

+
+_______________________________________________________ +
+

+
+
+

Word: STRNCPY

+
+
+
Data stack: ( s1 s2 n -- )
+
+

"STRNCPY" is a function words that copies n bytes of byte sequence s1 +to s2.

+
+_______________________________________________________ +
+

+
+
+

Word: SWAP

+
+
+
Data stack: ( v1 v2 -- v2 v1 )
+
+

"SWAP" is a function word the swaps the top two data stack cells.

+
+_______________________________________________________ +
+

+
+
+

Word: SYSTEM

+
+
+
Data value: ( -- a )
+
+

"SYSTEM" is a variable that holds the word list data for the system +calls. This is set up as separate word list from FORTH +merely as a matter of segregation.

+
+_______________________________________________________ +
+

+
+
+

Word: TELL

+
+
+
Data stack: ( char* n -- )
+
+

"TELL" is a function word that prints a string to stdout (file +descriptor 1).

+
+_______________________________________________________ +
+

+
+
+

Word: TERMINATE0

+
+
+
Data stack: ( -- )
+
+

"TERMINATE0" is a function word that terminates the program with exit +code 0.

+
+_______________________________________________________ +
+

+
+
+

Word: TFA>CFA

+
+
+
Data stack: ( tfa -- cfa )
+
+

"TFA>CFA" is a function word that pushes word cfa of the given tfa.

+
+
+
+
+
Definition concept for TFA>CFA
+

: TFA>CFA 8 + @ ;

+
+
+
+_______________________________________________________ +
+

+
+
+

Word: TFA>DFA

+
+
+
Data stack: ( tfa -- dfa )
+
+

"TFA>DFA" is a function word that pushes word dfa of the given tfa.

+
+
+
+
+
Definition concept for TFA>DFA
+

: TFA>DFA TFA>CFA 8 + ;

+
+
+
+_______________________________________________________ +
+

+
+
+

Word: TFA>FLAGS@

+
+
+
Data stack: ( tfa -- flags )
+
+

"TFA>FLAGS@" is a function word that pushes word flags of the given tfa.

+
+
+
+
Defintion concept 21Word: TFA>FLAGS@
+
+
: TFA>FLAGS@ 16 + @ ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: TFA>NAMEZ

+
+
+
Data stack: ( tfa -- char* )
+
+

"TFA>NAMEZ" is a function word that pushes changes a tfa pointer to a +pointer to the word pname’s character sequence, which is zero +terminated as well as preceded by a length cell.

+
+
+
+
Defintion concept for TFA>NAMEZ
+
+
: TFA>NAMEZ 32 + ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: THEN

+
+
+
Data stack: Compiling: ( a -- )
+
+

"THEN" is an immediate function word that is used together with +IF and ELSE to implement structured execution +control. THEN performs the branch resolution for the stacked address +which pinpoints the foot address the branch offset to resolve, so that +at execution time there is an appropriate conditional branch past the +"then-part" or the "else-part" of the "structured statement".

+
+_______________________________________________________ +
+

+
+
+

Word: THIS-WORD

+
+
+
Data stack: ( -- a )
+
+

"THIS-WORD" is a variable word used in +[p_evaluate_stream:EVALUATE-STREAM] as cache for the [n:char*] +values of the successive words being evaluated. This typically points +into the input stream buffer and remain valid until further stream +buffering functions are used.

+
+_______________________________________________________ +
+

+
+
+

Word: TRUE

+
+
+
Data stack: ( -- -1 )
+
+

"TRUE" is a value word representing logical true.

+
+_______________________________________________________ +
+

+
+
+

Word: TUCK

+
+
+
Data stack ( v1 v2 -- v2 v1 v2 )
+
+

"TUCK" is a function word that "inserts" the top cell below the second +cell on the data stack.

+
+
+
+
Definition concept 22: Word: TUCK
+
+
: TUCK SWAP OVER ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: !=

+
+
+
Data stack: ( v1 v2 -- 0/-1 )
+
+

"!=" is a function word that replaces a pair of values with -1 of the +values are unequal, and 0 otherwise.

+
+_______________________________________________________ +
+

+
+
+

Word: VERBOSE?

+
+
+
Data stack: ( -- a )
+
+

"VERBOSE?" is a variable word that is assigned at start up to -1 or 0 +signify whether or not the command line arguments includes "-v". When +non-zero (i.e. running rrqforth with "-v") the evaluation loop is more +verbose.

+
+_______________________________________________________ +
+

+
+
+

Word: WITHIN

+
+
+
Data stack: ( v lo hi -- 0/-1
+
+

"WITHIN" is a function word that replaces a triple of values with -1 +of the the first, v, is within the value range spanned by the second, +lo, inclusive and third, hi, exclusive.

+
+
+
+
Definition concept 23: Word: WITHIN
+
+
: WITHIN 2 PICK > ROT ROT <= AND ;
+
+
+
+_______________________________________________________ +
+

+
+
+

Word: WORDS

+
+
+
Data stack: ( wl -- )
+
+

"WORDS" is a function word that prints all words of teh given word +list to stdout (file descriptor 1).

+
+_______________________________________________________ +
+

+
+
+

Word: XOR

+
+
+
Data stack: ( v1 v2 -- v3 )
+
+

"XOR" is a function word that replaces a value pair with their bitwise +exclusion; each bit is 1 if the corresponding bits of the two operands +differ and 0 if not.

+
+_______________________________________________________ +
+

+
+
+

Word: RETURN-STACK

+
+
+
Data stack: ( -- a )
+
+

"RETURN-STACK" is a variable word harbouring the return stack.

+
+
+
+
+

System calls

+
+

RRQFORTH includes function wrapping for all "Linux syscalls", which +generally are described in their "man pages. This wrapping takes the +arguments fro the data stack in reverse order, i.e. the first argument +is deepest.

+

Use SYSTEM WORDS to get a list of all (321) available syscalls.

+
+
+
+

+ + + diff --git a/rrqforth b/rrqforth new file mode 100755 index 0000000000000000000000000000000000000000..378758d58e4ddc7438250e7a5fd1591d409cef2b GIT binary patch literal 2148423 zcmeF)d7LFxeK-DMANFBWRFuo60-`X23JiFAx^K^IrZ>8Kh8bCAP!vQ(kijh|=(r6d z;=aVV;1ZK4ny7J&3E)DEhQyc{#a)y9;F%b=s2G=iPSvebUH4RXU-JC>d(Z2|6g~Al z-%p)))va51?dv+@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o^xOY>T^_=gCCy>aYHSm3Z`Z5(b%K38{{WtA%(t0ZP=b-~>5gRc_e&|O# zXIZu Date: Wed, 2 Jun 2021 23:38:50 +1000 Subject: [PATCH 09/16] standardized call-out blocks --- adoc/inline_code.adoc | 3 + adoc/p_0branch.adoc | 10 ++ adoc/p_0equal.adoc | 2 +- adoc/p_0less.adoc | 12 +- adoc/p_1branch.adoc | 9 ++ adoc/p_2dup.adoc | 9 +- adoc/p_2over.adoc | 10 +- adoc/p_2swap.adoc | 9 +- adoc/p_Ccomma.adoc | 7 +- adoc/p_base.adoc | 6 - adoc/p_begin.adoc | 18 +++ adoc/p_bracketed_quote.adoc | 7 + adoc/p_branch.adoc | 10 ++ adoc/p_break.adoc | 21 +++ adoc/p_colon.adoc | 7 +- adoc/p_comma.adoc | 7 +- adoc/p_create.adoc | 18 ++- adoc/p_current_wordlist.adoc | 1 + adoc/p_decimal.adoc | 7 +- adoc/p_does.adoc | 6 +- adoc/p_evaluate_stream.adoc | 9 -- adoc/p_get_n_decrement.adoc | 7 +- adoc/p_here.adoc | 7 +- adoc/p_hex.adoc | 7 +- adoc/p_immediate.adoc | 7 +- adoc/p_left_bracket.adoc | 8 +- adoc/p_literal.adoc | 7 +- adoc/p_literal_string.adoc | 8 +- adoc/p_nip.adoc | 7 +- adoc/p_number.adoc | 7 - adoc/p_right_bracket.adoc | 7 +- adoc/p_semicolon.adoc | 8 +- adoc/p_stream.adoc | 8 +- adoc/p_tfa2flags_get.adoc | 7 +- adoc/p_tfa2namez.adoc | 4 +- adoc/p_tuck.adoc | 7 +- adoc/p_within.adoc | 7 +- reference.html | 265 +++++++++++++++++++++-------------- 38 files changed, 333 insertions(+), 233 deletions(-) diff --git a/adoc/inline_code.adoc b/adoc/inline_code.adoc index b1a9c46..d85166c 100644 --- a/adoc/inline_code.adoc +++ b/adoc/inline_code.adoc @@ -20,3 +20,6 @@ RRQFORTH executon by means of the following instruction sequence: forthcode: ---- ==== + +Note that the FORTH compiler does not invoke an assembler so any +inline assembly code must be provided in its binary form. diff --git a/adoc/p_0branch.adoc b/adoc/p_0branch.adoc index a11ec49..6488d62 100644 --- a/adoc/p_0branch.adoc +++ b/adoc/p_0branch.adoc @@ -14,3 +14,13 @@ the point of execution. If the value, v, is 0 then the branch offset is added, and otherwise execution continues with the cell following the branch offset in the definition. +Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first non-zero +value. + +See also <>, <>, <>, +<>, <> and <>. diff --git a/adoc/p_0equal.adoc b/adoc/p_0equal.adoc index 827c0f1..8e5379c 100644 --- a/adoc/p_0equal.adoc +++ b/adoc/p_0equal.adoc @@ -13,4 +13,4 @@ Data stack: ( v -- 0/-1 ) complement; the result is zero if the value non-zero, and the result is non-zero if the value is zero. -Compare with <>. +This is the same function as <>. diff --git a/adoc/p_0less.adoc b/adoc/p_0less.adoc index b068b63..b5c1f5e 100644 --- a/adoc/p_0less.adoc +++ b/adoc/p_0less.adoc @@ -12,12 +12,10 @@ Data stack: ( v -- 0/-1 ) less than 0, and 0 otherwise. ==== -.Word: 0< -[caption='Definition concept {counter:exec}: '] ----- -: 0= 0 SWAP < ; ----- +.Definition concept for 0< +**** +( v -- 0/1 ) : 0= 0 SWAP < ; +**** ==== -See also <> and -<>. +See also <> and <>. diff --git a/adoc/p_1branch.adoc b/adoc/p_1branch.adoc index 0483d00..8d1b7ca 100644 --- a/adoc/p_1branch.adoc +++ b/adoc/p_1branch.adoc @@ -14,3 +14,12 @@ the point of execution. If the value, v, is non-zero then the branch offset is added, and otherwise execution continues with the cell following the branch offset in the definition. +Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first zero value. + +See also <>, <>, <>, +<>, <> and <>. diff --git a/adoc/p_2dup.adoc b/adoc/p_2dup.adoc index 0b39b08..d425131 100644 --- a/adoc/p_2dup.adoc +++ b/adoc/p_2dup.adoc @@ -12,9 +12,8 @@ Data stack: ( v1 v2 -- v1 v2 v1 v2 ) stack. ==== -.Word: 2DUP -[caption='Definition concept {counter:exec}: '] ----- -: 2DUP OVER OVER ; ----- +.Definition concept for 2DUP +**** +( v1 v2 -- v1 v2 v1 v2 ) : 2DUP OVER OVER ; +**** ==== diff --git a/adoc/p_2over.adoc b/adoc/p_2over.adoc index 058bfdd..fcfc184 100644 --- a/adoc/p_2over.adoc +++ b/adoc/p_2over.adoc @@ -13,10 +13,8 @@ onto the top of the data stack. This is similar to <> but working with cell pairs rather than single cells. ==== -.Word: 2OVER -[caption='Definition concept {counter:exec}: '] ----- -: 2OVER 3 PICK 3 PICK ; ----- +.Definition concept for 2OVER +**** +( v1 v2 v3 v4 -- v1 v2 v3 v4 v1 v2 ) : 2OVER 3 PICK 3 PICK ; +**** ==== - diff --git a/adoc/p_2swap.adoc b/adoc/p_2swap.adoc index 6c123cf..2c03e49 100644 --- a/adoc/p_2swap.adoc +++ b/adoc/p_2swap.adoc @@ -13,9 +13,8 @@ the upper and lower pair. This is similar to <> but working with cell pairs rather than single cells. ==== -.Word: 2SWAP -[caption='Definition concept {counter:exec}: '] ----- -: 2SWAP 3 ROLL 3 ROOL ; ----- +.Definition concept for 2SWAP +**** +( v1 v2 v3 v4 -- v3 v4 v1 v2 ) : 2SWAP 3 ROLL 3 ROLL ; +**** ==== diff --git a/adoc/p_Ccomma.adoc b/adoc/p_Ccomma.adoc index a0b07cd..75992a8 100644 --- a/adoc/p_Ccomma.adoc +++ b/adoc/p_Ccomma.adoc @@ -14,11 +14,10 @@ Data stack: ( v -- ) at the current free head address, which also is incremented. ==== -.Word: C, -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for C, +**** : C, HERE @ 1 ALLOT C! ; ( v -- ; Claim 1 byte and put lsb value there ) ----- +**** ==== See also <>, <>. <>, <>, diff --git a/adoc/p_base.adoc b/adoc/p_base.adoc index fe6d66f..a8748b7 100644 --- a/adoc/p_base.adoc +++ b/adoc/p_base.adoc @@ -17,9 +17,3 @@ supported. See also <>, which holds the mapping table from digits to text. - -==== -.Usage example {counter:example}: claim 16 bytes for variable FOO -[caption='Usage example {counter:example}: '] -CREATE FOO BASE -==== diff --git a/adoc/p_begin.adoc b/adoc/p_begin.adoc index ca4f1af..da124ab 100644 --- a/adoc/p_begin.adoc +++ b/adoc/p_begin.adoc @@ -14,3 +14,21 @@ implement structured execution control. BEGIN simply places the address for resolving branches back to this point during execution, and then a 0 as a marker so as to allow for an unknown number of block exit points. + +==== +.Usage example {counter:example}: +---- +: WTELL ( tfa -- ; Print word pname ) + 24 + DUP 8 + SWAP @ TELL SP EMIT +; + +: WORDS ( wordlist -- ; Print all words of word list ) + BEGIN + @ DUP 0= IFBREAK + DUP WTELL + END + DROP + NL EMIT +; +---- +==== diff --git a/adoc/p_bracketed_quote.adoc b/adoc/p_bracketed_quote.adoc index 74e15a3..b7a231c 100644 --- a/adoc/p_bracketed_quote.adoc +++ b/adoc/p_bracketed_quote.adoc @@ -11,3 +11,10 @@ Data stack: ( -- cfa ) Input stream: word "[']" is an immediate function word that reads the next word on the input stream and pushes its cfa. +==== +.Definition concept for ['] +**** +: ['] IMMEDIATE ' ; +**** +==== + diff --git a/adoc/p_branch.adoc b/adoc/p_branch.adoc index 089e238..02f7319 100644 --- a/adoc/p_branch.adoc +++ b/adoc/p_branch.adoc @@ -11,3 +11,13 @@ Data stack: ( -- ) "BRANCH" is a function word that implements execution transfer by means of adding the subsequent branch offset to the point of execution. + +Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first zero value. + +See also <>, <>, <>, +<>, <> and <>. diff --git a/adoc/p_break.adoc b/adoc/p_break.adoc index f7da196..dec6fd7 100644 --- a/adoc/p_break.adoc +++ b/adoc/p_break.adoc @@ -9,3 +9,24 @@ branch out of an enclosing xef:p_begin[BEGIN]-xref:p_end[END] block. Similar to xref:p_ifbreak[IFBREAK] it lays out the branch cell followed by a reserved cell for the branch offset, and inserts the resolution address just above the required 0 on the data stack. + +==== +.Usage example {counter:example}: unconditional break with a condition. +---- +: WTELL ( tfa -- ; Print word pname ) + 24 + DUP 8 + SWAP @ TELL SP EMIT +; + +: WORDS ( wordlist -- ; Print all words of word list ) + BEGIN + @ DUP IF DUP WTELL ELSE BREAK THEN + END + DROP + NL EMIT +; +---- +==== + +See also <>, <>, +<>, <>, <>, +<> and <>. diff --git a/adoc/p_colon.adoc b/adoc/p_colon.adoc index 3a5acec..86b9104 100644 --- a/adoc/p_colon.adoc +++ b/adoc/p_colon.adoc @@ -14,11 +14,10 @@ This includes reading the next word for making a new dictionary entry and setting evaluation state to compiling mode. ==== -.Word: : -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for : +**** : : doFORTH READ-WORD CREATE TFA>CFA ! ] ; ----- +**** ==== See also <>, <>, diff --git a/adoc/p_comma.adoc b/adoc/p_comma.adoc index ae00035..f3064b7 100644 --- a/adoc/p_comma.adoc +++ b/adoc/p_comma.adoc @@ -13,11 +13,10 @@ Data stack: ( v -- ) <> heap. ==== -.Word: , -[caption='Definition concept{counter:exec}: '] ----- +.Definition concept for , +**** : , HERE @ 8 ALLOT ! ; ( v -- ; Claim 8 bytes and put value there ) ----- +**** ==== See also <>, <>. <>, <>, diff --git a/adoc/p_create.adoc b/adoc/p_create.adoc index cf8914e..5fdfe27 100644 --- a/adoc/p_create.adoc +++ b/adoc/p_create.adoc @@ -14,6 +14,8 @@ indicated [n:char*] print name, and returns the "TFA" (Token Field Address) of the word. The header memory layout is as follows: ==== +.rrqforth word structure +[caption='Layout {counter:layout}: '] ---- struct WORD TFA 8 link ; tfa of previous word @@ -42,9 +44,8 @@ function words initiated by ":" (aka "COLON") or changed to "dovalue" for RRQFORTH constants created by "CONSTANT". ==== -.Word: CREATE -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for CREATE +**** HERE @ R> ( save tfa on RS ) R@ CURRENT-WORD @ DUP @ , ! ( link in a new word ) DUP 49 + R@ + , ( pCFA ) @@ -54,13 +55,16 @@ HERE @ R> ( save tfa on RS ) R@ , ( pTFA ) 0 , ( OFF ) doVARIABLE ( CFA, default semantics ) ----- +**** ==== -.Usage example: a possible definition of CONSTANT -**** +==== +.a possible definition of CONSTANT +[caption='Usage example {counter:example}: '] +---- : CONSTANT READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! ! ; -**** +---- +==== See also <>, <>, <>, <>, <>, <>, <>, diff --git a/adoc/p_current_wordlist.adoc b/adoc/p_current_wordlist.adoc index 91d9240..a5ab031 100644 --- a/adoc/p_current_wordlist.adoc +++ b/adoc/p_current_wordlist.adoc @@ -10,6 +10,7 @@ Data stack: ( -- a ) "CURRENT-WORDLIST" is a variable word that points out the DFA of the current word list word for <> to use finding words. The word list word content is as follows: + ==== .word list word content [caption='Layout {counter:layout}: '] diff --git a/adoc/p_decimal.adoc b/adoc/p_decimal.adoc index b06e5f2..2925653 100644 --- a/adoc/p_decimal.adoc +++ b/adoc/p_decimal.adoc @@ -12,9 +12,8 @@ Data stack: ( -- ) "DECIMAL" is a function word that sets <> to 10. ==== -.Word: DECIMAL -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for DECIMAL +**** : DECIMAL 10 BASE ! ; ----- +**** ==== diff --git a/adoc/p_does.adoc b/adoc/p_does.adoc index a9ac349..b31b42b 100644 --- a/adoc/p_does.adoc +++ b/adoc/p_does.adoc @@ -15,8 +15,8 @@ offset to the current heap address. I.e., the word being defined will have its execution start at whatever comes after "DOES>". ==== -.Word: DOES> ----- +.Defintion concept for DOES> +**** : DOES> IMMEDIATE STATE @ != IF ( only for compilation mode ) CURRENT-WORDLIST @ @ TFA>CFA ( cfa of current word ) @@ -24,7 +24,7 @@ STATE @ != IF ( only for compilation mode ) HERE @ OVER 8 + - SWAP 8 - ! ( set up offset THEN ; ----- +**** ==== See also diff --git a/adoc/p_evaluate_stream.adoc b/adoc/p_evaluate_stream.adoc index ec54379..abd86d5 100644 --- a/adoc/p_evaluate_stream.adoc +++ b/adoc/p_evaluate_stream.adoc @@ -42,12 +42,3 @@ stack while reading, parsing and executing. If "EVALUATE-STREAM" ends with 0, then <> holds the [n:chars] reference of the offending word in the stream buffer. -==== -.Word: EVALUATE-STREAM -[caption='Definition concept {counter:exec}: '] ----- -( too complex to include here ) ----- -==== - - diff --git a/adoc/p_get_n_decrement.adoc b/adoc/p_get_n_decrement.adoc index b419099..9f22ca3 100644 --- a/adoc/p_get_n_decrement.adoc +++ b/adoc/p_get_n_decrement.adoc @@ -12,9 +12,8 @@ Data stack: ( a n -- v ) then decrements the cell at that address by n. ==== -.Word: @n++ -[caption='Defintion concept {counter:exec}'] ----- +.Defintion concept for @n++ +**** : @n++ OVER @ DUP ROT - ROT ! ; ----- +**** ==== diff --git a/adoc/p_here.adoc b/adoc/p_here.adoc index 5a6c416..66aa8ed 100644 --- a/adoc/p_here.adoc +++ b/adoc/p_here.adoc @@ -12,9 +12,12 @@ Data stack: ( -- a ) allocation space. It get updated by all words that allocate memory. -.Usage example +==== +.allocate 1024 bytes on the heap +[caption='Usage example {counter:example} '] **** -1024 HEAP @ + HEAP ! ( allocate 1024 bytes on the heap ) +1024 HEAP @ + HEAP ! **** +==== See also <>. diff --git a/adoc/p_hex.adoc b/adoc/p_hex.adoc index 35ef0ff..cdefe59 100644 --- a/adoc/p_hex.adoc +++ b/adoc/p_hex.adoc @@ -13,9 +13,8 @@ letters a-f as additional digits. (Uppercase letter are also accepted on input). ==== -.Word: HEX -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for HEX +**** : HEX 16 BASE ! ; ----- +**** ==== diff --git a/adoc/p_immediate.adoc b/adoc/p_immediate.adoc index 5e887fe..154aa3a 100644 --- a/adoc/p_immediate.adoc +++ b/adoc/p_immediate.adoc @@ -12,11 +12,10 @@ Data stack: ( -- ) the most recent word to 1, thereby making that word an immediate word. ==== -.Word: IMMEDIATE -[caption='Definition concept {counter:exec}:'] ----- +.Definition concept for IMMEDIATE +**** : IMMEDIATE IMMEDIATE 1 CURRENT-WORDLIST @ @ 16 + ! ; ----- +**** ==== See also <>, <>, diff --git a/adoc/p_left_bracket.adoc b/adoc/p_left_bracket.adoc index ead7d3b..ecd77bf 100644 --- a/adoc/p_left_bracket.adoc +++ b/adoc/p_left_bracket.adoc @@ -13,10 +13,8 @@ mode to be intepreting. In this mode, words are executed immediately after parsing, by invoking their "doer". ==== -.Word: [ -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for [ +**** : [ IMMEDIATE 0 STATE ! ; ----- +**** ==== - diff --git a/adoc/p_literal.adoc b/adoc/p_literal.adoc index 35d98da..5a50f2d 100644 --- a/adoc/p_literal.adoc +++ b/adoc/p_literal.adoc @@ -17,11 +17,10 @@ with the CFA pointer following the value. It's not a good idea to use "LIT" interactively. ==== -.Word: LIT -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for LIT +**** : LIT R> DUP 8 + >R @ ; ----- +**** ==== diff --git a/adoc/p_literal_string.adoc b/adoc/p_literal_string.adoc index 218f443..ba94b0f 100644 --- a/adoc/p_literal_string.adoc +++ b/adoc/p_literal_string.adoc @@ -13,11 +13,9 @@ inlined subsequently to it in the containing definition. This is similar to <> but for a string literal. ==== -.Word: LIT -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for LIT +**** : LIT R> DUP @ 2DUP + 8 + >R SWAP 8 + SWAP ; ----- +**** ==== - diff --git a/adoc/p_nip.adoc b/adoc/p_nip.adoc index 8e14946..1f99710 100644 --- a/adoc/p_nip.adoc +++ b/adoc/p_nip.adoc @@ -12,9 +12,8 @@ Data stack: ( v1 v2 -- v2 ) on the data stack. ==== -.Word: NIP -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for NIP +**** : NIP SWAP DROP ; ----- +**** ==== diff --git a/adoc/p_number.adoc b/adoc/p_number.adoc index d3bcce5..c875971 100644 --- a/adoc/p_number.adoc +++ b/adoc/p_number.adoc @@ -18,10 +18,3 @@ base, letters a-f or A-F for values 10-15. I.e. the normal positive or negative decimal integers or normal (positive only) hexadecimal integers. -==== -.Word: NUMBER -[caption='Definition concept {counter:exec}: '] ----- -( too complex to include here ) ----- -==== diff --git a/adoc/p_right_bracket.adoc b/adoc/p_right_bracket.adoc index 218873a..580d7bf 100644 --- a/adoc/p_right_bracket.adoc +++ b/adoc/p_right_bracket.adoc @@ -19,9 +19,8 @@ Note that a word is parsed as a number only if it is not found in the wordlist; i.e., the word list may contain definitions for numbers. ==== -.Word: ] -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for ] +**** : ] 1 STATE ! ; ----- +**** ==== diff --git a/adoc/p_semicolon.adoc b/adoc/p_semicolon.adoc index 1818e80..c16e147 100644 --- a/adoc/p_semicolon.adoc +++ b/adoc/p_semicolon.adoc @@ -13,10 +13,8 @@ Data stack: ( -- ) by means of adding an <> ==== -.Word: : -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for ; +**** : ; IMMEDIATE ' EXIT , ; ----- +**** ==== - diff --git a/adoc/p_stream.adoc b/adoc/p_stream.adoc index cec3e9a..6143ef0 100644 --- a/adoc/p_stream.adoc +++ b/adoc/p_stream.adoc @@ -16,8 +16,8 @@ A file descriptor backed STREAM gains a buffer of the given size prefixed by a 32 byte STREAM header of the following layout: ==== -.file descriptor -[caption='Stream layout {counter:layout}, for '] +.file descriptor stream +[caption='Layout {counter:layout}: '] ---- 8 bytes = size of buffer (excluding the 32 byte header) 8 bytes source file descriptor @@ -33,8 +33,8 @@ A memory block stream is only the header (though allocated via following layout: ==== -.memory block -[caption='Stream layout {counter:layout}, for '] +.memory block stream +[caption='Layout {counter:layout}: '] ---- 8 bytes = block address 8 -1 (indicates memory block) diff --git a/adoc/p_tfa2flags_get.adoc b/adoc/p_tfa2flags_get.adoc index 5ded0d4..8e5ed33 100644 --- a/adoc/p_tfa2flags_get.adoc +++ b/adoc/p_tfa2flags_get.adoc @@ -11,9 +11,8 @@ Data stack: ( tfa -- flags ) "TFA>FLAGS@" is a function word that pushes word flags of the given tfa. ==== -.Word: TFA>FLAGS@ -[caption='Defintion concept {counter:exec}'] ----- +.Defintion concept for TFA>FLAGS@ +**** : TFA>FLAGS@ 16 + @ ; ----- +**** ==== diff --git a/adoc/p_tfa2namez.adoc b/adoc/p_tfa2namez.adoc index 074ead9..16db5db 100644 --- a/adoc/p_tfa2namez.adoc +++ b/adoc/p_tfa2namez.adoc @@ -14,7 +14,7 @@ terminated as well as preceded by a length cell. ==== .Defintion concept for TFA>NAMEZ ----- +**** : TFA>NAMEZ 32 + ; ----- +**** ==== diff --git a/adoc/p_tuck.adoc b/adoc/p_tuck.adoc index 965f0d3..452d163 100644 --- a/adoc/p_tuck.adoc +++ b/adoc/p_tuck.adoc @@ -12,9 +12,8 @@ Data stack ( v1 v2 -- v2 v1 v2 ) cell on the data stack. ==== -.Word: TUCK -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for TUCK +**** : TUCK SWAP OVER ; ----- +**** ==== diff --git a/adoc/p_within.adoc b/adoc/p_within.adoc index 911325f..ca23146 100644 --- a/adoc/p_within.adoc +++ b/adoc/p_within.adoc @@ -13,9 +13,8 @@ of the the first, v, is within the value range spanned by the second, lo, inclusive and third, hi, exclusive. ==== -.Word: WITHIN -[caption='Definition concept {counter:exec}: '] ----- +.Definition concept for WITHIN +**** : WITHIN 2 PICK > ROT ROT <= AND ; ----- +**** ==== diff --git a/reference.html b/reference.html index f57f5c8..e07df55 100644 --- a/reference.html +++ b/reference.html @@ -905,6 +905,8 @@ RRQFORTH executon by means of the following instruction sequence:

forthcode: +

Note that the FORTH compiler does not invoke an assembler so any +inline assembly code must be provided in its binary form.

_______________________________________________________
@@ -921,6 +923,15 @@ means of optionally adding the subsequent branch offset, or not, to the point of execution. If the value, v, is 0 then the branch offset is added, and otherwise execution continues with the cell following the branch offset in the definition.

+

Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first non-zero +value.

+

See also 1BRANCH, BRANCH, IF, +ELSE, IFBREAK and IFAGAIN.

_______________________________________________________
@@ -935,7 +946,7 @@ _______________________________________________________

"0=" is a function word that replaces a value with its logical complement; the result is zero if the value non-zero, and the result is non-zero if the value is zero.

-

Compare with NOT.

+

This is the same function as NOT.

_______________________________________________________
@@ -951,14 +962,13 @@ _______________________________________________________ less than 0, and 0 otherwise.

-
-
Definition concept 1: Word: 0<
+
-
: 0= 0 SWAP < ;
+
Definition concept for 0<
+

( v — 0/1 ) : 0= 0 SWAP < ;

-

See also SWAP and -<.

+

See also SWAP and <.

_______________________________________________________
@@ -975,6 +985,14 @@ means of optionally adding the subsequent branch offset, or not, to the point of execution. If the value, v, is non-zero then the branch offset is added, and otherwise execution continues with the cell following the branch offset in the definition.

+

Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first zero value.

+

See also 0BRANCH, BRANCH, IF, +ELSE, IFBREAK and IFAGAIN.

_______________________________________________________
@@ -1003,10 +1021,10 @@ _______________________________________________________ stack.

-
-
Definition concept 2: Word: 2DUP
+
-
: 2DUP OVER OVER ;
+
Definition concept for 2DUP
+

( v1 v2 — v1 v2 v1 v2 ) : 2DUP OVER OVER ;

@@ -1039,10 +1057,10 @@ onto the top of the data stack. This is similar to OVER bu working with cell pairs rather than single cells.

-
-
Definition concept 3: Word: 2OVER
+
-
: 2OVER 3 PICK 3 PICK ;
+
Definition concept for 2OVER
+

( v1 v2 v3 v4 — v1 v2 v3 v4 v1 v2 ) : 2OVER 3 PICK 3 PICK ;

@@ -1075,10 +1093,10 @@ the upper and lower pair. This is similar to SWAP but working with cell pairs rather than single cells.

-
-
Definition concept 4: Word: 2SWAP
+
-
: 2SWAP 3 ROLL 3 ROOL ;
+
Definition concept for 2SWAP
+

( v1 v2 v3 v4 — v3 v4 v1 v2 ) : 2SWAP 3 ROLL 3 ROLL ;

@@ -1097,10 +1115,10 @@ _______________________________________________________ at the current free head address, which also is incremented.

-
-
Definition concept 5: Word: C,
+
-
: C, HERE @ 1 ALLOT C! ;  ( v -- ; Claim 1 byte and put lsb value there )
+
Definition concept for C,
+

: C, HERE @ 1 ALLOT C! ; ( v — ; Claim 1 byte and put lsb value there )

See also :, [p_comma]. HERE, @, @@ -1253,10 +1271,6 @@ numerical base is set to 10 or 16 by DECIMAL and supported.

See also DIGITS, which holds the mapping table from digits to text.

-
-
-
Usage example 3: claim 16 bytes for variable FOO

CREATE FOO BASE

-
_______________________________________________________
@@ -1274,6 +1288,25 @@ implement structured execution control. BEGIN simply places the address for resolving branches back to this point during execution, and then a 0 as a marker so as to allow for an unknown number of block exit points.

+
+
+
+
Usage example 3:
+
+
: WTELL ( tfa -- ; Print word pname )
+  24 + DUP 8 + SWAP @ TELL SP EMIT
+;
+
+: WORDS ( wordlist -- ; Print all words of word list )
+  BEGIN
+    @ DUP 0= IFBREAK
+    DUP WTELL
+  END
+  DROP
+  NL EMIT
+;
+
+
_______________________________________________________
@@ -1287,6 +1320,14 @@ _______________________________________________________

"[']" is an immediate function word that reads the next word on the input stream and pushes its cfa.

+
+
+
+
+
Definition concept for [']
+

: ['] IMMEDIATE ' ;

+
+
_______________________________________________________
@@ -1301,6 +1342,14 @@ _______________________________________________________

"BRANCH" is a function word that implements execution transfer by means of adding the subsequent branch offset to the point of execution.

+

Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first zero value.

+

See also 0BRANCH, 1BRANCH, IF, +ELSE, IFBREAK and IFAGAIN.

_______________________________________________________
@@ -1313,6 +1362,27 @@ branch out of an enclosing xef:p_begin[BEGIN]-END block. Similar to IFBREAK it lays out the branch cell followed by a reserved cell for the branch offset, and inserts the resolution address just above the required 0 on the data stack.

+
+
+
+
Usage example 4: unconditional break with a condition.
+
+
: WTELL ( tfa -- ; Print word pname )
+  24 + DUP 8 + SWAP @ TELL SP EMIT
+;
+
+: WORDS ( wordlist -- ; Print all words of word list )
+  BEGIN
+    @ DUP IF DUP WTELL ELSE BREAK THEN
+  END
+  DROP
+  NL EMIT
+;
+
+
+

See also BRANCH, 0BRANCH, +1BRANCH, IF, ELSE, +IFBREAK and IFAGAIN.

_______________________________________________________
@@ -1373,10 +1443,10 @@ This includes reading the next word for making a new dictionary entry and setting evaluation state to compiling mode.

-
-
Definition concept 6: Word: :
+
-
: : doFORTH READ-WORD CREATE TFA>CFA ! ] ;
+
Definition concept for :
+

: : doFORTH READ-WORD CREATE TFA>CFA ! ] ;

See also doFORTH, READ-WORD, @@ -1397,10 +1467,10 @@ _______________________________________________________ HERE heap.

-
-
Definition concept7: Word: ,
+
-
: , HERE @ 8 ALLOT ! ; ( v -- ; Claim 8 bytes and put value there )
+
Definition concept for ,
+

: , HERE @ 8 ALLOT ! ; ( v — ; Claim 8 bytes and put value there )

See also :, [p_Ccomma]. HERE, @, @@ -1422,6 +1492,7 @@ Address) of the word. The header memory layout is as follows:

+
Layout 1: rrqforth word structure
struct WORD
 TFA  8 link ; tfa of previous word
@@ -1448,10 +1519,10 @@ function words initiated by ":" (aka "COLON") or changed to "dovalue"
 for RRQFORTH constants created by "CONSTANT".

-
-
Definition concept 8: Word: CREATE
+
-
HERE @ R> ( save tfa on RS )
+
Definition concept for CREATE
+

HERE @ R> ( save tfa on RS ) R@ CURRENT-WORD @ DUP @ , ! ( link in a new word ) DUP 49 + R@ + , ( pCFA ) 0 , ( flags ) @@ -1459,13 +1530,16 @@ for RRQFORTH constants created by "CONSTANT".

HERE @ ROT ROT MEMCPY 0 C, ( pname + NUL ) R@ , ( pTFA ) 0 , ( OFF ) - doVARIABLE ( CFA, default semantics )
+ doVARIABLE ( CFA, default semantics )

-
+
+
+
+
Usage example 5: a possible definition of CONSTANT
-
Usage example: a possible definition of CONSTANT
-

: CONSTANT READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! ! ;

+
: CONSTANT READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! ! ;
+

See also !, +, [p_comma], @, [p_Ccomma], CURRENT-WORD, DUP, @@ -1490,7 +1564,7 @@ word list word content is as follows:

-
Layout 1: word list word content
+
Layout 2: word list word content
  8 TFA of latest word in the word list
   8 DFA of the/a subsequent word list to search through
@@ -1525,10 +1599,10 @@ _______________________________________________________

"DECIMAL" is a function word that sets BASE to 10.

-
-
Definition concept 9: Word: DECIMAL
+
-
: DECIMAL 10 BASE ! ;
+
Definition concept for DECIMAL
+

: DECIMAL 10 BASE ! ;

@@ -1652,16 +1726,16 @@ offset to the current heap address. I.e., the word being defined will have its execution start at whatever comes after "DOES>".

-
-
Word: DOES>
+
-
: DOES> IMMEDIATE
+
Defintion concept for DOES>
+

: DOES> IMMEDIATE STATE @ != IF ( only for compilation mode ) CURRENT-WORDLIST @ @ TFA>CFA ( cfa of current word ) doDOES OVER ! ( set up doer ) HERE @ OVER 8 + - SWAP 8 - ! ( set up offset THEN -;

+;

See also @@ -1936,14 +2010,6 @@ execution.

stack while reading, parsing and executing.

If "EVALUATE-STREAM" ends with 0, then THIS-WORD holds the [n:chars] reference of the offending word in the stream buffer.

-
-
-
-
Definition concept 10: Word: EVALUATE-STREAM
-
-
( too complex to include here )
-
-
_______________________________________________________
@@ -2082,10 +2148,10 @@ _______________________________________________________ then decrements the cell at that address by n.

-
-
Defintion concept 11Word: @n++
+
-
: @n++ OVER @ DUP ROT - ROT ! ;
+
Defintion concept for @n++
+

: @n++ OVER @ DUP ROT - ROT ! ;

@@ -2163,10 +2229,13 @@ _______________________________________________________

"HERE" is a variable word that keeps the lowest address of the free allocation space. It get updated by all words that allocate memory.

+
+
-
Usage example
-

1024 HEAP @ + HEAP ! ( allocate 1024 bytes on the heap )

+
allocate 1024 bytes on the heap
+

1024 HEAP @ + HEAP !

+

See also ALLOT.

@@ -2185,10 +2254,10 @@ letters a-f as additional digits. (Uppercase letter are also accepted on input).

-
-
Definition concept 12: Word: HEX
+
-
: HEX 16 BASE ! ;
+
Definition concept for HEX
+

: HEX 16 BASE ! ;

@@ -2257,10 +2326,10 @@ _______________________________________________________ the most recent word to 1, thereby making that word an immediate word.

-
-
Definition concept 13:Word: IMMEDIATE
+
-
: IMMEDIATE IMMEDIATE 1 CURRENT-WORDLIST @ @ 16 + ! ;
+
Definition concept for IMMEDIATE
+

: IMMEDIATE IMMEDIATE 1 CURRENT-WORDLIST @ @ 16 + ! ;

See also :, CURRENT-WORDLIST, @@ -2281,10 +2350,10 @@ mode to be intepreting. In this mode, words are executed immediately after parsing, by invoking their "doer".

-
-
Definition concept 14: Word: [
+
-
: [ IMMEDIATE 0 STATE ! ;
+
Definition concept for [
+

: [ IMMEDIATE 0 STATE ! ;

@@ -2334,10 +2403,10 @@ with the CFA pointer following the value.

It’s not a good idea to use "LIT" interactively.

-
-
Definition concept 15: Word: LIT
+
-
: LIT R> DUP 8 + >R @ ;
+
Definition concept for LIT
+

: LIT R> DUP 8 + >R @ ;

@@ -2356,10 +2425,10 @@ inlined subsequently to it in the containing definition. This is similar to LIT but for a string literal.

-
-
Definition concept 16: Word: LIT
+
-
: LIT R> DUP @ 2DUP + 8 + >R SWAP 8 + SWAP ;
+
Definition concept for LIT
+

: LIT R> DUP @ 2DUP + 8 + >R SWAP 8 + SWAP ;

@@ -2470,10 +2539,10 @@ _______________________________________________________ on the data stack.

-
-
Definition concept 17: Word: NIP
+
-
: NIP SWAP DROP ;
+
Definition concept for NIP
+

: NIP SWAP DROP ;

@@ -2521,14 +2590,6 @@ a 1 on top, or just a 0 if the word didn’t parse.

base, letters a-f or A-F for values 10-15. I.e. the normal positive or negative decimal integers or normal (positive only) hexadecimal integers.

-
-
-
-
Definition concept 18: Word: NUMBER
-
-
( too complex to include here )
-
-
_______________________________________________________
@@ -2758,10 +2819,10 @@ left on the stack.

wordlist; i.e., the word list may contain definitions for numbers.

-
-
Definition concept 19: Word: ]
+
-
: ] 1 STATE ! ;
+
Definition concept for ]
+

: ] 1 STATE ! ;

@@ -2823,10 +2884,10 @@ _______________________________________________________ by means of adding an EXIT

-
-
Definition concept 20: Word: :
+
-
: ; IMMEDIATE ' EXIT , ;
+
Definition concept for ;
+

: ; IMMEDIATE ' EXIT , ;

@@ -2941,7 +3002,7 @@ prefixed by a 32 byte STREAM header of the following layout:

-
Stream layout 2, for file descriptor
+
Layout 3: file descriptor stream
  8 bytes = size of buffer (excluding the 32 byte header)
   8 bytes source file descriptor
@@ -2958,7 +3019,7 @@ following layout:

-
Stream layout 3, for memory block
+
Layout 4: memory block stream
  8 bytes = block address
   8 -1 (indicates memory block)
@@ -3134,10 +3195,10 @@ _______________________________________________________
 

"TFA>FLAGS@" is a function word that pushes word flags of the given tfa.

-
-
Defintion concept 21Word: TFA>FLAGS@
+
-
: TFA>FLAGS@ 16 + @ ;
+
Defintion concept for TFA>FLAGS@
+

: TFA>FLAGS@ 16 + @ ;

@@ -3156,10 +3217,10 @@ pointer to the word pname’s character sequence, which is zero terminated as well as preceded by a length cell.

-
-
Defintion concept for TFA>NAMEZ
+
-
: TFA>NAMEZ 32 + ;
+
Defintion concept for TFA>NAMEZ
+

: TFA>NAMEZ 32 + ;

@@ -3222,10 +3283,10 @@ _______________________________________________________ cell on the data stack.

-
-
Definition concept 22: Word: TUCK
+
-
: TUCK SWAP OVER ;
+
Definition concept for TUCK
+

: TUCK SWAP OVER ;

@@ -3272,10 +3333,10 @@ of the the first, v, is within the value range spanned by the second, lo, inclusive and third, hi, exclusive.

-
-
Definition concept 23: Word: WITHIN
+
-
: WITHIN 2 PICK > ROT ROT <= AND ;
+
Definition concept for WITHIN
+

: WITHIN 2 PICK > ROT ROT ⇐ AND ;

-- 2.39.2 From 076f00a88873336acf2c7150281f1a8172683fe7 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 2 Jun 2021 23:40:41 +1000 Subject: [PATCH 10/16] corrected example --- adoc/p_break.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/adoc/p_break.adoc b/adoc/p_break.adoc index dec6fd7..f274ea6 100644 --- a/adoc/p_break.adoc +++ b/adoc/p_break.adoc @@ -20,6 +20,7 @@ resolution address just above the required 0 on the data stack. : WORDS ( wordlist -- ; Print all words of word list ) BEGIN @ DUP IF DUP WTELL ELSE BREAK THEN + 1 IFAGAIN END DROP NL EMIT -- 2.39.2 From bdc1081de477cd5230b7762d479b140cbbcf842f Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Wed, 2 Jun 2021 23:41:23 +1000 Subject: [PATCH 11/16] corrected BREAK example --- reference.html | 1 + 1 file changed, 1 insertion(+) diff --git a/reference.html b/reference.html index e07df55..f49869a 100644 --- a/reference.html +++ b/reference.html @@ -1374,6 +1374,7 @@ resolution address just above the required 0 on the data stack.

: WORDS ( wordlist -- ; Print all words of word list ) BEGIN @ DUP IF DUP WTELL ELSE BREAK THEN + 1 IFAGAIN END DROP NL EMIT -- 2.39.2 From 97a4e5ecb1623dbe0fbd7b6eeb96e966c6c5b1d3 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Thu, 3 Jun 2021 21:03:22 +1000 Subject: [PATCH 12/16] add INPUT variable for current eval stream --- compile.asm | 33 ++++++++++++++++----------------- rrqforth.asm | 8 +++----- stdio.asm | 2 +- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/compile.asm b/compile.asm index fe19b20..bcffaef 100644 --- a/compile.asm +++ b/compile.asm @@ -49,7 +49,7 @@ p_create_COPY: ;; ( "word" -- cfa ) ;; Find the following word and push its cfa, or 0 pushr rsi - DOFORTH p_stdin, p_read_word, p_find + DOFORTH p_input, p_get, p_read_word, p_find cmp qword[rsp],0 jne p_quote_tfa add rsp,16 @@ -241,6 +241,10 @@ p_numper_POSITIVE: popr rsi next + WORD p_input,'INPUT',dovariable + ;; The current input stream for evaluate-stream + dq 0 + WORD p_this_word,'THIS-WORD',dovariable dq 0,0 ; ( n chars* ) @@ -248,26 +252,23 @@ p_numper_POSITIVE: ;; ( stream* -- *?* flag ) ;; Execute the words from the given stream ;; returns 1 if stream ends and 0 if an unknown word is found - dq p_gtR ; Keep the stream on the return stack. + dq p_input, p_get, p_gtR ; save old stream on R-stack + dq p_input, p_put p_evaluate_stream_PROMPT: - dq p_verboseQ - dq p_get + dq p_verboseQ, p_get BRANCH 0,p_evaluate_stream_LOOP - dq p_depth - dq p_dot + dq p_depth, p_dot dq p_literal_string STRING '> ' dq p_tell - dq p_Rget + dq p_input, p_get dq p_clear_stream p_evaluate_stream_LOOP: - dq p_Rget + dq p_input, p_get dq p_read_word dq p_dup BRANCH 0,p_evaluate_stream_END ; branch if 0 on TOP - dq p_2dup - dq p_this_word - dq p_2put + dq p_2dup, p_this_word, p_2put dq p_find dq p_dup BRANCH 0,p_evaluate_stream_NOTWORD ; branch if 0 on TOP @@ -293,13 +294,12 @@ p_evaluate_stream_NOTWORD: dq p_dup BRANCH 0,p_evaluate_stream_BAD ; branch if 0 dq p_drop - dq p_state - dq p_get + dq p_state, p_get BRANCH 0,p_evaluate_stream_AFTER ; branch if 0 dq p_literal, p_literal dq p_comma, p_comma p_evaluate_stream_AFTER: - dq p_Rget + dq p_input, p_get dq p_stream_nchars BRANCH 0,p_evaluate_stream_PROMPT BRANCH ,p_evaluate_stream_LOOP @@ -307,8 +307,7 @@ p_evaluate_stream_END: dq p_2drop dq p_literal, 1 p_evaluate_stream_BAD: - dq p_Rgt - dq p_drop + dq p_Rgt, p_input, p_put ; restore previous stream dq p_exit WORD p_colon,':' @@ -316,7 +315,7 @@ p_evaluate_stream_BAD: ;; Read next word as a new word into current wordlist, set it ;; to be a doforth word, and set compiling mode. dq p_literal, doforth - dq p_stdin + dq p_input, p_get dq p_read_word dq p_create dq p_tfa2cfa diff --git a/rrqforth.asm b/rrqforth.asm index 1928fbb..f0ef63a 100644 --- a/rrqforth.asm +++ b/rrqforth.asm @@ -181,7 +181,7 @@ include 'compile.asm' WORD p_lparen,'(',fasm,IMMEDIATE pushr rsi p_lparen_loop: - DOFORTH p_stdin, p_read_word + DOFORTH p_input, p_get, p_read_word pop rax pop rbx cmp rax,0 ; end of stream @@ -242,7 +242,6 @@ main_is_not_verbose: last_forth_word: WORD p_quit,'QUIT',fasm ;; QUIT is the program entry point ******************** - mov rsp,DS_TOP mov rbp,RS_TOP cmp qword [p_stdin_DFA],0 @@ -254,7 +253,7 @@ last_forth_word: pop qword [p_stdin_DFA] ; Assign STDIN p_quit_INITIALIZED: - ;; Initial blurb + ;; Setup INPUT from STDIN FORTH dq p_verboseQ dq p_get @@ -262,8 +261,7 @@ p_quit_INITIALIZED: dq p_program_version dq p_tell p_quit_EVAL: - dq p_stdin - dq p_evaluate_stream + dq p_stdin, p_evaluate_stream BRANCH 0,p_quit_ERROR dq p_false dq sys_exit diff --git a/stdio.asm b/stdio.asm index 658e42f..eeac438 100644 --- a/stdio.asm +++ b/stdio.asm @@ -219,7 +219,7 @@ p_read_word_nomore: push p_pad_DFA push 0 p_double_quote_loop: - DOFORTH p_stdin, p_read_stream_char + DOFORTH p_input, p_get, p_read_stream_char pop rax cmp rax,0 jl p_double_quote_endstream -- 2.39.2 From d5613f1ba2ae4065d60df8e768027f437f740a7f Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Thu, 3 Jun 2021 21:03:38 +1000 Subject: [PATCH 13/16] bug fix TFA>NAMEZ --- memory.asm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/memory.asm b/memory.asm index ff88893..80ce280 100644 --- a/memory.asm +++ b/memory.asm @@ -25,7 +25,8 @@ WORD p_tfa2namez,'TFA>NAMEZ',fasm ;; ( tfa -- char* ) pop rax - push qword[rax+32] + add rax,32 + push rax next WORD p_cfa2flags_get,'CFA>FLAGS@',fasm -- 2.39.2 From 7893fc511f6be292b35cc1371f0ca0215f580f9c Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Thu, 3 Jun 2021 21:04:58 +1000 Subject: [PATCH 14/16] no "continue" in bp 7 commands --- debug.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/debug.sh b/debug.sh index fd6795b..9b64b49 100755 --- a/debug.sh +++ b/debug.sh @@ -21,7 +21,6 @@ commands $((NBR+1)) print (void*) \$rsp print (((char*)(*(((void**)\$rax)-2)))+32) print (void*) \$rsi -continue end EOF -- 2.39.2 From 1fb804b8f6a4bd907491e5d64d4a16e190e64c17 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Thu, 3 Jun 2021 21:05:17 +1000 Subject: [PATCH 15/16] upgraded binary --- rrqforth | Bin 2148423 -> 2148591 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/rrqforth b/rrqforth index 378758d58e4ddc7438250e7a5fd1591d409cef2b..df86d14c1efaee742189a9ef9d364880dec95af3 100755 GIT binary patch delta 5978 zcmZ{odsviJ8ov!bJpRY}Yn5ZSA(MTl<8O+2-S=+?svQP0f8ef6VuM=l#8xbKY~_ zbG~tHEYMxsRG`~v(Ld(e6f)KC+9`}^yLRejQdDFLT%~HNPE+-o>Y=HgnrhHgFHQB< zR3A{v4boJzrdl*LSW`nZHB?iF zXzEZ+4b#-{Ln=OBq<{6%!!tJGv-;5K(FiFnwDdhEJd%89AWA`pNhvgpB~yxVrtUJ? zRE)Fr8=^?#W^D0Y8ii1fvTo=L#CtP#=z_?c&DgH%BKtSvU|lWwU^7-iox_;Tzx=<= zsbusP{8H$}$ln9nNz)dbuS+D4Y{d@!1{ZmEEB;wG;;=?=tw%6KhHXkiZ{8m+x!t&L zyOV~C{#4>DKH(QgW|v?;e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|9GZwD^RHkGd_kIh(B9|p`1L6zfT3{x-)W;=454Oj3b-RV$_MZ ze;Qr25HWm0dH8dMZR@8oL7UHt;mm&Vi`RvI_{D2fKiB1$E5{7cU9wOVc|J7OkrAF> zpU`E5H>zJezXiHy%(b!H0Vv9feztsox&kZY;KKvrBPPEfJu8Qp2kv~t1i=I0*9-6x zj)1}QTv<6uuDr~AqW&0z2gIPftDg0<1;Nh~vvTt@W{_6~Mw){){uN0D4+`3tJ>z~i z`4Bu2n{yH{kn`WB@SKk<8}^Su8f815zbX;T;nC|U!6m1#P!ElGy81_r|1OkO%Mz~h z6M<*IUEwBIXT0w9UL6I}YMCt->R|Zkq~{3y?s);2>~bIV-gj1`vVt Date: Thu, 3 Jun 2021 21:08:26 +1000 Subject: [PATCH 16/16] document the INPUT word --- adoc/p_input.adoc | 13 +++++++++++++ reference.adoc | 2 ++ reference.html | 18 ++++++++++++++++-- wordindex.adoc | 1 + 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 adoc/p_input.adoc diff --git a/adoc/p_input.adoc b/adoc/p_input.adoc new file mode 100644 index 0000000..d5f8022 --- /dev/null +++ b/adoc/p_input.adoc @@ -0,0 +1,13 @@ +// compile.asm: WORD p_input,'INPUT',dovariable + +anchor:p_input[] + +=== Word: INPUT + +.... +Data stack: ( -- a ) +.... + +"INPUT" is a variable word for the input stream buffer used by +<>. + diff --git a/reference.adoc b/reference.adoc index 9175d73..1700ddf 100644 --- a/reference.adoc +++ b/reference.adoc @@ -153,6 +153,8 @@ include::adoc/p_ifbreak.adoc[] include::separator.adoc[] include::adoc/p_immediate.adoc[] include::separator.adoc[] +include::adoc/p_input.adoc[] +include::separator.adoc[] include::adoc/p_left_bracket.adoc[] include::separator.adoc[] include::adoc/p_lessequal.adoc[] diff --git a/reference.html b/reference.html index f49869a..0fc06e1 100644 --- a/reference.html +++ b/reference.html @@ -832,7 +832,8 @@ asciidoc.install(); +IMMEDIATE   +INPUT  

MAIN-ARGS   @@ -2338,6 +2339,19 @@ the most recent word to 1, thereby making that word an immediate word.

_______________________________________________________
+

+
+
+

Word: INPUT

+
+
+
Data stack: ( -- a )
+
+

"INPUT" is a variable word for the input stream buffer used by +EVALUATE-STREAM.

+
+_______________________________________________________ +

@@ -3397,7 +3411,7 @@ is deepest.

diff --git a/wordindex.adoc b/wordindex.adoc index 8623a0b..ebac853 100644 --- a/wordindex.adoc +++ b/wordindex.adoc @@ -105,6 +105,7 @@ xref:p_if[IF] {nbsp} xref:p_ifagain[IFAGAIN] {nbsp} xref:p_ifbreak[IFBREAK] {nbsp} xref:p_immediate[IMMEDIATE] {nbsp} +xref:p_input[INPUT] {nbsp} xref:p_literal[LIT] {nbsp} xref:p_load_file_quote[LOAD-FILE"] {nbsp} -- 2.39.2