Author Topic: tried to use REPT macro with iterator number failing.  (Read 1041 times)

ggmasm32

  • Member
  • **
  • Posts: 51
tried to use REPT macro with iterator number failing.
« on: December 28, 2015, 10:31:30 AM »
Hi Anyone see issue with following? As far as I concerned and according this tutorial
http://users.cis.fiu.edu/~downeyt/cop3402/rept.html, it all looks legitimate code to declare range of variables whose name is:
decsIdt0, descIdt1 and so on.

   i=0   
   REPT    32
   descIdt&i&   db   'int-gate'   
   i=i+1
   ENDM
   ENDIF


This is the compiler error thrown at every iteration:

pmode.asm(152) : error A2008: syntax error : &
 MacroLoop(1): iteration 64: Macro Called From
  pmode.asm(152): Main Line Code
pmode.asm(152) : error A2008: syntax error : &
 MacroLoop(1): iteration 65: Macro Called From
  pmode.asm(152): Main Line Code
pmode.asm(152) : error A2008: syntax error : &
 MacroLoop(1): iteration 66: Macro Called From
  pmode.asm(152): Main Line Code
pmode.asm(152) : error A2008: syntax error : &
 MacroLoop(1): iteration 67: Macro Called From
  pmode.asm(152): Main Line Code
pmode.asm(152) : error A2008: syntax error : &
 MacroLoop(1): iteration 68: Macro Called From
  pmode.asm(152): Main Line Code
pmode.asm(152) : fatal error A1012: error count exceeds 100; stopping assembly
 MacroLoop(1): iteration 69: Macro Called From
  pmode.asm(152): Main Line Code

jj2007

  • Member
  • *****
  • Posts: 7548
  • Assembler is fun ;-)
    • MasmBasic
Re: tried to use REPT macro with iterator number failing.
« Reply #1 on: December 28, 2015, 11:35:29 AM »
   i=0
   REPEAT 32
    @CatStr(<descIdt>, %i, < db   'int-gate'>)
    i=i+1
   ENDM

rrr314159

  • Member
  • *****
  • Posts: 1381
Re: tried to use REPT macro with iterator number failing.
« Reply #2 on: December 28, 2015, 11:38:36 AM »
Hi ggmasm32,

You can also do it this way:

Code: [Select]
i=0   
   REPT    32
    i$ textequ %i
%   descIdt&i$   db   'int-gate'
   i=i+1
   ENDM

I don't know why your reference is wrong, but it is.
I am NaN ;)

ggmasm32

  • Member
  • **
  • Posts: 51
Re: tried to use REPT macro with iterator number failing.
« Reply #3 on: December 28, 2015, 03:10:57 PM »
THANKS YOU!!!