]> pd.if.org Git - mmurtl/commitdiff
autocommit for file dated 1995-02-09 16:01:28
authorRichard Burgess <>
Thu, 9 Feb 1995 16:01:28 +0000 (16:01 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 17 Oct 2016 14:03:48 +0000 (14:03 +0000)
msamples/othersrc/memtest.c [new file with mode: 0644]

diff --git a/msamples/othersrc/memtest.c b/msamples/othersrc/memtest.c
new file mode 100644 (file)
index 0000000..c4c8535
--- /dev/null
@@ -0,0 +1,75 @@
+/* Test memory Aliasing for MMURTL V1.0 */\r
+/*  Copyright (c) 1994 R.A. Burgess     */\r
+/*  All Rights Reserved                 */\r
+\r
+/*\r
+This simple program shows how memory aliasing works in MMURTL.\r
+To build this, use MakeIt.bat in DOS, or use CM32 and DASM:\r
+  CM32 MemTest.c\r
+  DASM MemTest.atf\r
+*/\r
+\r
+\r
+#define U32 unsigned long\r
+#define S32 long\r
+#define U16 unsigned int\r
+#define S16 int\r
+#define U8 unsigned char\r
+#define S8 char\r
+#define TRUE 1\r
+#define FALSE 0\r
+\r
+\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <ctype.h>\r
+#include <stdlib.h>\r
+\r
+/* Includes for OS public calls and structures */\r
+\r
+#include "\OSSource\MMemory.h"\r
+#include "\OSSource\MKbd.h"\r
+#include "\OSSource\MStatus.h"\r
+\r
+/**************** BEGIN Data ********************/\r
+\r
+char *Alias;\r
+U32 AliasPhy;\r
+U32 OSPhy;\r
+\r
+/**************** BEGIN Code ********************/\r
+\r
+void main(U32 argc, U8 argv[])\r
+{\r
+unsigned long erc, key;\r
+\r
+       erc = GetPhyAdd(1, 3072, &OSPhy);\r
+       if (erc)\r
+               printf("ERROR %d on GetPhyAdd.\r\n", erc);\r
+\r
+       printf("Aliasing Job 1 Linear Address %08x\r\n", 3072);\r
+       printf("Physical Address is           %08x\r\n", OSPhy);\r
+\r
+       erc = AliasMem(3072, 8000, 1, &Alias);\r
+\r
+       if (erc)\r
+               printf("ERROR %d on AliasMem.\r\n", erc);\r
+\r
+       erc = GetPhyAdd(3, Alias, &AliasPhy);\r
+\r
+       if (erc)\r
+               printf("ERROR %d on GetPhyAdd.\r\n", erc);\r
+\r
+       printf("Alias Linear address is   %08x\r\n", Alias);\r
+       printf("Physical Address is       %08x\r\n", AliasPhy);\r
+\r
+       printf("Press a key to continue...\r\n");\r
+       ReadKbd(&key, 1);\r
+\r
+       erc = DeAliasMem(Alias, 8000, 3);\r
+       if (erc)\r
+               printf("ERROR %d on DeAliasMem.\r\n", erc);\r
+\r
+       exit(0);\r
+\r
+}\r