Chip8
   HOME

TheInfoList



OR:

CHIP-8 is an interpreted
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
, developed by
Joseph Weisbecker Joseph A. Weisbecker (September 4, 1932 – November 15, 1990) was an early microprocessor and microcomputer researcher, as well as a gifted writer and designer of toys and games. He was a recipient of the David Sarnoff award for outstanding tech ...
made on his
1802 Events January–March * January 5 – Thomas Bruce, 7th Earl of Elgin, British ambassador to the Ottoman Empire, begins removal of the Elgin Marbles from the Parthenon in Athens, claiming they were at risk of destruction during the O ...
Microprocessor. It was initially used on the COSMAC VIP and Telmac 1800 8-bit microcomputers in the mid-1970s. CHIP-8 programs are run on a CHIP-8
virtual machine In computing, a virtual machine (VM) is the virtualization/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized h ...
. It was made to allow
video game Video games, also known as computer games, are electronic games that involves interaction with a user interface or input device such as a joystick, controller, keyboard, or motion sensing device to generate visual feedback. This fee ...
s to be more easily programmed for these computers. The simplicity of CHIP-8, and its long history and popularity, has ensured that CHIP-8 emulators and programs are still being made to this day. Roughly fifteen years after CHIP-8 was introduced, derived interpreters appeared for some models of
graphing calculator A graphing calculator (also graphics calculator or graphic display calculator) is a handheld computer that is capable of plotting graphs, solving simultaneous equations, and performing other tasks with variables. Most popular graphing calcu ...
s (from the late 1980s onward, these handheld devices in many ways have more computing power than most mid-1970s microcomputers for hobbyists). An active community of users and developers existed in the late 1970s, beginning with ARESCO's "VIPer" newsletter whose first three issues revealed the machine code behind the CHIP-8 interpreter.


CHIP-8 applications

There are a number of classic video games ported to CHIP-8, such as ''
Pong ''Pong'' is a table tennis–themed twitch arcade sports video game, featuring simple two-dimensional graphics, manufactured by Atari and originally released in 1972. It was one of the earliest arcade video games; it was created by Allan Al ...
'', ''
Space Invaders is a 1978 shoot 'em up arcade game developed by Tomohiro Nishikado. It was manufactured and sold by Taito in Japan, and licensed to the Midway division of Bally for overseas distribution. ''Space Invaders'' was the first fixed shooter an ...
'', ''
Tetris ''Tetris'' (russian: link=no, Тетрис) is a puzzle video game created by Soviet software engineer Alexey Pajitnov in 1984. It has been published by several companies for multiple platforms, most prominently during a dispute over the appro ...
'', and '' Pac-Man''. There are also applications like a random maze generator and
Conway's Game of Life The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no furthe ...
.


CHIP-8 extensions and variations

During the 1970s and 1980s, CHIP-8 users shared CHIP-8 programs, but also changes and extensions to the CHIP-8 interpreter, in the COSMAC VIP users' newsletter, VIPER magazine. These extensions included CHIP-10 and Hi-Res CHIP-8, which introduced a higher resolution than the standard 64x32, and CHIP-8C and CHIP-8X, which extended the monochrome display capabilities to support limited color, among other features. These extensions were mostly backwards compatible, as they were based on the original interpreter, although some repurposed rarely used opcodes for new instructions. In 1979, Electronics Australia ran a series of articles on building a kit computer similar to the COSMAC VIP, based on the
Motorola 6800 The 6800 ("''sixty-eight hundred''") is an 8-bit microprocessor designed and first manufactured by Motorola in 1974. The MC6800 microprocessor was part of the M6800 Microcomputer System (latter dubbed ''68xx'') that also included serial and para ...
architecture. This computer, the DREAM 6800, came with its own version of CHIP-8. A newsletter similar to VIPER, called DREAMER, was used to share CHIP-8 games for this interpreter. In 1981,
Electronics Today International ''Electronics Today International'' or ETI was a magazine for electronics hobbyists and professionals. Originally started in Australia in April 1971, ''ETI'' was published in the UK in 1972. From there, it expanded to various European countrie ...
(ETI) ran a series of articles on building a computer, the ETI-660, which also was very similar to the VIP (and used the same microprocessor). ETI ran regular ETI-660 and general CHIP-8 columns until 1985. In 1990, a CHIP-8 interpreter called CHIP-48 was made for
HP-48 The HP 48 is a series of graphing calculators designed and produced by Hewlett-Packard from 1990 until 2003. The series includes the HP 48S, HP 48SX, HP 48G, HP 48GX, and HP 48G+, the G models being expanded and im ...
graphing calculator A graphing calculator (also graphics calculator or graphic display calculator) is a handheld computer that is capable of plotting graphs, solving simultaneous equations, and performing other tasks with variables. Most popular graphing calcu ...
s so games could be programmed more easily. Erik Bryntse later created another interpreter based on CHIP-48, called SCHIP, S-CHIP or Super-Chip. SCHIP extended the CHIP-8 language with a larger resolution and several additional opcodes meant to make programming easier. If it were not for the development of the CHIP-48 interpreter, CHIP-8 would not be as well known today. David Winter's emulator, disassembler, and extended technical documentation popularized CHIP-8/SCHIP on many other platforms. It laid out a complete list of undocumented opcodes and features, and was distributed across many hobbyist forums. Many emulators used these works as a starting point. However, CHIP-48 subtly changed the semantics of a few of the opcodes, and SCHIP continued to use those new semantics in addition to changing other opcodes. Many online resources about CHIP-8 propagate these new semantics, so many modern CHIP-8 games are not backwards compatible with the original CHIP-8 interpreter for the COSMAC VIP, even if they do not specifically use the new SCHIP extensions.


