Professional Documents
Culture Documents
txt
; This RPN calculator program draws a spirograph picture.
;
;
;
;
;
;
;
;
; x = (R+r)*cos(t) - p*cos(((R+r)/r)*t)
; y = (R+r)*sin(t) - p*sin(((R+r)/r)*t)
; where t is the angle theta which starts at 0 degrees
; and continues incrementing forever.
;
;
;
;
;
;
;
;
;
;
Rolldown
STO 2
; Reg[2] is used to hold r
Rolldown
STO 1
; Reg[1] is used to hold R
RCL 1
RCL 2
+
STO 4
;
;
;
;
X = R
X = r, Y = R
X = R+r
Reg[4] is used to hold (R+r)
+0.
STO 0
LBL 1
4
0
4
2
0
3
;
;
;
;
;
;
;
;
;
;
;
;
;
X
X
X
X
X
X
X
X
X
X
X
X
X
=
=
=
=
=
=
=
=
=
=
=
=
=
R+r
t, Y = R+r
sin(t), Y = R+r
(R+r)*sin(t)
R+r, Y = (R+r)*sin(t)
r, Y = R+r, Z = (R+r)*sin(t)
(R+r)/r, Y = (R+r)*sin(t)
t, Y = (R+r)/r, Z = (R+r)*sin(t)
((R+r)/r)*t, Y = (R+r)*sin(t)
sin(((R+r)/r)*t), Y = (R+r)*sin(t)
p, Y = sin(((R+r)/r)*t), Z = (R+r)*sin(t)
p*sin(((R+r)/r)*t), Y = (R+r)*sin(t)
(R+r)*sin(t) - p*sin(((R+r)/r)*t)
4
0
4
2
0
3
;
;
;
;
;
;
;
;
;
;
;
;
;
X
X
X
X
X
X
X
X
X
X
X
X
X
=
=
=
=
=
=
=
=
=
=
=
=
=
R+r
t, Y = R+r
cos(t), Y = R+r
(R+r)*cos(t)
R+r, Y = (R+r)*cos(t)
r, Y = R+r, Z = (R+r)*cos(t)
(R+r)/r, Y = (R+r)*cos(t)
t, Y = (R+r)/r, Z = (R+r)*cos(t)
((R+r)/r)*t, Y = (R+r)*cos(t)
cos(((R+r)/r)*t), Y = (R+r)*cos(t)
p, Y = cos(((R+r)/r)*t), Z = (R+r)*cos(t)
p*cos(((R+r)/r)*t), Y = (R+r)*cos(t)
(R+r)*cos(t) - p*cos(((R+r)/r)*t)