//===== LD (n), n
void sngLD8_8()
{
	_u8 dst = FETCH8;
	_u8 src = FETCH8;
	storeB(dst, src);
	cycles = 5;
}
    bool pack(UByte& _b1, UByte& _b2, UByte& _b3) const
    {
      _b1 = utypeValue<UByte, true>(storeR(), 8, 0);
      _b2 = utypeValue<UByte, true>(storeG(), 8, 0);
      _b3 = utypeValue<UByte, true>(storeB(), 8, 0);

      return true;
    }
 bool pack(UByte& _b1, UByte& _b2) const
 {
   _b1 = utypeValue<UByte,  true>(storeR(), 5, 0)
       | utypeValue<UByte,  true>(storeG(), 3, 5);
   _b2 = utypeValue<UByte, false>(storeG(), 3, 3)
       | utypeValue<UByte,  true>(storeB(), 5, 3);
   return true;
 }
Esempio n. 4
0
void storeW(uint32 address, uint16 data)
{
        address &= 0xFFFFFF;

	if(address & 1)
	{
	 storeB(address + 0, data & 0xFF);
	 storeB(address + 1, data >> 8);
	 return;
	}
Esempio n. 5
0
EXPORT void FrameAdvance(MyFrameInfo* frame)
{
	lagged = true;
	bool MeowMeow = 0;
	MDFN_Surface surface;
	surface.pixels = frame->VideoBuffer;
	surface.pitch32 = 160;
	frame->Width = 160;
	frame->Height = 152;
	frontend_time = frame->FrontendTime;
	storeB(0x6f82, frame->Buttons);

	ngpc_soundTS = 0;
	NGPFrameSkip = frame->SkipRendering;

	do
	{
		int32 timetime = (uint8)TLCS900h_interpret(); // This is sooo not right, but it's replicating the old behavior(which is necessary
													  // now since I've fixed the TLCS900h core and other places not to truncate cycle counts
													  // internally to 8-bits).  Switch to the #if 0'd block of code once we fix cycle counts in the
													  // TLCS900h core(they're all sorts of messed up), and investigate if certain long
													  // instructions are interruptable(by interrupts) and later resumable, RE Rockman Battle
		// & Fighters voice sample playback.

		//if(timetime > 255)
		// printf("%d\n", timetime);

		// Note: Don't call updateTimers with a time/tick/cycle/whatever count greater than 255.
		MeowMeow |= updateTimers(&surface, timetime);

		z80_runtime += timetime;

		while (z80_runtime > 0)
		{
			int z80rantime = Z80_RunOP();

			if (z80rantime < 0) // Z80 inactive, so take up all run time!
			{
				z80_runtime = 0;
				break;
			}

			z80_runtime -= z80rantime << 1;
		}
	} while (!MeowMeow);

	frame->Cycles = ngpc_soundTS;
	frame->Samples = MDFNNGPCSOUND_Flush(frame->SoundBuffer, 8192);
	frame->Lagged = lagged;
}
Esempio n. 6
0
static bool do_flash_read(const uint8 *flashdata)
{
	FlashFileHeader header;
	const uint8 *fileptr;
	uint16 i;
	uint32 j;
	bool PREV_memory_unlock_flash_write = memory_unlock_flash_write; // kludge, hack, FIXME

	memcpy(&header, flashdata, sizeof(header));

	if (header.block_count > FLASH_MAX_BLOCKS)
	{
		return false;
		//throw MDFN_Error(0, _("FLASH header block_count(%u) > FLASH_MAX_BLOCKS!"), header.block_count);
	}

	//Read header
	block_count = header.block_count;
	fileptr = flashdata + sizeof(FlashFileHeader);

	//Copy blocks
	memory_unlock_flash_write = TRUE;
	for (i = 0; i < block_count; i++)
	{
		FlashFileBlockHeader *current = (FlashFileBlockHeader *)fileptr;
		fileptr += sizeof(FlashFileBlockHeader);

		blocks[i].start_address = current->start_address;
		blocks[i].data_length = current->data_length;

		//Copy data
		for (j = 0; j < blocks[i].data_length; j++)
		{
			storeB(blocks[i].start_address + j, *fileptr);
			fileptr++;
		}
	}
	memory_unlock_flash_write = PREV_memory_unlock_flash_write;

	optimise_blocks(); //Optimise

#if 0
	//Output block list...
	for (i = 0; i < block_count; i++)
		printf("flash block: %06X, %d bytes\n", 
			blocks[i].start_address, blocks[i].data_length);
#endif
	return true;
}
Esempio n. 7
0
static void NGP_z80_writebyte(uint16 address, uint8 value)
{
	if (address <= 0x0FFF)
	{
		storeB(0x7000 + address, value);
		return;
	}

	if (address == 0x8000)
	{
		CommByte = value;
		return;
	}

	if (address == 0x4001)	{	Write_SoundChipLeft(value); return; }
	if (address == 0x4000)	{	Write_SoundChipRight(value); return; }

	if (address == 0xC000)
	{
		TestIntHDMA(6, 0x0C);
	}
}
Esempio n. 8
0
int main()
{
	LOGT("=====TestSubject=====");

	Subject<int> observee;
	A observerA;
	B observerB;
	D observerD;
	F observerF;

	Delegate<void, int> d[6];

	d[0] = Delegate<void, int>(foo);
	d[1] = Delegate<void, int>(observerA, &A::foo);
	d[2] = Delegate<void, int>(observerB, &B::foo);
	d[3] = Delegate<void, int>(observerD, &D::foo);
	d[4] = Delegate<void, int>(E::foo);
	d[5] = Delegate<void, int>(observerF, &F::foo);

	for (int i = 0; i < 6; ++i)
		observee.add(&d[i]);

	observee.notify(101);


	LOGT("=====TestObserver=====");

	Store storeA('A');
	Store storeB('B');
	Store storeC('C');
	Price price;
	price.add(&storeA);
	price.add(&storeB);
	price.add(&storeC);
	price.notify();

	return 0;
}
Esempio n. 9
0
static void Emulate(EmulateSpecStruct *espec)
{
	bool MeowMeow = 0;

	espec->DisplayRect.x = 0;
	espec->DisplayRect.y = 0;
	espec->DisplayRect.w = 160;
	espec->DisplayRect.h = 152;

	if(espec->VideoFormatChanged)
	 NGPGfx->set_pixel_format(espec->surface->format);

	if(espec->SoundFormatChanged)
	 MDFNNGPC_SetSoundRate(espec->SoundRate);


	NGPJoyLatch = *chee;
	storeB(0x6F82, *chee);

	MDFNMP_ApplyPeriodicCheats();

	ngpc_soundTS = 0;
	NGPFrameSkip = espec->skip;

	do
	{
#if 0
         int32 timetime;

	 if(main_timeaccum == 0)
	 {
	  main_timeaccum = TLCS900h_interpret();
          if(main_timeaccum > 255)
	  {
	   main_timeaccum = 255;
           printf("%d\n", main_timeaccum);
	  }
	 }

	 timetime = std::min<int32>(main_timeaccum, 24);
	 main_timeaccum -= timetime;
#else
#if 0
	 uint32 old_pc = pc;
	 {
	  uint32 xix = gpr[0];
	  uint32 xiz = gpr[2];
	  printf("%08x %08x --- %s\n", xix, xiz, TLCS900h_disassemble());
	 }
	 pc = old_pc;
#endif

	 int32 timetime = (uint8)TLCS900h_interpret();	// This is sooo not right, but it's replicating the old behavior(which is necessary
							// now since I've fixed the TLCS900h core and other places not to truncate cycle counts
							// internally to 8-bits).  Switch to the #if 0'd block of code once we fix cycle counts in the
							// TLCS900h core(they're all sorts of messed up), and investigate if certain long
							// instructions are interruptable(by interrupts) and later resumable, RE Rockman Battle
							// & Fighters voice sample playback.
#endif
	 //if(timetime > 255)
	 // printf("%d\n", timetime);

	 // Note: Don't call updateTimers with a time/tick/cycle/whatever count greater than 255.
	 MeowMeow |= updateTimers(espec->surface, timetime);

	 z80_runtime += timetime;

         while(z80_runtime > 0)
	 {
	  int z80rantime = Z80_RunOP();

	  if(z80rantime < 0) // Z80 inactive, so take up all run time!
	  {
	   z80_runtime = 0;
	   break;
	  }

	  z80_runtime -= z80rantime << 1;

	 }
	} while(!MeowMeow);


	espec->MasterCycles = ngpc_soundTS;
	espec->SoundBufSize = MDFNNGPCSOUND_Flush(espec->SoundBuf, espec->SoundBufMaxSize);
}
Esempio n. 10
0
void TGAImage::setB( int lod, int i, int j, int v )
{ 
	int w = getLODwidth(lod);
	storeB( lodData[lod] + BPP * ( j * w + i ), v );
}