c64-livecoding/wip-hugo/routines/line/line_down_inv.s
hugova 7f56f90613 Changed 16-bit value syntax from using > and < in addresses to using +1.
This was recomended by dicander and duunqnd because  A =$ABAC
looks like one address and not 2 zero-page addresses.
2025-04-28 12:56:52 +02:00

77 lines
1.8 KiB
ArmAsm

;;; -*- 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 + 1
STA dx_2 + 1
STA $FD
SEC
LDA dy
SBC dx
STA V
Mult_16 V, V + 1
Mult_16 dx_2, dx_2 + 1
Mov_16 D, D + 1, dx_2, dx_2 + 1
Add_16 D, D + 1, #$ff, #$01, !
Sub_16 D, D + 1, dy, #$00
selfmod:
LDA dx_2
STA case_2 + 1
LDA dx_2 + 1
STA case_2 + 7
LDA V
STA case_1 + 1
LDA V + 1
STA case_1 + 7
end_selfmod:
jsr pixel_draw
LDY #$00
LDX dy
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 + 1, #$3F ,#$01, !
increment_y_pos_end:
DEX
;CPX Y_end
BEQ end
Lag_16 D, D + 1, #$00, #$02, case_2
case_1:
Sub_16_A D, D + 1, #>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 + 1, #$07, #$00, !
LDA #%10000000
STA byte_to_paint
JMP for_y
case_2:
Add_16 D, D + 1, #>dx_2, #<dx_2, ! ;D = D + 2*dx
JMP for_y
end:
RTS
.endproc