REVIEW OF DUREXFORTH Samuel A. Falvo II 2025 November 15 Forth Day What is DurexForth? durexForth is a Forth 2012 environment for the Commodore 64. It replaces BASIC entirely. In this review, I'm looking at version 5.0.0. NOTE: It is NOT POSSIBLE to escape to BASIC for any reason. RESTORE key breaks back into Forth! Kernel and editor takes up around 12.5 KiB, starting at $0801. Return stack = CPU stack. Data stack occupies zero-page space formerly belonging to BASIC. About 32 cells deep. Subroutine-threaded with tail-call optimization! FAST!! NOTE: TCO requires people who play with the return stack (like I do and have shown in the past) to take care. This can crash! : uhoh R> DROP ; : hmm ." Concerning" uhoh ; : emote hmm CR ; However, R> DROP can still work if you can elide TCO. Includes several demos illustrating how one could access VIC-II or SID chips. NOTE: I'd show one, but the demos are large and might take too long to load. I'll show one if enough time remains; else see me after. As you no doubt noticed by now, based around files! But, ANS File wordset is not supported. Nor are blocks. Instead... LOADB ( fnA fnU ldA - nextA ) SAVEB ( baseA endA fnA fnU - ) Access to raw Commodore KERNAL I/O as well (DEVICE, OPEN, CLOSE, CHKIN, CHKOUT, CLRCHN, etc.) Yes, it includes a 6502 assembler! Structure of Dictionary Space LATEST points to last defined word entry in dictionary. HERE points to first free byte in code/data space. LATEST grows down towards HERE. Or, HERE grows up towards LATEST. Out of space when LATEST <= HERE. .---------------+-----+-------. ! code/data !/////! dict ! ---------------+-----+------- $0801___________^ ^___$9fff ! ! here latest Trivial to HIDE private definitions. But, be careful! Nothing stops you from issuing HIDE DROP. Name tokens are variable-length entries in the dictionary. Names can be up to 31 characters long. -----+---+---+---+---+----+---- ! $04 ! D ! R ! O ! P ! ll ! hh ! -----+---+---+---+---+----+---- ^ ! Name Field Code Field NT Address ! ! ! `-------------------------. ! ! ! 7 6 5 4 3 2 1 0 ! --- ------- ---+---+---+---+--- ! I !///////! Length ! --- ------- ---+---+---+---+--- ! ! ! `-- ignored; typically 0. `-------- immediate flag I couldn't find a way to resolve a NT to an XT in the stock dictionary; but, it's easy to build one yourself. : nt>xt ( nt - xt ) dup c@ $1F and + 1+ @ ; Facilities The included text editor is named simply V. It is based on vi, but there are many differences. v can edit files up to 11 KiB. NOTE: BE CAREFUL! It is trivial to crash v! (In fact, I just did as I was typing this note!) Save early, save often! Whatever you do, never ever type - in command-mode. You will never be able to recover from this except by rebooting. Same for =. The editor supports running the contents of the buffer by pressing F7. The buffer does not need to be saved (however, I still recommend saving first!). The "dos" module (INCLUDE DOS) gives command-line access to the DOS that runs on Commodore's storage devices. For example, 8 device dos r0:new-name=0:old-name will rename a file called old-name to new-name. Frequent DOS commands include but aren't necessarily limited to: r: rename s: scratch (delete file) c: copy n: format disk v: validate disk (like CHKDSK) Anything you'd send over the command channel to the drive in BASIC using OPEN 15,8,15,"..." or PRINT#15 can be sent over with DOS. You can get a disk directory with the LS command. So, between LS, DOS, and V, you have a pretty productive development environment! Work Flow durexForth encourages a workflow that is centered around the V editor, which makes it perfectly compatible with test-driven development. Learn to use MARKER words for controlling dictionary space consumption. For modules under active development, use a phrase like this as a header: ===M=== MARKER ===M=== where M is the name of your module. The first incantation will free up dictionary space, while the MARKER will start the module anew. NOTE: I'm working on a Space Invaders clone using this approach, and it is so seamless that the 23 KiB of free dictionary space will feel like you have MB at your disposal. NOTE: When first getting into your development routine, you will need to manually create the first MARKER. But, this can be scripted too. Within each module, you can list one or more unit tests to ensure program correctness upon loading. I tend to structure my modules like so: ===M=== MARKER ===M=== \ ... configuration constants ... \ ... private words ... \ ... public words ... MARKER END-TESTS : T100 ... test code here ... ; T100 : T110 ... test code here ... ; T110 END-TESTS Conclusion durexForth is now my 2nd-favorite Forth environment, coming in right after PygmyForth for MS-DOS. Despite being easy to crash if you're not careful, durexForth is small and comfortable enough to easily resume where you left off after a crash. Since it replaces BASIC, it has no underlying host OS to rely upon to make up for missing features. So, durexForth must assume the roles and responsibilities of an OS. It does this with grace, convenience, speed, minimalism, and yet doen't compromise on features or system level access. 10/10. Thank you!