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

Re: 6502 Multitasking OS announce



ralph.mason@liffe.com (Ralph Mason) wrote:
>Michael Ellis <michael@anest4.anest.ufl.edu> wrote:
>
>>holger@deep.hb.provi.de (Holger Bruns) wrote:
>
>>>An operating system for the 6502 should have some of the properties of CPM. 
>>>Parameters could be passed into registers and some zeropage locations. 
>
>>   The way to get around this is to pass all parameters on the stack, and use separate
>>   stacks for the separate tasks.
>
>
>All well & good BUT the 6502 does not have a relocatable stack pointer
>so your kinda left with a bit of a problem when it commes to
>multitasking, ie you cant give each process it's own stack without
>copying the whole stack ( maybe just to the current sp value? )during
>each context switch. 
>
>-Ralph Mason

Of course, the SP is only an 8-bit register so it HAS to be at a fixed RAM address.
I would consider copying the stack (only the bytes that are actually used) during
a task switch becase no matter what you do you're going to end up copying context-
related data at some point. 

Consider the case in which zero-page is used to pass parameters.  When you switch tasks
you will HAVE to preserve the context-sensistive parameters by copying them to 
some area of RAM.  This is not unlike copying the stack and, using this approach,
you can't take advantage of the capabilities that the stack provides (i.e. recusion,
parameter passing, etc.).

Please feel free to experiment, though -- I was just trying to save a few headaches.

-Michael Ellis