The VIC-20's RAM was expandable with plug-in cartridges using the same expansion port as programs. RAM cartridges were available in several sizes: 3 KB (with or without an included BASIC extension ROM), 8 KB, 16 KB, 32 KB and 64 KB, the latter two only from third-party vendors. The internal memory map was dramatically reorganized with the addition of each size cartridge, leading to the situation that some programs would only work if the right amount of memory was present (to cater for this, the 32 KB cartridges had switches, and the 64 KB cartridges had software setups, allowing the RAM to be enabled in user-selected sections).
The most visible part of memory that was reorganised with differing expansion memory configurations was the video memory (with text and/or graphics display data). This was because the video chip could only use the built-in memory for its display data, and at the same time free memory had to remain contiguous for the BASIC interpreter to be able to use it. An unexpanded VIC had 1 KB of system memory, followed by a 3 KB "hole", then 4 KB of contiguous user memory up to address 8191. The 3 KB cartridge would fill the "hole", so on unexpanded and +3K VICs the video area was placed at the top of user memory (8 KB - 512 Bytes). If an 8 KB or 16 KB cartridge was added instead, this memory appeared at addresses above 8 KB; the video memory was then placed at the start of user memory at 4 KB, just above the "hole", to provide the maximum amount of contiguous user memory.
The 32 KB cartridges allowed adding up to 24 KB to the BASIC user memory; together with the 3.5 KB built-in user memory, this gave a maximum of 27.5 KB for BASIC programs and variables. The extra 8 KB could usually be used in one of two ways, set by switches:
Either it could be mapped into the address space reserved for ROM cartridges, which sat "behind" the I/O register space and thus was not contiguous with the rest of the RAM. This allowed running many cartridge-based games from disk or tape and was thus very useful for software pirates; especially if the RAM expansion allowed switching off writing to its memory after the game was loaded, so that the memory behaved exactly like ROM.
Or, 3 KB of the 8 KB could be mapped into the same memory "hole" that the 3 KB cartridge used, letting 5 KB lie fallow. These 3 KB were contiguous with the rest of RAM, but couldn't be used to expand BASIC space to more than 27.5 KB, because the display data would have had to be moved to cartridge RAM, which wasn't possible.
Some 64 KB expansion cartridges allowed the user to copy ROM images to RAM. The more advanced versions even contained an 80-character video chip and a patched BASIC interpreter which gave access to 48 KB of the memory and to the 80-column video mode. As the latter type of cartridges, marketed primarily in Germany, weren't released until late 1984—two years after the appearance of the more capable C64—they went by mostly unnoticed.