what is macro?

well i usualy program in assembler only the body part.
now since i need to tanslate a code to pascal and i found few things i havent know.

how macro and external segment declared. do macro is like union in c?
external segment - it is pritty much obvius what is it, but how does it declared?

more info about these would pritty much helpful

thank you
dolev

Comments

  • : well i usualy program in assembler only the body part.
    : now since i need to tanslate a code to pascal and i found few things i havent know.
    :
    : how macro and external segment declared. do macro is like union in c?
    : external segment - it is pritty much obvius what is it, but how does it declared?
    :
    : more info about these would pritty much helpful
    :
    : thank you
    : dolev
    :
    [green]
    Macro is similiar to a function, however, a macro injects the code into the location specified while a function is called.
    [/green]

  • thank you, it is good general info but ill be glad to recieve more info including a small example with explenations.

    thanks
    dolev
  • : thank you, it is good general info but ill be glad to recieve more info including a small example with explenations.
    :
    : thanks
    : dolev
    :

    [code]
    ;FASM Macro

    macro Add2Numbers var1, var2
    {
    mov ax, var1
    mov dx, var2 ;this code is put in every time it is used
    add ax, dx
    }

    ;Now used

    Add2Numbers 12, 32 ;add 12 and 32
    [/code]

    [code]
    ;FASM Subroutine

    mov ax, 12
    mov dx, 32
    call Add2Numbers ; cs:ip=Add2Numbers

    Add2Numbers:
    add ax, dx
    ret ;this code is not copied all the time like a macro

    [/code]

  • thanks - macro is a great tool.

    now i understand it better.

    dolev
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories