flat assembler
Message board for the users of flat assembler.

Index > Main > repeat macro + @@

Author
Thread Post new topic Reply to topic
Fr3m3n



Joined: 21 Apr 2006
Posts: 5
Fr3m3n 03 Jul 2006, 05:34
Hello. I'm working on disassembler-it's opcode base is single linked list.
However, even if some nodes are same, i cant use repeat macroinstruction...
Consider this code:
Code:
@@:
;40          INC EAX-INC EDI 47
repeat 7
dw SPECIAL ;opcode flags
db @f-$
db 3,'INC'
DW SPECIAL_CPU_REG_IN_OPCODE_0
@@:
end repeat
    

When try to assemble, i got an error:
'Error: Symbol already defined'
'Instruction: @@'

Is this a bug? If not, what macroinstruction should i use to get equivalent code? Or, maybe dont possible?
Post 03 Jul 2006, 05:34
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 03 Jul 2006, 08:27
REPEAT is not a macro, REPT is.
Code:
@@:
;40          INC EAX-INC EDI 47
rept 7
{
dw SPECIAL ;opcode flags
db @f-$
db 3,'INC'
DW SPECIAL_CPU_REG_IN_OPCODE_0
@@:
}    


The REPEAT only repeats interpreting the given lines by the assembler (and thus the given @@ is still the same label, as this is still the same line). The REPT produces the new lines that are later interpreted.

See this if you've got some time for reading (and the manual, of course).
Post 03 Jul 2006, 08:27
View user's profile Send private message Visit poster's website Reply with quote
Fr3m3n



Joined: 21 Apr 2006
Posts: 5
Fr3m3n 03 Jul 2006, 16:09
Thanks! Smile
Post 03 Jul 2006, 16:09
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.