Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UMLAL with rd_hi = rd_lo yields wrong result #1956

Closed
ladystarbreeze opened this issue Nov 28, 2020 · 2 comments
Closed

UMLAL with rd_hi = rd_lo yields wrong result #1956

ladystarbreeze opened this issue Nov 28, 2020 · 2 comments

Comments

@ladystarbreeze
Copy link

@ladystarbreeze ladystarbreeze commented Nov 28, 2020

In mGBA 0.8.4, the UMLAL instruction yields incorrect results when rd_hi and rd_lo are the same register.
On hardware (3DS + open-agb-firm), UMLAL r4, r4, r4, r4 with r4 = 20001h sets r4 to 20005h. mGBA sets r4 to 60006h. Presumably, this is the correct order of operations:

a = do_unsigned_long_multiplication(rm, rs)
a += concat(rd_hi, rd_lo)
rd_lo = a_lo
rd_hi = a_hi

3ds_gba_umlal

mgba_umlal

@endrift
Copy link
Member

@endrift endrift commented Nov 28, 2020

Can you please actually upload the test ROM so I don't have to make one myself?

@ladystarbreeze
Copy link
Author

@ladystarbreeze ladystarbreeze commented Nov 28, 2020

Sorry, here's the test ROM.

umlal.zip

@endrift endrift closed this in fbba3ef Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants