ARTICLE AD BOX
I'm working on an emulator for a z80 based system and have decided to structure my registers like this:
union Reg { uint16 reg_; struct { uint8 hi_; uint8 lo_; }; };The only problem I'm experiencing with this is that when I access those lower level fields, they seem to have the opposite data than what I expect. I never considered the endianness of the host system playing a part here, but is that the case?
For example, in case I'm not very clear, when I create data like so
Reg BC; BC.reg_ = 0x0123;I expect to be able to access the hi byte with BC.hi_ and receive 0x01, but instead I get 0x23. Is this just how data is structured on a low level on modern systems? Or is this something I should check for different systems?
