From afef9457c8ad77e466100a70bd3fa10c8c8d6703 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 28 Mar 2021 18:30:50 -0400 Subject: [PATCH] gr: lines: some size updates --- graphics/gr/lines/lines_recurse.s | 22 +++++++++++++--------- graphics/gr/lines/lines_small.s | 11 ++++------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/graphics/gr/lines/lines_recurse.s b/graphics/gr/lines/lines_recurse.s index 7b2aed89..bdb7f9f7 100644 --- a/graphics/gr/lines/lines_recurse.s +++ b/graphics/gr/lines/lines_recurse.s @@ -7,10 +7,12 @@ .include "zp.inc" .include "hardware.inc" -B_X1 = $F0 -B_Y1 = $F1 -B_X2 = $F2 -B_Y2 = $F3 +; 144 -- initial working implementation + +;B_X1 = $F0 +;B_Y1 = $F1 +;B_X2 = $F2 +;B_Y2 = $F3 COUNT = $F9 X1 = $1000 @@ -93,20 +95,22 @@ draw_recurse: ; check if done - lda X1,X - cmp MIDX,X + lda MIDX,X + cmp X1,X bne recurse - lda Y1,X - cmp MIDY,X + lda MIDY,X + cmp Y1,X beq done_draw_line recurse: - ; draw( ax, ay, midx, midy); + ; draw( midx, midy, ax, ay); + lda MIDX,X sta X1+1,X lda MIDY,X sta Y1+1,X + lda X1,X sta X2+1,X lda Y1,X diff --git a/graphics/gr/lines/lines_small.s b/graphics/gr/lines/lines_small.s index a1c46f52..04bc76d8 100644 --- a/graphics/gr/lines/lines_small.s +++ b/graphics/gr/lines/lines_small.s @@ -20,6 +20,7 @@ ; 152 -- merge into common_inc ; 151 -- share an RTS ; 150 -- use X when plotting +; 148 -- re-arrange do abs (thanks to 42BS) B_X1 = $F0 B_Y1 = $F1 @@ -205,23 +206,19 @@ done_line: ; x=1, for Y ;===================================== do_abs: + ldy #$ff sec lda B_X1,X sbc B_X2,X ; A = x1 - x2 - bmi is_neg + bpl is_pos - ldy #$ff - bmi neg_done - -is_neg: ldy #$1 neg: eor #$ff clc adc #1 - -neg_done: +is_pos: sty B_SX,X sta B_DX,X rts