mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
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:
committed by
Blue Swirl
parent
02130e8240
commit
17594b70b8
@@ -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 !
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user