Reduses one CMP instruction in line_down_inv by drawing the line in the other direction

This commit is contained in:
hugova 2025-07-17 14:00:56 +02:00
parent cda44f292c
commit 1ad8071f75

View file

@ -49,20 +49,26 @@ selfmod:
LDA V + 1
STA case_1 + 7
end_selfmod:
LDA X_end
STA X_pos
LDA Y_end
STA Y_pos
JSR pixel_calc ;;only used first pixel. after this relative position is abused
STA byte_to_paint
INY
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$01, #$00
LDX dy
for_y:
LDA byte_to_paint
ORA (btp_mem_pos), Y
STA (btp_mem_pos), Y
increment_y_pos:
INY
CPY #$08
DEY
BNE increment_y_pos_end
move_8px_down:
LDY #$00
Add_16 btp_mem_pos, btp_mem_pos + 1, #$3F ,#$01, !
LDY #$08
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40 ,#$01
increment_y_pos_end:
DEX
;CPX Y_end
@ -71,11 +77,11 @@ increment_y_pos_end:
case_1:
Sub_16_A D, D + 1, #>V, #<V, !
increment_pixel_x:
LSR byte_to_paint
ASL byte_to_paint
BCC for_y
move_8px_left:
ROR byte_to_paint
Add_16 btp_mem_pos, btp_mem_pos + 1, #$08, #$00, !
ROL byte_to_paint
Sub_16 btp_mem_pos, btp_mem_pos + 1, #$08, #$00
JMP for_y
case_2:
Add_16 D, D + 1, #>dx_2, #<dx_2, ! ;D = D + 2*dx