|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 5120 (0x1400)
Types: TextFile
Names: »MINPADDE.PAS«
└─⟦037dced94⟧ Bits:30003312 Elevopgave i styring af skildpadde til Piccolo
└─⟦this⟧ »MINPADDE.PAS«
program MinPadde;
type
index = 1..5000;
modevektor = array(.index.) of integer;
var
mode : modevektor;
nr,antal,vent,tid,test,fart: integer;
tilstand,steptal : integer;
str1: string(.1.);
ch,ch2,ch3,ch1:char;
(*-------------------------------------*)
procedure nulstil;
begin
for nr := 1 to 5000 do mode(.nr.) := 0;
steptal := 1;
end;
(*-------------------------------------*)
procedure flyt(var tilstand : integer);
begin
port(.17.) := tilstand;
mode(.steptal.) := tilstand;
steptal := steptal + 1;
gotoxy(1,1);write('Step nr. ',steptal);
port(.17.) := 0;
end;
(*-------------------------------------*)
procedure tempo;
begin
gotoxy(1,1);write(clrhom);
gotoxy(35,4);write('TEMPOVALG:');
gotoxy(35,5);write('_________');
gotoxy(25,12);write('Indtast et tal mellem 1 og 5.');
gotoxy(25,13);write('1 er på forhånd valgt af pro-');
gotoxy(25,14);write('grammet, det er langsomt.');
gotoxy(47,4);
repeat
read(kbd,ch3);
until ch3 in (.'1','2','3','4','5'.);
val(ch3,fart,test);
gotoxy(47,4);write(fart);
tid := (8-fart)*2;
for nr := 1 to 20000 do
end;
(*-------------------------------------*)
procedure undervis;
begin
gotoxy(1,1);write(clrhom);
gotoxy(34,4 );write('UNDERVISNING.');
gotoxy(34,5 );write('____________ ');
gotoxy(25,8 );write('Du kan nu vælge at:');
gotoxy(25,10);write('Køre frem tast F');
gotoxy(25,11);write('Køre tilbage tast B');
gotoxy(25,12);write('Dreje til højre tast H');
gotoxy(25,13);write('Dreje til venstre tast V');
gotoxy(25,14);write('Gaffel op tast O');
gotoxy(25,15);write('Gaffel ned tast N');
gotoxy(25,16);write('Holde pause tast P');
gotoxy(25,17);write('Standse tast S');
gotoxy(45,8);
nulstil;
repeat
read(kbd,ch2);
if (ch2 <> 'Q') and (ch2 <> 'q') then
begin
case ch2 of
'F','f': tilstand := 15;
'B','b': tilstand := 5;
'H','h': tilstand := 13;
'V','v': tilstand := 7;
'O','o': tilstand := 48;
'N','n': tilstand := 16;
'P','p': tilstand := 42;
otherwise
tilstand:=0;
end;
flyt(tilstand);
end;
until (ch2 = 'S') or (ch2 = 's') or (steptal > 4999);
end;
(*-------------------------------------*)
procedure gentag;
begin
gotoxy(1,1);write(clrhom);
gotoxy(30,10);write(chr(130),'********************',chr(128));
gotoxy(31,11);write('NU GENTAGES DET HELE');
gotoxy(30,12);write(chr(130),'********************',chr(128));
for nr := 1 to steptal do
begin
port(.17.) := mode(.nr.);
for vent := 1 to tid do
gotoxy(1,1);write('Step nr. ',nr);
port(.17.) := 0;
end;
end;
(*-------------------------------------*)
procedure forklar;
begin
gotoxy(1,1);write(clrhom);
gotoxy(17, 4);write(' F O R K L A R I N G ');
gotoxy(17, 5);write(' ___________________ ');
gotoxy(17, 7);write('Skildpaddens to motorer skal være tilsluttet de ');
gotoxy(17, 8);write('2 udgange på interfacet mærket 1 og 2. Hvis den ');
gotoxy(17, 9);write('viser sig at virke omvendt, skal motorstikkene ');
gotoxy(17,10);write('blot byttes om. ');
gotoxy(17,11);write('Skildpadden kan kun "huske" 5000 instrukser, så ');
gotoxy(17,12);write('lad være med at lave turen for lang. ');
gotoxy(17,13);write('De små ryk, som skildpadden giver under indlæ- ');
gotoxy(17,14);write('ringsprocessen skyldes at PICCOLOENs taster er ');
gotoxy(17,15);write('repetitive. Rykkene er væk ved gentagelsespro- ');
gotoxy(17,16);write('cessen. ');
gotoxy(28,24);write('Tryk MELLEMRUM for at fortsætte...');
repeat
read(kbd,ch);
until ch=' ';
end;
(*-------------------Her begynder det egentlige program----------------*)
begin
port(.19.):=255;
port(.19.):=192;
nulstil;
tid := 14;
repeat
gotoxy(1,1);write(clrhom);
gotoxy(25,4 );write('S K I L D P A D D E S T Y R I N G');
gotoxy(24,5 );write(chr(130),'*********************************',chr(128));
gotoxy(20,8 );write('Du har nu følgende valg:');
gotoxy(20,9 );write('_______________________ ');
gotoxy(20,11);write('Du kan indtaste et tempo tast T');
gotoxy(20,13);write('Du kan undervise tast U');
gotoxy(20,15);write('Skildpadden kan gentage tast G');
gotoxy(20,17);write('Du kan få forklaring tast F');
gotoxy(20,19);write('Hvis du vil standse, så tast Q');
gotoxy(20,21);write('NB!!! Hele turen bliver SLETTET !!!');
gotoxy(45,8);
repeat
read(kbd,ch1);
case ch1 of
'T','t': tempo;
'U','u': undervis;
'G','g': gentag;
'F','f': forklar;
end;
until ch1 in (.'T','t','U','u','G','g','F','f','Q','q'.);
until (ch1 = 'Q') or (ch1 = 'q');
gotoxy(1,1);write(clrhom);
end.
«eof»