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

Re: Unixisms on top of P8?



> This has been one of the real weaknesses of the 6502 in relation to general-purpose "multi-tasking". The stack-based architecture has emerged as a "must" for general-purpose and modular programming.  256 bytes is really tight for the stack address space shared by multiple tasks.
> 


How many bytes does one really need from the stack for each process.  Good programming can keep the stack usage down.  Therefore one can pretty much alot 64 bytes of stack space for each process.  I don't believe any more than 4 processes can be used at any one time.

Therefore, all that is needed is two bytes reserved by each process to hold the stack ptr from the last process and one byte for the current process.

Something like this could be used for each process to control the stack:

 TSX
 STX LASTPROCESS
 LDX CURRENTPROCESS*64   ; Process 0, 1, 2, or 3
 TXS
 .
 .
 .
; and before returning to the previous process
 LDX LASTPROCESS
 TXS
 RTS

This would be no different than having to change the stack pointer to wherever that stack was located in memory.

This should be sufficient for an 8 bit machine in a 64 kb bank.