6502 Forth kernel assembler source size (moved)

Topics relating to various Forth models on the 6502, 65816, and related microprocessors and microcontrollers.
Post Reply
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

6502 Forth kernel assembler source size (moved)

Post by GARTHWILSON »

moved here from viewtopic.php?p=16279#16279 to avoid highjacking the "6551 vs 6850 vs 8250 vs ?" topic too badly:

GARTHWILSON wrote:
BillO wrote:
More recently I had actually wanted to find a romable Forth to put on it as well, but ran out of steam on that.
My job doesn't seem very secure because of dismal sales for the last year or two. If I get let go, one thing I want to do with my time is publish my '02 and '816 Forth kernels as assembler sources. The '816 one is closer to ready for publishing but has only collected dust for many years. My '02 Forth will need more work to make it public, especially for an all-RAM model, as the current one is ROMed. (The primary difference is how variables are compiled.)

It is a very rich Forth though, and adds full interrupt support in high-level Forth with prioritized interrupts that can be installed and deleted on the fly, more program structures than others have ready-made, date & time (including multiple alarms for carrying out tasks at assigned times, with 10ms granularity in the case of my workbench computer), trig, log, square-root, random-number, and extended-precision functions, 32-bit looping controls (in addition to the normal 16-bit ones), ability to go into assembly language in the middle of a secondary and back again, and more primitives for faster execution of words that are usually written as secondaries. It's mostly Forth-83 but has a lot of enhancements from ANS, Brodie's books "Starting Forth" and "Thinking Forth," Forth Dimensions, F-PC, common Forth usage, and my own experience. There may be a lot more there than you need, but various portions will be in INCLude files that you can leave out if you like.

then:
ElEctric_EyE wrote:
GARTHWILSON wrote:
...My job doesn't seem very secure because of dismal sales for the last year or two. If I get let go, one thing I want to do with my time is publish my '02 and '816 Forth kernels as assembler sources...
Sorry to hear that Garth... Just out of curiosity, how big is your version for the 6502?

If you include everything, it looks like about 24K, assuming you leave the headers in. What I started with was probably less than half that much. What happened is that my employer bought me a 6502 Forth metacompiler in about 1990 for the automated test equipment I made. The source they started out was just the public-domain FIG-Forth that's available for download about 3/4 of the way down our source code repository page on 6502.org, but they made some changes mostly I guess to change it from FIG-Forth to the more popular Forth-83, and maybe some other changes just to irritate me. :twisted: The 6502 source code had a few bugs which I've fixed (the UM/MOD one being the primary one, followed by a multiplication bug that showed up only under very rare conditions but it fouled up my FFT function), but their DOS-based metacompiler had some major bugs which became more and more pronounced as the source code size grew. These initially resembled pot holes but eventually became sink holes. Initially I was able to find work-arounds, but eventually it got to where I said I won't use it ever again, and instead will convert the 6502 source code to assembler source so it can be assembled without using their metacompiler at all. Something I need to do in the process is to re-write the few portions that the supplier could claim any copyright on. It would still work the same as far as you the user would see it-- it's just that a few internals would be changed. I compile and assemble on the workbench computer every time I use it of course, but that's only using its capabilities that are already in the EPROM. I have not run the 6502 Forth metacompiler on the PC in many years.


BigDumbDinosaur wrote:
GARTHWILSON wrote:
My job doesn't seem very secure because of dismal sales for the last year or two.
Let's hope that isn't the case. <Sigh>

Many of my clients are suffering from sagging sales, some of it due to the decline of the manufacturing sector of our economy. Meanwhile, our so-called leaders [...]

Our customers are aircraft owners--basically the wealthy--so although I'm definitely not one of them (and actually don't even want to be), my paycheck depends on them having plenty of disposable income to play with. They've definitely had less in the last couple of years.
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?
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Post by BillO »

I'd be interested in the ROM version for the 6502. I'd even be willing to build a new platform for it if I could not shoe-horn it into one of those I already have.

Is that 24K in ROM? or total memory requirement, minus user program?




Sorry to hear your job is in jeopardy. I fully sympathize as I lost mine a year ago yesterday. Still unemployed too...
Bill
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Quote:
Is that 24K in ROM? or total memory requirement, minus user program?
That's ROM. It doesn't take much RAM though, if you don't include the user's programs. Zero page is used for the data stack and page 1 for the return stack, but testing shows that even with a full application running and I/O interrupts serviced in Forth plus the clock running on NMI's, the maximum stack depth used is only a few dozen bytes, maybe slightly over an eighth of a page each. For this reason I put some variables in ZP and some in page 1. When I convert to assembler I'll probably put NEXT in ZP also like I did on my '816 Forth to eliminate a level of indirection in the final JMP and make it slightly faster. (It is ITC Forth.) Additionally there's the TIB which I've left 128 bytes for in page 2, and 256 bytes I left for an RS-232 input buffer. Various other variables take a little RAM space.

The 24K of ROM would be if you include everything I mentioned. Many users would leave out various parts. In addition, if you were to compile something for a commercial use where the user has no need to compile or assemble anything, you can leave out the assembler of course and, because of the header macros, elect to compile headerless code locally or globally.
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?
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Post by BillO »

If you need a hand testing or making it relocatable, or anything else, let me know.
Bill
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Wow, I better take you up before you change your mind! Relocating is no problem, but it's always good to have another tester in case I goof on any changes I need to make. The way it sits now it has shown to be bug-free in the last probably ten years or so, but like I said, I can't distribute it the way it is.
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?
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

BillO wrote:
If you need a hand testing or making it relocatable, or anything else, let me know.
Ditto.

24K is pretty big though...
Post Reply