diff --git a/compiler/res/prog8lib/cx16/verafx.p8 b/compiler/res/prog8lib/cx16/verafx.p8 index 5c96b6d13..9422df231 100644 --- a/compiler/res/prog8lib/cx16/verafx.p8 +++ b/compiler/res/prog8lib/cx16/verafx.p8 @@ -98,4 +98,13 @@ verafx { ; sta $0403 }} } + + sub transparency(bool enable) { + cx16.VERA_CTRL = 2<<1 ; dcsel = 2 + if enable + cx16.VERA_FX_CTRL |= %10000000 + else + cx16.VERA_FX_CTRL &= %01111111 + cx16.VERA_CTRL = 0 + } } diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 7fd7da0c0..66b0633be 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -514,5 +514,8 @@ the emulators already support it). There's also a ``clear`` routine here to very quickly clear a piece of vram to a given byte value (it writes 4 bytes at a time). The routine is around 3 times faster as a regular unrolled loop to clear vram. +``transparency`` + Enable or disable transparent writes (color 0 will be transparent if enabled). + Read the `source code `_ to see what's in there. diff --git a/docs/source/todo.rst b/docs/source/todo.rst index fbce4a994..c31f9a79b 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -1,9 +1,7 @@ TODO ==== -- add verafx transparent writes enable/disable routines - add %option verafxmuls in block to enable transparent verafx muls use for that block only + add warning message to docs to not use it it in prg AND irq code -- '>>=' can be used as an operator in an expression?? should only be augmented assignment! - [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 .... - [on branch: ir-less-branch-opcodes] IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction diff --git a/examples/test.p8 b/examples/test.p8 index 8538d15c6..b984d0f21 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,21 +1,20 @@ %import textio -%import emudbg +%import gfx2 +%import verafx %zeropage basicsafe -%option no_sysinit main { sub start() { - - txt.print_ub(emudbg.is_emulator()) - txt.nl() - emudbg.console_value1(123) - emudbg.console_value2(222) - for cx16.r0L in iso:"Hello debug console!\n" - emudbg.console_chrout(cx16.r0L) - - emudbg.console_write(iso:"Hello another message!\n") - - emudbg.EMU_DBG_HOTKEY_ENABLED=false + gfx2.screen_mode(4) + gfx2.disc(160, 120, 100, 2) + ; verafx.transparency(true) + gfx2.position(0, 70) + repeat 3000 { + gfx2.next_pixel(7) + repeat 10 + gfx2.next_pixel(0) ; transparent! + } + verafx.transparency(false) } }