装配中的结构阵列的教学元素

时间:2013-01-01 14:31:20

标签: assembly struct x86 masm irvine32

我写的代码在这里:

    TITLE MASM Template                     (main.asm)

Description:

Revision date:

INCLUDE Irvine32.inc   
INCLUDE macros.inc   
Employee STRUCT   
idnum BYTE "0000",0   
lastname BYTE 30 DUP(0)   
years WORD 0   
Employee ENDS    

.data   
workers Employee 3 DUP(<>)   
count DWORD ?   
.code   
main PROC

mov ecx,LENGTHOF workers
mov esi,TYPE Employee

l1:
mov count,ecx
mWrite "Enter employee id:> "

mov edx,OFFSET workers[esi].idnum
mov ecx,LENGTHOF workers.idnum
call ReadString
call crlf
mov ecx,count
add esi,TYPE employee
loop l1


exit
main ENDP

END main

我想为结构中的每个员工添加idnum。如何联系idnum变量?

Here's the solution.
mov edx, OFFSET workers
add edx, esi
mov ecx, sizeof (employee ptr[edx]).idnum
call ReadString

0 个答案:

没有答案
相关问题