flat assembler
Message board for the users of flat assembler.
Index
> Main > if ..... |
Author |
|
crc 09 Oct 2004, 13:04
IF is processed before the assembly takes place. I don't think that you can check the value of a variable at the preprocessing stage.
|
|||
09 Oct 2004, 13:04 |
|
wishmaster 09 Oct 2004, 13:14
Is there a way to check the value of a variable ? TASM supports that.
|
|||
09 Oct 2004, 13:14 |
|
Matrix 09 Oct 2004, 13:34
don't use post processor for that Code: ; you can say this is a character table writer program, ; but its destination is to demonstrate using a simple variable in FASM ; MATRIX ; oh, i have discovered it is 32 bytes org 256 and word [testvar],0 mov ax,$b800 push es mov es,ax mov ah,$07 mainloop: stosw inc word [testvar] mov al,byte [testvar] cmp word [testvar],255 jb mainloop ; if [testvar] <= 50 then goto mainloop pop es int 20h testvar: rw 1 MATRIX |
|||
09 Oct 2004, 13:34 |
|
crc 09 Oct 2004, 13:50
I think you could do something like:
Code: abc_value = 5 abc db abc_value if abc_value < 6 . . . then Just out of curiosity, why do you need to check the value of a variable during the preprocessing time? |
|||
09 Oct 2004, 13:50 |
|
Tomasz Grysztar 09 Oct 2004, 20:29
crc: what you've done it's better to do this way:
Code: abc db 5 load abc_value from abc if abc_value < 6 ; ... end if However it seems that it's just the ".if" macro what wishmaster is looking for, to generate the code that will do the checking of the variable at the run time. |
|||
09 Oct 2004, 20:29 |
|
wishmaster 10 Oct 2004, 11:03
Thank you, that works well
|
|||
10 Oct 2004, 11:03 |
|
Dragontamer 10 Oct 2004, 23:59
Just wanna make sure you know...
the if statement will always be true. It is a PREPROCESSOR statement. I agree with Privalov, the ".if" macro is what you want. What I would use, is the conditional jumps. But thats just me. |
|||
10 Oct 2004, 23:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.