Bank Switching

From Wiki -
Revision as of 07:11, 26 August 2020 by Dlevere (talk | contribs) (External Links)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

From Wikipedia, the free encyclopedia

Bank switching is a technique to increase the amount of usable memory beyond the amount directly addressable by the processor. It can be used to configure a system differently at different times; for example, a ROM required to start a system from diskette could be switched out when no longer needed. In video game systems, bank switching allowed larger games to be developed for play on existing consoles.

Bank switching originated in minicomputer systems. Many modern micro controllers and microprocessors use bank switching to manage random-access memory, non-volatile memory, input-output devices and system management registers in small embedded systems. The technique was common in 8-bit microcomputer systems. Bank-switching may also be used to work around limitations in address bus width, where some hardware constraint prevents straightforward addition of more address lines. Some control-oriented microprocessors use a bank-switching technique to access internal I/O and control registers, which limits the number of register address bits that must be used in every instruction.

Unlike memory management by paging, data is not exchanged with a mass storage device like disk memory. Data remains in quiescent storage in a memory area that is not currently accessible to the processor, (although it may be accessible to the video display, DMA controller, or other subsystems of the computer).

1000px-Bankswitch memory map.svg.png A hypothetical memory map of bank-switched memory for a processor that can only address 64 KB. This scheme shows 200 KB of memory, of which only 64 Kb can be accessed at any time by the processor. The operating system must manage the bank-switching operation to ensure that program execution can continue when part of memory is not accessible to the processor.

Bank switching was also used 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 game data such as graphics and different game stages).

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 peripherals as infrared links or rumble motors.

Bank switching was still being used on later game systems. Several Sega Mega Drive cartridges were over 4MB in size and required the use of this technique (4MB being the maximum address size). The GP2X handheld from Gamepark Holdings uses bank switching in order to control the start address (or memory offset) for the second processor.

The bank switching technique provides a way for computer systems to access more memory than they would otherwise be capable of. When a computer processor is limited to a specific amount of addressable memory space, additional banks of memory can be set up for the processor to use. These separate banks can then be used to switch away from code that is no longer being used, such as read only memory (ROM) used when starting up the computer, and open up banks of memory for multiple users on the system or store memory for other devices on the system.

Bank switching came about as a cost-effective way to keep computers up and running back in the 1980's without having to replace the processor. It found a good deal of use on older 8-bit computer systems, extending the useful life of a computer by simply adding more memory. As newer systems were developed, they also implemented bank switching methods so that programs created on the older systems could still run.

The way bank switching works is by implementing what's called a latch technique. The latch is really just something of a switch that toggles the address space that the computer processor is using. For example, 8-bit computers use a 16-bit address space, meaning that they are only capable of working with 64K, or 65,536, individual memory locations at any given time. When a latch was added, either by means of software or hardware, it could then toggle between multiple banks of memory.

The latch is set up separate from the processor, leaving the bank switching in the hands of an external operation. In some cases, it's simply a bit hiding out in the upper register of memory addresses and toggled as necessary by the computer's operating system or some other software. As the memory fills, the processor can check the bit at the top and toggle to another bank. Other methods of decoding the latch involved bit-addressable ports that granted access to another bank of memory.

Bank switching found its way into a number of video game consoles from the era as well. The ROM cartridges would come equipped with additional hardware built-in that would expand the console beyond its limited available memory space, allowing for better graphics in games and longer game play through additional stages. As technology and techniques improved, however, the method fell out of use. Some modern operating systems can still emulate bank switching in order to operate older software. Many modern embedded computer systems, those computer systems built into some other device or system and typically designed to perform a single task, also still use bank switching due to its cost effectiveness and ease of use.

External Links