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

## Name

pfe-assembler-ext ? ASSEMBLER Programming-Tools (see TOOLS-EXT)

## Synopsis

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

`"EXTENSIONS"`;
?

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

`"EXTENSIONS"`;
?

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

`"ASSEMBLER"`;
?

## Description

CODE ( "name" -- ) => "EXTENSIONS"

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 ( -- ) => "EXTENSIONS"

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 Forth Wordset List? | Home | ?pfe-block-ext