Accessing Segment Registers MASM

五迷三道 提交于 2019-12-01 21:35:59

MASM by default assumes that any access to the segment registers is an error (which usually it is). You need to redefine the assumptions for the FS register using ASSUME FS:NOTHING. You can place this directive at the top of your file, OR you could "reassume" the FS register temporarily. Example:

ASSUME FS:NOTHING
MOV EAX, FS:[0]
ASSUME FS:ERROR

This way you turn off the error checking only for this single instruction. The ASSUME directives only inform the assembler what to do, they don't cause any code to be emitted.

According to the MSDN documentation for error A2108, you need to add an assume directive to your code.

ASSUME NOTHING at the top of your file should remove register error checking.

I presume this is because for most code, using the segment registers results in incorrect behavior.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!