Is there a Select case command (maybe a macro) similar to the one used in C and/or Visual Basic for Assembly programs?
Robert,
In the macros that MASM32 supports there is a very good Switch/Case set of macros written by Greg Falen. I did some aliases so you could use Select/Case as well. You will find the macros in the macros.asm file in MASM32 in the macros directory. just include the macro file after the include files in your project and you can use all of them.
It might be and if there is not ...
I guess writting one is pretty easy
However in MASM and TASM the IF macro is actually a CASE construct when using the ELSEIF variation like that:
mov ebx,[another_variable]
.IF [test_value]==16
; do something here
.ELSEIF [test_value]==27
; some other things
.ELSEIF [test_value]==MY_ACT_MESSAGE
;action based on equates
.ELSEIF [test_value]>39
; as you can se we can have real conditions
; a thing not available in C /C++
.ELSEIF [test_value]<ebx
; now ve can even test against a variable ;)
.ELSE
; here we can do the normal "otherwise" statement
.ENDIF
So you see it is much better than a "simple C" SWITCH statement ...
But i am sure that a macro specialized guy can easyly furfill your apparent need
Quote from: hutch-- on December 22, 2004, 11:33:01 PM
Robert,
In the macros that MASM32 supports there is a very good Switch/Case set of macros written by Greg Falen. I did some aliases so you could use Select/Case as well. You will find the macros in the macros.asm file in MASM32 in the macros directory. just include the macro file after the include files in your project and you can use all of them.
Thanks, hutch. I was too eager to post the message. I found the macros.asm file right after I posted.
Quote from: BogdanOntanu on December 22, 2004, 11:38:55 PM
It might be and if there is not ...
I guess writting one is pretty easy
However in MASM and TASM the IF macro is actually a CASE construct when using the ELSEIF variation like that:
mov ebx,[another_variable]
.IF [test_value]==16
; do something here
.ELSEIF [test_value]==27
; some other things
.ELSEIF [test_value]==MY_ACT_MESSAGE
;action based on equates
.ELSEIF [test_value]>39
; as you can se we can have real conditions
; a thing not available in C /C++
.ELSEIF [test_value]<ebx
; now ve can even test against a variable ;)
.ELSE
; here we can do the normal "otherwise" statement
.ENDIF
So you see it is much better than a "simple C" SWITCH statement ...
But i am sure that a macro specialized guy can easyly furfill your apparent need
Come to think about it you're right. I never really gave any thought to that, I just saw .IF ..... .ELSEIF ..... .ELSEIF ..... .ELSE ...... .ENDIF and left it as that. Thanls for the clue.