home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / LA / LA023.ZIP / QFLOP2.ZIP / QFLOP2.ASM next >
Assembly Source File  |  1988-11-24  |  7KB  |  145 lines

  1. title   'QUIKFLOP.ASM by Dave Williams, 11/24/1988 ver 2.00'
  2. comment / This program was written and assembled with MASM 5.1. Since it
  3.           doesn't use any of the special directives from MASM 5.x, it should
  4.           assemble under any earlier version.
  5.            The JMP SHORT (label) instructions are to tell the assembler that
  6.           this is a near jump, which saves a bit of code space. Plus MASM
  7.           5.1 bitches and moans about it.
  8.            Version 2.00 at the request of Mike Arst in Seattle, who for some
  9.           reason wanted to restore his floppies to their defaults for something.
  10.         /
  11.  
  12. cseg    segment para public 'code'
  13.         assume  cs:cseg,ds:cseg,es:cseg
  14. main    proc    far
  15.         org     100h
  16. start:  jmp     begin
  17.  
  18. lf      equ     0Ah                     ;ASCII for linefeed
  19. cr      equ     0Dh                     ;ASCII for carriage return
  20. bel     equ     07h                     ;ASCII bell character
  21. logon   db      'QuikFlop v2.00 Copyright (c) Dave Williams 1988',cr,lf,'$'
  22. logoff  db   lf,'         Diskette parameters changed',cr,lf,'$'
  23. help    db      ' Syntax: quikflop /Q /R ',cr,lf
  24.         db      '         /Q speeds up floppy drive',cr,lf
  25.         db      '         /R resets to IBM defaults',cr,lf,'$'
  26. IBM     db   lf,'         Parameters reset to IBM defaults',cr,lf,'$'
  27. badparm db  bel,'Bad Parameter',cr,lf,'$'
  28. defname db      'NUL',2 dup (0)         ;make larger for more params later
  29.  
  30. begin:
  31.         mov     dx,offset logon         ;say hello and display copyright
  32.         mov     ah,09h                  ;DOS function to display a string
  33.         int     21h                     ;call DOS
  34.  
  35.         cmp  byte ptr ds:[80h],0        ;any command line parameter chars?
  36.         jz      help_msg                ;no, show them the help screen
  37.         cmp byte ptr ds:[81h],'/'       ;is first character a slash? 
  38.         jz      get_toggle              ;yes, go get toggle char(s)
  39.  
  40. read_data:  mov  si,82h                 ;see if there're any parameters
  41.             mov  bx,offset defname      ;point bx to defname
  42.  
  43. ; get toggle character(s)
  44. get_toggle:
  45.         lodsb                           ;load next byte & INC SI
  46.         cmp     al,'/'                  ;is it a toggle character?
  47.         jz      get_toggle              ;yes, so try again
  48. what_toggle:
  49.         and     al,95   ;capitalize (if it gets here, it's the char after a /)
  50.         cmp     al,'Q'                  ;gimme an Q?
  51.         jz      setparms                ;set parms to generalized fast mode
  52.         cmp     al,'R'                  ;gimme an R?
  53.         jz      reset_IBM               ;reset parms to IBM defaults
  54.         mov     dx,offset badparm       ;beep 'em and say there's a problem
  55.         mov     ah,09h                  ;DOS function to display a string
  56.         int     21h                     ;call DOS
  57.         jmp short help_msg              ;give 'em the help message again
  58.  
  59.  
  60. ;let's do it
  61. setparms:
  62. ; begin BIOS table modification (the GUTS!)
  63.         push    ds                      ;save for linkage
  64.         xor     ax,ax                   ;clear for return
  65.         push    ax                      ;put in stack
  66.  
  67.         push    ds                      ;modify diskette parameters
  68.         mov     ds,ax                   ;offset into disk table
  69.         lds     di,dword ptr ds:78h     ;address of disk table
  70.         mov     byte ptr [di],175       ;modify step rate     (normal 239)
  71.         mov     byte ptr [di+2],5       ;and motor stop delay (normal 37)
  72.         mov     byte ptr [di+0Ch],0     ;and head settle time (normal 15-25)
  73.         mov     byte ptr [di+10h],1     ;motor start time, 1/8 sec increments
  74.         int     13h                     ;reset diskette system
  75.         pop     ds                      ;clear the stack
  76. ; tell 'em we're done and goodbye
  77.         mov     dx,offset logoff        ;tell 'em we're through
  78.         mov     ah,09h                  ;DOS function to display a string
  79.         int     21h                     ;call DOS
  80.         jmp short exitok
  81.  
  82.  
  83. reset_IBM:
  84. ; begin BIOS table modification (same routine as setparms)
  85.         push    ds                      ;save for linkage
  86.         xor     ax,ax                   ;clear for return
  87.         push    ax                      ;put in stack
  88.  
  89.         push    ds                      ;modify diskette parameters
  90.         mov     ds,ax                   ;offset into disk table
  91.         lds     di,dword ptr ds:78h     ;address of disk table
  92.         mov     byte ptr [di],239       ;reset step rate      (normal 239)
  93.         mov     byte ptr [di+2],37      ;and motor stop delay (normal 37)
  94.         mov     byte ptr [di+0Ch],25    ;and head settle time (normal 15-25)
  95.         mov     byte ptr [di+10h],2     ;motor start time, 1/8 sec increments
  96.         pop     ds                      ;clear the stack
  97.  
  98.         mov     dx,offset IBM           ;tell 'em we reset everything
  99.         mov     ah,09h                  ;DOS function to display a string
  100.         int     21h                     ;call DOS
  101.         jmp short exitok
  102.  
  103.  
  104. help_msg:
  105.         mov     dx,offset help          ;tell 'em about the program
  106.         mov     ah,9
  107.         int     21h
  108.         jmp short exitok
  109.  
  110. ; exit to DOS
  111. exitok: mov     al,0                    ;set errorlevel to 0
  112.         mov     ah,04Ch                 ;exit w/errorlevel
  113.         int     21h
  114.  
  115. main    endp
  116. cseg    ends
  117.         end     start
  118.  
  119. COMMENT /
  120.  table of data on diskette parameter table:
  121. Interrupt 1Eh  Vector of Diskette Controller Parameters
  122. (0:0078h)       Dword address points to data base table that is used by BIOS.
  123.                 Default location is at 0F000:0EFC7h. 11-byte table format:
  124.                 bytes:
  125.                 00h     4-bit step rate, 4-bit head unload time 
  126.                 01h     7-bit head load time, 1-bit DMA flag
  127.                 02h     54.9254 ms counts - delay till motor off (37-38 typ)
  128.                 03h     sector size: 
  129.                         00h     128 bytes
  130.                         01h     256 bytes
  131.                         02h     512 bytes
  132.                         03h     1024 bytes
  133.                 04h     last sector on track (8 or 9 typical)
  134.                 05h     gap between sectors on read/write (42 typical)
  135.                 06h     data length for DMA transfers (0FFh typical)
  136.                 07h     gap length between sectors for format (80 typical)
  137.                 08h     sector fill byte for format (0F6h typical)
  138.                 09h     head settle time (in milliseconds) (15 to 25 typical)
  139.                         DOS 1.0   0
  140.                         DOS 2.10  15
  141.                         DOS 3.1   1   (allegedly)
  142.                 10h     motor start time (in 1/8 second intervals) (2 to 4 typ.)
  143.                         DOS 2.10  2
  144. COMMENT /
  145.