;Name: cmp_args.asm
;Description: The program compares the amount of arguments
;passed to the program with a constant number within the program(4)
;Date: 11/28/04

section .data
   
   ;success message
   ep: db 'enough params',10

   ;success message length
   eplen: equ $-ep

   ;failure message
   nep: db 'Not enough params',10

   ;failure message length
   neplen: equ $-nep

section .text
   global _start

_start:

   ;get args from the stack
   pop edx
   ;write sys call
   mov eax,4
   ;default io
   mov ebx,1
   
   ;compare args for 3 + prog name (4 total) 
   cmp edx,4
   ;jump to error equal message					
   jne Perror
   
   ;text to ouput
   mov ecx,ep
   ;lenth of text
   mov edx,eplen
	
exit:

   ;sys call
   int 0x80
   ;clear eax for exit
   xor eax,eax
   ;add one for exit sys call
   inc eax
   ;call kernel interupt
   int 0x80

Perror:

   ;text to output
   mov ecx,nep
   ;text length
   mov edx,neplen
   ;jmp to exit label
   jmp exit

