コード例 #1
0
ファイル: bios.c プロジェクト: jonathanopalise/hatari
/**
 * Check Bios call and see if we need to re-direct to our own routines.
 * Return true if we've handled the exception, else return false to let
 * TOS attempt it
 */
bool Bios(void)
{
	Uint32 Params;
	Uint16 BiosCall;

	/* Get call */
	Params = Regs[REG_A7];
	BiosCall = STMemory_ReadWord(Params);
	Params += SIZE_WORD;

	/* Intercept? */
	switch(BiosCall)
	{
	case 0x0:
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x00 Getmpb(0x%X)\n",
			  STMemory_ReadLong(Params));
		break;

	case 0x3:
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x03 Bconout(%i, 0x%02hhX)\n",
			  STMemory_ReadWord(Params),
			  STMemory_ReadWord(Params)+SIZE_WORD);
		break;

	case 0x4:
		Bios_RWabs(Params);
		break;

	case 0x5:
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x05 Setexc(0x%hX, 0x%X)\n",
			  STMemory_ReadWord(Params),
			  STMemory_ReadLong(Params)+SIZE_WORD);
		break;

	case 0x1:
	case 0x2:
	case 0x7:
	case 0x8:
	case 0x9:
	case 0xB:
		/* commands taking a single word */
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x%02hX %s(0x%hX)\n",
			  BiosCall, Bios_Call2Name(BiosCall),
			  STMemory_ReadWord(Params));
		break;

	case 0x6:
	case 0xA:
		/* commands taking no args */
		LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x%02hX %s()\n",
			  BiosCall, Bios_Call2Name(BiosCall));
		break;

	default:
		Log_Printf(LOG_WARN, "Unknown BIOS call 0x%x!\n", BiosCall);
		break;
	}
	return false;
}
コード例 #2
0
ファイル: bios.c プロジェクト: hskinnemoen/hatari
/**
 * BIOS Write character to device
 * Call 3
 */
static bool Bios_Bconout(Uint32 Params)
{
	Uint16 Dev;
	unsigned char Char;

	Dev = STMemory_ReadWord(Params+SIZE_WORD);
	Char = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD);

	HATARI_TRACE(HATARI_TRACE_OS_BIOS, "BIOS Bconout(%i, 0x%02x)\n", Dev, Char);

	return FALSE;
}
コード例 #3
0
ファイル: bios.c プロジェクト: jonathanopalise/hatari
/**
 * BIOS Read/Write disk sector
 * Call 4
 */
static void Bios_RWabs(Uint32 Params)
{
	Uint32 pBuffer;
	Uint16 RWFlag, Number, RecNo, Dev;

	/* Read details from stack */
	RWFlag = STMemory_ReadWord(Params);
	pBuffer = STMemory_ReadLong(Params+SIZE_WORD);
	Number = STMemory_ReadWord(Params+SIZE_WORD+SIZE_LONG);
	RecNo = STMemory_ReadWord(Params+SIZE_WORD+SIZE_LONG+SIZE_WORD);
	Dev = STMemory_ReadWord(Params+SIZE_WORD+SIZE_LONG+SIZE_WORD+SIZE_WORD);

	LOG_TRACE(TRACE_OS_BIOS, "BIOS 0x04 Rwabs(%d,0x%lX,%d,%d,%i)\n",
	          RWFlag, STRAM_ADDR(pBuffer), Number, RecNo, Dev);
}
コード例 #4
0
ファイル: xbios.c プロジェクト: diablodiab/hatari
/**
 * XBIOS Devconnect
 * Call 139
 */
