pzkpfw Posted February 27, 2015 Posted February 27, 2015 (edited) ... Most CPUs out there use 8bit bytes. Well, er, yeah, 8 bit bytes is pretty much by definition. What I was referring to is that the thing being addressed (by a given op code, in a given addressing mode) might not be bytes, it might be words, of whatever word size the particular CPU uses. ... And as the OP is already confused by the simple case ... And adding to his confusion over signed offsets with wrap around makes it simpler? As Sensei belaboured, it'd seldom work the way you described. Edited February 27, 2015 by pzkpfw
Sensei Posted February 28, 2015 Posted February 28, 2015 (edited) It doesn't make any difference whether you consider the offsets as signed or unsigned Please notice that signed short is differently extended to short int, than unsigned short to unsigned int, Unsigned are extended by clearing upper bits 31-16. Signed are extended by populating 15th bit of short. Like I showed in post #24. As Sensei belaboured, it'd seldom work the way you described. After extending 16 bit -> 32 bit (or 64 bit) it would work. Extension might be in code (like in Motorola we were using EXT.L (16->32), or EXT.W (8->16)), or made by CPU internally (so offset is real signed short, it's just different interpretation of 15th bit). Edited February 28, 2015 by Sensei
Thorham Posted February 28, 2015 Posted February 28, 2015 Well, er, yeah, 8 bit bytes is pretty much by definition. Bytes weren't always fixed in size in the past.
Strange Posted February 28, 2015 Posted February 28, 2015 Please notice that signed short is differently extended to short int, than unsigned short to unsigned int, Unsigned are extended by clearing upper bits 31-16. Signed are extended by populating 15th bit of short. Like I showed in post #24. Good point. I overlooked the fact that it is a 16 bit offset to a (presumably) 32 bit address. Bytes weren't always fixed in size in the past. Should we also consider that the offset value might be in BCD?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now