{$N+,E+} Program Prologo_II; Uses Graph,CRT,Tools,Scrolling,GetCom,ComChange,ComExec,Deg2Rad ,ComCarry,Repeats,Builder,Stack,Queue,Error,EPSON,uservars; Type RadMem=Array[0..359] of Real; Var Rmem:RadMem; Ch:Char; s,Command,LastCommand:String; boo,Pendown,TurtleOn,Abort:Boolean; za,Angle,Colour:Integer; x,y:Real; Com:Byte; Location,fse:Word; Begin; {-----------Introduction & Title screen-----------} {----------Prepare all variables for use----------} X:=225; Y:=185; Angle:=0; PenDown:=True; TurtleOn:=True; Building:=False; SetRmem; Colour:=White; Ch:='`'; LastCommand:=''; Location:=0; Qcreate; Screate; SlowMo:=False; ClrVars; {------------------Setup Screen-------------------} Graclr(Red); {Initialize Graphics Mode} SetViewPort(0,0,GetmaxX,GetmaxY,True); {Sets the Current window} {for Graphics Output. } Line(450,0,450,479); {Graphics area #1 - 1, 1,449,369} Line(0,370,450,370); {Text area #1 - 1,371,279,478} Line(280,370,280,479); {Text area #2 - 451, 1,638,478} {Variable area #1 - 281,371,369,478} DrawTurtle(X,Y,Angle,Colour,TurtleOn); {Draws the Turtle} SetColor(White); {----------------Run Main Program-----------------} Repeat SetColor(White); { Displays all information } Setfillstyle(SolidFill,Black); { to be shown in the } Str(Round(x),s); { Information window. } Bar(345,374,400,381); OuttextXY(345,374,s); OuttextXY(284,374,'X-pos :'); Str(Round(y),s); Bar(345,384,400,391); OuttextXY(345,384,s); OuttextXY(284,384,'Y-pos :'); Str(Angle,s); Bar(345,394,368,401); OuttextXY(345,394,s); OuttextXY(284,394,'Angle :'); SetFillstyle(SolidFill,Colour); Bar(352,404,362,411); OuttextXY(284,404,'Colour :'); SetFillStyle(Solidfill,Black); if TurtleOn=True then s:='ON' else s:='OFF'; Bar(352,414,374,421); OuttextXY(352,414,s); OuttextXY(284,414,'Turtle :'); if PenDown=True then s:='DOWN' else s:='UP'; Bar(329,424,360,431); OuttextXY(329,424,s); OuttextXY(284,424,'Pen :'); if Building then Begin SetColor(Yellow); OutTextxy(284,444,'BUILDING'); end else Bar(284,444,360,451); {-------------------------------------------------------------------} fse:=468; boo:=false; GetCommand(2,fse,279,Command,Abort,boo); {Get Command} Alter(Command); {Alter Command to Logo-Understandable} if (Building) and (Copy(Command,1,7)<>'REPEAT ') and (Copy(Command,1,5)<>'MAKE ') then Writeln(Buildfile,Command); {if Building and neither a MAKE or REPEAT has been entered, } {Write the command to the BuildFile. } {If Building and the Command was either a REPEAT or a MAKE, } {Then it will be written to the buildfile later on somewhere } {withing the REPEATS unit. } Com:=0; if Command='DUMP' then begin Command:=''; Dump; end; if Command<>'' then Carryout(Command,Com,x,y,Angle,Colour,Pendown,TurtleOn ,Location); If (Com>99) and (com<200) then ShowError(Com); {If an Invalid Command was entered, show the Error. } Scrolltext; {Scroll the Text area up by one line. } if Abort=True then begin ShowError(113); repeat ch:=Readkey; ch:=Upcase(ch); if ch='N' then begin Abort:=False; Ch:='Y'; end; until ch='Y'; ScrollText; end; Until Abort=True; {Loop until Escape is Pressed } { (Triggering abort Flag) } Closegraph; {Close Down Graphics Mode and return to Text. } End. {End LOGO. }