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>
-
-
- /* This is in no way a useful 68k function
- * or a style of programming i suggest:-)
- */
-
- UWORD M68kProgram[]=
- {
- /*
- Color:
- ;d0=color
- move.l d2,-(a7)
- moveq #-1,d1
- moveq #20,d2
- 0$:
- move.w d0,$dff180
- dbra d1,0$
- dbra d2,0$
- move.l (a7)+,d2
- rts
- */
-
- 0x2f02,
- 0x72ff,
- 0x7414,
- 0x33c0,
- 0x00df,
- 0xf180,
- 0x51c9,
- 0xfff8,
- 0x51ca,
- 0xfff4,
- 0x241f,
- 0x4e75
- };
-
- int main(void)
- {
- struct Caos *MyCaos;
-
- if (MyCaos = (struct Caos*) PPCAllocVec(sizeof(struct Caos),
- MEMF_PUBLIC|MEMF_CLEAR))
- {
- MyCaos->caos_Un.Function = (APTR) &M68kProgram;
- /* Look at the M68k function above and you see that this
- function doesn`t touch any memory the PPC uses or
- will use after the function returns.
- BUT let`s assume you would call AllocMem now and pass back
- that ptr to the PPC program you would need to set CacheFlush
- TRUE. Attention..you`re aren`t allowed to use normal AllocMem
- areas anyway because of the needed CacheLine Alignment only
- the ppc.library functions offer.
- */
- MyCaos->M68kCacheMode = IF_CACHEFLUSHNO;
- MyCaos->PPCCacheMode = IF_CACHEFLUSHNO;
- MyCaos->d0 = 0x0ff; /* the value the 68k function writes into color reg 0 */
- PPCCallM68k(MyCaos);
- PPCFreeVec(MyCaos);
- }
- return(0);
- }
-