# ASMIX Commands and Utilities
# (c) Sergei Zubkov (Cubbi) 1999-2001
#
# pwd.s - Print working directory
# 
# $Id: pwd.s,v 1.1 2001/09/29 13:33:21 cubbi Exp $

	.globl _start
_start:
	pushl	$1024
	pushl	$linux_buffer
	movl	$326,%eax
	pushl	%ebx
        int     $0x80
	addl	$12,%esp
        testl   %eax,%eax
        jnz	error_exit
        xorl    %eax,%eax
        xorl    %ecx,%ecx
        decl    %ecx
        movl    $linux_buffer,%edi
        repne
        scasb
        subl    $linux_buffer,%edi
        movb    $0x0A,linux_buffer(%edi)
        incl    %edi
        pushl	%edi
	pushl	$linux_buffer
        pushl	$1
        movl    $4,%eax
	pushl	%ebx
        int     $0x80
	addl	$16,%esp
	xorl	%eax,%eax
error_exit:
	pushl	%eax
	movl	$1,%eax
	pushl	%ebx
	int	$0x80

	.bss
	.lcomm linux_buffer,1024
