add verafx.transparency()

This commit is contained in:
Irmen de Jong 2023-10-03 01:47:52 +02:00
parent e505bf9ccf
commit a8507b437d
4 changed files with 24 additions and 15 deletions

View File

@ -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
}
}

View File

@ -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 <https://github.com/irmen/prog8/tree/master/compiler/res/prog8lib/cx16/verafx.p8>`_
to see what's in there.

View File

@ -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

View File

@ -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)
}
}