flat assembler
Message board for the users of flat assembler.

Index > Windows > Label inside of repeat block?

Author
Thread Post new topic Reply to topic
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
I'm not allowed to use generic labels (or any labels at all!) inside of a repeat block, is there any way around it?
Code:
repeat 4
@@: ; "symbol already defined" error
end repeat
    
Post 02 Mar 2008, 18:39
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17277
Location: In your JS exploiting you and your system
revolution
Code:
rept 4 {
@@: ; No more "symbol already defined" error
}    
Post 03 Mar 2008, 00:39
View user's profile Send private message Visit poster's website Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
Thank You! (probably one of the simplest question-response's I've seen)
Post 03 Mar 2008, 01:08
View user's profile Send private message Visit poster's website Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
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.
Post 03 Mar 2008, 01:55
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17277
Location: In your JS exploiting you and your system
revolution
Code:
macro MixColumns state {
 rept 4 counter
  \{
.....
  \}
}    
Post 03 Mar 2008, 02:01
View user's profile Send private message Visit poster's website Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
"Undefined symbol counter"
It now does not recognize the counter symbol, the array symbols are working right (changed to "equ" instead of "=").
Post 03 Mar 2008, 02:21
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17277
Location: In your JS exploiting you and your system
revolution
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)
...    
Post 03 Mar 2008, 02:25
View user's profile Send private message Visit poster's website Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
Works:
Code:
macro MixColumns state {
    rept 4 counter 
    \{
       ; constants
       ...
    \}
}
    


< Thanks again >
Post 03 Mar 2008, 02:31
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.