second: implement VLIN and PLOT

this is so inefficient
This commit is contained in:
Vince Weaver 2023-09-17 22:36:29 -04:00
parent 739ddd312a
commit fb33832144
2 changed files with 137 additions and 17 deletions

View File

@ -16,21 +16,21 @@ frame15:
.byte SET_COLOR | WHITE
.byte BOX, 4, 6, 35,41
.byte SET_COLOR | RED
.byte HLIN,0,39,2
.byte SET_COLOR | DARK_BLUE
.byte HLIN,0,39,3
; .byte SET_COLOR | RED
; .byte HLIN,0,39,2
; .byte SET_COLOR | DARK_BLUE
; .byte HLIN,0,39,3
.byte SET_COLOR | RED
.byte HLIN,0,39,12
.byte SET_COLOR | DARK_BLUE
.byte HLIN,0,39,13
; .byte SET_COLOR | RED
; .byte HLIN,0,39,12
; .byte SET_COLOR | DARK_BLUE
; .byte HLIN,0,39,13
.byte SET_COLOR | GREEN
.byte BOX, 2,2,10,12 ; goes to 6 only top
.byte BOX, 12,3,20,12
.byte BOX, 22,2,30,13 ; goes to 6 full
.byte BOX, 32,3,39,13
; .byte SET_COLOR | GREEN
; .byte BOX, 2,2,10,12 ; goes to 6 only top
; .byte BOX, 12,3,20,12
; .byte BOX, 22,2,30,13 ; goes to 6 full
; .byte BOX, 32,3,39,13

View File

@ -232,6 +232,77 @@ hlin_done:
;=================================
;=================================
draw_vlin:
iny
lda (INL),Y
sta Y1
iny
lda (INL),Y
sta Y2
iny
lda (INL),Y
sta X1
lda Y2
lsr
; if even, go to one less
; else, fine
bcs odd_bottom_vlin
even_bottom_vlin:
sec
sbc #1
odd_bottom_vlin:
sta vlin_yend_smc+1
; see if we start at multiple of two
lda Y1
lsr
tay
bcc even_vlin_start
; we're odd, need to call PLOT
jsr plot_mask_odd
iny
even_vlin_start:
vlin_yloop:
lda gr_offsets_l,Y
sta vlin_xloop_smc+1
lda gr_offsets_h,Y
clc
adc DRAW_PAGE
sta vlin_xloop_smc+2
lda COLOR
ldx X1
vlin_xloop_smc:
sta $400,X
iny
vlin_yend_smc:
cpy #0
bcc vlin_yloop ; less than
beq vlin_yloop ; equal
; done
; if Y2 was even we need to fixup and draw one more line
lda Y2
lsr
bcs definitely_odd_vlin
jsr plot_mask_even
definitely_odd_vlin:
; done
lda #4
@ -246,15 +317,24 @@ draw_vlin:
draw_plot:
iny
lda (INL),Y
tax
sta X1
iny
lda (INL),Y
; sta Y1
; lda Y1
lsr
tay
bcs do_plot_mask_odd
jsr plot_mask_even
jmp plot_done
do_plot_mask_odd:
jsr plot_mask_odd
draw_plot_smc:
sta $400
plot_done:
; done
@ -306,6 +386,46 @@ draw_hlin_s_xloop_smc:
rts
;===================================
;===================================
; plot common code
;===================================
;===================================
; X1, set up
; Y/2 is in Y
; call the proper entry point
; Y untouched
plot_mask_odd:
lda #$0F
.byte $2C ; bit trick
plot_mask_even:
lda #$F0
sta MASK
eor #$FF
and COLOR
sta COLOR2
lda gr_offsets_l,Y
sta plot_l_smc+1
sta plot_s_smc+1
lda gr_offsets_h,Y
clc
adc DRAW_PAGE
sta plot_l_smc+2
sta plot_s_smc+2
ldx X1
plot_l_smc:
lda $400,X
and MASK
ora COLOR2
plot_s_smc:
sta $400,X
rts
.include "gr_fast_clear.s"