registers - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.



How do I know what is the maximum value that I can put
into a register (8-bit, 16-bit, 32-bit and 64-bit)?

And what means 32-bit or 64-bit programming?


  • jeffleydajeffleyda Posts: 390Member
    : Hi..
    : How do I know what is the maximum value that I can put
    : into a register (8-bit, 16-bit, 32-bit and 64-bit)?

    You know primarily from what CPU you're using. 8086, 8088, 80186, 80286 are all 16bit CPUs. All registers are 16bit. You probably won't find any 8bit computers, at least not in the IBM PC compatible world.

    However, a 16bit register can be broken down into TWO 8 bit registers:
    AX in itself is a 16bit registers.
    AH, the HIGH half of AX is an 8bit register.
    AL, the LOW half of AX is also an 8bit registers.

    So if AX=34e1h, AH=34, AL=e1

    Likewise with the BX, CX, and DX registers.

    : And what means 32-bit or 64-bit programming?

    Starting with the 80386 CPU, we were given 32bit registers to play with. All intel did was add an additional 16bits to each of our 4 general purpose registers, and called them EXTENDED registers:

    EAX, EBX, ECX, EDX are all 32bit registers. Just like with a 16bit register, you can still access EAX as AL, AH, AX or EAX. You cannot however access the extended portion of EAX (the upper 16bits) as 8bit values.
    In other words, there is no EAH or EAL, and sometimes I curse intel for not letting me do that!

    The 80486, pentium, xeon, etc are all (at least) 32bit processors.
    64bit processing is a whole different concept, and it's not one that I'm familiar enough with the write about.

    Typically though, 32bit programming often means programming in protected mode or using memory above 1mb, or programming in windows, which is both protected mode and uses memory above 1mb. There are whole tutorials on those subject alone.

    Typically though, every program that I write is a 32bit program simply because the additional storage space that the 32bit registers provide is a useful feature. My program might never be in protected mode or use memory above 1mb, but it's still a 32bit program.

  • emu8086emu8086 Posts: 125Member
    [b][red]This message was edited by emu8086 at 2002-9-27 3:15:41[/red][/b][hr]
    : How do I know what is the maximum value that I can put
    : into a register (8-bit, 16-bit, 32-bit and 64-bit)?

    - just calculate 2 in power of number of bits minus 1.
    for example, if you have 8 bits:

    2 ^ 8 - 1 = 255

    thus the maximum value you can put in 8-bit register is 255.

    General formula:

    2 ^ (number of bits) - 1 = (maximum value)

    : And what means 32-bit or 64-bit programming?

    - when you operate with 32-bit values it's 32-bit programming,
    the same is for 8, 16, 64, 128 bits...

    Actually you can operate with 32-bit values using 16
    bit microprocessor, but this won't be 32-bit programming,
    just a trick.
    True 32-bit programming will be when CPU has support for
    making operations 32-bit values internally (as I see it).

  • blipblip Posts: 756Member
    I see it that if you do use two 16-bit values as one then that is 32-bit procesing, because you're processing a 32-bit number. Just because the 6510 is 8-bit and has only 3 easily accessible registers doesn't mean you can't do 32-bit processing, i.e. handling 32-bit numbers (just hold them in memory, preferably the ZP).
Sign In or Register to comment.