ENTERPRISE KLUB
2021. október 2., 1055 Budapest, Nyugati tér 9. 14-19 óráig
Belépés kizárólag klubtagok részére! (Klubkártyával vagy előfizetéssel!)
Welcome, Guest. Please login or register.


Author Topic: FORTH (Read 18048 times)

Offline Zozosoft

  • EP addict
  • *
  • Posts: 14023
  • Country: hu
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 19.0 Firefox 19.0
    • View Profile
    • http://enterprise.iko.hu/
Re: FORTH
« Reply #45 on: 2013.March.09. 00:22:53 »
Quote from: BruceTanner

One point I have just noticed is that trailing spaces are not removed; thus even the smallest program takes up 1k :oops: and if you have 16 small program fragments each in their own block it will take up 16k :oops::oops::oops::oops::oops::oops::oops::oops::oops::oops::oops::oops::oops::oops::oops::oops: which is not good on tape systems that this is aimed at!
There is a Turbo Pack Tape extension which compresses the saved bytes on the fly  :-) (and higher baud rate also can be used)
« Last Edit: 2013.March.10. 11:25:09 by szipucsu »

Offline lgb

  • EP addict
  • *
  • Posts: 3555
  • Country: hu
  • æðsta yfirmaður
  • OS:
  • Linux Linux
  • Browser:
  • Chrome 26.0.1410.28 Chrome 26.0.1410.28
    • View Profile
    • http://lgb.hu/
Re: FORTH
« Reply #46 on: 2013.March.10. 11:12:46 »
Quote from: BruceTanner
Yes, spot on - you have discovered a little secret! (Actually, not so secret - they are in the manual). Not a major performance increase but slightly quicker nonetheless. I think it's worth it for 0 and 1 which occur in programs very commonly; I'm not so convinced by 2 and 3!
I've just checked the output of vlist out again. It seems there are four words defined whose names are consist of only numbers: 0, 1, 2 and 3. Interesting to have defined words for 2 and 3 too, if it's not worth as much as for 0, 1 because then some may think that eg 4 and 5 should be handled this way as well :)

Offline BruceTanner

  • EP lover
  • *
  • Posts: 565
  • Country: gb
  • OS:
  • Linux Linux
  • Browser:
  • Safari 4.0 Safari 4.0
    • View Profile
Re: FORTH
« Reply #47 on: 2013.March.10. 11:28:57 »
Quote from: lgb
...some may think that eg 4 and 5 should be handled this way as well :)
It's FORTH so they can if they want to :smt003 (will require use of assembler if it is to be exactly the same)

Offline BruceTanner

  • EP lover
  • *
  • Posts: 565
  • Country: gb
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 25.0.1364.152 Chrome 25.0.1364.152
    • View Profile
Re: FORTH
« Reply #48 on: 2013.March.10. 11:54:16 »
Quote from: BruceTanner
It's FORTH so they can if they want to :smt003 (will require use of assembler if it is to be exactly the same)
So before someone asks:

CODE 4   DE PUSH,  HL DE EX,  4 HL LD,  IX JP(),  END-CODE
CODE 5   DE PUSH,  HL DE EX,  5 HL LD,  IX JP(),  END-CODE

The top two items on the stack are held in registers DE and HL. So PUSH DE puts the current second item on the actual stack to make it the third, EX DE,HL puts the current top of stack in HL into DE to make it the second on the stack, and LD HL,4 makes 4 the new top item on the stack. JP (IX) is how all IS-FORTH machine code words end.

Offline Zozosoft

  • EP addict
  • *
  • Posts: 14023
  • Country: hu
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 19.0 Firefox 19.0
    • View Profile
    • http://enterprise.iko.hu/
Re: FORTH
« Reply #49 on: 2013.March.12. 21:20:40 »
Lacika wrote prime search program for comparing BASIC and FORTH speed.