CHIP-8 today

There is a CHIP-8 implementation for almost every platform, as well as some development tools. Games are still being developed and cataloged for CHIP-8 today, in addition to older games resurfacing online in digital archives. While CHIP-8 and SCHIP have commonly been implemented as
emulator In computing, an emulator is hardware or software that enables one computer system (called the ''host'') to behave like another computer system (called the ''guest''). An emulator typically enables the host system to run software or use pe ...
s, a pure hardware implementation (written in the
Verilog Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits at the register-transfer level of abstraction. It is als ...
language) also exists for certain FPGA boards.


Virtual machine description


Memory

CHIP-8 was most commonly implemented on 4K systems, such as the Cosmac VIP and the Telmac 1800. These machines had 4096 (0x1000) memory locations, all of which are 8 bits (a
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable uni ...
) which is where the term CHIP-8 originated. However, the CHIP-8 interpreter itself occupies the first 512 bytes of the memory space on these machines. For this reason, most programs written for the original system begin at memory location 512 (0x200) and do not access any of the memory below the location 512 (0x200). The uppermost 256 bytes (0xF00-0xFFF) are reserved for display refresh, and the 96 bytes below that (0xEA0-0xEFF) were reserved for the call stack, internal use, and other variables. In modern CHIP-8 implementations, where the interpreter is running natively outside the 4K memory space, there is no need to avoid the lower 512 bytes of memory (0x000-0x1FF), and it is common to store font data there.


Registers

CHIP-8 has 16 8-
bit The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represente ...
data registers named V0 to VF. The VF register doubles as a flag for some instructions; thus, it should be avoided. In an addition operation, VF is the
carry flag In computer processors the carry flag (usually indicated as the C flag) is a single bit in a system status register/flag register used to indicate when an arithmetic carry or borrow has been generated out of the most significant arithmetic l ...
, while in subtraction, it is the "no borrow" flag. In the draw instruction VF is set upon pixel collision. The address register, which is named I, is 12 bits wide and is used with several opcodes that involve memory operations.


The stack

The stack is only used to store return addresses when subroutines are called. The original
RCA 1802 The COSMAC (Complementary Symmetry Monolithic Array Computer) is an 8-bit microprocessor family introduced by RCA. It is historically notable as the first CMOS microprocessor. The first production model was the two-chip CDP1801R and CDP1801U, wh ...
version allocated 48 bytes for up to 12 levels of nesting; modern implementations usually have more.


Timers

CHIP-8 has two timers. They both count down at 60
hertz The hertz (symbol: Hz) is the unit of frequency in the International System of Units (SI), equivalent to one event (or cycle) per second. The hertz is an SI derived unit whose expression in terms of SI base units is s−1, meaning that o ...
, until they reach 0. *Delay timer: This timer is intended to be used for timing the events of games. Its value can be set and read. *Sound timer: This timer is used for sound effects. When its value is nonzero, a beeping sound is made.


