c64: graphics.horizontal_line() is romable

This commit is contained in:
Irmen de Jong
2025-04-17 00:02:17 +02:00
parent 4fbd67ff99
commit 1a07129865
2 changed files with 20 additions and 24 deletions

View File

@@ -192,8 +192,8 @@ graphics {
} }
if length!=0 { if length!=0 {
; TODO: Romable
%asm {{ %asm {{
_pixeladdr = P8ZP_SCRATCH_W1
lda p8v_length lda p8v_length
and #7 and #7
sta p8v_separate_pixels sta p8v_separate_pixels
@@ -204,37 +204,35 @@ graphics {
lsr p8v_length+1 lsr p8v_length+1
ror p8v_length ror p8v_length
lda p8v_pixaddr lda p8v_pixaddr
sta _modified+1 sta _pixeladdr
lda p8v_pixaddr+1 lda p8v_pixaddr+1
sta _modified+2 sta _pixeladdr+1
lda p8v_length lda p8v_length
ora p8v_length+1 ora p8v_length+1
beq _zero beq _zero
ldy p8v_length ldy p8v_length
sty P8ZP_SCRATCH_B1 ; length
ldx #$ff ldx #$ff
_modified stx $ffff ; modified _more txa
lda _modified+1 ldy #0
sta (_pixeladdr),y
lda _pixeladdr
clc clc
adc #8 adc #8
sta _modified+1 sta _pixeladdr
bcc + bcc +
inc _modified+2 inc _pixeladdr+1
+ dey + dec P8ZP_SCRATCH_B1 ; length
bne _modified bne _more
_zero _zero
ldy p8v_separate_pixels ldy p8v_separate_pixels
beq hline_zero2 beq _end
lda _modified+1
sta P8ZP_SCRATCH_W1
lda _modified+2
sta P8ZP_SCRATCH_W1+1
lda hline_filled_right,y lda hline_filled_right,y
ldy #0 ldy #0
ora (P8ZP_SCRATCH_W1),y ora (_pixeladdr),y
sta (P8ZP_SCRATCH_W1),y sta (_pixeladdr),y
jmp hline_zero2 _end rts
hline_filled_right .byte 0, %10000000, %11000000, %11100000, %11110000, %11111000, %11111100, %11111110 hline_filled_right .byte 0, %10000000, %11000000, %11100000, %11110000, %11111000, %11111100, %11111110
hline_zero2
}} }}
} }
} }

View File

@@ -1,14 +1,12 @@
%import textio %import graphics
%zeropage basicsafe %zeropage basicsafe
%option no_sysinit %option no_sysinit
main { main {
sub start() { sub start() {
txt.home() graphics.enable_bitmap_mode()
for cx16.r11L in 0 to 20 { for cx16.r11L in 0 to 110 {
for cx16.r10L in 0 to 30 { graphics.horizontal_line(cx16.r11L+10, cx16.r11L+20, cx16.r11L+5)
txt.setcc(cx16.r10L, cx16.r11L, sc:'*', 7)
}
} }
} }
} }