Howdy, Stranger!

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



mr_biologymr_biology Member Posts: 44


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 Member Posts: 390
    : 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 Member Posts: 125
    [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 Member Posts: 756
    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).
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ____ { } free ebooks and video tutorials about || MATLAB Perl Python C# C Assembly Go Scratch JavaScript C++ Swift PHP PL/SQL Ruby Visual Basic .NET Java Visual Basic Delphi R Objective-C Kotlin F# Scala Dart Lua Ada Lisp Awk SAS COBOL LabVIEW Crystal Hack D Transact-SQL Rust ML Fortran Logo Scheme Clojure ABAP Erlang FoxPro VBScript Bash Apex Julia Prolog Alice || ____________

Sign In or Register to comment.