• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 757
  • Last Modified:

printing an array of Double Word integers in x86 assembly

I set up an array of double words in memory but I do not know how to get them out of memory and print them.  Can any one give me an idea of how to do this or direct me to some good sites to explain working with bigger variables than the register itself.  I know I could probalby use extended registers, but am not very familiar with them.
0
feldmani
Asked:
feldmani
1 Solution
 
WelkinMazeCommented:
Hi,
If you want to work with standard registers then you can handle a double word in two parts. You have to know that the four bytes of a double word a ordered in the memory from less meaningfull to the most meaningful byte. Or speaking in words - the first word in the memory of a double word is the less meaningful word of both.
So if you have a double word at address A in the memory then you have the less meaningful word at address A and the most meaningful word at address A+2. Knowing that and knowing how to work with standard registers you're supposed to do the trick.

btw The extended registers (at least general purpose ones) work like the standard ones. The only difference is that they are bigger.

Hope that helps!
0
 
kjetijoCommented:
If it's a string you want to print out, you could use int 21h with ah = 09. Then you're printing out directly from memory ds:dx untill you hit a $-sign (ascii-code 24h). Unless it's a string you're planing on writing out, I don't know how you would do it.

But anyway how you do it, I do belive you should know how the double words are stored in memory. If you have the double word 1234abcdh, it will be stored in memory like this:

adress   value
1000       cd
1001       ab
1002       34
1003       12

So the bytes are reversed. If you however have an array of double words, only the specific double words are reveresd, not the array. So if you had three doublewords: 11223344h, AABBCCDDh and 1234ABCDh in an array, they would be stored like this:

adress value
1000    44
1001    33
1002    22
1003    11
1004    DD
1005    CC
1006    BB
1007    AA
1008    CD
1009    AB
100A    34
100B    12

If you know a quick way of printing things out of registers, you could probably use the knowledge of how things are stored in memory, and the 'mov ax, [variable+bx]' command to read from memory, and write them out of the ax-register.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now