汇编结构体的声明和引用

来源:互联网 发布:开票软件打不开没响应 编辑:程序博客网 时间:2024/06/06 19:44
;*********************************************************TITLE 结构体的声明和引用;*********************************************************;*********************************************************;程序运行平台说明.386.MODEL FLAT,STDCALLOPTION CASEMAP:NONE;*********************************************************;*********************************************************;文件包含INCLUDE Irvine32.inc;*********************************************************;*********************************************************;数据类型定义Employee STRUCT  Idnum BYTE 0  Lastname BYTE 30 DUP(0)  Years WORD 0  Salary DWORD 0Employee ENDS;*********************************************************;*********************************************************;数据段定义.DATAhInstance Employee {}sample byte "Jimmy",0strEnter byte 0dh,0ah,0strId byte "The Emplyee id is ",0;strFamily byte "the Employee lastname is ",0strYear byte "the year is ",0strScalary byte "the scalaryis ",0;;*********************************************************;*********************************************************;代码段定义.CODEmain 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   exitmain endpend main;*********************************************************

0 0
原创粉丝点击