In this task, the job is to create a new empty file called "output.txt" of size 0 bytes
and an empty directory called "docs". This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.

global _start
 
: syscall ( num:eax -- result:eax ) syscall ;
 
: exit ( status:edi -- noret ) 60 syscall ;
: bye ( -- noret ) 0 exit ;
: die ( err:eax -- noret ) neg exit ;
 
: unwrap ( result:eax -- value:eax ) dup 0 cmp ' die xl ;
: ordie ( result -- ) unwrap drop ;
 
: open ( pathname:edi flags:esi mode:edx -- fd:eax ) 2 syscall unwrap ;
: close ( fd:edi -- ) 3 syscall ordie ;
 
: mkdir ( pathname:edi mode:esi -- ) 83 syscall ordie ;
 
00001 const for-writing
00100 const create
01000 const truncate
 
: create-file ( pathname -- ) 
	create for-writing or truncate or
	0640 open close ;
 
: make-directory ( pathname -- ) 0750 mkdir ;
 
: create-output-file ( -- ) s" output.txt" drop create-file ;
: make-docs-directory ( -- ) s" docs" drop make-directory ;
 
: _start ( -- noret ) 
	create-output-file 
	make-docs-directory 
	bye 
;