home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
PARASOL
/
VIDEOSTO.ARK
/
START-GO.SRC
< prev
next >
Wrap
Text File
|
1986-10-11
|
10KB
|
368 lines
copy "PARMS.LIB";
video.system.start.up.routine:
begin
{---------------------------------------------------
{ Video Management System
{ Video System Start-up Routine
{ Copyright (C) 1983 by Para-Soft
{ All Rights Reserved
{---------------------------------------------------
copy "SYSPARMS.FIL";
copy "STARTUP.FIL";
copy "BOJDATA.LIB";
byte print.char;
file print.init,
prn,
record print.char,
text;
external byte IOBYTE address ^h0003;
external label entry address ^h0005;
external word bios.loc address ^h0001;
string wk.accept 12;
string wk.str 40;
string dflt.date 9;
string alpha.date 20;
word wk.word;
word wk.rem;
word MPM.date.save;
byte pointer wk.bp;
word pointer wk.wp;
byte wk.byte;
byte date.entered value 'N';
byte first.term.started value 'N';
byte delay.flag value 0;
byte curr.printer value 0;
string program.to.start 81;
string command.line 128;
string command.word 81;
word end.startup.key;
record con.tbl;
byte con.type;
string 15;
endrec;
record prn.tbl;
byte prn.usage;
string 15;
endrec;
word days.this.year;
record month.days;
byte value 31; {Jan}
byte feb.days value 28; {Feb}
byte value 31; {Mar}
byte value 30; {Apr}
byte value 31; {May}
byte value 30; {Jun}
byte value 31; {Jul}
byte value 31; {Aug}
byte value 30; {Sep}
byte value 31; {Oct}
byte value 30; {Nov}
byte value 31; {Dec}
endrec;
record month.names;
field month.name.entry 9 value 'January';
field 9 value 'February';
field 9 value 'March';
field 9 value 'April';
field 9 value 'May';
field 9 value 'June';
field 9 value 'July';
field 9 value 'August';
field 9 value 'September';
field 9 value 'October';
field 9 value 'November';
field 9 value 'December';
endrec;
string pointer alpha.month.ptr value #month.names;
record day.names;
field day.name.entry 9 value 'Sunday';
field 9 value 'Monday';
field 9 value 'Tuesday';
field 9 value 'Wednesday';
field 9 value 'Thursday';
field 9 value 'Friday';
field 9 value 'Saturday';
endrec;
string pointer alpha.day.ptr value #day.names;
record MPM.time.responce;
word MPM.date;
byte MPM.hours;
byte MPM.minutes;
byte MPM.seconds;
endrec;
byte curr.year;
byte curr.month;
byte curr.day;
word curr.time;
copy "TRUNCSTR.LIB";
{-----------------------------------------------------------}
procedure split.wk.accept.date:
begin
scan wk.accept for any "-/" giving wk.word;
unstring wk.accept to wk.word giving wk.str;
convert wk.str to curr.month;
add 1 to wk.word;
unstring wk.accept from wk.word;
scan wk.accept for any "-/" giving wk.word;
unstring wk.accept to wk.word giving wk.str;
convert wk.str to curr.day;
add 1 to wk.word;
unstring wk.accept from wk.word;
convert wk.accept to curr.year;
end;
{-----------------------------------------------------------}
procedure get.date.from.operator:
begin
move 'N' to date.entered;
accept wk.accept;
if wk.accept[byte] = 0 then
move dflt.date to wk.accept;
else
move "Y" to date.entered;
fi;
call split.wk.accept.date;
{---compute new date in MPM format---}
move 78 to wk.byte;
move 0 to MPM.date;
do
divide wk.byte by 4 giving wk.word remainder wk.rem;
if wk.rem <> 0 then
move 365 to days.this.year;
move 28 to feb.days;
else
move 366 to days.this.year;
move 29 to feb.days;
fi;
if wk.byte = curr.year then
exitdo;
fi;
add days.this.year to MPM.date;
add 1 to wk.byte;
if wk.byte >= 100 then
move 0 to wk.byte;
fi;
od;
if curr.month > 12
or curr.month = 0 then
display "Month overflow error";
display "Enter new date (MM/DD/YY), or return:",;
goto get.date.from.operator;
fi;
move #month.days to wk.bp;
move 1 to wk.byte;
while wk.byte < curr.month do
add @wk.bp to MPM.date;
add 1 to wk.bp;
add 1 to wk.byte;
od;
if curr.day = 0
or curr.day > @wk.bp then
display "Day overflow error";
display "Enter new date (MM/DD/YY), or return:",;
goto get.date.from.operator;
fi;
add curr.day to MPM.date;
call make.alpha.date;
end;
{-----------------------------------------------------------}
procedure make.alpha.date:
begin
convert curr.month to wk.str;
if wk.str[+1,byte]=0 then
move wk.str[word] to wk.str[+1,word];
move '0' to wk.str[byte];
fi;
move wk.str to alpha.date;
append "/" to alpha.date;
convert curr.day to wk.str;
if wk.str[+1,byte]=0 then
move wk.str[word] to wk.str[+1,word];
move '0' to wk.str[byte];
fi;
append wk.str to alpha.date;
append "/" to alpha.date;
convert curr.year to wk.str;
if wk.str[+1,byte]=0 then
move wk.str[word] to wk.str[+1,word];
move '0' to wk.str[byte];
fi;
append wk.str to alpha.date;
subtract 1 from MPM.date;
divide MPM.date by 7 giving wk.word remainder wk.rem;
add 1 to MPM.date;
index day.name.entry with wk.rem giving alpha.day.ptr;
move @alpha.day.ptr[sp] to day.of.week;
subtract 1 from curr.month giving wk.byte;
index month.name.entry using wk.byte giving alpha.month.ptr;
move @alpha.month.ptr to alpha.month;
end;
{----------------------------------------------------------------
{ S T A R T O F P R O G R A M E X E C U T I O N
{
{ Correct drive and user is already logged in.
{----------------------------------------------------------------
procedure bios.con.stat: goto bios.con.stat;
procedure bios.con.in: goto bios.con.in;
move IPC.area to startup.parms length ##startup.parms;
and my.terminal.num with ^h0f;
{-----------------------------------
{ open the correct files
{-----------------------------------
move data.ext to sys.file.ext;
open sys shared error begin
display "Startup Error -- System File Not Located";
goto end;
end;
move 0 to sys.key;
read sys error standard;
if s.date[+2,byte] <> '/'
or s.date[+5,byte] <> '/' then
display "Startup Error -- Invalid System File Format";
goto end;
fi;
if operating.system = os.CPM then {--if it's CP/M--}
move 'Y' to first.term.started;
move s.date to dflt.date;
move s.date to wk.str;
display "The current system date is:",wk.str;
display "Enter new date (MM/DD/YY), or return:",;
call get.date.from.operator;
else {MP/M, old n/STAR, or new n/STAR}
{---------------------------}
{ get current MPM date }
{---------------------------}
retry.MPM.date:
mcall entry using 155, #MPM.date;
move MPM.date to MPM.date.save;
subtract 1 from MPM.date; {--adjust for this algorithm--}
move 78 to curr.year;
move 1 to curr.month;
move 1 to curr.day;
do
divide curr.year by 4 giving wk.word remainder wk.rem;
if wk.rem <> 0 then
move 365 to days.this.year;
move 28 to feb.days;
else
move 366 to days.this.year;
move 29 to feb.days;
fi;
if MPM.date < days.this.year then
exitdo;
fi;
subtract days.this.year from MPM.date;
add 1 to curr.year;
if curr.year >= 100 then
move 0 to curr.year;
fi;
od;
move #month.days to wk.bp;
while MPM.date >= @wk.bp do
subtract @wk.bp from MPM.date;
add 1 to wk.bp;
add 1 to curr.month;
if curr.month > 12 then
display "month overflow";
fi;
od;
add MPM.date to curr.day;
move MPM.date.save to MPM.date;
call make.alpha.date;
move s.date to wk.str;
if delay.flag = 0 then
display "Current system date = ",wk.str;
fi;
move wk.str to dflt.date;
{-------------------------------------------------------}
{ If MPM-date is the same as the video-system date }
{ assume that the date is set correctly, and start-up }
{-------------------------------------------------------}
move alpha.date[+6,field,length 2] to wk.str;
read sys error standard;
if wk.str < '83'
or alpha.date <> s.date then
if delay.flag = 0 then
display "Enter new date (MM/DD/YY), or return:",;
move ^hff to delay.flag;
fi;
mcall entry using 11 giving wk.byte;
if wk.byte = 0 then
mcall entry using 141,20; {-delay 1/3 sec-}
goto retry.MPM.date;
fi;
call get.date.from.operator;
{ accept "Enter time (HHMM):",wk.accept;
{ convert hex wk.accept to curr.time;
{ move curr.time[byte] to MPM.minutes;
{ move curr.time[+1,byte] to MPM.hours;
mcall entry using 104,#MPM.date;
move 'Y' to first.term.started;
fi;
call make.alpha.date;
fi;
{-------------------------------}
{ set new date in system file }
{-------------------------------}
move 0 to sys.key;
read sys lock error standard;
move alpha.date to s.date;
write sys unlock error standard;
close sys error standard;
{-------------------------------}
{ Set Job start-up parameters }
{-------------------------------}
move alpha.date to todays.date;
move @alpha.month.ptr to wk.str length ##month.name.entry;
move 0 to wk.str[byte,+##month.name.entry];
scan wk.str for trailing ' ' giving address wk.bp;
move 0 to @wk.bp;
if first.term.started <> "Y"
and operating.system <> os.CPM then
display "";
fi;
display "The month is ",wk.str,;
move @alpha.day.ptr to wk.str length ##day.name.entry;
move 0 to wk.str[byte,+##day.name.entry];
scan wk.str for trailing ' ' giving address wk.bp;
move 0 to @wk.bp;
display ". The day is ",wk.str,". The date is ",alpha.date;
{--program.to.execute is passed in startup.acct--}
move startup.acct to wk.str;
move " " to startup.acct;
call trunc.wk.str;
move wk.str to program.to.start;
move "." to wk.str[byte];
move prog.ext to wk.str[+1];
call trunc.wk.str;
append wk.str to program.to.start;
move startup.parms[field] to IPC.area;
execute program.to.start;
end;