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 / 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
// 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] = {
"""
NES CHR direct loading
( experiment in tiled + python )
based on https://github.com/samhocevar/tiled-pico8 by Sam Hocevar
"""
import tiled as T
import base64
PALETTE = [
(0x00, 0x00, 0x00), # black
from PIL import Image, ImageSequence
import array as arr
#assume gif is 4 colors ( and the 1st 4 )
#assume gif is 128x128
def frame2nes(input,basename,index):
(w, h) = input.size
# parse image by 8x8's
outname = basename + "_" + str(index) + ".chr"
from PIL import Image, ImageSequence, ImageDraw
import os
import array as arr
import sys
# chops up a gif into NES or (C64 sprites)
# you can define the master block size, for example 32x32
# will try and generate an optimal data set including meta information ( for NES )
##########################################################################################################################
// Windows
// gcc c6.c tigr\tigr.c -I tigr -lopengl32 -lgdi32 -Os -s -o c6.exe
// Linux
// gcc c6.c tigr\tigr.c -I tigr -lGLU -lGL -lX11 -Os -s -o c6.exe
// OSX
// gcc c6.c tigr\tigr.c -I tigr -framework OpenGL -framework Cocoa -Os -s -o c6.exe
// using Tigr
// from https://github.com/erkkah/tigr
//-------------------------------------------------------------
// Simple example of a tasking system
//-------------------------------------------------------------
// we only write CODE and DATA ( not VTABLE or ZP )
.file [name="tasker.prg", segments="CODE,DATA"]
.segment ZP [start=$02] // doesn't get written to the prg
.segment CODE [start=$0801]
@JettMonstersGoBoom
JettMonstersGoBoom / cia.asm
Last active November 20, 2020 05:50
C64 CIA example with Kickasm
.file [name="test.prg", segments="CODE,DATA"]
.segment CODE [start=$0801]
.segment DATA [startAfter="CODE"]
// PAL
.label CPU_FREQ = $4cc8
VIC: {
.label RASTER = $d012
@JettMonstersGoBoom
JettMonstersGoBoom / c64_export.lua
Created December 2, 2020 00:19
Asesprite script to export chars from the current frame ( removing duplicates )
local byte = string.char
local binfile = nil
local map = {}
local images = { }
local output_message = ""
local errors = 0
--
-- seperate platform from code
--
local C64 = {
@JettMonstersGoBoom
JettMonstersGoBoom / sprspr.asm
Created December 18, 2020 00:31
Sprite Sprite Collision tester
.file [name="collision.prg", segments="CODE"]
.segment ZP [start=$02]
spr_spr: .byte 0
.segment CODE [start=$0801]
.segment CODE
BasicUpstart2(Start)