home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 9.ddi / CHAPXMPL.ZIP / XCHANGE.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1991-02-13  |  1.4 KB  |  50 lines

  1. { Turbo Assembler    Copyright (c) 1988, 1991 By Borland International, Inc.
  2.  
  3.   XCHANGE.PAS - Example of exchanging two variables
  4.  
  5.   From the Turbo Assembler Users Guide - Interfacing Turbo Assembler with
  6.                                             Turbo Pascal
  7.  }
  8.  
  9. program TextExchange;
  10.  
  11. type
  12.   EmployeeRecord = record
  13.                      Name    :  string [30];
  14.                      Address :  string [30];
  15.                      City    :  string [15];
  16.                      State   :  string [2];
  17.                      Zip     :  string [10];
  18.                     end ;
  19. var
  20.   OldEmployee, NewEmployee : EmployeeRecord;
  21.  
  22. {$F+}
  23.  
  24. procedure Exchange(var var1,var2; count : word); external;
  25. {$L XCHANGE.OBJ}
  26. {$F-}
  27. begin
  28.   with OldEmployee do
  29.   begin
  30.     Name := 'John Smith';
  31.     Address := '123 F Street';
  32.     City := 'Scotts Valley';
  33.     State := 'CA';
  34.     Zip := '90000-0000';
  35.   end;
  36.   with NewEmployee do
  37.   begin
  38.     Name := 'Mary Jones';
  39.     Address := '9471 41st Avenue';
  40.     City := 'New York';
  41.     State := 'NY';
  42.     Zip := '10000-1111';
  43.   end;
  44.   Writeln('Before: ',OldEmployee.Name,'  ',NewEmployee.Name);
  45.   Exchange(OldEmployee,NewEmployee,sizeof(OldEmployee));
  46.   Writeln('After:  ',OldEmployee.Name,'  ',NewEmployee.Name);
  47.   Exchange(OldEmployee,NewEmployee,sizeof(OldEmployee));
  48.   Writeln('After:  ',OldEmployee.Name,'  ',NewEmployee.Name);
  49. end.
  50.