Author Topic: forth for cpc6128  (Read 7800 times)

0 Members and 1 Guest are viewing this topic.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Re: forth for cpc6128
« Reply #25 on: 09: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.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline Octoate

  • CPC6128
  • ****
  • Posts: 290
  • Country: de
    • Octoate.de
  • Liked: 62
  • Likes Given: 326
Re: forth for cpc6128
« Reply #26 on: 16: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?
« Last Edit: 16:03, 15 October 10 by Octoate »
--

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1983
  • Likes Given: 4650
Re: forth for cpc6128
« Reply #27 on: 17:44, 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).
 
 
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 :-)
 
 
« Last Edit: 17:50, 15 October 10 by TFM/FS »
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Re: forth for cpc6128
« Reply #28 on: 23: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
« Last Edit: 23:58, 15 October 10 by CP/M User »
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
Re: forth for cpc6128
« Reply #29 on: 16: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).

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Re: forth for cpc6128
« Reply #30 on: 02: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  :(
 
Code: [Select]

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

I changed it to
 
Code: [Select]
: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"
 
Code: [Select]

: 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
« Last Edit: 02:31, 18 October 10 by CP/M User »
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
Re: forth for cpc6128
« Reply #31 on: 07: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  :-\

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Re: forth for cpc6128
« Reply #32 on: 07: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.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
Re: forth for cpc6128
« Reply #33 on: 02: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" = ;

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Re: forth for cpc6128
« Reply #34 on: 03:00, 19 October 10 »
Ah yes, how could I forget that!  :)
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1983
  • Likes Given: 4650
Re: forth for cpc6128
« Reply #35 on: 05:58, 19 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 ;-)
 
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Re: forth for cpc6128
« Reply #36 on: 13:06, 08 April 13 »
... 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?  ???
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1157
  • Likes Given: 1924
Re: forth for cpc6128
« Reply #37 on: 11: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:


Code: [Select]
10 LET x = 7
20 PRINT x
30 PRINT CHR$(x)


they write it like this in Forth:


Code: [Select]
VARIABLE BEEP
7 BEEP !
BEEP @.
BEEP @EMIT


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


Code: [Select]
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:


Code: [Select]
: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:


Code: [Select]
: TEST 100 0 DO ." HELLO " LOOP ;


IT WORKS, yay!!  :D
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3