Skip to content

Instantly share code, notes, and snippets.

View intoinside's full-sized avatar

Raffaele Intorcia intoinside

View GitHub Profile
@intoinside
intoinside / thread.asm
Created June 4, 2023 16:17
Short example for threading with c64 (KickAssembler)
*= $0801 "Basic Upstart"
BasicUpstart2(Entry)
* = * "Entry"
Entry: {
sei
lda #<context_switch
ldx #>context_switch
sta $0314
@intoinside
intoinside / write-sequential-data-from-disk.bas
Last active November 16, 2022 21:32
Basic program for sequential file write on disk, works on C128
1 rem write sequential data to disk with c128
10 dopen#1,"@seq test",w
20 for i=1 to 100
30 a$="record"+str$(i)
40 print#1,a$
50 print "writing ";a$
60 next
70 close 1
@intoinside
intoinside / read-sequential-data-from-disk.bas
Last active November 16, 2022 21:32
Basic program for sequential file read from disk, works on C128
1 rem read sequential data from disk with c128
10 dopen#1,"seq test"
20 for i=1 to 150
30 input#1,a$
40 print a$
50 next
60 close 1
@intoinside
intoinside / koala.asm
Created April 18, 2022 16:40
Script for koala image draw on screen
// Kla image can be generated from Png or JPG using this service:
// https://www.micheldebree.nl/retropixels/
.const KOALA_TEMPLATE = "C64FILE, Bitmap=$0000, ScreenRam=$1f40, ColorRam=$2328, BackgroundColor = $2710"
.var picture = LoadBinary("image.kla", KOALA_TEMPLATE)
*=$0801 "Basic Program"
BasicUpstart($0810)
*=$0810 "Program"
lda #$38 // 00111000 - bitmap $2000, Screenram $0c00
@intoinside
intoinside / CopyBit2OnBit1
Last active February 25, 2022 12:38
Some code snippet for copy bit #2 to bit #1. Can be extended to copy bit #x to bit #x-1
// First (worst) version
lda c64lib.SPRITE_MSB_X // 3by + 4cy
and #%00000100 // 2by + 2cy
beq SetBitToZero // 2by + 2cy
lda c64lib.SPRITE_MSB_X // 3by + 4cy
ora #%00000010 // 2by + 2cy
jmp !+ // 3by + 3cy
SetBitToZero:
lda c64lib.SPRITE_MSB_X // 3by + 4cy
@intoinside
intoinside / treefall.asm
Created January 16, 2022 18:06
C64 routine in assembly to play a tree fall fx
SID: {
.label VOICE1_FREQ_1 = $d400
.label VOICE1_FREQ_2 = $d401
.label VOICE1_CTRL = $d404
.label VOICE1_ATTACK_DECAY = $d405
.label VOICE1_SUSTAIN_RELEASE = $d406
.label VOLUME_FILTER_MODES = $d418
}