6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 11:10 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Jun 18, 2021 3:25 pm 
Offline

Joined: Thu May 13, 2021 8:56 am
Posts: 31
Location: Hellevoetsluis-NL
Hello,
is it possible to emulate the word "CREATE" in the old fig forth so I can insert some bytes in the directory like,

create test 81 c, 82 c, 83 c,
and when I call test the address of the first byte will be on the stack.


Thank for any help.
Cheers,
Jan


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 18, 2021 5:13 pm 
Offline

Joined: Sun May 13, 2018 5:49 pm
Posts: 255
Code:
HERE 81 C, 82 C, 83 C, CONSTANT TEST
Here's a sample run where I then read back the three bytes from RAM:
Code:
HERE 81 C, 82 C, 83 C, CONSTANT TEST OK
test c@ . 81 OK
test 1 + c@ . 82 OK
test 2 + c@ . 83 OK
Note that the header for this word ends up AFTER the data.

If you'd like to have the header first so that you can keep adding more data, you might like:
Code:
: MYCREATE <BUILDS DOES> ;
along with a sample run:
Code:
: MYCREATE <BUILDS DOES> ; OK
MYCREATE TEST 81 C, 82 C, 83 C, OK
TEST C@ . 81 OK
TEST 1+ C@ . 82 OK
TEST 2 + c@ . 83 OK


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 18, 2021 8:25 pm 
Offline

Joined: Sun Apr 26, 2020 3:08 am
Posts: 357
<deleted>


Last edited by IamRob on Sun Jun 20, 2021 4:40 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 18, 2021 8:54 pm 
Offline

Joined: Thu May 13, 2021 8:56 am
Posts: 31
Location: Hellevoetsluis-NL
SamCoVT wrote:
Code:
HERE 81 C, 82 C, 83 C, CONSTANT TEST
Here's a sample run where I then read back the three bytes from RAM:
Code:
HERE 81 C, 82 C, 83 C, CONSTANT TEST OK
test c@ . 81 OK
test 1 + c@ . 82 OK
test 2 + c@ . 83 OK
Note that the header for this word ends up AFTER the data.

If you'd like to have the header first so that you can keep adding more data, you might like:
Code:
: MYCREATE <BUILDS DOES> ;
along with a sample run:
Code:
: MYCREATE <BUILDS DOES> ; OK
MYCREATE TEST 81 C, 82 C, 83 C, OK
TEST C@ . 81 OK
TEST 1+ C@ . 82 OK
TEST 2 + c@ . 83 OK


thanks, this is what i was looking for.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: