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

MEGA65: Hardware division gets the remainder wrong #387

Open
lydon42 opened this issue Aug 18, 2023 · 2 comments
Open

MEGA65: Hardware division gets the remainder wrong #387

lydon42 opened this issue Aug 18, 2023 · 2 comments
Assignees

Comments

@lydon42
Copy link

lydon42 commented Aug 18, 2023

Describe the bug
if you put 14 00 00 00 and 03 00 00 00 in MULTINA and MULTINB,. the result should be AB AA AA AA 06 00 00 00 in the 64 bit DIVOUT register. On xemu (next branch f16e0ae) it is AA in the first byte instead.

hwdiv-on-xemu-next

Used version of the project
next branch f16e0ae

To Reproduce

  1. MONITOR
  2. MFFD3670 FFD367F
  3. put AB AA AA AA 06 00 00 00 after >0FFD3770 and press return
  4. go up to the MFFD.. press return,check result.

Expected behavior
hwdiv-on-r3hw

@lgblgblgb lgblgblgb self-assigned this Aug 18, 2023
@lgblgblgb lgblgblgb changed the title Hardware division gets the reminder wrong MEGA65: Hardware division gets the reminder wrong Aug 18, 2023
@stefandd
Copy link

stefandd commented Dec 5, 2023

should be remainder (not reminder)

@lgblgblgb lgblgblgb changed the title MEGA65: Hardware division gets the reminder wrong MEGA65: Hardware division gets the remainder wrong Dec 6, 2023
@lgblgblgb
Copy link
Owner

lgblgblgb commented Dec 15, 2023

MEGA65/mega65-rom-public#101
An interesting case: 5211/193 = 27 (without remainder, per math) but it's not the very precise case with mega65-core, which also results in different result in ROM then.
MEGA65/mega65-core#505
MEGA65/mega65-core#506
Some insights.

Breaking news

And: MEGA65/mega65-core#786

I feel, this is still in the flux, and I should wait what the final solution should be, what I have to follow then. It's also possible that the current Xemu implementation will be the one with MEGA65, so ...

PR in mega65-core to fix round-off errors: MEGA65/mega65-core#812 This likely will change the result of the exact remainder values anyway even on mega65-core! >>has been merged into the development branch of mega65-core already, it seems<<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants