News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Using ESP as a general register within a proc

Started by sinsi, May 05, 2007, 07:16:26 AM

Previous topic - Next topic

sinsi

As long as I save and restore ESP and don't use any CALLs nothing will interrupt my proc and stuff up because of ESP?
This was a problem in DOS (INTs interrupting your proc) but Win32 doesn't have this problem does it?
Light travels faster than sound, that's why some people seem bright until you hear them.

hutch--

Yu can use ESP without any problems in win32 as long as you preserve it somewhere, either a global variable or in another type of register. For the obvious reason you cannot use the stack while ESP is in use elsewhere.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

daydreamer

instead of have your timecriticalcode that is speedup by using ESP in main or a proc and need to restore stack alot and easily a cause to crash the app , put that code inside a workerthread which the OS keeps with its own separate set of general regs, you can have the rest of your app do all apicalling and none-timecritical-code