Skip to content

Instantly share code, notes, and snippets.

💭
Programming is for AIs. Let's go shopping.

tomaes

  • Germany
View GitHub Profile
@tomaes
tomaes / blocktumble.txt
Last active Apr 20, 2019
a few notes on block tumble!
View blocktumble.txt
"Block Tumble!" is a humble Commodore 64 puzzle game from 1991 in 2KBytes; it features 56(!) levels.
Here are some random notes I took while poking around in memory...
observations:
- the level encoding is fixed: 18 Bytes x 56 = 1008 Bytes
- the level data starts at 0BF9 (in memory), or at 03FA (file offset)
- a better, flexible encoding of the level data should take around ~870 Bytes
(assuming a not-too-crowded field in most levels and on average at least 8 wall stones)
(also: discussing level encoding should be a separate post, as there are MANY options :))
@tomaes
tomaes / c64romandkernal.bas
Created Apr 20, 2019
A tiny program (with some fancy output) to detected a (classic) C64 OS/KERNAL and its version. Works on all(?) 8bit CBM machines.
View c64romandkernal.bas
0 c=-(peek(58504)=54): poke1024,.: k=-((peek(55296)and15)=14)
1 print"c64:"chr$(16*c+99),"kernal v3:"chr$(16*k+99)
@tomaes
tomaes / pico racer (c64)
Last active Apr 6, 2019
first version. ~300 byte commodore basic v2 (c64) mini game. use petcat and VICE to run on a pc. Or CBM studio. Or type it in like a man/woman/child/zombie/adventurous space person!
View pico racer (c64)
0 rem .-==: pico.racer :==-.
1 j=56320:p=1444:r=119:l=r+4:c=.001:printchr$(147)
2 w=peek(j):ifw=rthenx=x+1
3 ifw=lthenx=x-1
4 o=15+int(sin(m*.1)*3):ifm>20thens=s-(peek(p+x)=32)
5 pokep+x,81:printspc(o)"";:fori=0to5:ifrnd(0)>bthenprint":";:goto7
6 print" ";
7 next:pokep+x,66:m=m+1:b=b+c:prints:ifs<10thengoto2
8 print,"miles:";m
@tomaes
tomaes / oneliners.glsl
Last active Feb 11, 2019
shadertoy GLSL oneliners
View oneliners.glsl
// fragment shader one-liners
// note: some might break for timing reasons (iDate.a/iDate.w) and some for compatibility reasons ("f+=" on a Mac, f.e.)
//
// void mainImage( out vec4 f, vec2 p )
// and then...
// "flames (red)"
{f=vec4(p.x/p.y*mod(sin(p.x-iDate.a),.001*length(p-.9)),.2,.5,1.0);}
// "rain (small)"
@tomaes
tomaes / mem20.bas
Last active Oct 30, 2016
Short (eh) memory card game for the standard VIC20 (should work on all the 8-bit Commodore machines, I think...)
View mem20.bas
0 fori=.to7step2:m(i)=i+2:m(i+1)=i+2:next:r=1
1 forj=.to9:fori=.to7:a=int(rnd(.)*8):h=m(i):m(i)=m(a):m(a)=h:nexti,j
2 print"#:"r:fori=.to7:printi;chr$(63+(m(i)<0)):next
3 r=r+1:input"cards";a,b:if(a=b)or((m(a)orm(b))<0)goto3
5 printchr$(13)m(a)m(b)chr$(13):ifm(a)=m(b)thenm(a)=-m(a):m(b)=-m(b)
8 s=.:fori=.to7:s=s+m(i):next:if(s>-40)goto2
@tomaes
tomaes / conveyor belt (vic 20)
Created Oct 29, 2016
Speed and patterns can be tweaked a lot. Also works on the 64.
View conveyor belt (vic 20)
0 s$=right$(s$,63)+chr$(250.3-rnd(.)):?chr$(19)s$s$s$s$s$s$s$:goto
@tomaes
tomaes / heartcash.bas
Created Oct 29, 2016
A symbolic 3-liner game in symbolic instruction code (vic 20)
View heartcash.bas
0 v=38400:t=7680:c=164:m=50:h=211:printchr$(5):poke36879,127
1 o=((ti/m)and7)*m:geta$:x=x-(a$=" ")+(x=21)*21
2 ifpeek(t+o)<>83thenpokev+o,2:poket+o,c:?spc(x)chr$(h):goto1
@tomaes
tomaes / flatenthemout.pde
Last active Apr 11, 2016
Sierpinsky Carpet bömbing; stylish fractal things + parallax scrolling
View flatenthemout.pde
// PDE 3.02
// Sierpinski's Carpet bömbing (v3)
// updt: better, faster, interactive
PImage img = createImage(729,729, RGB);
void setup()
{
size( 729, 729, P2D ); //729 243 324
}
@tomaes
tomaes / p5test.js
Last active Apr 9, 2016
P5.js test port / conversion. Fast it is not. :/
View p5test.js
// Sierpinski's Carpet bömbing (v3)
// p5.js port (slow...)
var img;
function setup()
{
createCanvas( 729, 729, P2D ); //729 243 324
img = createImage(729,729, RGB);
}
@tomaes
tomaes / csrt.c
Created Mar 23, 2016
...turns out PDE is slower than expected; doing the same thing in c99 (-O3'ed) is an order of magnitude faster?
View csrt.c
// c99
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#define COUNT 200000000
#define RND_RANGE 200000000
You can’t perform that action at this time.