我在数据段定义了五个变量(是用MASM6.15)
DATA SEGMENT
l60 BYTE 0
ge60 BYTE 0
ge70 BYTE 0
ge80 byte 0
ge90 byte 0
DATA ENDS
在代码段:
CODE SEGMENT
START:
.
.
.
inc l60
inc ge90
inc ge80
inc ge70
inc ge60
.
.
.
CODE ENDS
END START
在ml 这个文件时,它说我在代码段中这五行都是
stu.asm(77) : error A2074: cannot access label through segment registers
stu.asm(79) : error A2074: cannot access label through segment registers
stu.asm(81) : error A2074: cannot access label through segment registers
stu.asm(83) : error A2074: cannot access label through segment registers
stu.asm(86) : error A2074: cannot access label through segment registers
不知道是怎么回事,还请各位大虾指点一下
小弟在些先谢过!!!!
------解决方案--------------------------------------------------------
在指令之前要加上 assume DS:DATA 语句吧, 并且有指令将 DS 设置指向 DATA 段. 这样就是高诉编译器 DATA 是通过 DS 引用的, 便于生成正确的代码
------解决方案--------------------------------------------------------
Topic: A2074
MASM error A2074
cannot access label through segment registers
An attempt was made to access a label through a segment register
that was not assumed to its segment or group.
楼上说的对加上:
CODE SEGMENT
assume cs:code, ds:data
START: