Page 1 of 1
Memory MAP
Posted: Thu Oct 13, 2022 6:51 am
by Juergen Frank
HI!! Is there a technical reasons why the IO space is in between the main RAM and the 8k HIGH memory space ?
In general would it be "nicer" to create one large memory block of ~48KBytes instead ?
Just want to understand the motivation behind this decission.
Thanks
Juergen
Memory MAP
Posted: Thu Oct 13, 2022 1:15 pm
by Guybrush
Would you rather have a 256 bytes taken from each and every high RAM page?
Memory MAP
Posted: Thu Oct 13, 2022 1:51 pm
by AndyMt
On 10/13/2022 at 3:15 PM, Guybrush said:
Would you rather have a 256 bytes taken from each and every high RAM page?
Not necessarily - IO could also be located directly above the zero page, so more at the beginning of the memory map at $100. Or at the top of the upper ROM area.
But I'm sure there were good reasons to have it where it is. And it won't be changed now, that's for sure. But me, too, would be interested why it is as it is...
Technically it's still possible to get code up there and execute it. It's just the question what happens when the Kernal swaps that for it's own data page in between...
Memory MAP
Posted: Thu Oct 13, 2022 3:11 pm
by kelli217
Kernal calls should start with a push of the value of $00 to the stack and should pull it back from the stack and restore it to $00 before the RTS. Same with interrupts, the handler should start with the push and should pull it back before RTI.
I think this is already implemented in the kernal itself; if not, it's easy enough for a user program to do. I'm pretty sure that the default interrupt behavior is the same.
Memory MAP
Posted: Sun Dec 04, 2022 5:22 am
by Ed Minchau
On 10/13/2022 at 12:51 AM, Juergen Frank said:
HI!! Is there a technical reasons why the IO space is in between the main RAM and the 8k HIGH memory space ?
In general would it be "nicer" to create one large memory block of ~48KBytes instead ?
Just want to understand the motivation behind this decission.
Thanks
Juergen
A lot of it has to do with the Commodore kernal. It allocates page 00 for the zero page variables, page 01 to the stack, and then the ROM uses pages 02 and 03 for some short subroutines and some variables. Pages 04 to 07 ("Golden RAM") were originally used by the kernal for a buffer for the cassette tape storage. BASIC starts at 0801.
So, to move the memory-mapped I/O to anything other than page 9F would have meant cutting into Golden RAM, or else rewriting large sections of the kernal to use page 02 or 03 (pages 00 and 01 can't be used for I/O; the stack can't be moved and zero page is right out).
Using page 9F just required one chip for the decoding logic, and it was the easiest place to put I/O, so that's what we've got.