colin-broderick / emu

0 stars 1 forks source link

added op AND zeropage X #12

Closed Mark-Platts closed 3 years ago

Mark-Platts commented 3 years ago

Added and tested the AND op with zero page X address mode.

I haven't tested this one yet but it should be fine due to its similarity to the other one. I'll test after merge to avoid an obvious conflict.

I thought doing two together in separate branched would be a good way to make sure git has no problems there.

Also, I looked at your LDA with zeropage X to get an idea of how you laid yours out. Have you done anything with that one to avoid address overflow out of page zero? The ref says to wrap-around the address so that it always stays within 2 bytes. I've used and AND with 0xFF to do that in mine.

colin-broderick commented 3 years ago

Without looking at the code to double check, it should wrap around automatically. The data type I'm calling 'Byte' is only 8 bits, so its (unsigned) maximum value is 255 as you'd expect.

255 + 1 = 0. Basically I'm using the overflow behaviour of the small int to accomplish wrap around automatically, where necessary.

Mark-Platts commented 3 years ago

Ah I see, because you declared it as a Byte from the beginning...

Alright, I guess my little extra step is a redundancy now then. :P

colin-broderick commented 3 years ago

I'm about to merge this. You might want to pull from master and test once I have; there was a quite messy merge conflict. I think I've resolved it correctly but ...

Mark-Platts commented 3 years ago

I'll have a look.

Mark-Platts commented 3 years ago

Everything looks fine to me and it still runs my most recent test without issue.

I was hoping to avoid a conflict with the way I did things. I think I'll look up what the standard way to do multiple branches is.

I know I said I'd rather you look at my code, but I'm happy to start doing merges myself if it makes things smoother. I'll just make a note whenever there's something I want your opinion on. :)

colin-broderick commented 3 years ago

I don't think you really did anything wrong. It's just that the code blocks were right next to each other and shared a lot of similar lines so the diff wasn't able to separate them very well.

I think, anyway. I don't particularly understand the details of how it works things out.