more rendering corrections
[AROS.git] / workbench / tools / ShowConfig.c
blob1a8eaf93b71ad47c41146f2333270313cd23b9bd
1 #include <aros/bootloader.h>
2 #include <exec/execbase.h>
3 #include <exec/memory.h>
4 #include <proto/aros.h>
5 #include <proto/bootloader.h>
6 #include <proto/exec.h>
7 #include <proto/utility.h>
9 #include <stdio.h>
11 ULONG ExtUDivMod32(ULONG a, ULONG b, ULONG *mod)
13 *mod = a % b;
15 return a/b;
18 void PrintNum(ULONG num)
20 /* MBytes ? */
21 if(num > 1023)
23 ULONG x, xx;
24 char* fmt = "meg";
26 /* GBytes ? */
27 if(num > 0xfffff)
29 num >>= 10;
30 fmt = "gig";
33 num = ExtUDivMod32(UMult32(num, 100) >> 10, 100, &x);
35 /* round */
36 x = ExtUDivMod32(x, 10, &xx);
38 if(xx > 4)
40 if(++x > 9)
42 x = 0;
43 num++;
47 printf("%d.%d %s", num, x, fmt);
49 else
51 printf("%d K", num);
55 ULONG ComputeKBytes(APTR a, APTR b)
57 IPTR result = b - a;
59 return (ULONG)(result >> 10);
62 int __nocommandline;
63 char __stdiowin[]="CON://700//ShowConfig/AUTO/CLOSE/WAIT";
65 int main()
67 struct MemHeader *mh;
68 APTR BootLoaderBase;
69 STRPTR bootldr;
70 struct List *args;
71 struct Node *n;
73 printf("VERS:\tAROS version %d.%d, Exec version %d.%d\n", ArosBase->lib_Version, ArosBase->lib_Revision,
74 SysBase->LibNode.lib_Version, SysBase->LibNode.lib_Revision);
76 printf("RAM:");
77 for (mh = (struct MemHeader *)SysBase->MemList.lh_Head; mh->mh_Node.ln_Succ; mh = (struct MemHeader *)mh->mh_Node.ln_Succ) {
78 char *memtype = "ROM";
80 if (mh->mh_Attributes & MEMF_CHIP)
81 memtype = "CHIP";
82 if (mh->mh_Attributes & MEMF_FAST)
83 memtype = "FAST";
84 printf("\tNode Type 0x%X, Attributes 0x%X (%s), at %p-%p (", mh->mh_Node.ln_Type, mh->mh_Attributes, memtype, mh->mh_Lower, mh->mh_Upper);
85 PrintNum(ComputeKBytes(mh->mh_Lower, mh->mh_Upper));
86 printf(")\n");
89 BootLoaderBase = OpenResource("bootloader.resource");
90 if (BootLoaderBase) {
91 bootldr = GetBootInfo(BL_LoaderName);
93 if (bootldr)
94 printf("BOOTLDR:%s\n", bootldr);
96 args = GetBootInfo(BL_Args);
97 if (args) {
98 printf("ARGS:\t");
99 for (n = args->lh_Head; n->ln_Succ; n = n->ln_Succ) {
100 printf("%s ", n->ln_Name);
101 printf("\n");
105 return 0;