<s>
CHIP-8	B-Device
is	O
an	O
interpreted	B-Application
programming	I-Application
language	I-Application
,	O
developed	O
by	O
Joseph	O
Weisbecker	O
made	O
on	O
his	O
1802	B-General_Concept
Microprocessor	O
.	O
</s>
<s>
It	O
was	O
initially	O
used	O
on	O
the	O
COSMAC	B-Device
VIP	I-Device
and	O
Telmac	B-Device
1800	I-Device
8-bit	O
microcomputers	B-Architecture
in	O
the	O
mid-1970s	O
.	O
</s>
<s>
CHIP-8	B-Device
programs	B-Application
are	O
run	O
on	O
a	O
CHIP-8	B-Device
virtual	B-Architecture
machine	I-Architecture
.	O
</s>
<s>
The	O
simplicity	O
of	O
CHIP-8	B-Device
,	O
and	O
its	O
long	O
history	O
and	O
popularity	O
,	O
has	O
ensured	O
that	O
CHIP-8	B-Device
emulators	B-Application
and	O
programs	B-Application
are	O
still	O
being	O
made	O
to	O
this	O
day	O
.	O
</s>
<s>
Roughly	O
fifteen	O
years	O
after	O
CHIP-8	B-Device
was	O
introduced	O
,	O
derived	O
interpreters	B-Application
appeared	O
for	O
some	O
models	O
of	O
graphing	B-Application
calculators	I-Application
(	O
from	O
the	O
late	O
1980s	O
onward	O
,	O
these	O
handheld	O
devices	O
in	O
many	O
ways	O
have	O
more	O
computing	O
power	O
than	O
most	O
mid-1970s	O
microcomputers	B-Architecture
for	O
hobbyists	O
)	O
.	O
</s>
<s>
An	O
active	O
community	O
of	O
users	O
and	O
developers	O
existed	O
in	O
the	O
late	O
1970s	O
,	O
beginning	O
with	O
ARESCO	O
's	O
"	O
VIPer	O
"	O
newsletter	O
whose	O
first	O
three	O
issues	O
revealed	O
the	O
machine	O
code	O
behind	O
the	O
CHIP-8	B-Device
interpreter	B-Application
.	O
</s>
<s>
There	O
are	O
a	O
number	O
of	O
classic	O
video	O
games	O
ported	O
to	O
CHIP-8	B-Device
,	O
such	O
as	O
Pong	B-Application
,	O
Space	B-Application
Invaders	I-Application
,	O
Tetris	B-Device
,	O
and	O
Pac-Man	B-Application
.	O
</s>
<s>
During	O
the	O
1970s	O
and	O
1980s	O
,	O
CHIP-8	B-Device
users	O
shared	O
CHIP-8	B-Device
programs	B-Application
,	O
but	O
also	O
changes	O
and	O
extensions	O
to	O
the	O
CHIP-8	B-Device
interpreter	B-Application
,	O
in	O
the	O
COSMAC	B-Device
VIP	I-Device
users	O
 '	O
