Esempio n. 1
0
static Bitu INT15_Handler(void)
	{
	static Bit16u biosConfigSeg = 0;
	switch (reg_ah)
		{
	case 0xC0:																		// Get Configuration
		{
		if (biosConfigSeg == 0)
			biosConfigSeg = DOS_GetPrivatMemory(1);									// We have 16 bytes
		PhysPt data	= SegOff2Ptr(biosConfigSeg, 0);
		Mem_Stosw(data, 8);															// 8 Bytes following
		Mem_Stosb(data+2, 0xFC);													// Model ID (PC)
		Mem_Stosb(data+3, 0x02);													// Submodel ID
		Mem_Stosb(data+4, 0x74);													// Bios Revision
		Mem_Stosb(data+5, 0x70);													// Feature Byte 1
		Mem_Stosw(data+6, 0);														// Feature Byte 2 + 3
		Mem_Stosw(data+8, 0);														// Feature Byte 4 + 5
		CPU_SetSegGeneral(es, biosConfigSeg);
		reg_bx = 0;
		reg_ah = 0;
		CALLBACK_SCF(false);
		}
		break;
	case 0x87:																		// Copy extended memory
		{
		Bitu   bytes	= reg_cx * 2;
		PhysPt data		= SegPhys(es)+reg_si;
		PhysPt source	= (Mem_Lodsd(data+0x12) & 0x00FFFFFF) + (Mem_Lodsb(data+0x16)<<24);
		PhysPt dest		= (Mem_Lodsd(data+0x1A) & 0x00FFFFFF) + (Mem_Lodsb(data+0x1E)<<24);
		Mem_rMovsb(dest, source, bytes);
		reg_ax = 0;
		CALLBACK_SCF(false);
		break;
		}
	case 0x88:																		// SYSTEM - Get extended memory size in KB (286+)
		reg_ax = TotEXTMB*1024;
		CALLBACK_SCF(false);
		break;
	default:
		LOG_MSG("Int 15 unhandled call %4X", reg_ax);
		reg_ah = 0x86;
		CALLBACK_SCF(true);
		}
	return CBRET_NONE;
	}
Esempio n. 2
0
Bit8u FCB_Parsename(Bit16u seg, Bit16u offset, Bit8u parser, char* string, Bit8u* change)
	{
	char* string_begin = string;
	Bit8u ret = 0;
	if (!(parser & PARSE_DFLT_DRIVE))												// Default drive forced, this intentionally invalidates an extended FCB
		vPC_rStosb(SegOff2Ptr(seg, offset), 0);
	DOS_FCB fcb(seg, offset, false);												// Always a non-extended FCB
	// First get the old data from the fcb
#pragma pack (1)
	union {
		struct {
			char drive[2];
			char name[9];
			char ext[4];
		} part;
		char full[DOS_FCBNAME];
	} fcb_name;
#pragma pack()
	fcb.GetName(fcb_name.full);														// Get the old information from the previous fcb
	fcb_name.part.drive[0] -= 'A'-1;
	fcb_name.part.drive[1] = 0;
	fcb_name.part.name[8] = 0;
	fcb_name.part.ext[3] = 0;
	if ((parser & PARSE_SEP_STOP) && *string)										// Ignore leading seperator
		if (strchr(":.;,=+", *string))
			string++;
	while ((*string == ' ') || (*string == '\t'))									// Strip leading spaces
		string++;
	bool hasdrive, hasname, hasext, finished;
	hasdrive = hasname = hasext = finished = false;
	if (string[1] == ':')															// Check for a drive
		{
		fcb_name.part.drive[0] = 0;
		hasdrive = true;
		if (isalpha(string[0]) && Drives[toupper(string[0])-'A'])
			fcb_name.part.drive[0] = (char)(toupper(string[0])-'A'+1);
		else
			ret = 0xff;
		string += 2;
		}
	if (string[0] == '.')															// Special checks for . and ..
		{
		string++;
		if (!string[0])
			{
			hasname = true;
			ret = PARSE_RET_NOWILD;
			strcpy(fcb_name.part.name, ".       ");
			goto savefcb;
			}
		if (string[1] == '.' && !string[1])
			{
			string++;
			hasname = true;
			ret = PARSE_RET_NOWILD;
			strcpy(fcb_name.part.name, "..      ");
			goto savefcb;
			}
		goto checkext;
		}
	hasname = true;																	// Copy the name
	finished = false;
	Bit8u fill = ' ';
	Bitu index = 0;
	while (index < 8)
		{
		if (!finished)
			{
			if (string[0] == '*')
				{
				fill = '?';
				fcb_name.part.name[index] = '?';
				if (!ret)
					ret = 1;
				finished = true;
				}
			else if (string[0] == '?')
				{
				fcb_name.part.name[index] = '?';
				if (!ret)
					ret = 1;
				}
			else if (isvalid(string[0]))
				fcb_name.part.name[index] = (char)(toupper(string[0]));
			else
				{
				finished = true;
				continue;
				}
			string++;
			}
		else
			fcb_name.part.name[index] = fill;
		index++;
		}
	if (!(string[0] == '.'))
		goto savefcb;
	string++;
checkext:
	hasext = true;																	// Copy the extension
	finished = false;
	fill = ' ';
	index = 0;
	while (index < 3)
		{
		if (!finished)
			{
			if (string[0] == '*')
				{
				fill = '?';
				fcb_name.part.ext[index] = '?';
				finished = true;
				}
			else if (string[0] == '?')
				{
				fcb_name.part.ext[index] = '?';
				if (!ret)
					ret = 1;
				}
			else if (isvalid(string[0]))
				fcb_name.part.ext[index] = (char)(toupper(string[0]));
			else
				{
				finished = true;
				continue;
				}
			string++;
			}
		else
			fcb_name.part.ext[index] = fill;
		index++;
		}
savefcb:
	if (!hasdrive & !(parser & PARSE_DFLT_DRIVE))
		fcb_name.part.drive[0] = 0;
	if (!hasname & !(parser & PARSE_BLNK_FNAME))
		strcpy(fcb_name.part.name, "        ");
	if (!hasext & !(parser & PARSE_BLNK_FEXT))
		strcpy(fcb_name.part.ext, "   ");
	fcb.SetName(fcb_name.part.drive[0], fcb_name.part.name, fcb_name.part.ext);
	*change = (Bit8u)(string-string_begin);
	return ret;
	}