Skip to content

Instantly share code, notes, and snippets.

@JettMonstersGoBoom
Last active September 13, 2019 04:05
Show Gist options
  • Save JettMonstersGoBoom/e2bddd5c98b092f87b44966c372cacee to your computer and use it in GitHub Desktop.
Save JettMonstersGoBoom/e2bddd5c98b092f87b44966c372cacee to your computer and use it in GitHub Desktop.
import random
const word verareg=$9f20
byte verahi @verareg+0
byte veramid @verareg+1
byte veralo @verareg+2
byte veradat @verareg+3
byte veradat2 @verareg+4
byte veractl @verareg+5
byte veraien @verareg+6
byte veraisr @verareg+7
#if 0
lda #$14 ; $40040
sta verahi
lda #$40
sta veralo
lda #1
sta veradat ; VGA output
#endif
const byte LAYER_ENABLE = 1
const byte TM_BPP1_16=(0<<5)
const byte TM_BPP1_256=(1<<5)
const byte TM_BPP2=(2<<5)
const byte TM_BPP4=(3<<5)
const byte TM_BPP8=(4<<5)
const byte BM_BPP2=(5<<5)
const byte BM_BPP4=(6<<5)
const byte BM_BPP8=(7<<5)
const byte TILEW8=0
const byte TILEW16=(1<<5)
const byte TILEH8=0
const byte TILEH16=(1<<4)
const byte MAPW32=(0)
const byte MAPW64=(1)
const byte MAPW128=(2)
const byte MAPW256=(3)
const byte MAPH32=(0<<2)
const byte MAPH64=(1<<2)
const byte MAPH128=(2<<2)
const byte MAPH256=(3<<2)
void to_vera(pointer source,byte count) {
byte c,x
for c,0,until,count {
for x,0,until,256 {
veradat=source[x]
}
source.hi+=1
}
}
void to_veratm8(pointer source,byte count) {
byte c,x
for c,0,until,count {
for x,0,until,256 {
veradat=source[x]
veradat=0
}
source.hi+=1
}
}
void set_vera8(byte count,byte value) {
byte c,x
for c,0,until,count {
for x,0,until,256 {
veradat=value
}
}
}
void set_vera16(byte count,word value) {
byte c,x
for c,0,until,count {
for x,0,until,256 {
veradat=value.lo
veradat=value.hi
}
}
}
void inc_vera16(byte count,word value) {
byte c,x
for c,0,until,count {
for x,0,until,256 {
veradat=value.lo & $f
veradat=value.hi
value+=1
}
}
}
void tilemode() {
// actually $4000
verahi = $10
veramid = $40
veralo = $00
to_vera(tileset,14)
// $0000
verahi = $10
veramid = $00
to_vera(tilemap,8)
// $40200
verahi = $14
veramid = $02
to_vera(palette,2)
// layer 0 regs at $40000
verahi = $14
veramid = 0
veradat = TM_BPP8 | LAYER_ENABLE
veradat = TILEW16 | TILEH16
veradat = 0
veradat = 0
veradat = $00 // tile_base
veradat = $10 // tile_base
}
void main() {
word hscroll
byte c,x
veractl = 0
verahi = $14
veramid = 0
veralo = $40
veradat = $1 // vga
// x & y scale
veralo=$41
veradat = 64
veradat = 64
tilemode()
while true {
verahi = $14
veramid = 0
veralo = 6
veradat = hscroll.lo
veradat = hscroll.hi
hscroll+=1
for c,0,until,9 {
for x,0,until,256 {
asm {
nop
}
}
}
}
}
array tilemap=file("x16-demo-master/mode4-tilemap.bin")
array tileset=file("x16-demo-master/mode4-tiles.bin")
array palette=file("x16-demo-master/mode4-palette.bin")
; Commander16
[compilation]
arch=cmos ; 65c02
encoding=petscii
screen_encoding=petscr
; modules to load, borrow the basic loader from CBM 64
modules=loader_0801
; optionally: default flags
[allocation]
; list of free zp pointer locations (these assume that some BASIC routines will keep working)
zp_pointers=$2-$ff
segments=default
default_code_segment=default
segment_default_start=$80D
segment_default_codeend=$9fff
segment_default_datastart=after_code
segment_default_end=$cfff
[define]
CBM=1
X16=1
WIDESCREEN=1
KEYBOARD=1
JOYSTICKS=1
HAS_BITMAP_MODE=1
[output]
style=single
format=startaddr,allocated
extension=prg
labels=vice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment