Strings in fig-FORTH?


Strings in fig-FORTH?

von tschak909 » Mi 31. Mär 2021, 19:05
Ok, why am I drawing such a huge blank here?

for the life of me, I can't remember how to properly create and manipulate strings in fig-FORTH.

I tried:

: CARRAY <BUILDS 256 ALLOT DOES> C@ + ;

but that doesn't seem to work very well :(

I need to create a 256 byte character buffer to store a devicespec to pass into a DCB to pass into SIOV..

-Thom

Re: Strings in fig-FORTH?

von Stefan » Mi 7. Apr 2021, 23:06
Hi Thom,

I have to admit, that I don't got what for the C-fetch and the + is needful there :? Maybe getting a dimension of one byte per element?

Imho it would be expedient to use this definition to get addressable storage:
Code: Alles auswählen
: CARRAY <BUILDS 256 ALLOT DOES>  ;


I'm not much more than a beginner with FORTH, but keen to go ahead. So I did some testing on fig4th 1.1 (ABBUC PD 0220), valFORTH 1.1 (atarimania) and of course with SNAUT 1.2 (atariwiki) which is a F83.

By the us of fig4th as well as valFORTH (both are Forth-7x) I got an addressable buffer with this code:
Code: Alles auswählen
: CARRAY <BUILDS 256 ALLOT DOES> ;
CARRAY MYBUF


Switching over to F83 "create" took place of "<builds" and the "does>" became needless therefor.

Which Forth do you use on the Atari?

8-bit regards :notworthy:
Stefan
buffer_on_fig4th.pngbuffer_on_fig4th.png
buffer_by_create_on_snaut.pngbuffer_by_create_on_snaut.png