
                   Computer Science IMP-77 Compiler.  Version 4.17

              1  %include "EDWIN:EDWIN.SPECS"
              &  { EDWIN routine specs added }                   %end %of %list
              2  %begin
              3  
              4     ! EDWIN test program 2
              5     ! This tests some of the attribute commands, for altering colour,
              6     ! line style, and character size.
              7     ! The picture is designed to show how windowing in EDWIN operates. 
              8     ! It is best run on a 4014 or VT15 to get the correct attributes set,
              9     ! because the other devices can't support the attributes.
             10  
             11     %const %integer BLACK = 1, BLUE = 2, RED = 4
             12     %const %integer NORMAL = 0, DOTTED = 1, SDASH = 3, LDASH = 4
             13     %integer TYPE
             14  
             15     %routine PRINT TEXT (%string (255) S, %integer X, Y)
             16        MOVE ABS (X,Y)
             17        TEXT (S)
             18     %end
             19  
             20     %routine JOIN (%integer X1, Y1, X2, Y2)
             21        MOVE ABS (X1,Y1)
             22        LINE ABS (X2,Y2)
             23     %end
             24   
             25     %routine RECT (%integer X, Y, H, V)
             26        MOVE ABS (X,Y)
             27        LINE REL (H,0); LINE REL (0,-V)
             28        LINE REL (-H,0); LINE REL (0,V)
             29     %end
             30  
             31     PROMPT ("Device Type:")
             32     READ (TYPE)
             33     INITIALISE FOR (TYPE)
             34  
             35     NEW FRAME
             36  
             37     STORE ON (2)
             38     ! A copy of the picture will be made on stream 2.
             39  
             40     ! Now that everything is set up the picture can be drawn.
             41  
             42  
             43     RECT (0,1023,1023,1023)
             44  
             45     SET CHAR SIZE (14)
             46     SET LINE STYLE (LDASH)
             47     RECT (300,900,600,400)
             48     PRINT TEXT ("VIEW PLANE, 700, 920)
             49     
             50     SET CHAR SIZE (12)
             51     RECT (200,400,500,300)
             52     PRINT TEXT ("VIEW SURFACE", 720, 250)
             53  
             54     SET COLOUR (BLUE)
             55     SET LINE STYLE (SDASH)
             56     RECT (500,800,300,200)
             57     PRINT TEXT ("WINDOW", 620,810)
             58    
             59     RECT (300,350,200,200)
             60     SET CHAR SIZE (9)
             61     PRINT TEXT ("VIEW PORT", 350,170)
             62     
             63     SET LINE STYLE (DOTTED)
             64     SET COLOUR (RED)
             65     JOIN (500, 800, 300, 350)
             66     JOIN (800, 800, 500, 350)
             67     JOIN (500, 600, 300, 150)
             68     JOIN (800, 600, 500, 150)
             69  
             70     SET CHAR SIZE (7)
             71     PRINT TEXT ("VIEWING TRANSFORMATION", 720,450)
             72  
             73     TERMINATE EDWIN
             74  
             75  %end %of %program
          ? NORMAL unused
          ? BLACK unused

              90 Statements compiled
