SolChip8 is the first 100% on-chain Chip8 emulator smart contract where you can run chip8 games on EVM environment. CHIP-8 is an interpreted programming language, initially used on the 8-bit microcomputers made in the mid-1970s. blog post
forge install rkdud007/solchip8
- unified contract address start with 0xc8c8c8c8to represent chip8 by using CREATE2 contract usingcreate2deploycli tool
❯ cast create2 \
    --deployer 0x0000000000FFe8B47B3e2130213B802212439497 \
    --caller 0x0000000000000000000000000000000000000000 \
    --init-code-hash 614b9ac9323beeaffd9de369597fc476014aee6e350489c0601b5f47b1146334 \
    --starts-with c8c8c8c8| Chain | Chain ID | Contract | v0.0.1 | 
|---|---|---|---|
| Base mainnet | 8453 | Solchip8 | 0xc8c8c8c8421e85597881ae753d040449e81e528a | 
| Ethereum sepolia | 11155111 | Solchip8 | 0xc8c8c8c8421e85597881ae753d040449e81e528a | 
| Arbitrum sepolia | 421614 | Solchip8 | 0xc8c8c8c8421e85597881ae753d040449e81e528a | 
| Base sepolia | 84532 | Solchip8 | 0xc8c8c8c8421e85597881ae753d040449e81e528a | 
| Optimism sepolia | 11155420 | Solchip8 | 0xc8c8c8c8421e85597881ae753d040449e81e528a | 
| Odyssey testnet | 911867 | Solchip8 | 0xc8c8c8c81fd75f59103ded843a1082ce403885f4 | 
- A 64x32 monochrome display
- Sixteen 8-bit general purpose registers
- 4096 bytes of RAM
- Example ROM games from Chip-8 Games Pack
- Run demo with desktop
Tested here
| Opcode | Mnemonic | Description | 
|---|---|---|
| 0000 | NOP | Nothing | 
| 00E0 | CLS | Clear the display | 
| 00EE | RET | Return from a subroutine | 
| 1NNN | JP NNN | Jump to address NNN | 
| 2NNN | CALL NNN | Call subroutine at NNN | 
| 3XNN | SE Vx, NN | Skip next instruction if VxequalsNN | 
| 4XNN | SNE Vx, NN | Skip next instruction if Vxdoes not equalNN | 
| 5XY0 | SE Vx, Vy | Skip next instruction if VxequalsVy | 
| 6XNN | LD Vx, NN | Load value NNinto registerVx | 
| 7XNN | ADD Vx, NN | Add value NNto registerVx | 
| 8XY0 | LD Vx, Vy | Set Vxequal toVy | 
| 8XY1 | OR Vx, Vy | Set VxtoVxORVy | 
| 8XY2 | AND Vx, Vy | Set VxtoVxANDVy | 
| 8XY3 | XOR Vx, Vy | Set VxtoVxXORVy | 
| 8XY4 | ADD Vx, Vy | Add VytoVx, set VF to carry | 
| 8XY5 | SUB Vx, Vy | Subtract VyfromVx, set VF to NOT borrow | 
| 8XY6 | SHR Vx | Shift Vxright by 1, set VF to least significant bit | 
| 8XY7 | SUBN Vx, Vy | Set VxtoVyminusVx, set VF to NOT borrow | 
| 8XYE | SHL Vx | Shift Vxleft by 1, set VF to most significant bit | 
| 9XY0 | SNE Vx, Vy | Skip next instruction if Vxdoes not equalVy | 
| ANNN | LD I, NNN | Set Ito addressNNN | 
| BNNN | JP V0, NNN | Jump to address V0 + NNN | 
| CXNN | RND Vx, NN | Set Vxto random byte ANDNN | 
| DXYN | DRW Vx, Vy, N | Draw sprite at ( Vx,Vy) with heightN, set VF on collision | 
| EX9E | SKP Vx | Skip next instruction if key Vxis pressed | 
| EXA1 | SKNP Vx | Skip next instruction if key Vxis not pressed | 
| FX07 | LD Vx, DT | Set Vxto the value of the delay timer | 
| FX0A | LD Vx, K | Wait for a key press, store the value in Vx | 
| FX15 | LD DT, Vx | Set the delay timer to Vx | 
| FX18 | LD ST, Vx | Set the sound timer to Vx | 
| FX1E | ADD I, Vx | Add VxtoI | 
| FX29 | LD F, Vx | Set Ito the location of the sprite for digitVx | 
| FX33 | LD B, Vx | Store BCD representation of Vxin memory atI,I+1, andI+2 | 
| FX55 | LD [I], Vx | Store registers V0toVxin memory starting atI | 
| FX65 | LD Vx, [I] | Read registers V0toVxfrom memory starting atI | 
