Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- checkMMU
- */
- #define __CLIB_PRAGMA_LIBCALL
- #include <libraries/identify.h>
- #include <stdio.h>
- #include <string.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/identify.h>
- #include <exec/types.h>
- #include <exec/lists.h>
- #include <exec/memory.h>
- #include <exec/execbase.h>
- #include <mmu/context.h>
- #include <mmu/mmubase.h>
- #include <mmu/mmutags.h>
- #include <mmu/exceptions.h>
- #include <utility/tagitem.h>
- #define DOS_IO
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/mmu.h>
- #include <string.h>
- struct MMUBase *MMUBase;
- char *vers="\0$VER: checkMMU (21.03.2023)";
- char *stacksize = "$STACK:8192"; // only works when started from CLI
- int main(void)
- {
- LONG retval = 0;
- char mmutype;
- /* -- Open Libraries -- */
- SysBase = *((struct ExecBase **)4L);
- DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",40L);
- if (DOSBase)
- {
- MMUBase = (struct MMUBase *)OpenLibrary("mmu.library",46L);
- if (MMUBase)
- {
- puts("Found mmu.library - maybe there is a MMU in that System?\n");
- retval = 1;
- }
- else
- {
- puts("There seems to be NO MMU in that System.\n");
- retval = -1;
- }
- }
- else
- puts("Could not open DOSBase.");
- /* check for MMU */
- if (MMUBase)
- {
- mmutype = GetMMUType();
- printf("MMU: %ld\n", GetMMUType());
- switch (mmutype)
- {
- /* 68000 (no MMU) */
- case MUTYPE_NONE:
- puts("\nNo working MMU found!");
- puts("This seems to be MC68000, defective MMU\nor UAE flavour with MMU disabled.");
- retval = -1;
- break;
- /* 68020 (68851 MMU) */
- case MUTYPE_68851:
- puts("\nWorking MMU detected!");
- puts("This seems to be MC68020 with 68851 MMU");
- retval = 0;
- break;
- /* 68030 (internal MMU) */
- case MUTYPE_68030:
- puts("\nWorking MMU detected!");
- puts("This seems to be MC68030 with internal MMU");
- retval = 0;
- break;
- /* 68040 (internal MMU) */
- case MUTYPE_68040:
- puts("\nWorking MMU detected!");
- puts("This seems to be MC68040 with internal MMU");
- retval = 0;
- break;
- /* 68030 (internal MMU) */
- case MUTYPE_68060:
- puts("\nWorking MMU detected!");
- puts("This seems to be MC68060 with internal MMU");
- retval = 0;
- break;
- default:
- puts("\nCould not determine if there is a working MMU.");
- }
- }
- /* -- Close Libraries -- */
- if (MMUBase)
- CloseLibrary((struct Library *)MMUBase);
- if (DOSBase)
- CloseLibrary((struct Library *)DOSBase);
- return (retval);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement