home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / code_examples / a68kex / slowme.asm < prev    next >
Assembly Source File  |  1991-01-17  |  3KB  |  111 lines

  1.  
  2. ***********************************************
  3. * This little program speeds up               *
  4. * the motors of floppys df0: - df3:           *
  5. * This has two effects:                       *
  6. * 1. the floppy is speeded                    *
  7. * 2. the scratching sound the floppy          *
  8. *    usually makes becomes a whining sound    *
  9. *                                             *
  10. * I know of no negative effects               *
  11. *                                             *
  12. *   E. Lenz                                   *
  13. *   Johann-Fichte-Strasse 11                  *
  14. *   8 Munich 40                               *
  15. *   Germany                                   *
  16. ***********************************************
  17.  
  18. ; EXEC.library routines
  19.  
  20. _AbsExecBase       equ 4
  21. _LVOForbid         equ -$84
  22. _LVOPermit         equ -$8a
  23. _LVOFindName       equ -$114
  24. _LVOGetMsg         equ -$174
  25. _LVOReplyMsg       equ -$17a
  26. _LVOWaitPort       equ -$180
  27.  
  28. PortStatus   equ 34
  29. TrackPort    equ 36
  30. SPReg        equ 54
  31. IDNestCnt    equ 294
  32. TrackTask    equ 302
  33. DeviceList   equ 350
  34.  
  35. pr_MsgPort       equ $5c
  36. pr_CLI           equ $ac
  37. ThisTask         equ $114
  38.  
  39.         moveq   #0,d7
  40.         movea.l _AbsExecBase,a6
  41.         movea.l ThisTask(a6),a0
  42.  
  43. ; Start from Workbench ?
  44.  
  45.         tst.l   pr_CLI(a0)
  46.         bne.s   noWB          Not from WB
  47.  
  48. ; Get WB Message
  49.  
  50.         lea     pr_MsgPort(a0),a0
  51.         jsr     _LVOWaitPort(a6)
  52.         jsr     _LVOGetMsg(a6)
  53.         move.l  d0,d7           Pointer to WB message
  54.  
  55.  
  56. noWB    bsr.s   Disable
  57.  
  58.         lea     TrackName(pc),a1
  59.         lea     DeviceList(a6),a0
  60.         jsr     _LVOFindName(a6)
  61.         movea.l d0,a5              a5 = trackdisk save
  62.         beq.s   Err
  63.  
  64. ; speed up df0: to df3:
  65.  
  66.         moveq   #12,d3
  67. l3      move.l  TrackPort(a5,d3.w),d0   is drive implemented?
  68.         beq.s   l5
  69.         movea.l d0,a3
  70.  
  71. l1      btst    #0,PortStatus(a3)     wait until drive ready
  72.         bne.s   l1
  73.         move.l  #1800,$2c(a3)         speed up step motor
  74.         move.l  #1,$30(a3)            no wait after positioning
  75.         lea     TrackTask+SPReg(a3),a2
  76.         movea.l (a2),a1
  77.  
  78. l5      subq.l  #4,d3
  79.         bpl.s   l3
  80.  
  81. Err     bsr.s   Enable
  82.         tst.l   d7
  83.         beq.s   Nbench
  84.  
  85.         jsr     _LVOForbid(a6)
  86.         movea.l d7,a1
  87.         jsr     _LVOReplyMsg(a6)  Reply to WB
  88.         jsr     _LVOPermit(a6)
  89.  
  90. Nbench  moveq   #0,d0    No errors
  91.         rts
  92.  
  93.  
  94. Disable move.w  #$4000,$dff09a     disable copper interrupts
  95.         move.l  a6,-(a7)
  96.         movea.l _AbsExecBase,a6
  97.         addq.b  #1,IDNestCnt(a6)
  98.         bra.s   Ll1
  99.  
  100. Enable  move.l  a6,-(a7)           enable copper interrupts
  101.         movea.l _AbsExecBase,a6
  102.         subq.b  #1,IDNestCnt(a6)
  103.         bge.s   Ll1
  104.         move.w  #$c000,$dff09a
  105. Ll1     movea.l (a7)+,a6
  106.         rts
  107.  
  108. TrackName  dc.b 'trackdisk.device',0
  109.            even
  110.            end
  111.