static bool XBios_Devconnect(Uint32 Params)
{
	Uint16 src,dst,clk,prescale,protocol;

	/* Read details from stack */
	src = STMemory_ReadWord(Params);
	dst = STMemory_ReadWord(Params+SIZE_WORD);
	clk = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD);
	prescale = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_WORD);
	protocol = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_WORD+SIZE_WORD);

	LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x8B Devconnect(%hd, 0x%hx, %hd, %hd, %hd) at PC 0x%X\n",
		  src, dst, clk, prescale, protocol ,
		  M68000_GetPC() );
	return false;
}
コード例 #5
0
ファイル: bios.c プロジェクト: hskinnemoen/hatari
/**
 * Check Bios call and see if we need to re-direct to our own routines
 * Return TRUE if we've handled the exception, else return FALSE to let TOS attempt it
 */
bool Bios(void)
{
	Uint32 Params;
	Uint16 BiosCall;

	/* Get call */
	Params = Regs[REG_A7];
	BiosCall = STMemory_ReadWord(Params);

	/* Intercept? */
	switch(BiosCall)
	{
	 case 0x1:
		return Bios_Bconstat(Params);
	 case 0x2:
		return Bios_Bconin(Params);
	 case 0x3:
		return Bios_Bconout(Params);
	 case 0x4:
		return Bios_RWabs(Params);
	 case 0x8:
		return Bios_Bcostat(Params);
	 default:           /* Call as normal! */
		HATARI_TRACE ( HATARI_TRACE_OS_BIOS, "BIOS %d\n", BiosCall );
		return FALSE;
	}
}
コード例 #6
0
ファイル: bios.c プロジェクト: hskinnemoen/hatari
/**
 * BIOS Read/Write disk sector
 * Call 4
 */
static bool Bios_RWabs(Uint32 Params)
{
	Uint32 pBuffer;
	Uint16 RWFlag, Number, RecNo, Dev;

	/* Read details from stack */
	RWFlag = STMemory_ReadWord(Params+SIZE_WORD);
	pBuffer = STMemory_ReadLong(Params+SIZE_WORD+SIZE_WORD);
	Number = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_LONG);
	RecNo = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_LONG+SIZE_WORD);
	Dev = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_LONG+SIZE_WORD+SIZE_WORD);

	HATARI_TRACE(HATARI_TRACE_OS_BIOS, "BIOS RWabs %i,%d,0x%lX,%d,%d\n",
			Dev, RWFlag, STRAM_ADDR(pBuffer), RecNo, Number);

	return FALSE;
}
コード例 #7
0
ファイル: vdi.c プロジェクト: jonathanopalise/hatari
/**
 * If opcodes argument is set, show AES opcode/function name table,
 * otherwise AES vectors information.
 */
void AES_Info(Uint32 bShowOpcodes)
{
	Uint16 opcode;
	
	if (bShowOpcodes)
	{
		for (opcode = 10; opcode < 0x86; opcode++)
		{
			fprintf(stderr, "%02x %-16s", opcode, AES_Opcode2Name(opcode));
			if ((opcode-9) % 4 == 0) fputs("\n", stderr);
		}
		return;
	}
	if (!bVdiAesIntercept)
	{
		fputs("VDI/AES interception isn't enabled!\n", stderr);
		return;
	}
	if (!AESControl)
	{
		fputs("No traced AES calls!\n", stderr);
		return;
	}
	opcode = STMemory_ReadWord(AESControl);
	if (opcode != AESOpCode)
	{
		fputs("AES parameter block contents changed since last call!\n", stderr);
		return;
	}

	fputs("Latest AES Parameter block:\n", stderr);
	fprintf(stderr, "- Opcode: %3hd (%s)\n",
		opcode, AES_Opcode2Name(opcode));

	fprintf(stderr, "- Control: %#8x\n", AESControl);
	fprintf(stderr, "- Global:  %#8x, %d bytes\n",
		AESGlobal, 2+2+2+4+4+4+4+4+4);
	fprintf(stderr, "- Intin:   %#8x, %d bytes\n",
		AESIntin, STMemory_ReadWord(AESControl+2*1));
	fprintf(stderr, "- Intout:  %#8x, %d bytes\n",
		AESIntout, STMemory_ReadWord(AESControl+2*2));
	fprintf(stderr, "- Addrin:  %#8x, %d longs\n",
		AESAddrin, STMemory_ReadWord(AESControl+2*3));
	fprintf(stderr, "- Addrout: %#8x, %d longs\n",
		AESAddrout, STMemory_ReadWord(AESControl+2*4));
}
コード例 #8
0
ファイル: xbios.c プロジェクト: diablodiab/hatari
/**
 * XBIOS Floppy Write
 * Call 9
 */
