gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gforth BLOCK 0


From: Josh Grams
Subject: Re: Gforth BLOCK 0
Date: Sat, 6 Aug 2022 10:39:06 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0

IIRC 0 isn't a valid block number: for instance,

http://forth.sourceforge.net/standard/dpans/dpans7.htm#7.6.1.1790 LOAD says "An ambiguous condition exists if u is zero or is not a valid block number."

I believe in some systems blocks were actually the raw disk, so the bootloader would be in block zero and thus it wasn't available for source code? I could be totally wrong about that.

--Josh

On 8/6/2022 7:17 AM, shtps via Gforth discussion and announcements wrote:
Hi,

I'm relatively new to Forth and I'm wondering if I'm doing something wrong or 
if this is intended behavior or if this is a bug. I'm using gforth on GNU/Linux.

Executing the following gives me an error message and creates an empty 0 byte 
file called blocks.fb:

s" Hello world!" 0 block place update save-buffers bye

I have attached the backtrace but it doesn't seem very helpful, all it says is 
invalid memory address. So I then delete the file blocks.fb and try again, but 
this time with block 1 instead:

s" Hello world!" 1 block place update save-buffers bye

and it successfully writes into the block and we can verify that it did indeed 
write into it by starting gforth again and executing:

1 block count type Hello world! ok

So maybe block 0 will work now? I try to write into it again:

s" weird..." 0 block place update save-buffers bye

No errors this time, but when I start gforth again and try to read from it I 
don't get the expected output:

0 block count type ok

So I looked at the blocks.fb file in a text editor and "weird..." was written 
into it correctly and after a while I've figured that the following works after starting 
gforth again:

1 block drop 0 block count type weird... ok

To me this seems like a bug where "0 block" doesn't initialize something that "1 
block" does. Either that or I'm using blocks the wrong way. Unfortunately I could not find any 
simple examples on how to use blocks so I'm just going off the docs and a few scraps of information 
on the internet that I could find.

Best Regards,
shtps



reply via email to

[Prev in Thread] Current Thread [Next in Thread]