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

AAA Does not clear upper nibble #26

Open
AshTS opened this issue Mar 5, 2024 · 0 comments
Open

AAA Does not clear upper nibble #26

AshTS opened this issue Mar 5, 2024 · 0 comments

Comments

@AshTS
Copy link

AshTS commented Mar 5, 2024

The algorithm performed by the ASCII Adjust After Addition instruction is documented as always clearing the upper nibble of AL. However, the current implementation does not do so.

From https://www.felixcloutier.com/x86/aaa:

IF 64-Bit Mode
    THEN
        #UD;
    ELSE
        IF ((AL AND 0FH) > 9) or (AF = 1)
            THEN
                AX := AX + 106H;
                AF := 1;
                CF := 1;
            ELSE
                AF := 0;
                CF := 0;
        FI;
        AL := AL AND 0FH;
FI;

This can be fixed by adding the bitwise and in the aaa implementation.

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