Re: 8-bit Linux?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-8086" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel]     [Linux ia64]     [DCCP]     [Linux for ARM]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux