Bank switching
From Wikipedia, the free encyclopedia
Bank switching (also known as "paging", but only loosely related to the ordinary meaning of "paging" in computing) was a technique common in 8-bit microcomputer systems, to increase the amount of addressable RAM and ROM without extending the address bus.
Since 8-bit CPUs such as the Zilog Z80 and the MOS Technology 6502 series, with their 16-bit address registers, could only address a maximum of 64 KB of memory (in case of a single address being an 8-bit element, see address bus), 8-bit systems containing more than 64 KB of memory addressed the memory in 64 KB banks (or "pages") — in other words, although the system may have contained 128 KB or more, only 64 KB was ever addressed directly at one time. This scheme offered access to more memory at the cost of more complicated programming and somewhat poorer performance.
While bank switching was less efficient than switching to a processor with a wider address bus would have been, it was an inexpensive way to increase the shelf life of several computer lines of the 1980s and it provided a high degree of backward compatibility with earlier systems: for example, the Apple IIe, IIc (see Apple II series), and Apple III could run software written for the Apple II+, and the Commodore 128 could run all the software of its much more prevalent predecessor, the C64 (which had already employed bank switching to allow for 64KB of RAM and still provide for ROM as well). Accessing the lower 64 KB part of memory was as simple as addressing the first (lowest) bank. The Atari 130XE used a similar technique, but added the ability for its two processors (the 6502 and the ANTIC) to access separate banks. This allowed programmers to make large playfields and other graphic objects without using up the memory visible to the CPU.
In 1988 the companies Lotus, Intel and Microsoft agreed on a specification called Expanded Memory System (EMS, also stated as LIM-EMS) for use in IBM PC compatible computers running MS-DOS. It was a form of bank switching technique that allowed more than the 640 KB of RAM foreseen by the original IBM PC architecture, by letting it appear piecewise in a 64KB "window" located in the Upper Memory Area. Some computer games made use of this, and the feature is nowadays emulated by later Microsoft Windows operating systems to provide backwards compatibility with those programs.
Bank switching was also utilized in some video game consoles. The Atari 2600, for instance, could only address 4 KB of ROM, so later 2600 game cartridges contained their own bank switching hardware in order to permit the use of more ROM and thus allow for more sophisticated games (via more program code and, equally important, larger amounts of gameworld data such as graphics and sound). The Nintendo Entertainment System contained a modified 6502 but its cartridges sometimes contained a megabit or more of ROM, addressed via bank switching called a Multi-Memory Controller. Game Boy cartridges used a chip called MBC (Memory Bank Controller), which not only offered ROM bank switching, but also cartridge SRAM bank switching, and even access to such features as infrared links or rumble motors.
Bank switching was later replaced by segmentation in 16-bit systems, which in turn was replaced by paging memory management units.