Page 1 of 4

Paging of stack

Posted: Thu Apr 29, 2021 5:06 pm
by Michael Kaiser

Has any consideration been made to making the stack ($0100 - $01FF) pageable?  Maybe zero page ($0002 - $00FF) as well?  This would greatly assist in multitasking.   


Paging of stack

Posted: Thu Apr 29, 2021 5:34 pm
by desertfish

The 65(c)02 cpu zero page and stack are hardwired to the first two memory pages.

I don't think you can work around that using some sort of external logic either.


Paging of stack

Posted: Thu Apr 29, 2021 5:41 pm
by Scott Robison

You certainly *can* work around it using external logic. A normal access to zero page just has a high address byte of 0, so if one inserted some logic between the CPU address lines and the rest of the system, it could "easily" remap the value 0 to any other value, thus relocating zero page. The same could be true for the stack page.

I think they are much too far down the path, and increasing the complexity of address decoding would increase the cost of the system. So time and money are both reasons why I suspect it would not happen.


Paging of stack

Posted: Thu Apr 29, 2021 5:44 pm
by Scott Robison

Note: The Commodore 128 had the functionality. Here is a video that talks about leveraging it (though I've not watched it).

I do remember seeing an example program on the 128 that used relocation of the stack (I think it was) to rapidly clear the 40 col screen by relocating it, pushing the accumulator 256 times, and repeating four times.





 


Paging of stack

Posted: Thu Apr 29, 2021 5:51 pm
by desertfish

@Scott Robison thanks! I was totally unaware of that!


Paging of stack

Posted: Thu Apr 29, 2021 6:26 pm
by Scott Robison

Note: if you are anything like me, you'll be yelling at that video as he tries to work out the logic in real time to manage manipulating the various pages.


Paging of stack

Posted: Thu Apr 29, 2021 9:47 pm
by TomXP411

No, there will not be paging of the stack or Zero Page. Lorin has been pretty firm that the memory management is finalized, aside from the parts of VERA and the expansion ports (Which are still in flux.)

 


Paging of stack

Posted: Fri Apr 30, 2021 2:01 am
by x16tial

Here's how to run 2 processes on a Commander X16:

Buy 2 of them.  ?

 

(But seriously, 8 bit computers are kind of single task machines aren't they?)


Paging of stack

Posted: Fri Apr 30, 2021 2:46 am
by Scott Robison


41 minutes ago, x16tial said:




Here's how to run 2 processes on a Commander X16:



Buy 2 of them.  ?



 



(But seriously, 8 bit computers are kind of single task machines aren't they?)



They can multitask just as fast as they can do anything else (which is to say, not very fast by modern standards). You can split the stack into multiple smaller segments so that only the stack pointer has to be adjusted on a task switch, or a task switch can swap the stack & some / all of zero page. You still won't have memory protection or other features provided by modern systems, but it can be done.


Paging of stack

Posted: Fri Apr 30, 2021 3:35 am
by Ed Minchau

I've seen a multitasking Unix-like OS for the Commodore 64 - GeckOS I think it was called. Each task uses its own stack starting at 013F, so at most 64 bytes get swapped in there when changing tasks.