c64-livecoding/wip-hugo/routines/line/line.s
2025-03-31 00:10:51 +02:00

49 lines
1,006 B
ArmAsm

;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*-
.proc line; X_pos =< X_end skall alltid gälla
.include "line.inc"
dx_ = $0c
dy_ = $06
;;dx
SEC
LDA X_end
SBC X_pos
STA dx_
BCC dx_no_underflow;; X_end >= X_pos
EOR #$ff ; Fix bit underflow
dx_no_underflow:
SEC
LDA Y_pos
SBC Y_end
STA dy_
BCC down ;normal Y_pos < Y_end
up:; Y_pos > Y_end
STA dy_
CMP dx_
BCC shallow; dy < dx
steep:
jsr line_up_inv
RTS
shallow: ;dy =< dx
lda dx_
jsr line_up
RTS
down:
EOR #$ff ; Fix bit underflow
STA dy_
CMP dx_
BCC shallow_; dy < dx
steep_:
;LDA dx
jsr line_down_inv
RTS
shallow_: ;dy < dx
jsr line_down
RTS
.include "line_down.s"
.include "line_down_inv.s"
.include "line_up.s"
.include "line_up_inv.s"
.endproc