ShonFrazier/lib6502

Shouldn't the M6502 flags be an unsigned char?

Opened this issue · 1 comments

I was working with this library and using the struct in my code, and began to realize that the flags are being set as an unsigned int, which is 16-bits wide. However, I do believe that the MOS 6502 flags are actually 8-bits wide, and this should instead be an unsigned char. Is there a specific reason why it was set up this way?

unsigned int flags;

Something odd and interesting to note, is that when I used h2pas to make the library compatible with FreePascal, it decided to mark it was a dword, which is 32-bits long, but that's more of an issue with h2pas and not this code, but I just thought I'd make mention of it, as I thought it was rather odd. Otherwise, using this library in FreePascal and Lazarus works rather well. Both compiled into the binary itself, and as an external shared library.

I brought this code to GitHub from elsewhere (i.e. I’m not the original author), so I’m unsure whether moving from u16 to s8 would cause any problems. Make the change, run the tests, maybe run some of your own 6502 programs through it. If it still works, I’ll gladly look at a PR. 🙂