Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #48668 > unrolled thread

ANOTHER new Forth ... sigh

Started byChris Curl <ccurl609@gmail.com>
First post2016-07-01 18:16 -0700
Last post2016-07-03 06:52 -0700
Articles 10 — 4 participants

Back to article view | Back to comp.lang.forth


Contents

  ANOTHER new Forth ... sigh Chris Curl <ccurl609@gmail.com> - 2016-07-01 18:16 -0700
    Re: ANOTHER new Forth ... sigh Paul Rubin <no.email@nospam.invalid> - 2016-07-01 19:32 -0700
      Re: ANOTHER new Forth ... sigh Chris Curl <ccurl609@gmail.com> - 2016-07-01 20:51 -0700
        Re: ANOTHER new Forth ... sigh Paul Rubin <no.email@nospam.invalid> - 2016-07-01 21:03 -0700
          Re: ANOTHER new Forth ... sigh Chris Curl <ccurl609@gmail.com> - 2016-07-01 21:44 -0700
        Re: ANOTHER new Forth ... sigh "Elizabeth D. Rather" <erather@forth.com> - 2016-07-01 19:19 -1000
          Re: ANOTHER new Forth ... sigh Chris Curl <ccurl609@gmail.com> - 2016-07-02 07:27 -0700
    Re: ANOTHER new Forth ... sigh Bill Zimmerly <billzimmerly@gmail.com> - 2016-07-03 03:05 -0700
      Re: ANOTHER new Forth ... sigh Bill Zimmerly <billzimmerly@gmail.com> - 2016-07-03 03:05 -0700
      Re: ANOTHER new Forth ... sigh Chris Curl <ccurl609@gmail.com> - 2016-07-03 06:52 -0700

#48668 — ANOTHER new Forth ... sigh

FromChris Curl <ccurl609@gmail.com>
Date2016-07-01 18:16 -0700
SubjectANOTHER new Forth ... sigh
Message-ID<16ab7c66-06bf-40fb-89e3-28594033ebd6@googlegroups.com>
This is, by most measures, just another "toy" forth,  but to me, it is 
an interesting exercise.

The idea here is to create a "bare metal" Forth Virtual Machine that has 
a very small executable footprint, and the entire system is 100% Forth.

I know this is not a new idea, but it satisfies my intellectual
curiosity.

The runtime executable is currently less than 10K.

It has less than 50 operations, most of which could be classified as
the CPU's instruction set. The other operations could be classified as 
the VM's "BIOS".

The 32-bit VM is currently configured with 8K of memory. The code + 
dictionary + stacks (1K data and 1K return) uses about 4K total.
Obviously, I could just as easily give it more memory than I would
know what to do with.

To get the initial system image into the VM, I created a simple assembler. 
The assembly language is very Forth like. The assembler generates an 
in-memory image of the VM's initial state. It then generates a 
listing/disassembly of that image to a file. A casual inspection of the 
listing will show that the entire system is just a Forth dictionary.

The VM's "BIOS" reads the listing file and loads the image as part 
of the VM's boot sequence.

The VM is written in C, but is it so simple that it could easily be
written in assembler. The compiler/assembler is C++, but it uses so
little of the C++ features that it could have just as easily been
written in C.

The project is here, should anyone be interested in having a look at it:

https://github.com/CCurl/Forth_C

[toc] | [next] | [standalone]


#48673

FromPaul Rubin <no.email@nospam.invalid>
Date2016-07-01 19:32 -0700
Message-ID<871t3cn526.fsf@nightsong.com>
In reply to#48668
Chris Curl <ccurl609@gmail.com> writes:
> The VM is written in C, but is it so simple that it could easily be
> written in assembler.

Why not Forth?

[toc] | [prev] | [next] | [standalone]


#48674

FromChris Curl <ccurl609@gmail.com>
Date2016-07-01 20:51 -0700
Message-ID<29ca3c9f-e311-4966-ac1e-88baad42ced0@googlegroups.com>
In reply to#48673
On Friday, July 1, 2016 at 10:32:02 PM UTC-4, Paul Rubin wrote:
> Chris Curl <ccurl609@gmail.com> writes:
> > The VM is written in C, but is it so simple that it could easily be
> > written in assembler.
> 
> Why not Forth?
That would be possible. Do you think the resulting EXE would be as 
small as 10K?

[toc] | [prev] | [next] | [standalone]


#48676

FromPaul Rubin <no.email@nospam.invalid>
Date2016-07-01 21:03 -0700
Message-ID<87wpl4lm92.fsf@nightsong.com>
In reply to#48674
Chris Curl <ccurl609@gmail.com> writes:
> That would be possible. Do you think the resulting EXE would be as 
> small as 10K?

You'd probably want to bootstrap from Forth to an assembler written in
Forth.

This might interest you: 

   http://chiselapp.com/user/tehologist/repository/compc/home

[toc] | [prev] | [next] | [standalone]


