From 27442c714e3f412a1dd3706153382b8f5785ec32 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 12 Jan 2019 01:59:32 +0100 Subject: [PATCH] added rasterbars example --- examples/hello.p8 | 2 +- examples/rasterbars.p8 | 40 ++++++++++++++++++++++++++++++++++++++++ examples/wizzine.p8 | 2 +- stackvm.sh | 5 ++--- 4 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 examples/rasterbars.p8 diff --git a/examples/hello.p8 b/examples/hello.p8 index 4e681b8bf..76414acda 100644 --- a/examples/hello.p8 +++ b/examples/hello.p8 @@ -17,7 +17,7 @@ str question = "How are you?\n" ; use iteration to write text - for ubyte char in question { + for ubyte char in question { ; @todo fix iteration c64.CHROUT(char) } diff --git a/examples/rasterbars.p8 b/examples/rasterbars.p8 new file mode 100644 index 000000000..738d45e05 --- /dev/null +++ b/examples/rasterbars.p8 @@ -0,0 +1,40 @@ +%import c64utils + + +~ main { + + sub start() { + c64.SCROLY &= %11101111 ; blank screen + c64utils.set_rasterirq_excl(40) + +dontstop: + goto dontstop + + } +} + + +~ irq { + + const ubyte barheight = 4 + ubyte[13] colors = [6,2,4,5,15,7,1,13,3,12,8,11,9] + ubyte color =0 + ubyte ypos = 0 + + sub irq() { + ubyte rasterpos=c64.RASTER + A=c64.SP0X ; delay for align + A=c64.SP0X ; delay for align + if color!=len(colors) { + c64.EXTCOL = colors[color] + c64.RASTER = rasterpos+barheight + color++ + } + else { + ypos+=2 + c64.EXTCOL = 0 + c64.RASTER=sin8u(ypos)/2+40 + color=0 + } + } +} diff --git a/examples/wizzine.p8 b/examples/wizzine.p8 index d9531f935..032eecb17 100644 --- a/examples/wizzine.p8 +++ b/examples/wizzine.p8 @@ -60,7 +60,7 @@ if msb(x) c64.MSIGX++ c64.EXTCOL++ } - c64.EXTCOL-=7 ; @todo for memory vars, this should not become more than 2 * dec but normal sbc instead + c64.EXTCOL-=7 } diff --git a/stackvm.sh b/stackvm.sh index e90d6aacb..5cf96601e 100755 --- a/stackvm.sh +++ b/stackvm.sh @@ -1,8 +1,7 @@ #!/usr/bin/env sh -PROG8_COMPILER_DIR=compiler -PROG8CLASSPATH=${PROG8_COMPILER_DIR}/out/production/compiler +PROG8CLASSPATH=./out/production/compiler KOTLINPATH=${HOME}/.IntelliJIdea2018.3/config/plugins/Kotlin -LIBJARS=${KOTLINPATH}/lib/kotlin-stdlib.jar:${KOTLINPATH}/lib/kotlin-reflect.jar:${PROG8_COMPILER_DIR}/antlr/lib/antlr-runtime-4.7.1.jar +LIBJARS=${KOTLINPATH}/lib/kotlin-stdlib.jar:${KOTLINPATH}/lib/kotlin-reflect.jar java -cp ${PROG8CLASSPATH}:${LIBJARS} prog8.StackVmMainKt $*