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
@JettMonstersGoBoom
JettMonstersGoBoom / demo.s
Created June 23, 2019 16:42
MillFork C64 sample
const pointer screen_out = $5c00
const pointer chars_out = $6000
const pointer sprites_out = $4000
const pointer spritepointer = screen_out+$3f8
byte timer
byte frameoffset
void main () {
@JettMonstersGoBoom
JettMonstersGoBoom / display.s
Last active July 1, 2019 16:12
charpad display 6502 C64
; display a charpad data set
; 64tass.exe --cbm-prg autorun.s -o auto.prg
; note using ? doesn't take any room in the output
*=$10
source .word ?
dest .word ?
tempx .byte ?
screenChars = $3400 ; the 40x25 buffer
@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
; 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
import random
const word verareg=$9f20
byte verahi @verareg+0
byte veramid @verareg+1
byte veralo @verareg+2
byte veradat @verareg+3
word x16_irq_address @$0314
volatile byte vsync
void irq() {
vsync = 0
asm {
pla
tay
pla
tax
#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]];
-- 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},
// 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
@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