home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TP_ADV.ZIP / LIST0801.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-07-31  |  1.4 KB  |  55 lines

  1. Unit OvrOne;
  2. { This is actually the last unit in the overly chain.  It is  }
  3. { called from overlay number two.  This routine is simply a   }
  4. { demo of how to create an overlayed program.                 }
  5.  
  6. {$O+,F+}            { Instruct compiler this can be overlayed }
  7.  
  8. Interface
  9.  
  10. Uses Crt;           { Link in the CRT unit for ClrScr call    }
  11.  
  12. Procedure Proc1;
  13.  
  14. Procedure Proc2;
  15.  
  16. Implementation
  17.  
  18. Procedure IncWord( Var W : Word );
  19. { A simple support routine that will increment a word value   }
  20. { passed.  If the value is equal to MaxWord, then we will     }
  21. { wrap the value back to zero.                                }
  22. Begin
  23.   If( W = 65535 ) Then  { Determine if value needs wrapped    }
  24.     W := 0
  25.   Else
  26.     Inc( W );
  27. End;
  28.  
  29. Procedure Proc1;
  30. { THis procedure will prompt the user for a value and then    }
  31. { increment this value by one.                                }
  32. Var
  33.   W1 : Word;            { Local variable to be entered        }
  34.  
  35. Begin
  36.   Write( 'Enter a value (0-65535) : ' );
  37.   Readln( W1 );
  38.   IncWord( W1 );
  39.   Writeln( 'After calling IncWord, value has become ', W1 );
  40. End;
  41.  
  42. Procedure Proc2;
  43. { THis routine is simply an interface to the procedure listed }
  44. { above.  It is included here as a demo of overlaying of      }
  45. { procedures.                                                 }
  46. Begin
  47.   ClrScr;
  48.   Writeln( 'About to call Proc1.....' );
  49.   Delay( 2500 );
  50.   Proc1;
  51. End;
  52.  
  53. End.
  54.  
  55.