Difference between revisions of "Memory Map"

From DenialWIKI
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Memory Map =
 
 
[[File:Memory Map.png|800px]]
 
 
 
The VIC-20's 6502 Microprocessor can directly address 64KB of memory.
 
The VIC-20's 6502 Microprocessor can directly address 64KB of memory.
  
Line 11: Line 7:
 
The memory map is divided in 8 '''blocks''', each 8K in length, and numbered 0 to 7.
 
The memory map is divided in 8 '''blocks''', each 8K in length, and numbered 0 to 7.
  
== [[1KB Low Memory|1 KB low Memory]] RAM (built-in) in Block 0 ==
+
<span style="float:left; margin-top:4px;">__TOC__</span>
 +
[[File:Memory Map.png|thumb|right|600px|
 +
{|
 +
|-
 +
|style="background-color:red;"|&nbsp;&nbsp;||Onboard RAM||style="background-color:#00B7EF;"|&nbsp;&nbsp;||Expansion port||style="background-color:#22B14C;"|&nbsp;&nbsp;||Onboard ROM
 +
|-
 +
|style="background-color:violet;"|&nbsp;&nbsp;||I/O chips||style="background-color:orange;"|&nbsp;&nbsp;||Color RAM||style="background-color:yellow;"|&nbsp;&nbsp;||Expansion Port I/O
 +
|}]]
 +
{{clear}}
 +
=Memory map=
 +
== Block 0 ==
 +
=== [[1KB Low Memory|1 KB low Memory]] RAM (built-in) ===
  
 
* $0000-$00FF: Zeropage
 
* $0000-$00FF: Zeropage
Line 17: Line 24:
 
* $0200-$03FF: KERNAL and BASIC working areas
 
* $0200-$03FF: KERNAL and BASIC working areas
  
== 3 KB open area in Block 0 ==
+
=== 3 KB open area in Block 0 ===
  
 
* $0400-$07FF: 1 KB, accessed by <span style="text-decoration: overline">RAM1</span> line
 
* $0400-$07FF: 1 KB, accessed by <span style="text-decoration: overline">RAM1</span> line
Line 23: Line 30:
 
* $0C00-$0FFF: 1 KB, accessed by <span style="text-decoration: overline">RAM3</span> line
 
* $0C00-$0FFF: 1 KB, accessed by <span style="text-decoration: overline">RAM3</span> line
  
== 4 KB Main RAM (built-in) in Block 0 ==
+
=== 4 KB Main RAM (built-in) in Block 0 ===
  
 
* $1000-$1FFF: 4 KB, Main RAM
 
* $1000-$1FFF: 4 KB, Main RAM
  
== 8 KB Expansion Blocks in Blocks 1..3 ==
+
== Blocks 1-3: 8 KB Expansion Blocks ==
  
 
* $2000-$3FFF: 8 KB, Expansion Block 1, accessed by <span style="text-decoration: overline">BLK1</span> line
 
* $2000-$3FFF: 8 KB, Expansion Block 1, accessed by <span style="text-decoration: overline">BLK1</span> line
Line 33: Line 40:
 
* $6000-$7FFF: 8 KB, Expansion Block 3, accessed by <span style="text-decoration: overline">BLK3</span> line
 
* $6000-$7FFF: 8 KB, Expansion Block 3, accessed by <span style="text-decoration: overline">BLK3</span> line
  
== 4 KB ROM, and 4 KB I/O Chip Areas in Block 4 ==
+
== Block 4==
 +
=== 4 KB [[Character ROM]]s ===
 +
* $8000-$83FF: 1 KB uppercase/glyphs
 +
* $8400-$87FF: 1 KB uppercase/lowercase
 +
* $8800-$8BFF: 1 KB inverse uppercase/glyphs
 +
* $8C00-$8FFF: 1 KB inverse uppercase/lowercase
  
* $8000-$8FFF: 4 KB, Character ROMs, 1k each for glpyhs, lowercase, inverse glyphs, and inverse lowercase
+
=== 4 KB I/O Blocks ===
 +
==== I/O Block 0: VIC/VIA chips ====
 
* $9000-$900F: [[Video Interface Chip|VIC]] Registers
 
* $9000-$900F: [[Video Interface Chip|VIC]] Registers
 
* $9110-$911F: [[Versatile Interface Adapter|VIA]] #1 Registers
 
