Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
45
Task/Delete-a-file/X86-Assembly/delete-a-file.x86
Normal file
45
Task/Delete-a-file/X86-Assembly/delete-a-file.x86
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
;syscall numbers for readability. :]
|
||||
%define sys_rmdir 40
|
||||
%define sys_unlink 10
|
||||
|
||||
section .text
|
||||
global _start
|
||||
|
||||
_start:
|
||||
mov ebx, fn
|
||||
mov eax, sys_unlink
|
||||
int 0x80
|
||||
test eax, eax
|
||||
js _ragequit
|
||||
|
||||
mov ebx, dn
|
||||
mov eax, sys_rmdir
|
||||
int 0x80
|
||||
|
||||
mov ebx, rfn
|
||||
mov eax, sys_unlink
|
||||
int 0x80
|
||||
cmp eax, 0
|
||||
je _exit
|
||||
|
||||
_ragequit:
|
||||
mov edx, err_len
|
||||
mov ecx, err_msg
|
||||
mov ebx, 4
|
||||
mov eax ,1
|
||||
int 0x80
|
||||
|
||||
_exit:
|
||||
push 0x1
|
||||
mov eax, 1
|
||||
push eax
|
||||
int 0x80
|
||||
ret
|
||||
|
||||
section .data
|
||||
fn db 'input.txt',0
|
||||
rfn db '/input.txt',0
|
||||
dn db 'doc',0
|
||||
|
||||
err_msg db "Something went wrong! :[",0xa
|
||||
err_len equ $-err_msg
|
||||
Loading…
Add table
Add a link
Reference in a new issue