Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement