Пример #1
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);
	}
}
Пример #2
0
void storeB(uint32 address, uint8 data)
{
        address &= 0xFFFFFF;

        if(address >= 0x8000 && address <= 0xbfff)
	{
         NGPGfx->write8(address, data);
	 return;
	}
        if(address >= 0x4000 && address <= 0x7fff)
        {
         *(uint8 *)(CPUExRAM + address - 0x4000) = data;
         return;
        }
	if(address >= 0x70 && address <= 0x7F)
	{
	 int_write8(address, data);
	 return;
	}
        if(address >= 0x20 && address <= 0x29)
	{
	 timer_write8(address, data);
	 return;
	}

	if(address == 0x50)
	{
	 SC0BUF = data;
	 return;
	}

	if(address == 0x6f) // Watchdog timer
	{
	 return;
	}

	if(address == 0xb2) // Comm?
	{
	 COMMStatus = data & 1;
	 return;
	}

	if(address == 0xb9) 
	{
         if(data == 0x55)
          Z80_SetEnable(1);
         else if(data == 0xAA)
          Z80_SetEnable(0);
         return;
	}

        if(address == 0xb8)
        {
	 if(data == 0x55)
	  MDFNNGPCSOUND_SetEnable(1);
	 else if(data == 0xAA)
	  MDFNNGPCSOUND_SetEnable(0);
	 return;
        }

	if (address == 0xBA)
	{
                Z80_nmi();
		return;
	}

	if(address == 0xBC)
	{
		Z80_WriteComm(data);
		return;
	}

	if(address >= 0xa0 && address <= 0xA3)
	{
         if(!Z80_IsEnabled())
         {
          if (address == 0xA1)   Write_SoundChipLeft(data);
          else if (address == 0xA0)      Write_SoundChipRight(data);
         } 
         //DAC Write
         if (address == 0xA2)
         {
          dac_write_left(data);
         }
         else if (address == 0xA3)
         {
          dac_write_right(data);
         }
	 return;
	}

	//printf("%08x %02x\n", address, data);
	uint8* ptr = (uint8*)translate_address_write(address);

	//Write
	if (ptr)
	{
		*ptr = data;
	}
	//else
        //        printf("ACK: %08x %02x\n", address, data);

}