从 DOS 到 Windows 10 组装 [英] From DOS to Windows 10 assembly

查看:31
本文介绍了从 DOS 到 Windows 10 组装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码将打印Hello, world!"在 DOS 中作为 .COM 可执行文件:

This code will print "Hello, world!" in DOS as a .COM executable:

org 100h
mov dx,msg
mov ah,9
int 21h
mov ah,4Ch
int 21h
msg db 'Hello, world!',0Dh,0Ah,'$'

但是它不会在 Windows 10 64 位上运行,并且我见过的用于 x86x64 的 Helloworld 程序的所有简单示例都涉及链接到某个库.

However it will not run on Windows 10 64-bit and all trivial examples of a Helloworld program for x86 and x64 I've seen involve linking to some library.

所以我的问题是这些更高版本的 Windows 是否仍然遵循 ISR IO 模型,或者更简单地说,我如何将此示例转换为更高的位数"?

So my question is do these later versions of Windows still follow an ISR IO model or more simply how do I convert this example to a "higher bitness"?

推荐答案

您不仅不能在 Windows 10 中这样做,而且实际上在任何以保护模式(Windows NT 3 和更高版本)运行应用程序的 Windows 中都不能这样做 - 应用程序不能直接访问中断和硬件.此外,可执行格式本身与操作系统有关.虽然有一些向后兼容性(例如 Win10 应该能够运行 Win7 应用程序),但它绝对不会追溯到 DOS 时代(根据定义,.COM 格式仅限于实模式,在 Win NT 3 之前就消失了).

You can't do that not only in Windows 10 but in fact in any Windows that runs applications in protected mode (Windows NT 3 and newer) - the application doesn't have direct access to interrupts and HW. Additionally, the executable format itself is OS-dependent. While there is some backwards compatibility (e.g. Win10 should be able to run Win7 apps) but it definetely doesn't stretch back to the DOS days (.COM format is by definition restricted to Real mode, that died before Win NT 3).

没有直接的方法可以将此代码转换为与 Win10 兼容.您需要使用操作系统提供的 API 来访问中断/硬件.

There is no direct way to convert this code to be Win10-compatible. You'll need to use OS-provided APIs to access the interrupts/HW.

这篇关于从 DOS 到 Windows 10 组装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