1 | /*
|
---|
2 | =============================================================================
|
---|
3 | mem.c -- show some critical memory allocation values
|
---|
4 | Version 1 -- 1988-02-01 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "stdio.h"
|
---|
10 | #include "osbind.h"
|
---|
11 |
|
---|
12 | typedef unsigned word;
|
---|
13 |
|
---|
14 | struct basepg {
|
---|
15 |
|
---|
16 | char *lowtpa; /* low TPA (basepage) address */
|
---|
17 | char *hitpa; /* high TPA (initial stack) address */
|
---|
18 | word *tbase; /* text segment base */
|
---|
19 | long tlen; /* text segment length */
|
---|
20 | word *dbase; /* data segment base */
|
---|
21 | long dlen; /* data segment length */
|
---|
22 | word *bbase; /* bss segment base */
|
---|
23 | long blen; /* bss segment length */
|
---|
24 | char *dta; /* initial DTA */
|
---|
25 | struct basepg *parent; /* pointer to parent's basepage */
|
---|
26 | long resptr; /* reserved pointer */
|
---|
27 | char *envstr; /* environment string pointer */
|
---|
28 | };
|
---|
29 |
|
---|
30 | extern char *_break;
|
---|
31 | extern struct basepg *_base;
|
---|
32 |
|
---|
33 | /* |
---|
34 |
|
---|
35 | */
|
---|
36 |
|
---|
37 | main()
|
---|
38 | {
|
---|
39 | long savessp, memsize, tpasize, syssize;
|
---|
40 | long *phystop, *membot, *memtop, *v_basad, *sysbase, *end_os;
|
---|
41 | long pt, mb, mt, vb, sb, eo;
|
---|
42 |
|
---|
43 | phystop = (long *)0x000042EL;
|
---|
44 | membot = (long *)0x0000432L;
|
---|
45 | memtop = (long *)0x0000436L;
|
---|
46 | v_basad = (long *)0x000044EL;
|
---|
47 | sysbase = (long *)0x00004F2L;
|
---|
48 | end_os = (long *)0x00004FAL;
|
---|
49 |
|
---|
50 | printf("GEMDOS System memory allocation information:\n\n");
|
---|
51 |
|
---|
52 | savessp = Super(0L); /* do this in supervisor mode */
|
---|
53 |
|
---|
54 | mb = *membot; /* TPA start */
|
---|
55 | mt = *memtop; /* TPA end */
|
---|
56 | pt = *phystop; /* physical RAM top */
|
---|
57 | sb = *sysbase; /* system base */
|
---|
58 | eo = *end_os; /* OS RAM end */
|
---|
59 | vb = *v_basad; /* video RAM base */
|
---|
60 |
|
---|
61 | Super(savessp); /* back to user mode */
|
---|
62 |
|
---|
63 | memsize = mt - mb; /* size of the maximum possible TPA */
|
---|
64 | tpasize = (long)_base->hitpa - (long)_base->lowtpa; /* actual TPA */
|
---|
65 | syssize = memsize - tpasize;
|
---|
66 |
|
---|
67 | printf(" membot = %08.8lx\n", mb);
|
---|
68 | printf(" memtop = %08.8lx\n", mt);
|
---|
69 | printf(" memsize = %ld bytes\n\n", memsize);
|
---|
70 |
|
---|
71 | printf(" TPA low = %08.8lx\n", _base->lowtpa);
|
---|
72 | printf(" TPA hi = %08.8lx\n", _base->hitpa);
|
---|
73 | printf(" TPA len = %ld bytes\n\n", tpasize);
|
---|
74 |
|
---|
75 | printf(" syssize = %ld bytes\n\n", syssize);
|
---|
76 |
|
---|
77 | printf(" tbase = %08.8lx\n", _base->tbase);
|
---|
78 | printf(" DTA = %08.8lx\n", _base->dta);
|
---|
79 | printf(" parent = %08.8lx\n\n", _base->parent);
|
---|
80 |
|
---|
81 | printf(" phystop = %08.8lx\n", pt);
|
---|
82 | printf(" sysbase = %08.8lx\n\n", sb);
|
---|
83 |
|
---|
84 | printf(" end_os = %08.8lx\n", eo);
|
---|
85 | printf(" v_basad = %08.8lx\n", vb);
|
---|
86 | }
|
---|