From: jurgen_defurne
Subject: Examples of (Common) Lisp/Scheme code which interfaces with the bare 	metal ?
Date: 
Message-ID: <343dfb8f-56ab-4359-9767-8f1bfe0f7f4d@h11g2000yqb.googlegroups.com>
Dear all,

As a hobby project, I am designing a 32-bit processor which I am
simulating using Common Lisp (mostly based upon SIMH ideas). Currently
I have a working simulation of a simple load/store instruction set, an
assembler and some simple test programs.

However, I want to go further. Last fall I implemented a simple Lisp
interpreter in Perl and now I want to implement a simple Lisp
interpreter on my simulated machine. However, I would like to
start with a Lisp description of all my necessary code and in order to
do that I would like to know if there are somewhere examples and
implementations of (Common) Lisp/Scheme code which
deal with structures in the C sense of the word (contiguous blocks of
memory with fields which are just offsets in the block) ?

Regards,

Jurgen

From: Alessio Stalla
Subject: Re: Examples of (Common) Lisp/Scheme code which interfaces with the 	bare metal ?
Date: 
Message-ID: <2f318abe-0244-47e1-a359-f6a3f17a09c9@h23g2000vbc.googlegroups.com>
On Jun 4, 2:38 pm, jurgen_defurne <··············@pandora.be> wrote:
> Dear all,
>
> As a hobby project, I am designing a 32-bit processor which I am
> simulating using Common Lisp (mostly based upon SIMH ideas). Currently
> I have a working simulation of a simple load/store instruction set, an
> assembler and some simple test programs.
>
> However, I want to go further. Last fall I implemented a simple Lisp
> interpreter in Perl and now I want to implement a simple Lisp
> interpreter on my simulated machine. However, I would like to
> start with a Lisp description of all my necessary code and in order to
> do that I would like to know if there are somewhere examples and
> implementations of (Common) Lisp/Scheme code which
> deal with structures in the C sense of the word (contiguous blocks of
> memory with fields which are just offsets in the block) ?
>
> Regards,
>
> Jurgen

You can take a look at Movitz: http://common-lisp.net/project/movitz/
It is a Common Lisp implementation targeting bare x86 processors.

hth,
Alessio
From: chthon
Subject: Re: Examples of (Common) Lisp/Scheme code which interfaces with the 	bare metal ?
Date: 
Message-ID: <667f8333-400b-4d61-bf84-318b58809c3d@a36g2000yqc.googlegroups.com>
On Jun 4, 2:53 pm, Alessio Stalla <·············@gmail.com> wrote:
> On Jun 4, 2:38 pm, jurgen_defurne <··············@pandora.be> wrote:
>
>
>
> > Dear all,
>
> > As a hobby project, I am designing a 32-bit processor which I am
> > simulating using Common Lisp (mostly based upon SIMH ideas). Currently
> > I have a working simulation of a simple load/store instruction set, an
> > assembler and some simple test programs.
>
> > However, I want to go further. Last fall I implemented a simple Lisp
> > interpreter in Perl and now I want to implement a simple Lisp
> > interpreter on my simulated machine. However, I would like to
> > start with a Lisp description of all my necessary code and in order to
> > do that I would like to know if there are somewhere examples and
> > implementations of (Common) Lisp/Scheme code which
> > deal with structures in the C sense of the word (contiguous blocks of
> > memory with fields which are just offsets in the block) ?
>
> > Regards,
>
> > Jurgen
>
> You can take a look at Movitz:http://common-lisp.net/project/movitz/
> It is a Common Lisp implementation targeting bare x86 processors.
>
> hth,
> Alessio

Silly me, I knew about Movitz, but forgot about it.

Thanks.
From: Rob Warnock
Subject: Re: Examples of (Common) Lisp/Scheme code which interfaces with the bare 	metal ?
Date: 
Message-ID: <yt6dnanGP5zQ4rXXnZ2dnUVZ_jWdnZ2d@speakeasy.net>
jurgen_defurne  <··············@pandora.be> wrote:
+---------------
| As a hobby project, I am designing a 32-bit processor which I am
| simulating using Common Lisp (mostly based upon SIMH ideas). Currently
| I have a working simulation of a simple load/store instruction set, an
| assembler and some simple test programs.
+---------------

