0

I have some symbols, such as "S", "A", "N", "D". How can I put them in a string(length 20) using the loop? For example: SANDSANDSANDSANDSAND

If you know how to do that, please help me.

  • 1
    What do you mean "the" loop? There's more than 1 way to loop in assembly. (Also, every architecture has its own assembly language, and you haven't said which one.) In NASM syntax for x86, one "fun" way would be `mov eax, "SAND"` / `mov ecx, 20>>2` / `rep stosd` to store 5 repeats of EAX, to memory pointed-to by EDI, incrementing it as you go. (So you set EDI to point to where you want to store.) Is that the kind of thing you're looking for? – Peter Cordes Jun 03 '22 at 06:34
  • Since you didn't say what ISA you were looking for, I found a duplicate for one that happened to be Z80. [How to write two bytes to a chunk of RAM repeatedly in Z80 asm](https://stackoverflow.com/q/57483503) - that's rather obscure and hard to read if you're used to more modern machines, unfortunately, so it's not a great illustration of the general idea. I'm mostly closing this because it's unanswerable without saying something about the ISA, or whether your input pattern is a constant or runtime-variable. – Peter Cordes Jun 03 '22 at 07:20
  • architecture TASM – Golden Shadow Jun 03 '22 at 14:23

0 Answers0