SuperFORTH Editor

Anything QL Software or Programming Related.
User avatar
programandala.net
Chuggy Microdrive
Posts: 74
Joined: Mon Dec 13, 2010 12:41 pm
Location: Spain
Contact:

Re: SuperFORTH Editor

Post by programandala.net »

polka wrote: The way blocks are managed in the two FORTH machines that I know are running on the QL (the Computer One FORTH and the Digital Precision SuperFORTH) are completely opposed and I prefer the Computer One way :
I have used both systems, and I agree with you. The way Computer One Forth handles block is better. That's the way most Forth systems do it, when simulating blocks on ordinary files.
polka wrote: SuperFORTH obviously prefers text source files (as all the added packages like the editor ... the reversi) are provided in this form.
Are you sure the source of Reversi was included with SuperForth? It was listed on the manual, but I think only the binary was included on the disk. I have to check my DP Collection. I think Reversi was included on a different disk.
polka wrote: So I would advise not to bother any longer with block files managers (especially the Digital Precision ones) and to adopt preferably text source files. They are not supported by Computer One FORTH, but I feel their management should be rather easy to implement and I will do it.
Yes, it should not be difficult to implement text source files on Computer One Forth, and also to improve the way SuperForth handles them (for example, make then nestable).

If you develop for Computer One Forth or SuperForth, on a computer you can install Vim or Gforth on, you may find useful the converters I wrote:
I find them very useful. They allow you to edit Forth sources with almost all the advantages of source text files, and almost no disadvantage of blocks, and convert them to blocks suitable for different Forth systems (the standard target format .fb is suitable for Computer One Forth, and a specific converter is included for SuperForth).
polka wrote: May the FORTH be with you !
I invite you to join Forth on Sinclair (and Z80) computers email list. There are some QL users there.


Marcos Cruz (programandala.net)
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: SuperFORTH Editor

Post by tcat »

Paul,
USING mdv1_MyFile_scr
And then you may load the blocks you select for instance by :

55 LOAD

that will load block 55 and if it contains "immediate" word --> , it will load next block and so on...
So far I can achieve a similar functionality in S*FTH, using READ_FILE (defined earlier in the post) that will take a start block and a FILENAME_FTH terminated with END_FILE. It puts out a number of blocks, inserts --> continuation mark in as needed, so single [nnn] LOAD may also work then.

lines longer than C/L are trimed, so before READ_FILE, CHECK_FILE might be used, it reports lines exceeding 64 chars, and it also counts No# blocks needed by READ_FILE.

My definition of CHECK_FILE here

Code: Select all

