This question is mainly how to handle the pathname which is an arbitrarily long string, in assembly, without db
or any helpers like that. I have seen several examples such as this which shows:
section .text
global _start ;must be declared for using gcc
_start: ;tell linker entry point
;create the file
mov eax, 8
mov ebx, file_name
mov ecx, 0777 ;read, write and execute by all
int 0x80 ;call kernel
section .data
file_name db 'myfile.txt'
However, I would specifically like to understand how to do this dynamically. I would like to (1) better understand the requirements of the filename in terms of assembly (does it need a null terminator, etc.), and more importantly (2) specify the file name without the use of db
or any assembler helpers. For example, you could specify the file name through the command line, and its structure would be unknown to the object file.
How do you do this?