Skip to content

Commit

Permalink
Fix #799
Browse files Browse the repository at this point in the history
  • Loading branch information
Atari2 committed Feb 4, 2023
1 parent f619764 commit 11e1435
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sa1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,9 @@ void S9xSetSA1 (uint8 byte, uint32 address)
{
int16 dividend = (int16) SA1.op1;
uint16 divisor = (uint16) SA1.op2;
uint16 remainder = (dividend >= 0) ? dividend % divisor : (dividend % divisor) + divisor;
uint16 quotient = (dividend - remainder) / divisor;
uint32 dividend_ext = dividend + (uint32)divisor * 65536;
uint16 remainder = dividend_ext % divisor;
uint16 quotient = dividend_ext / divisor;
SA1.sum = (remainder << 16) | quotient;
}

Expand Down

0 comments on commit 11e1435

Please sign in to comment.