CPCWiki forum

General Category => Programming => Topic started by: funkheld on 08:52, 10 October 10

Title: forth for cpc6128
Post by: funkheld on 08:52, 10 October 10
hmmm.., where there is a forth for cpc6128 ?

gruss
Title: Re: forth for cpc6128
Post by: Devilmarkus on 09:18, 10 October 10
Sometimes the wiki-page helps here:
Searched for "forth"
result:
http://cpcwiki.eu/index.php/Forth

It's the tape version but I am sure it can be transferred to DSK ;-)
Title: Re: forth for cpc6128
Post by: Devilmarkus on 09:30, 10 October 10
Hmmm bad. It's really for 464 only.

But here's another:
http://www.cpc-power.com/index.php?page=detail&onglet=dsk&num=4998
And here:
http://www.cpc-power.com/index.php?page=detail&onglet=dsk&num=4339
Title: Re: forth for cpc6128
Post by: Devilmarkus on 09:37, 10 October 10
I transferred the 2nd to DSK:

[cpc=http://cpcwiki.eu/forum/index.php?action=dlattach;topic=1426.0;attach=976,forth,1]CPC6128[/cpc]

For this is also a PDF handbook:
http://www.cpc-power.com/images/notices/4339_1.pdf
Title: Re: forth for cpc6128
Post by: funkheld on 17:59, 10 October 10
Hallo, danke(thanks)... :) :) :)

