home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 165 / NJPARK.ZIP / NJPARK.ASM < prev    next >
Assembly Source File  |  1988-06-11  |  3KB  |  191 lines

  1.  
  2. ; Nifty James' Famous Disk Parker
  3.  
  4. ; Version 1.00 of June 11, 1988 
  5.  
  6. ; (C) Copyright 1988 by Mike Blaszczak
  7. ; All rights reserved.
  8.  
  9. lf    equ    10
  10. cr    equ    13
  11.  
  12. Devices    equ    008h
  13. Seek    equ    00Ch
  14.  
  15. ReadChar    equ    001h
  16. WriteChar    equ    002h
  17. Write    equ    040h
  18.  
  19. DISKINT    equ    013h
  20. DOSINT    equ    021h
  21.  
  22.  
  23.     .stack    256
  24.  
  25.     .model    small
  26.     .data
  27.  
  28. Banner    db    "Nifty James' Disk Parker",cr,lf
  29.     db    "(C) Copyright 1988 by Mike Blaszczak",cr,lf
  30.     db    "All Rights Reserved",cr,lf
  31.     db    "Version 1.00 of 15 June 1988",cr,lf,lf
  32. BannerLen    equ    this byte - Banner
  33.  
  34. NoDrives    db    "No hard disk drives installed!",cr,lf,lf
  35. NoDrivesLen    equ    this byte - NoDrives
  36.  
  37. Parking    db    "Parking disk unit "
  38. ParkingLen    equ    this byte - Parking
  39.  
  40. ToCluster    db    " at cylinder "
  41. ToClusterLen    equ    this byte - ToCluster
  42.  
  43. EndOfSentence    db    ".",cr,lf
  44. EndOfSentenceLen    equ    this byte - EndOfSentence
  45.  
  46. Done    db    cr,lf,"Heads Parked!  Press any key to",cr,lf
  47.     db    "return to DOS, or shut down system now."
  48. DoneLen    equ    this byte - Done
  49.  
  50. NumberBuffer    db    10 dup (' ')
  51.  
  52. DriveNumber    db    080h
  53. DriveCount    db    0
  54. CylinderSector    dw    0
  55.  
  56.     .code
  57.  
  58. Beginning:
  59.     push    ds
  60.     mov    ax,@data
  61.     mov    ds,ax
  62.  
  63.     mov    ah,Write
  64.     mov    cx,BannerLen
  65.     mov    bx,1
  66.     mov    dx,offset Banner
  67.     int    DOSINT
  68.  
  69.     mov    ah,Devices
  70.     mov    dl,080h
  71.     int    DISKINT
  72.  
  73.     and    dl,dl        ; any drives?
  74.     jne    HasDrives
  75.  
  76.     mov    ah,Write
  77.     mov    cx,NoDrivesLen
  78.     mov    bx,1
  79.     mov    dx,offset NoDrives
  80.     int    DOSINT
  81.  
  82. BadExit:
  83.     mov    ax,04C01h
  84.     int    DOSINT
  85.  
  86.  
  87. HasDrives:    mov    DriveCount,dl
  88.  
  89. NextDrive:    mov    ah,Devices
  90.     mov    dl,DriveNumber
  91.     int    DISKINT
  92.  
  93. NextBunch:    add    ch,8
  94.     jnc    NoCarryCylinder
  95.     add    cl,001000000b
  96.     mov    ch,0
  97.  
  98. NoCarryCylinder:
  99.     mov    CylinderSector,cx
  100.  
  101.     mov    ah,Seek
  102.     mov    dl,DriveNumber
  103.     mov    dh,0
  104.     int    DISKINT
  105.  
  106.     mov    ah,Write
  107.     mov    cx,ParkingLen
  108.     mov    dx,offset Parking
  109.     mov    bx,1
  110.     int    DOSINT
  111.  
  112.     mov    al,DriveNumber
  113.     and    ax,007Fh
  114.     call    PrintInt
  115.  
  116.     mov    ah,Write
  117.     mov    cx,ToClusterLen
  118.     mov    dx,offset ToCluster
  119.     mov    bx,1
  120.     int    DOSINT
  121.  
  122.     mov    ax,CylinderSector
  123.     and    al,011000000b
  124.     mov    cl,6
  125.     shr    al,cl
  126.     xchg    al,ah
  127.     call    PrintInt
  128.  
  129.     mov    ah,Write
  130.     mov    cx,EndOfSentenceLen
  131.     mov    dx,offset EndOfSentence
  132.     mov    bx,1
  133.     int    DOSINT
  134.  
  135.     inc    DriveNumber
  136.     dec    DriveCount
  137.     jne    NextDrive
  138.  
  139.     mov    ah,Write
  140.     mov    cx,DoneLen
  141.     mov    dx,offset Done
  142.     mov    bx,1
  143.     int    DOSINT
  144.  
  145.     mov    ah,ReadChar
  146.     int    DOSINT
  147.  
  148. GoodExit:
  149.     mov    ax,04C00h
  150.     int    DOSINT
  151.  
  152.  
  153.  
  154. PrintInt    proc
  155.  
  156.     mov    dx,ax
  157.     xor    cx,cx
  158.     mov    di,offset NumberBuffer
  159.  
  160. PrintInt_1:    push    cx
  161.     mov    ax,dx
  162.     xor    dx,dx
  163.     mov    cx,10
  164.     div    cx
  165.     xchg    ax,dx
  166.  
  167.     add    al,'0'
  168.     mov    [di],al
  169.     inc    di
  170.  
  171.     pop    cx
  172.     inc    cx
  173.     and    dx,dx
  174.     jne    PrintInt_1
  175.  
  176. PrintInt_2:
  177.     dec    di
  178.     mov    dl,[di]
  179.     mov    ah,WriteChar
  180.     int    DOSINT
  181.     loop    PrintInt_2
  182.  
  183.     ret
  184.  
  185. PrintInt    endp
  186.  
  187.     end    Beginning
  188.  
  189.  
  190.  
  191.