gfx2 highres 4colors

This commit is contained in:
Irmen de Jong 2021-01-27 02:56:25 +01:00
parent c8855b2b10
commit 69c459c8ac
3 changed files with 27 additions and 22 deletions

View File

@ -239,22 +239,27 @@ _done
6 -> {
; highres 4c
; TODO also mostly usable for lores 4c?
cx16.VERA_ADDR_H = (cx16.VERA_ADDR_H & %00000111) ; no auto advance
color &=3
color <<= gfx2.plot.shift4c[lsb(x) & 3]
ubyte mask = gfx2.plot.mask4c[lsb(x) & 3]
ubyte[4] colorbits
ubyte[4] masks
ubyte mask = %11111100
ubyte ii
for ii in 3 downto 0 {
colorbits[ii] = color
masks[ii] = mask
color <<= 2
mask <<=2
}
void addr_mul_24_for_highres_4c(y, x) ; 24 bits result is in r0 and r1L (highest byte)
cx16.VERA_ADDR_H = (cx16.VERA_ADDR_H & %00000111) ; no auto advance
repeat length {
; TODO optimize the vera memory manipulation in pure assembly
ubyte cbits4 = cx16.vpeek(lsb(cx16.r1), cx16.r0) & mask | color
ubyte lower_x_bits = lsb(x) & 3
ubyte cbits4 = cx16.vpeek(lsb(cx16.r1), cx16.r0) & masks[lower_x_bits] | colorbits[lower_x_bits]
cx16.vpoke(lsb(cx16.r1), cx16.r0, cbits4)
x++
if x & 3 == 0
if lower_x_bits==%00000011
cx16.r0++ ; next x byte
ror2(color)
ror2(color)
ror2(mask)
ror2(mask)
x++
}
}
}
@ -635,6 +640,7 @@ _done
; -- sets the next pixel byte to the graphics chip.
; for 8 bpp screens this will plot 1 pixel.
; for 1 bpp screens it will plot 8 pixels at once (color = bit pattern).
; for 2 bpp screens it will plot 4 pixels at once (color = bit pattern).
%asm {{
sta cx16.VERA_DATA0
}}
@ -644,6 +650,7 @@ _done
; -- sets the next bunch of pixels from a prepared array of bytes.
; for 8 bpp screens this will plot 1 pixel per byte.
; for 1 bpp screens it will plot 8 pixels at once (colors are the bit patterns per byte).
; for 2 bpp screens it will plot 4 pixels at once (colors are the bit patterns per byte).
%asm {{
phx
sta P8ZP_SCRATCH_W1

View File

@ -10,10 +10,8 @@
main {
sub start() {
palette.set_monochrome($0aaa, $0000)
gfx2.screen_mode(6) ; select 640*480 mode
sys.wait(200)
gfx2.screen_mode(5) ; select 640*480 mode
palette.set_monochrome($0aaa, $0000) ; TODO fix setting the palette... the isNoClobberRisk() for lsb/msb broke it
cx16.VERA_DC_VSCALE = 64 ; have the vertical resolution so it is 640*240 - more or less Amiga's default non interlaced mode
cx16.mouse_config(1, 1) ; enable mouse TODO make it an Amiga mouse pointer if possible

View File

@ -19,14 +19,14 @@ main {
ubyte color
uword yy
for color in 3 downto 0 {
for yy in 100 to 120 {
uword xx
for xx in 10 to 500 {
gfx2.plot(xx, yy, color)
}
}
}
; for color in 3 downto 0 {
; for yy in 100 to 120 {
; uword xx
; for xx in 10 to 500 {
; gfx2.plot(xx, yy, color)
; }
; }
; }
for color in 3 downto 0 {