Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge my work around CREATE...;CODE and CREATE...DOES> #8

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Commits on Jun 20, 2015

  1. jonesforth.s: LITS->LITSTRING

    annexia/jonesforth.s.txt uses LITSTRING, while jonesforth.s/f use LITS.
    
    There's no real reason why this should be different from the original.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 20, 2015
    Configuration menu
    Copy the full SHA
    7091cc7 View commit details
    Browse the repository at this point in the history
  2. annexia: update originals to latest version (47)

    The ARM Jonesforth is version 47, while the prelude
    and x86 version under annexia were version 42.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 20, 2015
    Configuration menu
    Copy the full SHA
    a7d8fad View commit details
    Browse the repository at this point in the history
  3. jonesforth.s: omit \namelen parameter to defword and friends

    It's error-prone and doesn't quite help the readability, so
    implicitly calculate the length within the macro.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 20, 2015
    Configuration menu
    Copy the full SHA
    79ab55e View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2015

  1. jonesforth.s: add ;CODE

    Now we can make machine code definitions in Forth. I've
    decided to make all machine code emitters start with $
    (such as $NEXT), although this may change in the future.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 24, 2015
    Configuration menu
    Copy the full SHA
    ac99b06 View commit details
    Browse the repository at this point in the history
  2. jonesforth.f: OK should be followed by CR

    putchar may buffer after all.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 24, 2015
    Configuration menu
    Copy the full SHA
    7e11a37 View commit details
    Browse the repository at this point in the history

Commits on Jun 30, 2015

  1. jonesforth.f: rewrite ;CODE, add CODE and END-CODE

    Make ;CODE behave like the gforth variant, i.e. usable
    inside a level 2 (word defining) word (i.e. after CREATE).
    
    Before (see x86 jonesforth 47):
    
    : FOO ;CODE
    
    Now:
    
    CODE FOO END-CODE
    
    Or with CREATE:
    
    : MKNOTHING WORD CREATE 0 , ;CODE END-CODE
    MKNOTHING FOO
    
    More examples... so now we could do something like:
    
    defword "$DOCON",F_IMM,ASMDOCON
    	.int LIT            @ r0 points to DFA
    	ldr r12, [r0, #4]   @ read cell from DFA
    	.int COMMA
    	.int LIT
    	PUSHDSP r12         @ push to stack
    	.int COMMA
    	.int EXIT
    
    : MKCON
       WORD CREATE
       0 ,        ( push dummy codeword, rewritten by (;CODE))
       ,          ( actual constant )
    ;CODE
       $DOCON
    END-CODE
    
    5 MKCON CON5
    CON5 . CR
    
    CODE ... ENDCODE instead can be used to make `defcode'
    definitions in Forth instead of jonesforth.s.
    
    So now we could do something like:
    
    @ push r0 to stack
    defword "$<R0",F_IMM,ASMFROMR0
    	.int LIT
    	PUSHDSP r0
    	.int COMMA
    	.int EXIT
    
    @ push r7 to stack
    defword "$<R7",F_IMM,ASMFROMR7
    	.int LIT
    	PUSHDSP r7
    	.int COMMA
    	.int EXIT
    
    @ pop stack to r0
    defword "$>R0",F_IMM,ASMTOR0
    	.int LIT
    	POPDSP r0
    	.int COMMA
    	.int EXIT
    @ pop stack to r7
    defword "$>R7",F_IMM,ASMTOR7
    	.int LIT
    	POPDSP r7
    	.int COMMA
     	.int EXIT
    
    CODE SWAP $>R0 $>R7 $<R0 $<R7 END-CODE
    
    HEX 1337 FOOF SWAP . . CR
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 30, 2015
    Configuration menu
    Copy the full SHA
    0f5e3ec View commit details
    Browse the repository at this point in the history
  2. jonesforth.f: fix SEE to not segfault on words that don't exist.

    DICT signature is changed.
       On success: ( -- dictionary_address )
       On failure ( -- word_addr word_len 0 )
    
    Introduce DICT-CHECKED wrapper around DICT to log error about
    unknown word and throws an ABORT.
    
    Fix all words using DICT to instead use DICT-CHECKED.
    
    As an unfortunate side effect, the exception handling code
    had to travel upwards somewhat.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 30, 2015
    Configuration menu
    Copy the full SHA
    fef5bc3 View commit details
    Browse the repository at this point in the history
  3. jonesforth.f: let SEE see inside words created with CODE and ;CODE

    [instead of segfaulting or printing nothing, of course]
    
    Now:
       CODE FOO END-CODE
       SEE
    ...gives
       CODE FOO ( CODEWORD FOO+0 ) E49A0004 E5901000 E12FFF11 (END-CODE)
    
    ...where the hex stuff is the $NEXT macro.
    
    CREATE ... ;CODE words:
       : MKNOTHING WORD CREATE 0 , 3 , ;CODE END-CODE
       MKNOTHING BAR
       SEE MKNOTHING
       SEE BAR
    ...gives
       : MKNOTHING WORD CREATE 0 , 3 , ;CODE ( MKNOTHING+9 ) E49A0004 E5901000 E12FFF11 (END-CODE)
       CODE BAR ( CODEWORD MKNOTHING+9 ) 3 (END-CODE)
    
    ...which shows you that BAR is a word created with MKNOTHING.
    
    Native words:
       SEE 2SWAP
    ...gives
       CODE 2SWAP ( CODEWORD 85BC ) (END-CODE)
    
    ...since length isn't encoded defcode definitions, this is the best we can do.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jun 30, 2015
    Configuration menu
    Copy the full SHA
    22cd871 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2015

  1. jonesforth.s: implement DOES>

    See my blog post for details.
    
    http://osdevnotes.blogspot.com/2015/07/does-in-jonesforth.html
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Jul 26, 2015
    Configuration menu
    Copy the full SHA
    70675a2 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2015

  1. pijFORTHos: move all the rpi stuff into rpi/

    I really just want this to be a bunch of useful
    stuff built around a generic jonesforth.s.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Nov 5, 2015
    Configuration menu
    Copy the full SHA
    f2f363b View commit details
    Browse the repository at this point in the history
  2. arm: rename the jonesforth.s file

    Be more explicit about arch.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Nov 5, 2015
    Configuration menu
    Copy the full SHA
    b75a62f View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2015

  1. aarch64: a really terrible port of the jonesforth-arm.S code

    This is still a wip. Some basic things seem to work, but a lot more
    is to be done.
    
    Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
    andreiw committed Nov 17, 2015
    Configuration menu
    Copy the full SHA
    b1cd6c2 View commit details
    Browse the repository at this point in the history