linux-8086.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gábor Lénárt" <lgb@lgb.hu>
To: David Given <dg@cowlark.com>
Cc: "linux-8086@vger.kernel.org" <linux-8086@vger.kernel.org>
Subject: Re: 8-bit Linux?
Date: Wed, 28 Mar 2012 19:43:23 +0200	[thread overview]
Message-ID: <20120328174323.GB20308@vega.lgb.hu> (raw)
In-Reply-To: <4F73485D.50009@cowlark.com>

On Wed, Mar 28, 2012 at 06:20:29PM +0100, David Given wrote:
> Chris Cureau wrote:
> > Very interesting!  I'll look a little closer in a bit...
> > 
> > One of the nice things about the c128 is the built in MMU...which allows remapping of page 0 and page 1 (zero page and stack, respectively) at any given moment.  The same thing is possible with the 65816/65265 CPUs, which are the next target.  If you also use the o65 format, you can do software relocation.  There are still limitations of course, but the barriers are lower given those things...
> 
> Being able to remap the stack is a big win. Is 256 bytes a realistic C
> stack size, I wonder?

Not so much, but it does not a big issue as you can write a C compiler which
does not use "hardware" stack but a software implemented by the compiler
run-time compiled into the result. AFAIK eg with cc65 C compiler for 6502
this theory is used.

> 
> I did some work a while back looking at ways of doing C on the 6502 and
> the Z80. They both suck, because both processors predate
> stack-frame-based languages, and so don't have any useful addressing
> modes (like stack-relative addressing).

On 6502 stack is simply too small for a C like implementation for real in my
opinion. That's why cc65 does not use it, at least only partly. I can't tell
details but afaik local variables etc are allocated on "heap" which is
"normal memory" (not stack), and the "real hardware stack" is only used to
contain return addresses and some misc PHA stuffs to save register.

I guess it's a good idea to read cc65's source, it's quite good C compiler
especially if you consider it's not so easy to write one for 6502.
The cross-platform Contiki can be compiled for C64 with it, so it can't be
so bad :D

  reply	other threads:[~2012-03-28 17:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28 14:50 8-bit Linux? Chris Cureau
2012-03-28 15:12 ` Gábor Lénárt
2012-03-28 16:03   ` David Given
2012-03-28 16:33     ` Chris Cureau
2012-03-28 17:20       ` David Given
2012-03-28 17:43         ` Gábor Lénárt [this message]
2012-03-28 17:35     ` Gábor Lénárt
  -- strict thread matches above, loose matches on Subject: below --
2012-03-28  0:36 Scott Ferguson
2012-03-28  1:03 ` Stefan de Konink

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120328174323.GB20308@vega.lgb.hu \
    --to=lgb@lgb.hu \
    --cc=dg@cowlark.com \
    --cc=linux-8086@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).