Offline Zozosoft

  • EP addict
  • *
  • Posts: 14023
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 69.0 Firefox 69.0
    • View Profile
    • http://enterprise.iko.hu/
Re: FORTH
« Reply #50 on: 2019.September.24. 12:10:13 »
ExcaliburGER's machine at the Classic Computing exhibition :-)
23987-0

Offline ExcaliburGER

  • Newbie
  • Posts: 11
  • Country: de
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 70.0 Firefox 70.0
    • View Profile
Re: FORTH
« Reply #51 on: 2019.November.25. 17:19:08 »
Hi together,

I like Forth for a long time ago now, not so experienced but try my very best. This year I met a guy from the VCFe at HNF in Paderborn and we started three benchmarks on my old Sinclair QL at the very beginning of the site below. So yesterday it was time to reprogram the tests in IS-Forth and send him the results.

Enterprise 128 - Ultimate Forth Benchmark (must rolled down a bit)

Don't take a look at the results over the Ent ;) Thanks to Zozo about his examination to work with "BUFFERS ON " File.4TH" NAME. It's much more easier than working with the 1k-Blocks!

Greetings, Carsten
Today are the good old days that we will long for in 10 years

Offline Zozosoft

  • EP addict
  • *
  • Posts: 14023
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 70.0 Firefox 70.0
    • View Profile
    • http://enterprise.iko.hu/
Re: FORTH
« Reply #52 on: 2019.November.26. 10:20:18 »
Can you upload the Enterprise program files?

Offline Ep128

  • EP addict
  • *
  • Posts: 1750
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 70.0 Firefox 70.0
    • View Profile
    • Honlapom
Re: FORTH
« Reply #53 on: 2019.November.26. 23:47:12 »
ExcaliburGER's machine at the Classic Computing exhibition :-)
(Attachment Link)

Enterprise monitor, Enterprise printer... Hmmmmm... :-)

Offline ExcaliburGER

  • Newbie
  • Posts: 11
  • Country: de
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 70.0 Firefox 70.0
    • View Profile
Re: FORTH
« Reply #54 on: 2019.November.27. 17:56:14 »
So attached is the file, which is produced by the following steps

Change Drive and Directory in EXDOS
Afterwards start Forth

Code: [Select]
BUFFERS ON " DORECO.4TH" NAME
LOAD-BUFFERS
1 LOAD 2 LOAD 3 LOAD
DOINT
FIB2-BENCH
GCD1-BENCH

After LOAD-BUFFERS you can take a look into the pages of the file via 1 EDIT..3 EDIT.
To compile 1 LOAD..3 LOAD. After that DOINT, FIB2-BENCH, GCD1-BENCH are available to run. These tests are not exactly the same as on the benchmark site. NIP is replaced by SWAP DROP and U> by simple >.

If you modify the different pages LOAD them again.... AND don't forget the SAVE-BUFFERS at the end of the session :)
Today are the good old days that we will long for in 10 years

Offline ExcaliburGER

  • Newbie
  • Posts: 11
  • Country: de
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 87.0 Firefox 87.0
    • View Profile
Re: FORTH
« Reply #55 on: 2021.April.04. 08:53:43 »
Time to get this thread back to the active ones :) I've tried myself in finding an algorythm to draw the Sierpinski triangle. In a modern BASIC it's not really a problem, because the parameter variables are stored automatically and restored at procedures/functions end. Because it was a nice skill exercise, I ported it to IS-FORTH. Takes me hours of lifetime :ds_icon_cheesygrin:

But to the history, found this original tweet at Twitter on an ORIC. So, let the work begin. And here is my IS-Forth result - first time I ever used the word RECURSE. And to see how fast the ARM processor is... on an Acorn 3020.

Maybe the program can be more compact, my FORTH skills are really at beginners level. And it wasn't so easy for me to deal with four stack values at the same time. But I want to avoid variables, there is no "stackable" variant of them ;-)
I want to share it with you, so here is the listing for a first view:
Code: [Select]
( Drawing Sierpinsky triangle )

