Category : OS/2 Files
Archive   : EMXTST8F.ZIP
Filename : HW_MEM.C
#include
#include
#include
#include
#include
int main (int argc, char *argv[])
{
unsigned char *p;
unsigned long address, length, base, end, i;
char *q;
if (_osmode != DOS_MODE)
{
printf ("This programs runs under DOS, only.\n");
return (1);
}
if (argc != 3)
{
printf ("Usage: hw_mem
}
errno = 0;
address = strtoul (argv[1], &q, 16);
if (errno != 0 || *q != 0)
{
printf ("hw_mem: invalid address\n");
return (1);
}
length = strtoul (argv[2], &q, 16);
if (errno != 0 || *q != 0 || length == 0)
{
printf ("hw_mem: invalid length\n");
return (1);
}
base = address & ~0xfff;
end = (address + length - 1) | 0xfff;
p = _memaccess (base, end, 0);
if (p == NULL)
{
perror ("hw_mem: _memaccess");
return (2);
}
p += address - base;
if (_isterm (fileno (stdout)))
setvbuf (stdout, NULL, _IOLBF, BUFSIZ);
printf ("%.8lx:", address & ~0x0f);
for (i = 0; i < (address & 0x0f); ++i)
printf (" ");
for (i = 0; i < length; ++i)
{
printf (" %.2x", *p++);
++address;
if ((address & 0xf) == 0)
{
putchar ('\n');
if (i + 1 < length)
printf ("%.8lx:", address);
}
}
if ((address & 0xf) != 0)
putchar ('\n');
return (0);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/