newsletter	O
,	O
VIPER	O
magazine	O
.	O
</s>
<s>
These	O
extensions	O
included	O
CHIP-10	O
and	O
Hi-Res	O
CHIP-8	B-Device
,	O
which	O
introduced	O
a	O
higher	O
resolution	O
than	O
the	O
standard	O
64x32	O
,	O
and	O
CHIP-8C	O
and	O
CHIP-8X	O
,	O
which	O
extended	O
the	O
monochrome	O
display	O
capabilities	O
to	O
support	O
limited	O
color	O
,	O
among	O
other	O
features	O
.	O
</s>
<s>
These	O
extensions	O
were	O
mostly	O
backwards	B-General_Concept
compatible	I-General_Concept
,	O
as	O
they	O
were	O
based	O
on	O
the	O
original	O
interpreter	B-Application
,	O
although	O
some	O
repurposed	O
rarely	O
used	O
opcodes	B-Language
for	O
new	O
instructions	O
.	O
</s>
<s>
In	O
1979	O
,	O
Electronics	O
Australia	O
ran	O
a	O
series	O
of	O
articles	O
on	O
building	O
a	O
kit	O
computer	O
similar	O
to	O
the	O
COSMAC	B-Device
VIP	I-Device
,	O
based	O
on	O
the	O
Motorola	B-Device
6800	I-Device
architecture	O
.	O
</s>
<s>
This	O
computer	O
,	O
the	O
DREAM	O
6800	O
,	O
came	O
with	O
its	O
own	O
version	O
of	O
CHIP-8	B-Device
.	O
</s>
<s>
A	O
newsletter	O
similar	O
to	O
VIPER	O
,	O
called	O
DREAMER	O
,	O
was	O
used	O
to	O
share	O
CHIP-8	B-Device
games	O
for	O
this	O
interpreter	B-Application
.	O
</s>
<s>
ETI	O
ran	O
regular	O
ETI-660	O
and	O
general	O
CHIP-8	B-Device
columns	O
until	O
1985	O
.	O
</s>
<s>
In	O
1990	O
,	O
a	O
CHIP-8	B-Device
interpreter	B-Application
called	O
CHIP-48	O
was	O
made	O
for	O
HP-48	B-Device
graphing	B-Application
calculators	I-Application
so	O
games	O
could	O
be	O
programmed	O
more	O
easily	O
.	O
</s>
<s>
Erik	O
Bryntse	O
later	O
created	O
another	O
interpreter	B-Application
based	O
on	O
CHIP-48	O
,	O
called	O
SCHIP	O
,	O
S-CHIP	O
or	O
Super-Chip	O
.	O
</s>
<s>
SCHIP	O
extended	O
the	O
CHIP-8	B-Device
language	O
with	O
a	O
larger	O
resolution	O
and	O
several	O
additional	O
opcodes	B-Language
meant	O
to	O
make	O
programming	O
easier	O
.	O
</s>
<s>
If	O
it	O
were	O
not	O
for	O
the	O
development	O
of	O
the	O
CHIP-48	O
interpreter	B-Application
,	O
CHIP-8	B-Device
would	O
not	O
be	O
as	O
well	O
known	O
today	O
.	O
</s>
<s>
David	O
Winter	O
's	O
emulator	B-Application
,	O
disassembler	O
,	O
and	O
extended	O
technical	O
documentation	O
popularized	O
CHIP-8/SCHIP	O
on	O
many	O
other	O
platforms	O
.	O
</s>
<s>
It	O
laid	O
out	O
a	O
complete	O
list	O
of	O
undocumented	O
opcodes	B-Language
and	O
features	O
,	O
and	O
was	O
distributed	O
across	O
many	O
hobbyist	O
forums	O
.	O
</s>
<s>
Many	O
emulators	B-Application
used	O
these	O
works	O
as	O
a	O
starting	O
point	O
.	O
</s>
<s>
However	O
,	O
CHIP-48	O
subtly	O
changed	O
the	O
semantics	O
of	O
a	O
few	O
of	O
the	O
opcodes	B-Language
,	O
and	O
SCHIP	O
continued	O
to	O
use	O
those	O
new	O
semantics	O
in	O
addition	O
to	O
changing	O
other	O
opcodes	B-Language
.	O
</s>
<s>
Many	O
online	O
resources	O
about	O
CHIP-8	B-Device
propagate	O
these	O
new	O
semantics	O
,	O
so	O
many	O
modern	O
CHIP-8	B-Device
games	O
are	O
not	O
backwards	B-General_Concept
compatible	I-General_Concept
with	O
the	O
original	O
CHIP-8	B-Device
interpreter	B-Application
for	O
the	O
COSMAC	B-Device
VIP	I-Device
,	O
even	O
if	O
they	O
do	O
not	O
specifically	O
use	O
the	O
new	O
SCHIP	O
extensions	O
.	O
</s>
<s>
There	O
is	O
a	O
CHIP-8	B-Device
implementation	O
for	O
almost	O
every	O
platform	O
,	O
as	O
well	O
as	O
some	O
development	O
tools	O
.	O
</s>
<s>
Games	O
are	O
still	O
being	O
developed	O
and	O
cataloged	O
for	O
CHIP-8	B-Device
today	O
,	O
in	O
addition	O
to	O
older	O
games	O
resurfacing	O
online	O
in	O
digital	O
archives	O
.	O
</s>
<s>
While	O
CHIP-8	B-Device
and	O
SCHIP	O
have	O
commonly	O
been	O
implemented	O
as	O
emulators	B-Application
,	O
a	O
pure	O
hardware	O
implementation	O
(	O
written	O
in	O
the	O
Verilog	B-Language
language	O
)	O
also	O
exists	O
for	O
certain	O
FPGA	B-Architecture
boards	I-Architecture
.	O
</s>
<s>
CHIP-8	B-Device
was	O
most	O
commonly	O
implemented	O
on	O
4K	O
systems	O
,	O
such	O
as	O
the	O
Cosmac	B-Device
VIP	I-Device
and	O
the	O
Telmac	B-Device
1800	I-Device
.	O
</s>
<s>
These	O
machines	O
had	O
4096	O
(	O
0x1000	O
)	O
memory	O
locations	O
,	O
all	O
of	O
which	O
are	O
8	O
bits	O
(	O
a	O
byte	B-Application
)	O
which	O
is	O
where	O
the	O
term	O
CHIP-8	B-Device
originated	O
.	O
</s>
<s>
However	O
,	O
the	O
CHIP-8	B-Device
interpreter	B-Application
itself	O
occupies	O
the	O
first	O
512	O
bytes	B-Application
of	O
the	O
memory	O
space	O
on	O
these	O
machines	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
most	O
programs	B-Application
written	O
for	O
the	O
original	O
system	O
begin	O
at	O
memory	O
location	O
512	O
(	O
0x200	O
)	O
and	O
do	O
not	O
access	O
any	O
of	O
the	O
memory	O
below	O
the	O
location	O
512	O
(	O
0x200	O
)	O
.	O
</s>
<s>
The	O
uppermost	O
256	O
bytes	B-Application
(	O
0xF00-0xFFF	O
)	O
are	O
reserved	O
for	O
display	O
refresh	O
,	O
and	O
the	O
96	O
bytes	B-Application
below	O
that	O
(	O
0xEA0-0xEFF	O
)	O
were	O
reserved	O
for	O
the	O
call	B-General_Concept
stack	I-General_Concept
,	O
internal	O
use	O
,	O
and	O
other	O
variables	O
.	O
</s>
<s>
In	O
modern	O
CHIP-8	B-Device
implementations	O
,	O
where	O
the	O
interpreter	B-Application
is	O
running	O
natively	O
outside	O
the	O
4K	O
memory	O
space	O
,	O
there	O
is	O
no	O
need	O
to	O
avoid	O
the	O
lower	O
512	O
bytes	B-Application
of	O
memory	O
(	O
0x000-0x1FF	O
)	O
,	O
and	O
it	O
is	O
common	O
to	O
store	O
font	O
data	O
there	O
.	O
</s>
<s>
CHIP-8	B-Device
has	O
16	O
8-bit	O
data	O
registers	B-General_Concept
named	O
V0	O
to	O
VF	O
.	O
</s>
<s>
In	O
an	O
addition	O
operation	O
,	O
VF	O
is	O
the	O
carry	B-General_Concept
flag	I-General_Concept
,	O
while	O
in	O
subtraction	O
,	O
it	O
is	O
the	O
"	O
no	O
borrow	O
"	O
flag	O
.	O
</s>
<s>
In	O
the	O
draw	O
instruction	O
VF	O
is	O
set	O
upon	O
pixel	B-Algorithm
collision	O
.	O
</s>
<s>
The	O
address	B-General_Concept
register	I-General_Concept
,	O
which	O
is	O
named	O
I	O
,	O
is	O
12	O
bits	O
wide	O
and	O
is	O
used	O
with	O
several	O
opcodes	B-Language
that	O
involve	O
memory	O
operations	O
.	O
</s>
<s>
The	O
stack	B-General_Concept
is	O
only	O
used	O
to	O
store	O
return	O
addresses	O
when	O
subroutines	O
are	O
called	O
.	O
</s>
<s>
The	O
original	O
RCA	B-General_Concept
1802	I-General_Concept
version	O
allocated	O
48	O
bytes	B-Application
for	O
up	O
to	O
12	O
levels	O
of	O
nesting	O
;	O
modern	O
implementations	O
usually	O
have	O
more	O
.	O
</s>
<s>
CHIP-8	B-Device
has	O
two	O
timers	O
.	O
</s>
<s>
Input	O
is	O
done	O
with	O
a	O
hex	O
keyboard	B-Device
that	O
has	O
16	O
keys	O
ranging	O
0	O
to	O
F	O
.	O
The	O
'	O
8	O
 '	O
