home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <exec/memory.h>
- #include <powerup/ppclib/interface.h>
- #include <powerup/gcclib/powerup_protos.h>
- #include <powerup/ppcinline/exec.h>
-
- #define LOOP 10
-
- char Buffer[LOOP][256];
-
- /* Attention
- * You can share the Caos structure for asynchronus calls because
- * it`s copied to some internal buffer BUT you must be very careful
- * about the data which is touched by the AmigaOS function.
- * In this example Buffer is the problem and each asynchron call
- * is using a different buffer.
- */
-
- int main(void)
- {
- struct Caos *MyCaos;
- BPTR MyFile;
- ULONG i;
- void *DOSBase;
- void *SysBase;
- int Length;
-
- MyFile = PPCOutput();
- if (MyCaos = (struct Caos*) PPCAllocVec(sizeof(struct Caos),MEMF_PUBLIC|MEMF_CLEAR))
- {
- SysBase =(void*) *((ULONG*) 4L);
-
- /* The OpenLibrary() call is defined in the powerup/ppcinline/exec.h
- call.
- */
-
- if (DOSBase=(void*) OpenLibrary("dos.library",0))
- {
- for (i=0;i<LOOP;i++)
- {
- Length = PPCsprintf(Buffer[i],
- "Asynchron String %ld\n",
- i);
-
-
- /* Do a simple AmigaOS dos.library/Write */
- MyCaos->caos_Un.Offset = -0x30;
- MyCaos->d1 = (ULONG) MyFile;
- MyCaos->d2 = (ULONG) Buffer[i];
- MyCaos->d3 = Length;
- MyCaos->a6 = (ULONG) DOSBase;
- MyCaos->M68kCacheMode = IF_CACHEFLUSHALL | IF_ASYNC;
- MyCaos->PPCCacheMode = IF_CACHEFLUSHALL;
- PPCCallOS(MyCaos);
- }
- }
- PPCFreeVec(MyCaos);
- }
- return(0);
- }
-