flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Converting macro from masm |
Author |
|
prana 04 Oct 2003, 06:16
I was testing it like this:
____________________________________ macro return { ___ret =$ ret } macro rz { push ax mov al,126 cmp al,($-___ret) jnz $+3 ___ret =$ ret jz ___ret } org 100h main: mov al,0 cmp al,0 rz __________________________________________________ However, running this program causes an NTVDM error. Any help? |
|||
04 Oct 2003, 06:16 |
|
Tomasz Grysztar 04 Oct 2003, 10:20
You can compare two absolute values at the assembly time, like "if $-__ret>126", and the run-time comparision makes completely no sense for such kind of macro. However, even the original macro for masm seems a bit wrong for me, but I'm not sure how masm will react for such ambiguous situations, when you try to check value of some constant that was not defined yet in a way to determine whether define it or not (fasm won't let you do such things, because they are creating a mess). The correct version for fasm should look like:
Code: macro return { ___ret = $ ret } macro rz { if defined ___ret if $-___ret > 126 jnz $+3 ___ret = $ ret else jz ___ret end if else jnz $+3 ___ret = $ ret end if } |
|||
04 Oct 2003, 10:20 |
|
prana 04 Oct 2003, 20:16
yes, got it!
Thanks boss! However I missed the last "ret " in my previous posting: It was like: ______ ....... ..... org 100h main: mov al,0 cmp al,0 rz ret _____________ Thanks! |
|||
04 Oct 2003, 20:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.