Post Reply 
FORTH for the SHARP PC-E500 (S)
01-13-2022, 03:40 AM
Post: #61
RE: FORTH for the SHARP PC-E500 (S)
(01-12-2022 11:06 PM)Helix Wrote:  I'm still learning Forth, following the book Starting Forth 2nd edition. (I know it's outdated, but it's didactic and enjoyable. I have also the Forth Programmer's Handbook for a more modern reference.)

I have a problem with the KEY? word. If no key is pressed, it returns "error -57" instead of 0.
The same problem occurs with EKEY? Furthermore, if a key is pressed, EKEY? returns 255. I think it should be -1.

It is good to hear you are putting Forth500 through its paces Smile

You made a good point. The EKEY? word calls CHAR-READY? but then throws exception -57 if CHAR-READY? returns true. This is a small part of the older pceForth version, which looks wrong to me. The EKEY? Forth standard word requires EKEY? to return true or false.

I will correct this discrepancy soon and release an update.

I may also add a new module LOCALS.FTH that I wrote from scratch to implement the LOCALS word set (I heard that Forth purists turn their nose up to LOCALS, arguing that it is superfluous since everything can be done via the stacks.)

I was tinkering with some code I wrote to add dynamic scoping of arguments and locals to Forth definitions. This turns out to be surprisingly simple to implement in Forth itself, so I wouldn't be surprised if someone hasn't done this already.

- Rob

"I can count on my friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
01-16-2022, 09:22 PM
Post: #62
RE: FORTH for the SHARP PC-E500 (S)
Helix,

The EKEY? and KEY? exception problem is fixed. That was annoying. Thanks for reporting. Sorry to have missed that. I try to test Forth500 as much as possible before releasing updates, but there is only so much time one person can put into this.

The Forth500 update includes the following changes:

- updated BREAK key pressing exception to display Break instead of <Error -28

- updated REPRESENT to produce 12 or 13 non-rounded digits for single floating point results instead of 10, which means that single precision arithmetic is practically performed with 12 or even 13 digits without rounding

- updated double floating point computation results to round to 20 digits rather than ignoring the guard digits

- fixed EKEY? issue that affected KEY? as well

- Rob

"I can count on my friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
01-18-2022, 12:32 AM
Post: #63
RE: FORTH for the SHARP PC-E500 (S)
Thank you for the update! Now EKEY? works as expected. Smile

Jean-Charles
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)