#
# canola - canon canola 1614p emulator
# Copyright (C) 2011 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see .
#
; ---------- Card-Pocket-Begin -------------------------------------------
; Title: MS-20: Rectangular to Polar
; Accuracy: 10 digits
; Color: green
; Style: blank
; ---------- Card-Pocket-End ---------------------------------------------
;
; Input: M14 => x
; M13 => y
; Output: M14 => r
; M13 => theta (degrees)
;
SFJ $306
RM14
*
-=
MJ $412
RM13
MJ $412
SM14
90
SM13
SRJ
FJ $413
CS
SM14
270
SM13
SRJ
FJ $412
RM13
/
RM14
+=
MJ $414
1
SM12
UJ $500
FJ $414
1
CS
SM12
FJ $500
RV
*
+=
1
+=
/
1
RV
+=
SQRT
1
-=
/
2
-=
SM11
SQRT
SM10
1
SM9
RV
CS
FJ $501
CS
*
RM9
*
RM9
+=
1
M9
RV
/
RM9
*
RM11
+=
1
M9
RV
/
RM9
+=
M10
CS
MJ $501
114.5915590262
*
RM10
*
RM12
+=
SM12
RM14
*
+=
SM11
RM13
*
+=
M11
RM11
SQRT
SM11
RM14
MJ $502
RM13
MJ $503
UJ $504
FJ $503
360
M12
UJ $504
FJ $502
180
M12
FJ $504
RM11
SM14
RM12
SM13
SRJ