home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / dos / bdisk / asmsrc / secver.asm < prev    next >
Encoding:
Assembly Source File  |  1987-12-04  |  1.9 KB  |  87 lines

  1.         DOSSEG
  2.         .MODEL medium
  3.  
  4.         PUBLIC _SecVer
  5.  
  6. ;========================================================
  7. ; Verify sectors.  The usage is:
  8. ;
  9. ;   push <drive>        ;drive number
  10. ;   push <head>         ;head (side) number
  11. ;   push <track>        ;track number
  12. ;   push <sector>       ;sectors number
  13. ;   push <count>        ;number of sectors to verify
  14. ;   call _SecVer        ;verify
  15. ;
  16. ; The values are not checked. AX = 0 if no errors,
  17. ; otherwise the disk status is returned in AL and
  18. ; AH = 0.
  19. ;
  20. ; The stack is cleared on exit and all registers are
  21. ; preserved except AX.
  22.  
  23. SecVerStk       STRUC
  24. registers       dw 6 DUP (?)
  25. retaddr         dw 2 DUP (?)
  26. count           dw ?
  27. sector          dw ?
  28. track           dw ?
  29. head            dw ?
  30. drive           dw ?
  31. SecVerStk       ENDS
  32.  
  33.         ASSUME ds:NOTHING, es:NOTHING, ss:NOTHING
  34.  
  35.         .CODE
  36.  
  37. _SecVer PROC
  38.         push cx
  39.         push dx
  40.         push di
  41.         push si
  42.         push bp
  43.         push es
  44.         mov bp, sp
  45.  
  46. ;--- verify the sectors
  47.  
  48.         mov al, byte ptr [bp].count     ;sector count
  49.         mov ch, byte ptr [bp].track     ;track number
  50.         mov cl, byte ptr [bp].sector    ;sector number
  51.         mov dh, byte ptr [bp].head      ;head number
  52.         mov dl, byte ptr [bp].drive     ;drive number
  53.  
  54.         mov ah, 4       ;verify function
  55.         int 13h         ;execute
  56.         jnc Scvr1
  57.  
  58. ;--- error, reset disk and try again
  59.  
  60.         mov ah, 0       ;reset function
  61.         int 13h         ;execute
  62.  
  63.         mov ah, 4       ;verify function
  64.         int 13h         ;execute
  65.         jnc ScVr1       ;jump if okay
  66.  
  67. ;--- error formatting track
  68.  
  69.         mov al, ah
  70.         sub ah, ah
  71.         jmp ScVr2
  72.  
  73. ;--- sector is verified
  74.  
  75. Scvr1:  sub ax, ax
  76.  
  77. Scvr2:  pop es
  78.         pop bp
  79.         pop si
  80.         pop di
  81.         pop dx
  82.         pop cx
  83.         ret 10
  84. _SecVer ENDP
  85.  
  86.         END
  87.