User Tools

Site Tools


base:memory_management

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
base:memory_management [2018-05-29 08:18] white_flamebase:memory_management [2022-03-06 10:20] – [With Cartridges] white_flame
Line 5: Line 5:
 ====== Without Cartridges ====== ====== Without Cartridges ======
  
-The low 3 bits of $01 control the mapping of specific regions of memory.  The rules are kind of fiddly:+The low 3 bits of $01 control the mapping of specific regions of memory.  When a bit is set to 0, it activates its bank, but the interplay between them is kind of fiddly:
  
 ^Name ^Bit ^Region ^0 ^1 ^Notes^ ^Name ^Bit ^Region ^0 ^1 ^Notes^
Line 12: Line 12:
 |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 region: RAM, CHARROM, or I/O.| |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 region: RAM, CHARROM, or I/O.|
  
-  * All other memory locations ($0000-9FFF, $C000-CFFF) always map to RAM.+  * All other memory locations ($0002-9FFF, $C000-CFFF) always map to RAM.
   * Writes to a ROM-mapped region are applied to the underlying RAM at the same address.   * Writes to a ROM-mapped region are applied to the underlying RAM at the same address.
   * 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.   * 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.
Line 30: Line 30:
 |$37 +55 %111 |BASIC |I/O |KERNAL|Default| |$37 +55 %111 |BASIC |I/O |KERNAL|Default|
  
-The cartridge port also has the GAME and EXROM pinswhich meddle with the memory map even further.  See the Programmer's Reference Guide for that.+***WARNING***: Don't use INC $01 to switch modes from %111 to %000, as that will turn on the tape write head on the next bit up and do bad/unintentional things if there's stuff attached to the tape port. 
 + 
 + 
 +====== With Cartridges ====== 
 + 
 +The expansion port has 2 configuration inputs (/EXROM and /GAME), and 4 chip select outputs (/IO1, /IO2, /ROML, /ROMH). 
 + 
 +/IO1 and /IO2 lines are active on both reads & writes to their respective memory ranges, any time that I/O is banked in: 
 +  * /IO1 = $DE00 - $DEFF 
 +  * /IO2 = $DF00 - $DFFF 
 + 
 +/ROML and /ROMH are active on reads depending on how the cartridge sets the configuration inputs.  Normally, ROML sits right before the BASIC ROM at $8000-9FFF, while ROMH replaces BASIC itself.  Writes to these areas still go to internal RAM and do not activate the external chip select lines.  Ultimax mode has ROMH replacing the KERNAL and unmaps a lot of the internal RAM. 
 + 
 + 
 +===== Cart pulls /EXROM low ===== 
 + 
 +The simplest C64-mode cartridge configurationonly using ROML.  Any time the BASIC ROM is visible in at $A000, ROML is also visible in the 8kB before it. 
 + 
 +^$01 value ^$8000-9FFF ^$A000-BFFF ^$D000-DFFF ^$E000-FFFF ^Notes^ 
 +|$30 +48 %000 |RAM |RAM |RAM |RAM| 
 +|$31 +49 %001 |RAM |RAM |CHARROM |RAM| 
 +|$32 +50 %010 |RAM |RAM |CHARROM |KERNAL| 
 +|$33 +51 %011 |**__ROML__** |BASIC |CHARROM |KERNAL| 
 +
 +|$34 +52 %100 |RAM |RAM |RAM |RAM| 
 +|$35 +53 %101 |RAM |RAM |I/O |RAM| 
 +|$36 +54 %110 |RAM |RAM |I/O |KERNAL| 
 +|$37 +55 %111 |**__ROML__** |BASIC |I/O |KERNAL|Default| 
 + 
 +===== Cart pulls /EXROM + /GAME low ===== 
 + 
 +ROML is before BASIC, and is swapped out with the LORAM bit in $01.  ROMH replaces BASIC, and HIRAM swaps out both it and the KERNAL.  There is no KERNAL-only mode in this configuration. 
 + 
 +^$01 value ^$8000-9FFF ^$A000-BFFF ^$D000-DFFF ^$E000-FFFF ^Notes^ 
 +|$30 +48 %000 |RAM |RAM |RAM |RAM| 
 +|$31 +49 %001 |RAM |RAM |CHARROM |RAM| 
 +|$32 +50 %010 |RAM |**__ROMH__** |CHARROM |KERNAL| 
 +|$33 +51 %011 |**__ROML__** |**__ROMH__** |CHARROM |KERNAL| 
 +
 +|$34 +52 %100 |RAM |RAM |RAM |RAM| 
 +|$35 +53 %101 |RAM |RAM |I/O |RAM| 
 +|$36 +54 %110 |RAM |**__ROMH__** |I/O |KERNAL| 
 +|$37 +55 %111 |**__ROML__** |**__ROMH__** |I/O |KERNAL|Default| 
 + 
 +===== Cart pulls only /GAME low (Ultimax mode) ===== 
 + 
 +ROMH replaces the KERNAL at $E000, ROML is still at $8000.  Only the lowest 4kB of internal RAM remains visible, and I/O cannot be swapped out.  None of the bits in $01 affect the banking in this mode. 
 + 
 +^$0000-0FFF ^$1000-7FFF ^$8000-9FFF ^$A000-CFFF ^$D000-DFFF ^$E000-FFFF ^ 
 +|RAM |unmapped |**__ROML__** |unmapped |I/O |**__ROMH__**| 
 + 
 +The VIC-II will also see the first 4kB of ROMH at $3000-3FFF in all of its 16kB banks, with no access to CHARROM. 
  
 - White Flame - White Flame
  
  
-===== Related: from Graham's page =====+====== Related: from Graham's page ======
  
 In the C64/C128 series of computers, slightly modified versions of the 6502 were used. The modifications did not affect the functional part of the processor itself. Only a so-called processor port was added. This port, in combination with an external PLA, was used to map ROM and I/O areas into the 64KB RAM of the C64. Also, some bits of the port were used for the legendary Datasette. In the C64/C128 series of computers, slightly modified versions of the 6502 were used. The modifications did not affect the functional part of the processor itself. Only a so-called processor port was added. This port, in combination with an external PLA, was used to map ROM and I/O areas into the 64KB RAM of the C64. Also, some bits of the port were used for the legendary Datasette.
base/memory_management.txt · Last modified: 2022-04-17 05:36 by white_flame