static bool XBios_Flopwr(Uint32 Params)
{
	Uint32 pBuffer;
	Uint16 Dev,Sector,Side,Track,Count;

	/* Read details from stack */
	pBuffer = STMemory_ReadLong(Params);
	Dev = STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG); /* skip reserved long */
	Sector = STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG+SIZE_WORD);
	Track = STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG+SIZE_WORD+SIZE_WORD);
	Side = STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG+SIZE_WORD+SIZE_WORD+SIZE_WORD);
	Count = STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG+SIZE_WORD+SIZE_WORD+SIZE_WORD+SIZE_WORD);

	LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x09 Flopwr(0x%x, %d, %d, %d, %d, %d) at PC 0x%X for: %s\n",
		  pBuffer, Dev, Sector, Track, Side, Count,
		  M68000_GetPC(), EmulationDrives[Dev].sFileName);
	return false;
}
コード例 #9
0
ファイル: bios.c プロジェクト: hskinnemoen/hatari
/**
 * BIOS Read character from device
 * Call 2
 */
static bool Bios_Bconin(Uint32 Params)
{
	Uint16 Dev;

	Dev = STMemory_ReadWord(Params+SIZE_WORD);

	HATARI_TRACE(HATARI_TRACE_OS_BIOS, "BIOS Bconin(%i)\n", Dev);

	return FALSE;
}
コード例 #10
0
ファイル: vdi.c プロジェクト: jonathanopalise/hatari
/**
 * If opcodes argument is set, show VDI opcode/function name table,
 * otherwise VDI vectors information.
 */
void VDI_Info(Uint32 bShowOpcodes)
{
	Uint16 opcode, subcode;

	if (bShowOpcodes)
	{
		Uint16 opcode;
		for (opcode = 0; opcode < 0x84; )
		{
			if (opcode == 0x28)
			{
				fputs("--- GDOS calls? ---\n", stderr);
				opcode = 0x64;
			}
			fprintf(stderr, "%02x %-16s",
				opcode, VDI_Opcode2Name(opcode, 0));
			if (++opcode % 4 == 0) fputs("\n", stderr);
		}
		return;
	}
	if (!bVdiAesIntercept)
	{
		fputs("VDI/AES interception isn't enabled!\n", stderr);
		return;
	}
	if (!VDIControl)
	{
		fputs("No traced VDI calls!\n", stderr);
		return;
	}
	opcode = STMemory_ReadWord(VDIControl);
	if (opcode != VDIOpCode)
	{
		fputs("VDI parameter block contents changed since last call!\n", stderr);
		return;
	}

	fputs("Latest VDI Parameter block:\n", stderr);
	subcode = STMemory_ReadWord(VDIControl+2*5);
	fprintf(stderr, "- Opcode/Subcode: %hd/%hd (%s)\n",
		opcode, subcode, VDI_Opcode2Name(opcode, subcode));
	fprintf(stderr, "- Device handle: %d\n",
		STMemory_ReadWord(VDIControl+2*6));
	fprintf(stderr, "- Control: %#8x\n", VDIControl);
	fprintf(stderr, "- Ptsin:   %#8x, %d co-ordinate word pairs\n",
		VDIPtsin, STMemory_ReadWord(VDIControl+2*1));
	fprintf(stderr, "- Ptsout:  %#8x, %d co-ordinate word pairs\n",
		VDIPtsout, STMemory_ReadWord(VDIControl+2*2));
	fprintf(stderr, "- Intin:   %#8x, %d words\n",
		VDIIntin, STMemory_ReadWord(VDIControl+2*3));
	fprintf(stderr, "- Intout:  %#8x, %d words\n",
		VDIIntout, STMemory_ReadWord(VDIControl+2*4));
}
コード例 #11
0
/**
 * DebugInfo_CurrentBasepage: get and validate currently running program basepage.
 * if given sysbase is zero, use system sysbase.
 */
