diff --git a/wip-hugo/routines/line/line.inc b/wip-hugo/routines/line/line.inc index f1ef87d..ba7316b 100644 --- a/wip-hugo/routines/line/line.inc +++ b/wip-hugo/routines/line/line.inc @@ -5,10 +5,10 @@ Y_end = $05 X_pos = $FC Y_pos = $FB - dy= $0c - dx = dy + dx = $0c + dy = $06 dy_2 = $0607 - dx_2 = dy_2 + dx_2 = $0cF3 V = $0809 D = $0a0b ;;These are also used in pixel_draw. Look there to find out more diff --git a/wip-hugo/routines/line/line.s b/wip-hugo/routines/line/line.s index 8a89541..fc1c272 100644 --- a/wip-hugo/routines/line/line.s +++ b/wip-hugo/routines/line/line.s @@ -35,6 +35,8 @@ down: CMP dx BCC shallow_; dy < dx steep_: + ;LDA dx + jsr line_down_inv RTS shallow_: ;dy < dx diff --git a/wip-hugo/routines/line/line_down.s b/wip-hugo/routines/line/line_down.s index dd2855e..7daeb10 100644 --- a/wip-hugo/routines/line/line_down.s +++ b/wip-hugo/routines/line/line_down.s @@ -10,24 +10,7 @@ .proc line_down - ;; TEMPORARY - ;; Hack because changing dx and dy makes other line draws bugg and idk why - ;; This is offcorse temporary - ;.include "line.inc"; Defines memory positions, ex X_pos - X_end = $04 - Y_end = $05 - X_pos = $FC - Y_pos = $FB - dx = $0c - dy = $06 - dy_2 = $0607 - dx_2 = dy_2 - V = $0809 - D = $0a0b - ;;These are also used in pixel_draw. Look there to find out more - byte_to_paint = $FE ;Byte with one 1 that corasponds to a pixel. - btp_mem_pos =$494A; byte to paint memory position ;Position of byte on screen - ;;END TEMPORARY + .include "line.inc"; Defines memory positions, ex X_pos ;;We need to clear this memory LDA #$00 @@ -63,7 +46,7 @@ jsr pixel_draw ;;only used first pixel. after this relative position is abused LDX X_pos - selfmod: +selfmod: ;; Self modifying code. Makes LDA and SBC instructions each take 1 cycle less. ;; You can remove this if you run the loop without # at dy_2 and V. ;;Note: The offsets like +2 etc is because there are instructions betwean the label and the @@ -82,7 +65,7 @@ ;; Modifies SBC V - STA >dx_2 - LDA Y_end SEC - SBC Y_pos - STA dy - - SEC - SBC >V + LDA dy + SBC dx STA >V Mult_16 >V, dx_2, dx_2 - STA >D - LDA D, D, dx_2, D, D, dx_2 + STA case_2 +1 + LDA V + STA case_1 +3 + LDA btp_mem_pos, btp_mem_pos, D, D, V, D, V, #D, dx_2, D, dx_2, #V - STA >dy_2 LDA dx - SEC - SBC >V + SBC dy STA >V Mult_16 >V, dy_2, dy_2, dy_2 - STA >D - LDA D, dy_2, D, D, dy_2 + STA case_2 +1 + LDA V + STA case_1 +3 + LDA D, D, V, D, V, #D, dy_2, D, dy_2, #V - STA >dx_2 - LDA Y_pos SEC - SBC Y_end - STA dy - SEC - SBC >V + LDA dy + SBC dx STA >V Mult_16 >V, dx_2, dx_2 - STA >D - LDA D, D, dx_2, D, D, dx_2 + STA case_2 +1 + LDA V + STA case_1 +3 + LDA D, D, V, D, V, #D, dx_2, D, dx_2, #