home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / pascal / 6539 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  1.9 KB

  1. Path: sparky!uunet!ogicse!news.tek.com!vice!bobbe
  2. From: bobbe@vice.ICO.TEK.COM (Robert Beauchaine)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: Help!: ABS SECT (C:) Read/writes!!
  5. Message-ID: <10745@vice.ICO.TEK.COM>
  6. Date: 12 Nov 92 20:56:25 GMT
  7. Article-I.D.: vice.10745
  8. References: <1992Nov9.173332.1@uwovax.uwo.ca>
  9. Organization: Tektronix, Inc., Beaverton,  OR.
  10. Lines: 66
  11.  
  12.  
  13. Taken from _Turbo_Pascal_Advanced_Techniques_, Ohlsen/Stoker, from
  14. Que.
  15.  
  16. Call with drive = 0 for A, 1 for B, etc.
  17. Number is the count of sectors to read/write
  18. Logical is the starting sector
  19.  
  20. Note that there is a result variable that is never actually used.
  21. You may examine that error code in the procedures if necessary.  A
  22. technical DOS reference should point the way.
  23.  
  24.   Procedure AbsRead(var buf; drive,number,logical:word);
  25.   var 
  26.     result : integer;
  27.     begin
  28.       inline(
  29.     $55/        {Push BP}
  30.     $1E/            {Push DS}
  31.     $33/$C0/    {Xor Ax,Ax}
  32.     $89/$86/Result/ {Mov Result,Ax}
  33.     $8A/$86/Drive/  {Mov Al,Drive}
  34.     $8B/$8E/Number/ {Mov Cx,Number}
  35.     $8B/$96/Logical/{Mov Dx,Logical}
  36.     $C5/$9E/Buf/    {LDS Bx,Buf}
  37.     $CD/$25/    {Int 25 }
  38.     $5B/        {Pop Bx}
  39.     $1F/        {Pop DS}
  40.     $5D/        {Pop Bp}
  41.     $73/$04/    {JNB Done}
  42.     $89/$86/Result);{Mov Result,AX}
  43.             {Done:}
  44.       end;
  45.  
  46.  
  47.   Procedure AbsWrite(var buf; drive,number,logical:word);
  48.   var 
  49.     result : integer;
  50.     begin
  51.       inline(
  52.     $55/        {Push BP}
  53.     $1E/            {Push DS}
  54.     $33/$C0/    {Xor Ax,Ax}
  55.     $89/$86/Result/ {Mov Result,Ax}
  56.     $8A/$86/Drive/  {Mov Al,Drive}
  57.     $8B/$8E/Number/ {Mov Cx,Number}
  58.     $8B/$96/Logical/{Mov Dx,Logical}
  59.     $C5/$9E/Buf/    {LDS Bx,Buf}
  60.     $CD/$26/    {Int 26 }
  61.     $5B/        {Pop Bx}
  62.     $1F/        {Pop DS}
  63.     $5D/        {Pop Bp}
  64.     $73/$04/    {JNB Done}
  65.     $89/$86/Result);{Mov Result,AX}
  66.             {Done:}
  67.       end;
  68.  
  69. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 
  70.  
  71.  
  72. Bob Beauchaine bobb@vice.ICO.TEK.COM 
  73.  
  74. C: The language that combines the power of assembly language with the 
  75.    flexibility of assembly language.
  76.  
  77. Real friends don't let friends use UNIX.
  78.