If-else macro in MASM

℡╲_俬逩灬. 提交于 2020-01-03 06:30:08

问题


In MASM, is it possible to create an if...ekse macro (similar to those found in high-level programming languages)? I haven't yet found any kind of if-else statement macro for MASM, but I think a macro for this purpose would be very useful.

It would be useful if I could find a macro to make it easier to write a complicated series of if-statements in masm, as shown here:

;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

回答1:


Nobody reads the manual anymore??? Assembly has been around for YEARS, MASM has been out for YEARS!!! Tons of samples and documentation!!!

For example:

.if eax == 1

.elseif eax !=10

.elseif eax >= 11

.else

.endif

MASM32 contains a case macro...



来源:https://stackoverflow.com/questions/15350651/if-else-macro-in-masm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!