简体   繁体   English

如何使用MASM或FASM编译DOS程序

[英]How to compile DOS programs using MASM or FASM

I want to compile simple program using assemblers such as MASM or FASM. 我想使用MASM或FASM等汇编程序来编译简单程序。

Ideal
model small
Stack 256

Dataseg

    str1 db 'hello','$'

Codeseg
Startupcode

   lea dx, [str1]
   mov ah, 09h
   int 21h

   lea dx, [ent]
   mov ah, 09h 
   int 21h

exitcode
END

This source is compiled on TASM in my college, but how to do it using MASM or FASM ? 该资源是在我的大学的TASM上编译的,但是如何使用MASM或FASM呢?

Interrupts can only be used in 16 bit versions of Windows. 中断只能在Windows的16位版本中使用。 Those int 21h calls must be replaced by the equivalent Win32 Function calls. 这些int 21h调用必须替换为等效的Win32 Function调用。 Also where is the variable ent defined? 另外,变量ent在哪里定义? If you want to compile with Visual studio then set the custom build rules to MASM, go to linker settings and set the sub-system to windows and the entry point to main. 如果要使用Visual Studio进行编译,则将自定义生成规则设置为MASM,转到链接器设置,然后将子系统设置为Windows,将入口点设置为main。 Build and enjoy. 建立并享受。 See Setting Up Visual Studio 2010 For MASM32 Programming . 请参阅设置Visual Studio 2010以进行MASM32编程

This is the relevant MASM code listing: 这是相关的MASM代码清单:

.386
.model small
.stack 256

.data
  str1 db 'hello','$'

.code
main:
  lea dx, [str1]
  mov ah, 09h
  int 21h

  lea dx, [ent]
  mov ah, 09h 
  int 21h
end main

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM