! Configuration file for EDWIN Version 5 on the IBM PC with an Definicon board.

%external %string (80) SCCS String %alias "EDWIN_SCCS_VERSION" = -
"@(#)edwin.a      Version   5.6.2    27-Jun-89"

%external %string (63) %fn EDWIN VERSION %alias "EDWIN_VERSION"
   %result = Sub String (SCCS String, 5, length(SCCS String))
%end

%const %integer NUM DEV = 20

%from Edwin %include Device
%from Edwin %include Consts

!%external %routine %spec An X   %alias "EDWIN___A"     (%integer COM, X, Y)
!%external %routine %spec A REQ  %alias "EDWIN___A_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec A SAM  %alias "EDWIN___A_SAM" (%integer %name STATE, X, Y)
%external %routine %spec ASE    %alias "EDWIN___B"     (%integer COM, X, Y)
%external %routine %spec B REQ  %alias "EDWIN___B_REQ" (%integer %name STATE, X, Y)
%external %routine %spec B SAM  %alias "EDWIN___B_SAM" (%integer %name STATE, X, Y)
!%external %routine %spec CHAS   %alias "EDWIN___C"     (%integer COM, X, Y)
!%external %routine %spec C REQ  %alias "EDWIN___C_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec C SAM  %alias "EDWIN___C_SAM" (%integer %name STATE, X, Y)
!%external %routine %spec C MAP  %alias "EDWIN___C_MAP" (%integer A, R, B, G)
!%external %routine %spec D GIGI %alias "EDWIN___G"     (%integer COM, X, Y)
!%external %routine %spec G REQ  %alias "EDWIN___G_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec G SAM  %alias "EDWIN___G_SAM" (%integer %name STATE, X, Y)
%external %routine %spec HPPLOT %alias "EDWIN___H"     (%integer COM, X, Y)
%external %routine %spec H REQ  %alias "EDWIN___H_REQ" (%integer %name STATE, X, Y)
%external %routine %spec VERSA  %alias "EDWIN___K"     (%integer COM, X, Y)
!%external %routine %spec CALCOM %alias "EDWIN___L"     (%integer COM, X, Y)
%external %routine %spec MCP40  %alias "EDWIN___M"     (%integer COM, X, Y)
!%external %routine %spec ERCCGP %alias "EDWIN___N"     (%integer COM, X, Y)
!%external %routine %spec ERCCHP %alias "EDWIN___O"     (%integer COM, X, Y)
%external %routine %spec PS     %alias "EDWIN___P"     (%integer COM, X, Y)
!%external %routine %spec DHPTER %alias "EDWIN___R"     (%integer COM, X, Y)
!%external %routine %spec R REQ  %alias "EDWIN___R_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec DSIGMA %alias "EDWIN___S"     (%integer COM, X, Y)
!%external %routine %spec S REQ  %alias "EDWIN___S_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec S MAP  %alias "EDWIN___S_MAP" (%integer A, R, B, G)
!%external %routine %spec T4000  %alias "EDWIN___T"     (%integer COM, X, Y)
!%external %routine %spec T REQ  %alias "EDWIN___T_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec T4100  %alias "EDWIN___U"     (%integer COM, X, Y)
!%external %routine %spec U REQ  %alias "EDWIN___U_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec VIDEOS %alias "EDWIN___V"     (%integer COM, X, Y)
!%external %routine %spec V REQ  %alias "EDWIN___V_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec WC2014 %alias "EDWIN___W"     (%integer COM, X, Y)
!%external %routine %spec W REQ  %alias "EDWIN___W_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec W MAP  %alias "EDWIN___W_MAP" (%integer A, R, B, G)
!%external %routine %spec D X5A  %alias "EDWIN___X"     (%integer COM, X, Y)
!%external %routine %spec X REQ  %alias "EDWIN___X_REQ" (%integer %name STATE, X, Y)
!%external %routine %spec X SAM  %alias "EDWIN___X_SAM" (%integer %name STATE, X, Y)
!%external %routine %spec X MAP  %alias "EDWIN___X_MAP" (%integer A, R, B, G)
!%external %routine %spec YAWN   %alias "EDWIN___Y"     (%integer COM, X, Y)
!%external %routine %spec Y REQ  %alias "EDWIN___Y_REQ" (%integer %name STATE, X, Y)
%external %routine %spec LAZER  %alias "EDWIN___Z"     (%integer COM, X, Y)

