|
|
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: 6272 (0x1880)
Types: TextFile
Names: »MC.PAS«
└─⟦d482c3728⟧ Bits:30005987 Turbo Pascal v2.00A (Jet80)
└─⟦this⟧ »MC.PAS«
æ********************************************************************å
æ* BEFORE YOU COMPILE THIS PROGRAM: *å
æ* 1. Use the O command from the main menu to select Options. *å
æ* 2. Select the C option to generate a COM file. *å
æ* 3. Select the Q option to Quit the Options menu. *å
æ* 4. Select the M option to make this file the Main file *å
æ********************************************************************å
æ$R-,U-,V-,X-,A+,C-å
æ This program is Copyrighted by Borland International Inc. 1983 å
program MicroCalc;
const
FXMax: Char = 'G'; æ Maximum number of columns å
FYMax = 21; æ Maximum number of lines å
type
Anystring = stringÆ255Å;
ScreenIndex = 'A'..'G';
Attributes = (Constant,Formula,Txt,OverWritten,Locked,Calculated);
æ The spreadsheet is made out of Cells every Cell is defined as å
æ the following record: å
CellRec = record
CellStatus: set of Attributes; æ Status of cell (see type def.) å
Contents: StringÆ70Å; æ Contains a formula or some text å
Value: Real; æ Last calculated cell value å
DEC,FW: 0..20; æ Decimals and Cell Whith å
end;
Cells = arrayÆScreenIndex,1..FYMaxÅ of CellRec;
const
XPOS: arrayÆScreenIndexÅ of integer = (3,14,25,36,47,58,68);
var
Screen: Cells; æ Definition of the spread sheet å
FX: ScreenIndex; æ Culumn of current cell å
FY: Integer; æ Line of current cell å
Ch: Char; æ Last read character å
MCFile: file of CellRec; æ File to store sheets in å
AutoCalc: boolean; æ Recalculate after each entry? å
æ The following include files contain procedures used in MicroCalc. å
æ In the following source code there is a reference after each å
æ procedure call indicating in which module the procedure is located.å
æ If you want a printer listing of the following modules then you å
æ must let the include directives start in column one and then use å
æ the TLIST program to generate a listing. å
æ$I MC-MOD00.INC Miscelaneous procedures å
æ$I MC-MOD01.INC Initialization procedures å
æ$I MC-MOD02.INC Commands to move between fields å
æ$I MC-MOD03.INC Commands to Load,Save,Print å
æ$I MC-MOD04.INC Evaluating an expression in a cell å
æ$I MC-MOD05.INC Reading a cell definition and Format commandå
æ.PAå
æ*********************************************************************å
æ* START OF MAIN PROGRAM PROCEDURES *å
æ*********************************************************************å
æ Procedure Commands is activated from the main loop in this program å
æ when the user type a semicolon. Commands then activates a procedureå
æ which will execute the command. These procedures are located in theå
æ above modules. å
æ For easy reference the source code module number is shown in a å
æ comment on the right following the procedure call. å
procedure Commands;
begin
GotoXY(1,24);
HighVideo;
Write('/ restore, Quit, Load, Save, Recalculate, Print, Format, AutoCalc, Help ');
Read(Kbd,Ch);
Ch:=UpCase(Ch);
case Ch of æ In module å
'Q': Halt;
'F': Format; æ 04 å
'S': Save; æ 03 å
'L': Load; æ 03 å
'H': Help; æ 03 å
'R': Recalculate; æ 05 å
'A': Auto; æ 00 å
'/': Update; æ 01 å
'C': Clear; æ 01 å
'P': Print; æ 03 å
end;
Grid; æ 01 å
GotoCell(FX,FY); æ 02 å
end;
æ Procedure Hello says hello and activates the help procedure if the å
æ user presses anything but Return å
procedure Wellcome;
procedure Center(S: AnyString);
var I: integer;
begin
for I:=1 to (80-Length(S)) div 2 do Write(' ');
writeln(S);
end;
begin æ procedure Wellcome å
ClrScr; GotoXY(1,9);
Center('Welcome to MicroCalc. A Turbo demonstation program');
Center('Copyright 1983 by Borland International Inc. ');
Center('Press any key for help or <RETURN> to start');
GotoXY(40,12);
Read(Kbd,Ch);
if Ch<>^M then Help;
end;
æ.PAå
æ*********************************************************************å
æ* THIS IS WHERE THE PROGRAM STARTS EXECUTING *å
æ*********************************************************************å
begin
Init; æ 01 å
Wellcome;
ClrScr; Grid; æ 01 å
GotoCell(FX,FY);
repeat
Read(Kbd,Ch);
case Ch of
^E: MoveUp; æ 02 å
^X,^J: MoveDown; æ 02 å
^D,^M,^F: MoveRight; æ 02 å
^S,^A: MoveLeft; æ 02 å
'/': Commands;
^Æ: GetCell(FX,FY); æ 04 å
else
if Ch in Æ' '..'ü'Å then
GetCell(FX,FY); æ 04 å
end;
until true=false; æ (program stops in procedure Commands) å
end.
«eof»