Input

Input is done with a hex
keyboard Keyboard may refer to: Text input * Keyboard, part of a typewriter * Computer keyboard ** Keyboard layout, the software control of computer keyboards and their mapping ** Keyboard technology, computer keyboard hardware and firmware Music * Musi ...
that has 16 keys ranging 0 to F. The '8', '4', '6', and '2' keys are typically used for directional input. Three opcodes are used to detect input. One skips an instruction if a specific key is pressed, while another does the same if a specific key is ''not'' pressed. The third waits for a key press, and then stores it in one of the data registers.


Graphics and sound

Original CHIP-8
Display resolution The display resolution or display modes of a digital television, computer monitor or display device is the number of distinct pixels in each dimension that can be displayed. It can be an ambiguous term especially as the displayed resolution ...
is 64×32
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the ...
s, and color is
monochrome A monochrome or monochromatic image, object or palette is composed of one color (or values of one color). Images using only shades of grey are called grayscale (typically digital) or black-and-white (typically analog). In physics, monochrom ...
. Graphics are drawn to the screen solely by drawing sprites, which are 8 pixels wide and may be from 1 to 15 pixels in height. Sprite pixels are XOR'd with corresponding screen pixels. In other words, sprite pixels that are set flip the color of the corresponding screen pixel, while unset sprite pixels do nothing. The carry flag (VF) is set to 1 if any screen pixels are flipped from set to unset when a sprite is drawn and set to 0 otherwise. This is used for collision detection. As previously described, a beeping sound is played when the value of the sound timer is nonzero.


Opcode table

CHIP-8 has 35 opcodes, which are all two bytes long and stored
big-endian In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most sig ...
. The opcodes are listed below, in hexadecimal and with the following symbols: *NNN: address *NN: 8-bit constant *N: 4-bit constant *X and Y: 4-bit register identifier *PC : Program Counter *I : 16bit register (For memory address) (Similar to void pointer); *VN: One of the 16 available variables. N may be 0 to F (hexadecimal); There have been many implementations of the CHIP-8 instruction set since 1978. The following specification is based on the SUPER-CHIP specification from 1991 (but without the additional opcodes that provide extended functionality), as that is the most commonly encountered extension set today. Footnotes denote incompatibilities with the original CHIP-8 instruction set from 1978.


Notes


References

{{Reflist


Further reading

* "RCA COSMAC VIP CDP18S711 Instruction Manual," RCA Solid State Division, Somerville, NJ 08776, February 1978. Part VIP-311. pp. 13–18, 35–37. *
BYTE magazine ''Byte'' (stylized as ''BYTE'') was a microcomputer magazine, influential in the late 1970s and throughout the 1980s because of its wide-ranging editorial coverage. "''Byte'' magazine, the leading publication serving the homebrew market ..." '' ...

December 1978
pp. 108–122. "An Easy Programming System," by
Joseph Weisbecker Joseph A. Weisbecker (September 4, 1932 – November 15, 1990) was an early microprocessor and microcomputer researcher, as well as a gifted writer and designer of toys and games. He was a recipient of the David Sarnoff award for outstanding tech ...
. Describes CHIP-8 with specific example of a rocketship and UFO shooting-gallery game. *Archive o
Chip8.com
Website dedicated to CHIP-8 and related systems. Maintains the most complete collection of CHIP-8 programs on the net.

an accurate reference to the original CHIP-8 instruction set
David Winter's CHIP-8
Emulator, utilities and games.
BytePusher
A minimalist virtual machine inspired by the CHIP-8.
RCA COSMAC group on Yahoo
with authorized scans of the VIPER magazine.
OChip8
A CHIP-8 emulator in a browser

The popular Dream 6800 Microcomputer featured in Electronics Australia in 1979 ran CHIP-8.
FPGA SuperChip
A Verilog implementation of the SCHIP specification.
Octo
is an Online CHIP-8 IDE, Development System, Compiler/Assembler and Emulator, with a proprietary scripting language
Cowgod's Chip-8
Technical Reference (CHIP-48/SCHIP)
Matt Mikolay ''CHIP-8 Extensions Reference''''CHIP-8.com''
CHIP-8 Classic Computer Manual Virtual machines Virtualization software CHIP-8 Graphing calculator software