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