在MASM中,是否可以創建if ... ekse宏(類似於高級編程語言中的那些宏)?我還沒有找到任何一種MASM的if-else語句宏,但我認爲爲此目的的宏將非常有用。MASM中的If-else宏
這將是有用的,如果我能找到一個宏,使其更易於編寫一系列複雜的MASM if語句中,如下所示:
;jump to each case here
checkCase1:
cmp theVariable, 5;
jne case1;
checkCase2:
cmp theVariable, var2;
jne case2;
jmp defaultCase; do this if no other statement is true
;each of the cases are handled here
case1:
;handle case 1
jmp checkCase2; //check whether case 2 is true
case2:
handle case 2
jmp endOfStatement;
defaultCase:
;this is the default case
endOfStatement:
;this is the end of the statement
,我貼的作用更像一個if ... else if ... else語句不是一個switch語句的例子。 – 2013-03-11 23:37:19
我不確定是否可以編寫一個可以接受可變數量參數的MASM宏。也許寫一個簡單的if ... else宏會更容易。 – 2013-03-11 23:40:21