6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Nov 12, 2024 9:10 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri May 12, 2006 5:11 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Excellent news!

The 6502 STC Forth that I'm working on now runs, albeit very incomplete, under the Commodore 64 emulator.

A number of basic primitives exist -- I implement primitives only as I need them to write the rest of the Forth environment, so as to minimize the need for debugging while maximizing progress. I even wrote my own version of * which does a 16x16=16 multiplication. Amazingly, it worked the first time. :)

The Forth 'outer interpreter' now works great. I rely on Commodore's kernel for the screen editing capabilities, which makes my text input code utterly trivial. But it's factored enough to let me rewrite the text input code if required. The interpreter itself, however, works like a dream, although it took me a number of days to fix a bug where it would never detect a missing word.

The things that it lacks now include:

* Colon-compiler -- this is the biggest omission. However, implementing this ought not be too terribly difficult now that most of the words it depends on have been written.

* Word names are still not precisely correct -- because I'm using a cross-compiling environment to develop the software, words are written using commas after their names to distinguish host from target compiled words. This system works *great*, doesn't require the use of a Forth with vocabularies. However, inside the target image, those commas all exist inside the word names, so you still have to use commas there too. For example, to exit the Forth environment, you need to type GO64, instead of GO64. :-)

* Because I used commas to distinguish target and host words, there is a conflict between the assembler's AND, instruction and the host Forth word AND,. Therefore, I need to change from the use of commas to the use of ticks (e.g., instead of AND,, I would use AND'). As a temporary work-around, I'm currently using &, to stand for AND,.

* Because of how PETSCII works, I need to capitalize all words in my sources.

* I need to implement loading from blocks, which means I'll also need to implement the generic block I/O words too.

One thing is for sure though -- I should have been writing this with literate programming, as with my Colonel project, so that it could be precisely documented. I think I will spend a few weeks to do that, because once this is finished, I'd like to be able to publish the entire design and its rationales on the web.

The statistics from the latest compilation run is as follows:

Code:
bash-2.05b$ gforth forth.fs
**** Kestrel Forth 1
Cross Compiler Release 1r1

Copyright (c) 2006 Samuel A. Falvo II
All Rights Reserved.

================================================================
Bytes Assembled: 2936
 Data Stack Low: $87A
Data Stack High: $8FA
    Entry Point: $1373
================================================================


Not too shabby, weighing in at only 3KB, and that's without tail-call optimization, and with inlining of certain primitives (averaging 12 bytes a pop)! My guess, based on these numbers, is that a Forth environment without blocks but with the colon compiler will fall in at just under 5K, and with block I/O support, will probably consume closer to 6K. If I were to include the assembler in the static image, it looks to be about 9K all-together. I can probably shrink it down somewhat by using pure STC instead of inlining certain primitives like pushing constants onto the stack. But I'll see about that only after it becomes a problem for me.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 04, 2006 9:54 pm 
Offline

Joined: Wed May 21, 2003 1:08 pm
Posts: 27
Location: Germany
Hi kc5tja,

I'm working in the GForth Team to document the GForth EC (Embedded Cross-Compiler). Bernd Paysan has recently added the R8C Target, and I try to get the 6502 and 8086 targets running again.

Did you use the GForth EC Cross-Compiler or your own Cross-Compiler?

If you used the GForth EC, will you publish your sources?

Carsten


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 04, 2006 11:37 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
cas wrote:
Hi kc5tja,

I'm working in the GForth Team to document the GForth EC (Embedded Cross-Compiler). Bernd Paysan has recently added the R8C Target, and I try to get the 6502 and 8086 targets running again.

Did you use the GForth EC Cross-Compiler or your own Cross-Compiler?

If you used the GForth EC, will you publish your sources?

Carsten


I wrote my own target compiler in Linux GForth. I do not have any intention of porting GForth to the 65xx architecture -- it's too heavyweight and absolutely won't fit in 8K of ROM space. It also depends on a C compiler, which I don't have any intention of porting either.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jun 05, 2006 8:46 am 
Offline

Joined: Wed May 21, 2003 1:08 pm
Posts: 27
Location: Germany
kc5tja wrote:
cas wrote:
Hi kc5tja,

I'm working in the GForth Team to document the GForth EC (Embedded Cross-Compiler). Bernd Paysan has recently added the R8C Target, and I try to get the 6502 and 8086 targets running again.

Did you use the GForth EC Cross-Compiler or your own Cross-Compiler?

If you used the GForth EC, will you publish your sources?

Carsten


I wrote my own target compiler in Linux GForth. I do not have any intention of porting GForth to the 65xx architecture -- it's too heavyweight and absolutely won't fit in 8K of ROM space. It also depends on a C compiler, which I don't have any intention of porting either.


There are two flavors of GForth, the full GFOrth (C-Based) and GForth EC for embedded systems. GForth EC is crosscompiled using the full GForth (for ecample on Linux).

There is already a 6502 GForth EC target in the GForth distribution, but it is broken (since GForth 0.5.x). So I wasn't sure if you use the GForth EC sources for your Forth (the compiling messages look very similar to GForth EC).

Best regards

Carsten


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jun 05, 2006 5:35 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Can the GForth EC kernel compile itself once it's on the new architecture? If so, I will be more interested in it as a disk-loaded Forth environment.

Thanks.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 06, 2006 8:08 am 
Offline

Joined: Wed May 21, 2003 1:08 pm
Posts: 27
Location: Germany
kc5tja wrote:
Can the GForth EC kernel compile itself once it's on the new architecture? If so, I will be more interested in it as a disk-loaded Forth environment.

Thanks.


This should be possibe, I never tried it. The GForth Cross-Compiler is a direct descendant of the VolksForth Cross-Compiler (-> volksforth.sf.net ), and VolksForth can CrossCompile itself on a C=64.

Another project on my desk is to try to cross-compile VolksForth using the GForth Cross Compiler. VolksForth is a more lean than GForth EC.

Best regards

Carsten Strotmann


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 04, 2009 11:44 am 
Offline

Joined: Wed Nov 04, 2009 11:37 am
Posts: 1
Hi guys
I need help,I am working on building my own home-brew computer, and I want to base it on the MOS 6510. I noticed on the 6510 data sheet that it is possible to run this chip at 3 MHz, though I've never seen it done at more than 1MHz. Has anyone tried to run it at 3 MHz?

_________________
r4


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 04, 2009 6:29 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8539
Location: Southern California
johnnyblame, are you the same person as ccureau? This exact post and the discussion that followed are at viewtopic.php?t=73 in the Hardware forum. (Edit: Wow, I just realized most of your answers came six years after you posted!! After all that time you probably forgot you posted, or couldn't find it!) This here is the Forth forum though. Forth is a programming language and environment.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

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: