无法通过段寄存器在装配访问标签,错误 [英] Cannot access label through segment registers, error in assembly

查看:1045
本文介绍了无法通过段寄存器在装配访问标签,错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

INCLUDE Irvine16.inc

.data
    byteArray	BYTE 6 DUP(?)
    listSize = ($ - byteArray)
    aSum		WORD 0
    soffset = 0
.code
main PROC
    mov		ax, @data
    mov		ds, ax
    mov		cx, listSize
Loop1:
    mov		ax, 0
    movzx	ax, [byteArray + soffset]
    add		aSum, ax
    soffset = soffset + 1
    loop Loop1
    exit
main ENDP
END main

我得到的错误是错误A2074:无法通过段寄存器访问标签

The error I'm getting is error "A2074:cannot access label through segment registers"

我试图通过ByteArray的使用S偏移循环。

I'm trying to use the soffset to loop through the byteArray.

推荐答案

我不知道什么是在Irvine16.inc,但我敢打赌,跟它 .MODEL小,... 在一些点。

I'm not sure what's in Irvine16.inc, but I bet it is saying .model small,... at some point.

如果您添加

ASSUME DS:_DATA

那么你的错误信息会消失,但我怀疑,如果这足以使程序运行。


then your error messages will go away, although I doubt if that's enough to make the program run.


好吧,我有一个想法。我想你应该切换到32位示例。这就是段寄存器由OS建立和不使用程序的平面模型。我刚刚下载的欧文的例子和示例项目,这恰好是32位并组装和运行。

Ok, I've got an idea. I think you should switch to the 32-bit examples. That's a flat model where the segment registers are set up by the OS and not used by programs. I just downloaded the irvine examples and the sample project, which happens to be 32-bits did assemble and run.

在怪异,扭曲的世界是x86机器code,16位模型比32位模式更加复杂了不少,在从一个用户程序的角度最小。

In the wierd and twisted world that is x86 machine code, the 16-bit model is quite a bit more complex than the 32-bit model, at least from the point of view of a user program.

这篇关于无法通过段寄存器在装配访问标签,错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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