RAM chips usually have a "chip enable" pin, you might have chips that have 4k of addresses that are 8 bits wide [1] and fill out the 64k address space by having 16 RAM chips, feeding the least significant 12 bits to the RAM chips and the most 4 bits to a multiplexer that goes to the 16 RAM chips. All of the RAM chips are on the bus but only the one with CE set responds.
The same kind of thinking could be applied to extend the address space past 16 bits, for instance you poke at some hardware register and that determines which chip enable pin get sets, there is really no limit on how much RAM you could attach to an 8-bit machine.
A really advanced bank switching scheme for an 8-bitter was on the TRS-80 Color Computer 3
https://www.chibiakumas.com/6809/coco3.php
where the 64k address space was divided into 8k blocks and which might be backed by 128MB (minimum), 512MB (max from radio shack) or more RAM and you poked into a table which mapped virtual blocks to physical blocks. That wasn't too different from a modern memory management system greatly scaled down with the exception that systems like that rarely if ever had a true "executive" mode so nothing stopped user mode software from poking to change the memory map. The CoCo for instance had a multitasking OS called OS-9 that did muiltitasking like described in the explained if you had the orginal Color Computer, you could get Level II that supported more memory and if you never poked at those registers, some memory protection.
[1] at least you did in 1979.
I recall spending a few days mulling over the exact sequence of instructions to save the state of the previous task without clobbering the flags or any registers.
The result was that I could register functions (procedures) as tasks with their own little stack, and it would switch preemptively between them in a round-robin fashion.
I'm not familiar with Z80 asm but from what I can gather it looks very similar to what I had. I was running in real mode so also had very limited resources for each task, and a hardcoded upper limit on the number of tasks.
While I'm wildly more productive these days, I kinda miss how not having internet made accomplishments so much greater. It's like walking up a mountain on your own vs taking a tour bus to the summit.
chorlton2080•4h ago