Created
March 11, 2024 22:00
-
-
Save Gavriel770U/814abc15c007ca65ccd54f7796838612 to your computer and use it in GitHub Desktop.
Function to create new file in x86 .asm for DOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc create_file | |
; [bp+4] offset file_name | |
; [bp+6] offset file_handle | |
; [bp+8] offset error_message | |
; [bp+10] file attributes [value] | |
push bp | |
mov bp, sp | |
push ax | |
push bx | |
push cx | |
push dx | |
xor al, al | |
mov ah, 3Ch | |
mov dx, [bp+4] | |
mov bx, [bp+6] | |
mov cx, [bp+10] | |
int 21h | |
jc create_file_error | |
mov bx, [bp+6] | |
mov [bx], ax | |
pop dx | |
pop cx | |
pop bx | |
pop ax | |
pop bp | |
ret 8 | |
create_file_error: | |
mov dx, [bp+8] | |
mov ah, 09h | |
int 21h | |
pop dx | |
pop bx | |
pop cx | |
pop ax | |
pop bp | |
ret 8 | |
endp create_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment