Fix performance by using pointer tricks for ADD. 10% faster line drawing

This commit is contained in:
hugova 2025-03-24 17:07:14 +01:00
parent de2d597612
commit bc59ac63b1

View file

@ -53,15 +53,12 @@
LDY #$00
jsr pixel_draw ;;only used first pixel. after this relative position is abused
;;From line_test_time this is at program_start + list_file_offset = $080D + $0116 = $0923
for_x:
;; Lets increment btp_mem_pos with +8
;; Read more in pixel_draw to understand this!
LDX #$00
;; Paints A to address i btp_mem_pos* + Y
;; Y is our Y-pos-chunk-offset.
LDA byte_to_paint
ORA (>btp_mem_pos, X)
STA (>btp_mem_pos, X)
ORA (>btp_mem_pos), Y
STA (>btp_mem_pos), Y
increment_pixel_x:
CLC
ROR byte_to_paint
@ -84,7 +81,7 @@ increment_pixel_x_end:
case_1:; C =1 so we can use !
Sub_16 >D, <D, >V, <V, ! ; D = D - V
increment_y_pos:
Add_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00
;Add_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00
INY
CPY #$08 ;
BEQ move_8px_down
@ -92,7 +89,7 @@ increment_y_pos:
move_8px_down: ; Z=1 --> C=1
;; +320-8 bytes
LDY #$00
Add_16 >btp_mem_pos, <btp_mem_pos,#$38 , #$01
Add_16 >btp_mem_pos, <btp_mem_pos,#$40, #$01
jmp for_x
increment_y_pos_end:
case_2: ;; C =0 because LAG_16 so we can use !