static Uint32 DebugInfo_CurrentBasepage(Uint32 sysbase)
{
	Uint32 basepage;
	Uint16 osversion, osconf;

	if (!sysbase) {
		Uint32 rombase;
		sysbase = DebugInfo_GetSysbase(&rombase);
		if (!sysbase) {
			return 0;
		}
	}
	osversion = STMemory_ReadWord(sysbase+0x02);
	if (osversion >= 0x0102) {
		basepage = STMemory_ReadLong(sysbase+0x28);
	} else {
		osconf = STMemory_ReadWord(sysbase+0x1C);
		if((osconf>>1) == COUNTRY_SPAIN) {
			basepage = 0x873C;
		} else {
			basepage = 0x602C;
		}
	}
コード例 #12
0
ファイル: vdi.c プロジェクト: jonathanopalise/hatari
/**
 * This is called on completion of a VDI Trap workstation open,
 * to modify the return structure for extended resolutions.
 */
void VDI_Complete(void)
{
	/* right opcode? */
	assert(VDI_isWorkstationOpen(VDIOpCode));
	/* not changed between entry and completion? */
	assert(VDIOpCode == STMemory_ReadWord(VDIControl));

	STMemory_WriteWord(VDIIntout, VDIWidth-1);           /* IntOut[0] Width-1 */
	STMemory_WriteWord(VDIIntout+1*2, VDIHeight-1);      /* IntOut[1] Height-1 */
	STMemory_WriteWord(VDIIntout+13*2, VDIColors);       /* IntOut[13] #colors */
	STMemory_WriteWord(VDIIntout+39*2, 512);             /* IntOut[39] #available colors */

	STMemory_WriteWord(LineABase-0x15a*2, VDIWidth-1);   /* WKXRez */
	STMemory_WriteWord(LineABase-0x159*2, VDIHeight-1);  /* WKYRez */

	VDI_LineA(LineABase, FontBase);  /* And modify Line-A structure accordingly */
}
コード例 #13
0
ファイル: vdi.c プロジェクト: libretro/hatari
/**
 * Modify Line-A structure for our VDI resolutions
 */
void VDI_LineA(Uint32 linea, Uint32 fontbase)
{
	if (bUseVDIRes)
	{
		int cel_ht = STMemory_ReadWord(linea-46);             /* v_cel_ht */
		STMemory_WriteWord(linea-44, (VDIWidth/8)-1);         /* v_cel_mx (cols-1) */
		STMemory_WriteWord(linea-42, (VDIHeight/cel_ht)-1);   /* v_cel_my (rows-1) */
		STMemory_WriteWord(linea-40, cel_ht*((VDIWidth*VDIPlanes)/8));  /* v_cel_wr */

		STMemory_WriteWord(linea-12, VDIWidth);               /* v_rez_hz */
		STMemory_WriteWord(linea-4, VDIHeight);               /* v_rez_vt */
		STMemory_WriteWord(linea-2, (VDIWidth*VDIPlanes)/8);  /* bytes_lin */
		STMemory_WriteWord(linea+0, VDIPlanes);               /* planes */
		STMemory_WriteWord(linea+2, (VDIWidth*VDIPlanes)/8);  /* width */
	}
	LineABase = linea;
	FontBase = fontbase;
}
コード例 #14
0
ファイル: xbios.c プロジェクト: diablodiab/hatari
/**
 * XBIOS RsConf
 * Call 15
 */
static bool XBios_Rsconf(Uint32 Params)
{
	Sint16 Baud,Ctrl,Ucr;
#if ENABLE_TRACING
	Sint16 Rsr,Tsr,Scr;
#endif

	Baud = STMemory_ReadWord(Params);
	Ctrl = STMemory_ReadWord(Params+SIZE_WORD);
	Ucr = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD);
#if ENABLE_TRACING
	Rsr = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_WORD);
	Tsr = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_WORD+SIZE_WORD);
	Scr = STMemory_ReadWord(Params+SIZE_WORD+SIZE_WORD+SIZE_WORD+SIZE_WORD+SIZE_WORD);
	LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x0F Rsconf(%d, %d, %d, %d, %d, %d) at PC 0x%X\n",
		   Baud, Ctrl, Ucr, Rsr, Tsr, Scr,
		   M68000_GetPC());
