externalroutine SHOWOFF(string(255) REPEATER)
!
!%externalroutinespec CLEAR(%string(255) S)
!%externalroutinespec CONSOLE %alias "S#CONSOLE"(%integer EP,%integername START,LEN)
!%externalintegerfnspec DDELAY(%integer I)
!%externalroutinespec DEFINE(%string(255) S)
!%externalintegerfunctionspec EXIST(%string(31) F)
!%externalroutinespec DRAW PICTURE(%string(255) S)
!%externalstring(63)%functionspec INTERRUPT
!
!%include "ECSLIB.GENERALY_IMPPREDEF"
include "types.inc"
include "specs.inc"
include "shapes.inc"
include "consts.inc"
!
integer C,CVAL,FLAG,I,N
constinteger NUM=10
integerarray X(1:4), Y(1:4)
constintegerarray FORTYEIGHTNUMBERS(1:48)= c
250,250,250,400,105,330,105,180,
250,250,250,400,395,330,395,180,
250,250,395,180,250,120,105,180,
250,250,285,275,250,295,215,275,
215,275,250,250,250,205,215,230,
250,250,285,275,285,230,250,205
constantstring(1) SNL="
"
!
constantstring(31) CATFILE="ERCN09.SHOWOFFEGS_PUSSYCAT23"
constantstring(31) CHIPFILE1="ERCN09.SHOWOFFEGS_CHIP1XPDF"
constantstring(31) CHIPFILE2="ERCN09.SHOWOFFEGS_CHIP2XPDF"
constantstring(31) EASYGEG="ERCN09.SHOWOFFEGS_EASYGEG"
constantstring(31) WORLDMAPFILE="ERCN09.SHOWOFFEGS_WORLDXPDF"
!
record(POINTFM)array POLYPOINTS(1:10)
!
routine wait (integer i)
integer c
for i = 1, 1, i cycle
for c = 1, 1, 65000 cycle
repeat
repeat
end
routine DRAW THREE POLYGONS
integer N,WOW
for WOW=1,1,3 cycle
for N=1,1,4 cycle
C=C+1; POLYPOINTS(N)_X=FORTYEIGHTNUMBERS(C)
C=C+1; POLYPOINTS(N)_Y=FORTYEIGHTNUMBERS(C)
repeat
POLYGON(4,POLYPOINTS)
repeat
end
!
routine SAFE REVIEW
! Calls the EDWIN routine REVIEW which will return at the
! end of the picture, or signal event 9 if the picture description ends.
on 9 start
return
finish
REVIEW
end
!
! Trap any Errors which are signalled by EDWIN
on 14 start
TERMINATE EDWIN
PRINT STRING("EDWIN error : ".EDWIN ERROR(event_sub))
NEWLINE
stop
finish
!
!===================================================== SHOWOFF ============
!
REPEAT: ;! cycle around on indefinite display if SHOWOFF param REPEATER#""...
!
INITIALISE FOR(DEFAULT DEVICE) ;! this Edwin routine looks up terminaltype.
WINDOW(0,1023,0,767) ;! initialise scaling..
!
!----------------------------------------------------------- DEMO 1
!
NEWFRAME ;! clear screen.
MOVE ABS(512,384) ;! move cursor to centre of screen.
SET COLOUR(YELLOW) ;! yellow.
SET SHADE MODE(SOLID) ;! subsequent figure(s) to be shaded in solid colour.
CIRCLE(250)
SET COLOUR MODE(INVERT MODE) ;! new colour to be 'inverted' with existing colour.
SET SHADE MODE(OUTLINE) ;! figure to be drawn in outline only.
if Charles#device data_devno#bbc micro start
{ These both have very show circle shading, done from mainframe }
for I=248,-4,0 cycle
CIRCLE(I)
repeat
finish
UPDATE ;! make sure all the output is sent.
-> EXIT if INTERRUPTED ; ! user must be able to interrupt out of indefinite loop!
WAIT(7)
!
!----------------------------------------------------------- DEMO 2
! draws a series of 15 boxes coloured with the Edwin colours.
!
NEWFRAME ;! clear screen
SET COLOUR(BLACK)
SET CHAR SIZE(8)
MOVE ABS(0,475)
TEXT("Edwin Colours:")
for C=225,50,925 cycle
MOVE ABS(C,475)
TEXT(ITOS((C-225)//50+1,0))
repeat
UPDATE
N=200
SET SHADE MODE(SOLID) ;! solid filled-in colour.
for C=1,1,15 cycle ; ! now draw 15 coloured boxes!
SET COLOUR(C)
RECTANGLE(N,400,N+50,450)
UPDATE
N=N+50
repeat
-> EXIT if INTERRUPTED
WAIT(3)
!
!----------------------------------------------------------- DEMO 3
! draws 4 lines of text in various character sizes, and a GIMMS appreciation of Graeme!:
!
NEWFRAME ;! clear screen
SET COLOUR(BLACK)
SET COLOUR MODE(REPLACE MODE)
MOVE ABS(20,700)
SET CHAR SIZE(7)
TEXT("The built-in character-sets:")
for C=2,1,5 cycle
SET COLOUR(C)
SET CHAR SIZE(C*3)
MOVE ABS(20,(600-(C-2)*100))
TEXT("abcdefghijklmnopqrstuvwxyz")
TEXT(" ABCDEFGHIJKLMNOPQRSTUVWXYZ") if C<4
UPDATE
repeat
SET COLOUR(BLACK)
MOVE ABS(20,200)
SET CHAR SIZE(7)
TEXT("And some of EDWIN's character sets:")
SET CHAR QUALITY(1)
MOVE ABS(10,100)
SET COLOUR(YELLOW)
SET CHAR SIZE(35)
SET CHAR FONT(16)
TEXT("NB: ")
SET CHAR FONT(26)
TEXT("Graeme Wallace")
SET CHAR FONT(60)
TEXT(" was ")
SET CHAR FONT(61)
TEXT("here!")
UPDATE
SET COLOUR(BLACK)
SET CHAR FONT(0)
SET CHAR SIZE(7)
SET CHAR QUALITY(0)
-> EXIT if INTERRUPTED
WAIT(10)
!
!----------------------------------------------------------- DEMO 4
! light blue '3D' box in a dark blue '3D' corner:
!
NEWFRAME
SET COLOUR MODE(INVERT MODE)
SET COLOUR(BLUE) ;! dark blue.
SET SHADE MODE(SOLID)
C=0
DRAW THREE POLYGONS
SET COLOUR MODE(REPLACE MODE) ;! REPLACE old colour with new - ie REPLACE.
SET COLOUR(11) ;! light blue
DRAW THREE POLYGONS
SET COLOUR(BLACK) ;! black.
MOVE ABS(250,250); LINE ABS(215,275) ;! black outlines of small box..
MOVE ABS(250,250); LINE ABS(285,275)
MOVE ABS(250,250); LINE ABS(250,205)
UPDATE
-> EXIT if INTERRUPTED
WAIT(6)
!
!----------------------------------------------------------- DEMO 5
! overlay some coloured boxes to demonstrate colour-summing..
!
NEWFRAME
SET COLOUR MODE(INVERT MODE) ;! 'invert' new colour with old..
SET COLOUR(GREEN)
RECTANGLE(300,300,400,400)
UPDATE
WAIT (2)
SET COLOUR(RED)
RECTANGLE(300,300,500,500)
UPDATE
WAIT (2)
SET COLOUR(BLUE)
RECTANGLE(400,400,600,600)
UPDATE
WAIT (2)
SET COLOUR(YELLOW)
RECTANGLE(300,300,600,600)
UPDATE
WAIT (2)
SET COLOUR(GREEN)
RECTANGLE(300,300,400,400)
UPDATE
WAIT (2)
SET COLOUR(RED)
RECTANGLE(300,300,500,500)
UPDATE
WAIT (2)
SET COLOUR(BLUE)
RECTANGLE(400,400,600,600)
UPDATE
-> EXIT if INTERRUPTED
SET COLOUR MODE(REPLACE MODE)
WAIT(1)
!
!----------------------------------------------------------- DEMO 6
! Nine circles, variously coloured and shaded:
!
NEWFRAME
MOVE ABS(55,20)
SET CHAR SIZE(7)
TEXT("DEMONSTRATION OF TERMINAL'S IN-BUILT SHADING CAPABILITY:")
for I=0,1,9 cycle
MOVE ABS(55+I*110,200)
SET COLOUR(I+2)
SET SHADE MODE(I)
CIRCLE(50)
UPDATE
repeat
-> EXIT if INTERRUPTED
SET SHADE MODE(OUTLINE)
WAIT(3)
!
!----------------------------------------------------------- DEMO 7
! draws 8 lines, in different colours and linestyles if the terminal can take it!
! (note that Edwin actually only offers the first FOUR - for device-independence).
!
for C=0,1,7 cycle
SET COLOUR(C+2)
SET LINESTYLE(C)
MOVE ABS(100,(700-C*40))
LINE REL(700,0)
repeat
UPDATE
-> EXIT if INTERRUPTED
SET LINESTYLE(0)
WAIT (8)
!
!----------------------------------------------------------- DEMO 8
! flings up a routine EASYGRAPH example:
!
! %if EXIST(EASYGEG)#0 %thenstart
! NEWFRAME
! MOVE ABS(200,650)
! SET COLOUR(BLACK)
! SET CHAR SIZE(8)
! TEXT("A sample of EASYGRAPH output:")
! MOVE ABS (0, 0)
! DEFINE("66,".EASYGEG)
! SELECTINPUT(66)
! SAFE REVIEW
! UPDATE
! SELECTINPUT(0); CLOSESTREAM(66); CLEAR("66")
! %finishelse PRINTSTRING("Sorry: ".EASYGEG." does not exist or not access.".SNL)
! -> EXIT %if INTERRUPT#""
! FLAG=-1
! CONSOLE(9,FLAG,FLAG)
! I=DDELAY(4)
!!
!!----------------------------------------------------------- DEMO 9
!! Charles Duncan's coloured map of the world, courtesy of Gordon!
!!
! TERMINATE EDWIN
! INITIALISE FOR(DEFAULT DEVICE) ;! Start with a clean slate
! %if EXIST(WORLDMAPFILE)#0 %thenstart
! NEWFRAME
! DEFINE("66,".WORLDMAPFILE)
! SELECTINPUT(66)
! SAFE REVIEW
! UPDATE
! SELECTINPUT(0); CLOSESTREAM(66); CLEAR("66")
! %finishelse PRINTSTRING("Sorry: ".WORLDMAPFILE." does not exist or no access.".SNL)
! -> EXIT %if INTERRUPT#""
! FLAG=-1
! CONSOLE(9,FLAG,FLAG)
! I=DDELAY(4)
!!
!!----------------------------------------------------------- DEMO 10
!! draws an extract from one of Gordon's chips:
!!
! %if EXIST(CHIPFILE1)#0 %and EXIST(CHIPFILE2)#0 %thenstart
! NEWFRAME
! MOVE ABS(0,950)
! SET COLOUR(BLACK)
! SET CHAR SIZE(7)
! TEXT("Two examples of parts of integrated circuits drawn by EDWIN")
! UPDATE
! ! Note that the use of VIEWPORT is device specific.
! ! in this example the viewport is set to be a area relative to the
! ! maximum device drawing area. This is good for interactive displays
! ! but remember some plotters may have VERY LARGE areas available!
! VIEW PORT (0, INT(DEVICE DATA_MVX * 4.5/10),
! INT(DEVICE DATA_MVY * 2/10), INT(DEVICE DATA_MVY * 8/10))
! DEFINE("67,".CHIPFILE1)
! SELECTINPUT(67)
! SAFE REVIEW
! SELECTINPUT(0); CLOSESTREAM(67); CLEAR("67")
! VIEW PORT (INT(DEVICE DATA_MVX * 5.5/10), DEVICE DATA_MVX,
! INT(DEVICE DATA_MVY * 2/10), INT(DEVICE DATA_MVY * 8/10))
! DEFINE("67,".CHIPFILE2)
! SELECTINPUT(67)
! SAFE REVIEW
! UPDATE
! SELECTINPUT(0); CLOSESTREAM(67); CLEAR("67")
! %finishelse PRINTSTRING("Sorry: ".CHIPFILE2." does not exist or no access.".SNL)
! -> EXIT %if INTERRUPT#""
! FLAG=-1
! CONSOLE(9,FLAG,FLAG)
!!
!!----------------------------------------------------------- DEMO 11
!! draws the NOTICE pussy-cat!
!!
! %if EXIST(CATFILE)#0 %thenstart
! DRAW PICTURE(CATFILE.",.OUT")
! %finishelse PRINTSTRING("Sorry: ".CATFILE." does not exist or no access.".SNL)
! -> EXIT %if INTERRUPT#""
! FLAG=-1
! CONSOLE(9,FLAG,FLAG)
! I=DDELAY(5)
!
! -> REPEAT %if REPEATER#"" ;! param to SHOWOFF command non-null for indefinite repetition (until interrupted)
!
!----------------------------------------------------------- DEMO 12
! Gordon's cursor-testing program, for users to try themselves!
!
INITIALISE FOR(DEFAULT DEVICE) { Note DRAW PICTURE calls TERMINATE EDWIN }
NEWFRAME
UPDATE
SET COLOUR(BLACK)
PRINTSTRING("THE LAST EXAMPLE GIVES YOU AN OPPORTUNITY TO TRY OUT THE X5A FOR YOURSELF!".SNL.SNL)
PRINTSTRING("In a couple of moments a ""cross-hair cursor"" will appear on the screen:".SNL)
PRINTSTRING("Try moving this around to four different points on the screen -".SNL)
PRINTSTRING("using the cursor-keys or the ""JOYDISC"" on the left of the keyboard -".SNL)
PRINTSTRING("typing any key to fix each point.".SNL)
PRINTSTRING(SNL."When you want to finish, type S (for STOP).".SNL)
cycle
for I=1,1,4 cycle
REQUEST INPUT(CVAL,X(I), Y(I))
exit if CVAL='s' or CVAL='S'
if I&1=1 then MOVE ABS(X(I),Y(I)) else LINE ABS(X(I),Y(I))
MARKER REL(6,0,0)
repeat
exit if CVAL='s' or CVAL='S'
for I=0,1,NUM cycle
SET COLOUR(I+2)
MOVE ABS(X(1)+I*(X(2)-X(1))//NUM, Y(1)+I*(Y(2)-Y(1))//NUM)
LINE ABS(X(3)+I*(X(4)-X(3))//NUM, Y(3)+I*(Y(4)-Y(3))//NUM)
repeat
repeat
!
EXIT: TERMINATE EDWIN ;! user can interrupt out to here to abort indefinite loop.
!
end
!%externalroutine showoffx5a(%string(255) s)
! %externalroutinespec terminaltype(%string(255) s)
! terminaltype("27")
! showoff(s)
!%end
begin
showoff ("")
end
Endoffile