home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff236.lzh
/
DiskHandler
/
diska.a
< prev
next >
Wrap
Text File
|
1989-08-09
|
3KB
|
59 lines
;/* Disk.asm - Disk assembler support routines */
;/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
;/* |_o_o|\\ Copyright (c) 1987 The Software Distillery. All Rights Reserved */
;/* |. o.| || This program may not be distributed without the permission of */
;/* | . | || the author. BBS: */
;/* | o | || John Toebes Dave Baker (919)-471-6436 */
;/* | . |// */
;/* ====== */
;/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
SECTION section
XDEF _DskChngIntA
XDEF _MakeDateStamp
XREF _DskChngInt
XREF _LinkerDB
; Provides for the C calling conventions
; for the Disk Change Interrupt Function
_DskChngIntA:
move.l a4,-(SP)
lea _LinkerDB,A4
move.l a1,-(sp) ; put A1 (*global) onto the stack
jsr _DskChngInt ; call C routine
addq.w #4,SP ; fix up the stack
move.l (SP)+,A4 ; Restore destroyed registers
rts ; now that was painless wasn't it
; This code was conceived and written by Steve Beats at Commodore.
; Quite nice and elegant for such a complex operation.
_MakeDateStamp:
movem.l 4(SP),A0/A1 ; Get address of incoming time information
movem.l d2-d4,-(SP) ; and preserve the registers we destroy
movem.l (a0),d0/d1 ; get the incoming time information
moveq.l #0,d2 ; days = 0
moveq.l #0,d3 ; mins = 0
moveq.l #0,d4 ; ticks = 0
divu.w #43200,d0 ; half days = secs/43200
move.w d0,d2 ; d2 = #half days
clr.w d0
swap d0
lsr.w #1,d2 ; d2 = days
bcc.s l1 ; no extra half day
addi.l #43200,d0 ; d0 = remaining seconds
l1: divu.w #60,d0 ; mins = secs/60
move.w d0,d3 ; d3 = mins
swap d0 ; d0 = remaining seconds
divu.w #20000,d1 ; d1 = odd ticks
move.w d1,d4
mulu.w #50,d0 ; convert seconds to ticks
add.l d0,d4 ; d4 = total ticks
movem.l d2/d3/d4,(a0) ; save days,mins,ticks
movem.l (sp)+,d2-d4 ; Clean up the mess we made of the registers
rts
end