! This is the start-off routine for libfndn. It's job is to take the arguments
! as put on the stack by EXEC, and to parse them and set them up the way main
! expects them.

	.extern	main, exit
	.text
	.globl	_main
_main:
	xor	bp, bp			! clear for backtrace of core files
	mov	bp, sp
	mov	ax, [bp]		! argc
	lea	bx, [bp + 2]
	mov	cx, [bx]		! file
	add	bx, #4			! argv
	lea	dx, [bp + 4]
	add	dx, ax
	add	dx, ax			! envp
	push	dx			! push envp
	push	bx			! push argv
	push	cx			! push file
	call	main			! main(file, argv, envp)
	push	ax			! push exit status
	call	exit
