They swap them because they use the longest direction as a basis.
But normally they must operate with relative coordinates, and these do not change - only the source position does.
At least, this is how my own line drawing routine works.
See (d1-d2=origin, d3=color, d4-d5=offset) :
Code:
movem.l d0/d4-d7/a0-a2,-(a7)
movea.w #1,a0
move.l a0,a1 ; a0=a1=1 (init dir)
tst.l d4
bpl.s .abs1
neg.l d4
subq.l #2,a0 ; will be -1
.abs1
tst.l d5
bpl.s .abs2
neg.l d5
subq.l #2,a1
.abs2
move.l d4,d6 ; counter (here x)
cmp.l d4,d5
blo.s .max
move.l d5,d6 ; counter (here y)
.max
move.l d6,d0 ; loop cntr
move.l d6,a2 ; save for addy
lsr.l #1,d6 ; round to avoid "last pixel" effect
move.l d6,d7 ; d6=x cntr, d7=y cntr
bra.s .yp ; put 1st pix (+ finish if same pos)
.loop
sub.l d4,d6
bgt.s .xp
add.l a0,d1 ; depl x
add.l a2,d6
.xp
sub.l d5,d7
bgt.s .yp
add.l a1,d2 ; depl y
add.l a2,d7
.yp
bsr setpixel ; set pixel at (d1,d2) to color d3
dbf d0,.loop
movem.l (a7)+,d0/d4-d7/a0-a2
rts
The above code will update the coordinates d1,d2 to the new position.
Keep d4-d5 at the same value and you will redo the exact same move from the new position.
Just replace "setpixel" call by whatever output you need.
For your example, pass in d1=x2, d2=y2, d4=(x1-x2), d5=(y1-y2).