-
Notifications
You must be signed in to change notification settings - Fork 93
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
Altair 8800 DAA instruction doesn't adjust for carry bit #433
Comments
You are right. The DAA instruction is not correctly implemented in the Altair simulator. I suggest to use the AltairZ80 simulator instead. It also can simulate an Altair 8800 and has a correct implementation of the DAA instruction for both 8080 and Z80. |
Thanks! That seems to work for my code. For the record, it looks like the plain old |
Now that you've identified a clear bug, you can suggest a specific fix. If you're up for that, please work against the latest code here in the master branch. If you're familiar with git, feel free to submit a pull request. Otherwise, just identify the appropriate code change here and I'll be glad to put the change into the system here with you as the author. |
Unfortunately, the fix I had in mind was just to check the carry flag, but it looks like it is insufficient to get DAA completely working. I think the remaining issue is that the auxiliary carry flag isn't getting set correctly during ADD/ADI. That's as far as I've gotten. |
Context
Disclaimer: I don't have an actual Altair 8800 to test against, so it's possible there's a misunderstanding on my part and/or a bug in the other emulator I'm testing against.
On the Altair 8800 (Intel 8080), for the DAA instruction, the 8080 Programmers Manual says:
It looks like
altair_cpu.c
only checks the auxiliary carry flag and not the normal carry flag. To test this, I ran the following program (which adds 0x81 to 0x81 and runs DAA, which should result in 0x62 at address 0x40, since 81 + 81 = 162), but the result at 0x40 is 0x02 instead of 0x62. A different Altair simulator shows 0x62 as the result.the output of "sim> SHOW VERSION" while running the simulator which is having the issue
Altair 8800 simulator V3.8-1 [32b data, 32b addresses, no Ethernet]
how you built the simulator or that you're using prebuilt binaries
Prebuilt x86-64 Debian Bookworm binaries
the simulator configuration file (or commands) which were used when the problem occurred.
No custom configuration file; GitHub won't let me attach the compiled .bin file, so here it is in octal:
076 201 306 201 047 062 100 000 166
(with a zero at address 0x40/octal 0100)the expected behavior and the actual behavior
Output of running the above program and checking the result at octal 0100:
you may also need to provide specific pointers to data files that may be necessary to demonstrate the problem
See assembly and octal compiled program above.
The text was updated successfully, but these errors were encountered: