Skip to content

Instantly share code, notes, and snippets.

View JettMonstersGoBoom's full-sized avatar
💭
I may be slow to respond.

Jett JettMonstersGoBoom

💭
I may be slow to respond.
View GitHub Profile
// bytebytejump bytepusher implementation
// build with
// tcc bpush.c migr.dll
#include "migr.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern __declspec(dllimport) MIGR migr;
// fake wav chunk for 8bit pcm, just the header
signed char audio_buffer[368*2] = {
@JettMonstersGoBoom
JettMonstersGoBoom / unrle.as9
Last active July 26, 2020 01:41
6309 RLE decompressor
; packer from C64
; https://csdb.dk/release/?id=34685
; ldx #source_address
; ldy #dest_address
; jsr unrle6309
SUBROUTINE unrle6309
ldb #$00
; get byte
@JettMonstersGoBoom
JettMonstersGoBoom / c64.h
Created July 4, 2020 16:41
header file for easier working with C64 and VBCC
/* useful macros ( from cc65 ) */
#define POKE(addr,val) (*(unsigned char*) (addr) = (val))
#define POKEW(addr,val) (*(unsigned*) (addr) = (val))
#define PEEK(addr) (*(volatile unsigned char*) (addr))
#define PEEKW(addr) (*(unsigned*) (addr))
/* CIA1 */
#define cia1_pra 0xDC00
// build with
// millfork.exe -t c64 irq.mfk
import random
import c64_joy
import stdio
const byte VIC_25LINES = %00001000
const byte VIC_DISPLAY_ENABLED = %00010000
const byte VIC_BITMAP_ENABLED = %00100000
-- draw a mode7 style floor
scene = {x=10,y=10,z=140,hz=25,rot=0,spd=0}
-- fade table http://kometbomb.net/pico8/fadegen.html
local fadetable={
{0,0,129,129,129,129,1},
{1,1,1,1,1,1,1},
{2,2,133,133,133,1,1},
#include <stdio.h>
#include <string.h>
int encode_rle(unsigned char *src,int size,unsigned char *dst)
{
int stat[256];
int i,tag,sym,sym_prev,len,ptr;
// count how often each byte is used , to find an unused byte
memset(stat,0,sizeof(stat));
for(i=0;i<size;++i) ++stat[src[i]];
word x16_irq_address @$0314
volatile byte vsync
void irq() {
vsync = 0
asm {
pla
tay
pla
tax
import random
const word verareg=$9f20
byte verahi @verareg+0
byte veramid @verareg+1
byte veralo @verareg+2
byte veradat @verareg+3
; flip byte horizontally . 1bit
; ldx bytetoflip
; lda hiresFLIP,x
; a = flipped
hiresFLIP:
db $00, $80, $40, $C0, $20, $A0, $60, $E0, $10, $90, $50, $D0
db $30, $B0, $70, $F0, $08, $88, $48, $C8, $28, $A8, $68, $E8
db $18, $98, $58, $D8, $38, $B8, $78, $F8, $04, $84, $44, $C4
@JettMonstersGoBoom
JettMonstersGoBoom / pacman.mfk
Last active July 3, 2019 22:47
Pacman Millfork sample
//java -jar ..\..\millfork.jar pacman.mfk -s -g -o pacman -t pacman_machine
import random
byte watchdog @$50C0
word stack_address @$4fee
byte irqen @$5000
const pointer vidram = $4000
const word colram = $4400
const pointer sprtbase = $4ff0