FIF. Another FORTH.

Discussion about ZX80 / ZX81 Software
Post Reply
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: FIF. Another FORTH.

Post by Moggy »

As per last post I've only tried this in SZ81 emulator which isn't spand compatible and uses the 81 ROM and it crashes to the K prompt.

For Toddy compile : BRK ?TERMINAL IF QUIT THEN ; Or substitute ABORT for QUIT to restart Toddy.

Console = FIF prompt
Last edited by Moggy on Wed Mar 31, 2021 1:35 pm, edited 3 times in total.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: FIF. Another FORTH.

Post by Moggy »

Just noticed the version you have is from Kmurtas site and is too old, use this for ?TERMINAL

Example : ZZZ 10000 0 DO I . BRK LOOP ;
Attachments
tForth15.zip
(284.39 KiB) Downloaded 120 times
roganjosh
Posts: 100
Joined: Thu Jun 14, 2018 12:59 pm

Re: FIF. Another FORTH.

Post by roganjosh »

Hmmm. very odd.
I've just installed SZ81 2.3.11 under Fedora Linux 33. I don't get a crash to the K prompt. Also ?BRK IF QUIT THEN (or ABORT) does return you to the FIF prompt (though you have to press RETURN to get the OK and cursor displayed as is common for QUIT etc). EightyOne is happy with it as well.

What does HEX F47 C@ H. show? If it's '7F' then the ROM version would look to be OK. Otherwise I can only at the moment assume that there's a bug in your version of SZ81 (what version and platform is it?). My code is not doing anything fancy at all, it's very short and very trivial.

Thanks for the updated tforth link. It would explain why there was no ?TERMINAL .

Alan
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: FIF. Another FORTH.

Post by Moggy »

I'm have SZ81 on LUBUNTU but am not bothered about emulation.

I tried this on real issue 3 spand using the compilation...

: BK ?BRK IF LEAVE THEN ; as per your original post.

Then testing with a simple loop...

: zzz 1000 0 DO I . BK LOOP ;

This causes a screen flick then crash to K prompt when break pressed whether spand or 81 ROM used.


EDIT

Now tried with QUIT rather than LEAVE which I've just noticed you've changed it to in your last post and this works on real kit.

As an after thought most of my zeddies are using the big bang 2speed BASIC ROM I will try FIF on one of these machines and see what differences if any occur.
roganjosh
Posts: 100
Joined: Thu Jun 14, 2018 12:59 pm

Re: FIF. Another FORTH.

Post by roganjosh »

Ah, that explains it.
You can only use LEAVE in the middle of a DO loop and at the same level as the DO word (not in a word called from the loop). That's because LEAVE replaces the top return stack word (index) with the second return stack word (terminating argument) as a way of forcing exit at the next word loop test. FIF shares its return stack with the Z80 return stack, so if you invoke the LEAVE from within a different word it'll mess up the Z80s system stack. You may not see that with tforth and other implementations that maintain a separate return stack. However they usually use the Z80 stack for their data stack so they can be crashed by other means). There's not a lot you can do about such things - there are plenty of ways to crash any FORTH system.

OTOH you can use QUIT and ABORT from a word called from within a DO loop as these don't corrupt the return stack. In fact they cleanly reset it.

Alan
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: FIF. Another FORTH.

Post by Moggy »

Understood Alan.

This is turning into a nice Forth and can't wait for the spand version. :D
roganjosh
Posts: 100
Joined: Thu Jun 14, 2018 12:59 pm

Re: FIF. Another FORTH.

Post by roganjosh »

Time for another release. This one provides ZXpand support therefore Screens are now properly implemented. It should work on both ZXpand+ and the classic version. This release has been ready for some time, however the code highlighted a problem with EightyOne which was reported to, and enthusiastically fixed by, sirmorris. Consequently if you use EightyOne it'll only work on release 1.22 and subsequent releases. We're also investigating a possible issue regarding SD cards but it might be an illusory one. I'd therefore be grateful if anyone who experiences 'ZXPAND Error 1' after typing CREATE-SCREENS (see the Screens.txt file) would let me know the manufacturer, size and type of SD card being used. If you get that error then not all the screen files will have been produced.

There is a new file in the Docs directory 'Installation.txt' which will hopefully help you to configure a setup suitable for your hardware/emulator.

The NoUDG and UDG subdirectories of the Screens directory hold 32 mostly empty and ready-to-use screen files. The exceptions are screens 3-9. Screens 3-7 hold the editor, screen 8 contains Moggy's formatting words and screen 9 holds square root words as described earlier in this thread e.g.
0 31. root
will display the square root of 31
It is traditional to use screens 0-2 for a text index of what's on the subsequent screens. That hasn't yet been done (an exercise for the reader as they say).

