<s>
Bank	B-General_Concept
switching	I-General_Concept
is	O
a	O
technique	O
used	O
in	O
computer	O
design	O
to	O
increase	O
the	O
amount	O
of	O
usable	O
memory	O
beyond	O
the	O
amount	O
directly	O
addressable	O
by	O
the	O
processor	O
instructions	O
.	O
</s>
<s>
It	O
can	O
be	O
used	O
to	O
configure	O
a	O
system	O
differently	O
at	O
different	O
times	O
;	O
for	O
example	O
,	O
a	O
ROM	B-Device
required	O
to	O
start	B-Operating_System
a	I-Operating_System
system	I-Operating_System
from	O
diskette	O
could	O
be	O
switched	O
out	O
when	O
no	O
longer	O
needed	O
.	O
</s>
<s>
In	O
video	O
game	O
systems	O
,	O
bank	B-General_Concept
switching	I-General_Concept
allowed	O
larger	O
games	O
to	O
be	O
developed	O
for	O
play	O
on	O
existing	O
consoles	O
.	O
</s>
<s>
Bank	B-General_Concept
switching	I-General_Concept
originated	O
in	O
minicomputer	B-Architecture
systems	O
.	O
</s>
<s>
Many	O
modern	O
microcontrollers	B-Architecture
and	O
microprocessors	B-Architecture
use	O
bank	B-General_Concept
switching	I-General_Concept
to	O
manage	O
random-access	B-Architecture
memory	I-Architecture
,	O
non-volatile	O
memory	O
,	O
input-output	B-General_Concept
devices	I-General_Concept
and	O
system	O
management	O
registers	O
in	O
small	O
embedded	B-Architecture
systems	I-Architecture
.	O
</s>
<s>
The	O
technique	O
was	O
common	O
in	O
8-bit	O
microcomputer	B-Architecture
systems	O
.	O
</s>
<s>
Bank-switching	B-General_Concept
may	O
also	O
be	O
used	O
to	O
work	O
around	O
limitations	O
in	O
address	B-Architecture
bus	I-Architecture
width	O
,	O
where	O
some	O
hardware	O
constraint	O
prevents	O
straightforward	O
addition	O
of	O
more	O
address	O
lines	O
,	O
and	O
to	O
work	O
around	O
limitations	O
in	O
the	O
ISA	B-General_Concept
,	O
where	O
the	O
addresses	O
generated	O
are	O
narrower	O
than	O
the	O
address	B-Architecture
bus	I-Architecture
width	O
.	O
</s>
<s>
Some	O
control-oriented	O
microprocessors	B-Architecture
use	O
a	O
bank-switching	B-General_Concept
technique	O
to	O
access	O
internal	O
I/O	B-General_Concept
and	O
control	O
registers	O
,	O
which	O
limits	O
the	O
number	O
of	O
register	O
address	O
bits	O
that	O
must	O
be	O
used	O
in	O
every	O
instruction	O
.	O
</s>
<s>
Unlike	O
memory	O
management	O
by	O
paging	B-Architecture
,	O
data	O
is	O
not	O
exchanged	O
with	O
a	O
mass	O
storage	O
device	O
like	O
disk	B-Device
storage	I-Device
.	O
</s>
<s>
Data	O
remains	O
in	O
quiescent	O
storage	O
in	O
a	O
memory	O
area	O
that	O
is	O
not	O
currently	O
accessible	O
to	O
the	O
processor	O
(	O
although	O
it	O
may	O
be	O
accessible	O
to	O
the	O
video	O
display	O
,	O
DMA	B-General_Concept
controller	I-General_Concept
,	O
or	O
other	O
subsystems	O
of	O
the	O
computer	O
)	O
without	O
the	O
use	O
of	O
special	O
prefix	O
instructions	O
.	O
</s>
<s>
Bank	B-General_Concept
switching	I-General_Concept
can	O
be	O
considered	O
as	O
a	O
way	O
of	O
extending	O
the	O
address	B-General_Concept
space	I-General_Concept
of	O
processor	O
instructions	O
with	O
some	O
register	O
.	O
</s>
<s>
The	O
follow-on	O
system	O
to	O
a	O
processor	O
with	O
a	O
12	O
bit	O
address	O
has	O
a	O
15	O
bit	O
address	B-Architecture
bus	I-Architecture
,	O
but	O
there	O
is	O
no	O
way	O
to	O
directly	O
specify	O
the	O
high	O
three	O
bits	O
on	O
the	O
address	B-Architecture
bus	I-Architecture
.	O
</s>
<s>
The	O
follow-on	O
system	O
to	O
a	O
processor	O
with	O
a	O
15	O
bit	O
address	O
has	O
an	O
18	O
bit	O
address	B-Architecture
bus	I-Architecture
,	O
but	O
legacy	O
instructions	O
only	O
have	O
15	O
address	O
bits	O
;	O
internal	O
bank	O
registers	O
can	O
be	O
used	O
to	O
provide	O
those	O
bits	O
.	O
</s>
<s>
A	O
processor	O
with	O
a	O
16-bit	B-Device
external	O
address	B-Architecture
bus	I-Architecture
can	O
only	O
address	O
216	O
=	O
65536	O
memory	B-General_Concept
locations	I-General_Concept
.	O
</s>
<s>
If	O
an	O
external	O
latch	B-General_Concept
was	O
added	O
to	O
the	O
system	O
,	O
it	O
could	O
be	O
used	O
to	O
control	O
which	O
of	O
two	O
sets	O
of	O
memory	O
devices	O
,	O
each	O
with	O
65536	O
addresses	O
,	O
could	O
be	O
accessed	O
.	O
</s>
<s>
The	O
processor	O
could	O
change	O
which	O
set	O
is	O
in	O
current	O
use	O
by	O
setting	O
or	O
clearing	O
the	O
latch	B-General_Concept
bit	O
.	O
</s>
<s>
The	O
latch	B-General_Concept
can	O
be	O
set	O
or	O
cleared	O
by	O
the	O
processor	O
in	O
several	O
ways	O
;	O
a	O
particular	O
memory	B-General_Concept
address	I-General_Concept
may	O
be	O
decoded	O
and	O
used	O
to	O
control	O
the	O
latch	B-General_Concept
,	O
or	O
,	O
in	O
processors	O
with	O
separately-decoded	O
I/O	B-General_Concept
addresses	I-General_Concept
,	O
an	O
output	O
address	O
may	O
be	O
decoded	O
.	O
</s>
<s>
Several	O
bank-switching	B-General_Concept
control	O
bits	O
could	O
be	O
gathered	O
into	O
a	O
register	O
,	O
approximately	O
doubling	O
the	O
available	O
memory	O
spaces	O
with	O
each	O
additional	O
bit	O
in	O
the	O
register	O
.	O
</s>
<s>
Because	O
the	O
external	O
bank-selecting	O
latch	B-General_Concept
(	O
or	O
register	O
)	O
is	O
not	O
directly	O
connected	O
with	O
the	O
program	B-General_Concept
counter	I-General_Concept
of	O
the	O
processor	O
,	O
it	O
does	O
not	O
automatically	O
change	O
state	O
when	O
the	O
program	B-General_Concept
counter	I-General_Concept
overflows	O
;	O
this	O
cannot	O
be	O
detected	O
by	O
the	O
external	O
latch	B-General_Concept
since	O
the	O
program	B-General_Concept
counter	I-General_Concept
is	O
an	O
internal	O
register	O
of	O
the	O
processor	O
.	O
</s>
<s>
Instead	O
the	O
processor	O
must	O
explicitly	O
do	O
a	O
bank-switching	B-General_Concept
operation	O
to	O
access	O
large	O
memory	O
objects	O
.	O
</s>
<s>
Generally	O
a	O
bank-switching	B-General_Concept
system	O
will	O
have	O
one	O
block	O
of	O
program	B-Device
memory	I-Device
that	O
is	O
common	O
to	O
all	O
banks	O
;	O
no	O
matter	O
which	O
bank	O
is	O
currently	O
active	O
,	O
for	O
part	O
of	O
the	O
address	B-General_Concept
space	I-General_Concept
only	O
one	O
set	O
of	O
memory	B-General_Concept
locations	I-General_Concept
will	O
be	O
used	O
.	O
</s>
<s>
This	O
area	O
would	O
be	O
used	O
to	O
hold	O
code	O
that	O
manages	O
the	O
transitions	O
between	O
banks	O
,	O
and	O
also	O
to	O
process	O
interrupts	B-Application
.	O
</s>
<s>
If	O
only	O
one	O
bank	O
is	O
accessible	O
at	O
a	O
time	O
,	O
it	O
would	O
be	O
necessary	O
to	O
move	O
each	O
byte	O
twice	O
:	O
first	O
into	O
the	O
common	O
memory	O
area	O
,	O
perform	O
a	O
bank	B-General_Concept
switch	I-General_Concept
to	O
the	O
destination	O
bank	O
,	O
and	O
then	O
actually	O
to	O
move	O
the	O
byte	O
into	O
the	O
destination	O
bank	O
.	O
</s>
<s>
If	O
the	O
computer	O
architecture	O
has	O
a	O
DMA	B-General_Concept
engine	I-General_Concept
or	O
a	O
second	O
CPU	O
,	O
and	O
its	O
bank	O
access	O
restrictions	O
differ	O
,	O
whichever	O
subsystem	O
can	O
transfer	O
data	O
directly	O
between	O
banks	O
should	O
be	O
used	O
.	O
</s>
<s>
Unlike	O
a	O
virtual	B-Architecture
memory	I-Architecture
scheme	O
,	O
bank-switching	B-General_Concept
must	O
be	O
explicitly	O
managed	O
by	O
the	O
running	O
program	O
or	O
operating	B-General_Concept
system	I-General_Concept
;	O
the	O
processor	O
hardware	O
cannot	O
automatically	O
detect	O
that	O
data	O
not	O
currently	O
mapped	O
into	O
the	O
active	O
bank	O
is	O
required	O
.	O
</s>
<s>
The	O
application	O
program	O
must	O
keep	O
track	O
of	O
which	O
memory	B-General_Concept
bank	I-General_Concept
holds	O
a	O
required	O
piece	O
of	O
data	O
,	O
and	O
then	O
call	O
the	O
bank-switching	B-General_Concept
routine	O
to	O
make	O
that	O
bank	O
active	O
.	O
</s>
<s>
However	O
,	O
bank-switching	B-General_Concept
can	O
access	O
data	O
much	O
faster	O
than	O
,	O
for	O
example	O
,	O
retrieving	O
the	O
data	O
from	O
disk	B-Device
storage	I-Device
.	O
</s>
<s>
Processors	O
with	O
16-bit	B-Device
addressing	O
(	O
8080	B-General_Concept
,	O
Z80	B-General_Concept
,	O
6502	B-General_Concept
,	O
6809	B-Device
,	O
etc	O
.	O
)	O
</s>
<s>
commonly	O
used	O
in	O
early	O
video	B-Device
game	I-Device
consoles	I-Device
and	O
home	O
computers	O
can	O
directly	O
address	O
only	O
64KB	O
.	O
</s>
<s>
Systems	O
with	O
more	O
memory	O
had	O
to	O
divide	O
the	O
address	B-General_Concept
space	I-General_Concept
into	O
a	O
number	O
of	O
blocks	O
that	O
could	O
be	O
dynamically	O
mapped	O
into	O
parts	O
of	O
a	O
larger	O
address	B-General_Concept
space	I-General_Concept
.	O
</s>
<s>
Bank	B-General_Concept
switching	I-General_Concept
was	O
used	O
to	O
achieve	O
this	O
larger	O
address	B-General_Concept
space	I-General_Concept
by	O
organizing	O
memory	O
into	O
separate	O
banks	O
of	O
up	O
to	O
64KB	O
each	O
.	O
</s>
<s>
Cromemco	O
was	O
the	O
first	O
microcomputer	B-Architecture
manufacturer	O
to	O
use	O
bank	B-General_Concept
switching	I-General_Concept
,	O
supporting	O
8	O
banks	O
of	O
64KB	O
in	O
its	O
systems	O
.	O
</s>
<s>
When	O
using	O
bank	B-General_Concept
switching	I-General_Concept
some	O
caution	O
was	O
required	O
in	O
order	O
not	O
to	O
corrupt	O
the	O
handling	O
of	O
subroutine	O
calls	O
,	O
interrupts	B-Application
,	O
the	O
machine	B-General_Concept
stack	I-General_Concept
,	O
and	O
so	O
on	O
.	O
</s>
<s>
While	O
the	O
contents	O
of	O
memory	O
temporarily	O
switched	O
out	O
from	O
the	O
CPU	O
was	O
inaccessible	O
to	O
the	O
processor	O
,	O
it	O
could	O
be	O
used	O
by	O
other	O
hardware	O
,	O
such	O
as	O
video	O
display	O
,	O
DMA	B-General_Concept
,	O
I/O	B-General_Concept
devices	I-General_Concept
,	O
etc	O
.	O
</s>
<s>
CP/M	B-Operating_System
-80	I-Operating_System
3.0	O
released	O
in	O
1983	O
and	O
the	O
Z80-based	O
TRS-80s	B-Device
the	O
Model	B-Device
4	I-Device
and	O
Model	B-Device
II	I-Device
supported	O
bank	B-General_Concept
switching	I-General_Concept
to	O
allow	O
use	O
of	O
more	O
than	O
the	O
64KB	O
of	O
memory	O
that	O
the	O
8080	B-General_Concept
or	O
Z80	B-General_Concept
processor	O
could	O
address	O
.	O
</s>
<s>
Bank	B-General_Concept
switching	I-General_Concept
allowed	O
extra	O
memory	O
and	O
functions	O
to	O
be	O
added	O
to	O
a	O
computer	O
design	O
without	O
the	O
expense	O
and	O
incompatibility	O
of	O
switching	O
to	O
a	O
processor	O
with	O
a	O
wider	O
address	B-Architecture
bus	I-Architecture
.	O
</s>
<s>
For	O
example	O
,	O
the	O
C64	O
used	O
bank	B-General_Concept
switching	I-General_Concept
to	O
allow	O
for	O
a	O
full	O
64KB	O
of	O
RAM	B-Architecture
and	O
still	O
provide	O
for	O
ROM	B-Device
and	O
memory-mapped	B-Architecture
I/O	I-Architecture
as	O
well	O
.	O
</s>
<s>
The	O
Atari	B-Device
130XE	I-Device
could	O
allow	O
its	O
two	O
processors	O
(	O
the	O
6502	B-General_Concept
and	O
the	O
ANTIC	B-General_Concept
)	O
to	O
access	O
separate	O
RAM	B-Architecture
banks	O
,	O
allowing	O
programmers	O
to	O
make	O
large	O
playfields	O
and	O
other	O
graphic	O
objects	O
without	O
using	O
up	O
the	O
memory	O
visible	O
to	O
the	O
CPU	O
.	O
</s>
<s>
Microcontrollers	B-Architecture
(	O
microprocessors	B-Architecture
with	O
significant	O
input/output	B-General_Concept
hardware	O
integrated	O
on-chip	O
)	O
may	O
use	O
bank	B-General_Concept
switching	I-General_Concept
,	O
for	O
example	O
,	O
to	O
access	O
multiple	O
configuration	O
registers	O
or	O
on-chip	O
read/write	O
memory	O
.	O
</s>
<s>
An	O
example	O
is	O
the	O
PIC	B-Architecture
microcontroller	I-Architecture
.	O
</s>
<s>
In	O
1985	O
,	O
the	O
companies	O
Lotus	O
and	O
Intel	O
introduced	O
Expanded	B-Device
Memory	I-Device
Specification	I-Device
(	O
EMS	B-Device
)	O
3.0	O
for	O
use	O
in	O
IBM	O
PC	O
compatible	O
computers	O
running	O
MS-DOS	B-Application
.	O
</s>
<s>
Microsoft	O
joined	O
for	O
versions	O
3.2	O
in	O
1986	O
and	O
4.0	O
in	O
1987	O
and	O
the	O
specification	O
became	O
known	O
as	O
Lotus-Intel-Microsoft	B-Device
EMS	B-Device
or	O
LIM	O
EMS	B-Device
.	O
</s>
<s>
It	O
is	O
a	O
form	O
of	O
bank	B-General_Concept
switching	I-General_Concept
technique	O
that	O
allows	O
more	O
than	O
the	O
640KB	O
of	O
RAM	B-Architecture
defined	O
by	O
the	O
original	O
IBM	O
PC	O
architecture	O
,	O
by	O
letting	O
it	O
appear	O
piecewise	O
in	O
a	O
64KB	O
"	O
window	O
"	O
located	O
in	O
the	O
Upper	B-Device
Memory	I-Device
Area	I-Device
.	O
</s>
<s>
Some	O
computer	O
games	O
made	O
use	O
of	O
this	O
,	O
and	O
though	O
EMS	B-Device
is	O
obsolete	O
,	O
the	O
feature	O
is	O
nowadays	O
emulated	B-Application
by	O
later	O
Microsoft	B-Application
Windows	I-Application
operating	I-Application
systems	I-Application
to	O
provide	O
backwards	O
compatibility	O
with	O
those	O
programs	O
.	O
</s>
<s>
The	O
later	O
eXtended	B-Device
Memory	I-Device
Specification	O
(	O
XMS	O
)	O
,	O
also	O
now	O
obsolete	O
,	O
is	O
a	O
standard	O
for	O
,	O
in	O
principle	O
,	O
simulating	O
bank	B-General_Concept
switching	I-General_Concept
for	O
memory	O
above	O
1MB	O
(	O
called	O
"	O
extended	B-Device
memory	I-Device
"	O
)	O
,	O
which	O
is	O
not	O
directly	O
addressable	O
in	O
the	O
Real	B-Application
Mode	I-Application
of	O
x86	B-Operating_System
processors	O
in	O
which	O
MS-DOS	B-Application
runs	O
.	O
</s>
<s>
XMS	O
allows	O
extended	B-Device
memory	I-Device
to	O
be	O
copied	O
anywhere	O
in	O
conventional	O
memory	O
,	O
so	O
the	O
boundaries	O
of	O
the	O
"	O
banks	O
"	O
are	O
not	O
fixed	O
,	O
but	O
in	O
every	O
other	O
way	O
it	O
works	O
like	O
the	O
bank	B-General_Concept
switching	I-General_Concept
of	O
EMS	B-Device
,	O
from	O
the	O
perspective	O
of	O
a	O
program	O
that	O
uses	O
it	O
.	O
</s>
<s>
Later	O
versions	O
of	O
MS-DOS	B-Application
(	O
starting	O
circa	O
version	O
5.0	O
)	O
included	O
the	O
EMM386	O
driver	O
,	O
which	O
simulates	O
EMS	B-Device
memory	I-Device
using	O
XMS	O
,	O
allowing	O
programs	O
to	O
use	O
extended	B-Device
memory	I-Device
even	O
if	O
they	O
were	O
written	O
for	O
EMS	B-Device
.	O
</s>
<s>
Microsoft	B-Application
Windows	I-Application
emulates	B-Application
XMS	O
also	O
,	O
for	O
those	O
programs	O
that	O
require	O
it	O
.	O
</s>
<s>
Bank	B-General_Concept
switching	I-General_Concept
was	O
also	O
used	O
in	O
some	O
video	B-Device
game	I-Device
consoles	I-Device
.	O
</s>
<s>
The	O
Atari	B-General_Concept
2600	I-General_Concept
,	O
for	O
instance	O
,	O
could	O
only	O
address	O
4KB	O
of	O
ROM	B-Device
,	O
so	O
later	O
2600	O
game	B-Protocol
cartridges	I-Protocol
contained	O
their	O
own	O
bank	B-General_Concept
switching	I-General_Concept
hardware	O
in	O
order	O
to	O
permit	O
the	O
use	O
of	O
more	O
ROM	B-Device
and	O
thus	O
allow	O
for	O
more	O
sophisticated	O
games	O
(	O
via	O
more	O
program	O
code	O
and	O
,	O
equally	O
important	O
,	O
larger	O
amounts	O
of	O
game	O
data	O
such	O
as	O
graphics	O
and	O
different	O
game	O
stages	O
)	O
.	O
</s>
<s>
The	O
Nintendo	O
Entertainment	O
System	O
contained	O
a	O
modified	O
6502	B-General_Concept
but	O
its	O
cartridges	B-Protocol
sometimes	O
contained	O
a	O
megabit	O
or	O
more	O
of	O
ROM	B-Device
,	O
addressed	O
via	O
bank	B-General_Concept
switching	I-General_Concept
called	O
a	O
Multi-Memory	B-General_Concept
Controller	I-General_Concept
.	O
</s>
<s>
Game	B-Protocol
Boy	I-Protocol
cartridges	I-Protocol
used	O
a	O
chip	O
called	O
MBC	O
(	O
Memory	B-General_Concept
Bank	I-General_Concept
Controller	O
)	O
,	O
which	O
not	O
only	O
offered	O
ROM	B-Device
bank	B-General_Concept
switching	I-General_Concept
,	O
but	O
also	O
cartridge	B-Protocol
SRAM	B-Architecture
bank	B-General_Concept
switching	I-General_Concept
,	O
and	O
even	O
access	O
to	O
such	O
peripherals	O
as	O
infrared	O
links	O
or	O
rumble	O
motors	O
.	O
</s>
<s>
Bank	B-General_Concept
switching	I-General_Concept
was	O
still	O
being	O
used	O
on	O
later	O
game	O
systems	O
.	O
</s>
<s>
Several	O
Sega	B-Operating_System
Mega	I-Operating_System
Drive	I-Operating_System
cartridges	B-Protocol
,	O
such	O
as	O
Super	B-Application
Street	I-Application
Fighter	I-Application
II	I-Application
were	O
over	O
4MB	O
in	O
size	O
and	O
required	O
the	O
use	O
of	O
this	O
technique	O
(	O
4MB	O
being	O
the	O
maximum	O
address	O
size	O
)	O
.	O
</s>
<s>
The	O
GP2X	B-Device
handheld	O
from	O
Gamepark	O
Holdings	O
uses	O
bank	B-General_Concept
switching	I-General_Concept
in	O
order	O
to	O
control	O
the	O
start	O
address	O
(	O
or	O
memory	O
offset	O
)	O
for	O
the	O
second	O
processor	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
while	O
the	O
processor	O
is	O
updating	O
the	O
contents	O
of	O
one	O
set	O
of	O
physical	O
memory	B-General_Concept
locations	I-General_Concept
,	O
the	O
video	O
generation	O
hardware	O
is	O
accessing	O
and	O
displaying	O
the	O
contents	O
of	O
a	O
second	O
set	O
.	O
</s>
<s>
When	O
the	O
processor	O
has	O
completed	O
its	O
update	O
,	O
it	O
can	O
signal	O
to	O
the	O
video	B-Architecture
display	I-Architecture
hardware	I-Architecture
to	O
swap	O
active	O
banks	O
,	O
so	O
that	O
the	O
transition	O
visible	O
on	O
screen	O
is	O
free	O
of	O
artifacts	O
or	O
distortion	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
processor	O
may	O
have	O
access	O
to	O
all	O
the	O
memory	O
at	O
once	O
,	O
but	O
the	O
video	B-Architecture
display	I-Architecture
hardware	I-Architecture
is	O
bank-switched	O
between	O
parts	O
of	O
the	O
video	O
memory	O
.	O
</s>
<s>
Bank	B-General_Concept
switching	I-General_Concept
was	O
later	O
supplanted	O
by	O
segmentation	B-General_Concept
in	O
many	O
16-bit	B-Device
systems	I-Device
,	O
which	O
in	O
turn	O
gave	O
way	O
to	O
paging	B-Architecture
memory	B-General_Concept
management	I-General_Concept
units	I-General_Concept
.	O
</s>
<s>
In	O
embedded	B-Architecture
systems	I-Architecture
,	O
however	O
,	O
bank	B-General_Concept
switching	I-General_Concept
is	O
still	O
often	O
used	O
for	O
its	O
simplicity	O
,	O
low	O
cost	O
,	O
and	O
often	O
better	O
adaptation	O
to	O
those	O
contexts	O
than	O
to	O
general	O
purpose	O
computing	O
.	O
</s>
