Memory MAP

Get help from the community & developers with the X16 hardware if you can't find the solution elsewhere
Post Reply
Juergen Frank
Posts: 6
Joined: Wed Oct 12, 2022 8:21 am

Memory MAP

Post 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

 

Guybrush
Posts: 63
Joined: Fri Jul 10, 2020 10:38 pm

Memory MAP

Post by Guybrush »


Would you rather have a 256 bytes taken from each and every high RAM page?

User avatar
AndyMt
Posts: 326
Joined: Sun Jun 21, 2020 3:02 pm
Location: Switzerland

Memory MAP

Post 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...

kelli217
Posts: 531
Joined: Sun Jul 05, 2020 11:27 pm

Memory MAP

Post 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.

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.

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Memory MAP

Post 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. 

Post Reply