home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / gcc_9112.lzh / include20 / inline / battmem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-15  |  1.8 KB  |  78 lines

  1. #include <inline/stub.h>
  2. #ifndef BASE_EXT_DECL
  3. #define BASE_EXT_DECL extern struct BattMemBase * BattMemBase;
  4. #endif
  5. #ifndef BASE_PAR_DECL
  6. #define BASE_PAR_DECL
  7. #define BASE_PAR_DECL0 void
  8. #endif
  9. #ifndef BASE_NAME
  10. #define BASE_NAME BattMemBase
  11. #endif
  12. __inline static void ObtainBattSemaphore(BASE_PAR_DECL0)
  13. {
  14.     BASE_EXT_DECL
  15.     register void *a6 __asm ("a6");
  16.     a6 = BASE_NAME;
  17.     __asm volatile ("
  18.     jsr a6@(-0x6)"
  19.     : /* no output */
  20.     : "g" (a6)
  21.     : "d0", "d1", "a0", "a1");
  22. }
  23. __inline static void ReleaseBattSemaphore(BASE_PAR_DECL0)
  24. {
  25.     BASE_EXT_DECL
  26.     register void *a6 __asm ("a6");
  27.     a6 = BASE_NAME;
  28.     __asm volatile ("
  29.     jsr a6@(-0xc)"
  30.     : /* no output */
  31.     : "g" (a6)
  32.     : "d0", "d1", "a0", "a1");
  33. }
  34. __inline static ULONG ReadBattMem(BASE_PAR_DECL APTR buffer, long unsigned int offset, long unsigned int length)
  35. {
  36.     BASE_EXT_DECL
  37.     register ULONG res __asm("d0");
  38.     register void *a6 __asm ("a6");
  39.     register APTR a0 __asm("a0");
  40.     register long unsigned int d0 __asm("d0");
  41.     register long unsigned int d1 __asm("d1");
  42.  
  43.     a6 = BASE_NAME;
  44.     a0 = buffer;
  45.     d0 = offset;
  46.     d1 = length;
  47.     __asm volatile ("
  48.     jsr a6@(-0x12)"
  49.     : "=g" (res)
  50.     : "g" (a6), "g" (a0), "g" (d0), "g" (d1)
  51.     : "d0", "d1", "a0", "a1");
  52.     return res;
  53. }
  54. __inline static ULONG WriteBattMem(BASE_PAR_DECL APTR buffer, long unsigned int offset, long unsigned int length)
  55. {
  56.     BASE_EXT_DECL
  57.     register ULONG res __asm("d0");
  58.     register void *a6 __asm ("a6");
  59.     register APTR a0 __asm("a0");
  60.     register long unsigned int d0 __asm("d0");
  61.     register long unsigned int d1 __asm("d1");
  62.  
  63.     a6 = BASE_NAME;
  64.     a0 = buffer;
  65.     d0 = offset;
  66.     d1 = length;
  67.     __asm volatile ("
  68.     jsr a6@(-0x18)"
  69.     : "=g" (res)
  70.     : "g" (a6), "g" (a0), "g" (d0), "g" (d1)
  71.     : "d0", "d1", "a0", "a1");
  72.     return res;
  73. }
  74. #undef BASE_EXT_DECL
  75. #undef BASE_PAR_DECL
  76. #undef BASE_PAR_DECL0
  77. #undef BASE_NAME
  78.