home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / AT_WORLD / ATRIW6B.MSA / OTHER_SEEKUP_SEEKUPE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-26  |  2.2 KB  |  78 lines

  1. /*********************************************************************
  2. *
  3. * SEEKUP
  4. *
  5. * Short description:
  6. * On STs running TOS 2.06, SEEKUP turns off step rate doubling.
  7. *
  8. * Versions:
  9. * 1.0  mo  25.04.92  base version
  10. *
  11. * Author:
  12. * mo   (\/) Martin Osieka, Erbacherstr. 2, D-6100 Darmstadt
  13. *
  14. * Translated (sort of) into English (kind of) by Martin_Koehling@un.maus.de
  15. * Note: only tested (by me) with German TOS ROMs.
  16. *
  17. *********************************************************************/
  18.  
  19. #include <stddef.h>
  20. #include <tos.h>
  21.  
  22.  
  23. #define PRGNAME "(\\/) SEEKUP"
  24.  
  25. #define _sysbase (*((SYSHDR **)0x4F2))
  26.  
  27. /*** 3rd variant of the DSB ***/
  28. typedef struct {
  29.   char cmdbit3;   /* $00 or $08, will be OREd into the SEEK command
  30.                      Can be changed/inquired with Floprate() */
  31.   char dummy;     /* unused */
  32.   short track;    /* current track */
  33.   short hdmode;   /* 0 or 3, written into register $FF860E
  34.                      This register doesn't exist on a ST */
  35.   short seekrate; /* hdmode=0: 0: 6ms, 1: 12ms, 2: 2ms, 3: 3ms
  36.                      hdmode=3: 0,1: 12ms, 2,3: 6ms
  37.                      Can be changed/inquired with Floprate() */
  38. } dsb3S;
  39.  
  40. /*
  41. TOS remembers the floppy disk state in DSBs.
  42. The DSBs are initialized to { 0, 0, 0xFF00, 3, _seekrate}, which sets
  43. the seek rate to 6 ms on a ST.
  44. The track positioning routine toggles <hdmode> when an error occurs and
  45. makes a second attempt.
  46. The formatting function sets <hdmode> depending on the number of sectors
  47. per track. It would propably be better if TOS set <hdmode> to 0 after any
  48. diskchange it recognized.
  49. */
  50.  
  51. /********************************************************************/
  52.  
  53. int main( void)
  54. {
  55.   void *stk;
  56.   SYSHDR *sys;
  57.  
  58.   /*** get address of OSHEADER ***/
  59.   stk = (void *)Super( NULL);
  60.   sys = _sysbase->os_base;
  61.   Super( stk);
  62.  
  63.   /*** turn of seek rate doubling ***/
  64.   if (sys->os_version == 0x206) {
  65.     dsb3S *pdsb = (dsb3S *)0x160A;
  66.     pdsb->hdmode = 0;
  67.     (pdsb+1)->hdmode = 0;
  68.     Cconws( PRGNAME ": Done.\r\n");
  69.   }
  70.   else {
  71.     Cconws( PRGNAME ": Unsupported TOS.\r\n");
  72.   };
  73.  
  74.   return( 0);
  75. } /* main */
  76.  
  77. /********************************************************************/
  78.