tfv: worlds worst vlin implementation

works though
This commit is contained in:
Vince Weaver 2017-08-16 22:39:07 -04:00
parent 15a8d0a983
commit 2b9a86f35a
2 changed files with 43 additions and 34 deletions

14
tfv/NOTES Normal file
View File

@ -0,0 +1,14 @@
Could make VLIN faster by writing in chunks of two
6502 assembly woes:
why do
STA XX,Y
and
STA (XX),Y
do different things?
why are
LDA $44
and
LDA #$44
both valid?

View File

@ -421,57 +421,52 @@ done_print_string:
;=========================================
; X, V2 at Y
vlin:
;int vlin(int page, int y1, int y2, int at) {
sty TEMPY ; save Y (x location)
vlin_loop:
; for(i=A;i<V2;i++) {
txa ; a=x (get first y)
and #$fe ; Clear bottom bit
tay ; y=A
lda gr_offsets,Y ; lookup low-res memory address
sta GBASL
tay ;
lda gr_offsets,Y ; lookup low-res memory address low
sta GBASL ; put it into our indirect pointer
iny
lda gr_offsets,Y
lda gr_offsets,Y ; lookup low-res memory address high
clc
adc DRAW_PAGE ; add in draw page offset
sta GBASH
sta GBASH ; put into top of indirect
; vlin_hi=i&1;
ldy TEMPY ; load back in y (x offset)
; pha
txa ; load back in x (current y)
lsr ; check the low bit
bcc vlin_low ; if not set, skip to low
ldy TEMPY
vlin_high:
lda #$F0 ; setup masks
sta MASK
lda #$0f
bcs vlin_too_slow
lda COLOR
sta (GBASL),Y
vlin_low: ; setup masks
lda #$0f
sta MASK
lda #$f0
vlin_too_slow:
; lda #$0F
; and (GBASL),Y
; sta (GBASL),Y
; lda COLOR
; and #$f0
; ora (GBASL),Y
; sta (GBASL),Y
and (GBASL),Y ; mask current byte
sta (GBASL),Y ; and store back
; if (vlin_hi) {
; ram[vlin_addr]=ram[vlin_addr]&0x0f;
; ram[vlin_addr]|=ram[COLOR]&0xf0;
; }
; else {
; ram[vlin_addr]=ram[vlin_addr]&0xf0;
; ram[vlin_addr]|=ram[COLOR]&0x0f;
; }
lda MASK ; mask the color
and COLOR
ora (GBASL),Y ; or into the right place
sta (GBASL),Y ; store it
; pla
inx ; increment X (current y)
cpx V2 ; compare to the limit
bcc vlin_loop ; if <= then loop
inx
cpx V2
bcc vlin_loop
rts
rts ; return