I'm learning AT&T syntax assembly, and as a little exercise want to write a program that outputs the number of command line arguments [including program name].
As I understand it, the number of args [argc to C gurus] is the first value to be pushed to the stack when a program executes?
Here's what I have so far:
It compiles and runs fine, but nothing visible is output. I think it might have something to do with sys_write not outputting numbers, so that's why I used an ascii var [argnum], with no avail.Code:.section .data argnum: .ascii "" .section .text .globl _start _start: movl $4, %eax movl $1, %ebx movl (%esp), %edx movl %edx, argnum movl argnum, %ecx movl $2, %edx int $0x80 movl $1, %eax xorl %ebx, %ebx int $0x80