#48678

FromChris Curl <ccurl609@gmail.com>
Date2016-07-01 21:44 -0700
Message-ID<b93856d5-f21a-499c-89da-5d84203ec701@googlegroups.com>
In reply to#48676
On Saturday, July 2, 2016 at 12:03:38 AM UTC-4, Paul Rubin wrote:
> Chris Curl <CCurl...@gmail.com> writes:
> > That would be possible. Do you think the resulting EXE would be as 
> > small as 10K?
> 
> You'd probably want to bootstrap from Forth to an assembler written in
> Forth.
> 
> This might interest you: 
> 
>    http://chiselapp.com/user/tehologist/repository/compc/home
That looks pretty similar to my implementation. Mine comes in at 411 
lines of code. The source for my assembler looks very much like Forth.

[toc] | [prev] | [next] | [standalone]


#48679

From"Elizabeth D. Rather" <erather@forth.com>
Date2016-07-01 19:19 -1000
Message-ID<e_idncjKTJhg0-rKnZ2dnUU7-fHNnZ2d@supernews.com>
In reply to#48674
On 7/1/16 5:51 PM, Chris Curl wrote:
> On Friday, July 1, 2016 at 10:32:02 PM UTC-4, Paul Rubin wrote:
>> Chris Curl <ccurl609@gmail.com> writes:
>>> The VM is written in C, but is it so simple that it could easily be
>>> written in assembler.
>>
>> Why not Forth?
> That would be possible. Do you think the resulting EXE would be as
> small as 10K?

Should be a good deal smaller.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

[toc] | [prev] | [next] | [standalone]


#48696

FromChris Curl <ccurl609@gmail.com>
Date2016-07-02 07:27 -0700
Message-ID<a9fa4c7c-754c-416c-940b-7ae9b6f56285@googlegroups.com>
In reply to#48679
On Saturday, July 2, 2016 at 1:20:03 AM UTC-4, Elizabeth D. Rather wrote:
> On 7/1/16 5:51 PM, Chris Curl wrote:
> > On Friday, July 1, 2016 at 10:32:02 PM UTC-4, Paul Rubin wrote:
> >> Chris Curl <ccurl...@gmail.com> writes:
> >>> The VM is written in C, but is it so simple that it could easily be
> >>> written in assembler.
> >>
> >> Why not Forth?
> > That would be possible. Do you think the resulting EXE would be as
> > small as 10K?
> 
> Should be a good deal smaller.
> 
> Cheers,
> Elizabeth
> 
> -- 
> ==================================================
> Elizabeth D. Rather   (US & Canada)   800-55-FORTH
> FORTH Inc.                         +1 310.999.6784
> 5959 West Century Blvd. Suite 700
> Los Angeles, CA 90045
> http://www.forth.com
> 
> "Forth-based products and Services for real-time
> applications since 1973."
> ==================================================

My exe currently uses statically linked libraries. I am going to change it
to be able to dynamically load libraries, and use that mechanism for
the core system as well. That might further reduce my footprint.

[toc] | [prev] | [next] | [standalone]


#48742

FromBill Zimmerly <billzimmerly@gmail.com>
Date2016-07-03 03:05 -0700
Message-ID<6656f2cd-1142-4aae-bf0e-9e8300a2a72c@googlegroups.com>
In reply to#48668
> ANOTHER new Forth ... sigh

There's no need to sigh about it, Charles. There is no universal limit to the number of useful Forth implementations. Be proud of what you've done!

And ... Thank you for this. ;) 

- Bill

[toc] | [prev] | [next] | [standalone]


#48743

FromBill Zimmerly <billzimmerly@gmail.com>
Date2016-07-03 03:05 -0700
Message-ID<6052c685-0d81-49df-b2fb-329afd319f4b@googlegroups.com>
In reply to#48742
On Sunday, July 3, 2016 at 5:05:14 AM UTC-5, Bill Zimmerly wrote:
> > ANOTHER new Forth ... sigh
> 
> There's no need to sigh about it, Charles. There is no universal limit to the number of useful Forth implementations. Be proud of what you've done!
> 
> And ... Thank you for this. ;) 
> 
> - Bill

Ooops, I mean CHRIS.

[toc] | [prev] | [next] | [standalone]


#48746

FromChris Curl <ccurl609@gmail.com>
Date2016-07-03 06:52 -0700
Message-ID<5d6dd493-fae1-4b2f-9620-e5f36f447d77@googlegroups.com>
In reply to#48742
On Sunday, July 3, 2016 at 6:05:14 AM UTC-4, Bill Zimmerly wrote:
> > ANOTHER new Forth ... sigh
> 
> There's no need to sigh about it, Charles. There is no universal limit to the number of useful Forth implementations. Be proud of what you've done!
> 
> And ... Thank you for this. ;) 
> 
> - Bill

Thanks! And no worries about the name ... actually, Charles is my middle name!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web