Assembly masm汇编如何访问结构变量

Assembly masm汇编如何访问结构变量,assembly,struct,masm,Assembly,Struct,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

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.   
mov (DPT PTR [DI-SIZEOF DPT]).bHdSettle,15
在MASM中组装时,我使用了以下语法:

MOVB [DI-SIZEOF DPT]+[DPT.bHdSettle],15
MASM显示以下错误:

syntax error : [

我不确定
movb
应该是什么,但我认为这是一个打字错误,你的意思是
mov

您可以这样编写指令:

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.   
mov (DPT PTR [DI-SIZEOF DPT]).bHdSettle,15
或者,如果您在
PROC
中,希望通过
di
执行多个结构访问,您可以告诉汇编程序暂时假定
di
指向
DPT

ASSUME di:PTR DPT
mov [di-SIZEOF DPT].bHdSettle,15
.....
ASSUME di:NOTHING

如果这是masm,通常语法类似于
mov[di sizeof dpt].dpt.bHdSettle,15
。为什么di指向结构的结尾,而不是开始?