⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsp1.cpp

📁 SFC游戏模拟器 snes9x 1.43 的原代码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
						DSPOp0C ();												DSP1.out_count = 4;						DSP1.output [0] = (uint8) (Op0CX2&0xFF);						DSP1.output [1] = (uint8) ((Op0CX2>>8)&0xFF);						DSP1.output [2] = (uint8) (Op0CY2&0xFF);						DSP1.output [3] = (uint8) ((Op0CY2>>8)&0xFF);						break;											case 0x3c:					case 0x1c:	// Polar (3D rotate)						Op1CZ = (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						//MK: reversed X and Y on neviksti and John's advice.						Op1CY = (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op1CX = (DSP1.parameters [4]|(DSP1.parameters[5]<<8));						Op1CXBR = (DSP1.parameters [6]|(DSP1.parameters[7]<<8));						Op1CYBR = (DSP1.parameters [8]|(DSP1.parameters[9]<<8));						Op1CZBR = (DSP1.parameters [10]|(DSP1.parameters[11]<<8));												DSPOp1C ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op1CXAR&0xFF);						DSP1.output [1] = (uint8) ((Op1CXAR>>8)&0xFF);						DSP1.output [2] = (uint8) (Op1CYAR&0xFF);						DSP1.output [3] = (uint8) ((Op1CYAR>>8)&0xFF);						DSP1.output [4] = (uint8) (Op1CZAR&0xFF);						DSP1.output [5] = (uint8) ((Op1CZAR>>8)&0xFF);						break;											case 0x32:					case 0x22:					case 0x12:					case 0x02:	// Parameter (Projection)						Op02FX = (short)(DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op02FY = (short)(DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op02FZ = (short)(DSP1.parameters [4]|(DSP1.parameters[5]<<8));						Op02LFE = (short)(DSP1.parameters [6]|(DSP1.parameters[7]<<8));						Op02LES = (short)(DSP1.parameters [8]|(DSP1.parameters[9]<<8));						Op02AAS = (unsigned short)(DSP1.parameters [10]|(DSP1.parameters[11]<<8));						Op02AZS = (unsigned short)(DSP1.parameters [12]|(DSP1.parameters[13]<<8));												DSPOp02 ();												DSP1.out_count = 8;						DSP1.output [0] = (uint8) (Op02VOF&0xFF);						DSP1.output [1] = (uint8) ((Op02VOF>>8)&0xFF);						DSP1.output [2] = (uint8) (Op02VVA&0xFF);						DSP1.output [3] = (uint8) ((Op02VVA>>8)&0xFF);						DSP1.output [4] = (uint8) (Op02CX&0xFF);						DSP1.output [5] = (uint8) ((Op02CX>>8)&0xFF);						DSP1.output [6] = (uint8) (Op02CY&0xFF);						DSP1.output [7] = (uint8) ((Op02CY>>8)&0xFF);						break;											case 0x3a:  //1a Mirror					case 0x2a:  //1a Mirror					case 0x1a:	// Raster mode 7 matrix data					case 0x0a:						Op0AVS = (short)(DSP1.parameters [0]|(DSP1.parameters[1]<<8));												DSPOp0A ();												DSP1.out_count = 8;						DSP1.output [0] = (uint8) (Op0AA&0xFF);						DSP1.output [2] = (uint8) (Op0AB&0xFF);						DSP1.output [4] = (uint8) (Op0AC&0xFF);						DSP1.output [6] = (uint8) (Op0AD&0xFF);						DSP1.output [1] = (uint8) ((Op0AA>>8)&0xFF);						DSP1.output [3] = (uint8) ((Op0AB>>8)&0xFF);						DSP1.output [5] = (uint8) ((Op0AC>>8)&0xFF);						DSP1.output [7] = (uint8) ((Op0AD>>8)&0xFF);						DSP1.in_index=0;						break;											case 0x16:					case 0x26:					case 0x36:					case 0x06:	// Project object						Op06X = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op06Y = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op06Z = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp06 ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op06H&0xff);						DSP1.output [1] = (uint8) ((Op06H>>8)&0xFF);						DSP1.output [2] = (uint8) (Op06V&0xFF);						DSP1.output [3] = (uint8) ((Op06V>>8)&0xFF);						DSP1.output [4] = (uint8) (Op06S&0xFF);						DSP1.output [5] = (uint8) ((Op06S>>8)&0xFF);						break;											case 0x1e:					case 0x2e:					case 0x3e:					case 0x0e:	// Target						Op0EH = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op0EV = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));												DSPOp0E ();												DSP1.out_count = 4;						DSP1.output [0] = (uint8) (Op0EX&0xFF);						DSP1.output [1] = (uint8) ((Op0EX>>8)&0xFF);						DSP1.output [2] = (uint8) (Op0EY&0xFF);						DSP1.output [3] = (uint8) ((Op0EY>>8)&0xFF);						break;												// Extra commands used by Pilot Wings					case 0x05:					case 0x35:					case 0x31:					case 0x01: // Set attitude matrix A						Op01m = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op01Zr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op01Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));						Op01Xr = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));												DSPOp01 ();						break;										case 0x15:						case 0x11:	// Set attitude matrix B						Op11m = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op11Zr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op11Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));						Op11Xr = (int16) (DSP1.parameters [7]|(DSP1.parameters[7]<<8));												DSPOp11 ();						break;											case 0x25:					case 0x21:	// Set attitude matrix C						Op21m = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op21Zr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op21Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));						Op21Xr = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));												DSPOp21 ();						break;											case 0x09:					case 0x39:					case 0x3d:					case 0x0d:	// Objective matrix A						Op0DX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op0DY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op0DZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp0D ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op0DF&0xFF);						DSP1.output [1] = (uint8) ((Op0DF>>8)&0xFF);						DSP1.output [2] = (uint8) (Op0DL&0xFF);						DSP1.output [3] = (uint8) ((Op0DL>>8)&0xFF);						DSP1.output [4] = (uint8) (Op0DU&0xFF);						DSP1.output [5] = (uint8) ((Op0DU>>8)&0xFF);						break;											case 0x19:					case 0x1d:	// Objective matrix B						Op1DX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op1DY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op1DZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp1D ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op1DF&0xFF);						DSP1.output [1] = (uint8) ((Op1DF>>8)&0xFF);						DSP1.output [2] = (uint8) (Op1DL&0xFF);						DSP1.output [3] = (uint8) ((Op1DL>>8)&0xFF);						DSP1.output [4] = (uint8) (Op1DU&0xFF);						DSP1.output [5] = (uint8) ((Op1DU>>8)&0xFF);						break;											case 0x29:					case 0x2d:	// Objective matrix C						Op2DX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op2DY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op2DZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp2D ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op2DF&0xFF);						DSP1.output [1] = (uint8) ((Op2DF>>8)&0xFF);						DSP1.output [2] = (uint8) (Op2DL&0xFF);						DSP1.output [3] = (uint8) ((Op2DL>>8)&0xFF);						DSP1.output [4] = (uint8) (Op2DU&0xFF);						DSP1.output [5] = (uint8) ((Op2DU>>8)&0xFF);						break;												case 0x33:					case 0x03:	// Subjective matrix A						Op03F = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op03L = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op03U = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp03 ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op03X&0xFF);						DSP1.output [1] = (uint8) ((Op03X>>8)&0xFF);						DSP1.output [2] = (uint8) (Op03Y&0xFF);						DSP1.output [3] = (uint8) ((Op03Y>>8)&0xFF);						DSP1.output [4] = (uint8) (Op03Z&0xFF);						DSP1.output [5] = (uint8) ((Op03Z>>8)&0xFF);						break;											case 0x13:	// Subjective matrix B						Op13F = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op13L = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op13U = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp13 ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op13X&0xFF);						DSP1.output [1] = (uint8) ((Op13X>>8)&0xFF);						DSP1.output [2] = (uint8) (Op13Y&0xFF);						DSP1.output [3] = (uint8) ((Op13Y>>8)&0xFF);						DSP1.output [4] = (uint8) (Op13Z&0xFF);						DSP1.output [5] = (uint8) ((Op13Z>>8)&0xFF);						break;											case 0x23:	// Subjective matrix C						Op23F = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op23L = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op23U = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp23 ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op23X&0xFF);						DSP1.output [1] = (uint8) ((Op23X>>8)&0xFF);						DSP1.output [2] = (uint8) (Op23Y&0xFF);						DSP1.output [3] = (uint8) ((Op23Y>>8)&0xFF);						DSP1.output [4] = (uint8) (Op23Z&0xFF);						DSP1.output [5] = (uint8) ((Op23Z>>8)&0xFF);						break;											case 0x3b:					case 0x0b:						Op0BX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op0BY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op0BZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp0B ();												DSP1.out_count = 2;						DSP1.output [0] = (uint8) (Op0BS&0xFF);						DSP1.output [1] = (uint8) ((Op0BS>>8)&0xFF);						break;											case 0x1b:						Op1BX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op1BY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op1BZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp1B ();												DSP1.out_count = 2;						DSP1.output [0] = (uint8) (Op1BS&0xFF);						DSP1.output [1] = (uint8) ((Op1BS>>8)&0xFF);						break;											case 0x2b:						Op2BX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op2BY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op2BZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));												DSPOp2B ();												DSP1.out_count = 2;						DSP1.output [0] = (uint8) (Op2BS&0xFF);						DSP1.output [1] = (uint8) ((Op2BS>>8)&0xFF);						break;											case 0x34:					case 0x14:							Op14Zr = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));						Op14Xr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));						Op14Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));						Op14U = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));						Op14F = (int16) (DSP1.parameters [8]|(DSP1.parameters[9]<<8));						Op14L = (int16) (DSP1.parameters [10]|(DSP1.parameters[11]<<8));												DSPOp14 ();												DSP1.out_count = 6;						DSP1.output [0] = (uint8) (Op14Zrr&0xFF);						DSP1.output [1] = (uint8) ((Op14Zrr>>8)&0xFF);						DSP1.output [2] = (uint8) (Op14Xrr&0xFF);						DSP1.output [3] = (uint8) ((Op14Xrr>>8)&0xFF);						DSP1.output [4] = (uint8) (Op14Yrr&0xFF);						DSP1.output [5] = (uint8) ((Op14Yrr>>8)&0xFF);						break;										case 0x27:					case 0x2F:						Op2FUnknown = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));												DSPOp2F ();												DSP1.out_count = 2;						DSP1.output [0] = (uint8)(Op2FSize&0xFF);						DSP1.output [1] = (uint8)((Op2FSize>>8)&0xFF);						break;												case 0x07:					case 0x0F:						Op0FRamsize = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));												DSPOp0F ();												DSP1.out_count = 2;						DSP1.output [0] = (uint8)(Op0FPass&0xFF);						DSP1.output [1] = (uint8)((Op0FPass>>8)&0xFF);						break;											default:						break;					}				}			}		}    }}uint8 DSP1GetByte(uint16 address){	uint8 t;    if ((address & 0xf000) == 0x6000 ||//		(address >= 0x8000 && address < 0xc000))		(address&0x7fff) < 0x4000)    {		if (DSP1.out_count)		{			//if ((address & 1) == 0)				t = (uint8) DSP1.output [DSP1.out_index];			//else			//{			//	t = (uint8) (DSP1.output [DSP1.out_index] >> 8);				DSP1.out_index++;				if (--DSP1.out_count == 0)				{					if (DSP1.command == 0x1a || DSP1.command == 0x0a)					{						DSPOp0A ();						DSP1.out_count = 8;						DSP1.out_index = 0;						DSP1.output [0] = (Op0AA&0xFF);						DSP1.output [1] = (Op0AA>>8)&0xFF;						DSP1.output [2] = (Op0AB&0xFF);						DSP1.output [3] = (Op0AB>>8)&0xFF;						DSP1.output [4] = (Op0AC&0xFF);						DSP1.output [5] = (Op0AC>>8)&0xFF;						DSP1.output [6] = (Op0AD&0xFF);						DSP1.output [7] = (Op0AD>>8)&0xFF;					}					if(DSP1.command==0x1f)					{						if((DSP1.out_index%2)!=0)						{							t=(uint8)DSP1ROM[DSP1.out_index>>1];						}						else						{							t=DSP1ROM[DSP1.out_index>>1]>>8;						}					}				}				DSP1.waiting4command = TRUE;			//}		}		else		{			// Top Gear 3000 requires this value....	//		if(4==Settings.DSPVersion)				t = 0xff;			//Ballz3d requires this one:	//		else t = 0x00;		}    }    else t = 0x80;	return t;}void DSP2SetByte(uint8 byte, uint16 address){	if ((address & 0xf000) == 0x6000 ||		(address >= 0x8000 && address < 0xc000))    {		if (DSP1.waiting4command)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -