fix gfx2 screen fill broken when using verafx

This commit is contained in:
Irmen de Jong 2023-10-02 00:12:48 +02:00
parent 690782bf60
commit 70ee2026ff
4 changed files with 22 additions and 4 deletions

View File

@ -32,6 +32,7 @@ gfx2 {
bool monochrome_dont_stipple_flag = false ; set to false to enable stippling mode in monochrome displaymodes
sub screen_mode(ubyte mode) {
cx16.VERA_CTRL=0
when mode {
1 -> {
; lores monochrome

View File

@ -6,6 +6,17 @@
verafx {
%option no_symbol_prefixing
sub fill(ubyte vbank, uword vaddr, ubyte data, uword numlongs) {
; TODO use vera fx cache write
cx16.vaddr(vbank, vaddr, 0, true)
repeat numlongs {
cx16.VERA_DATA0 = data
cx16.VERA_DATA0 = data
cx16.VERA_DATA0 = data
cx16.VERA_DATA0 = data
}
}
; unsigned multiplication just passes the values as signed to muls
; if you do this yourself in your call to muls, it will save a few instructions.
sub mult(uword value1, uword value2) -> uword {
@ -46,9 +57,10 @@ verafx {
stz cx16.VERA_DATA0 ; multiply and write out result
lda #%00010001 ; $01 with Increment 1
sta cx16.VERA_ADDR_H ; so we can read out the result
stz cx16.VERA_FX_CTRL ; Cache write disable
lda cx16.VERA_DATA0
ldy cx16.VERA_DATA0
stz cx16.VERA_FX_CTRL ; Cache write disable
stz cx16.VERA_CTRL ; reset DCSEL
rts
; we skip the upper 16 bits of the result:
; lda cx16.VERA_DATA0

View File

@ -1,7 +1,6 @@
TODO
====
- add a compiler switch to replace all calls to the math word mul routine on the X16 by the verafx call instead. Search TODO("vera fx mul")
- [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
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? etc), but only after setting the status bits is verified!
@ -20,6 +19,7 @@ Future Things and Ideas
^^^^^^^^^^^^^^^^^^^^^^^
Compiler:
- Currently "320*240/8/8" gives integer overflow, so: allow constant integer subexpressions to contain out of range integers (>65535 etc) as long as the final constant value is within byte/word range.
- allow 'chained' array indexing for expressions: value = ptrarray[0][0]
- allow 'chained' array indexing for assign targets: ptrarray[0][0] = 42 this is just evaluating the lhs as a uword pointer expression

View File

@ -1,7 +1,7 @@
%import diskio
%import gfx2
%import textio
;%import math
;%import verafx
%import verafx
%zeropage basicsafe
%option no_sysinit
@ -36,6 +36,11 @@ main {
txt.print_w(w1)
txt.nl()
gfx2.screen_mode(1)
verafx.fill(0, 0, %10101010, 1200) ; should fill top half of the screen
verafx.fill(0, 4800, %11111111, 1200) ; should fill bottom half of the screen
; txt.print_uw(math.mul16_last_upper())
; txt.nl()
; uword value1=5678