* $9110-$911F: [[Versatile Interface Adapter|VIA]] #1 Registers
 
* $9120-$912F: VIA #2 Registers
 
* $9120-$912F: VIA #2 Registers
* $9130-$93FF: Unused<ref>This memory range actually repeats the memory windows of the VIC and VIA chips. This is due to the VIC-20's physical design. The entire 1k region of $9000-$9400 sits on a chip select line, but when this line is active, only address lines A0-A3 are connected to the chips, and lines A4-A5 are decoded to select from the three chips. Ergo, $9130-$913F map to nothing (decoder output is unused), $9140-$914F maps to the VIC, $9150-$195F to VIA #1, etc.</ref>
+
* $9130-$93FF: Unused<SUP><SMALL>'''[A]'''</SMALL></SUP>
* $9400-$97FF: Color RAM (1K of 4 bit nibbles)<ref>Color is mapped to $9400-95FF or $9600-$97FF depending upon a setting in the VIC registers. Typically, it is $9600-$97FF on an unexpanded or 3k expanded VIC, otherwise it is at $9400-95FF.</ref>
+
 
 +
==== I/O Block 1: Color RAM ====
 +
* $9400-$97FF: [[Color RAM]] (1K of 4 bit nibbles)<SUP><SMALL>'''[B]'''</SMALL></SUP>
 +
 
 +
==== I/O Blocks 2-3: Expansion port ====
 
* $9800-$9BFF: 1 KB, I/O Expansion 2, accessed by <span style="text-decoration: overline">I/O2</span> line
 
* $9800-$9BFF: 1 KB, I/O Expansion 2, accessed by <span style="text-decoration: overline">I/O2</span> line
 
* $9C00-$9FFF: 1 KB, I/O Expansion 3, accessed by <span style="text-decoration: overline">I/O3</span> line
 
* $9C00-$9FFF: 1 KB, I/O Expansion 3, accessed by <span style="text-decoration: overline">I/O3</span> line
  
== 8 KB Expansion Area in Block 5 ==
+
== Block 5: 8 KB Expansion Area ==
  
* $A000-$BFFF: 8 KB, Expansion Block 5, accessed by <span style="text-decoration: overline">BLK5</span> line. Often used for ROM cartridges. Allows autostart sequence.
+
* $A000-$BFFF: 8 KB, Expansion Block 5, accessed by <span style="text-decoration: overline">BLK5</span> line. Often used for ROM cartridges. Allows [[autostart]] sequence.
  
== 16 KB ROM Areas in Blocks 6, and 7 ==
+
== Blocks 6 and 7: System ROMs ==
  
 
* $C000-$DFFF: 8 KB, Block 6, BASIC Interpreter ROM
 
* $C000-$DFFF: 8 KB, Block 6, BASIC Interpreter ROM
 
* $E000-$FFFF: 8 KB, Block 7, KERNAL ROM
 
* $E000-$FFFF: 8 KB, Block 7, KERNAL ROM
 +
** The top six bytes of the entire memory space are special to the [[MOS Technology 6502|6502]]. They form three pairs which contain <abbr title="16-bit memory addresses to which the processor jumps">vectors</abbr>:
 +
*** 65530–65531/$FFFA–$FFFB: [[Non-maskable interrupt]]
 +
*** 65532–65533/$FFFC–$FFFD: Reset vector; contains the address where the processor will start running on boot
 +
*** 65534–65535/$FFFE–$FFFF: [[Interrupt request]]
  
 
=Screen memory map=
 
=Screen memory map=
Line 65: Line 86:
 
[[Image: Unexp Vic-20 Screen Colour Codes.png]]
 
[[Image: Unexp Vic-20 Screen Colour Codes.png]]
  
 +
= Notes =
 +
<SMALL>
 +
{|
 +
|-
 +
|style="vertical-align:top;"|A.||This memory range actually repeats the memory windows of the VIC and VIA chips. This is due to the VIC-20's physical design. The entire 1k region of $9000-$9400 sits on a chip select line, but when this line is active, only address lines A0-A3 are connected to the chips, and lines A4-A5 are decoded to select from the three chips. Ergo, $9130-$913F map to nothing (decoder output is unused), $9140-$914F maps to the VIC, $9150-$195F to VIA #1, etc.
 +
|-
 +
|style="vertical-align:top;"|B.||Color is mapped to $9400-95FF or $9600-$97FF depending upon a setting in the VIC registers. Typically, it is $9600-$97FF on an unexpanded or 3k expanded VIC, otherwise it is at $9400-95FF.
 +
|}
 +
