Jump to content

Book says 16 bits is equivalent to 32,678 bytes


DylsexicChciken

Recommended Posts

...

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 by pzkpfw
Link to comment
Share on other sites

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 by Sensei
Link to comment
Share on other sites

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? :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.