Jump to content

Book says 16 bits is equivalent to 32,678 bytes

Featured Replies

...

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

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

Well, er, yeah, 8 bit bytes is pretty much by definition.

Bytes weren't always fixed in size in the past.

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

Archived

This topic is now archived and is closed to further replies.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.