Day 17




Directories


	Today, we will investigate what goes into creating and deleting a directory (folder).

Creating

To create a directory, we use Function 39h of the DOS Service Interrupt 21h. Function 39h expects a pointer to a NULL-terminated string in DX. Here's a small program to create an "Elmo" directory: ;;---CODE START---;; mov ah,39h mov dx,offset dirname int 21h mov ah,4Ch int 21h dirname db "Elmo",0 ;;---CODE END---;;

Deleting

Deleting is identical and is Function 3Ah. This will delete the directory created by the previous program: ;;---CODE START---;; mov ah,3Ah ; different function this time. mov dx,offset dirname int 21h mov ah,4Ch int 21h dirname db "Elmo",0 ;;---CODE END---;;

This Day In Review

I should take this opportunity to mention that Function numbers always go in AH or all of AX! And each function expects it's parameters in specific registers, if you put things in the wrong register the code will not work. I wonder files are next... - GbaGuy
Intro - Day 18

Patater GBAGuy Mirror
Contact