2VARIABLE #TEMP  VARIABLE #EOF
: EF ." END_FILE" ;
: CHECK_FILE   ( "filename" --- )

  CR ." Lines over " C/L . ." chars:"
  #IN 2@ #TEMP 2! 0 OPEN #IN 2!
  0 BEGIN
  L/B 0 DO
       DUP QUERY 10 WORD DUP
       ['] EF >BODY 2+ $= DUP #EOF !
       IF LEAVE THEN
       C@ C/L > IF L/B * I + 1+ . ELSE DROP THEN
  LOOP
  1+ #EOF @ UNTIL 2DROP 1+ CR ." BLK#:" .
  #IN 2@ CLOSE #TEMP 2@ #IN 2! ;

END_FILE
Example:

Code: Select all

CHECK_FILE MDV2_EDITOR_FTH
Lines over 64 chars: 3  4  19  83  84  85
BLK#:12   ok
The lines 3 .. 85 contain some long comments, once adjusted to 64 chars, [nnn] READ_FILE MDV2_EDITOR_FTH will put out 12 blocks.

[nnn] LOAD works.

Marco @ mandala,
If you develop for Computer One Forth or SuperForth, on a computer you can install Vim or Gforth on, you may find useful the converters I wrote:

fsb Forth source converter
fsb2 Forth source converter
I will also try these tools of yours ...

Tom


User avatar
programandala.net
Chuggy Microdrive
Posts: 74
Joined: Mon Dec 13, 2010 12:41 pm
Location: Spain
Contact:

Re: SuperFORTH Editor

Post by programandala.net »

Derek_Stewart wrote: A possible solution this this would be to use SUB by Phil Borman.

SUB allows substitution of directories to a single device called SUB, much like DEV, but work better.
Thank you. I didn't remember that useful extension. I have included it into my boot and tried it with SuperForth, following your example and also the SUB manual, but nothing changed: the original binary (which boots from flp1_) doesn't find the BLK1 file on nfa4_. I'm using SMSQmulator. I'll try other emulators. My goal is to make SuperForth load its BLK1 file from the native file system of the host, not from a .win, or .img file.

After so many tries, I have a nice collection of SuperForth binary files, every one patched to boot from a different device:

Code: Select all

superforth_dev7_exe
superforth_flp1_exe
superforth_nfa1_exe
superforth_nfa4_exe
superforth_nfa7_exe
superforth_ram1_exe
superforth_sfa1_exe
superforth_sfa7_exe
superforth_sub4_exe
superforth_win1_exe


Marcos Cruz (programandala.net)
Derek_Stewart
Font of All Knowledge
Posts: 4684
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: SuperFORTH Editor

Post by Derek_Stewart »

Hi,

The commands you need are:

FLP_USE FDD
SUB_USE FLP
SUB_USE 1,SF

Where SF is the directory holding the SuperForth files

Just need to LRUN FLP1_BOOT to run Superforth Editor

I have just tried this on QPC2, SMSQmulator, Qemulator, QXL 8mb, 768K Trump Card JS QL, 512K Qubide QL, Q40. All work great.


Regards,

Derek
User avatar
programandala.net
Chuggy Microdrive
Posts: 74
Joined: Mon Dec 13, 2010 12:41 pm
Location: Spain
Contact:

Re: SuperFORTH Editor

Post by programandala.net »

Derek_Stewart wrote: FLP_USE FDD
SUB_USE FLP
SUB_USE 1,SF

Where SF is the directory holding the SuperForth files

Just need to LRUN FLP1_BOOT to run Superforth Editor
Thank you for trying on other emulators (In order to try QCP2 and Q-emuLator I have to use a different machine). But I think you're missing SUB_DRV. By default the drive used by SUB is "win". So I guess you are booting SuperForth from a directory of a .win file. That works for me too. I want to boot from the native system instead. I have SFA4_superforth_exe and I want it to find NFA4_BLK1 instead of FLP1_BLK1 or SUB1_BLK1 or whatever device.

I'll do more tries later.


Marcos Cruz (programandala.net)
User avatar
polka
Trump Card
Posts: 207
Joined: Mon Mar 07, 2011 11:43 am

Re: SuperFORTH Editor

Post by polka »

programandala.net wrote: Are you sure the source of Reversi was included with SuperForth? It was listed on the manual, but I think only the binary was included on the disk. I have to check my DP Collection. I think Reversi was included on a different disk.
Yes you are right, on the mdv reversi is a binary, but I never tried to load it, and as the source is listed in the manual, I surmised that it was a text file also on the disc (like the EDITOR, by the way).

Bye, Paul


May the FORTH be with you !
POLKa
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: SuperFORTH Editor

Post by tcat »

Hi,

I have rewritten the words CHECK_FILE, and READ_FILE using built in S*FTH strings, the code is now a bit neater and much simpler.

CHECK_FILE

Code: Select all

2VARIABLE #TEMP  VARIABLE #EOF
STR_CONST EF "END_FILE"  85 STRING LN

: CHECK_FILE   ( "filename" --- )
  CR ." Lines over " C/L . ." chars:"
  #IN 2@ #TEMP 2! 0 OPEN #IN 2!
  0 BEGIN
  L/B 0 DO
       DUP LN INPUT
       EF LN 1 0 LOCATE 0> DUP #EOF !
       IF LEAVE THEN
       LN C@ C/L > IF L/B * I + 1+ . ELSE DROP THEN
  LOOP
  1+ #EOF @ UNTIL DROP 1+ CR ." BLK#:" .
  #IN 2@ CLOSE #TEMP 2@ #IN 2! ;

END_FILE

READ_FILE

Code: Select all

2VARIABLE #TEMP  VARIABLE #EOF
STR_CONST EF "END_FILE"  STR_CONST NB "-->"  85 STRING LN

: READ_FILE   ( first_block "filename" --- )
  #IN 2@ #TEMP 2! 0 OPEN #IN 2!
  BEGIN DUP BUFFER
  L/B 1 DO
       DUP LN INPUT
       EF LN 1 0 LOCATE 0> DUP #EOF !
       IF LEAVE THEN
       LN COUNT ROT SWAP CMOVE
       SPAN @ + C/L SPAN @ - +
  LOOP NB COUNT ROT SWAP CMOVE
  UPDATE SAVE-BUFFERS
  1+ #EOF @ UNTIL 2DROP
  #IN 2@ CLOSE #TEMP 2@ #IN 2! ;

END_FILE
Tom


Post Reply