Shop Learn P1 Docs P2 Docs
Taqoz Reloaded 2.8 - How to append a wordcode — Parallax Forums

Taqoz Reloaded 2.8 - How to append a wordcode

Christof Eb.Christof Eb. Posts: 771
edited 2022-04-07 10:20 in Forth

Hi,
perhaps someone can point me to a solution here. I have been trying for a long time...

' endloc := endlocCFA
pre (;)
    endlocCFA [C] || ;
: myword1 (;) nop nop ;
: myword2 (;) nop nop (;) ;
TAQOZ# see myword1

1B8A8: pub myword1
0B49A: ADA4     endloc
0B49C: 2062     NOP
0B49E: 2063     NOP ;
      ( 6  bytes )
 ---  ok
TAQOZ# see myword2

1B89E: pub myword2
0B4A0: ADA4     endloc
0B4A2: ADA5     endloc ;

So if I use my immediate word (;) at the beginning of the code, it works as intended and compiles the normal word endloc into the code. If I use it a second time at the end of the code, it overwrites the other code. It is like the code pointer is not getting advanced.

A related question: What is the difference between HERE and @CODE?

Thanks for some hints!
Christof

Comments

  • OK,

    pre (;)
        endlocCFA [C] [W] ;
    

    did the trick somehow....

  • bob_g4bbybob_g4bby Posts: 344
    edited 2022-04-07 13:43

    @"Christof Eb."

    My 'guess':-
    endlocCFA [C] || would compile in line with your code a 32 bit long ( the word for endlocCFA + word $0000). Since there isn't a forth word stored at $0000, your program will do something weird or crash.
    whereas
    endlocCFA [C] [W] just compiles the normal word required for TAQOZ to interpret. Each Taqoz word compiled only occupies 16 bits = 1 word, as you can see with your decompiled words.

  • Hm, || does compile a 16 bit word to here, see the decompilation of myword1. Somehow HERE is not matching to @code.

  • Yes, you're right || is 16 bit, I beg your pardon.

  • Don't beg pardon here, we are both guessing what's going on in these depths of the system....

Sign In or Register to comment.