GARTHWILSON wrote:
BigEd wrote:
If there's any remaining lack of clarity once Bruce's doc has been taken into account, then experiment is needed.
I've made a test fixture to exercise the '816 a half cycle at a time to see how it behaves, and allows making choices as to the next course of action based on what it did in each half cycle. It will take time to get it back out and set up, and I can't do it right away; but if you want to list some exact things you would like me to check, and no one beats me to it, I'll try to do it for you. I'm sure many of us would like to know.
That's sounds pretty neat.
I don't have any burning needs, I'm mostly just trying to get some gut check that I'm interpreting things properly. I guess the consensus is that the WDC book simply isn't detailed enough to rely upon at the intimate details, and better to cede to Bruce's document.
When I was doing my 6502 simulator, I was relying on a web based 6502 to vet my assumptions. I could test code in it easily (I think it had an assembler and/or you could just type in simply hex code). It didn't help that I found bugs in their implementation as well. Eventually I was able to run the test suite and get it to pass.
But I don't know of a readily accessible an '816 simulator that's really easy to dabble with.
I would be quite interested to know the cycle counts on 16 bit loads that cross bank boundaries, see if the bank bump eats a cycle or two (it's not really important to me as I don't even keep track of cycles now -- but I'd like to).
Also curious what the chip does when it encounters '816 instructions in emulation mode. Like JMP LONG, the Move instructions, etc. Does it do anything? treat them as NOPs? Partially work? "Undefined"? "Don't do that"?
But for "normal code", that's not an issue. It's reasonable to assume that if you're traipsing through '816 code in emulation mode, your code is "crashing" anyway, so it doesn't matter what it actually does. So, more just trivia knowledge than anything. In the end if the straight forward code I write on my simulator works on the raw chip, I'm happy.
Writing the Addressing code, keeping the bank registers, the page/bank wrapping, the emulation modes all straight -- it warps my Pooh brain. It would probably be easier if I was starting from scratch vs trying to uplift my 6502 simulator. I'm already a bull in a china shop as it is, but, yea, all of the addressing code is getting redone and I have to be careful to not uplift bad 6502 based code, as it makes assumptions that are just not valid anymore.
I already rewrote my Direct stuff twice. Part of the problem was that I call the Direct register the Direct Page register -- and it's not. It has nothing to do with pages. It's a conflation of the idea of Zero Page and Direct, and they're not related. So early on I was taking the Direct register and multiplying it by 256 to get the right "page", then adding the offset.
Nope! Doesn't work like that. There's no alignments whatsoever with the Direct register, rather it's simply bound to bank 0, and wraps at the bank boundary. It doesn't help that Bruce's doc uses the term Direct page as well. I think treating the Direct register as a "big" Zero Page isn't the right way to approach it, and using the DP idiomatically as a frame pointer makes more sense (set D to SP at routine entry, every routine has their own "zero page"). I dunno. It'll all come out in the wash.
So, anyway, walking on eggs writing the addressing code.