From cd0a91b34ea061b3e109f4fb0aaef4da276d30ef Mon Sep 17 00:00:00 2001 From: hugova Date: Fri, 25 Jul 2025 09:00:32 +0200 Subject: [PATCH] modify line.s to make it work if X_pos > X_end --- .gitignore | 3 +- wip-hugo/routines/line/line.s | 17 +++++++++-- wip-hugo/routines/line/line_test_extensive.s | 32 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9f406fc..537ecd2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ *.lst *.lst *.note -./build/* +*.lbl +build/* diff --git a/wip-hugo/routines/line/line.s b/wip-hugo/routines/line/line.s index 320a1a9..9768771 100644 --- a/wip-hugo/routines/line/line.s +++ b/wip-hugo/routines/line/line.s @@ -23,10 +23,23 @@ do_not_fix_y_end: SEC LDA X_end SBC X_pos - STA dx - BCC dx_no_underflow;; X_end >= X_pos + BCS dx_no_underflow;; X_end >= X_pos EOR #$ff ; Fix bit underflow + STA dx + ;; line_* expect X_pos < X_end and now its not the case. + ;; Lets move them around + LDX X_pos + LDY X_end + STX X_end + STY X_pos + LDX Y_pos + LDY Y_end + STX Y_end + STY Y_pos + + dx_no_underflow: + STA dx SEC LDA Y_pos SBC Y_end diff --git a/wip-hugo/routines/line/line_test_extensive.s b/wip-hugo/routines/line/line_test_extensive.s index 2790b51..4f79005 100644 --- a/wip-hugo/routines/line/line_test_extensive.s +++ b/wip-hugo/routines/line/line_test_extensive.s @@ -98,4 +98,36 @@ long_line_test_b: LDA Y_pos_ CMP #$ff BNE @loop + +clear_screen__: + ;;Paint the bitmap black. More bitmap: https://www.c64-wiki.com/wiki/53272, https://www.c64-wiki.com/wiki/Screen_RAM#Moving_of_screen_RAM + Mov_16 A_start, A_start + 1, #VIC_bank + Mov_16 length, length + 1, #<$1f40, #>$1f40 + LDA #$00 + jsr memset + +long_line_test_b_pos_end_swapped: + LDA #$00 + STA X_end_ + LDA #$00 + STA Y_end_ + LDA #$ff + STA X_pos_ + LDA #$60 + STA Y_pos_ +@loop: + LDA Y_end_ + STA Y_end + LDA X_end_ + STA X_end + LDA X_pos_ + STA X_pos + LDA Y_pos_ + STA Y_pos + jsr line + INC Y_end_ + LDA Y_end_ + CMP #$ff + BNE @loop + .endscope