/* SetCPU V1.60 by Dave Haynie, April 13, 1990 Released to the Public Domain HEADER FILE */ #define PROGRAM_VERSION 160 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* ====================================================================== */ /* Define all bit components used for manipulation of the Cache Control Register. */ #define CACR_INST ((ULONG)(1L<<0)) #define CACR_DATA ((ULONG)(1L<<8)) #define CACR_FIXED ((ULONG)(CACR_DATA<b)?a:b) /* ====================================================================== */ /* From the CONTROL.A module */ extern void SetCACR(), GetCRP(), SetCRP(), SetTC(); extern ULONG GetCACR(), *GetVBR(), GetTC(); /* ====================================================================== */ /* From the IDENTS.A module */ extern ULONG GetCPUType(), GetMMUType(), GetFPUType(); /* ====================================================================== */ /* From the OTHER.A module */ extern void SetMMUTag(), FlushATC(), SetKeyDelay(); extern ULONG KeyCode, KeyCodeSize, BerrCode, BerrCodeSize; /* ====================================================================== */ /* From the REBOOT.A module. */ extern void ROMBoot(), CleanBoot(); extern ULONG BootCode, BootCodeSize, ResetCode, ResetCodeSize; /* ====================================================================== */ /* From the EXPDEV.C module. */ /* This structure is device information used by the memory mapping routine. */ struct ExpROMData { struct ExpROMData *next; ULONG ROMbase; ULONG ROMsize; ULONG imagebase; ULONG tablebase; char *name; }; extern LONG ReadExpDevs(); extern struct ExpROMData *GetExpROM(); extern void FreeExpROM(), SafeConfigDevs(); /* ====================================================================== */ /* From the MISC.C module. */ /* Patch types */ #define PT_STRING 1 #define PT_JSR 2 #define PT_END 3 #define PT_IGNORE 4 #define PT_KEYBOARD 5 /* This is a item */ struct pitem { UWORD Type; /* The type of patch to apply */ UWORD Pad; /* Nothing here yet... */ ULONG Offset; /* The offset at which to apply the patch */ ULONG Length; /* The length of the patch item */ UWORD *Code; /* The actual patch item */ }; /* This is the patch structure. */ struct patch { struct patch *next; /* Next patchlist */ struct pitem *list; /* First item in this patchlist */ UWORD Version; /* Which ROM version */ UWORD Revision; /* and revision */ }; /* These are the some patch system variables. */ #define KEYPATCH 0 extern struct patch SystemPatch[]; extern struct MemChunk *lastpatch; /* The actual functions. */ extern LONG striequ(), strniequ(); extern void MotorOff(); extern BYTE ReadBuf(); extern LONG CheckTDDev(); extern LONG AddPatch(); /* ====================================================================== */ /* From the MMU.C module. */ extern void Phantom(), SetMMURegs(), FillBasicTable(), FreeMMUTable(), MakeExpTable(), MakeFastStack(), FreeFastStack(); /* ====================================================================== */ /* From the MEMORY.C module. */ /* This section describes the system tag structure, where I stick all the information that I like to keep around. */ #define ROM_NOP 0x0000 /* No ROM operation called for */ #define ROM_FAST 0x0002 /* Normally installed FASTROM image */ #define ROM_KICK 0x0003 /* Installed as a KICK image */ #define ROM_FKICK 0x0004 /* A KICK image made into a FAST image */ /* This was originally the patchtag structure, which looked like a patch. I decided that was real kludgy. I hook the systag onto an invalid page descriptor which I locate in the physical ROM image, a place that should always be safe to have an invalid tag structure. Don't change this without checking in the "030Stuff.a" file -- some of these structure members are used by the reboot code. */ struct systag { ULONG tagsize; /* Size of this tag */ ULONG progver; /* The program version */ ULONG *maintable; /* The main ROM table */ ULONG *romhi; /* The main ROM image */ UWORD romtype; /* Type of MMU ROM */ UWORD patches; /* The number of other patches applied */ struct MemChunk *patchlist; /* List of installed patches */ struct ExpROMData *devs; /* Translated device ROMs */ ULONG TC; /* Precomputed TC used for KICK. */ ULONG CRP[2]; /* Precomputed CRP used for KICK. */ UWORD config; /* Configuration status. */ ULONG BerrSize; /* Size of bus error handler. */ char *OldBerr; /* The old BERR routine. */ char *BerrHandler; /* My BERR routine. */ short wrapup; /* Upper address wrap bound. */ short wrapdown; /* Lower address wrap bound. */ ULONG tablesize; /* Main table size. */ char *ResetCode; /* Actual reset routine */ ULONG romsize; /* Size of ROM image */ ULONG romloc; /* Where does the fool thing go? */ ULONG romstart; /* And where do we start it up? */ ULONG *romlo; /* Secondary ROM image, if needed */ char *sysstack; /* Physical system stack image */ ULONG sysstksize; /* System Stack allocated size. */ ULONG ResetSize; /* Size of the reset code. */ char *OldReset; /* Old Reset Code */ }; /* The actual functions */ extern void MemCopy(), SetMMURegs(), *AllocAligned(), SnoopSpecial(), FillBasicTable(), FreeSAFEImage(); ULONG * SizeROM(); extern struct systag *AllocROMImage(), *AllocDISKImage(), *AllocSAFEImage(), *GetSysTag(); extern LONG SmartlyGetRange(); /* ====================================================================== */ /* From the DISKIO.C module. */ extern struct systag *AllocKSImage(), *AllocFILEImage(), *AllocDISKImage(); /* ====================================================================== */ /* From the COOLHAND.C module. */ struct Window *CoolHand(); /* ====================================================================== */ /* Intermodule globals */ struct CfgBlock { ULONG Addr, Size; }; #ifdef MAIN_MODULE struct ExpansionBase *ExpansionBase = NULL; /* The expansion library */ unsigned short LoadErr = 16; struct CfgBlock Bridge = { 0L, 0L }, A26x0 = { 0L, 0L }; #else extern struct ExpansionBase *ExpansionBase; extern unsigned short LoadErr, forcewrap; extern struct CfgBlock Bridge, A26x0; extern BOOL allochead,aliens; extern ULONG cpu; #endif