Declaring local variables in assembly
- by dcmoebius
Is it possible to allocate locally-scoped memory in assembly?
For example, consider the following (completely contrived) situation:
I have two macros, one of which is dependent on the other. The first is:
minimum MACRO dest, num1, num2
; Finds the minimum of two unsigned numbers, stores the result in dest
And the second is:
tripMin MACRO dest, num1, num2, num3
; Finds the minimum of three unsigned numbers, stores the result in dest
minimum firstMin, num1, num2
minimum secondMin, num2, num3
minimum dest, firstMin, secondMin
(I know that this isn't a realistic example for a variety of reasons, but bear with me.)
Assuming that all the registers are otherwise occupied, is there any way to declare firstMin and secondMin locally within the macro?
Or am I just better off freeing a register by pushing its value onto the stack and popping it back when I'm done?