Archived
1
0
This repository has been archived on 2025-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
asm_libs/src/path.asm

30 lines
368 B
NASM
Raw Normal View History

2022-11-06 13:51:51 +03:00
format ELF
public filename as 'path.filename'
include '../include/_macros.inc'
extrn string.len
section '.text' executable
filename:
2022-11-06 18:21:21 +03:00
prelude
2022-11-06 13:51:51 +03:00
2022-11-06 18:21:21 +03:00
mov eax, [ebp+2*4]
push eax
call string.len
pop ebx
2022-11-06 13:51:51 +03:00
2022-11-06 18:21:21 +03:00
.loop:
cmp [ebx+eax], byte '/'
je .break
cmp ebx, 0
je .break
2022-11-06 13:51:51 +03:00
2022-11-06 18:21:21 +03:00
dec ebx
jmp .loop
.break:
add eax, ebx
inc eax
mov [ebp+2*4], eax
postlude
ret