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

Issues with NBCD instruction #55

Open
dirkwhoffmann opened this issue Dec 25, 2019 · 0 comments
Open

Issues with NBCD instruction #55

dirkwhoffmann opened this issue Dec 25, 2019 · 0 comments

Comments

@dirkwhoffmann
Copy link

The implementation of NBCD doesn’t seem to be correct.

To verify this instruction, I’ve written four test cases:

https://github.com/dirkwhoffmann/vAmigaTS/tree/master/CPU/NBCD

nbcd1

Draws two 16 x 16 squares. In each square, the NBCD command is run for all 256 possible source values. The left square has the X flag cleared and the right square set. Each 8 x 8 pixel box shows the bit pattern of value computed by the instruction under test.

nbcd2

Displays the value of the N flag after NBCD has been executed.

nbcd3

Displays the value of the V flag after NBCD has been executed.

nbcd4

Displays the value of the X,Z, and V flag after NBCD has been executed.

Here are the results:

Musashi (vAmiga):

Bildschirmfoto 2019-12-25 um 10 18 34

A real Amiga (A500+ 🥰):

nbcd1_A500+

The left image (NBCD executed with X = 0) seems to be correct. The right image differs.

The flags show discrepancies, too:

Musashi (vAmiga):

Bildschirmfoto 2019-12-25 um 10 22 17

Bildschirmfoto 2019-12-25 um 10 21 15

Bildschirmfoto 2019-12-25 um 10 21 39

A500+:

nbcd2_A500+
nbcd3_A500+
nbcd4_A500+

I've also run the test cases in UAE. As far as I could see, UAE does it right. I didn't look into the UAE code yet, but it might help to fix the instruction.

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

No branches or pull requests

1 participant