mask off upper bits when incrementing RX addr

fixes #931
This commit is contained in:
RSDuck 2021-01-09 18:31:12 +01:00
parent 7081c2de65
commit c475372372
1 changed files with 3 additions and 10 deletions

View File

@ -791,22 +791,15 @@ bool ProcessTX(TXSlot* slot, int num)
}
inline void IncrementRXAddr(u16& addr, u16 inc)
inline void IncrementRXAddr(u16& addr, u16 inc = 2)
{
addr += inc;
addr &= 0x1FFE;
if (addr >= (IOPORT(W_RXBufEnd) & 0x1FFE))
{
addr -= (IOPORT(W_RXBufEnd) & 0x1FFE);
addr += (IOPORT(W_RXBufBegin) & 0x1FFE);
}
}
inline void IncrementRXAddr(u16& addr)
{
addr += 2;
if (addr == (IOPORT(W_RXBufEnd) & 0x1FFE))
{
addr = (IOPORT(W_RXBufBegin) & 0x1FFE);
addr &= 0x1FFE;
}
}