#endif
	if (!bXBiosCommands)
		return false;
	
	if (!ConfigureParams.RS232.bEnableRS232)
		return false;

	/* Set baud rate and other configuration, if RS232 emaulation is enabled */
	if (Baud >= 0 && Baud < ARRAYSIZE(BaudRates))
	{
		/* Convert ST baud rate index to value */
		int BaudRate = BaudRates[Baud];
		/* And set new baud rate: */
		RS232_SetBaudRate(BaudRate);
	}

	if (Ucr != -1)
	{
		RS232_HandleUCR(Ucr);
	}

	if (Ctrl != -1)
	{
		RS232_SetFlowControl(Ctrl);
	}

	return true;
}
コード例 #15
0
/* helper to get instruction type */
Uint32 DebugCpu_OpcodeType(void)
{
	/* cannot use OpcodeFamily like profiler does,
	 * as that's for previous instructions
	 */
	Uint16 opcode = STMemory_ReadWord(M68000_GetPC());

	if (opcode == 0x4e74 ||			/* RTD */
	    opcode == 0x4e75 ||			/* RTS */
	    opcode == 0x4e77)			/* RTR */
		return CALL_SUBRETURN;

	if (opcode == 0x4e73)			/* RTE */
		return CALL_EXCRETURN;

	/* NOTE: BSR needs to be matched before BRA/BCC! */
	if ((opcode & 0xff00) == 0x6100 ||	/* BSR */
	    (opcode & 0xffc0) == 0x4e80)	/* JSR */
		return CALL_SUBROUTINE;

	/* TODO: ftrapcc, chk2? */
	if (opcode == 0x4e72 ||			/* STOP */
	    opcode == 0x4afc ||			/* ILLEGAL */
	    opcode == 0x4e76 ||			/* TRAPV */
	    (opcode & 0xfff0) == 0x4e40 ||	/* TRAP */
	    (opcode & 0xf1c0) == 0x4180 ||	/* CHK */
	    (opcode & 0xfff8) == 0x4848)	/* BKPT */
		return CALL_EXCEPTION;

	/* TODO: fbcc, fdbcc */
	if ((opcode & 0xf000) == 0x6000 ||	/* BRA / BCC */
	    (opcode & 0xffc0) == 0x4ec0 ||	/* JMP */
	    (opcode & 0xf0f8) == 0x50c8)	/* DBCC */
		return CALL_BRANCH;

	return CALL_UNKNOWN;
}
コード例 #16
0
ファイル: xbios.c プロジェクト: diablodiab/hatari
/**
 * Check if we need to re-direct XBios call to our own routines
 */
