assembly - masm程序集如何访问结构变量
问题描述
DPT 是这样定义的结构:
DPT STRUC
rSrtHdUnld DB 1; Bits 0-3: SRT step rate time, bits 4-7: head unload time.
rDmaHdLd DB 1; Bit 0: 1=use DMA, bits 2-7: head load time.
bMotorOff DB 1; 55-ms increments before turning disk motor off.
bSectSize DB 1; Sector size (0=128, 1=256, 2=512, 3=1024).
bLastTrack DB 1; EOT (last sector on a track).
bGapLen DB 1; Gap length for read/write operations.
bDTL DB 1; DTL (Data Transfer Length) max transfer when length not set.
bGapFmt DB 1; Gap length for format operation.
bFillChar DB 1; Fill character for format (normally 0f6H).
bHdSettle DB 1; Head-settle time (in milliseconds).
bMotorOn DB 1; Motor-startup time (in 1/8th-second intervals)
DPT ENDS ; Size=11.
在 MASM 中组装时,我使用了以下语法:
MOVB [DI-SIZEOF DPT]+[DPT.bHdSettle],15
MASM 显示以下错误:
syntax error : [
解决方案
我不确定movb
应该是什么,但我认为这是一个错字,你的意思是mov
.
您可以像这样编写指令:
mov (DPT PTR [DI-SIZEOF DPT]).bHdSettle,15
或者,如果您在一个PROC
想要通过多个结构访问的地方,di
您可以告诉汇编器暂时假设di
指向 a DPT
:
ASSUME di:PTR DPT
mov [di-SIZEOF DPT].bHdSettle,15
.....
ASSUME di:NOTHING
推荐阅读
- android - 没有上下文的 ResourcesCompat.getColor():错误 NotFoundException
- reactjs - 如何检查 Next-Js 组件状态?
- python - QtWidgets.QWidget() 返回什么小部件?
- c# - ASP.NET MVC 在单个 HTTP 发布请求中更新主从记录
- python - OLS 回归结果显示 R 平方和调整后的 R 平方分别为 0.091 和 0.074。我的模型有那么差吗?
- r - 特定条件下的颜色 geom_rect
- c# - Datagrid 在 ASP NET C# 中显示最后不需要的空白列
- python-sphinx - 如何调整手册页宽度
- c# - 表单授权超时,302 重定向到Login.aspx 不适用于单页 ExtJs 应用程序
- mysql - Rails 应用程序 - 填充数据库缓存并保持填充