如何在32位Windows程序集中使用DOS中断? [英] How can I use DOS interrupts in 32-bit Windows assembly?

查看:81
本文介绍了如何在32位Windows程序集中使用DOS中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在用TASM编写汇编代码.但是现在我想将其迁移到MASM,并使其在32位Windows上运行.我还能保留DOS中断还是有其他方法可以做到?

So I was writing assembly code in TASM. But now I want to migrate it to MASM and have it run on 32-bit Windows. Can I still keep the DOS interrupts or is there some other way to do it?

我想理想地在Windows 10上运行它.

I want to ideally run this on Windows 10.

推荐答案

简单答案:否.在Win32/Win64下,调用DOS中断将使您的程序崩溃,并显示无效操作"消息.弄清楚您要如何处理DOS中断(控制台输出?正在写入文件?),找到相应的Win32 API函数,然后调用它们.

Simple answer: no. Under Win32/Win64, calling a DOS interrupt will crash your program with an "Invalid operation" message. Figure out what are you trying to do with DOS interrupts (console output? writing to files?), find corresponding Win32 API functions, and call them.

更新:取决于您要做什么. DOS中断仅对DOS可执行文件可用. Windows可执行文件必须使用Windows API.完全有可能将Windows可执行文件汇编为包括MASM在内的可执行文件,但是您必须学习新技术. MASM的较早版本支持构建DOS可执行文件,但是在当今的计算环境中,该技能集毫无意义.一方面,DOS子系统正在缓慢但肯定会从Windows中消失-64位版本的Windows不再具有它.

UPDATE: depends on what are you after. DOS interrupts are only available to DOS executables; Windows executables have to use Windows API. It's entirely possible to make Windows executables in assembly, MASM included, but you'd have to learn new techniques. Building DOS executables is supported in older versions of MASM, but that skillset is rather pointless in today's computing environment. For one thing, the DOS subsystem is slowly but surely going away from Windows - 64-bit versions of Windows don't have it anymore.

这篇关于如何在32位Windows程序集中使用DOS中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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