#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    47
    Rep Power
    7

    Why split the temporary registers?


    I recently started digging into assembly programming, mainly out of curiosity and to broaden the understanding of what's actually going on under the hood. I'm currently studying mips, and there is this little mystery that I haven't seen addressed anywhere - why are the temporary registers split in two groups, in the register use convention? First $t0-$t7 in $8-$15, then some other varieties, and then you get two more t's in $24-$25. Is there any particular reason for this or did it just happen to end up that way?
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    I have no idea, but I'm sort of curious now, so if you ever find out post back and let me know.

    It's possible that in older RISC machines $24 and $25 were reserved for some special purpose that became obsolete so they changed the convention to temp registers.

    It's also possible that $24 and $25 are essentially reserved for some future special purpose.

    Or perhaps they are simply left overs spots that they defined as temporary registers because they had nothing else to do with them after having allocated all of the necessary special registers.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    I'm not an expert in assembly and my memory of college assembly class could be horribly wrong but...

    $0,$1 - hi/lo
    $2,$3 - returns
    $4-$7 - args
    $8-$15 - general-purpose

    There ends the definition of the 4-bit addressing space. Once we made 8-bit processors we were able to extend it with:
    $16-$23 - preserved registers

    Starting from the big-end so the instructions are easy to identify (all 1s are return location)
    $31 - return storage
    $30 - frame pointer
    $29 - stack pointer

    $24,$25 - Extra space, may as well give the programmer two more general purpose registers

    Just a theory combined with a vague memory.

    -Dan
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo