6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Mar 29, 2024 11:15 am

All times are UTC




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: So, Forth
PostPosted: Thu Mar 16, 2017 7:30 pm 
Offline

Joined: Mon Mar 25, 2013 4:43 pm
Posts: 15
Location: Arizona
I had a HES Forth cartridge for my C64. I played around with it but really didn't see the point, and oh my was that syntax confusing. I really didn't understand Forth.

Fast forward to the past year (30+ years) and I have been playing a lot with a Parallax Propeller and a 6502. I really like the Prop, it's a wonderful chip and amazing how easy to program in it's native Spin. I had written some code to talk to the 6502 and even a little monitor in Spin to watch the common SRAM between them. Works great, if not so fast.

Then I started noticing that a fellow named Peter Jackaki over on the Prop forum had written a Forth for the Prop called Tachyon Forth. Though I remembered how confusing Forth was, I decided to load his system up on a Prop demo board and try it, while squinting at his documentation pages.

I accomplished everything I had done in Spin over several weeks in about 15 minutes in Tachyon, and it's very much faster as well. And, I love Spin, and think it's very easy to use.

Sold.

I get Forth now. At the moment I'm a little bit obsessed with it, what with studying the design of things I never heard of a few months ago, like inner and outer interpreters and the various methods of implementing Forth.

So... as my 65816/Prop hybrid project crawls along at a glacial pace, it seems to me to be logical to implement the mini operating system for the 816 in, lets say, a TIL, and run Tachyon on the Prop. I never intended that, but the more I read in these pages and the other information out there, it just seems to be more logical to do that. And is it me, or does Forth seem to be making a comeback? I see it in a lot of places around the nets now. Or maybe I'm just paying attention now.

I'm glad this 6502 Forth interest is so strong. It's just what I need.

- George


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Fri Mar 17, 2017 9:25 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10760
Location: England
Great success story!


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Fri Mar 17, 2017 2:01 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3328
Location: Ontario, Canada
I'm curious to hear more about your 65816/Prop project, George. And, as you've noticed, this forum is a good place to discuss Forth (as well as anything 65xx-related, of course).

GunPilot wrote:
I get Forth now. At the moment I'm a little bit obsessed with it
Cool! You've reminded me of my own early experiences with Forth.

A lot has been written about Forth, and I am reminded of the allegory of the blind men trying to imagine the elephant -- when each of them is grasping a different part of the animal!

It's possible to describe Forth in fairly objective, matter-of-fact terms, but instead quite a lot of the written commentary involves extreme zeal and use of imagery and superlatives. The latter presentation has potential to be off-putting, I'd say. :( I don't disagree with the high fallutin' claims, but IMO the first point to establish about Forth is that it's a systematic way of stringing together what are basically subroutines. And parameter passing is via a stack. The elephant truly is a wondrous creature, and a challenge to describe in its entirety. But the description should start with the down-to-earth view -- of the elephant's feet, so to speak! :P

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Fri Mar 17, 2017 11:33 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
GunPilot wrote:
Sold.

I get Forth now.

If I may ask, what part did you "get". What are you doing that sold it for you?

Quote:
I accomplished everything I had done in Spin over several weeks in about 15 minutes in Tachyon

Was this simply from having a very fast iteration cycle, i.e. having interactive access to the chip, making it dance by simply typing commands in, perhaps doing some simple loops vs iterating through edit/compile/download/restart cycle? Or was it fast since now you know much more about the Prop than you did before?

We talk a lot about implementations, and CPU cycle golf, but it's not clear, outside of implementing it, the many are actually doing anything with the implementation, perhaps outside of using it as a shell to poke around hardware.


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Mar 28, 2017 6:14 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
Byte magazine Forth issue, V5N8, Aug 1980, over 100 pages on Forth:
https://archive.org/details/byte-magazine-1980-08
Caveat: I have not read it myself. Since the .pdf download is over 200MB, I might hold out for the day I can find the paper magazine in a used book store! :mrgreen:

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Mar 28, 2017 6:24 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1918
Location: Sacramento, CA, USA
GARTHWILSON wrote:
Byte magazine Forth issue, V5N8, Aug 1980, over 100 pages on Forth:
https://archive.org/details/byte-magazine-1980-08
Caveat: I have not read it myself. Since the .pdf download is over 200MB, I might hold out for the day I can find the paper magazine in a used book store! :mrgreen:

I have the actual paper and ink issue in my attic, Garth. Say the word, and it's yours, free of charge ... I feel like it has been waiting for someone just like you!

Mike B.


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Mar 28, 2017 6:40 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8412
Location: Southern California
Wow, thanks! You have my address.

I now realize that I posted in a different topic than I had in mind though. I'll re-post in the "What is Forth?" topic.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Mar 28, 2017 7:52 am 
Offline

Joined: Mon Jan 07, 2013 2:42 pm
Posts: 576
Location: Just outside Berlin, Germany
GARTHWILSON wrote:
Since the .pdf download is over 200MB, I might hold out for the day I can find the paper magazine in a used book store!
Having recently downloaded about 45 GB for Mass Effect Andromeda, 200 MB sounds like a rounding error :D . Thanks, I'll take a look - I just love the ads in these old magazines ...


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Mar 28, 2017 8:11 am 
Offline

Joined: Sun Apr 10, 2011 8:29 am
Posts: 597
Location: Norway/Japan
I remember reading that physical paper issue back when it arrived in the mail. I don't think I have it anymore, but I downloaded the scan a couple of years back.
As with so much else, nearly all of my paper copies of magazines were dumped back in the day. Something I regret, but I really didn't have the space then. American magazines have for the most part been scanned, but UK mags like Personal Computer World aren't available anywhere.


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Mar 28, 2017 8:33 am 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
I have a physical copy of that edition. It's to only edition of byte I kept.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Mar 28, 2017 8:43 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
BitWise wrote:
I have a physical copy of that edition. It's to only edition of byte I kept.


Funny. I have the Smalltalk-80 edition :)


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Apr 04, 2017 2:10 am 
Offline