bool XBios(void)
{
	Uint32 Params;
	Uint16 XBiosCall;

	/* Find call */
	Params = Regs[REG_A7];
	XBiosCall = STMemory_ReadWord(Params);
	Params += SIZE_WORD;

	switch (XBiosCall)
	{
		/* commands with special handling */
	case 8:
		return XBios_Floprd(Params);
	case 9:
		return XBios_Flopwr(Params);
	case 15:
		return XBios_Rsconf(Params);
	case 20:
		return XBios_Scrdmp(Params);
	case 139:
		return XBios_Devconnect(Params);
	case HATARI_CONTROL_OPCODE:
		return XBios_HatariControl(Params);

	case 2:		/* Physbase */
	case 3:		/* Logbase */
	case 4:		/* Getrez */
	case 17:	/* Random */
	case 23:	/* Gettime */
	case 24:	/* Bioskeys */
	case 34:	/* Kbdvbase */
	case 37:	/* Vsync */
	case 39:	/* Puntaes */
	case 81:	/* EgetShift */
	case 89:	/* VgetMonitor */
	case 103:	/* Dsp_GetWordSize */
	case 104:	/* Dsp_Lock */
	case 105:	/* Dsp_Unlock */
	case 113:	/* Dsp_RequestUniqueAbility */
	case 114:	/* Dsp_GetProgAbility */
	case 115:	/* Dsp_FlushSubroutines */
	case 121:	/* Dsp_Hf2 */
	case 122:	/* Dsp_Hf3 */
	case 125:	/* Dsp_Hstat */
	case 128:	/* Locksnd */
	case 129:	/* Unlocksnd */
		/* commands with no args */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s() at PC 0x%X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  M68000_GetPC());
		return false;
		
	case 1:		/* Ssbrk */
	case 14:	/* Iorec */
	case 26:	/* Jdisint */
	case 27:	/* Jenabint */
	case 29:	/* Offgibit */
	case 30:	/* Ongibit */
	case 33:	/* Setprt */
	case 44:	/* Bconmap */
	case 64:	/* Blitmode */
	case 80:	/* EsetShift */
	case 82:	/* EsetBank */
	case 86:	/* EsetGray */
	case 87:	/* EsetSmear */
	case 88:	/* VsetMode */
	case 90:	/* VsetSync */
	case 91:	/* VgetSize */
	case 102:	/* Dsp_RemoveInterrupts */
	case 112:	/* Dsp_TriggerHC */
	case 117:	/* Dsp_InqSubrAbility */
	case 118:	/* Dsp_RunSubroutine */
	case 119:	/* Dsp_Hf0 */
	case 120:	/* Dsp_Hf1 */
	case 132:	/* Setmode */
	case 134:	/* Setmontracks */
	case 136:	/* Buffoper */
	case 140:	/* Sndstatus */
		/* ones taking single word */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s(0x%hX) at PC 0x%X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  STMemory_ReadWord(Params),
			  M68000_GetPC());
		return false;

	case 6:		/* Setpalette */
	case 22:	/* Settime */
	case 32:	/* Dosound */
	case 36:	/* Ptrblt */
	case 38:	/* Supexec */
	case 48:	/* Metainit */
	case 141:	/* Buffptr */
		/* ones taking long or pointer */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s(0x%X) at PC 0x%X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  STMemory_ReadLong(Params),
			  M68000_GetPC());
		return false;

	case 7:		/* Setcolor */
	case 21:	/* Cursconf */
	case 28:	/* Giaccess */
	case 35:	/* Kbrate */
	case 41:	/* Floprate */
	case 83:	/* EsetColor */
	case 130:	/* Soundcmd */
	case 133:	/* Settracks */
	case 137:	/* Dsptristate */
	case 135:	/* Setinterrupt */
	case 138:	/* Gpio */
		/* ones taking two words */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s(0x%hX, 0x%hX) at PC 0x%X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  STMemory_ReadWord(Params),
			  STMemory_ReadWord(Params+SIZE_WORD),
			  M68000_GetPC());
		return false;

	case 12:	/* Midiws */
	case 13:	/* Mfpint */
	case 25:	/* Ikbdws */
		/* ones taking word length/index and pointer */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s(%hd, 0x%X) at PC 0x %X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  STMemory_ReadWord(Params),
			  STMemory_ReadLong(Params+SIZE_WORD),
			  M68000_GetPC());
		return false;

	case 11:	/* Dbmsg */
	case 84:	/* EsetPalette */
	case 85:	/* EgetPalette */
	case 93:	/* VsetRGB */
	case 94:	/* VgetRGB */
		/* ones taking word, word and long/pointer */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s(0x%hX, 0x%hX, 0x%X) at PC 0x%X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  STMemory_ReadWord(Params),
			  STMemory_ReadWord(Params+SIZE_WORD),
			  STMemory_ReadLong(Params+SIZE_WORD+SIZE_WORD),
			  M68000_GetPC());
		return false;

	case 106:	/* Dsp_Available */
	case 107:	/* Dsp_Reserve */
	case 111:	/* Dsp_LodToBinary */
	case 126:	/* Dsp_SetVectors */
		/* ones taking two longs/pointers */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s(0x%X, 0x%X) at PC 0x%X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  STMemory_ReadLong(Params),
			  STMemory_ReadLong(Params+SIZE_LONG),
			  M68000_GetPC());
		return false;

	case 5:		/* Setscreen */
		if (STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG) == 3) {
			/* actually VSetscreen with extra parameter */
			LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX VsetScreen(0x%X, 0x%X, 3, 0x%hX) at PC 0x%X\n",
				  XBiosCall, STMemory_ReadLong(Params),
				  STMemory_ReadLong(Params+SIZE_LONG),
				  STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG+SIZE_WORD),
				  M68000_GetPC());
			return false;			
		}
	case 109:	/* Dsp_ExecProg */
	case 110:	/* Dsp_ExecBoot */
	case 116:	/* Dsp_LoadSubroutine */
	case 150:	/* VsetMask */
		/* ones taking two longs/pointers and a word */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX %s(0x%X, 0x%X, 0x%hX) at PC 0x%X\n",
			  XBiosCall, XBios_Call2Name(XBiosCall),
			  STMemory_ReadLong(Params),
			  STMemory_ReadLong(Params+SIZE_LONG),
			  STMemory_ReadWord(Params+SIZE_LONG+SIZE_LONG),
			  M68000_GetPC());
		return false;

	default:  /* rest of XBios calls */
		LOG_TRACE(TRACE_OS_XBIOS, "XBIOS 0x%02hX (%s)\n",
			  XBiosCall, XBios_Call2Name(XBiosCall));
		return false;
	}
}
コード例 #17
0
ファイル: vdi.c プロジェクト: jonathanopalise/hatari
/**
 * Check whether this is VDI/AES call and see if we need to re-direct
 * it to our own routines. Return true if VDI_Complete() function
 * needs to be called on OS call exit, otherwise return false.
 *
 * We enter here with Trap #2, so D0 tells which OS call it is (VDI/AES)
 * and D1 is pointer to VDI/AES vectors, i.e. Control, Intin, Ptsin etc...
 */
