forth: add more pockets

This changes pocket index calculation to support more than two pockets.
As an example default number of pockets is set to 4.
This should ease nesting more than two levels using pockets as
temporary storage.

Signed-off-by: Igor Kovalenko <igor.v.kovalenko@gmail.com>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@494 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Igor Kovalenko
2009-05-22 17:15:48 +00:00
committed by Blue Swirl
parent 02130e8240
commit 17594b70b8

View File

@@ -622,18 +622,19 @@ variable >in 0 >in !
\ pockets implementation for 7.3.4.1
100 constant pocketsize
4 constant numpockets
variable pockets 0 pockets !
variable whichpocket 0 whichpocket !
\ allocate 2 pockets to begin with
\ allocate 4 pockets to begin with
: init-pockets ( -- )
pocketsize 2* alloc-mem pockets !
pocketsize numpockets * alloc-mem pockets !
;
: pocket ( ?? -- ?? )
pocketsize whichpocket @ *
pockets @ +
1 whichpocket @ -
whichpocket @ 1 + numpockets mod
whichpocket !
;