1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Simple program in asm.. doesnt work !

Discussion in 'Assembly Language Programming (ALP) Forum' started by tetinger, Nov 25, 2010.

  1. tetinger

    tetinger New Member

    Joined:
    Nov 25, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    section .data ; data section, read-write
    an: DD 0 ; this is a temporary var
    string: db "the result is %s",10,0

    section .text ; our code is always in the .text section
    global main
    extern printf ; tell linker that printf is defined elsewhere ; (not used in


    main:
    pop eax
    pop eax
    push string
    call printf

    proc_exit: ; exiting the program
    mov eax, 1
    int 80h





    i try to print first argument in the command line, and i have a some problems:
    1. the first value on the stack is not the number of arguments, i have to do pop once in order to get the number of arguments..
    2. after i did pop once, i suppose to get to the arguments, but when i try to print the arguments, like you see in the program, it doesnt work, which means that first value in the stack after the number of parameters is not an argument ..

    thanks a lot for whoever willing to help ..
     
  2. livinmanavalan

    livinmanavalan Banned

    Joined:
    Dec 6, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    i think there will be any mistake in your coding. what was your program. you did not mention it in your post. without know your program how can i help you?
     
  3. tetinger

    tetinger New Member

    Joined:
    Nov 25, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Nvm .. i fixed it .. 10x anyway.
     

Share This Page