bool VDI_AES_Entry(void)
{
	Uint16 call = Regs[REG_D0];
	Uint32 TablePtr = Regs[REG_D1];

#if ENABLE_TRACING
	/* AES call? */
	if (call == 0xC8)
	{
		if (!STMemory_ValidArea(TablePtr, 24))
		{
			Log_Printf(LOG_WARN, "AES call failed due to invalid parameter block address 0x%x+%i\n", TablePtr, 24);
			return false;
		}
		/* store values for debugger "info aes" command */
		AESControl = STMemory_ReadLong(TablePtr);
		AESGlobal  = STMemory_ReadLong(TablePtr+4);
		AESIntin   = STMemory_ReadLong(TablePtr+8);
		AESIntout  = STMemory_ReadLong(TablePtr+12);
		AESAddrin  = STMemory_ReadLong(TablePtr+16);
		AESAddrout = STMemory_ReadLong(TablePtr+20);
		AESOpCode  = STMemory_ReadWord(AESControl);
		LOG_TRACE(TRACE_OS_AES, "AES call %3hd (%s)\n",
			  AESOpCode, AES_Opcode2Name(AESOpCode));

		/* using same special opcode trick doesn't work for
		 * both VDI & AES as AES functions can be called
		 * recursively and VDI calls happen inside AES calls.
		 */
		return false;
	}
#endif

	/* VDI call? */
	if (call == 0x73)
	{
		if (!STMemory_ValidArea(TablePtr, 20))
		{
			Log_Printf(LOG_WARN, "VDI call failed due to invalid parameter block address 0x%x+%i\n", TablePtr, 20);
			return false;
		}
		/* store values for extended VDI resolution handling
		 * and debugger "info vdi" command
		 */
		VDIControl = STMemory_ReadLong(TablePtr);
		VDIIntin   = STMemory_ReadLong(TablePtr+4);
		VDIPtsin   = STMemory_ReadLong(TablePtr+8);
		VDIIntout  = STMemory_ReadLong(TablePtr+12);
		VDIPtsout  = STMemory_ReadLong(TablePtr+16);
		VDIOpCode  = STMemory_ReadWord(VDIControl);
#if ENABLE_TRACING
		{
		Uint16 subcode = STMemory_ReadWord(VDIControl+2*5);
		LOG_TRACE(TRACE_OS_VDI, "VDI call %3hd/%3hd (%s)\n",
			  VDIOpCode, subcode,
			  VDI_Opcode2Name(VDIOpCode, subcode));
		}
#endif
		/* Only workstation open needs to be handled at trap return */
		return bUseVDIRes && VDI_isWorkstationOpen(VDIOpCode);
	}

	LOG_TRACE((TRACE_OS_VDI|TRACE_OS_AES), "Trap #2 with D0 = 0x%hX\n", call);
	return false;
}
コード例 #18
0
ファイル: vdi.c プロジェクト: libretro/hatari
/**
 * Output AES call info, including some of args
 */
