[OpenBIOS] r494 - trunk/openbios-devel/forth/bootstrap

svn at openbios.org svn at openbios.org
Fri May 22 19:15:48 CEST 2009


Author: blueswirl
Date: 2009-05-22 19:15:48 +0200 (Fri, 22 May 2009)
New Revision: 494

Modified:
   trunk/openbios-devel/forth/bootstrap/bootstrap.fs
Log:
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 at gmail.com>


Modified: trunk/openbios-devel/forth/bootstrap/bootstrap.fs
===================================================================
--- trunk/openbios-devel/forth/bootstrap/bootstrap.fs	2009-05-22 17:14:10 UTC (rev 493)
+++ trunk/openbios-devel/forth/bootstrap/bootstrap.fs	2009-05-22 17:15:48 UTC (rev 494)
@@ -622,18 +622,19 @@
 \ 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 !
   ;
 




More information about the OpenBIOS mailing list