[OpenBIOS] [PATCH 1/3] bootstrap.fs: add pseudo r-stack implementation for interpret mode

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Jul 17 21:05:33 CEST 2016


On 17/07/16 17:20, Segher Boessenkool wrote:

> On Sun, Jul 17, 2016 at 03:20:57PM +0100, Mark Cave-Ayland wrote:
>> +\
>> +\ Pseudo r-stack implementation for interpret mode
>> +\
>> +
>> +variable prstack 20 cells allot
>> +variable #prstack 0 #prstack !
> 
> 20 hex or 20 decimal?  If it isn't clear, put hex or decimal before this?

The default in OpenBIOS is hex, so the intended value is 32 decimal.
Skimming through the existing files, it looks like the conventional way
to do "h# 20" so I can do that on a v2.

> This allocates 21 cells and isn't portable, btw ("variable" allocate one
> cell already, not necessarily contiguous with the "allot" allocated cells).

Looking at the existing code, the most common way to reserve memory in
the dictionary is with allot, e.g.

variable prstack here h# 20 cells allot prstack !

Does that look reasonable?

>> +: >r state @ if ['] >r , exit then r> swap prstack-push >r ; immediate
>> +: r> state @ if ['] r> , exit then r> prstack-pop swap >r ; immediate
>> +: r@ state @ if ['] r@ , exit then r> prstack-pop dup prstack-push swap >r ; immediate
> 
> ['] >r ,   is very non-portable as well, "postpone >r" is much more modern.

The version above is what is used throughout the OpenBIOS codebase as
opposed to postpone which is why I went with it. I've just tried using
postpone in OpenBIOS and it causes things to break, so I suspect that
either it does something strange to the r-stack itself or perhaps it is
another word that needs fixes for immediate mode.


ATB,

Mark.




More information about the OpenBIOS mailing list