MASM32错误A2006,A2074错误及警告A4023 [英] MASM32 error A2006, error A2074 and warning A4023

查看:2835
本文介绍了MASM32错误A2006,A2074错误及警告A4023的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来assmebly。我从书中我学习形式下面这段code的。我下载MASM32。我的电脑是64位的Win7。我试图建立以下code:

I am new to assmebly. I have the following piece of code from the book I am learning form. I downloaded MASM32. My computer is Win7 64bit. I tried to build the following code:

.model small
.stack 100h

.data
a dw 2
b dw 5
sum dw ?

.code
main proc
mov ax, @data
mov ds, ax

mov ax, a
add ax, b
mov sum, ax

mov ax, 4c00h
int 21h

main endp
 end main

不幸的是,我得到以下错误:

Unfortunately, I get the following errors:

Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: C:\masm32\test.asm
C:\masm32\test.asm(11) : error A2006: undefined symbol : DGROUP
C:\masm32\test.asm(14) : error A2074: cannot access label through segment registers
C:\masm32\test.asm(15) : error A2074: cannot access label through segment registers
C:\masm32\test.asm(16) : error A2074: cannot access label through segment registers
C:\masm32\test.asm(22) : warning A4023: with /coff switch, leading underscore required for start address : main
_
Assembly Error
Press any key to continue . . .

我已搜查有关的解决方案。我可以解决错误A2074:通过添加 承担DS:_DATA 。数据行。我把它从这个职位:<一href=\"http://stackoverflow.com/questions/1512734/cannot-access-label-through-segment-registers-error-in-assembly\">Cannot通过段寄存器,错误装配访问标号但遗憾的是,该解决方案不能提供的,为什么和这是什么解释?

I have searched about solutions. I could solve the error A2074: by adding ASSUME DS:_DATA before .data line. I took it from this post: Cannot access label through segment registers, error in assembly but unfortunately, the solution does not provide explanations of why and what is this ?

为什么这些错误出现,如何解决?我是一个新手,需要一些细节,一步一开始的一步。

Why these errors appear and how to solve them? I am a newbie and need some details and step by step at the beginning.

推荐答案

您需要使用16位Microsoft分段链接器链接16位DOS code,不附带MASM32,从MS下载增量链接:
16位Microsoft分段链接器5.60

You need to use the 16 bit Microsoft Segmented Linker to link 16 bit DOS code, NOT the Incremental Linker that comes with MASM32, download from MS: 16 bit Microsoft Segmented Linker 5.60

解压到一个目录,然后LINK.EXE重命名为类似link16.exe并将该到你的/ MASM32 / bin目录。您现在可以使用LINK16 16位DOS应用程序和链接32位应用程序。

Unzip to a directory then rename link.exe to something like link16.exe and place that into your /masm32/bin directory. You now can use link16 for 16 bit DOS apps and link for 32 bit apps.

您还需要使用正确的命令行参数来组装16位code,这里的例子:<一href=\"http://stackoverflow.com/questions/14692582/assembly-fatal-error-lnk1190-invalid-fixup-found-type-0x0001\">assembly致命错误LNK1190:发现无效的链接地址信息,类型×0001
当您使用的是64位操作系统,不能运行16位DOS应用程序本身了,你需要使用的仿真器。我使用 D-芬德重装上阵

You also need to use the correct command line parameters to Assemble 16bit code, example here: assembly fatal error LNK1190: invalid fixup found, type 0x0001 As you are using a 64 bit OS, you cannot run a 16 bit DOS app natively anymore, you need to use an emulator. I use D-Fend Reloaded.

这篇关于MASM32错误A2006,A2074错误及警告A4023的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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