home *** CD-ROM | disk | FTP | other *** search
- * DoDOS.asm - Call function from an AmigaDOS process context.
- * Copyright (C) 1991, 1992, 1993 Kristian Nielsen.
- *
- * This file is part of XFH, the compressing file system handler.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
-
- *************************************************************************
- *
- * Project: CFS
- * File: DoDOS.asm
- *
- * Kludge to make a call to DeviceProc. This process executes a function
- * for the handler, permitting AmigaDOS calls.
- *
- *************************************************************************
-
- INCLUDE "exec/types.i"
- INCLUDE "libraries/dosextens.i"
- INCLUDE "exec/ports.i"
-
- SECTION DoDeviceProc,CODE
-
- XDEF _DoDOS
- XDEF _DoDOSSeg
-
- XREF _LinkerDB
- XREF _SysBase
-
- XREF _LVOFindTask
- XREF _LVOWaitPort
- XREF _LVOGetMsg
- XREF _LVOForbid
- XREF _LVOReplyMsg
-
- _DoDOSSeg
- dc.l 0 ;Dummy seglist entry.
- _DoDOS
- lea _LinkerDB,a4
- move.l _SysBase(a4),a6
- suba.l a1,a1
- jsr _LVOFindTask(a6)
- movea.l d0,a2
- lea pr_MsgPort(a2),a2
- msgloop
- movea.l a2,a0
- jsr _LVOWaitPort(a6)
- movea.l a2,a0
- jsr _LVOGetMsg(a6)
- tst.l d0
- beq.s msgloop
-
- * The first long word after the message structure is the address of
- * the function to call. The message is passed in a0.
-
- movea.l d0,a2
- movea.l a2,a0
- movea.l MN_SIZE(a0),a1
- jsr (a1)
-
- * Now reply the message, and exit.
-
- jsr _LVOForbid(a6) ;Musn't unload until we're done.
- movea.l a2,a1
- jsr _LVOReplyMsg(a6)
-
- * Exit under the spell of the Forbid().
-
- rts
-
- END
-
-