是否可以将.exe文件从.ASM代码调用不使用操作系统的文件?
因此,在这里,我有一个以全屏运行的.exe
文件,我需要从.asm
语言中调用它。为了更清楚,我正在尝试制作一个OS原型(如果让我发疯的话,我有一个.exe
文件,我需要从.asm。
代码。我是一个学习者,所以我不确定是否可以,但是根据网络上的其他答案,我必须制作 基本的I/O子系统,内存管理和东西 (OS通常使用)。我想有一个示例,其中.exe
是从.asm
代码调用的,并且执行.exe
。
谢谢
!!
So here I have an .EXE
file that runs in full-screen, and I need to call it from .ASM
language. To make it more clear, I am trying to make an OS prototype (idk if it makes me sound mad), where I have an .EXE
file that I need to call from an .ASM
code. I am a learner, so I am not sure if this is possible, but according to other answers on the net, I would have to make a basic I/O subsystem, memory management, and stuff (which an OS typically does). I would like to have an example where an .EXE
while is called from .ASM
code, and the .EXE
is executed.
Thank You!, even if you only read this :)
And if you need the .EXE file with its components, I can provide you that, if you can help me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大多数
.exe
文件使用操作系统服务,如果未提供这些服务,则无法正常工作。更具体地说:DOS.exe
文件需要DOS API,例如INT 21H。应用程序程序使用的最突出的操作系统服务是文件系统驱动程序。.exe
文件中的代码向操作系统询问打开一个名为data.bin.bin 的文件,它取决于操作系统以在磁盘上找到文件。您无法运行.exe
文件,该文件试图无需任何类型的操作系统访问文件。如果您正在编写自己的操作系统,则必须实现一种方法来从操作系统加载DOS内核(例如MS-DOS,Freedos),以便
.exe
文件可以访问系统服务它需要,或者您的操作系统需要实施与DOS兼容的服务。加载和执行.exe
文件是一个直接的任务(假设您已经具有文件访问工作)。您先加载标头。标题指示EXE文件内的可执行代码/数据的开始及其大小。您必须加载该区域,最后您需要加载重新安装(重新定位表的尺寸和长度也包括在EXE标题中),并在将堆栈设置为EXE标题中请求的地址并跳跃之前应用重新固定。到入口点。如果将DOS内核加载到操作系统中,DOS内核已经实现了加载和执行EXE文件,因此您可以通过调用INT 21H/AX = 4B00H将加载/启动的过程授权/启动到DOS内核。
Most
.EXE
files use operating system services and won't work if these services are not provided. More specific: A DOS.EXE
files requires the DOS APIs, e.g. INT 21h to be present. The most prominent operating system service used by application programs is the file system driver. The code in the.EXE
file asks the operating system to open a file called DATA.BIN, and it's up to the operating system to locate the file on the disk. You can not run a.EXE
file that tries to access files without any kind of operating system.If you are writing your own operating system, you either have to implement a way to load a DOS kernel (e.g. MS-DOS, FreeDOS) from your operating system so the
.EXE
file can access the system services it requires, or your operating system needs to implement DOS-compatible services. Loading and executing an.EXE
file is a straight-forward task (assuming you already have file access working). You load the header first. The header indicates the start of the executable code/data inside the EXE file and the size of it. You have to load that area, and finally you need to load the relocations (size and length of the relocation table is also included in the EXE header), and apply the relocations before setting the stack to the address requested in the EXE header and jumping to the entry point.If you loaded a DOS kernel into your operating system, the DOS kernel already implements loading and executing EXE files, so you could just delegate the process of loading/starting to the DOS kernel by calling int 21h/AX=4B00h.