使用ASM将文件装入内存



我正在做一个小的ASM程序,需要加载另一个平面二进制文件将磁盘/软盘/硬盘w/e,然后开始执行。我好像不知道怎么扫描文件的本地文件夹或系统说main.bin,然后跳转到代码的main:部分。

so for example we have a small file called main.bin, which is a 
compiled flat binary of nasm code. there is a label called main:
what i need to do is find the file main.bin and load into memory 
at address 0x0500, then jmp/give control to the loaded program and
have it start working at the main: label in the code.
如果有人能帮我做这件事,我将不胜感激。感谢阅读

具体情况取决于您的硬件体系结构和文件系统。你能否介绍一下具体情况?

听起来你在开发自己的操作系统。特别是因为你用"引导加载程序"标记了你的问题。或者您希望在其他操作系统中实现此功能?

如果不进行系统调用,就无法从用户层执行此操作。您也不知道'main'在平面二进制文件中的位置(对象文件将是另一回事)。

最新更新