Neat!

+---------------
| However, I want to go further. Last fall I implemented a simple Lisp
| interpreter in Perl and now I want to implement a simple Lisp
| interpreter on my simulated machine. However, I would like to
| start with a Lisp description of all my necessary code and in order to
| do that I would like to know if there are somewhere examples and
| implementations of (Common) Lisp/Scheme code which
| deal with structures in the C sense of the word (contiguous blocks of
| memory with fields which are just offsets in the block) ?
+---------------

Please say a little more about exactly what you mean by "deal with
structures". Almost all Lisp/Scheme compilers/interpreters have some
sort of simple "deref+offset" operators down at the bottom of their
implementations. E.g., DEFSTRUCT accessors might be defined as closures
over a more primitive operator such as (an internal version of) ELT,
perhaps.

Also, in terms of generating code for a "raw" machine, make sure you've
read the chapters on compilation in both SICP <http://mitpress.mit.edu/sicp/>
and L.i.S.P. <http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html> [and maybe
even the bits on compiling in PAIP <http://www.norvig.com/paip.html>].


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: chthon
Subject: Re: Examples of (Common) Lisp/Scheme code which interfaces with the 	bare metal ?
Date: 
Message-ID: <f0e57277-e562-45bc-955f-b55907501ee1@k8g2000yqn.googlegroups.com>
On Jun 5, 4:13 am, ····@rpw3.org (Rob Warnock) wrote:

> Please say a little more about exactly what you mean by "deal with
> structures". Almost all Lisp/Scheme compilers/interpreters have some
> sort of simple "deref+offset" operators down at the bottom of their
> implementations. E.g., DEFSTRUCT accessors might be defined as closures
> over a more primitive operator such as (an internal version of) ELT,
> perhaps.

Basically, this is it what you say, 'deref+offset', since every
programming language needs to be able to access its most basic
datastructure. Writing a primitive version of ELT is maybe enough to
start, plus something to access bit fields. You know, I am currently
just trying to get an orientation on things to do.

> Also, in terms of generating code for a "raw" machine, make sure you've
> read the chapters on compilation in both SICP <http://mitpress.mit.edu/sicp/>
> and L.i.S.P. <http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html> [and maybe
> even the bits on compiling in PAIP <http://www.norvig.com/paip.html>].

These parts are in the future on my reading list. I have both SICP and
PiSL (the latest French version of LiSP) at home.

Regards,

Jurgen
From: ······@lisp.de
Subject: Re: Examples of (Common) Lisp/Scheme code which interfaces with the 	bare metal ?
Date: 
Message-ID: <bdd40af7-6650-42d6-a4bd-bd9fb903baa6@e21g2000yqb.googlegroups.com>
On 5 Jun., 08:50, chthon <··············@pandora.be> wrote:
> On Jun 5, 4:13 am, ····@rpw3.org (Rob Warnock) wrote:
>
> > Please say a little more about exactly what you mean by "deal with
> > structures". Almost all Lisp/Scheme compilers/interpreters have some
> > sort of simple "deref+offset" operators down at the bottom of their
> > implementations. E.g., DEFSTRUCT accessors might be defined as closures
> > over a more primitive operator such as (an internal version of) ELT,
> > perhaps.
>
> Basically, this is it what you say, 'deref+offset', since every
> programming language needs to be able to access its most basic
> datastructure. Writing a primitive version of ELT is maybe enough to
> start, plus something to access bit fields. You know, I am currently
> just trying to get an orientation on things to do.
>
> > Also, in terms of generating code for a "raw" machine, make sure you've
> > read the chapters on compilation in both SICP <http://mitpress.mit.edu/sicp/>
> > and L.i.S.P. <http://www-spi.lip6.fr/~queinnec/WWW/LiSP.html> [and maybe
> > even the bits on compiling in PAIP <http://www.norvig.com/paip.html>].
>
> These parts are in the future on my reading list. I have both SICP and
> PiSL (the latest French version of LiSP) at home.
>
> Regards,
>
> Jurgen

For example:

http://ccl.clozure.com/ccl-documentation.html#Referencing-and-Using-Foreign-Memory-Addresses
http://ccl.clozure.com/ccl-documentation.html#id415320