User Tools

Site Tools


base:memory_management

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
base:memory_management [2015-04-17 04:32] – external edit 127.0.0.1base:memory_management [2019-04-10 03:12] – changed start of ram from 0000 to 0002 white_flame
Line 3: Line 3:
 (Someone please integrate the texts on this page into one...) (Someone please integrate the texts on this page into one...)
  
-Oswald/Resource here, I will try to give you a much smaller and easier to understand info on the c64's ROM&IO registers banking system:+====== Without Cartridges ======
  
-the c64 has 64k ram overlapped with ROMs and IO register areas. The IO area is where the registers of the various chips of the c64 are visible.+The low 3 bits of $01 control the mapping of specific regions of memory.  The rules are kind of fiddly:
  
-memory map:+^Name ^Bit ^Region ^0 ^1 ^Notes^ 
 +|LORAM|0|$A000-BFFF|RAM|BASIC|If KERNAL isn't mapped in, then BASIC won'map in either and this region stays mapped to RAM.| 
 +|HIRAM|1|$E000-FFFF|RAM|KERNAL| | 
 +|CHAREN|2|$D000-DFFF|CHARROM|I/O|If HIRAM and LORAM are both set to 0, then this bit is ignored and the area also maps to RAM. This allows for 3 mappings of this regionRAM, CHARROM, or I/O.|
  
-<code> +  * All other memory locations ($0002-9FFF, $C000-CFFF) always map to RAM. 
-0000-A000 RAM +  * Writes to a ROM-mapped region are applied to the underlying RAM at the same address. 
-A000-C000 RAM  _OR_ BASIC ROM +  * I/O includes the registers for the VIC-II, SID, and CIA chips; color RAM; and two external I/O pages that reach out the expansion port. 
-C000-D000 RAM +  * The VIC-II always sees the CHARROM at $1000-1FFF and $9000-9FFF, and RAM everywhere else, regardless of these bits.
-D000-E000 RAM  _OR_ IO         _OR_ CHAR ROM +
-E000-FFFF RAM  _OR_ KERNAL ROM +
-</code>+
  
-Memory address $01 controls if the ROMs or RAMs etc. are visible on the given memory map above.+The mappings from combining these 3 bits are listed below.  Higher bits of location $01 are used for other purposes and default to %00110xxx.
  
-<code> +^$01 value ^$A000-BFFF ^$D000-DFFF ^$E000-FFFF ^Notes^ 
-$01=$37 -> Basic Rom visible A000-C000, IO visible at D000-E000, Kernal Rom Visible at E000-FFFF +|$30 +48 %000 |RAM |RAM |RAM| 
-$01=$36 -> RAM       visible A000-C000, IO visible at D000-E000, Kernal Rom Visible at E000-FFFF +|$31 +49 %001 |RAM |CHARROM |RAM| 
-$01=$35 -> RAM       visible A000-C000, IO visible at D000-E000, RAM        Visible at E000-FFFF +|$32 +50 %010 |RAM |CHARROM |KERNAL| 
-$01=$34 -> RAM       visible A000-C000, RAM visible at D000-E000, RAM        Visible at E000-FFFF +|$33 +51 %011 |BASIC |CHARROM |KERNAL| 
-$01=$33 -> RAM       visible A000-C000, CHAR ROM   at D000-E000, RAM        Visible at E000-FFFF +
-</code>+|$34 +52 %100 |RAM |RAM |RAM| 
 +|$35 +53 %101 |RAM |I/O |RAM| 
 +|$36 +54 %110 |RAM |I/O |KERNAL| 
 +|$37 +55 %111 |BASIC |I/O |KERNAL|Default|
  
-thats all.+The cartridge port also has the GAME and EXROM pins, which meddle with the memory map even further See the Programmer's Reference Guide for that. 
 + 
 +- White Flame
  
-Char Rom behaves weird, as from the processors point of view normally its invisible, and if you turn it on the CPU "sees" it always at D000-E000. From the VIC's viewpoint this is all different. The VIC sees the char ROM _always_ at the memory areas $1000-$2000 and $9000-$a000 making these ram areas unusable for storing gfx, as no matter what the VIC will read from the char ROM at these addresses. 
  
 ===== Related: from Graham's page ===== ===== Related: from Graham's page =====
base/memory_management.txt · Last modified: 2022-04-17 05:36 by white_flame