[comp.lang.pascal] sector RW with INT 25/26?

nacer@hpmcaa.mcm.hp.com (Abdenacer Moussaoui) (04/09/91)

Hi, DOS Int. 25/26 (dec 37 and 38) do not clean up the stack.  Instead
they finish and return to the program with one word left on the stack.
This is probably the cause for my following code hanging. I tried to
follow intr() with and POP DX but this won't do it.  Can anyone
provide a solution (assembly, inline code, ...) to achieve what is
intended here.  I do want to use Int 25 instead of 13 hex.  Thanks in
advance.
 ----------
  PROCEDURE  DSK_SECTOR_READ_ABS
                   (     DRIVE : BYTE ;
                         SECTOR_COUNT,
                         SECTOR_SEQ_NUMBER : INTEGER ;
                     VAR BUFFER : BUFFER_T ) ;
   VAR
    REG : registers ;
  BEGIN
   REG .AX := 0 ;
   REG .AX := DRIVE ;
   REG .CX := SECTOR_COUNT ;
   REG .DX := SECTOR_SEQ_NUMBER ;
   REG .BX := OFS( BUFFER ) ;
   REG .DS := SEG( BUFFER ) ;
   INTR( $25, REG ) ;    

   INLINE( $5A ) ;                                                { POP DX }
  END ; {DSK_SECTOR_READ_ABS}
 {--06/11/1986-V1.00-------------------------------------------------}


Thank you.
--Abdenacer 	(nacer@hpmcaa.mcm.hp.COM)

-- 
Thank you.
--Abdenacer 	(nacer@hpmcaa.mcm.hp.COM)

del@DIALix.oz.au (D Elson) (04/17/91)

Yes, I have solved the problem.  Basically it's simple -- put the following
code immediately after the INT 25/26 call:

   LAHF
   POPF

That way, you save the flags in AH and pop them off the stack.  It's
only the flags that are left behind.

Del  (del@DIALix.oz.au).