;;**************************************************************************** ;;register struct ;;BY:qianyuqianxun ;;**************************************************************************** .386 .model flat,stdcall option casemap:none include windows.inc include kernel32.inc include masm32.inc include debug.inc includelib kernel32.lib includelib masm32.lib includelib debug.lib MyPoint struct X dd ? Y dd ? MyPoint ends MySquare struct LeftTop MyPoint <> RightBottom MyPoint <> MySquare ends .data Square1 MySquare <<1,1>,<10,10>> ;;Init at defination Square2 MySquare <> ;;without init .code main proc ;; mov Square2.LeftTop.X,2 mov Square2.LeftTop.Y,2 mov Square2.RightBottom.X,20 mov Square2.RightBottom.Y,20 ;Method one lea eax,Square1 mov edx,(MySquare ptr [eax]).LeftTop.X PrintDec edx mov edx,(MySquare ptr [eax]).LeftTop.Y PrintDec edx mov edx,(MySquare ptr [eax]).RightBottom.X PrintDec edx mov edx,(MySquare ptr [eax]).RightBottom.Y PrintDec edx PrintLine ;;Method two lea eax,Square2 assume eax:ptr MySquare ;;let eax point to a struct mov edx,[eax].LeftTop.X PrintDec edx mov edx,[eax].LeftTop.Y PrintDec edx mov edx,[eax].RightBottom.X PrintDec edx mov edx,[eax].RightBottom.Y PrintDec edx assume eax:nothing ;;don't forget this line ret main endp end main