Add performance improvments to line_down_inv.s

This commit is contained in:
hugova 2025-03-24 19:54:31 +01:00
parent 9b8e3fe33f
commit 05b0ff9762
3 changed files with 17 additions and 24 deletions

View file

@ -44,27 +44,22 @@
Add_16 >D, <D, #$ff, #$01
Sub_16 >D, <D, dy, #$00
LDY #$00
jsr pixel_draw ;;only used first pixel. after this relative position is abused
CLC ; this makes it that C =0 always on for_x
for_y:
LDX #$00
LDA byte_to_paint
ORA (>btp_mem_pos, X)
STA (>btp_mem_pos, X)
increment_y_pos:
Add_16 >btp_mem_pos, <btp_mem_pos, #$01, #$00, ! ; I know that C ==0 on for_y
INY
CPY #$08 ;
BEQ move_8px_down
jmp increment_y_pos_end
move_8px_down:
;; +320-8 bytes
LDY #$00
Add_16 >btp_mem_pos, <btp_mem_pos,#$38 , #$01
increment_y_pos_end:
INC Y_pos;; legacy
LDX Y_pos
for_y:
LDA byte_to_paint
ORA (>btp_mem_pos), Y
STA (>btp_mem_pos), Y
increment_y_pos:
INY
CPY #$08
BNE increment_y_pos_end
move_8px_down:
LDY #$00
Add_16 >btp_mem_pos, <btp_mem_pos,#$40 , #$01; ; +320 bytes
increment_y_pos_end:
INX
CPX Y_end
BEQ end
;;If D < %00000010 00000000: case_2
@ -73,11 +68,9 @@ increment_y_pos_end:
case_1:
Sub_16 >D, <D, >V, <V; D = D - V
increment_pixel_x:
CLC
LDA byte_to_paint
ROR byte_to_paint
BCS move_8px_left
JMP for_y
LSR byte_to_paint
BCC for_y
move_8px_left:
;; add +8 to btp_mem_pos. Find more of why in pixel_draw
Add_16 >btp_mem_pos, <btp_mem_pos, #$08, #$00

View file

@ -9,7 +9,7 @@
;;NOTE THAT Y_pos >) Y_end, X_pos <= X_end. Min 45deg!
.proc line_up_inv
include "line.inc"
.include "line.inc"
;We need to clear this memory
LDA #$00

View file

@ -2,7 +2,7 @@
.include "macros/timer.s"
.include "STARTUP.s"
.include "routines/line/line_test_time.s"
.include "routines/line/line_test.s"
;;This is used by .s files to terminate nicely without reading includes at the end!
exit: