home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TP_ADV.ZIP / LIST1405.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-11-17  |  2.8 KB  |  49 lines

  1. Procedure AbsRead ( var buf; drive, number, logical : Word );
  2. var
  3.   result : integer;
  4. begin
  5.   inline (
  6.     $55/              { PUSH BP         ; Interrupt 25 trashes all registers    }
  7.     $1E/              { PUSH DS         ; Store DS                              }
  8.     $33/$C0/          { XOR  AX,AX      ; set AX to zero                        }
  9.     $89/$86/Result/   { MOV  Result, AX ; Move AX to Result                     }
  10.     $8A/$86/Drive/    { MOV  AL, Drive  ; Move Drive to AL                      }
  11.     $8B/$8E/Number/   { MOV  CX, Number ; Move Number to CX                     }
  12.     $8B/$96/Logical/  { MOV  DX, Logical; Move Logical to DX                    }
  13.     $C5/$9e/Buf/      { LDS  BX, Buf    ; Move Buf to DS:BX                     }
  14.     $CD/$25/          { INT  25h        ; Call interrupt $25                    }
  15.     $5B/              { POP  BX         ; Remove the flags value from the stack }
  16.     $1F/              { POP  DS         ; Restore DS                            }
  17.     $5D/              { POP  BP         ; Restore BP                            }
  18.     $73/$04/          { JNB  Done       ; Jump ...                              }
  19.     $89/$86/Result ); { MOV  Result, AX ; move error code to AX                 }
  20.                       { Done:                                                   }
  21.   If ( Result <> 0 ) Then
  22.     { Error condition... };
  23. End;
  24.  
  25. Procedure AbsWrite ( var buf; drive, number, logical : Word );
  26. var
  27.   result : Word;
  28. begin
  29.   inline (
  30.     $55/              { PUSH BP         ; Interrupt 25 trashes all registers    }
  31.     $1E/              { PUSH DS         ; Store DS                              }
  32.     $33/$C0/          { XOR  AX,AX      ; set AX to zero                        }
  33.     $89/$86/Result/   { MOV  Result, AX ; Move AX to Result                     }
  34.     $8A/$86/Drive/    { MOV  AL, Drive  ; Move Drive to AL                      }
  35.     $8B/$8E/Number/   { MOV  CX, Number ; Move Number to CX                     }
  36.     $8B/$96/Logical/  { MOV  DX, Logical; Move Logical to DX                    }
  37.     $C5/$9E/Buf/      { LDS  BX, Buf    ; Move Buf to DS:BX                     }
  38.     $CD/$26/          { INT  25h        ; Call interrupt $25                    }
  39.     $5B/              { POP  BX         ; Remove the flags value from the stack }
  40.     $1F/              { POP  DS         ; Restore DS                            }
  41.     $5D/              { POP  BP         ; Restore BP                            }
  42.     $73/$04/          { JNB  Done       ; Jump ...                              }
  43.     $89/$86/Result ); { MOV  Result, AX ; move error code to AX                 }
  44.                       { Done:                                                   }
  45.   If ( Result <> 0 ) Then
  46.     { Error condition... };
  47. End;
  48.  
  49.