Skip to content

Instantly share code, notes, and snippets.

@intoinside
Created April 18, 2022 16:40
Show Gist options
  • Save intoinside/02b5838ae41c94d62486decadc46e6fb to your computer and use it in GitHub Desktop.
Save intoinside/02b5838ae41c94d62486decadc46e6fb to your computer and use it in GitHub Desktop.
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
sta $d018
lda #$d8 // 11011000 - 40cols, multicolor on
sta $d016
lda #$3b // 00111011 - 25 rows, screen on, bitmap mode on, ext bkg off
sta $D011
lda #0
sta $d020
lda #picture.getBackgroundColor()
sta $d021
ldx #0
!loop:
.for (var i=0; i<4; i++) {
lda colorRam+i*$100,x
sta $d800+i*$100,x
}
inx
bne !loop-
jmp *
*=$0c00; .fill picture.getScreenRamSize(), picture.getScreenRam(i)
*=$1c00; colorRam: .fill picture.getColorRamSize(), picture.getColorRam(i)
*=$2000; .fill picture.getBitmapSize(), picture.getBitmap(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment