alpha xForth Compiler

Post Reply
BruceMcF
Posts: 1336
Joined: Fri Jul 03, 2020 4:27 am

alpha xForth Compiler

Post by BruceMcF »


NOTE: v0.1.4 seems to have fixed or reduced the severity of the corrupted dictionary in v1.3. Known Bugs: .S may give spurious results. DOES> is broken, do not attempt to use it.




________________________________________________________________




I just uploaded this to see if it runs in the try it now box. It appears to run fine, including the words that operate programmatically based on the width of the display.




With some work with an effective in system Monitor program, it would be possible to save a copy of xForth including words you have defined on the console, but for practical purposes, this still requires a SAVE word to be able to save an image of the file after extending, and an INCLUDE word to load a script from a .SEQ file. Once those are written, I will be able to test to see how close to American National Standards Forth (ANS Forth) compliance this system actually comes.




While it runs, it is not fully exercised, so I would be very surprised if there were not bugs. "Alpha" in the title means that there ARE bugs, though I fixed two substantial ones since the last release. Bug reports & suggested bug fixes both accepted, the first dutifully and the second gleefully.




About upper and lower case: there is NO ASCII CONVERSION in this system. ANS Forth requires that ANS standard words be recognized in upper case, and its up to the individual Forth what they do about lower case. Most modern Forths are not case sensitive. This one is. So if you are in Graphics mode, do EVERYTHING in upper case. If you switch to Upper/Lower case mode, do EVERYTHING in lower case. If you enter the command WORDS to see all of the words in the dictionary, you will note some that look like /FORTH/ which is what I did when eForth had lower case words that were "platform" words that the standard Forth word in upper case was built upon. You will also see /DO/ /?DO/ and /LOOP/ as the "platform" words that DO ?DO and LOOP are built upon.




No conversion also means the the line comment word \ is entered and shown as the English Pound Sterling, aka GBP, sign, _ is backarrow, and ^ is up arrow. On the command line, any character from $00 to space is treated as whitespace, as is any character from $80 to Non-Break-Space ($A0).




For some brief usage examples and pointer to more about the Forth programming language, see the discussion forum posts attached to this upload.



This is a maintenance release, which fixed a bug in ! which affected the compiler ... incrementing the address of the high byte was broken when the low byte was at $xxFF.  This affected compilation in particular, since the present build starts the codespace pointer less than 20 bytes away from a page boundary.




Also, the prompt OK is also the name of the NOOP command in xForth, so you can more easily use previous command line entries that are still on the screen as a command history.




Also, printing free form numbers with . and U. has been brought into compliance with Forth94 ... eForth puts a leading separating space, but the standard specifies a trailing space.




Also, the words in the dictionary have been put into the correct order, so WORDS gives a display that is the order of "more recent definition first, oldest definition last" which is more familiar to regular Forth users.




______________________________________________________________




By the way, don't worry that I might be forced to take this to Beta prematurely due to running out of release numbers for Alpha ... I consider 0.00 to 0.3F to be Alpha, 0.40 to 0.FF Beta.



EFC02_DT.REF
EFC02_DT_20200911b.ASM

Attachments
alpha xForth Compiler
alpha xForth Compiler
v0014_screen2.jpg (118.37 KiB) Viewed 8745 times
alpha xForth Compiler
alpha xForth Compiler
v0014_screen1.jpg (73.11 KiB) Viewed 8745 times
x4th_dty.prg
alpha xForth Compiler
(10.04 KiB) Downloaded 517 times
BruceRMcF
Posts: 224
Joined: Sat Jan 07, 2023 10:33 pm

Re: alpha xForth Compiler

Post by BruceRMcF »

Note that updating my password on my original account did not work, so I am now BruceRMcF.

However, while this download is still broken where it was broken before (the word DOES> does not work), it only used core Kernel calls and should be compatible with R41.
TheGeekOnSkates
Posts: 8
Joined: Mon Feb 06, 2023 1:02 am

Heart Re: alpha xForth Compiler

Post by TheGeekOnSkates »

Whoa, you're building a Forth? That's what I wanted to do. :D

I'm building mine in C using cc65, but I have to admit there's a lot about Forth internals I have yet to learn (especially when it comes to ANS Forth standards). My Assembly skills are intermediate at best, but if there's anything I can do to help you with this project, I'm all for it. For now, I downloaded your alpha ROM. :)

PS: Hex in version numbers? I like it!
BruceRMcF
Posts: 224
Joined: Sat Jan 07, 2023 10:33 pm

Re: alpha xForth Compiler

Post by BruceRMcF »

TheGeekOnSkates wrote: Mon Feb 06, 2023 10:28 pm Whoa, you're building a Forth? That's what I wanted to do. :D
I started looking to make a Forth for my C128 when I was teaching Math to a high school in Grenada in the West Indies. I left them my C128, and bought a C128D with part of my re-adjustment allowance ... and then I fried the CPU plugging a power tap into the datasette port upside down.

I used my C64, but went to grad school and didn't have time, acquired a family in grad school which came with me when I went to Australia to teach, so sometimes I doodled on it but had no hardware to implement it on, set it to one side ...

... and when I came across this project, decided to try my hand. When my intensive online course is over and I am down to a normal course load, I hope to crack the CREATE ... DOES> bug then get Blocks and INCLUDE up so it can be further extended in Forth.
I'm building mine in C using cc65, but I have to admit there's a lot about Forth internals I have yet to learn (especially when it comes to ANS Forth standards). My Assembly skills are intermediate at best, but if there's anything I can do to help you with this project, I'm all for it. For now, I downloaded your alpha ROM. :)
I've seen several interesting C implementations of Forth ... indeed, I used gforth quite heavily while in Australia two and three decades ago.
PS: Hex in version numbers? I like it!
It does kind of signal the intended audience! 8-)
TheGeekOnSkates
Posts: 8
Joined: Mon Feb 06, 2023 1:02 am

Re: alpha xForth Compiler

Post by TheGeekOnSkates »

It totally does. :D

And yeah, if you get SAVE and INCLUDE figured out... I mean shoot, that's a Forth to be reconed with. :lol: Cheesy, I know, but we Forth fans love our cheesy puns. I got a buddy on another community who is always saying things like "go Forth" and stuff like that.

And no hurry - believe me, I get it. For you it's "course load"; for me it's "backlog" (my day job is also as a programmer, lol). But there's always time to play with 8-bit stuff. :) I think I might keep playing with my Forth, just cuz, but like I said when u get back on this I'll help out any way I can. The X16 just needs a good Forth. Yours, mine, I don't care. Even if we both end up with complete Forths, nothing wrong with that. The C64 has C64 Forth and durexForth. Linux has Gforth and Pforth. And in the meantime, we'll just keep going and see what happens - the journey is the fun part. :)

PS: Completely off-topic for an X16 forum, but Gforth is 20-30 years old? Who GNU? :D
BruceRMcF
Posts: 224
Joined: Sat Jan 07, 2023 10:33 pm

Re: alpha xForth Compiler

Post by BruceRMcF »

TheGeekOnSkates wrote: Fri Feb 10, 2023 1:29 am... PS: Completely off-topic for an X16 forum, but Gforth is 20-30 years old? Who GNU? :D
:roll:

When I wrote a "vanilla ANS Forth text editor" (so no function keys, commands were done by hitting \ first -- the \ command emitting a \ so a direct \\ escape -- I called it Bruce McFarling's Writer so I could say that I finally had a BMW.
Post Reply