flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Windows > Label inside of repeat block? | 
  
| Author | 
  | 
              
| 
                  
                   revolution 03 Mar 2008, 00:39 
                  Code: rept 4 { @@: ; No more "symbol already defined" error }  | 
              |||
                  
  | 
              
| 
                  
                   AlexP 03 Mar 2008, 01:08 
                  Thank You! (probably one of the simplest question-response's I've seen) 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   AlexP 03 Mar 2008, 01:55 
                  Okay, I'm having troubles with the rept {} macro.  I looked over fasm doc's for it, and it looks like it should work in my code, but now I get an error I've never seen before, "Incomplete Macro". Here's the full code I use:
 
                  
                Code: macro MixColumns state { ; 46*4 instructions rept 4 counter { mov eax,dword[array_r] mov dword[array_a],eax shl al,1 mov [array_b + 0],al jnc @f xor byte[array_b + 0],GF_modulus @@: shl ah,1 mov [array_b + 1],ah jnc @f xor byte[array_b + 1],GF_modulus @@: shr eax,16 shl al,1 mov [array_b + 2],al jnc @f xor byte[array_b + 2],GF_modulus @@: shl ah,1 mov [array_b + 3],ah jnc @f xor byte[array_b + 3],GF_modulus @@: mov al,[array_b + 0] xor al,[array_a + 3] xor al,[array_a + 2] xor al,[array_b + 1] xor al,[array_a + 1] mov [dest + 0],al mov al,[array_b + 1] xor al,[array_a + 0] xor al,[array_a + 3] xor al,[array_b + 2] xor al,[array_a + 2] mov [dest + 1],al mov al,[array_b + 2] xor al,[array_a + 1] xor al,[array_a + 0] xor al,[array_b + 3] xor al,[array_a + 3] mov [dest + 2],al mov al,[array_b + 3] xor al,[array_a + 2] xor al,[array_a + 1] xor al,[array_b + 0] xor al,[array_a + 0] mov [dest + 3],al } } the three array's and the dest array are here, using the counter var: Code: ; procedure constants array_a = Log + ((counter-1)*4) array_b = Alog + ((counter-1)*4) array_r = Temp + ((counter-1)*4) dest = State + ((counter-1)*4) It is part of some other things with GF that I've been experimenting with, but the "incomplete macro" error has me baffled. Until I find out what's wrong, I'll go back to looping for now.  | 
              |||
                  
  | 
              
| 
                  
                   revolution 03 Mar 2008, 02:01 
                  Code: macro MixColumns state { rept 4 counter \{ ..... \} }  | 
              |||
                  
  | 
              
| 
                  
                   AlexP 03 Mar 2008, 02:21 
                  "Undefined symbol counter"
 
                  
                It now does not recognize the counter symbol, the array symbols are working right (changed to "equ" instead of "=").  | 
              |||
                  
  | 
              
| 
                  
                   revolution 03 Mar 2008, 02:25 
                  You have to define your "array_x" variables inside the rept structure. Use "=" not "equ".     
                  
                Code: macro MixColumns state { rept 4 counter \{ array_a = Log + ((counter-1)*4) ...  | 
              |||
                  
  | 
              
| 
                  
                   AlexP 03 Mar 2008, 02:31 
                  Works:
 
                  
                Code: macro MixColumns state { rept 4 counter \{ ; constants ... \} } < Thanks again >  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.