Results 1 to 7 of 7
  1. #1
    ????????????????????????? Doomulation's Avatar
    Join Date
    Nov 2001
    Location
    ????????????????
    Posts
    8,780

    Special registers

    Messing around with assembly, I seem to be confused about ebp and esp. What are these two registers function? I know they are general purpose, but typically vc++ uses them for its own purpose.
    I thought ebp was the stack pointer, but when I push something onto the stack, I see esp changes! Am I wrong?

    It also seems it is much faster to read/write to memory rather than the stack. At least due to my tests. Is it supposed to be like that?

    Atashi wa juu-yon-sai no onna no ko! Atashi no namae wa Miizuki. Yurushiku ne!
    Nani? Atashi o shinjirimasen desu ka? Baka!
    "You're all doomed! Doomed, I say! Hehe... are we approaching the end of the world?"

    shikata ga kaite aru - "the instructions are written above"
    Need to download GoodN64 or instructions to use it? Need to check if it's a good or bad rom?
    Download: Glide64 | Hacktarux's wrapper


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2

  3. #3
    Moderator
    Join Date
    Nov 2001
    Posts
    256
    ESP is stack register
    EPB is used for a stack frame .. basicly stores the stack location at the start of the function that way it can always know where a variable is stored in the stack cause it will be in a set position from its starting point.

    in function a .. var bcd would be at something like ebp - 4 .. so no matter where the stack pos is .. that variable is always constant

  4. #4
    ????????????????????????? Doomulation's Avatar
    Join Date
    Nov 2001
    Location
    ????????????????
    Posts
    8,780
    Well, that's a bother. That means there are only 6 general purpose registers to use...
    Unless I use shifting and bit manipulating to fully use each bit of the 32-bit registers.
    Atashi wa juu-yon-sai no onna no ko! Atashi no namae wa Miizuki. Yurushiku ne!
    Nani? Atashi o shinjirimasen desu ka? Baka!
    "You're all doomed! Doomed, I say! Hehe... are we approaching the end of the world?"

    shikata ga kaite aru - "the instructions are written above"
    Need to download GoodN64 or instructions to use it? Need to check if it's a good or bad rom?
    Download: Glide64 | Hacktarux's wrapper

  5. #5
    Moderator
    Join Date
    Nov 2001
    Posts
    256
    You are free to use ESP and EBP .. I once played with it with pj64 recompiler, but VC had a spack if ESP was not pointing to valid memory.

    You can use EBP, but if it is inlined asm, then it needs to be saved and restored

  6. #6
    EmuTalk Member
    Join Date
    Jan 2006
    Posts
    192
    Well, you can use EBP freely in a routine, without pushing/poping, if you don't mix C and asm (pure inline asm) in that routine. I haven't profiled the speed results, as I always used it for size optimizations. When using ebp VisualC will generate a warning that you can safely ignore. About ESP, if you're using the stack for something in that routine, it's better to use it only to index the stack.

  7. #7
    ????????????????????????? Doomulation's Avatar
    Join Date
    Nov 2001
    Location
    ????????????????
    Posts
    8,780
    You can check omit framepointers in the config to make vc ignore the ebp register unless necessary. But you had better not touch esp unless you know what you're doing.
    Atashi wa juu-yon-sai no onna no ko! Atashi no namae wa Miizuki. Yurushiku ne!
    Nani? Atashi o shinjirimasen desu ka? Baka!
    "You're all doomed! Doomed, I say! Hehe... are we approaching the end of the world?"

    shikata ga kaite aru - "the instructions are written above"
    Need to download GoodN64 or instructions to use it? Need to check if it's a good or bad rom?
    Download: Glide64 | Hacktarux's wrapper

Similar Threads

  1. Gekko CPU Registers?
    By emuexpert in forum Dolwin
    Replies: 1
    Last Post: April 26th, 2005, 00:37
  2. Anything special for Zelda?
    By Evil Dragon in forum Dolphin
    Replies: 5
    Last Post: February 3rd, 2004, 13:55
  3. Optimizing in the dynamic recompilation!
    By Norlin in forum Mupen64
    Replies: 2
    Last Post: February 9th, 2003, 10:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •