?login_element?

Subversion Repositories NedoOS

Rev

Rev 618 | Blame | Compare with Previous | Last modification | View Log | Download

  1. program MicroCalc;
  2. {
  3.     MICROCALC DEMONSTRATION PROGRAM  Version 1.00A
  4.  
  5.   This program is Copyrighted by Borland International, Inc.
  6.   1983, 1984, 1985 and is hereby donated to the public domain for
  7.   non-commercial use only.
  8.  
  9.  
  10.   INSTRUCTIONS
  11.     1.  Compile this program using the TURBO.COM compiler.
  12.         a.  Use the O command from the main menu to select Options.
  13.         b.  Select the C option to generate a .COM file.
  14.         c.  Select the Q option to Quit the Options menu.
  15.         d.  Select the M option to specify the Main file
  16.         e.  Type "MC" and hit <RETURN>
  17.         f.  Type C to compile the program to disk
  18.         g.  Type R to run the program
  19.  
  20.     2.  Exit the program by typing: /Q
  21. }
  22.  
  23. {$R-,U-,V-,X-,A+,C-}
  24.  
  25.  
  26. const
  27.   FXMax: Char  = 'G';
  28.   FYMax        = 21;
  29.  
  30. type
  31.   Anystring   = string[255];
  32.   ScreenIndex = 'A'..'G';
  33.   Attributes  = (Constant,Formula,Txt,OverWritten,Locked,Calculated);
  34.  
  35.  
  36.   CellRec    = record
  37.     CellStatus: set of Attributes;
  38.     Contents:   String[70];
  39.     Value:      Real;
  40.     DEC,FW:     0..20;
  41.   end;
  42.  
  43.   Cells      =  array[ScreenIndex,1..FYMax] of CellRec;
  44.  
  45. const
  46.   XPOS: array[ScreenIndex] of integer = (3,14,25,36,47,58,68);
  47.  
  48. var
  49.   Screen:        Cells;
  50.   FX:            ScreenIndex;
  51.   FY:            Integer;
  52.   Ch:            Char;
  53.   MCFile:        file of CellRec;
  54.   AutoCalc:      boolean;
  55.  
  56.  
  57. { The following include files contain procedures used in MicroCalc.  }
  58.  
  59.  
  60.  {$I MC-MOD00.INC}
  61.  {$I MC-MOD01.INC}
  62.  {$I MC-MOD02.INC}
  63.  {$I MC-MOD03.INC}
  64.  {$I MC-MOD04.INC}
  65.  {$I MC-MOD05.INC}
  66.  {$I MC-MOD06.INC}
  67.  {$I MC-MOD07.INC}
  68.  
  69.  
  70.  
  71. {.PA}
  72.  
  73. procedure Commands;
  74. begin
  75.   GotoXY(1,24);
  76.   LowVideo;
  77.   Write('/ restore, Quit, Load, Save, Recalculate, Print,  Format, AutoCalc, Help ');
  78.   Read(Kbd,Ch);
  79.   Ch:=UpCase(Ch);
  80.   case Ch of
  81.     'Q': Begin
  82.            NormVideo;
  83.            Halt;
  84.          End;
  85.     'F': Format;
  86.     'S': Save;
  87.     'L': Load;
  88.     'H': Help;
  89.     'R': Recalculate;
  90.     'A': Auto;
  91.     '/': Update;
  92.     'C': Clear;
  93.     'P': Print;
  94.   end;
  95.   Grid;
  96.   GotoCell(FX,FY);
  97. end;
  98.  
  99.  
  100. procedure Wellcome;
  101.  
  102.   procedure Center(S: AnyString);
  103.   var I: integer;
  104.   begin
  105.     for I:=1 to (80-Length(S)) div 2 do Write(' ');
  106.     writeln(S);
  107.   end;
  108.  
  109. begin { procedure Wellcome }
  110.   ClrScr; GotoXY(1,9);
  111.   Center('Welcome to MicroCalc.  A Turbo demonstation program');
  112.   Center('Copyright 1983 by Borland International Inc. ');
  113.   Center('Press any key for help or <RETURN> to start');
  114.   GotoXY(40,12);
  115.   Read(Kbd,Ch);
  116.   if Ch<>^M then Help;
  117. end;
  118.  
  119. {.PA}
  120.  
  121. begin
  122.   Init;
  123.   Wellcome;
  124.   ClrScr; Grid;
  125.   GotoCell(FX,FY);
  126.   repeat
  127.     Read(Kbd,Ch);
  128.     case Ch of
  129.       #250{^E}:       MoveUp;
  130.       #249{^X,^J}:    MoveDown;
  131.       #251{^D,^M,^F}: MoveRight;
  132.       #248{^S,^A}:    MoveLeft;
  133.       '/':      Commands;
  134.       ^[:       GetCell(FX,FY);
  135.     else
  136.       if Ch in [' '..'~'] then
  137.       GetCell(FX,FY);
  138.     end;
  139.   until true=false;
  140. end.
  141.  
  142.