// set tabs to 4 #define WIDTH 320 // MUST be a multiple of 32 #define HEIGHT 200 struct TagItem TagArray[] = { SA_Interleaved, FALSE, // c2p8 does NOT work on interleaved screens // can add other tags here TAG_DONE,0 }; struct ExtNewScreen NewScreenStructure = { 0,0, WIDTH,HEIGHT, 8, // depth 0,1, NULL, CUSTOMSCREEN+SCREENQUIET+NS_EXTENDED, NULL, NULL, NULL, NULL, (struct TagItem *)&TagArray }; struct NewWindow NewWindowStructure1 = { 0,0, WIDTH,HEIGHT, 0,1, NULL, SIMPLE_REFRESH+BORDERLESS+NOCAREREFRESH, NULL, NULL, NULL, NULL, NULL, 5,5, WIDTH,HEIGHT, CUSTOMSCREEN }; // external function prototypes ----------------- void __asm c2p8_init ( register __a0 UBYTE *chunky, // pointer to chunky data register __a1 UBYTE *chunky_cmp, // pointer to chunky comparison buffer register __a2 PLANEPTR *planes, // pointer to planes register __d0 ULONG signals1, // 1 << sigbit1 register __d1 ULONG signals2, // 1 << sigbit2 register __d2 ULONG pixels, // WIDTH * HEIGHT register __d3 ULONG offset, // byte offset into plane register __d4 UBYTE *buff2, // Chip buffer (size = width*height) register __d5 UBYTE *buff3, // Chip buffer (size = width*height) register __a3 struct GfxBase *GfxBase); void __asm c2p8_go(void); // internal function prototypes ----------------- long get_timer(void); void free_timer(void); long get_signals(void); void free_signals(void); long get_chunky_mem(void); void free_chunky_mem(void); void init_chunky(void); long get_window(void); void free_window(void); // library bases -------------------------------- struct DosLibrary *DOSBase; struct IntuitionBase *IntuitionBase; struct ExecBase *SysBase; struct GfxBase *GfxBase; struct Library *TimerBase; struct Library *MathIeeeDoubBasBase; // timer related variables ---------------------- struct timerequest timerio_m; struct EClockVal time0_m; struct EClockVal time1_m; struct timerequest *timerio = &timerio_m; struct EClockVal *time0 = &time0_m; struct EClockVal *time1 = &time1_m; ULONG timerclosed = TRUE; double micros_per_eclock; // Length of EClock tick in microseconds // window related variables --------------------- struct RastPort *RP; struct Screen *s; struct Window *w; // chunky data and c2p8() related variables ----- UBYTE *chunky; // chunky data (preferably in fast ram) UBYTE *chunky_cmp; // chunky data comparison buffer (preferably in fast ram) UBYTE *buff2; // blitter buffer (chip ram) UBYTE *buff3; // blitter buffer (chip ram) long sigbit1 = -1; // used by c2p8() long sigbit2 = -1; // used by c2p8() #define nokick "This needs Kickstart 3.0!\n" #define REPEAT_COUNT 10 long __saveds main(void) { int count; double micros, sum_micros; SysBase = *(struct ExecBase **)4; if(DOSBase = (struct DosLibrary *) OpenLibrary("dos.library",33)) { // check what kickstart version we are using // inform the user and exit if lower than 39 if( DOSBase->dl_lib.lib_Version < 39) { Write(Output(), nokick, sizeof(nokick) ); CloseLibrary( (struct Library *) DOSBase); return(0); } // if compiling with 68020+ code, exit before we crash // a 68000 machine #ifdef _M68020 if(! ( SysBase->AttnFlags & AFF_68020) ) { Printf("This version needs at least a 68020!\n"); return(0); } #endif if(IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",39)) if(GfxBase = (struct GfxBase *) OpenLibrary("graphics.library",39)) { if( get_timer() ) if( get_window() ) if( get_chunky_mem() ) if( get_signals() ) { Printf ("\nWidth = %ld, Height = %ld, Depth = 8\n\n",WIDTH, HEIGHT ); sum_micros = 0.0; // initialize c2p converter c2p8_init ( chunky, chunky_cmp, &RP->BitC