pfe-tools-ext
Prev? | pfe Forth Wordset List | ?Next

## Name

pfe-tools-ext ? TOOLS Programming-Tools (without ASSEMBLER)

## Synopsis

`.S ( -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`DUMP ( addr len -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`SEE ( "word" -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`WORDS ( -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`AHEAD ( -- DP-mark ORIG-magic ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`BYE ( -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`CS-PICK ( 2a 2b 2c ... n -- 2a 2b 2c ... 2a ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`CS-ROLL ( 2a 2b 2c ... n -- 2b 2c ... 2a ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`FORGET ( "word" -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`[ELSE] ( -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`[IF] ( flag -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`[THEN] ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`? ( addr -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`CODE ( "name" -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`;CODE ( -- ) ?=>? (` | `)`; | ?

`"[ANS] FORTH"`;
?

`END-CODE ( "name" -- ) ?=>? (` | `)`; | ?

`"ASSEMBLER"`;
?

## Description

.S ( -- ) => "[ANS] FORTH"

print the stack content in vertical nice format. tries to show cell-stack and float-stack side-by-side,

Depending on configuration, there are two parameter stacks: for integers and for floating point operations. If both stacks are empty, `.S` will display the message `&lt;stacks empty&gt;`.

If only the floating point stack is empty, `.S` displays the integer stack items in one column, one item per line, both in hex and in decimal like this (the first item is topmost):

      12345 HEX 67890 .S
         	424080 [00067890]
              12345 [00003039] ok

If both stacks ar not empty, => .S displays both stacks, in two columns, one item per line

      HEX 123456.78E90 ok
      DECIMAL 123456.78E90 .S
         	   291 [00000123]          1.234568E+95
         1164414608 [45678E90] ok

Confusing example? Remember that floating point input only works when the `BASE` number is `DECIMAL`. The first number looks like a floating point but it is a goodhex double integer too - the number base is `HEX`. Thus it is accepted as a hex number. Second try with a decimal base will input the floating point number.

If only the integer stack is empty, => .S shows two columns, but he first columns is called `&lt;stack empty&gt;`, and the second column is the floating point stack, topmost item first.

DUMP ( addr len -- ) => "[ANS] FORTH"

show a hex-dump of the given area, if it's more than a screenful it will ask using => ?CR

You can easily cause a segmentation fault of something like that by accessing memory that does not belong to the pfe-process.

SEE ( "word" -- ) => "[ANS] FORTH"

decompile word - tries to show it in re-compilable form.

`(SEE)` tries to display the word as a reasonable indented source text. If you defined your own control structures or use extended control-flow patterns, the indentation may be suboptimal.

      simulate:
        : SEE  [COMPILE] ' (SEE) ;

WORDS ( -- ) => "[ANS] FORTH"

uses CONTEXT and lists the words defined in that vocabulary. usually the vocabulary to list is named directly in before.

      example:
         FORTH WORDS  or  LOADED WORDS

AHEAD ( -- DP-mark ORIG-magic ) compile-only => "[ANS] FORTH"

      simulate:
        : AHEAD  BRANCH MARK&gt; (ORIG#) ;

BYE ( -- ) no-return => "[ANS] FORTH"

should quit the forth environment completly

CS-PICK ( 2a 2b 2c ... n -- 2a 2b 2c ... 2a ) => "[ANS] FORTH"

pick a value in the compilation-stack - note that the compilation stack _can_ be seperate in some forth-implemenations. In PFE the parameter-stack is used in a double-cell fashion, so CS-PICK would 2PICK a DP-mark and a COMP-magic, see `PICK`

CS-ROLL ( 2a 2b 2c ... n -- 2b 2c ... 2a ) => "[ANS] FORTH"

roll a value in the compilation-stack - note that the compilation stack _can_ be seperate in some forth-implemenations. In PFE the parameter-stack is used in a double-cell fashion, so CS-ROLL would 2ROLL a DP-mark and a COMP-magic, see `ROLL`

FORGET ( "word" -- ) => "[ANS] FORTH"

      simulate:
        : FORGET  [COMPILE] '  &gt;NAME (FORGET) ; IMMEDIATE

[ELSE] ( -- ) => "[ANS] FORTH"

eat up everything upto and including the next [THEN]. count nested [IF] ... [THEN] constructs. see `[IF]`

      this word provides a simple pre-compiler mechanism

[IF] ( flag -- ) => "[ANS] FORTH"

check the condition in the CS-STACK. If true let the following text flow into `INTERPRET` , otherwise eat up everything upto and including the next `[ELSE]` or `[THEN]` . In case of skipping, count nested [IF] ... [THEN] constructs.

      this word provides a simple pre-compiler mechanism

[THEN] - no description, sorry

? ( addr -- ) => "[ANS] FORTH"

Display the (integer) content of at address `addr`. This word is sensitive to `BASE`

      simulate:
        : ?  @ . ;

CODE ( "name" -- ) => "[ANS] FORTH"

call `ALSO` and add ASSEMBLER wordlist if available. Add PROC ENTER assembler snippet as needed for the architecture into the PFA. The CFA is setup (a) with the PFA adress in traditional ITC or (b) with an infoblock as for sbr-coded colon words.

Remember that not all architectures are support and that the ASSEMBLER wordset is not compiled into pfe by default. Use always the corresponding `END-CODE` for each `CODE` start. The new word name is not smudged.

;CODE ( -- ) => "[ANS] FORTH"

Does end the latest word (being usually some DOES> part) and enters machine-level (in EXEC-mode).

BE AWARE: The TOOLS-EXT will not provide an `END-CODE` or any other word in the `ASSEMBLER` wordlist which is required to start any useful assembler programming. After requiring ASSEMBLER-EXT you will see a second ";CODE" in the `EXTENSIONS` wordlist that will also provide an optimized execution than the result of this standard-forth implemenation.

The Standard-Forth implementation will actually compile a derivate of `BRANCH` into the dictionary followed by `;`. The compiled word will not jump to the target adress (following the execution token) but it will call the target adress via the host C stack. The target machine level word (C domain) will just return here for being returned (Forth domain). Hence `END-CODE` may be a simple RET, comma!

END-CODE ( "name" -- ) => "ASSEMBLER"

call `PREVIOUS` and add PROC LEAVE assembler snippet as needed for the architecture - usually includes bits to "return from subroutine". Remember that not all architectures are support and PFE usually does only do variants of call-threading with a separate loop for the inner interpreter that does "call into subroutine". Some forth implementations do "jump into routine" and the PROC LEAVE part would do "jump to next routine" also known as next-threading. The sbr-call-threading is usually similar to the native subroutine-coding of the host operating system. See `CODE`

Prev? | Up | ?Next
pfe-toolbelt-ext? | Home | ?pfe-tools-misc-ext