</SMALL>
 
[[Category:Programming]]
 
[[Category:Programming]]

Latest revision as of 15:30, 26 June 2020

The VIC-20's 6502 Microprocessor can directly address 64KB of memory.

A stock VIC-20 has 5K RAM, and 20K ROM built-in. Furthermore 4K of the address range access I/O devices, including the VIC chip. The I/O area also contains 1K of 4-bit values serving as Color RAM.

A range of 256 bytes, with the base address also divisible by 256 is called a page.

The memory map is divided in 8 blocks, each 8K in length, and numbered 0 to 7.

   Onboard RAM    Expansion port    Onboard ROM
   I/O chips    Color RAM    Expansion Port I/O

Memory map

Block 0

1 KB low Memory RAM (built-in)

  • $0000-$00FF: Zeropage
  • $0100-$01FF: CPU Stack
  • $0200-$03FF: KERNAL and BASIC working areas

3 KB open area in Block 0

  • $0400-$07FF: 1 KB, accessed by RAM1 line
  • $0800-$0BFF: 1 KB, accessed by RAM2 line
  • $0C00-$0FFF: 1 KB, accessed by RAM3 line

4 KB Main RAM (built-in) in Block 0

  • $1000-$1FFF: 4 KB, Main RAM

Blocks 1-3: 8 KB Expansion Blocks

  • $2000-$3FFF: 8 KB, Expansion Block 1, accessed by BLK1 line
  • $4000-$5FFF: 8 KB, Expansion Block 2, accessed by BLK2 line
  • $6000-$7FFF: 8 KB, Expansion Block 3, accessed by BLK3 line

Block 4

4 KB Character ROMs

  • $8000-$83FF: 1 KB uppercase/glyphs
  • $8400-$87FF: 1 KB uppercase/lowercase
  • $8800-$8BFF: 1 KB inverse uppercase/glyphs
  • $8C00-$8FFF: 1 KB inverse uppercase/lowercase

4 KB I/O Blocks

I/O Block 0: VIC/VIA chips

  • $9000-$900F: VIC Registers
  • $9110-$911F: VIA #1 Registers
  • $9120-$912F: VIA #2 Registers
  • $9130-$93FF: Unused[A]

I/O Block 1: Color RAM

  • $9400-$97FF: Color RAM (1K of 4 bit nibbles)[B]

I/O Blocks 2-3: Expansion port

  • $9800-$9BFF: 1 KB, I/O Expansion 2, accessed by I/O2 line
  • $9C00-$9FFF: 1 KB, I/O Expansion 3, accessed by I/O3 line

Block 5: 8 KB Expansion Area

  • $A000-$BFFF: 8 KB, Expansion Block 5, accessed by BLK5 line. Often used for ROM cartridges. Allows autostart sequence.

Blocks 6 and 7: System ROMs

  • $C000-$DFFF: 8 KB, Block 6, BASIC Interpreter ROM
  • $E000-$FFFF: 8 KB, Block 7, KERNAL ROM
    • The top six bytes of the entire memory space are special to the 6502. They form three pairs which contain vectors:
      • 65530–65531/$FFFA–$FFFB: Non-maskable interrupt
      • 65532–65533/$FFFC–$FFFD: Reset vector; contains the address where the processor will start running on boot
      • 65534–65535/$FFFE–$FFFF: Interrupt request

Screen memory map

Following is the memory map for the default screen on an unexpanded Vic 20:

Screen Character Codes

Unexp Vic-20 Screen Character Codes.png


Screen Colour Codes

Unexp Vic-20 Screen Colour Codes.png

Notes

A. This memory range actually repeats the memory windows of the VIC and VIA chips. This is due to the VIC-20's physical design. The entire 1k region of $9000-$9400 sits on a chip select line, but when this line is active, only address lines A0-A3 are connected to the chips, and lines A4-A5 are decoded to select from the three chips. Ergo, $9130-$913F map to nothing (decoder output is unused), $9140-$914F maps to the VIC, $9150-$195F to VIA #1, etc.
B. Color is mapped to $9400-95FF or $9600-$97FF depending upon a setting in the VIC registers. Typically, it is $9600-$97FF on an unexpanded or 3k expanded VIC, otherwise it is at $9400-95FF.