mirror of
https://github.com/irmen/prog8.git
synced 2024-10-19 07:23:56 +00:00
added plasma example
This commit is contained in:
parent
15d24d4308
commit
70bab76b36
@ -772,7 +772,7 @@ internal class AstChecker(private val program: Program,
|
|||||||
errors.err("bitwise operator can only be used on integer operands", expr.right.position)
|
errors.err("bitwise operator can only be used on integer operands", expr.right.position)
|
||||||
}
|
}
|
||||||
"<<", ">>" -> {
|
"<<", ">>" -> {
|
||||||
// for now, bit-shifts can only shift by a constant number
|
// for now, bit-shifts can only shift by a constant number TODO remove this restriction
|
||||||
val constRight = expr.right.constValue(program)
|
val constRight = expr.right.constValue(program)
|
||||||
if(constRight==null)
|
if(constRight==null)
|
||||||
errors.err("bit-shift can only be done by a constant number (for now)", expr.right.position)
|
errors.err("bit-shift can only be done by a constant number (for now)", expr.right.position)
|
||||||
|
Binary file not shown.
BIN
examples/compiled/plasma.prg
Normal file
BIN
examples/compiled/plasma.prg
Normal file
Binary file not shown.
@ -1,5 +1,4 @@
|
|||||||
%import c64lib
|
%import c64lib
|
||||||
%zeropage basicsafe
|
|
||||||
|
|
||||||
|
|
||||||
;/*****************************************************************************\
|
;/*****************************************************************************\
|
||||||
@ -22,10 +21,11 @@ main {
|
|||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
c64.COLOR = 1
|
c64.COLOR = 1
|
||||||
c64scr.print("creating charset...")
|
c64scr.print("creating charset...\n")
|
||||||
makechar()
|
makechar()
|
||||||
|
|
||||||
ubyte block = c64.CIA2PRA
|
ubyte block = c64.CIA2PRA
|
||||||
|
; ubyte v = c64.VMCSB
|
||||||
c64.CIA2PRA = (block & $FC) | (lsb(SCREEN1 >> 14) ^ $03)
|
c64.CIA2PRA = (block & $FC) | (lsb(SCREEN1 >> 14) ^ $03)
|
||||||
|
|
||||||
repeat {
|
repeat {
|
||||||
@ -34,6 +34,11 @@ main {
|
|||||||
doplasma(SCREEN2)
|
doplasma(SCREEN2)
|
||||||
c64.VMCSB = PAGE2
|
c64.VMCSB = PAGE2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; restore screen (if you want)
|
||||||
|
;c64.VMCSB = v
|
||||||
|
;c64.CIA2PRA = block
|
||||||
|
;c64scr.print("done!\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
; several variables outside of doplasma to make them retain their value
|
; several variables outside of doplasma to make them retain their value
|
||||||
@ -49,33 +54,32 @@ main {
|
|||||||
ubyte c1b = c1B
|
ubyte c1b = c1B
|
||||||
ubyte c2a = c2A
|
ubyte c2a = c2A
|
||||||
ubyte c2b = c2B
|
ubyte c2b = c2B
|
||||||
ubyte @zp i
|
ubyte @zp x
|
||||||
ubyte @zp ii
|
ubyte @zp y
|
||||||
|
|
||||||
for ii in 0 to 24 {
|
for y in 0 to 24 {
|
||||||
ybuf[ii] = sin8u(c1a) + sin8u(c1b)
|
ybuf[y] = sin8u(c1a) + sin8u(c1b)
|
||||||
c1a += 4
|
c1a += 4
|
||||||
c1b += 9
|
c1b += 9
|
||||||
}
|
}
|
||||||
c1A += 3
|
c1A += 3
|
||||||
c1B -= 5
|
c1B -= 5
|
||||||
for i in 0 to 39 {
|
for x in 0 to 39 {
|
||||||
xbuf[i] = sin8u(c2a) + sin8u(c2b)
|
xbuf[x] = sin8u(c2a) + sin8u(c2b)
|
||||||
c2a += 3
|
c2a += 3
|
||||||
c2b += 7
|
c2b += 7
|
||||||
}
|
}
|
||||||
c2A += 2
|
c2A += 2
|
||||||
c2B -= 3
|
c2B -= 3
|
||||||
for ii in 0 to 24 {
|
for y in 0 to 24 {
|
||||||
for i in 0 to 39 {
|
for x in 0 to 39 {
|
||||||
@(screen) = xbuf[i] + ybuf[ii]
|
@(screen) = xbuf[x] + ybuf[y]
|
||||||
screen++
|
screen++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub makechar() {
|
sub makechar() {
|
||||||
|
|
||||||
ubyte[8] bittab = [ $01, $02, $04, $08, $10, $20, $40, $80 ]
|
ubyte[8] bittab = [ $01, $02, $04, $08, $10, $20, $40, $80 ]
|
||||||
ubyte c
|
ubyte c
|
||||||
for c in 0 to 255 {
|
for c in 0 to 255 {
|
||||||
|
@ -7,20 +7,5 @@ main {
|
|||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
uword zz = $ee22
|
|
||||||
|
|
||||||
const uword SCREEN1 = $E000
|
|
||||||
const uword CHARSET = $E800
|
|
||||||
const ubyte PAGE1 = ((SCREEN1 >> 6) & $F0) | ((CHARSET >> 10) & $0E)
|
|
||||||
ubyte cmsb = msb(zz)
|
|
||||||
ubyte clsb = lsb(zz)
|
|
||||||
|
|
||||||
c64scr.print("\ncmsb=")
|
|
||||||
c64scr.print_ubhex(cmsb, false)
|
|
||||||
c64scr.print("\nclsb=")
|
|
||||||
c64scr.print_ubhex(clsb, false)
|
|
||||||
c64scr.print("\nPAGE1=")
|
|
||||||
ubyte p1 = PAGE1 ; TODO fix type error of PAGE1
|
|
||||||
c64scr.print_ubhex(PAGE1, false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user