flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 19 Jun 2007, 03:02
Unfortunately there is no .break provided. However is possible to workaround this problem
Code: .while TRUE ; blah .if eax = 10 jmp .exitWhile .endif ; .blah .endw .exitWhile: As for the second code can you explain more detailed what you want? Perhaps define the dword and assign the value to the assembly-time variable at the same time? If that is the case then this should do the work Code: macro dd [value]{ forward if 1 match var==val, value \{ dd val var = val else \} dd value end if } Example Code: a = 1 b = 2 c = 3 p = 4 q = 5 r = 6 s = 7 dd a,b,c,p=3,q,r,s,x=5,y=1,z=100 display a+'0', ';', p+'0', ';', x+'0' Displays "1;3;5" |
|||
![]() |
|
ssp 19 Jun 2007, 04:33
Thanks LocoDelAssembly.
That was very childish of you! I myself could have figured out the first alternative suggested by you, but I wanted to do it exactly as I wrote. The second one is nice, but it would be nicer if it were included in the standard macros. _________________ From: Sandeep |
|||
![]() |
|
ssp 20 Jun 2007, 02:41
I did the following and it works:
Code: ; inside if.inc macro .while [arg] { common local ..while __WHILE equ ..while local ..endw __ENDW equ ..endw .break equ jmp ..endw ; Updated. __WHILE: JNCOND __ENDW,arg } ; and now I can do this mov ebx, 10 .while ebx invoke MessageBox,0,'Ping!',0,0 dec ebx .if ebx < 8 .break .endif .endw fasm is great! |
|||
![]() |
|
LocoDelAssembly 20 Jun 2007, 03:06
In that way if you have nested .while loops, any .break occurence will jump to the last .endw issued
Code: .while ebx . . .break ; ok . . .while eax . . .endw . . .break ; bad, jumps to the end of the ".while eax" . . .endw Aditionally, after defining a .while loop, .break becomes always available and jumps to the last .endw issued In case you want to add real ".break .if cond" support you can use match directive to automatically convert it to .if cond/.break/.endif. Add to .endw macro "restore .break" |
|||
![]() |
|
ssp 20 Jun 2007, 03:29
Thanks LocoDelAssembly for your suggestions.
I'll try to improve it and make it nestable. |
|||
![]() |
|
ssp 21 Jun 2007, 06:14
I did this in IF.INC:
Code: macro .while [arg] { common local ..while __WHILE equ ..while local ..endw __ENDW equ ..endw .break equ jmp ..endw .continue equ jmp ..while __WHILE: JNCOND __ENDW,arg } macro .endw { jmp __WHILE __ENDW: restore __ENDW restore __WHILE restore .break restore .cotinue } And now I have nestable .break and .continue ![]() |
|||
![]() |
|
kohlrak 21 Jun 2007, 06:27
Perhaps this could get checked and go into the list of unofficial fasm addon macros.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.