,	O
'	O
4	O
 '	O
,	O
'	O
6	O
 '	O
,	O
and	O
'	O
2	O
 '	O
keys	O
are	O
typically	O
used	O
for	O
directional	O
input	O
.	O
</s>
<s>
Three	O
opcodes	B-Language
are	O
used	O
to	O
detect	O
input	O
.	O
</s>
<s>
The	O
third	O
waits	O
for	O
a	O
key	O
press	O
,	O
and	O
then	O
stores	O
it	O
in	O
one	O
of	O
the	O
data	O
registers	B-General_Concept
.	O
</s>
<s>
Original	O
CHIP-8	B-Device
Display	B-General_Concept
resolution	I-General_Concept
is	O
64×32	O
pixels	B-Algorithm
,	O
and	O
color	O
is	O
monochrome	O
.	O
</s>
<s>
Graphics	O
are	O
drawn	O
to	O
the	O
screen	O
solely	O
by	O
drawing	O
sprites	O
,	O
which	O
are	O
8	O
pixels	B-Algorithm
wide	O
and	O
may	O
be	O
from	O
1	O
to	O
15	O
pixels	B-Algorithm
in	O
height	O
.	O
</s>
<s>
Sprite	O
pixels	B-Algorithm
are	O
XOR	B-Application
'd	O
with	O
corresponding	O
screen	O
pixels	B-Algorithm
.	O
</s>
<s>
In	O
other	O
words	O
,	O
sprite	O
pixels	B-Algorithm
that	O
are	O
set	O
flip	O
the	O
color	O
of	O
the	O
corresponding	O
screen	O
pixel	B-Algorithm
,	O
while	O
unset	O
sprite	O
pixels	B-Algorithm
do	O
nothing	O
.	O
</s>
<s>
The	O
carry	B-General_Concept
flag	I-General_Concept
(	O
VF	O
)	O
is	O
set	O
to	O
1	O
if	O
any	O
screen	O
pixels	B-Algorithm
are	O
flipped	O
from	O
set	O
to	O
unset	O
when	O
a	O
sprite	O
is	O
drawn	O
and	O
set	O
to	O
0	O
otherwise	O
.	O
</s>
<s>
CHIP-8	B-Device
has	O
35	O
opcodes	B-Language
,	O
which	O
are	O
all	O
two	O
bytes	B-Application
long	O
and	O
stored	O
big-endian	O
.	O
</s>
<s>
The	O
opcodes	B-Language
are	O
listed	O
below	O
,	O
in	O
hexadecimal	O
and	O
with	O
the	O
following	O
symbols	O
:	O
</s>
<s>
There	O
have	O
been	O
many	O
implementations	O
of	O
the	O
CHIP-8	B-Device
instruction	O
set	O
since	O
1978	O
.	O
</s>
<s>
The	O
following	O
specification	O
is	O
based	O
on	O
the	O
SUPER-CHIP	O
specification	O
from	O
1991	O
(	O
but	O
without	O
the	O
additional	O
opcodes	B-Language
that	O
provide	O
extended	O
functionality	O
)	O
,	O
as	O
that	O
is	O
the	O
most	O
commonly	O
encountered	O
extension	O
set	O
today	O
.	O
</s>
<s>
Footnotes	O
denote	O
incompatibilities	O
with	O
the	O
original	O
CHIP-8	B-Device
instruction	O
set	O
from	O
1978	O
.	O
</s>
<s>
OpcodeTypeC	O
PseudoExplanation	O
Calls	O
machine	O
code	O
routine	O
(	O
RCA	B-General_Concept
1802	I-General_Concept
for	O
COSMAC	B-Device
VIP	I-Device
)	O
at	O
address	O
NNN	O
.	O
</s>
<s>
Adds	O
NN	O
to	O
VX	O
(	O
carry	B-General_Concept
flag	I-General_Concept
is	O
not	O
changed	O
)	O
.	O
</s>
<s>
(	O
bitwise	O
AND	O
operation	O
)	O
Sets	O
VX	O
to	O
VX	O
xor	B-Application
VY	O
.	O
</s>
<s>
Draws	O
a	O
sprite	O
at	O
coordinate	O
(	O
VX	O
,	O
VY	O
)	O
that	O
has	O
a	O
width	O
of	O
8	O
pixels	B-Algorithm
and	O
a	O
height	O
of	O
N	O
pixels	B-Algorithm
.	O
</s>
<s>
Each	O
row	O
of	O
8	O
pixels	B-Algorithm
is	O
read	O
as	O
bit-coded	O
starting	O
from	O
memory	O
location	O
I	O
;	O
I	O
value	O
does	O
not	O
change	O
after	O
the	O
execution	O
of	O
this	O
instruction	O
.	O
</s>
<s>
As	O
described	O
above	O
,	O
VF	O
is	O
set	O
to	O
1	O
if	O
any	O
screen	O
pixels	B-Algorithm
are	O
flipped	O
from	O
set	O
to	O
unset	O
when	O
the	O
sprite	O
is	O
drawn	O
,	O
and	O
to	O
0	O
if	O
that	O
does	O
not	O
happen	O
.	O
</s>
