3 * Test program: Make use of the MS-DOS "List of Lists" to print various things
4 * (C) 2011-2012 Jonathan Campbell.
5 * Hackipedia DOS library.
7 * This code is licensed under the LGPL.
8 * <insert LGPL legal text here>
11 /* FIXME: MS-DOS 6.22 under QEMU: This hangs, or causes QEMU to crash? */
21 #include <hw/cpu/cpu.h>
22 #include <hw/dos/dos.h>
23 #include <hw/dos/doswin.h>
24 #include <hw/dos/dosbox.h>
28 unsigned char FAR *LOL;
31 printf("DOS version %x.%02u\n",dos_version>>8,dos_version&0xFF);
32 if (detect_windows()) {
33 printf("I am running under Windows.\n");
34 printf(" Mode: %s\n",windows_mode_str(windows_mode));
35 printf(" Ver: %x.%02u\n",windows_version>>8,windows_version&0xFF);
36 printf(" Flavor: '%s'\n",dos_flavor_str(dos_flavor));
39 printf("Not running under Windows or OS/2\n");
42 if (detect_dosbox_emu())
43 printf("I am also running under DOSBox\n");
45 if ((LOL = dos_list_of_lists()) != NULL) {
46 printf("DOS List of Lists at ");
47 #if TARGET_MSDOS == 32
48 printf("0x%08lX\n",(unsigned long)LOL);
50 printf("%04x:%04x\n",FP_SEG(LOL),FP_OFF(LOL));
54 printf("Unable to locate the DOS 'list of lists'\n");
58 /* ENTER for next, ESC to stop */
59 while ((c=getch()) != 13) {
60 if (c == 27) return 0;
65 struct dos_psp_cooked pspnfo;
66 struct dos_mcb_enum men;
68 if (dos_mcb_first(&men)) {
69 printf("Resident MCBs\n"); line++;
71 mcb_filter_name(&men);
73 printf("[%04x]: %02x PSP=%04x size=%04x %-8s ",
74 men.cur_segment,men.type,men.psp,men.size,men.name);
75 for (i=0;i < 32;i++) {
77 if (c >= 32 && c <= 126) printf("%c",c);
82 if (men.psp >= 0x80 && men.psp < 0xFFFFU && dos_parse_psp(men.psp,&pspnfo)) {
83 printf(" PSP memsize=%04xh callpsp=%04xh env=%04xh command='%s'\n",
84 pspnfo.memsize,pspnfo.callpsp,pspnfo.env,pspnfo.cmd);
89 /* ENTER for next, ESC to stop */
90 while ((c=getch()) != 13) {
91 if (c == 27) return 0;
99 /* ENTER for next, ESC to stop */
100 while ((c=getch()) != 13) {
101 if (c == 27) return 0;
104 } while (dos_mcb_next(&men));
106 /* ENTER for next, ESC to stop */
107 while ((c=getch()) != 13) {
108 if (c == 27) return 0;
115 struct dos_device_enum denu;
117 if (dos_device_first(&denu)) {
118 printf("Device drivers\n"); line++;
120 printf(" ATTR=%04Xh entry=%04Xh int=%04Xh %s\n",denu.attr,denu.entry,denu.intent,denu.name);
125 /* ENTER for next, ESC to stop */
126 while ((c=getch()) != 13) {
127 if (c == 27) return 0;
130 } while (dos_device_next(&denu));
132 /* ENTER for next, ESC to stop */
133 while ((c=getch()) != 13) {
134 if (c == 27) return 0;