Add README.md
[pdp8.git] / sw / src / pascal / PLOTES.PS
CommitLineData
81e70d48
PH
1PROGRAM PLOTTERTEST(OUTPUT);
2
3CONST UP="H"; DOWN="I";
4 C=100.0; P=0.125; RHO=0.0174532925;
5 X0=950.0; Y0=1300.0;
6
7VAR X,Y,R,PHI: REAL;
8 GRAD: INTEGER;
9
10 PENXPOS,PENYPOS: INTEGER;
11
12(********** P L O T T E R PROZEDUREN **********)
13
14PROCEDURE PEN(I:CHAR);
15 BEGIN WRITE(I) END;
16
17PROCEDURE SEND(IX,IY: INTEGER);
18 BEGIN
19 IF IX>=0 THEN WRITE( IX:1,"@")
20 ELSE WRITE(-IX:1,"P");
21 IF IY>=0 THEN WRITE( IY:1,"A")
22 ELSE WRITE(-IY:1,"Q")
23 END;
24
25PROCEDURE MOVE(X,Y: REAL);
26 BEGIN
27 PENXPOS:=ROUND(X); PENYPOS:=ROUND(Y);
28 WRITE("H");
29 SEND(PENXPOS,PENYPOS);
30 WRITELN("K")
31 END;
32
33PROCEDURE LINE(X,Y: REAL);
34 VAR DX,DY: INTEGER;
35 BEGIN
36 DX:=ROUND(X)-PENXPOS;
37 DY:=ROUND(Y)-PENYPOS;
38 SEND(DX,DY); WRITELN("J");
39 PENXPOS:=PENXPOS+DX; PENYPOS:=PENYPOS+DY
40 END;
41
42PROCEDURE SYSIZE(R,G: INTEGER);
43 BEGIN
44 WRITE("C", CHR(G+16*(R+2)))
45 END;
46
47(***********************************************)
48
49BEGIN
50 MOVE(200,2600);
51 SYSIZE(0,6);
52 WRITELN("BPLOTTER-PROGRAMMIERUNG IN PASCAL-S");
53 MOVE(X0,Y0);
54 PEN(DOWN);
55 MOVE(X0+C,Y0);
56 PEN(DOWN);
57 FOR GRAD := 1 TO 180 DO
58 BEGIN
59 PHI := 5*GRAD*RHO;
60 R := C*EXP(P*PHI);
61 X := R*COS(PHI);
62 Y := R*SIN(PHI);
63 LINE(X0+X,Y0+Y)
64 END;
65 PEN(UP)
66END.