Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Simple program in asm.. doesnt work ! (http://www.go4expert.com/forums/simple-program-asm-doesnt-t23995/)

tetinger 26Nov2010 02:28

Simple program in asm.. doesnt work !
 
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 ..

livinmanavalan 6Dec2010 17:04

Re: Simple program in asm.. doesnt work !
 
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?

tetinger 6Dec2010 17:17

Re: Simple program in asm.. doesnt work !
 
Nvm .. i fixed it .. 10x anyway.


All times are GMT +5.5. The time now is 06:52.