Hello!

I know that it is at least ugly to ask others to do the work for you, but I just have no time for this morning and I have no chance to deal with it ...

So assembler, tasm .

Given 2 vectors of this type:

 n1 dw 6,2,1,3,1,1 n2 dw 2,1,2,1,4,3 

you need to write code that summarizes the elements of these 2 vectors in pairs, and writes the result to 3 vector.

that is, you need to display something like:

 n3 8, 3, 3, 4, 5, 4 

Help at least by sketching ...

  • The sketch, alas, did not work out - everything is so simple here that it’s not clear how you can’t figure it out with such an elementary thing, it's the basics, an ABC book ... - user6550
  • Hmm, your code really looks very simple ... - Neamtu Daniel


1 answer 1

Something like this:

 .DATA n1 dw 6,2,1,3,1,1 n2 dw 2,1,2,1,4,3 n3 dw 0,0,0,0,0,0 .CODE lea ebx, n1 lea edx, n2 lea edi, n3 mov ecx, 6 push ds ; для stosw pop es r: mov ax, [ebx] add ax, [edx] ; переполнение не отслеживаем stosw add ebx, 2 ; inc ebx/inc ebx add edx, 2 ; inc edx/inc edx loop r 
  • I can’t compile it in any way, I added the initial .model small .stack 100h and at the end end. And the compiler swears about the unexpected end of file encountered, and I can’t understand how the computer will exit the loop r loop? - Neamtu Daniel
  • Then, even .386 in the beginning does not hurt. And about the loop - you did not try to read the textbooks, since this is clearly an educational task? If the paper is very tight, then there is online, but at least here . - user6550