Category : Modula II Source Code
Archive   : LINEDRAW.ZIP
Filename : MATHPLOT.MOD

 
Output of file : MATHPLOT.MOD contained in archive : LINEDRAW.ZIP
MODULE MathPlot;

(* Adapted from the code listings in the April 1988 issue of Dr. Dobbs
Journal of Software Tools. The article was the Structed Programming
Column by Kent Porter in which he developed an implementation of Dr.
Writh's line drawing module. This FST adaptation of the module by
Larry Maturo, 12209 Arrowwood Drive, Austin, Texas 78727. *)


FROM MathLib0 IMPORT sin, cos, real, entier;
FROM LineDraw IMPORT line, dot, clear, WriteString, Px, Py, text;
FROM InOut IMPORT Read;

VAR x, sx, cx, y : REAL;
xc : INTEGER;
ch : CHAR;

PROCEDURE yc(y : REAL) : INTEGER;
BEGIN
RETURN entier(y * 100.0) + 300;
END yc;

BEGIN
clear;
Px := 0; Py := 300; line(0,800); (* Axis *)
Px := 0; Py := yc(1.0); (* Set Cooridinates to 0,400 *)
dot(2,Px,Py); (* Set Color *)
WriteString(" 1");
line(0,750); (* Draw line from 0,400 for 750 units in the direction east. *)
Px := 0; Py := yc(-1.0); (* Set Cooridinates to 0,200 *)
WriteString(" -1");
line(0,750); (* Draw line from 0,200 for 750 units in the direction east. *)
FOR xc := 125 TO 799 BY 126 DO (* draw a series of 4 vertical lines *)
Px := xc; Py := yc(2.0); line(6,400);
END;
Px := 310; Py := 599;
WriteString("y = cos x + sin 2x ");
FOR xc := 1 TO 799 DO
x := real(xc)/80.0; (* Convert x to radians *)
sx := sin(2.0 * x);
dot(2,xc,yc(sx));
cx := cos(x);
dot(1,xc,yc(cx));
y := sx + cx;
dot(0,xc,yc(y));
END;
Read(ch);
text;
END MathPlot.


  3 Responses to “Category : Modula II Source Code
Archive   : LINEDRAW.ZIP
Filename : MATHPLOT.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/