mirror of
https://github.com/irmen/prog8.git
synced 2025-02-09 23:30:45 +00:00
fix monogfx horizontal line and text draw in invert mode
This commit is contained in:
parent
bfcf07c1a2
commit
6d29b00a80
@ -169,7 +169,8 @@ _clear
|
|||||||
|
|
||||||
ubyte separate_pixels = (8-lsb(xx)) & 7
|
ubyte separate_pixels = (8-lsb(xx)) & 7
|
||||||
if separate_pixels {
|
if separate_pixels {
|
||||||
if mode!=MODE_STIPPLE {
|
when mode {
|
||||||
|
MODE_NORMAL -> {
|
||||||
position(xx,yy)
|
position(xx,yy)
|
||||||
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
|
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
|
||||||
if draw
|
if draw
|
||||||
@ -177,12 +178,23 @@ _clear
|
|||||||
else
|
else
|
||||||
cx16.VERA_DATA0 &= ~masked_starts[separate_pixels]
|
cx16.VERA_DATA0 &= ~masked_starts[separate_pixels]
|
||||||
xx += separate_pixels
|
xx += separate_pixels
|
||||||
} else {
|
}
|
||||||
|
MODE_STIPPLE -> {
|
||||||
repeat separate_pixels {
|
repeat separate_pixels {
|
||||||
plot(xx, yy, draw)
|
plot(xx, yy, draw)
|
||||||
xx++
|
xx++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MODE_INVERT -> {
|
||||||
|
position(xx,yy)
|
||||||
|
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
|
||||||
|
if draw
|
||||||
|
cx16.VERA_DATA0 ^= masked_starts[separate_pixels]
|
||||||
|
else
|
||||||
|
cx16.VERA_DATA0 &= masked_starts[separate_pixels]
|
||||||
|
xx += separate_pixels
|
||||||
|
}
|
||||||
|
}
|
||||||
length -= separate_pixels
|
length -= separate_pixels
|
||||||
}
|
}
|
||||||
if length {
|
if length {
|
||||||
@ -203,8 +215,25 @@ _clear
|
|||||||
+ lda p8v_mode
|
+ lda p8v_mode
|
||||||
lsr a
|
lsr a
|
||||||
bcs _stipple
|
bcs _stipple
|
||||||
ldy #255 ; don't stipple
|
lsr a
|
||||||
|
bcs _inverted
|
||||||
|
ldy #255 ; normal drawing mode
|
||||||
bra _loop
|
bra _loop
|
||||||
|
|
||||||
|
_inverted lda #0
|
||||||
|
jsr cx16.vaddr_clone
|
||||||
|
_invertedloop lda p8v_length
|
||||||
|
ora p8v_length+1
|
||||||
|
beq _done
|
||||||
|
lda cx16.VERA_DATA1
|
||||||
|
eor #255
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
lda p8v_length
|
||||||
|
bne +
|
||||||
|
dec p8v_length+1
|
||||||
|
+ dec p8v_length
|
||||||
|
bra _invertedloop
|
||||||
|
|
||||||
_stipple lda p8v_yy
|
_stipple lda p8v_yy
|
||||||
and #1 ; determine stipple pattern to use
|
and #1 ; determine stipple pattern to use
|
||||||
bne +
|
bne +
|
||||||
@ -223,18 +252,28 @@ _loop lda p8v_length
|
|||||||
_done
|
_done
|
||||||
}}
|
}}
|
||||||
|
|
||||||
if mode!=MODE_STIPPLE {
|
when mode {
|
||||||
|
MODE_NORMAL -> {
|
||||||
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
|
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
|
||||||
if draw
|
if draw
|
||||||
cx16.VERA_DATA0 |= masked_ends[separate_pixels]
|
cx16.VERA_DATA0 |= masked_ends[separate_pixels]
|
||||||
else
|
else
|
||||||
cx16.VERA_DATA0 &= ~masked_ends[separate_pixels]
|
cx16.VERA_DATA0 &= ~masked_ends[separate_pixels]
|
||||||
} else {
|
}
|
||||||
|
MODE_STIPPLE -> {
|
||||||
repeat separate_pixels {
|
repeat separate_pixels {
|
||||||
plot(xx, yy, draw)
|
plot(xx, yy, draw)
|
||||||
xx++
|
xx++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MODE_INVERT -> {
|
||||||
|
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
|
||||||
|
if draw
|
||||||
|
cx16.VERA_DATA0 ^= masked_ends[separate_pixels]
|
||||||
|
else
|
||||||
|
cx16.VERA_DATA0 &= masked_ends[separate_pixels]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off again
|
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off again
|
||||||
}
|
}
|
||||||
@ -264,12 +303,10 @@ _done
|
|||||||
lda p8v_mode
|
lda p8v_mode
|
||||||
and #p8c_MODE_INVERT
|
and #p8c_MODE_INVERT
|
||||||
beq +
|
beq +
|
||||||
lda #$45 ; eor ZP
|
lda #$45 ; eor ZP modifying code
|
||||||
sta drawmode
|
bne ++
|
||||||
bra ++
|
+ lda #$05 ; ora ZP modifying code
|
||||||
+ lda #$05 ; ora ZP
|
+ sta drawmode
|
||||||
sta drawmode
|
|
||||||
+
|
|
||||||
}}
|
}}
|
||||||
if mode!=MODE_STIPPLE {
|
if mode!=MODE_STIPPLE {
|
||||||
; draw continuous line.
|
; draw continuous line.
|
||||||
@ -818,7 +855,7 @@ skip:
|
|||||||
cx16.screen_set_charset(charset, 0)
|
cx16.screen_set_charset(charset, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
sub text(uword @zp xx, uword yy, bool draw, uword sctextptr) {
|
sub text(uword @zp xx, uword yy, bool draw, str sctextptr) {
|
||||||
; -- Write some text at the given pixel position. The text string must be in screencode encoding (not petscii!).
|
; -- Write some text at the given pixel position. The text string must be in screencode encoding (not petscii!).
|
||||||
; You must also have called text_charset() first to select and prepare the character set to use.
|
; You must also have called text_charset() first to select and prepare the character set to use.
|
||||||
uword chardataptr
|
uword chardataptr
|
||||||
@ -826,6 +863,17 @@ skip:
|
|||||||
ubyte[8] @shared char_bitmap_bytes_right
|
ubyte[8] @shared char_bitmap_bytes_right
|
||||||
|
|
||||||
cx16.r3 = sctextptr
|
cx16.r3 = sctextptr
|
||||||
|
%asm {{
|
||||||
|
lda p8v_mode
|
||||||
|
cmp #p8c_MODE_INVERT
|
||||||
|
beq +
|
||||||
|
lda #$0d ; ORA abs modifying code
|
||||||
|
bne ++
|
||||||
|
+ lda #$4d ; EOR abs modifying code
|
||||||
|
+ sta cdraw_mod1
|
||||||
|
sta cdraw_mod2
|
||||||
|
}}
|
||||||
|
|
||||||
while @(cx16.r3) {
|
while @(cx16.r3) {
|
||||||
chardataptr = charset_addr + @(cx16.r3) * $0008
|
chardataptr = charset_addr + @(cx16.r3) * $0008
|
||||||
; copy the character bitmap into RAM
|
; copy the character bitmap into RAM
|
||||||
@ -859,7 +907,7 @@ skip:
|
|||||||
%asm {{
|
%asm {{
|
||||||
ldy #0
|
ldy #0
|
||||||
- lda p8v_char_bitmap_bytes_left,y
|
- lda p8v_char_bitmap_bytes_left,y
|
||||||
ora cx16.VERA_DATA1
|
cdraw_mod1 ora cx16.VERA_DATA1
|
||||||
sta cx16.VERA_DATA0
|
sta cx16.VERA_DATA0
|
||||||
iny
|
iny
|
||||||
cpy #8
|
cpy #8
|
||||||
@ -885,7 +933,7 @@ skip:
|
|||||||
%asm {{
|
%asm {{
|
||||||
ldy #0
|
ldy #0
|
||||||
- lda p8v_char_bitmap_bytes_right,y
|
- lda p8v_char_bitmap_bytes_right,y
|
||||||
ora cx16.VERA_DATA1
|
cdraw_mod2 ora cx16.VERA_DATA1
|
||||||
sta cx16.VERA_DATA0
|
sta cx16.VERA_DATA0
|
||||||
iny
|
iny
|
||||||
cpy #8
|
cpy #8
|
||||||
|
@ -467,7 +467,7 @@ skip:
|
|||||||
; TODO vm bitmap charset
|
; TODO vm bitmap charset
|
||||||
}
|
}
|
||||||
|
|
||||||
sub text(uword @zp xx, uword yy, bool draw, uword sctextptr) {
|
sub text(uword @zp xx, uword yy, bool draw, str sctextptr) {
|
||||||
; -- Write some text at the given pixel position. The text string must be in screencode encoding (not petscii!).
|
; -- Write some text at the given pixel position. The text string must be in screencode encoding (not petscii!).
|
||||||
; You must also have called text_charset() first to select and prepare the character set to use.
|
; You must also have called text_charset() first to select and prepare the character set to use.
|
||||||
; TODO vm bitmap charset
|
; TODO vm bitmap charset
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
cx16.monogfx: add invert mode support to horizontal line routine, and text routine
|
|
||||||
|
|
||||||
replace Takes by Http4k in httpCompilerService project. https://github.com/http4k/examples/blob/master/hello-world/README.md
|
replace Takes by Http4k in httpCompilerService project. https://github.com/http4k/examples/blob/master/hello-world/README.md
|
||||||
|
|
||||||
...
|
...
|
||||||
|
@ -6,30 +6,23 @@ main {
|
|||||||
monogfx.lores()
|
monogfx.lores()
|
||||||
monogfx.drawmode(monogfx.MODE_INVERT)
|
monogfx.drawmode(monogfx.MODE_INVERT)
|
||||||
|
|
||||||
uword x1, x2
|
ubyte tt
|
||||||
uword y1, y2
|
|
||||||
|
|
||||||
repeat 200 {
|
|
||||||
x1 = math.rnd()
|
|
||||||
y1 = math.rnd() % 240
|
|
||||||
x2 = math.rnd()
|
|
||||||
y2 = math.rnd() % 240
|
|
||||||
monogfx.line(x1, y1, x2, y2, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
repeat 5 {
|
|
||||||
for cx16.r9L in 0 to 200 {
|
|
||||||
monogfx.vertical_line(cx16.r9L, 10, 200, true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
monogfx.disc(160, 120, 100, true)
|
|
||||||
monogfx.fillrect(20, 100, 280, 50, true)
|
|
||||||
monogfx.drawmode(monogfx.MODE_STIPPLE)
|
|
||||||
monogfx.fillrect(80, 10, 50, 220, true)
|
|
||||||
|
|
||||||
repeat {
|
repeat {
|
||||||
|
ubyte tts=tt
|
||||||
|
word x1 = math.sin8(tts) / 2
|
||||||
|
byte y1 = math.cos8(tts) / 2
|
||||||
|
tts += 256/3
|
||||||
|
word x2 = math.sin8(tts) / 2
|
||||||
|
byte y2 = math.cos8(tts) / 2
|
||||||
|
tts += 256/3
|
||||||
|
word x3 = math.sin8(tts) / 2
|
||||||
|
byte y3 = math.cos8(tts) / 2
|
||||||
|
monogfx.line(160+x1 as uword, 120+y1 as ubyte, 160+x2 as uword, 120+y2 as ubyte, true)
|
||||||
|
monogfx.line(160+x2 as uword, 120+y2 as ubyte, 160+x3 as uword, 120+y3 as ubyte, true)
|
||||||
|
monogfx.line(160+x3 as uword, 120+y3 as ubyte, 160+x1 as uword, 120+y1 as ubyte, true)
|
||||||
|
sys.waitvsync()
|
||||||
|
tt++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user