: TRIANGLE ( X Y L S -- )
  2SWAP 2DUP MOVE ( STARTPOINT )
  2SWAP SWAP DUP
  0 > IF
    SWAP 2SWAP 2DUP
    4 PICK + DRAW
    2DUP SWAP 4 PICK + SWAP DRAW
    2DUP DRAW 2SWAP
    2 / SWAP 1 - SWAP
    ( SHOULD BE X Y L-1 S/2 )
    3 PICK 3 PICK 3 PICK 3 PICK
    RECURSE
    3 PICK 1 PICK + 3 PICK 3 PICK 3 PICK
    RECURSE
    3 PICK 3 PICK 2 PICK + 3 PICK 3 PICK
    RECURSE
    2SWAP SWAP
  THEN
  2DROP 2DROP ;

As attachment it is added as a FORTH editor file, which you can put into file system in EP128emu (Set working directory). And then use
Code: [Select]
BUFFERS ON " triangle.4th" NAME
LOAD-BUFFERS 1 LOAD
-- Switch to HIRES graphic mode
4 HIRES
-- to run it after loading
0 0 6 700 TRIANGLE
« Last Edit: 2021.April.04. 12:28:56 by ExcaliburGER »
Today are the good old days that we will long for in 10 years

Offline Lacika

  • EP addict
  • *
  • Posts: 3049
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 87.0 Firefox 87.0
    • View Profile
    • http://www.ep128.hu
Re: FORTH
« Reply #56 on: 2021.April.04. 09:35:04 »
What am I doing wrong?
*** Channel does not exist.

Offline ExcaliburGER

  • Newbie
  • Posts: 11
  • Country: de
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 87.0 Firefox 87.0
    • View Profile
Re: FORTH
« Reply #57 on: 2021.April.04. 09:50:59 »
Before you start it, you have to switch the graphics mode. I have corrected that 2 minutes later in the post and did not thought, that someone is such incredible fast :)
Code: [Select]
4 HIRES
-- after that - only 4 lines at the bottom for input
0 0 6 700 TRIANGLE
Hope it helps
« Last Edit: 2021.April.04. 10:14:35 by ExcaliburGER »
Today are the good old days that we will long for in 10 years

Offline Tutus

  • EP lover
  • *
  • Posts: 593
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 89.0 Firefox 89.0
    • View Profile
    • Enterpress News
Re: FORTH
« Reply #58 on: 2021.July.07. 14:46:52 »
I interpret the question of our club member Zoltán Horváth.
How to compile FORTH program? So make it executable?

Offline ExcaliburGER

  • Newbie
  • Posts: 11
  • Country: de
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 89.0 Firefox 89.0
    • View Profile
Re: FORTH
« Reply #59 on: 2021.July.15. 20:55:33 »
How to compile FORTH program? So make it executable?
Hi, I try to answer your question from my basic FORTH understanding at all. Most of the FORTH systems can't make an executable out of a given source code, because they need their inner core. Maybe there is a way to do this in IS-FORTH, but I haven't found anything about it in the manual yet.

That's because of how the kernel works. FORTH is an interpreter when you type in space separated words or numbers. They are looked up inside a dictionary with their name resulting in an address for executing this single word or a number is stacked. When you type in a declaration (starting with : ) - defining a new word - the system looks up all the addresses inside the new declaration and compiles them (the bunch of sub word addresses) to a new executable block and adds a dictionary entry with the start address.

I know, that's a very simplified view and description. For a deeper understanding of the language the FORTH-bible "Starting FORTH" by Leo Brodie explains it much better than I can. The book gives a good background from start to deeper knowledge. It is nowadays freely available, take a look here. IS-FORTH implements a huge kind of words of the inner core, so it's a good starting point. Some specialities about graphics you have to lookup in it's documentation.
« Last Edit: 2021.July.15. 20:58:38 by ExcaliburGER »
Today are the good old days that we will long for in 10 years