Implemented OAM, SAT so sprites and background scrolling now work
This commit is contained in:
@@ -1506,6 +1506,49 @@ namespace Core.Cpu
|
||||
if ((n & 0x02) != 0) AF.Low |= 0x20; // Bit 5 from bit 1
|
||||
return 16;
|
||||
}
|
||||
case 0xA2: // INI
|
||||
{
|
||||
// 1. Read from the port specified by BC
|
||||
byte inValA2 = _simpleIoBus.ReadPort(BC.Word);
|
||||
|
||||
// 2. Write the value to memory at HL
|
||||
WriteMemory(HL.Word, inValA2);
|
||||
|
||||
// 3. Decrement B (the byte counter)
|
||||
BC.High--;
|
||||
|
||||
// 4. Increment HL (the memory pointer)
|
||||
HL.Word++;
|
||||
|
||||
// 5. Update Flags
|
||||
AF.Low |= 0x02; // N is always set (1)
|
||||
if (BC.High == 0) AF.Low |= 0x40; // Z is set if B reaches 0
|
||||
else AF.Low &= 0xBF; // Z is cleared otherwise
|
||||
|
||||
return 16; // Takes 16 T-States
|
||||
}
|
||||
case 0xB2: // INIR
|
||||
{
|
||||
// This does exactly the same thing as INI, but loops until B == 0
|
||||
byte inValB2 = _simpleIoBus.ReadPort(BC.Word);
|
||||
WriteMemory(HL.Word, inValB2);
|
||||
BC.High--;
|
||||
HL.Word++;
|
||||
|
||||
AF.Low |= 0x02; // N is always set
|
||||
|
||||
if (BC.High != 0)
|
||||
{
|
||||
AF.Low &= 0xBF; // Z is reset
|
||||
PC -= 2; // Loop back and execute ED B2 again!
|
||||
return 21;
|
||||
}
|
||||
else
|
||||
{
|
||||
AF.Low |= 0x40; // Z is set
|
||||
return 16;
|
||||
}
|
||||
}
|
||||
case 0xA3: // OUTI
|
||||
{
|
||||
// 1. Read data from memory at HL
|
||||
|
||||
Reference in New Issue
Block a user