Browse Source

simple ram blitter example

pixelbath 3 years ago
parent
commit
f89e368667
1 changed files with 52 additions and 0 deletions
  1. 52 0
      blitstuff.lua

+ 52 - 0
blitstuff.lua

@@ -0,0 +1,52 @@
+-- title:  blit ram to video
+-- author: pixelbath
+-- desc:   blit ram to video, one byte at a time
+-- script: lua
+
+t=0
+base_addr= 0x4000
+base_vram= 0x0000
+
+function blit_random()
+	base_addr=math.floor(math.random()*0x14000)+0x4000
+end
+
+function TIC()
+
+	if btn(4) then blit_random() end
+
+	if t>32639 then
+		cls(0)
+	end
+	
+	local offset=t%32640
+	poke(base_vram+offset, peek(base_addr+offset))
+	
+	t=t+1
+end
+
+-- <TILES>
+-- 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
+-- 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
+-- 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
+-- 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
+-- 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
+-- 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
+-- 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
+-- 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
+-- </TILES>
+
+-- <WAVES>
+-- 000:00000000ffffffff00000000ffffffff
+-- 001:0123456789abcdeffedcba9876543210
+-- 002:0123456789abcdef0123456789abcdef
+-- </WAVES>
+
+-- <SFX>
+-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
+-- </SFX>
+
+-- <PALETTE>
+-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
+-- </PALETTE>
+