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