;*********************************************************
TITLE 结构体的声明和引用
;*********************************************************



;*********************************************************
;程序运行平台说明
.386
.MODEL FLAT,STDCALL
OPTION CASEMAP:NONE
;*********************************************************


;*********************************************************
;文件包含
INCLUDE Irvine32.inc
;*********************************************************


;*********************************************************
;数据类型定义
Employee STRUCT
Idnum BYTE 0
Lastname BYTE 30 DUP(0)
Years WORD 0
Salary DWORD 0
Employee ENDS
;*********************************************************



;*********************************************************
;数据段定义
.DATA
hInstance Employee {}
sample byte "Jimmy",0
strEnter byte 0dh,0ah,0
strId byte "The Emplyee id is ",0;
strFamily byte "the Employee lastname is ",0
strYear byte "the year is ",0
strScalary byte "the scalaryis ",0;

;*********************************************************


;*********************************************************
;代码段定义
.CODE
main proc
;给各部分赋值
;员工工号
mov hInstance.Idnum,20
;员工姓氏
mov esi ,offset sample
mov edi,offset hInstance.Lastname
mov ecx,sizeof sample
cld
rep movsb
;年份
mov hInstance.Years,1990
;工资
mov hInstance.Salary,5000
;输出员工工号
mov edx,offset strId
call WriteString
movzx eax,hInstance.Idnum
call WriteInt
mov edx,offset strEnter
call WriteString
;输出员工姓氏
mov edx,offset strFamily
call WriteString
mov edx,offset hInstance.Lastname
call WriteString
mov edx,offset strEnter
call WriteString
;输出员工年份
mov edx,offset strYear
call WriteString
movzx eax,hInstance.Years
call WriteInt
mov edx,offset strEnter
call WriteString
;输出员工的工资
mov edx,offset strScalary
call WriteString
mov eax, hInstance.Salary
call WriteInt
mov edx,offset strEnter
call WriteString
exit
main endp
end main
;*********************************************************