<commit_before>/* notes:
 *
 *     Ancient Pentium Pro 200MHZ system:
 *        - Real mode calling works perfectly.
 *        - Protected mode interface crashed until we increased the stack size during
 *          the call to 0x200 bytes (up from 0x100)
 *        - PnP structures reveal some mystery devices at I/O ports 0x78-0x7F and 0x80...
 *          what are they?
 *        - Another mystery device at 0x290-0x297, what is it?
 *        - BIOS settings allow you to specify a Plug & Play OS, and then, if Serial &
 *          Parallel ports are set to "Auto", the BIOS says it doesn't configure them and
 *          leaves it up to the OS to do it. Sure enough, according to the PnP info,
 *          the serial ports show up as being disabled (IO base 0 len 0) waiting to be
 *          set to one of the "possible resources" listed! Neat!
 */

#include <stdio.h>
#include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <ctype.h>
#include <fcntl.h>
#include <dos.h>

#include <hw/vga/vga.h>
#include <hw/dos/dos.h>
#include <hw/8254/8254.h>		/* 8254 timer */
#include <hw/vga/vgagui.h>
#include <hw/vga/vgatty.h>
#include <isapnp/isapnp.h>

static unsigned char far devnode_raw[4096];

int main(int argc,char **argv) {
	char tmp[129];
	int c,i;

	printf("ISA Plug & Play test program\n");

	if (!probe_vga()) {
		printf("Cannot init VGA\n");
		return 1;
	}
	if (!probe_8254()) {
		printf("Cannot init 8254 timer\n");
		return 1;
	}
	if (!init_isa_pnp_bios()) {
		printf("Cannot init ISA PnP\n");
		return 1;
	}
	if (!find_isa_pnp_bios()) {
		printf("ISA PnP BIOS not found\n");
		return 1;
	}

	printf("Your BIOS provides a ISA PnP structure\n");
	printf("   version=0x%02X length=0x%02X  control=0x%04X  event_notify_flag @ 0x%08lX\n",
		isa_pnp_info.version,		isa_pnp_info.length,
		isa_pnp_info.control,		(unsigned long)isa_pnp_info.event_notify_flag_addr);
	printf("   realmode entry: %04X:%04X pm entry: %08lX + %04X oem device id=0x%08lX\n",
		isa_pnp_info.rm_ent_segment,		isa_pnp_info.rm_ent_offset,
		isa_pnp_info.pm_ent_segment_base,	isa_pnp_info.pm_ent_offset,
		isa_pnp_info.oem_device_id);
	printf("   data segment: realmode: %04X  pm base: %08lX\n",
		isa_pnp_info.rm_ent_data_segment,
		(unsigned long)isa_pnp_info.pm_ent_data_segment_base);
	printf("WARNING: Part of the ISA PnP callback mechanism involves doing direct calls via\n");
	printf("         the entry pointers above. If your BIOS is badly written, this program\n");
	printf("         will crash when asked to do so.\n");
#if TARGET_MSDOS == 32
	printf("This program runs in protected mode, and will use the protected mode interface.\n");
	printf("If you would like to use the real-mode interface, hit 'R' (Shift+R) now.\n");
	printf("Or hit 'W' (Shift+W) to enable 'Windows 95' mode.\n");
#else
	printf("This program runs in real mode, and will use the real mode interface.\n");
#endif<commit_msg>isapnp test: show BIOS location<commit_after>/* notes:
 *
 *     Ancient Pentium Pro 200MHZ system:
 *        - Real mode calling works perfectly.
 *        - Protected mode interface crashed until we increased the stack size during
 *          the call to 0x200 bytes (up from 0x100)
 *        - PnP structures reveal some mystery devices at I/O ports 0x78-0x7F and 0x80...
 *          what are they?
 *        - Another mystery device at 0x290-0x297, what is it?
 *        - BIOS settings allow you to specify a Plug & Play OS, and then, if Serial &
 *          Parallel ports are set to "Auto", the BIOS says it doesn't configure them and
 *          leaves it up to the OS to do it. Sure enough, according to the PnP info,
 *          the serial ports show up as being disabled (IO base 0 len 0) waiting to be
 *          set to one of the "possible resources" listed! Neat!
 */

#include <stdio.h>
#include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <ctype.h>
#include <fcntl.h>
#include <dos.h>

#include <hw/vga/vga.h>
#include <hw/dos/dos.h>
#include <hw/8254/8254.h>		/* 8254 timer */
#include <hw/vga/vgagui.h>
#include <hw/vga/vgatty.h>
#include <isapnp/isapnp.h>

static unsigned char far devnode_raw[4096];

int main(int argc,char **argv) {
	char tmp[129];
	int c,i;

	printf("ISA Plug & Play test program\n");

	if (!probe_vga()) {
		printf("Cannot init VGA\n");
		return 1;
	}
	if (!probe_8254()) {
		printf("Cannot init 8254 timer\n");
		return 1;
	}
	if (!init_isa_pnp_bios()) {
		printf("Cannot init ISA PnP\n");
		return 1;
	}
	if (!find_isa_pnp_bios()) {
		printf("ISA PnP BIOS not found\n");
		return 1;
	}

	printf("Your BIOS provides a ISA PnP structure at F000:%04X\n",(unsigned int)isa_pnp_bios_offset);
	printf("   version=0x%02X length=0x%02X  control=0x%04X  event_notify_flag @ 0x%08lX\n",
		isa_pnp_info.version,		isa_pnp_info.length,
		isa_pnp_info.control,		(unsigned long)isa_pnp_info.event_notify_flag_addr);
	printf("   realmode entry: %04X:%04X pm entry: %08lX + %04X oem device id=0x%08lX\n",
		isa_pnp_info.rm_ent_segment,		isa_pnp_info.rm_ent_offset,
		isa_pnp_info.pm_ent_segment_base,	isa_pnp_info.pm_ent_offset,
		isa_pnp_info.oem_device_id);
	printf("   data segment: realmode: %04X  pm base: %08lX\n",
		isa_pnp_info.rm_ent_data_segment,
		(unsigned long)isa_pnp_info.pm_ent_data_segment_base);
	printf("WARNING: Part of the ISA PnP callback mechanism involves doing direct calls via\n");
	printf("         the entry pointers above. If your BIOS is badly written, this program\n");
	printf("         will crash when asked to do so.\n");
#if TARGET_MSDOS == 32
	printf("This program runs in protected mode, and will use the protected mode interface.\n");
	printf("If you would like to use the real-mode interface, hit 'R' (Shift+R) now.\n");
	printf("Or hit 'W' (Shift+W) to enable 'Windows 95' mode.\n");
#else
	printf("This program runs in real mode, and will use the real mode interface.\n");
#endif
{'fraction_non_alphanumeric': 0.11937345424567189, 'fraction_numerical': 0.030832646331409728, 'mean_word_length': 3.574660633484163, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2831816', 'n_tokens_mistral': 2383, 'n_tokens_neox': 2190, 'n_words': 700}