0

我写的代码在这里:

    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
4

0 回答 0