As another view on zeropage, it's also common to have a subsystem (say, a set of floating point routines) which use some area of zero page as a scratchpad (say, two or three multibyte values.)
Indeed Sweet16 is such a subsystem, but I think that's more often mentioned than actually used!
Zero page as registers
Re: Zero page as registers
BigEd wrote:
As another view on zeropage, it's also common to have a subsystem (say, a set of floating point routines) which use some area of zero page as a scratchpad (say, two or three multibyte values.)
Indeed Sweet16 is such a subsystem, but I think that's more often mentioned than actually used!
Indeed Sweet16 is such a subsystem, but I think that's more often mentioned than actually used!
In terms of modern operating systems this is all very problematic as things like a context switch require saving the active processor state, which may mean saving zero page locations if they were unique to the current process. Multitasking might be a step too far, but if we did want networking, for example, then we need at least some limited multitasking, or maybe just interrupt routines would be enough, but it still leads to the same issues.
That's one of the interesting things about 6502 systems, by necessity they needed to come up with quite different solutions to issues than modern operating systems have standardised on. I'm sure I need to adapt my thinking to consider that.
Re: Zero page as registers
I just checked the approach used in Acorn's 8-bit MOS, as used in the BBC Micro and successors. It's not a multi-tasking system, but it supports paged ROMs which are in effect independent software subsystems. In response to some OS calls, a series of paged ROMs may be called on to respond, and so there has to be a memory allocation story for them. However, there's one long-term tenant which is "the current language" and one medium-term tenant which is "the current filesystem."
Restricting the story to zero page, the "current language" has 144 bytes of zero page, whereas the "current filesystem" has 32 bytes of zero page. There's 16 bytes for the Econet system and the rest is used by the various parts of the OS.
I think this illustrates that an OS is not just a set of calls but also a set of conventions about resource use: zero page allocations and wider RAM allocations must be part of that.
Restricting the story to zero page, the "current language" has 144 bytes of zero page, whereas the "current filesystem" has 32 bytes of zero page. There's 16 bytes for the Econet system and the rest is used by the various parts of the OS.
I think this illustrates that an OS is not just a set of calls but also a set of conventions about resource use: zero page allocations and wider RAM allocations must be part of that.
Re: Zero page as registers
It is so finite! I always feel pressured dealing with the zpage, especially in my own (usually trivial) bootloaders and systems. I wind up changing things around, and fidgetting to the point of deadlocking myself, trying to come up with the 'ultimate' way to use and share the zero page.
Even a big, 64K direct page would not resolve my tension -- more space but it still must be managed, and possibly relocated. A fully-movable DP of the 6809 seems nice, but I have yet to try to use it.
I still like it more than just giving up on the timing and using a cache, but it is a subject of concern.
Even a big, 64K direct page would not resolve my tension -- more space but it still must be managed, and possibly relocated. A fully-movable DP of the 6809 seems nice, but I have yet to try to use it.
I still like it more than just giving up on the timing and using a cache, but it is a subject of concern.
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Zero page as registers
enso1 wrote:
A fully-movable DP of the 6809 seems nice, but I have yet to try to use it.
The 65C816 has that and I use it a lot, usually in functions, where DP is pointed to reserved stack space. It is oh-so convenient.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Zero page as registers
enso1 wrote:
It is so finite! I always feel pressured dealing with the zpage, especially in my own (usually trivial) bootloaders and systems. I wind up changing things around, and fidgetting to the point of deadlocking myself, trying to come up with the 'ultimate' way to use and share the zero page. ...
Re: Zero page as registers
enso1 wrote:
A fully-movable DP of the 6809 seems nice, but I have yet to try to use it.
Re: Zero page as registers
gilhad wrote:
enso1 wrote:
A fully-movable DP of the 6809 seems nice, but I have yet to try to use it.