home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / directry / mv / absdr.asm next >
Encoding:
Assembly Source File  |  1994-06-05  |  2.3 KB  |  70 lines

  1. ; 8-Sep-86 16:23:47-PDT,1765;000000000000
  2. ; Return-Path: <pwu@unix.macc.wisc.edu>
  3. ; Received: FROM UNIX.MACC.WISC.EDU BY B.ISI.EDU WITH TCP ; 8 Sep 86 16:19:46 PDT
  4. ; Received: by unix.macc.wisc.edu;
  5. ;           id AA04919; 4.12/5; Mon, 8 Sep 86 17:30:29 cdt
  6. ; Date: Mon, 8 Sep 86 17:30:29 cdt
  7. ; From: Peter Wu <pwu@unix.macc.wisc.edu>
  8. ; Message-Id: <8609082230.AA04919@unix.macc.wisc.edu>
  9. ; To: info-ibmpc-request@mosis
  10. ; Subject: absdr.asm
  11. ; bios call to do absolute disk read/write
  12. ; using int86 from C to call int 25h and 26h will freeze the computer
  13. ; (because si and di were modified?), so I had to write this in assembly.
  14.  
  15. _text   segment public byte 'code'
  16.         assume cs:_text
  17.  
  18.         public  _absdr          ; absolute disk read
  19. _absdr  proc    near
  20.         push    si
  21.         push    di
  22.         push    bp
  23.         mov     bp,sp
  24.  
  25.         mov     al,[bp+8]       ; drive number
  26.         mov     cx,[bp+10]      ; number of sectors to read
  27.         mov     dx,[bp+12]      ; beginning sector number
  28.         mov     bx,[bp+14]      ; buffer address
  29.         int     25h             ; absolute disk read
  30. ; int 25h supposed to destroy all registers except segment registers
  31.         jc      error           ; if error, leave error no in AX
  32.         mov     ax,0            ; clear error number if no error
  33. error:
  34.         inc     sp              ; pop the flags
  35.         inc     sp              ; pop the flags
  36.         pop     bp
  37.         pop     di
  38.         pop     si
  39.         ret
  40. _absdr  endp
  41.  
  42.         public  _absdw          ; absolute disk write
  43. _absdw  proc    near
  44.         push    si
  45.         push    di
  46.         push    bp
  47.         mov     bp,sp
  48.  
  49.         mov     al,[bp+8]       ; drive number
  50.         mov     cx,[bp+10]      ; number of sectors to read
  51.         mov     dx,[bp+12]      ; beginning sector number
  52.         mov     bx,[bp+14]      ; buffer address
  53.         int     26h             ; absolute disk read
  54. ; int 26h supposed to destroy all registers except segment registers
  55.         jc      error1          ; if error, leave error no in AX
  56.         mov     ax,0            ; clear error number if no error
  57. error1:
  58.         inc     sp              ; pop the flags
  59.         inc     sp              ; pop the flags
  60.         pop     bp
  61.         pop     di
  62.         pop     si
  63.         ret
  64. _absdw  endp
  65.  
  66. _text   ends
  67.         end
  68. ;
  69.