使用ASM将文件加载到内存中?

时间:2011-08-27 00:36:12

标签: assembly nasm

我正在开发一个需要从中加载另一个平面二进制文件的小型ASM程序 disk / floppy / hdd 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.

如果有人可以帮助我,我们将不胜感激。感谢阅读:)

2 个答案:

答案 0 :(得分:2)

如果不进行系统调用,则无法在用户区域执行此操作。你也不会知道平面二进制文件中的'main'在哪里(对象文件会是另一个故事)。

答案 1 :(得分:2)

详细信息取决于您的硬件架构和文件系统。你能告诉我们更多细节吗?

听起来你正在开发自己的操作系统。特别是因为你用“bootloader”标记了你的问题。或者您希望在其他操作系统中执行此操作吗?