Be patient when loading the editor (3 LOAD) as it has to compile the definitions as it loads. The OK prompt will return when it's ready.
If you're using a ZXpand then you will need to CONFIG "M=H" before loading FIF. With a ZXpand there is approximately 21K of free RAM available (~$6390 - ~$B570). Note that all new defining words must be defined before memory address $8000 as DOES> creates some executable machine code on your behalf. I'll be doing further memory configurations as the project develops (e.g. to support Chroma 81). The word DIR has the same functionality as the ZXpand CAT command, but you don't use quotes. A RDJOY word is provided to read the ZXpand joystick port. BSAVE and BLOAD commands have been added to allow you to save/load blocks of memory (they work with cassettes too). A CALL word has been added to allow you to invoke machine code (so you can type 0 CALL to reset the machine).

Also be aware that the SD library used in the firmware of the ZXpand is not thought to support wear-balancing. So, to avoid excessive saving to the same SD card locations, it makes sense to do any development on an emulator and then transfer your screens to an SD card when you're ready to show them off using real hardware.

At some stage I'll provide commands to access the ZXpand sound chip. However, as my music production skills are negligible, that would best be done in collaboration with someone out there who's musically talented and Forth-aware/interested.

Alan
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: FIF. Another FORTH.

Post by Moggy »

A brief report re new FIF81.(all non-udg)

1) Works ok on Spand+ V5.0 and V5.1, but not on issue 1 + 3 classic Spands. FIF loads but editor just hangs after 3 LOAD entered as does DIR +MYDIR.

2) Doesn't run from ZXpand Commander and not thought to be a MEM HI-LO thing as quitting commander and checking without a reset shows MEM as HI.

3) No error 1 with my no-name SD cards ( 2gig) which is all I have.

4) I did notice the F79 word PAGE was absent but discovered you have replaced it with CLS.

5) Works ok in Win 32, ZXpand version of SZ-81 emulator.


So all seems ok as far as I've checked, sterling work that man! :D

Moggy.
roganjosh
Posts: 100
Joined: Thu Jun 14, 2018 12:59 pm

Re: FIF. Another FORTH.

Post by roganjosh »

Thanks Moggy. Very useful. To answer them:

1) That's naivety on my part. I haven't been able to find any documentation that shows versions of previous firmware & ROM. I've been working on the basis that CONFIG "V" shows the firmware and that the byte at $1dff (7679) shows the ROM version. As far as FIF is concerned it's the ROM version that counts. I've been assuming that if that byte is 70 then it's a classic, otherwise it's a '+'. So, if anyone can point me to a list/changelog of ROM version numbers that'd be very useful. I have no clue how numbers such as 5.0 and 5.1 (etc) relate to the ROM/firmware versions. I do know it works on '+' firmware versions "MOGGY" and "TOMTE", both of which have ROM 72. I also know it works on the classic with "TROLL" firmware and ROM version 70. In short, once I know what the numbers are it will hopefully be just a minor tweak. Famous last words.

2) I haven't looked at Menu Commander. If there's any low-level documentation on that somewhere I'll happily take a look. The latest FIF tramples on more areas when it loads to try to maximise the available RAM. It'll do more of that kind of thing in upcoming versions.

3) I'm relieved to hear your cards are OK. I got off to a bad start with the first two I tried gave errors. The subsequent 12 were absolutely fine. The odd thing is that the first two were good quality brands (Kingston & Sandisk) whereas the rest were mostly cheap unbranded ones. I also had a Sandisk card which would initialise on inserting on a '+' but not on a classic. A few years ago I did an SD card interface for the Jupiter Ace so I know these things can be funny at times. Usually though it's the cheap unbranded ones you have to hit with the software equivalent of a hammer to initialise. Anyway, any info I can pass on to Charlie might help. Of course it might just be a coincidence.

4) Ah, I hadn't looked to se whether there was an alternative name for CLS. Most F79s I've used use CLS. The word PAGE isn't in the core 79 vocabulary so it got overlooked. Obviously easy enough to change of course.

5) Ta for the SZ-81 info!

Alan
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: FIF. Another FORTH.

Post by Moggy »

Will check my ROM versions tonight.

The PAGE word I understood to be part of the standard as per this 1980 publication from the Forth standards team.

https://www.complang.tuwien.ac.at/forth ... RTH-79.TXT


All my classics have the AY interface so not sure if that makes a difference and are running either Troll or Dragon with a 6.6 or something ROM but again will check.

SD cards I have found that after time some kind of wear must be taking place in the SD card slot on the spand as unless I give the card an almighty tap on insertion rather than the usual push then no initialisation takes place, though I must add as Charlie will testify, my spands get well hammered that's why I need six of the buggers !! :lol:

As for Commander that's Charlies baby alongside some input from Kmurta.

This page may be of help re ROMs and firmware if you have not already seen it.


viewtopic.php?f=13&t=913
Post Reply