Joined: Mon Mar 25, 2013 4:43 pm
Posts: 15
Location: Arizona
Well I guess how I "get" Forth is just a better understanding of what level the language sits at, and how it works. I read a little bit about threaded interpretive languages and that helped me see how Forth kind of has one foot in the hardware and one foot in a higher level language. I marvel though, at how it was conceived as a way to simplify the complexity of programming. Sort of like simplifying the complexity of a bicycle by inventing a unicycle. It will get you there just the same, but it's a different learning curve for sure. I can see that it rewards experience very strongly.

Jeff, my little project was conceived at first as a fairly typical application of a Propeller: serving I/O for something else. I built several of the defunct N8VEM CP/M based projects, and some of them used the Prop for serial, parallel and video. So I'm familiar with that application.

What really got me interested was the fact that a SID emulator in a single cog was written. So, suddenly, your project has SID capability through software. Why not dual SID, then, if an extra cog is free. There are already 6502/Prop hybrids out there - but they all share something in common as far as I know - they all control the 6502 with the Prop, usually by clocking it but some with more elaborate methods.

Where mine tries to be different is, it won't control the CPU with the Prop, except to interrupt it to write to SRAM. Here's my big idea: since the 65xxx sees I/O as memory, then why not just have the interface between the two chips be the SRAM? The processor will read/write to whatever location is decided is the I/O port, and the Prop will read/write that location as appropriate to support the I/O. So the CPU can free run, more or less, with its own clock. Most of the hybrids are limited to around 1 Mhz because that about all the Prop can do and still carry out its other tasks. I'd like to see mine run around 10 Mhz.

The startup sequence would have the Prop load RAM from an SD card, or EEPROM while holding the CPU in reset. Then the Prop would get off the bus and let the CPU start. It would proceed as though it were reading ROM and begin running its bios. The bios would be written as the programmer sees fit to place the I/O and video; there are no physical ports. It's all RAM. The Prop would interrupt the CPU and read or write the I/O locations as needed. Of course the program on the Prop and the bios run by the CPU would have to agree on the I/O locations in memory.

Getting long winded. Continued next post.


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Apr 04, 2017 2:28 am 
Offline

Joined: Mon Mar 25, 2013 4:43 pm
Posts: 15
Location: Arizona
Chips can be emulated by the Prop as Jac Goudsmit did with the L-Star (which I have BTW) and as demonstrated by the SIDCOG object. So a lot of things could be built in software without requiring physical hardware changes.

I/O could be moved at will. ROMS could be swapped in seconds or less. The Prop could (does) provide a back end console that allows monitoring the system independent of the CPU.

The I2C bus would allow expansion of numerous hardware ICs like real time clocks, serial I/O, parallel, and lots of neat stuff like wireless and so forth ( :) ) without having to add more lines to the Prop or the CPU. The fantasy goes on in my mind but that's the basics.

I have successfully interfaced the Prop, SRAM, and a 65816 using only the first 64k, and had the two reading and writing the SRAM, but with errors. After I pulled the breadboard apart intending to redo everything, I found the wiring error staring me in the face, of course. Even though I had looked at it a hundred times. At the moment I am restarting everything and am going to clean the wiring up, finish a schematic to show you guys, and start over.

So in the meantime Forth has appeared as a really good way to run things on the Prop side and maybe even the CPU side. Heck, maybe the Prop could inject Forth words (tokens?) in RAM for the CPU... or vice versa.

I'd greatly appreciate comments on this project. I'm all self-taught on the hardware side and things take a while to sink in these days. It's fun though and I'm not afraid to try things. My assembly skills and soldering is decent having built numerous projects. This is my first design though. I'm calling it the Miniac after a computer in an old children's adventure book series I read when I was a kid.

Thanks,

George


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Apr 04, 2017 5:33 am 
Offline

Joined: Thu Jan 21, 2016 7:33 pm
Posts: 269
Location: Placerville, CA
I'm kinda curious about Forth on the Propeller - does most of the interpreter run in the cog, or does it have to dip into main memory a lot?

(And heh, I had a chuckle at your reference to an old series of children's books - did a little Googling. Never read that particular story, but I quite liked one of the other Danny Dunn books as a kid!)


Top
 Profile  
Reply with quote  
 Post subject: Re: So, Forth
PostPosted: Tue Apr 04, 2017 6:45 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10760
Location: England
Forth as the unicycle of programming languages - excellent!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: