Category : Modula II Source Code
Archive   : LINEDRAW.ZIP
Filename : LINEDRAW.DEF

 
Output of file : LINEDRAW.DEF contained in archive : LINEDRAW.ZIP
DEFINITION MODULE LineDraw;


(* 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. *)

(* This module provides primitive graphics capabilities. It assumes EGA
640 x 350 color mode (procedure Clear puts the system in this mode).
It uses a virtual screen that is 800 wide by 600 high with the origin
in the lower left hand corner. *)


(* EXPORT QUALIFIED
width, height, CharWidth, CharHeight, PaintMode, Px, Py,
mode, dot, line, paint, copyArea, clear, Write, WriteString, text; *)

TYPE
PaintMode = (replace, add, invert, erase);

VAR
Px, Py : INTEGER; (* Current coordinates of drawing pen *)
mode : PaintMode; (* Current mode for paint and copy *)
width : INTEGER; (* Width of picture area, read-only *)
height : INTEGER; (* Height of picture area, read-only *)
CharWidth : INTEGER; (* Witdh of a Character *)
CharHeight : INTEGER; (* Height of a Character *)


PROCEDURE dot(c : CARDINAL; x,y : INTEGER);
(* Place a dot at coordinate x,y in color c *)

PROCEDURE line(d, n : CARDINAL);
(* Draw a line of length n, in direction d
(angle = 45 * d (in degrees)) *)

PROCEDURE paint(c : CARDINAL; x,y,w,h : INTEGER);
(* Paint the rectangular area at x,y of width w and height h in
color c, where :
0 = white
1 = light gray
2 = dark gray
3 = black
*)

PROCEDURE copyArea(sx, sy, dx, dy, dw, dh : INTEGER);
(* Copy rectangular area at sx, sy into rectangle at ds, dy
of width dw, and height dh *)

PROCEDURE clear; (* Clear the Screen *)
(* Note, also palces display into EGA 640 X 50 color mode. *)

PROCEDURE Write(ch : CHAR); (* Write ch at pen's position. *)

PROCEDURE WriteString(s : ARRAY OF CHAR);

PROCEDURE text; (* Puts the Screen into text mode again. *)

END LineDraw.



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

  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/