%external %routine DRIVE DEVICE %alias "EDWIN_DRIVE_DEV"  (%integer COM, X, Y)
   %switch SW(0:NUM DEV)

   %on 9 %start
      ! IO errors from within the device drivers are really EDWIN system errors
      %signal 14, 1
   %finish

   %if COM=0 %start
       DEV DATA = 0
       X = X - 'a' + 'A' %if 'a'<=X<='z' %and X#100
       %if X=0 %start                                     { Null device }
           DEV DATA_NAME = "null"
           %return
!       %else %if 4002<=X<=4099 %or X=1015 %or X=2015 %or X=4662
!                                                          { Tektronix-Westward }
!           DEV DATA_DEV NO = 1
       %else %if X='G'                                    { GEM Meta-files }
           DEV DATA_DEV NO = 2
       %else %if X=7475 %or X=7470 %or X=7580 %or X=7550 -
             %or X=7220 %or X=72208 %or X=7585 %or X=7586 %or X=7440 { HP's }
           DEV DATA_DEV NO = 3
!       %else %if X=906 %or X=1012                         { Calcomp plotters }
!           DEV DATA_DEV NO = 4    
       %else %if X=16_5053 {m'PS'} %or X=16_7073  {m'ps'}  { Postscript printer }
           DEV DATA_DEV NO = 5
!       %else %if X=200 %or X=550 %or X=52 %or X=100 %or X=55 { C. A. T.'s } %c
!                       %or X='E' { 69 or 101 } %or X='V' { 86 or 118 } %c
!                       %or X='L' { 76 or 108 } %or X='X' { 120&95 }
!           DEV DATA_DEV NO = 6
!       %else %if X=2648                                 { HP terminal }
!           DEV DATA_DEV NO = 7
!       %else %if X=2014                                 { Westward colour }
!           DEV DATA_DEV NO = 8
!       %else %if X=5688 %or X=5684 %or X=5680           { Sigma displays }
!           DEV DATA_DEV NO = 9
!       %else %if X='G'                                  { GIGI terminal }
!           DEV DATA_DEV NO = 10
       %else %if X='D'
           DEV DATA_DEV NO = 11
!       %else %if X=5555 %or X=5 %or X=1                 { X5A or XK1 }
!           DEV DATA_DEV NO = 12
!       %else %if X=40                                   { MCP40 (oric) plotters }
!           DEV DATA_DEV NO = 13
       %else %if X=2686 %or X=2686150 %or X=2686300 %or X=33440 %or X=300 -
             %or X=8060 %or X=80120 %or X=10060 %or X=100120 %or 80<=X<=82
             { HP Laserjets, Printronix Printers, or Epson Printers }
           DEV DATA_DEV NO = 14
!       %else %if 4105 <= X <= 4109                      { Tek colour terminals }
!           DEV DATA_DEV NO = 15
!       %else %if 563<=X<=1051                           { Network Calcomp plotters }
!           DEV DATA_DEV NO = 16
!       %else %if X=-7220                                { Network HP plotter }
!           DEV DATA_DEV NO = 17
!       %else %if X=220 %or X=131 %or X=-200 %or X=-55    { Line terminals }
!           DEV DATA_DEV NO = 18
!       %else %if X='X'                                   { X Window }
!           DEV DATA_DEV NO = 20
       %else                                             { Versatec plotters ? }
           %signal 14, 0, X
       %finish
   %finish
   %return %if VIEWING<0 %or DEV DATA_DEV NO<=0 %or COM < 0 %or COM > NUM DEV
   ! Ignore calls to the null device driver, or if the parameter is out of range
   -> SW(DEV DATA_DEV NO)

!SW(1):  T4000  (COM, X, Y); %return  { Tektronix 4000 series storage tubes
SW(2):  ASE    (COM, X, Y); %return  { Gem Meta-files
SW(3):  HPPLOT (COM, X, Y); %return  { HP plotter driver
!SW(4):  CALCOM (COM, X, Y); %return  { Calcomps
SW(5):  PS     (COM, X, Y); %return  { Postscript printer
!SW(6):  VIDEOS (COM, X, Y); %return  { Cursor Addressable Terminal driver
!SW(7):  DHPTER (COM, X, Y); %return  { HP raster scan terminal.
!SW(8):  WC2014 (COM, X, Y); %return  { Westwood Colour display
!SW(9):  DSIGMA (COM, X, Y); %return  { Sigma Colour display
!SW(10): DGIGI  (COM, X, Y); %return  { DEC GIGI terminal
SW(11): ASE    (COM, X, Y); %return  { ES2 Solo PC et al
!SW(12): DX5A   (COM, X, Y); %return  { Datatype X5A terminal
!SW(13): MCP40  (COM, X, Y); %return  { GP 300 maxtix printer
SW(14): LAZER  (COM, X, Y); %return  { HP Laser printer
!SW(15): T4100  (COM, X, Y); %return  { Tek 4100 series displays
!SW(16): ERCCGP (COM, X, Y); %return  { ERCC Calcomp plotters (Graph pack)
!SW(17): ERCCHP (COM, X, Y); %return  { ERCC Network HP plotters (HP-GL + JCL)
!SW(18): YAWN   (COM, X, Y); %return  { Line terminals
!SW(19): VERSA  (COM, X, Y); %return  { Versatec plotters
!SW(20): An X  (COM, X, Y); %return  { X Windows
%end

%external %routine REQUEST DEVICE %alias "EDWIN_REQUEST_DEV" (%integer %name STATE, X, Y)
   %switch DC(0:NUM DEV)
   %signal 14,8,DEV DATA_DEV NO %unless 0 <= DEV DATA_DEV NO <= NUM DEV
   -> DC(DEV DATA_DEV NO)

!DC(1):  T REQ (STATE, X, Y); %return
!DC(2):  C REQ (STATE, X, Y); %return
DC(3):  H REQ (STATE, X, Y); %return
!DC(6):  V REQ (STATE, X, Y); %return
!DC(7):  R REQ (STATE, X, Y); %return
!DC(8):  W REQ (STATE, X, Y); %return
!DC(9):  S REQ (STATE, X, Y); %return
!DC(10): G REQ (STATE, X, Y); %return
DC(11): B REQ (STATE, X, Y); %return
!DC(12): X REQ (STATE, X, Y); %return
!DC(15): U REQ (STATE, X, Y); %return
!DC(18): Y REQ (STATE, X, Y); %return
!DC(20): A REQ (STATE, X, Y); %return
DC(*):  %signal 14, 8, DEV DATA_DEV NO
%end

%external %routine SAMPLE DEVICE %alias "EDWIN_SAMPLE_DEV" (%integer %name STATE, X, Y)
   B Sam (STATE, X, Y) %and %return %if Dev Data_Dev no = 11
!   A Sam (STATE, X, Y) %and %return %if Dev Data_Dev no = 20
   %signal 14, 8
%end

%external %routine AREA OF DEVICE %alias "EDWIN_AREA_DEV" (%integer %name XL, YB, XR, YT)
   %signal 14, 8
%end

%external %routine SET COLOUR MAP %alias "EDWIN_SET_COLOUR_MAP" (%integer ADR, RED, BLUE, GREEN)
!   %integer DEVICE
!   DEVICE = DEV DATA_DEV NO
!   %if DEVICE=CHARLES %start
!       C MAP (ADR, RED, BLUE, GREEN)
!   %finish %else %if DEVICE=SIGMA %start
!       S MAP (ADR, RED, BLUE, GREEN)
!   %finish %else %if DEVICE=WESTWARD %start
!       W MAP (ADR, RED, BLUE, GREEN)
!   %finish %else %if DEVICE=X5A %start
!       X MAP (ADR, RED, BLUE, GREEN)
!   %finish
%end

%end %of %file
