Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth Mac > Re: 16 bits arr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 95 of 159
Post > Topic >>

Re: 16 bits array cells being erased

by Roelf Toxopeus <these3rt0only@[EMAIL PROTECTED] > Jan 23, 2005 at 12:03 AM

In article <f3cdf9d9.0501210909.1841f573@[EMAIL PROTECTED]
>,
 jeandal34@[EMAIL PROTECTED]
 (jd) wrote:

> Hi,
> 
> I am running MacForth 5.2 on a Mac and have very strange things
> happening with my arrays. When i create an array and enter a value in
> the first cell as follows:
> create MyArray 12 allot
> 221 MyArray !
> 
> if i view the content of the first cell the value is right:
> MyArray @[EMAIL PROTECTED]
 . 
> 221
> 
> However if i now enter a value in the second cell of the 16 bit array:
> 230 MyArray 2 + !
> 
> and check the content of the first cell again, i obtain 0 : my first
> cell has been erased!!
> 
> Do i do anything wrong? Can anyone help.
> Thanks in advance,
> jd

a cell in MacForth is 32 bits

use w@[EMAIL PROTECTED]
 and w! for 16 bit storage and retrieval as in your case above.
221 Myarray w!
230 MyArray 2 + w!

use ! and @[EMAIL PROTECTED]
 for 32 bit stuff
221 Myarray !
230 MyArray 4 + !

(just in case: use c@[EMAIL PROTECTED]
 and c! for 8 bit, sorry characters)
 




 4 Posts in Topic:
16 bits array cells being erased
jeandal34@[EMAIL PROTECTE  2005-01-21 09:09:26 
Re: 16 bits array cells being erased
ward@[EMAIL PROTECTED] (  2005-01-22 06:33:18 
Re: 16 bits array cells being erased
ward@[EMAIL PROTECTED] (  2005-01-23 07:52:44 
Re: 16 bits array cells being erased
Roelf Toxopeus <these3  2005-01-23 00:03:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 4:08:45 CDT 2008.