Programming the 80’s way.

The idea of porting my Forth system to the ZX Next OS was pinned in my mental board the very day I pledged on Kickstart and once, during last April when I received my brand new ZX Spectrum Next, I really felt the commitment to pursue the task. 

Forth is a programming language that fascinated me since I was a child and even nowadays I consider it a true goldmine because it nicely blends some of the best features of a compiler, an assembler, an interpreter, and an interactive development environment. But even better, it’s an all-in-one place where you can feel the 80’s way of coding and testing.

I did not need to start from scratch since I started from a reliable working version of mine – the vForth 1.413j [EDIT] v-Forth 1.5 [EDIT]- already running on a real machine with a ZX Microdrive or with (emulated) MGT DISCiPLE floppy diskette which already provides an old fashion numbered Screens storage system. 

All I had to do was to learn the new API specifications and exert my programming skills. The evolutionary step here was just to adapt a previous Screen storage system to work using the APIs available on NextZXOS to access a single file on SD. In a couple of weeks, I released the first working build on my Google site “ZX Attic” and announced it on a Facebook group. 

To my surprise, the work received a warm welcome from the community and drove me to continue porting some of the features ZX Next provides, such as Z80N Assembler extensions, MMU7 paging, Layer 2, and so on. 

This project doesn’t want to divert people from using NextBasic, on the contrary it wants to attract people to learn Forth and perhaps to learn Z80 Assembler a different way. 

7 Comments

  • I’ve just released a new “v-Forth 1.5 NEXTZXOS version – build 20200721” with a nice improvement, a way to instruct INTERPRET to ignore the case and accept lower-case text. In the dictionary I added two new words, CASEON and CASEOFF, that do the job.

    The “documentation” is the among the first things do, so I spent a few hours to write this document that should help: https://github.com/mattsteeldue/vforth-next/blob/master/docs/vForth1.5-core-en.pdf .

    If you are interested in trying to use “v-Forth 1.5 NEXTZXOS version”, it is available for download at https://github.com/mattsteeldue/vforth-next/blob/master/download/ [edited]. You have to copy “forth” directory in C:/tools/vForth of your SD and load “C:/tools/vForth/Forth15_loader.bas”.

    I also removed a nasty bug that haunted for long years. The facts are as follow: I use often LIST word to inspect and then modify a Screen, and it happens sometime that I misspell it as “LIT”. This causes an immediate crash. I finally managed to fix it when I thought at how LIT works under the hood by consuming the token in the following cell.

    If you are reading this post until here, it means you want to know more technical details. Since in this case LIT wasn’t executed in a definition but it was parsed by INTERPRET and immediately run by EXECUTE, it consumed the token just after EXECUTE, that is BRANCH which is usually followed by a very small offset. Having wrongly consumed BRANCH, the Instruction Pointer now points such small positive offset and when used as an execution-token at a very low address (in ROM) the crash was unavoidable… This happens when you try to “execute the data”. I fixed it by adding a NOOP after the EXECUTE token in INTERPRET definition so, in that case LIT consumes a “NOOP” and the control flow continues without misunderstanding.

    Well, I wish to continue this post using some reply… to inform you about any good improvement I making continuing developing on this software.

  • Good to see Forth still being used. I developed Abersoft Forth for the Spectrum, and others, back in 1982 and it had a small but dedicated following back then.

  • Marc van Blijswijk says:

    Please continue this work if you can. I am very interested in Forth on the ZX Next (v2) as I dabbled with both Z80 assembler and Lightning Forth on the 48K Spectrum back in the days.

    • Thank you Marc ! This is my aim: trying to add to v-Forth enough Next features to be able to create some nice things.
      In this very moment I am coding/testing some new core definitions: REG! REG@ MMU7! MMU7@ to make easier interacting with the Next hardware. In particular I am exploiting MMU7 to build a String-Heap, i.e. a banked memory zone where I can put all strings I want and from where I can later retrieve them. See my post #2 for more details…

  • peter bierbach says:

    Hi good afternoon.
    this vforth for the next is wonderful.
    with my 72 years i’m also a forth friend.
    have played with the c64 since 1990 and forth. was a long time ago.
    there were already different versions.

    I’ve been playing with the next (n-go) for some time.
    I always looked for a language that was quick and clear.
    I liked this nextbuild. then i saw this vforth for
    the next and I’m thrilled. of course, i am not yet familiar with this next system, so my questions about the vforth and the functions.
    keep it up.
    maybe one day this vforth can be packed into a kind of rom for the next (n-go). that would be the highlight.

    greetings from Germany.

Leave a Reply to John Jones-Steele Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.