home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / 1986 / 03 / weislst3.mar < prev    next >
Text File  |  1986-03-31  |  3KB  |  80 lines

  1.                 ;---------------------------------------------;
  2.                 ; Weissman/Dr. Dobbs Submission   LISTING 3:  ;
  3.                 ; Sample program fragment to change diskette  ;
  4.                 ; BIOS parameters.                            ;
  5.                 ;---------------------------------------------;
  6.  
  7.  
  8.                 ;-------------------------------------------------;
  9.                 ; Define the structure of the BIOS diskette parms ;
  10.                 ;-------------------------------------------------;
  11.  
  12. DISKPARMS       struc
  13.  
  14. SPEC1           db      ?               ; Don't change these values
  15. SPEC2           db      ?
  16. SPEC3           db      ?
  17. SPEC4           db      ?
  18. SPEC5           db      ?
  19. SPEC6           db      ?
  20. SPEC7           db      ?
  21. SPEC8           db      ?
  22. SPEC9           db      ?
  23. HEAD_SETTLE     db      ?
  24. MOTOR_WAIT      db      ?
  25.  
  26. DISKPARMS       ends
  27.  
  28.                 ;-------------------------------------------------;
  29.                 ; Define the location of the pointer to the parms ;
  30.                 ;-------------------------------------------------;
  31.  
  32. SYS0    segment at 0000
  33.  
  34.         org     78h
  35.  
  36. DISK_PTR        label dword
  37.  
  38. SYS0    ends
  39.  
  40.  
  41.                 ;---------------------------------------------;
  42.                 ; Here is fragment to access the current      ;
  43.                 ; parameter block, and set the settle-time    ;
  44.                 ; and motor wait.                             ;
  45.                 ;                                             ;
  46.                 ; Enter with the settle time in AL, and       ;
  47.                 ; the motor-wait value (in 1/8ths of a sec.)  ;
  48.                 ; in AH.                                      ;
  49.                 ;                                             ;
  50.                 ; So you can preserve and restore the current ;
  51.                 ; values, AL & AH return with them: you must  ;
  52.                 ; save them for later if you want to restore. ;
  53.                 ;---------------------------------------------;
  54.  
  55. SET_PARMS       proc
  56.  
  57.         push    bx                      ; Save the reg's used.
  58.         push    ds
  59.         xor     bx,bx                   ; need sys0
  60.         mov     ds,bx
  61.  
  62. assume ds:SYS0
  63.  
  64.         lds     bx,DISK_PTR
  65.  
  66. assume ds:nothing
  67.  
  68.         xchg    [bx].HEAD_SETTLE,al
  69.         xchg    [bx].MOTOR_WAIT,ah
  70.  
  71.         pop     ds
  72.         pop     bx
  73.         ret
  74.  
  75. SET_PARMS       endp
  76.  
  77. ;-- You need your own "assume" and "end" statements!
  78.  
  79.  
  80.