;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- ;;drawing line from 2 cordinates ;;# (X_pos, Y_pos) # ;;# * # ;;# * # ;;# * # ;;# (X_end, Y_end) # ;;NOTE THAT X_pos <= X_end, Y_pos <= Y_end. Min 45deg! .proc line_down_inv ;; Look at line_down for referense .include "line.inc"; Defines memory positions, ex X_pos LDA #$00 STA <V STA <dx_2 STA $FD SEC LDA dy SBC dx STA >V Mult_16 >V, <V Mult_16 >dx_2, <dx_2 Mov_16 >D, <D, >dx_2, <dx_2 Add_16 >D, <D, #$ff, #$01, ! Sub_16 >D, <D, dy, #$00 selfmod: LDA >dx_2 STA case_2 +1 LDA <dx_2 STA case_2 +7 LDA >V STA case_1 +1 LDA <V STA case_1 +7 end_selfmod: jsr pixel_draw LDY #$00 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, #$3F ,#$01, ! increment_y_pos_end: INX CPX Y_end BEQ end Lag_16 >D, <D, #$00, #$02, case_2 case_1: Sub_16_A >D, <D, #>V, #<V, ! increment_pixel_x: LDA byte_to_paint LSR byte_to_paint BCC for_y move_8px_left: Add_16 >btp_mem_pos, <btp_mem_pos, #$07, #$00, ! LDA #%10000000 STA byte_to_paint JMP for_y case_2: Add_16 >D, <D, #>dx_2, #<dx_2, ! ;D = D + 2*dx JMP for_y end: RTS .endproc