static void AES_OpcodeInfo(FILE *fp, Uint16 opcode)
{
	int code = opcode - 10;
	fprintf(fp, "AES call %3hd ", opcode);
	if (code >= 0 && code < ARRAYSIZE(AESName_10) && AESName_10[code])
	{
		bool first = true;
		int i, items;

		fprintf(fp, "%s(", AESName_10[code]);

		items = 0;
		/* there are so few of these that linear search is fine */
		for (i = 0; i < ARRAYSIZE(AESStrings); i++)
		{
			/* something that can be shown? */
			if (AESStrings[i].code == opcode)
			{
				items = AESStrings[i].count;
				break;
			}
		}
		/* addrin array size in longs enough for items? */
		if (items > 0 && items <= STMemory_ReadWord(AESControl+SIZE_WORD*3))
		{
			const char *str;
			fputs("addrin: ", fp);
			for (i = 0; i < items; i++)
			{
				if (first)
					first = false;
				else
					fputs(", ", fp);
				str = (const char *)STRAM_ADDR(STMemory_ReadLong(AESAddrin+SIZE_LONG*i));
				fprintf(fp, "\"%s\"", str);
			}
		}
		/* intin array size in words */
		items = STMemory_ReadWord(AESControl+SIZE_WORD*1);
		if (items > 0)
		{
			if (!first)
			{
				fputs(", ", fp);
				first = true;
			}
			fputs("intin: ", fp);
			for (i = 0; i < items; i++)
			{
				if (first)
					first = false;
				else
					fputs(",", fp);
				fprintf(fp, "0x%x", STMemory_ReadWord(AESIntin+SIZE_WORD*i));
			}
		}
		fputs(")\n", fp);
	}
	else
		fputs("???\n", fp);
	fflush(fp);
}