Thread View: comp.lang.forth.mac
2 messages
2 total messages
Started by sorry no email Randolph Peters
Mon, 14 Dec 1992 18:28
Pocket Forth
Author: sorry no email Randolph Peters
Date: Mon, 14 Dec 1992 18:28
Date: Mon, 14 Dec 1992 18:28
22 lines
1240 bytes
1240 bytes
I'm a pocket forth user. Pocket forth is great for learning the forth ropes, as it were, and is not bad for automatic handling of the event loop. Considering how stripped down it is, it is a remarkably full-featured forth implementation and is fairly true to the Brodie text "Starting Forth." If there are any other pocket forth users out there, you may find this little bug fix useful (basically, it allows you to use interpret correctly by resetting the input stream). See my posting on comp.lang.forth for more discussion on this. : 0>is tib a>r 2r> ,$ 285E ; macro : query tib 80 32 fill 0>is tib 80 expect interpret ; Randolph Peters Suite C, 3rd floor Silverstein Hosp of the Univ of PA 34th and Spruce Streets, Phila PA 19104
Re: Pocket Forth
Author: Jim Lynch
Date: Tue, 15 Dec 1992 03:27
Date: Tue, 15 Dec 1992 03:27
44 lines
1486 bytes
1486 bytes
Here's a pre-83 PICK for Pocket Forth,,, ROLL, -ROLL and PACK might be
forthcoming someday...
--- cut here
: code create -8 allot ;
hex
code pick ( works! )
3D3C , 0002 , ( MOVE #$02,-(PS) )
4EAB , ' * , ( JSR times-base(BP) )
301E , ( MOVE (PS)+,D0 )
41F6 , 0000 , ( LEA 0(PS,D0.W),A )
3D20 , ( MOVE -(A0),-(PS) )
4E75 , ( RTS )
decimal
: (-loop) ( amount to subtract from index -> flag for until. )
r> r> ( ret addr )
r> ( index )
4 pick -
dup r > 0= ( terminate do...-loop now? ) dup
if swap drop ( drop new index )
r> drop ( drop limit )
rot rot >r >r ( put ret addr back )
else swap >r ( put index back )
rot rot >r >r ( put ret addr back )
then
swap drop ( get rid of amount )
;
: -loop [ ' (-loop) literal ] compile [compile] until ; immediate
--- cut here
Oh yeah, here's a bonus: -loop!
Try this:
: CountBackwards 0 4 do r . 1 -loop ; CountBackwards
One more thing: 1 pick = dup, 2 pick = over...
Enjoy.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads