i read about the very fast plot routine on C-Hacking issue #8. They calculate with an average speed of 20 cycles per pixel.
After a few attempts and experimenting, I wasn't able to get the routine to work. Has anyone here finished the routine yet?
In assembly:
Code: Select all
LDA BITP,X 4 ;Load the bit pattern from a table
BPL CONT 3 2 ;Still in the same column?
EOR $LO 3 ;If not, add 128 to the low byte
STA $LO 3
BMI CONT 3 2 ;If the high bit is set, stay in the same page
INC $HI 5 ;Otherwise point to the next page
LDA #$128 2 ;We still need the bit pattern for x!
CONT ORA ($LO),Y 5
STA ($LO),Y 6 ;Plot the point
--------
Cycle count: 18 26 32
and 32 cycles to jump a page. Over 16 points, this averages 19.375 cycles.
http://unusedino.de/ec64/technical/c=hacking/ch08.html
Best regards
Sven
PS: My fastest solution is 22 cycles + JSR + RTS or with JMP + JMP = 22 + 12 or 22 + 6 = 34 or 28
Code: Select all
LDA #$00
STA $FB ; set lowbyte for drawing - save LDA #$00
; every column starts with lowbate $00 - $1000, $1100, $1200, - , $1F00
MainLoop:
some code ...
JSR SetPixel ; 6
(JMP SetPixel ; 3)
(FinishSetPixel:)
jmp MainLoop
SetPixel:
lda highb,x ; 4
sta $fc ; 3
lda ($fb),y ; 5
ora xtableset,x ; 4
sta ($fb),y ; 6
rts ; 6
(JMP FinishSetPixel ; 3)