From ee69828ec7653821b16f85f56eddcf5c371a94db Mon Sep 17 00:00:00 2001 From: hugova Date: Sun, 2 Mar 2025 18:05:20 +0100 Subject: [PATCH] Optimisation by moving logic out of loop for faster execution. This should be implemented on the other line_* files --- wip-hugo/routines/memory/line_down.s | 50 +++++++++++++++------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/wip-hugo/routines/memory/line_down.s b/wip-hugo/routines/memory/line_down.s index 0c8a4fa..698b60b 100644 --- a/wip-hugo/routines/memory/line_down.s +++ b/wip-hugo/routines/memory/line_down.s @@ -12,42 +12,50 @@ Y_end = $05 X_pos = $FC Y_pos = $FB + dx = $0c dy_2 = $0607 - dx = $08 + V = $0809 ;Lets reuse dx register ($08) D = $0a0b - ;;Set values - LDA #$00 - STA $FD ; for pixel_draw - ;example values ~~~~~ SHOULD BE PRECOMPILED LDA #$00 STA X_pos STA Y_pos - LDA #$f0 + LDA #$90 STA X_end - LDA #$80 + LDA #$10 STA Y_end ;;~~~~~~~~~~ - ;;2*dy = 2*(Y_end -Y_pos) + + ;;We need to clear this memory + LDA #$00 + STA dy_2 - LDA #$00 - STA dy_2, V + STA >dy_2; >dy_2 = dy. Needed for dy_2 (not for V) LDA X_end SEC SBC X_pos STA dx + SEC + SBC >V + STA >V; V, dy_2, dy_2 STA >D LDA D, D, dx_2, D, dx_2, D, V, D, dy_2,