home .. forth .. colorforth mail list archive ..

Re: [colorforth] new color


>Anyway, I get what you're doing now.  With defer
>in a word it's address pushed from the return
>stack to the parameter stack so you can store
>it in the jump table rather than execute it.
>But here's what I don't get now.  What keeps
>"defer" from executing the second time when
>the address is executed from the jump table?

Here you have to know a little about how call/return work. 
Call pushes the address of the next instruction, therefore 
what ever instruction follows 'defer' is the address which 
is returned. Strings, arrays are implemented very similar. 
Look in block 48, to see that 'defer' goes by name 
of 'string' there. In the case of arrays the the 
call 'array' is aligned so the next address is divisable by 
4.

: string pop ;
: array pop 2/ 2/ ; 

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com