#ifndef _INL_DOS_H_
#define _INL_DOS_H_

#include <sys/cdefs.h>
#include <inline/stubs.h>

__BEGIN_DECLS

#ifndef BASE_EXT_DECL
#define BASE_EXT_DECL extern struct DosLibrary * DOSBase;
#endif
#ifndef BASE_PAR_DECL
#define BASE_PAR_DECL
#define BASE_PAR_DECL0 void
#endif
#ifndef BASE_NAME
#define BASE_NAME DOSBase
#endif

static __inline void 
FreeArgs (BASE_PAR_DECL struct RDArgs *args)
{
  BASE_EXT_DECL
  register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
  register struct RDArgs *d1 __asm("d1") = args;
  __asm __volatile ("jsr a6@(-0x35a)"
  : /* no output */
  : "r" (a6), "r" (d1)
  : "a0","a1","d0","d1", "memory");
}
static __inline LONG 
IoErr (BASE_PAR_DECL0)
{
  BASE_EXT_DECL
  register LONG  _res  __asm("d0");
  register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
  __asm __volatile ("jsr a6@(-0x84)"
  : "=r" (_res)
  : "r" (a6)
  : "a0","a1","d0","d1", "memory");
  return _res;
}
static __inline struct RDArgs *
ReadArgs (BASE_PAR_DECL STRPTR _template,LONG *array,struct RDArgs *args)
{
  BASE_EXT_DECL
  register struct RDArgs * _res  __asm("d0");
  register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
  register STRPTR d1 __asm("d1") = _template;
  register LONG *d2 __asm("d2") = array;
  register struct RDArgs *d3 __asm("d3") = args;
  __asm __volatile ("jsr a6@(-0x31e)"
  : "=r" (_res)
  : "r" (a6), "r" (d1), "r" (d2), "r" (d3)
  : "a0","a1","d0","d1","d2","d3", "memory");
  return _res;
}
static __inline void 
ReplyPkt (BASE_PAR_DECL struct DosPacket *dp,long res1,long res2)
{
  BASE_EXT_DECL
  register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
  register struct DosPacket *d1 __asm("d1") = dp;
  register long d2 __asm("d2") = res1;
  register long d3 __asm("d3") = res2;
  __asm __volatile ("jsr a6@(-0x102)"
  : /* no output */
  : "r" (a6), "r" (d1), "r" (d2), "r" (d3)
  : "a0","a1","d0","d1","d2","d3", "memory");
}
static __inline struct DosPacket *
WaitPkt (BASE_PAR_DECL0)
{
  BASE_EXT_DECL
  register struct DosPacket * _res  __asm("d0");
  register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
  __asm __volatile ("jsr a6@(-0xfc)"
  : "=r" (_res)
  : "r" (a6)
  : "a0","a1","d0","d1", "memory");
  return _res;
}

#undef BASE_EXT_DECL
#undef BASE_PAR_DECL
#undef BASE_PAR_DECL0
#undef BASE_NAME

__END_DECLS

#endif /* _INL_DOS_H_ */
  
  
