forked from sin365/AxibugEmuOnline
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AxibugEmuOnline.Client.UNES
|
|
{
|
|
sealed partial class CPU
|
|
{
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void WriteIoRegister(uint reg, byte val)
|
|
{
|
|
switch (reg)
|
|
{
|
|
case 0x4014: // OAM DMA
|
|
_emulator.PPU.PerformDMA(val);
|
|
break;
|
|
case 0x4016:
|
|
_emulator.Controller.Strobe(val == 1);
|
|
break;
|
|
}
|
|
|
|
if (reg <= 0x401F)
|
|
{
|
|
return; // APU write
|
|
}
|
|
|
|
throw new NotImplementedException($"{reg:X4} = {val:X2}");
|
|
}
|
|
|
|
public uint ReadIORegister(uint reg)
|
|
{
|
|
switch (reg)
|
|
{
|
|
case 0x4016:
|
|
return (uint) _emulator.Controller.ReadState() & 0x1;
|
|
}
|
|
return 0x00;
|
|
//throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|