Petit Computer Wiki
Advertisement
CHIP8

General Info
Genre(s): Miscellaneous
Contributor(s): SquareFingers
Release Date: September 27, 2014
Development Status: Stable
Version: 1.0.0
Size: 11944 B (12 KB)
Mode(s): Single-Player
Language(s): English

A CHIP-8 emulator.

Instructions[]

Type the name of a set of CHIP-8 MEM files (more details below). Use the touchscreen for the CHIP-8 'keypad', or the buttons indicated on the touchscreen. Press START to load a new CHIP-8 MEM file. Press SELECT to exit.

Changelog[]

Version 1.0.0[]

  • Initial Release

Future Plans[]

(Maybe..) Process multiple 'keypad' keys down. Improve the interface. Make button-to-'keypad' map editable from within the emulator. Code SUPERCHIP instructions. Optimize.

Videos and Screenshots[]

No screenshots.

Download[]

CHIP8 v1-0-0

If the image above doesn't appear well on your computer screen, click it, and you should see another box in your browser. Move the mouse inside the box near the top and click "See full size image".

License[]

No license applied as of now.

Notes[]

This program will do nothing useful until it is given object code in the CHIP-8 language, in MEM files. The MEM filenames must all begin with "C8", followed by two hexadecimal digits (the first file in the sequence having "02", and subsequent files having subsequent numbers), followed by between one and four additional characters. The contents of each file is 256 bytes of CHIP-8 code, with fewer than 256 bytes in the last file (this means sometimes a MEM file containing the empty string is necessary to signify the end of the code). The last section of the filename, the one to four additional characters, is the 'name' of the file typed in at the beginning the program.

Here is a sample program to generate a MEM file from hexadecimal representation of the object file:

GEN8MAZE v1-0-0

More useful, though, is to give the listing:

'PRG:GEN8MAZE
'v 1.0.0
'Creates MEM files for CHIP-8 "MAZE"

CLEAR
N$="MAZE"
I=&H02
A$=""
@LOOP1
MEM$=""
@LOOP2
IF A$=="" THEN READ A$
IF LEFT$(A$,1)=="Z" GOTO @FINISH
MEM$=MEM$+CHR$(VAL("&H"+LEFT$(A$,2)))
A$=RIGHT$(A$,LEN(A$)-2)
@LOOP3
IF LEFT$(A$,1)==" " THEN A$=RIGHT$(A$,LEN(A$)-1):GOTO @LOOP3
IF LEN(MEM$)<256 THEN @LOOP2
SAVE "MEM:C8"+HEX$(I,2)+N$
I=I+1
GOTO @LOOP1

@FINISH
SAVE "MEM:C8"+HEX$(I,2)+N$
END

'MAZE
DATA "60 00 61 00 A2 22 C2 01 32 01 A2 1E D0 14 70 04"
DATA "30 40 12 04 60 00 71 04 31 20 12 04 12 1C 80 40"
DATA "20 10 20 40 80 10"
DATA "Z"

To generate more CHIP-8 MEM files, assign a new 1-to-4-character value to N$, replace the DATA with the object file (keeping DATA "Z" at the end), copy-and-paste it to PTCUtilities or

http://www2.u-netsurf.ne.jp/~ozawa/petitcom/petiteditor.html

and run the generated QR.

The emulator currently only handles one 'keypress' at a time: if multiple keys are pressed, only the lowest 'valued' one is recognized. This makes two-player games very unfair.

0F_ADD[]

NOTE: This is not the program

This QR is for adding this program to the 0FILES system. Scan it, run 0F_ADD once, and the program on this page will appear on the 0FILES list.

0F ADD CHIP8

Credits[]

Advertisement