From 70bab76b365ca29ed3eb9a375b017bf24e4db59b Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 21 Aug 2020 17:44:44 +0200 Subject: [PATCH] added plasma example --- .../src/prog8/ast/processing/AstChecker.kt | 2 +- examples/compiled/examples.d64 | Bin 174848 -> 174848 bytes examples/compiled/plasma.prg | Bin 0 -> 1260 bytes examples/plasma.p8 | 28 ++++++++++-------- examples/test.p8 | 15 ---------- 5 files changed, 17 insertions(+), 28 deletions(-) create mode 100644 examples/compiled/plasma.prg diff --git a/compiler/src/prog8/ast/processing/AstChecker.kt b/compiler/src/prog8/ast/processing/AstChecker.kt index 8add048d6..6e394d38d 100644 --- a/compiler/src/prog8/ast/processing/AstChecker.kt +++ b/compiler/src/prog8/ast/processing/AstChecker.kt @@ -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) } "<<", ">>" -> { - // 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) if(constRight==null) errors.err("bit-shift can only be done by a constant number (for now)", expr.right.position) diff --git a/examples/compiled/examples.d64 b/examples/compiled/examples.d64 index 20017586cb7bc8f9768a5e7b81279b5363121791..72bd4da3b877c98e2b6de04f4f20d26a930c6ef9 100644 GIT binary patch delta 1479 zcmZWpZ){Ul6o2Qo-TLn9>mO`i--eY(JJ2}+mnm5=G71h^Qk>~#{Dw^kF-xYxHxpyF z5Z^S$>SiU!KiM40TUK<*=Cor%2P!cRla823_~3>gw3`q{i9m#HeV*6NiSgaudv1T{ zoZmU;-TO}G1>Sjq53^Zhb|@YNU@q4vyKREQ{cv)B2ww`peW|L2UrHM9D4Q*k#Tq>5 z1{EtkkT2nWWNs*q0Klhkl{wjTsM|I_6T*F6P(K>Ib_T#c%C1|UWyrixMAiq7_IQ6} zE+;Yv6q(GCsZe}(DT0x&VVcPk?Z7&n5Gd8z#r^h+tiR;-~=^= zl6Uy$3p_z^;W96<;onIyNSaIq9XH&>k&Dobz2Cro+*Siy6>ZWg>wPQT#9y~=-uUx+ zVgBls%vy-pF`~dsN4epjRH;mV?5s0yTEh_Q|8VFcCFe8TR^1vMiM+D8`$&9*Eg#8g zG4Hm9A**fWx@`C+?# zLez^{A!oh8`K)-}Ha{V*(!L7su5`7P4VM=FN$nlNr|3B**F*?G; zKUOiXlsa^~+QxE^ADNhOcxNgj0|k|5zfQL?_nPKtrlwQO!gs4%*&^ zTCCF`HwGJE%MKeqejK3>0%Lm)z&^Vp7H!!Z#n0NHvi#|I)859Gesr~iS_$!JOKW3% zCw&tArKfabtpyq6iEO8 delta 605 zcmY+BOK1~O6o&hsnY=U2G^S&%#I~8LloG54q_{F-tAT3EOu$_?(nTR?-3e|=!MYM! zhjI`%iVzoW)YuuZwu+Bk(Url4i93UeN)Ztsop@4k;n{qLd+!J5{%5utovlXiP@_Vh zecaWd-o!TwCu`{ire|=B!Hiv%tZU@W& zn?0y|*bcy1%5dUl%J#V7lBB)HUIzs diff --git a/examples/compiled/plasma.prg b/examples/compiled/plasma.prg new file mode 100644 index 0000000000000000000000000000000000000000..cdfc6eb52ef3187f76b6a8d7e8b55ebc49cd3150 GIT binary patch literal 1260 zcmbtTe`pg|9DjFdn%ukml%%<=3%)9yrF88a;_AxWx=vl>up_h33Bn0NsjMIfGQqMA zePv2-Rav2%v@2x~bHzZ1AVzu-p_E185+O?OA5L*;}a+C z8N)QfHU446oGD9OuSA{yBkElfy~br+rV*#mX~Rz9O>Ux+UNOjJU z0*06rJ%FZUhd}BElK7P65a83bbxUqjI#yZYEWdWVLBVOWPF2oKQ&t`d{=D3h9gE z^JjE0!D#WHc$4Zm(R-?||J=af`QcG=VJtR&>2iD`aeZQ+KX9<)P}kujM~@x<`ZeoENpnaC I&Eb>&2CzaQxc~qF literal 0 HcmV?d00001 diff --git a/examples/plasma.p8 b/examples/plasma.p8 index 1c54bfff2..79b54a8c8 100644 --- a/examples/plasma.p8 +++ b/examples/plasma.p8 @@ -1,5 +1,4 @@ %import c64lib -%zeropage basicsafe ;/*****************************************************************************\ @@ -22,10 +21,11 @@ main { sub start() { c64.COLOR = 1 - c64scr.print("creating charset...") + c64scr.print("creating charset...\n") makechar() ubyte block = c64.CIA2PRA + ; ubyte v = c64.VMCSB c64.CIA2PRA = (block & $FC) | (lsb(SCREEN1 >> 14) ^ $03) repeat { @@ -34,6 +34,11 @@ main { doplasma(SCREEN2) 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 @@ -49,33 +54,32 @@ main { ubyte c1b = c1B ubyte c2a = c2A ubyte c2b = c2B - ubyte @zp i - ubyte @zp ii + ubyte @zp x + ubyte @zp y - for ii in 0 to 24 { - ybuf[ii] = sin8u(c1a) + sin8u(c1b) + for y in 0 to 24 { + ybuf[y] = sin8u(c1a) + sin8u(c1b) c1a += 4 c1b += 9 } c1A += 3 c1B -= 5 - for i in 0 to 39 { - xbuf[i] = sin8u(c2a) + sin8u(c2b) + for x in 0 to 39 { + xbuf[x] = sin8u(c2a) + sin8u(c2b) c2a += 3 c2b += 7 } c2A += 2 c2B -= 3 - for ii in 0 to 24 { - for i in 0 to 39 { - @(screen) = xbuf[i] + ybuf[ii] + for y in 0 to 24 { + for x in 0 to 39 { + @(screen) = xbuf[x] + ybuf[y] screen++ } } } sub makechar() { - ubyte[8] bittab = [ $01, $02, $04, $08, $10, $20, $40, $80 ] ubyte c for c in 0 to 255 { diff --git a/examples/test.p8 b/examples/test.p8 index fb419f2f1..d33c2febc 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -7,20 +7,5 @@ main { 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) } }