hi all,
i'm asking if someone could kindly help me on this:
i need to translate this HLL into asm :)
IF DEBUG
.IF eax == .....
...
...
...
.ENDIF
END IF
That's only couse i prefer to see asm code :)
Thanks ALL!
B7
i'm asking if someone could kindly help me on this:
i need to translate this HLL into asm :)
IF DEBUG
.IF eax == .....
...
...
...
.ENDIF
END IF
That's only couse i prefer to see asm code :)
Thanks ALL!
B7
Afternoon, Bit7
ummm....
It seems that it's already translated:grin: .
The "DEBUG" would just be declared somewhere (I usually put it at the top of the main .asm file just above the "include"s).
i.e.
Then I'd use it in code like so...
Cheers,
Scronty
ummm....
It seems that it's already translated:grin: .
The "DEBUG" would just be declared somewhere (I usually put it at the top of the main .asm file just above the "include"s).
i.e.
.386 ; 386 instruction set
.model flat, stdcall ; 32 bit memory model
option casemap:none ; Case sensitive
; 1 == debugging log is on.
; 0 == debugging log is off
_DEBUGON EQU 1
include \masm32\include\windows.inc
...
Then I'd use it in code like so...
IF _DEBUGON
; write message to the debugging log
invoke SetFilePointer,hDebugFile,0,0,FILE_END
invoke WriteFile,hDebugFile, OUTPUTDEBUGTEXT("prWinMain: Stopped Message Pump.") ,ADDR dwBytesWrittenDF,0
ENDIF
Cheers,
Scronty
You could also do conditional compilation this way, by defining the constant 'DEBUG' on the command line for the compiler. This is one way of making debug builds.
sorry... in this period my brain-pulse-diagram seems to be flat ! (no activity) :)
thanks !!
B7
thanks !!
B7
The most important feature here, not said yet, is that if the condition is false, the code (asm) within the scope of the IF/ENDIF block is not assembled at all!!
This is why its used instead of .if/.else with a memory variable. In this case, true or false, it doesnt matter, its still evaluated at RUN-TIME and has to be compiled into code.
IF/ENDIF blocks are COMPILE-TIME conditionals...
Also, be aware they will play tricks on your head if you use them in a macro, and you get an error report on compile concerning the macro.
ie)
This is just a dumb example, if the error was generated on line 4 of your macro file (and stated as such). Your macro looks like:
So which 4, is 4?? Ive fallen in this trap before, and tried correcting macro code in attempt to figure out the problem, only to realize im hacking up perfectly good code (that was not included in the compile)!! :rolleyes:
:NaN:
This is why its used instead of .if/.else with a memory variable. In this case, true or false, it doesnt matter, its still evaluated at RUN-TIME and has to be compiled into code.
IF/ENDIF blocks are COMPILE-TIME conditionals...
Also, be aware they will play tricks on your head if you use them in a macro, and you get an error report on compile concerning the macro.
ie)
dumb MACRO
mov eax, 3
xor edx, edx
IF DEBUG
mov edx, eax
mov esi, @CatStr( <ed>, <x>)
ELSE
mov edx, ebx
mov edi, SomeOtherMacro( 3 )
ENDIF
ENDM
This is just a dumb example, if the error was generated on line 4 of your macro file (and stated as such). Your macro looks like:
dumb MACRO
1 mov eax, 3
2 xor edx, edx
IF DEBUG
3 mov edx, eax
4 mov esi, @CatStr( <ed>, <x>)
ELSE
3 mov edx, ebx
4 mov edi, SomeOtherMacro( 3 )
ENDIF
ENDM
So which 4, is 4?? Ive fallen in this trap before, and tried correcting macro code in attempt to figure out the problem, only to realize im hacking up perfectly good code (that was not included in the compile)!! :rolleyes:
:NaN:
NAN, thanks for the deep help. Now it's more clear.
B7
B7