Skip to content

Instantly share code, notes, and snippets.

View tobiasvl's full-sized avatar
🦀
Learning Rust

Tobias V. I. Langhoff tobiasvl

🦀
Learning Rust
View GitHub Profile
# switch/case macro, should be followed by a jump table with the same number of entries as cases
:macro switch REG {
v0 := REG
v0 <<= v0
:calc table { HERE + 10 }
# for Super-CHIP compatibility, we also load VX for use with jump0 where X is the upper digit of the table's address
# note that if the table is located at address 0xA00 or above, we'll clobber necessary registers here!
:calc table-reg { table >> 8 }
v9 := 0x9
v9 -= v0
@tobiasvl
tobiasvl / install_aseprite.sh
Last active May 5, 2024 21:44
The commands to build aseprite on Fedora
# Copied from https://github.com/aseprite/aseprite/blob/master/INSTALL.md#skia-on-linux
sudo yum install -y gcc-c++ cmake ninja-build libX11-devel libXcursor-devel mesa-libGL-devel fontconfig-devel
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone -b aseprite-m71 https://github.com/aseprite/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia

CHIP-8 extensions and compatibility

This document is intended as a well-sourced and exhaustive documentation of all extensions to CHIP-8. They all use the standard CHIP-8 interpreter as a base, mentioning what additions and changes they make to that common base.

This list is mostly for historical purposes; few of the extensions listed here had a considerable number of programs written for them. It could serve as a reference for CHIP-8 emulator/interpreter developers who want to support the various incompatible instructions and behaviors that have cropped up in different interpreters over the decades. Perhaps the instructions listed here can also inspire someone to make their own modern CHIP-8 extension (of which there have been a couple, see the bottom of the list).

A note on modern implementations

The only CHIP-8 extensions in active use today (beyond basic CHIP-8) are Super-CHIP 1.1 and the relative newcomer XO-CHIP.

: keys
0
1
2
3
4
5
6
7
8
poke(24364,3)w={10,11,8,2,12}o="★●♥◆✽"b={[0]=0,0,0,0,0,0}z=56h=6::_::add(b,ceil(rnd(5)))cls()j=6*(8-flr(z/8))-6
?"██",8*(h%6),z+8*flr(h/6),5
?t(),49,58
for q=0,j+6 do
u=abs(b[q])for i in all{1,6}do
if(q<j and(i>1or q%6>1)and u==abs(b[q-i])and u==abs(b[q-i*2])and u!=0)b[q-i]=-u b[q-i*2]=-u b[q]=-u
end
?sub(o,u,u),(q%6)*8,z+flr(q/6)*8,q<j and w[u]or 1
end
for q=0,j do
[
{
"backcolor": "#C2C3C7",
"name": "PICO-8 devkit keyboard",
"author": "tobiasvl",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx"
},
[
@tobiasvl
tobiasvl / neighboring_tiles.lua
Last active March 24, 2019 20:29
PICO-8 snippets
-- four directions, 16 tokens
for i=0,1,0.25 do
local x,y=cos(i),sin(i)
end
-- eight directions, 24 tokens
for i=0.125,1,0.125 do
local x,y=flr(cos(i)+.5),flr(sin(i)+.5)
end
z="lights out"poke(24364,3)::x::flip()cls()k=btnp()w={[0]="","▒","█"}f=flr
?z,12,18,stat(95)%4
?"z: classic\nx: 2000",12,32,7
if(k<9)goto x
if(k>16)w[3]="█"
b={}p=2m=0
for i=1,35 do
b[i]=i%7<2 and 0or 2
end::_::flip()cls()
?m,30,54
@tobiasvl
tobiasvl / fried_eggs.p8
Last active November 15, 2018 10:47 — forked from nucleartide/fried_eggs.p8
You thought you liked breakfast...
u=64
x,y=u,u
es={}c=circfill
f=abs
p=cos
o=sin::_::
if(btn(0))x-=1
if(btn(1))x+=1
if(btn(2))y-=1
if(btn(3))y+=1
@tobiasvl
tobiasvl / picochallenge.p8
Last active November 15, 2018 10:53
Patrick's Picochallenge
poke(24364,3)x="웃"v="▥"h="▤"b={}for i=1,36 do b[i]=i%9<2 and""or"█"end for i in all{"⬆️","➡️",h,"⬅️","⬇️",v,x}do repeat f=1+flr(rnd(36))until b[f]!=""b[f]=i
if(i==x)p=f
end::_::t=btnp cls()for i=0,35 do
k=b[i+1]
?k,i%9*8,6*flr(i/9)+20,k==x and 11 or 7
end b[p]=""q=p
if(t(0))q-=1
if(t(1))q+=1
if(t(2))q-=9
if(t(3))q+=9