%%HP: T(3)A(D)F(.);
\<<

@       Program to compute co-ordinates of
@       intersection of two lines

@  Multiple line input for line 1

"" {
":x1:
:y1:
:x2:
:y2:"
{ 1 0 } }
INPUT OBJ\->

@ Multiple line input for line 2

"" {
":x3:
:y3:
:x4:
:y4:"
{ 1 0 } }
INPUT OBJ\->

@ store as local variables

\-> x1 y1 x2 y2 x3 y3 x4 y4
\<<

@ Build inverse matrix

y2 y1 -
x1 x2 -
\->V2

y4 y3 -
x3 x4 -
\->V2

2 ROW\->
INV

@ Build second matrix

x1 y2 *
x2 y1 * -

x3 y4 *
x4 y3 * -

\->V2

@ Muliply two matrices

*

@ Resolve vector
V\->

@ Display intersected co-ordinates

SWAP
" Intersection at 

xp = " SWAP 3 FIX +
"
yp = " + SWAP +
CLLCD 1 DISP 3 FREEZE
0 WAIT DROP

\>>
\>>
