home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 274.lha / DiskHandler / diska.a < prev    next >
Text File  |  1989-07-25  |  3KB  |  59 lines

  1. ;/* Disk.asm - Disk assembler support routines */
  2.  
  3. ;/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  4. ;/* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved */
  5. ;/* |. o.| || This program may not be distributed without the permission of   */
  6. ;/* | .  | || the author.                                           BBS:      */
  7. ;/* | o  | ||   John Toebes    Dave Baker                     (919)-471-6436  */
  8. ;/* |  . |//                                                                  */
  9. ;/* ======                                                                    */
  10. ;/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  11.  
  12.         SECTION section
  13.  
  14.         XDEF _DskChngIntA
  15.         XDEF _MakeDateStamp
  16.         XREF _DskChngInt
  17.         XREF _LinkerDB
  18.  
  19. ; Provides for the C calling conventions
  20. ; for the Disk Change Interrupt Function
  21.  
  22. _DskChngIntA:
  23.           move.l a4,-(SP)
  24.           lea    _LinkerDB,A4
  25.           move.l a1,-(sp)     ; put A1 (*global) onto the stack
  26.           jsr    _DskChngInt  ; call C routine
  27.           addq.w #4,SP        ; fix up the stack
  28.           move.l (SP)+,A4     ; Restore destroyed registers
  29.           rts                 ; now that was painless wasn't it
  30.  
  31. ; This code was conceived and written by Steve Beats at Commodore.
  32. ; Quite nice and elegant for such a complex operation.
  33. _MakeDateStamp:
  34.           movem.l 4(SP),A0/A1     ; Get address of incoming time information
  35.           movem.l d2-d4,-(SP)     ; and preserve the registers we destroy
  36.           movem.l (a0),d0/d1      ; get the incoming time information
  37.           moveq.l #0,d2           ; days = 0
  38.           moveq.l #0,d3           ; mins = 0
  39.           moveq.l #0,d4           ; ticks = 0
  40.           divu.w  #43200,d0       ; half days = secs/43200
  41.           move.w  d0,d2           ; d2 = #half days
  42.           clr.w   d0
  43.           swap    d0
  44.           lsr.w   #1,d2           ; d2 = days
  45.           bcc.s   l1              ; no extra half day
  46.           addi.l  #43200,d0       ; d0 = remaining seconds
  47. l1:       divu.w  #60,d0          ; mins = secs/60
  48.           move.w  d0,d3           ; d3 = mins
  49.           swap    d0              ; d0 = remaining seconds
  50.           divu.w  #20000,d1       ; d1 = odd ticks
  51.           move.w  d1,d4
  52.           mulu.w  #50,d0          ; convert seconds to ticks
  53.           add.l   d0,d4           ; d4 = total ticks
  54.           movem.l d2/d3/d4,(a0)   ; save days,mins,ticks
  55.           movem.l (sp)+,d2-d4     ; Clean up the mess we made of the registers
  56.           rts
  57.  
  58.           end
  59.