How can I print array in Assembly

Movart

I want to print result array, which has 3000 elements. I wrote this code:

.intel_syntax noprefix
.text
.globl main
main:
mov ecx, 3000
mov edx, offset result
llp:

mov al,[edx]
push eax
mov eax, offset message
push eax
call printf
add esp, 8
inc edx

loop llp
mov eax, 0
ret

.data
message : 
.asciz " Wynik: %i\n"

The problem is, that program prints only first element 3000 times. What should I change?

UPDATE

solved

Jester

ecx and edx are caller-saved registers, meaning they can be freely used in called functions such as the printf. You are lucky you even got 3000 items printed. One possible solution is to save and restore those registers using the stack around the call printf:

llp:

mov al,[edx]
push ecx
push edx
push eax
mov eax, offset message
push eax
call printf
add esp, 8
pop edx
pop ecx
inc edx

loop llp

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I print 0 to 100 in assembly language in emu 8086?

From Dev

How can i print characters diagonal with loop in assembly

From Dev

How can I print the lowest key of an array?

From Dev

How can I print an associative array as a matrix

From Dev

How can I print a multidimensional array in Perl?

From Dev

How can I print the lowest key of an array?

From Dev

how I can print an array as a vector form

From Dev

How can I save an array to UserDefaults, and then retrieve that array and print

From Dev

How can this assembly program print "Hello World"?

From Dev

How can I print how many bytes has been read to console with Assembly?

From Dev

x86 assembly language: how can I print a hex register value as decimal output?

From Dev

How can I print this?

From Dev

print elements of array in assembly

From Dev

How can I print the value of the lowest key of an array?

From Dev

How can i print a database query to a javascript array?

From Dev

How can I compare array value and print it if matches?

From Dev

How can I return a char array and print it in main?

From Dev

How can I print my array in a certain way?

From Dev

How can I print the contents of an array alongside it's position?

From Dev

How can i print my array and my histogram on the same line?

From Dev

How can I print text with spaces from array?

From Dev

How can I print multiple elements from an array inJavaSCript?

From Dev

How can I print a one dimensional array as grid in Python?

From Dev

How can I print all content of an array in one line?

From Dev

How can I set a specific set of numbers in an array/matrix to print?

From Dev

How can I compare array value and print it if matches?

From Dev

How can i print json objects and array values?

From Dev

How can I print a String array with reflection with quotation marks in java

From Dev

How can i print multidimensional array like this in php?

Related Related

  1. 1

    How can I print 0 to 100 in assembly language in emu 8086?

  2. 2

    How can i print characters diagonal with loop in assembly

  3. 3

    How can I print the lowest key of an array?

  4. 4

    How can I print an associative array as a matrix

  5. 5

    How can I print a multidimensional array in Perl?

  6. 6

    How can I print the lowest key of an array?

  7. 7

    how I can print an array as a vector form

  8. 8

    How can I save an array to UserDefaults, and then retrieve that array and print

  9. 9

    How can this assembly program print "Hello World"?

  10. 10

    How can I print how many bytes has been read to console with Assembly?

  11. 11

    x86 assembly language: how can I print a hex register value as decimal output?

  12. 12

    How can I print this?

  13. 13

    print elements of array in assembly

  14. 14

    How can I print the value of the lowest key of an array?

  15. 15

    How can i print a database query to a javascript array?

  16. 16

    How can I compare array value and print it if matches?

  17. 17

    How can I return a char array and print it in main?

  18. 18

    How can I print my array in a certain way?

  19. 19

    How can I print the contents of an array alongside it's position?

  20. 20

    How can i print my array and my histogram on the same line?

  21. 21

    How can I print text with spaces from array?

  22. 22

    How can I print multiple elements from an array inJavaSCript?

  23. 23

    How can I print a one dimensional array as grid in Python?

  24. 24

    How can I print all content of an array in one line?

  25. 25

    How can I set a specific set of numbers in an array/matrix to print?

  26. 26

    How can I compare array value and print it if matches?

  27. 27

    How can i print json objects and array values?

  28. 28

    How can I print a String array with reflection with quotation marks in java

  29. 29

    How can i print multidimensional array like this in php?

HotTag

Archive