Skip to content

Instantly share code, notes, and snippets.

@sasq64
Created June 4, 2020 09:35
Show Gist options
  • Save sasq64/09d8470a3127652e2491eedc18293b31 to your computer and use it in GitHub Desktop.
Save sasq64/09d8470a3127652e2491eedc18293b31 to your computer and use it in GitHub Desktop.
; C64 Koala viewer
!macro VicAdr(adr) {
!assert (adr & 0x3fff) == 0
lda #((~adr)&0xffff)>>14
sta $dd00
}
!macro BitmapAndScreen(bm_offs, scr_offs) {
!assert (bm_offs & 0xdfff) == 0
!assert (scr_offs & 0xc3ff) == 0
.bits0 = (bm_offs>>10)
.bits1 = (scr_offs>>6)
lda #.bits0 | .bits1
sta $d018
}
!section "main", 0x801
!byte $0b, $08,$01,$00,$9e,str(start)," BY SASQ", $00,$00,$00
start:
sei
ldx #$00
- lda colors,x
sta $d800,x
lda colors+$100,x
sta $d900,x
lda colors+$200,x
sta $dA00,x
lda colors+$2e8,x
sta $dae8,x
inx
bne -
VicAdr(0x0000)
BitmapAndScreen(0x2000, 0x1000)
lda #$18
sta $d016
lda #$3b
sta $d011
lda #bg_color
sta $d020
sta $d021
jmp *
koala = Load("archmage.koa")
bitmap = koala[2:0x1f42]
screen_ram = koala[0x1f42:0x232a]
color_ram = koala[0x232a:0x2712]
bg_color = koala[0x2712]
colors:
!block color_ram
screen:
!section "screen", 0x1000
!block screen_ram
!section "koala", 0x2000
!block bitmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment