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