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

Incorrect branch instruction in report.i65 for converting hex characters #20

Closed
dragonbytes opened this issue Jan 3, 2023 · 4 comments

Comments

@dragonbytes
Copy link

Hi, I really like your 6502 testing suite but I found an error in report.i65 that converts values to hexadecimal characters for IO debugging output:

Line 189: bcc rchar

This line in the "rnib" subroutine should actually be a BCS instead. Thanks :)

@Klaus2m5
Copy link
Owner

Klaus2m5 commented Jan 4, 2023

Remember, that in the 6502 world borrow = -carry (borrow is the complement of carry). Besides the routine has worked for many users for thousands of times now.
So if you get garbled output it is definitely not in this routine.

@dragonbytes
Copy link
Author

wow my bad, you were right of course :) I apologize for that. I come from a 6809 background so that borrow inversion tricked me. I am pretty close to having a successful test but I seem to be stuck in the "tadd" loop which keeps calling "chkadd" over and over and doesn't throw a trap as usual. any tips on what might be wrong? theres alot of nested increments/decrements so i can't quite figure out what the test it trying to do.

@Klaus2m5
Copy link
Owner

Klaus2m5 commented Jan 5, 2023

The loop at "tadd" iterates through all possible operands for an add instruction and calls "chkadd" twice, first with C clear and second with C set. This is 256 * 256 *2 iterations and may take a long time. "tadd" exits when "inc ad2" overflows to 0 again. So the best approach is to find the operands "ad1" and "ad2" in memory and see, wether they increment and wether "ad2" actually gets back to 0 to stop the loop.

@dragonbytes
Copy link
Author

yes! that was it exactly. I started to monitor ad2 and saw how slowly it was incrementing, so I let it run. took about 30 mins to complete, but when it did, my emulator passed all your tests! (I am emulating a 6502 on a 6309 CPU (another 8-bit cpu with a larger instruction set) so I expected it wouldn't be the fastest in the world :) your tool was super useful, thanks alot for making it!

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

2 participants