handle edge cases properly

This commit is contained in:
RSDuck 2021-01-09 22:06:15 +01:00
parent c475372372
commit 6b306e18a5

View File

@ -793,13 +793,12 @@ bool ProcessTX(TXSlot* slot, int num)
inline void IncrementRXAddr(u16& addr, u16 inc = 2)
{
addr += inc;
addr &= 0x1FFE;
if (addr >= (IOPORT(W_RXBufEnd) & 0x1FFE))
for (u32 i = 0; i < inc; i += 2)
{
addr -= (IOPORT(W_RXBufEnd) & 0x1FFE);
addr += (IOPORT(W_RXBufBegin) & 0x1FFE);
addr += 2;
addr &= 0x1FFE;
if (addr == (IOPORT(W_RXBufEnd) & 0x1FFE))
addr = (IOPORT(W_RXBufBegin) & 0x1FFE);
}
}