Skip to content

Commit

Permalink
missing instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertvanheusden committed Sep 2, 2023
1 parent ecece0f commit 933d4dc
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions XT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2599,30 +2599,43 @@ public bool Tick()
Log.DoLog($"{prefixStr} {name} {affected},{name_from}");
#endif
}
else if (opcode == 0xcc || opcode == 0xcd)
else if (opcode == 0xcc || opcode == 0xcd || opcode == 0xce)
{
// INT 0x..
byte @int = (byte)(opcode == 0xcc ? 3 : GetPcByte());
if (opcode != 0xce || GetFlagO())
{
byte @int = 0;

uint addr = (uint)(@int * 4);
if (opcode == 0xcc)
@int = 3;
else if (opcode == 0xce)
@int = 4;
else
@int = GetPcByte();

if (InterceptInt(@int) == false)
{
push(_flags);
push(_cs);
push(_ip);
uint addr = (uint)(@int * 4);

SetFlagI(false);
if (InterceptInt(@int) == false)
{
push(_flags);
push(_cs);
push(_ip);

_ip = (ushort)(_b.ReadByte(addr + 0) + (_b.ReadByte(addr + 1) << 8));
_cs = (ushort)(_b.ReadByte(addr + 2) + (_b.ReadByte(addr + 3) << 8));
}
SetFlagI(false);

_ip = (ushort)(_b.ReadByte(addr + 0) + (_b.ReadByte(addr + 1) << 8));
_cs = (ushort)(_b.ReadByte(addr + 2) + (_b.ReadByte(addr + 3) << 8));
}

cycle_count += 51; // 71
cycle_count += 51; // 71 TODO

#if DEBUG
Log.DoLog($"{prefixStr} INT {@int:X2} -> ${_cs * 16 + _ip:X6} (from {addr:X4})");
if (opcode == 0xce)
Log.DoLog($"{prefixStr} INTO {@int:X2} -> ${_cs * 16 + _ip:X6} (from {addr:X4})");
else
Log.DoLog($"{prefixStr} INT {@int:X2} -> ${_cs * 16 + _ip:X6} (from {addr:X4})");
#endif
}
}
else if (opcode == 0xcf)
{
Expand Down Expand Up @@ -3508,15 +3521,15 @@ public bool Tick()
#endif
}
}
else if (opcode == 0xca || opcode == 0xcb)
else if (opcode >= 0xc8 || opcode <= 0xcb)
{
// RETF n / RETF
ushort nToRelease = opcode == 0xca ? GetPcWord() : (ushort)0;
ushort nToRelease = (opcode == 0xca || opcode == 0xc8) ? GetPcWord() : (ushort)0;

_ip = pop();
_cs = pop();

if (opcode == 0xca)
if (opcode == 0xca || opcode == 0xc8)
{
_sp += nToRelease;

Expand Down

0 comments on commit 933d4dc

Please sign in to comment.