I am trying to copy an variables into an array

0ptimus

I am trying to copy variables and paste it to my array. The way I am trying to do is following but my emulator is giving me an error saying wrong parameters. How can I do that. Assuming that there are values already in count_a and count_b

.model

.data

frequency dw dup(0)

count_a   dw ?

count_b   dw ? 

.code

mov bx,[frequency]     ;Effective Address of Frequency in bx

   mov [bx],count_a

   add bx,2

   mov [bx],count_b

end
Jose Manuel Abarca Rodríguez

You can't copy memory to memory (one variable to another variable), you will have to use a register in the middle, like this:

.model

.data

frequency dw dup(0)

count_a   dw ?

count_b   dw ? 

.code

   mov bx,[frequency]     ;Effective Address of Frequency in bx

   MOV DX,count_a
   mov [bx],DX

   add bx,2

   MOV DX,count_b
   mov [bx],DX

end

It's not allowed to move data from count_a to [bx], so we can use DX (or any other register) to store the value and pass it from one memory location to the other.

By the way, "mov bx,[frequency]" is not the effective address of frequency, this is:

lea bx, frequency

Now BX contains the effective address of frequency, thanks to "lea" instruction. Another way:

mov bx, offset frequency

What you were doing with "mov bx,[frequency]" was transfering the first two bytes of the array frequency to bx.

One last comment: "frequency" doesn't look like an array, it should be:

frequency dw 256 dup(0)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

I am trying to copy an variables into an array

From Dev

I am trying to load variables in an array

From Dev

I am trying to copy the data of one array to another array

From Dev

i am trying to make a array of a object in php

From Dev

Trying to access the instance variables of the class that I am calling a class method on

From Dev

I am trying to figure out what these temporary variables mean

From Dev

What am i doing wrong in trying to set these instance variables?

From Dev

I am trying to convert a string of words into an array with the spaces included

From Dev

I am getting undefined while trying to pass array to a class

From Dev

Vuejs, I am trying to do a push of a subobject to an array

From Dev

Trying to copy contents of array

From Dev

I am trying to copy a entire website e-commerce system locally, How do i do it?

From Dev

I am trying to Implement Afnetworking in my project without pod just copy paste the files in my project but it is not working

From Dev

I am trying to reference a merged cell on one worksheet and have it copy over into the next sheet

From Dev

I am trying to create a socket in python 3 but i get this error, even when i copy code stragte from the web

From Dev

I am trying to set different markers to an array of addresses. I want a separate infowindow for each. I am not getting infowindows

From Dev

I am trying to crawl a website using scrapy and storing the scraped data into variables of item class

From Dev

In R, I am trying to loop through variables of lists and pull out a specific index from each one

From Dev

I am trying to crawl a website using scrapy and storing the scraped data into variables of item class

From Dev

What am I missing in trying to pass Variables in an SSIS Execute SQL Task?

From Dev

C++ Catch and throw: I am trying to an integer array and it is not catching the array properly

From Dev

New in reactJS, i am trying to adding an item in array by clicking on button . but could not fetch changed array

From Java

I'm trying to return details of an array, but I am returning zeros instead

From Dev

I am trying to search up to the right diagonally in my multidimensional array in java. Why am I getting index out of bounds error?

From Dev

Why do I get a segmentation fault when trying to copy an array from stdin to a 2d array?

From Dev

Trying to copy file from desktop to usr/share/audacious/skins using terminal. What am I doing wrong?

From Dev

Why am I getting a Compiler error stating that my variables are undefined when I pass an array by reference?

From Dev

i am trying to read a file and store the contents of file into three different array

From Dev

I am trying to add user input from the second form with title, description to my Data array but can't

Related Related

  1. 1

    I am trying to copy an variables into an array

  2. 2

    I am trying to load variables in an array

  3. 3

    I am trying to copy the data of one array to another array

  4. 4

    i am trying to make a array of a object in php

  5. 5

    Trying to access the instance variables of the class that I am calling a class method on

  6. 6

    I am trying to figure out what these temporary variables mean

  7. 7

    What am i doing wrong in trying to set these instance variables?

  8. 8

    I am trying to convert a string of words into an array with the spaces included

  9. 9

    I am getting undefined while trying to pass array to a class

  10. 10

    Vuejs, I am trying to do a push of a subobject to an array

  11. 11

    Trying to copy contents of array

  12. 12

    I am trying to copy a entire website e-commerce system locally, How do i do it?

  13. 13

    I am trying to Implement Afnetworking in my project without pod just copy paste the files in my project but it is not working

  14. 14

    I am trying to reference a merged cell on one worksheet and have it copy over into the next sheet

  15. 15

    I am trying to create a socket in python 3 but i get this error, even when i copy code stragte from the web

  16. 16

    I am trying to set different markers to an array of addresses. I want a separate infowindow for each. I am not getting infowindows

  17. 17

    I am trying to crawl a website using scrapy and storing the scraped data into variables of item class

  18. 18

    In R, I am trying to loop through variables of lists and pull out a specific index from each one

  19. 19

    I am trying to crawl a website using scrapy and storing the scraped data into variables of item class

  20. 20

    What am I missing in trying to pass Variables in an SSIS Execute SQL Task?

  21. 21

    C++ Catch and throw: I am trying to an integer array and it is not catching the array properly

  22. 22

    New in reactJS, i am trying to adding an item in array by clicking on button . but could not fetch changed array

  23. 23

    I'm trying to return details of an array, but I am returning zeros instead

  24. 24

    I am trying to search up to the right diagonally in my multidimensional array in java. Why am I getting index out of bounds error?

  25. 25

    Why do I get a segmentation fault when trying to copy an array from stdin to a 2d array?

  26. 26

    Trying to copy file from desktop to usr/share/audacious/skins using terminal. What am I doing wrong?

  27. 27

    Why am I getting a Compiler error stating that my variables are undefined when I pass an array by reference?

  28. 28

    i am trying to read a file and store the contents of file into three different array

  29. 29

    I am trying to add user input from the second form with title, description to my Data array but can't

HotTag

Archive