Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

BIOS(10h)

Hi. I'm a newbie in assembler, and I don't like to code with DOS(21h) interrupt so i need to create a simple file or folder. How can I create them without DOS interrupt i think maybe with BIOS or etc. pls help (no DOS) :)

Comments

  • shaolin007shaolin007 Member Posts: 1,018
    : Hi. I'm a newbie in assembler, and I don't like to code with DOS(21h) interrupt so i need to create a simple file or folder. How can I create them without DOS interrupt i think maybe with BIOS or etc. pls help (no DOS) :)
    :

    [green]
    Why, it's very simple to create a file or folder with DOS.

    [red]
    INT 21 - AH = 3Ch DOS 2+ - CREATE A FILE WITH HANDLE (CREAT)
    CX = attributes for file
    bit 0: read-only
    1: hidden
    2: system
    3: volume label
    4: reserved, must be zero (directory)
    5: archive bit
    7: if set, file is shareable under Novell NetWare
    DS:DX = address of ASCIZ filename
    Return: CF set on error
    AX = error code
    CF clear if successful
    AX = file handle
    [/red]

    [code]
    ;USE NASM

    Create_File:

    mov ah, 03ch
    xor cx, cx
    or cx, 1 ;read only
    mov dx, offset test_file ;File name
    jc Error ;jump if carry is set
    mov word offset test_file_handle, ax ;save file handle
    ret ;all done

    test_file db "C: est_file.hex",0
    test_file_handle dw 0
    [/code]

    Creating a directory is even easier...
    [red]
    INT 21 - AH = 39h DOS 2+ - CREATE A SUBDIRECTORY (MKDIR)
    DS:DX = address of ASCIZ pathname
    Return: CF set on error
    AX = Error Code
    [/red]

    [code]
    ;USE NASM

    Create_Dir:
    mov ah, 039h
    mov dx, offset test_folder
    jc Error

    test_folder db " est",0
    [/code]

    the directory function is a little troublesome and I think you don't have to specify the drive. If you want it on a different drive then you will have to change the default directory with function 03bh. ther than that I don't know how to create a file or folder any easier than using DOS. I didn't test the code above but it should work. Let me know if you see any errors.
    [/green]

Sign In or Register to comment.