Gruss
peter
Title: Re: forth for cpc6128
Post by: Gryzor on 07:53, 11 October 10
Ok, so a guy walks in, and not only do you give the answer but you do the conversion and offer an online version, too. What service! :D
Title: Re: forth for cpc6128
Post by: AMSDOS on 11:02, 11 October 10
Yes sorry, I tried to get my responce yesterday (my Internet is all loopy!  :( ) about the number of Forth programming languages which are available in CP/M.  You can find in here (http://www.cpm.z80.de/binary.html)

DXFORTH
FORTH80
Z80FORTH

The only trouble with these is they will need a bit of setting up to get them working on a CPC6128. So they probably need to go onto a Disk Image, and then setup so the Terminal Emulation will make the programs function properly on the CPC. I guess the only advantage they have is the standards they apply - Fig Forth 83 I think is one of the standardised Forths, they run under CP/M so are Disk Based Languages too and there doesn't seem to be much available specifically for the CPC.
Title: Re: forth for cpc6128
Post by: TFM on 22:02, 12 October 10
There was a specific Forth-83 release for the CPC in the Publuc Domain (Kotulla), was maybe around 30 DM or so. I don't have the dsk here, but will see it in some months again...
Title: Re: forth for cpc6128
Post by: funkheld on 22:24, 12 October 10
s it really would be great. :)
Title: Re: forth for cpc6128
Post by: Executioner on 03:36, 13 October 10
There's also a forth I wrote way back. The disc image and source code are available on the WinAPE site (http://www.winape.net) downloads section.
Title: Re: forth for cpc6128
Post by: funkheld on 10:51, 13 October 10
not loop with cpc6128. >:(

gruss
Title: Re: forth for cpc6128
Post by: Octoate on 11:40, 13 October 10
There is also a Forth version of VolksFORTH for CP/M. You can download it here: http://volksforth.sourceforge.net/ (http://volksforth.sourceforge.net/).
Title: Re: forth for cpc6128
Post by: funkheld on 15:40, 13 October 10
VolksFORTH for CP/M :
new cpm+disk with WINCPC  and then copyfile "volks4th.com"  in the new cpm+-disk ?

help me...?  >:(

gruss
Title: Re: forth for cpc6128
Post by: arnoldemu on 16:05, 13 October 10
Quote from: funkheld on 15:40, 13 October 10
VolksFORTH for CP/M : crash with cpm3 and cpc 2.2... on the WINCPC.

help me...?  >:(

gruss
This is what I did and it works for me.

Download cpcxfs and extract:
http://www.cpctech.org.uk/download.html

Double click cpcxfs:

cpcfs>

extract volksforth to c:\. I used 7-zip.

lcd c:\
lcd volksforth-cpm-380a
lcd 3.80a
new -s forth.dsk
mput *.com
close

new -s forth2.dsk
mput *.fb
close

Drag and drop cpm1.dsk to wincpc (download from nvg)
Select A

drag and drop forth.dsk to wincpc
select b

A> B:
A> volks4th

or
A> kernel

...


volksFORTH-83 rev. 3.80a
ok


Now I don't know forth, so I can't tell you anymore...

Title: Re: forth for cpc6128
Post by: funkheld on 17:03, 13 October 10
hello, thanks.
disk is present ok: forth.dsk and forth2.dsk

thanks, loop wonderful.


i'am with  "cpcfs" a system-dsk for cpm?

gruss
Title: Re: forth for cpc6128
Post by: arnoldemu on 17:31, 13 October 10
Quote from: funkheld on 17:03, 13 October 10
hello, thanks.
disk is present ok: forth.dsk and forth2.dsk

thanks, loop wonderful.


i'am with  "cpcfs" a system-dsk for cpm?

gruss
yes

format -s does not install cpm.

I will return with a solution to solve this for you.
Title: Re: forth for cpc6128
Post by: TFM on 19:31, 13 October 10
Quote from: Executioner on 03:36, 13 October 10
There's also a forth I wrote way back. The disc image and source code are available on the WinAPE site (http://www.winape.net/) downloads section.

Call me dumb, or lazy.... but... I've tried that version some time (years?) ago, and I didn't get it running. Is it updated? Does it work now?

Quote from: Octoate on 11:40, 13 October 10
There is also a Forth version of VolksFORTH for CP/M. You can download it here: http://volksforth.sourceforge.net/ (http://volksforth.sourceforge.net/).

That one looks interesting! It's still under further developpment, people seem to be active here.
Is there a link to a .DSK file "ready to go"?

Some time ago, I started thinking about a Forth implementation (patched version of some good compiler...) for FutureOS, but instead the FIOLIB was created, since there were more people interrested in C. However I like Forth. If there would be some interrest, I would consider a port.
Title: Re: forth for cpc6128
Post by: funkheld on 21:01, 13 October 10
....« Reply #13 on: Today at 17:05 »....

dsk create by the Volksforth.
Title: Re: forth for cpc6128
Post by: Executioner on 04:07, 14 October 10
Quote from: TFM/FS on 19:31, 13 October 10
Call me dumb, or lazy.... but... I've tried that version some time (years?) ago, and I didn't get it running. Is it updated? Does it work now?

Ah.. I never knew it didn't work. The reason is it's designed to be run from Drive B: The binary loader at #be80 sets the drive (#ac00 after ROM init) to 1. If you edit byte #8c of the program (don't know which sector but you'll find the header for FORTH.) to 00 instead of 01 it should run.
Title: Re: forth for cpc6128
Post by: TFM on 06:01, 14 October 10
Runs nicely from B :) B drive is ok, as long as you know that you have to use it  ;)
Title: Re: forth for cpc6128
Post by: AMSDOS on 10:40, 14 October 10
My thoughts in an recent thread have got me thinking that if this language is available as a compilable language, then it's worth looking into. I number of Forth compilers are built around a Kernal which is there to produce efficent programs. I'm unsure if this means that to make programs one has to have the language itself, or if there is some way of making the programs compilable as standard alone programs with the Kernal built-into that so people don't need to be loading Forth everytime you want to run some programs.

The other catch22 I guess is support. Forth isn't the best language to look at, and naturally there's pages and pages of Forth stuff out there, so finding new stuff based on the Forth83 model would be the best approach, tutorials, source code, anything which can be adapted to. Forth is an excellent Language for taking something and building it up progressively. Even the simplest examples can do some neat tricks.
Title: Re: forth for cpc6128
Post by: TFM on 17:48, 14 October 10
... one question remains... which is the most quick Forth for the CPC?

I did a simple speed test, using the following program:

: SQUARE CLS 250 150 ORIGIN
  100 0
  DO 100 0
     DO I J PLOT
     LOOP
  LOOP ;
Now use SQUARE and measure the time...

1. ams-Forth: - doesn't support commands!
2. Electro Forth: 11.3 seconds
3. FIG-Forth: 7.5 seconds
4. volksForth:

Can somebody do the test with volksForth (I don't have a .DSK)?

BTW: BASIC need 34.34 seconds!
Title: Re: forth for cpc6128
Post by: Executioner on 23:53, 14 October 10
Quote from: TFM/FS on 17:48, 14 October 10
I did a simple speed test, using the following program:

: SQUARE CLS 250 150 ORIGIN
  100 0
  DO 100 0
     DO I J PLOT
     LOOP
  LOOP ;
Now use SQUARE and measure the time...

I'd think the PLOT call accounts for about 90% of the overhead there. Does FIG forth have it's own PLOT routine rather than using firmware?

It may be worth trying this test just using a simple maths calculation rather than graphics.. eg. Simply DO I J * + and put a number on the stack to begin.
Title: Re: forth for cpc6128
Post by: AMSDOS on 00:28, 15 October 10
Personally I prefer graphics which rely on Mathematics as a excellent means to test. Unfortunately I don't know Forth well enough to do the classic circle routine, but if someone wants to Interpret this BASIC example into Forth then feel free!  ;D


10 CLS
20 DEG
30 FOR a=1 to 360
40 MOVE 320,200
50 DRAW 320+190*COS(a),200+190*SIN(a)
60 NEXT
Title: Re: forth for cpc6128
Post by: TFM on 02:44, 15 October 10
Quote from: Executioner on 23:53, 14 October 10
It may be worth trying this test just using a simple maths calculation rather than graphics.. eg. Simply DO I J * + and put a number on the stack to begin.

Good idea, it's your turn now  ;)
Title: Re: forth for cpc6128
Post by: AMSDOS on 07:14, 15 October 10
OK - I've downloaded Electro Forth, can somebody recommend some sort of Tutorial guide? Aany specific info I can about Electro Forth I will be interested in too.
Title: Re: forth for cpc6128
Post by: Octoate on 14:01, 15 October 10
If you want to do a benchmark, you shouldn't hardware dependent things like plotting to the screen. As already said, use a math problem. Then you can also compare benchmarks of one equally implemented algorithm in e.g. BASIC, Forth, C, etc.
What about calculating the first 100 prime numbers? Btw, if you guys are interested in a benchmark topic, we should start one and maybe use different ideas to compare speed and code size of the compilers. What do you think?
Title: Re: forth for cpc6128
Post by: TFM on 15:44, 15 October 10
Quote from: CP/M User on 07:14, 15 October 10
OK - I've downloaded Electro Forth, can somebody recommend some sort of Tutorial guide? Aany specific info I can about Electro Forth I will be interested in too.

You have to start the file "FORTH." from drive B, but you need a disc in A too (for file operations).

Take a look at the commands by typing VLIST (in upper cases).


Quote from: Octoate on 14:01, 15 October 10
If you want to do a benchmark, you shouldn't hardware dependent things like plotting to the screen. As already said, use a math problem. Then you can also compare benchmarks of one equally implemented algorithm in e.g. BASIC, Forth, C, etc.
What about calculating the first 100 prime numbers? Btw, if you guys are interested in a benchmark topic, we should start one and maybe use different ideas to compare speed and code size of the compilers. What do you think?

Calculating the first 100 prime numbers is .... depending on the single routine for calculating that numbers... so it's cpu and / or algorithm dependent.

As you said, different benchmarks would be fine to have - and to compare. Good idea.

The Executioneer also mentioned something about math benchmarks.

Ok, guys, you both are cordially invited to post benchmark code here :-)

Title: Re: forth for cpc6128
Post by: AMSDOS on 21:54, 15 October 10
I know nothing about benchmarks :(

Spoiler: ShowHide
 
Though have done some mathematical comparisions between Interpreted BASIC & Compilable Pascal which demonstrated how slow Compilable Pascal was. I just wanted to let you know that BASIC cheats in some instances by using Lookup tables!  >:(  So perhaps avoid using stuff like COS() SIN(), not sure how well it handles other maths.


I downloaded the FIG-FORTH manual, so if some of the rules/terms from that Manual are used in Electro FORTH, but I love the sound of that VLIST command!  ;D
Title: Re: forth for cpc6128
Post by: Executioner on 14:55, 17 October 10
I can't remember the exact version of Forth, but I think it was Forth-79 compatible. If you find a book on the Forth language it should be enough to get you going. There are also some CPC specific routines included (as mentioned, use VLIST).
Title: Re: forth for cpc6128
Post by: AMSDOS on 00:28, 18 October 10
I forgot I actually had a book on Forth, unfortunately it appears to be for MMSFORTH for the TRS-80 computers and the syntax in that differs from Electro Forth! :(

So something like this doesn't work  :(


:AGAIN CR " TRY AGAIN" Y/N DUP DUP ;


I changed it to

:AGAIN CR ." TRY AGAIN" Y/N DUP DUP ;

but then it didn't understand Y/N  ???

Here's the rest of the program though, I have a feeling though this is Forth programming prior to the FORTH-79 standard, there's a page about this at the back of the book, so it may seem that a lot of this code maybe MMSForth Based. Very misleading given the book is called "Introduction to Forth"


: TASK ; 1 VARIABLE GUESS
0 VARIABLE LOW 101 VARIABLE HIGH
: AGAIN   CR " TRY AGAIN" Y/N DUP DUP ;
: LOWER   DUP HIGH ! LOW @ DUP ROT SWAP - 2 / +
          SWAP DROP DUP . 1 GUESS +! ;
: HIGHER  DUP LOW ! HIGH @ DUP ROT - 2 / -
          SWAP DROP DUP . 1 GUESS +! ;
: GET    CR " HOW'D I DO" #IN CR ;
: TELL   GET DUP IF 1 - IF CR " ! GUESSED IT IN "
         GUESS ? " TRIES" 1 ELSE LOWER 0 THEN
         ELSE DROP HIGHER 0 THEN ;
: TRY-AGAIN  BEGIN TELL END AGAIN
             0= IF 101 HIGH ! 0 LOW ! 1 GUESS !
             ELSE 1 THEN ;
: COMPGUESS  BEGIN CR 50 DUP . TRY-AGAIN END DROP ;
COMPGUESS  FORGET TASK
Title: Re: forth for cpc6128
Post by: Executioner on 05:12, 18 October 10
It's been a long time since I wrote it or used it. It's not a bad language if you don't mind everything being backwards because it's stack based  :-\
Title: Re: forth for cpc6128
Post by: AMSDOS on 05:59, 18 October 10
Understand your predicament, I'm still trying to come to grips with how I wrote some of my assembly routines.

Unfortunately while Forth looks like a decent language, it's the layout which is troubling me. Probably because it's a language which needs constant use to really get a handle of it. Don't really expect the Forth example I posted earlier to be translated unless on the off chance one of the Forth programs on the Amstrad knows that Dialect. Always tricky to tell.
Title: Re: forth for cpc6128
Post by: Executioner on 00:20, 19 October 10
Part of the beauty of Forth though is that if a command doesn't exist, you can create it. It may well be possible to create a Y/N command that does something like:

:Y/N INPUT "Y" = ;
Title: Re: forth for cpc6128
Post by: AMSDOS on 01:00, 19 October 10
Ah yes, how could I forget that!  :)
Title: Re: forth for cpc6128
Post by: TFM on 03:58, 19 October 10
Quote from: TFM/FS on 17:48, 14 October 10
... one question remains... which is the most quick Forth for the CPC?

I did a simple speed test, using the following program:

: SQUARE CLS 250 150 ORIGIN
  100 0
  DO 100 0
     DO I J PLOT
     LOOP
  LOOP ;
Now use SQUARE and measure the time...

1. ams-Forth: - doesn't support commands!
2. Electro Forth: 11.3 seconds
3. FIG-Forth: 7.5 seconds
4. volksForth: ? n.d.
5. BASIC need 34.34 seconds!

Tried it just for fun with my plot routine from the FIOLIB, there it's only <0.4 seconds ;-)
Title: Re: forth for cpc6128
Post by: AMSDOS on 11:06, 08 April 13
Quote from: TFM/FS on 17:48, 14 October 10
... one question remains... which is the most quick Forth for the CPC?

I did a simple speed test, using the following program:

: SQUARE CLS 250 150 ORIGIN
  100 0
  DO 100 0
     DO I J PLOT
     LOOP
  LOOP ;
Now use SQUARE and measure the time...

1. ams-Forth: - doesn't support commands!
2. Electro Forth: 11.3 seconds
3. FIG-Forth: 7.5 seconds
4. volksForth:


Just wondered which FIG-Forth that was? There seems to be two the later being Interceptor Software in 1985 & the earlier AMSOFT/Abersoft one or do they share that 7.5 Second Result?  ???
Title: Re: forth for cpc6128
Post by: AMSDOS on 10:47, 01 February 17
Can't believe it's been a few years since I've gone back to Forth.


I went back to an early programming series on Forth ACU had when it went from the transition from Amstrad CPC464 User to ACU. I wasn't entirely clear which Forth Language they might have been referring to and just looking at their opening series, it appears they have some flaws in it, if they were based on the AMSOFT/Abersoft FIG-FORTH. I downloaded the Inceptor Software FIG-FORTH, though also had problems. So I went back to the AMSOFT/Abersoft one, incidentally I downloaded the CDT FORTH from AMSOFT/Indescomp category and discovered it was the AMSOFT/Abersoft version on Tape (obviously repackaged for Spainish users), after looking through the English manual, I don't know if the article (I was just looking at their 1st part from March 1985) has made any errors in their coding. Their 1st example for example takes this BASIC program:



10 LET x = 7
20 PRINT x
30 PRINT CHR$(x)



they write it like this in Forth:



VARIABLE BEEP
7 BEEP !
BEEP @.
BEEP @EMIT



their second line 7 BEEP ! is the same as LET x=7 in BASIC, but I found this is valid in Forth:



7 VARIABLE BEEP
BEEP @ .
BEEP @ EMIT



Which works in AMSOFTs Fig-Forth. Take note Fig-Forth makes a big deal about Spaces, the 1st Forth Example I typed in is how it was written in the ACU article, which does not seperate the "at" symbol from the "full-stop". My 1st line "7 VARIABLE BEEP" simply declares a variable BEEP and assigns 7 to it, which was what I learned from their manual.


Further into the 1st Article ACU have, they posted another Test example that you can try once you've loaded your Forth from Tape, which that too has Spacing issues which Fig-Forth doesn't like, this is what they had:


:TEST100 0 DO ."HELLO" LOOP;


when I typed that in it did not give me "ok", so again look at the Manual and sure enough revealed some vital spaces were missing, I also had to insert spaces in the inverted commas or there would be trouble, eventually I ended up with this that works:



: TEST 100 0 DO ." HELLO " LOOP ;



IT WORKS, yay!!  :D
Powered by SMFPacks Menu Editor Mod