#include #float.asm #214,74,83,647 is about the biggest no that can be handled #this example uses only the IEEE standard for double precision representation #of a floating point no --1 bit for the sign, 11 bits for the exponent, # and 52 bits for the mantissa #this example takes a text representation of a floating point no. as #entered by the user in a textbox and uses the ascTodouble fuction to #convert it into a 64 bit floating point representation #it does the same with the no. in the second textbox #now that the numbers are in a form they are given to the processor's #fpu instructions to perform floating point addition #the processor's result is which is in fp is converted to ascii representation #and the answer displayed in the third box #the code is kludgy ! there isn't much error checking and the #comments are just being added. #you will also need to read some floating point representation and fpu #tutorials on the internet to really get the picture #Please drop me an email for any clarifications,suggestions,comments begin imports [Kernel32.dll] GetModuleHandleA GetCommandLineA LoadLibraryA ExitProcess GlobalAlloc GlobalSize GlobalFree GlobalReAlloc Sleep CreateFileA ReadFile WriteFile CloseHandle GetFileSize CreateThread CreateProcessA SuspendThread ResumeThread ExitThread TerminateThread [user32.dll] wsprintfA RegisterClassExA CreateWindowExA ShowWindow UpdateWindow DefWindowProcA GetMessageA TranslateMessage DispatchMessageA SendMessageA LoadCursorA LoadIconA LoadMenuA BeginPaint EndPaint DrawTextA GetClientRect PostQuitMessage MessageBoxA SetForegroundWindow SetActiveWindow BringWindowToTop FindWindowA DestroyWindow PostMessageA CreatePopupMenu AppendMenuA SetMenu CreateMenu GetCursorPos TrackPopupMenu SetFocus [gdi32.dll] CreateFontIndirectA Rectangle CreateSolidBrush SelectObject SetBkMode ExtFloodFill CreatePen SetTextColor [comctl32.dll] InitCommonControls [comdlg32.dll] GetOpenFileNameA GetSaveFileNameA [crtdll.dll] strtod atof fopen fclose fgets fputs fgetc fputc feof malloc realloc free fread fwrite fprintf fscanf _itoa _ecvt memcpy memcmp memmove memset sprintf atoi strcpy strstr strncat _fcvt end imports #-----------------Constants---------------------------------------------- begin const SW_HIDE 0 SW_SHOW 5 WS_CHILD 1073741824 WS_VISIBLE 268435456 WS_BORDER 8388608 WS_HSCROLL 1048576 WS_VSCROLL 2097152 WS_CAPTION 12582912 WS_CHILDWINDOW 1073741824 WS_OVERLAPPEDWINDOW 13565952 WS_POPUPWINDOW 2156396544 WS_CLIENTEDGE 512 WS_MINIMIZEBOX 131072 ES_MULTILINE 4 WM_CREATE 1 WM_COPY 769 WM_CUT 768 WM_PASTE 770 WM_CLOSE 16 WM_COMMAND 273 WM_DESTROY 2 WM_ENABLE 10 WM_GETTEXT 13 WM_GETTEXTLENGTH 14 WM_INITDIALOG 272 WM_INITMENU 278 WM_KEYDOWN 256 WM_KEYUP 257 WM_KILLFOCUS 8 WM_LBUTTONDBLCLK 515 WM_LBUTTONDOWN 513 WM_LBUTTONUP 514 WM_MOVE 3 WM_NOTIFY 78 WM_PAINT 15 WM_ACTIVATE 6 WM_QUIT 18 WM_RBUTTONDBLCLK 518 WM_RBUTTONDOWN 516 WM_RBUTTONUP 517 WM_SETFOCUS 7 WM_SETFONT 48 WM_SETTEXT 12 WM_SIZE 5 WM_TIMER 275 WM_UNDO 772 WS_SYSMENU 524288 LB_ADDSTRING 384 LB_RESETCONTENT 388 LBS_HASSTRINGS 64 LB_SELECTSTRING 396 LB_SETTOPINDEX 407 DT_SINGLELINE 32 DT_CENTER 1 DT_VCENTER 4 DT_BOTTOM 8 IDI_APPLICATION 32512 IDC_CROSS 32515 GMEM_ZEROINIT 64 ES_AUTOVSCROLL 64 ES_AUTOHSCROLL 128 EN_MSGFILTER 1792 EM_SETEVENTMASK 1093 EN_CHANGE 768 ENM_MOUSEEVENTS 131072 ENM_SELCHANGE 524288 ENM_PROTECTED 2097152 ENM_KEYEVENTS 65536 ENM_UPDATE 2 ENM_SCROLL 4 ENM_CHANGE 1 ES_NOHIDESEL 256 EM_GETFIRSTVISIBLELINE 206 EM_FINDTEXTEX 1103 EM_LINEFROMCHAR 201 EM_LINESCROLL 182 EM_SETLIMITTEXT 197 MF_ENABLED 0 MF_BYPOSITION 1024 MF_SEPARATOR 2048 MF_STRING 0 MF_POPUP 16 MF_DISABLED 2 MF_BYCOMMAND 0 GENERIC_READ 2147483648 GENERIC_WRITE 1073741824 OPEN_EXISTING 3 FILE_ATTRIBUTE_NORMAL 128 EM_STREAMIN 1097 EM_STREAMOUT 1098 ES_WANTRETURN 4096 ES_LEFT 0 SF_RTF 2 SFF_SELECTION 32768 SFF_PLAINRTF 16384 SF_TEXT 1 CB_ADDSTRING 323 CB_DELETESTRING 324 CB_GETCOUNT 326 CB_GETLBTEXT 328 CB_GETLBTEXTLEN 329 CB_INSERTSTRING 330 CB_RESETCONTENT 331 CB_GETCURSEL 327 CB_SETCURSEL 334 CBN_DROPDOWN 7 CBS_DROPDOWN 2 CBS_DROPDOWNLIST 3 CBS_HASSTRINGS 512 CBN_SELENDOK 9 CBN_SELCHANGE 1 CBS_SIMPLE 1 CBN_CLOSEUP 8 CB_FINDSTRINGEXACT 344 CBS_SORT 256 OFN_EXPLORER 524288 OFN_HIDEREADONLY 4 OFN_LONGNAMES 2097152 OFN_PATHMUSTEXIST 2048 MB_ICONASTERISK 64 end const #-----------------Data Section------------------------------------------- begin data dword hwndMain 0 string Class Window dword hInstance 0 string ClassName WinClass string AppName Windows Template ! string MenuName Menu string btn button string text Edit string combo combobox string list listbox string colon : dword quit 0 string font1 ms sans serif string font2 Courier New sequence fon1 60 sequence fon2 60 dword hfont1 0 dword hfont2 0 string ofnfilter All Files dword DataType 0 string read r string write w string readb rb string writeb wb string WindowCaption Floating Points 2.0 ! string ab About ... string ab1 MyApp Version 1.0 string ab2 by .... string ab3 ---------------------------------------------------- string spc string spc6 string stop . string comp Compute sequence float1 8 sequence float2 8 sequence float3 8 sequence fpno1 48 sequence fpno2 48 sequence buffer 256 sequence buf 48 sequence ibuf 24 sequence listbuf 48 sequence icobuf 24 sequence pt 8 sequence ofnfname 256 dword htext1 0 dword htext2 0 dword htext3 0 dword htext4 0 dword htext5 0 dword hbtn1 0 dword hbtn2 0 dword hbtn3 0 dword hbtn4 0 dword hbtn5 0 dword hbtn6 0 dword hbtn7 0 dword hlist 0 dword hlist1 0 dword hcombo1 0 sequence blank 1 dword filler 0 dword CommandLine 0 dword hmem 0 sequence wndclass 16 sequence msg 28 sequence asci 16 sequence ibuf 32 dword mem 0 string zero 0 string min - dword hst1 0 dword hst2 0 dword hst3 0 string static static string s1 Float1 string s2 Float2 string s3 Sum dword dataend 4294967295 end data #------------------------------------------------------------------- begin code proc strlen dword q push ebp mov ebp esp mov edi [q] mov eax 0 mov ecx 0 cld search_loop: inc ecx scasb jne search_loop dec ecx mov eax ecx leave ret 4 endp #------------------------------------------------------------------------ proc left dword s dword n dword slen 0 push ebp mov ebp esp add esp -16 cld eax = n inc eax slen = eax invoke malloc eax edi = eax invoke memset eax 0 slen esi = s ecx = n rep_movsb leave ret 8 endp #------------------------------------------------------------------------ proc addmem dword addr dword addition dword n 0 dword length 0 push ebp mov ebp esp add esp -48 eax =[addr] add eax 4 ebx = [eax] add ebx [addition] [length] = ebx eax =[addr] invoke [realloc] [eax] [length] ecx =[addr] [ecx] = eax ebx = [length] add ecx 4 [ecx] =ebx ebx = [length] sub ebx [addition] ecx =[addr] edx =[ecx] add edx ebx invoke [memset] edx 0 [addition] leave ret 8 endp #------------------------------------------------------------------------ proc writemem dword addr dword disp dword vartype dword val push ebp mov ebp esp add esp -48 eax = [addr] add eax [disp] if [vartype] = 1 ebx = [val] [eax] = ebx endif if [vartype] = 2 ebx = [val] invoke [strcpy] eax ebx endif #write byte if [vartype] = 3 ebx = [val] [eax] = bl endif eax = [addr] leave ret 16 endp #------------------------------------------------------------------------ proc readmem dword addr dword disp dword typ push ebp mov ebp esp add esp -48 ebx = [addr] add ebx [disp] if typ = 0 eax = [ebx] endif if typ = 1 eax=0 al=[ebx] endif leave ret 12 endp #------------------------------------------------------------------------ proc getlength dword addr push ebp mov ebp esp ebx = [addr] add ebx 4 eax = [ebx] leave ret 4 endp #------------------------------------------------------------------------ proc clearlength dword addr push ebp mov ebp esp eax=addr [eax]=0 add eax 4 [eax]=0 leave ret 4 endp #------------------------------------------------------------------------ proc NumToAsci dword n dword p 0 push ebp mov ebp esp add esp -16 #asci is the dest string 16 bytes long mov edi asci add edi 16 mov eax [n] mov eax n mov ecx 10 str_begin: cmp eax ecx jl str_exit xor edx edx div ecx or edx 48 mov [edi] dl dec edi jmp str_begin str_exit: or eax 48 mov [edi] al mov eax edi str_out: leave ret 4 endp #------------------------------------------------------------------------ proc strcat dword s1 dword s2 dword len1 0 dword len2 0 dword addr 0 dword len 0 push ebp mov ebp esp add esp -48 invoke strlen [s1] mov [len1] eax invoke strlen [s2] mov [len2] eax add eax [len1] inc eax len = eax invoke [malloc] eax invoke memset eax 0 len mov [addr] eax mov edi eax mov ecx [len1] mov esi [s1] rep_movsb mov ecx [len2] mov esi [s2] rep_movsb mov eax [addr] leave ret 8 endp #------------------------------------------------------------------------ proc ascTodouble dword str dword addr dword n 0 dword m 0 dword c 0 dword t 0 dword minus 0 dword afterdp 0 dword beforedp 0 dword dot 0 dword double1 0 dword double2 0 dword double 0 dword started 0 dword subfactor 0 dword exp 0 dword nzlength 0 dword st 0 dword z 0 dword zlen 0 push ebp mov ebp esp add esp -96 #first step is to divide the asci float into 2 binary dwords #beforedp holds portion before the decimal and afterdp... m=strlen str ebx=0 ecx=10 n=1 c=0 afterdp=0 beforedp=0 dot=0 nzlength=0 minus=0 exp=1 mov esi str add esi m dec esi #go to last char instring while ebx < m eax=0 mov al [esi] if eax=45 minus=1 jmp astod endif if eax=46 # check for decimal point dot=1 n=1 jmp astod #skip to end of loop endif if dot=0 inc nzlength endif and eax 15 mul n if dot=0 add afterdp eax #after dp endif if dot=1 add beforedp eax #before dp endif mov eax n mul ecx n=eax astod: dec esi #move from right to left inc c ebx=c endw z=0 if beforedp=0 z=1 beforedp=1 endif #---------------------- #find position of most significant bit in beforedp #decrementing this gives the pos of the binary exponent ebx=0 m=32 n=0 ecx=1 c=1 while ebx< m #find first significant bit test beforedp ecx je astod1 eax=c #if bit is 1 ,note position exp=eax astod1: shl ecx #if bit is 0 continue inc c ebx=c dec ebx endw dec exp #calculate exponent double1=0 #init vars double2=0 started=0 subfactor=500000000 #---------------------- if exp > 20 #beforedp will extend to the 2nd dword ecx=1048576 edx=2147483648 c=0 ebx=0 while ebx < 21 test beforedp edx je astod2 if started=1 #to skip ist bit (always 1) or double1 ecx endif started=1 astod2: shr edx if started=1 shr ecx inc c endif ebx=c endw eax=exp sub eax 20 n=eax ecx=2147483648 c=0 ebx=0 while ebx < n test beforedp edx je astod3 or double2 ecx astod3: shr edx shr ecx inc c ebx=c endw t=ecx eax=10 sub eax nzlength n=eax ecx=10 eax=afterdp ebx=1 while ebx < n mul ecx inc ebx endw afterdp=eax eax=exp sub eax 20 n=eax eax=32 sub eax n n=eax ebx=1 edx=1 while ebx < n shl edx inc ebx endw eax=afterdp c=0 ebx=0 while ebx < n if eax > subfactor sub eax subfactor or double2 edx #put a 1 if eax is greater otherwise skip endif #skipping is the same as putting 0 if eax=subfactor or double2 edx jmp astod_out endif shr edx shr subfactor inc c ebx=c endw jmp astod_out endif #-------------------- if exp <= 20 #beforedp will remain in the first dword ecx=1048576 edx=2147483648 c=0 ebx=0 while ebx < 32 test beforedp edx je astod4 if started=1 or double1 ecx endif started=1 astod4: shr edx if started=1 shr ecx endif inc c ebx=c endw t=ecx #store ecx --transfer point #------------------------ #continue transfer to double1 from afterdp depending #on result of subtraction eax=10 sub eax nzlength n=eax ecx=10 eax=afterdp ebx=1 while ebx < n mul ecx inc ebx endw afterdp=eax ebx=0 c=0 eax=20 sub eax exp n=eax eax=afterdp edx=t #restore transfer point while ebx < n if eax > subfactor sub eax subfactor or double1 edx #put a 1 if eax is greater otherwise skip endif #skipping is the same as putting 0 if eax=subfactor or double1 edx jmp astod_out endif shr edx shr subfactor inc c ebx=c endw ebx=0 c=0 edx=2147483648 while ebx < 32 if eax > subfactor sub eax subfactor or double2 edx #put a 1 if eax is greater otherwise skip endif #skipping is the same as putting 0 if eax=subfactor or double2 edx jmp astod_out endif shr edx shr subfactor inc c ebx=c endw endif #------------------------- #transfer exp 8 bits to beginning of single astod_out: if z=1 #find position of most significant bit in afterdp ebx=0 m=32 n=0 ecx=1 c=1 while ebx< m #find first significant bit test double1 ecx je astod9 eax=c #if bit is 1 ,note position exp=eax astod9: shl ecx #if bit is 0 continue inc c ebx=c dec ebx endw eax=32 sub eax exp sub eax 12 exp=eax inc exp ebx=0 while ebx < exp shl double1 inc ebx endw ecx=1048575 and double1 ecx ebx=0 n=0 ecx=1 edx=2147483648 c=0 while ebx< exp #shift from double2 to double1 test double2 edx je astod11 or double1 ecx astod11: shr edx shl ecx inc c ebx=c endw eax=0 sub eax exp exp=eax endif #-------------------- add exp 1023 c=0 while c < 20 #move to leftmost bit but one ,leftmost is for sign shl exp #this is to setup transfer inc c endw ecx=1073741824 #starting at leftmost but one bit edx=1073741824 c=0 while c < 11 test exp ecx je astod8 or double1 edx astod8: shr edx shr ecx inc c endw if minus=1 edx=2147483648 or double1 edx endif double=malloc 8 eax=double2 ebx=double [ebx]=eax eax=double1 add ebx 4 [ebx]=eax invoke memcpy addr double 8 #eax=double #eax=float1 #ebx=double2 #[eax]=ebx #add eax 4 #ebx=double1 #[eax]=ebx leave ret 8 endp #----------------------- ------------------------------------------------- proc doubleToasc dword dbl dword n 0 dword m 0 dword c 0 dword t 0 dword st 0 dword dc 0 dword exp 0 dword temp 0 dword denom 0 dword afterdp 0 dword beforedp 0 dword double1 0 dword double2 0 dword started 0 push ebp mov ebp esp add esp -96 ebx=dbl eax=[ebx] double2=eax add ebx 4 eax=[ebx] double1=eax #eax=[ebx] #ebx=eax #eax=[ebx] #double2=eax #add ebx 4 #eax=[ebx] #double1=eax dc=0 edx=1073741824 #most sig but one bit ecx=1024 #8th bit from right c=0 exp=0 while c < 11 test double1 edx je douboas or exp ecx douboas: shr edx shr ecx inc c endw sub exp 1023 #get exponent beforedp=0 afterdp=0 if exp < 0 endif ebx=0 ecx=1 while ebx < exp #setup mask shl ecx inc ebx endw or beforedp ecx #put leftmost 1 (always 1) shr ecx #go back one bit #--------- if exp > 20 #beforedp extends to 2nd dword c=0 ebx=0 edx=524288 while ebx < 20 test double1 edx je douboas1 or beforedp ecx douboas1: shr edx shr ecx inc c ebx=c endw eax=exp sub eax 20 n=eax c=0 ebx=0 edx=2147483648 while ebx < n test double2 edx je douboas2 or beforedp ecx douboas2: shr edx shr ecx inc c ebx=c endw eax=32 sub eax n n=eax ecx=2147483648 c=0 ebx=0 while ebx < n test double2 edx je douboas3 or afterdp ecx douboas3: shr edx shr ecx inc c ebx=c endw jmp doasc_nex endif #--------------------- if exp <= 20 #beforedp is within 1st dword if exp < 0 #case of 0.something c=0 ebx=0 edx=524288 ecx=1048576 or afterdp ecx #leftmost 1 shr ecx while ebx < 20 test double1 edx je douboas10 or afterdp ecx douboas10: shr edx shr ecx inc c ebx=c endw denom=2097152 #2^21 eax=0 sub eax exp exp=eax dec exp ebx=0 while ebx < exp shl denom inc ebx endw beforedp=0 jmp douasc_out endif #---------- eax=exp add eax 12 n=eax c=0 ebx=0 edx=524288 while ebx < exp test double1 edx je douboas4 or beforedp ecx douboas4: shr edx shr ecx inc c ebx=c endw eax=32 sub eax n n=eax ecx=2147483648 ebx=0 c=0 while ebx < n test double1 edx je douboas5 or afterdp ecx douboas5: shr edx shr ecx inc c ebx=c endw eax=32 sub eax n n=eax edx=2147483648 ebx=0 c=0 while ebx < n test double2 edx je douboas6 or afterdp ecx douboas6: shr edx shr ecx inc c ebx=c endw doasc_nex: temp=0 ebx=0 c=0 edx=2147483648 ecx=134217728 #2^27 while ebx < 26 #this figure chosen by trial & error test afterdp edx #for best results je douboas7 or temp ecx douboas7: shr edx shr ecx inc c ebx=c endw eax=temp afterdp=eax denom=268435456 #2^28 endif douasc_out: t=0 n=0 invoke writemem blank 0 3 0 dc=strcat blank blank started=0 while n < 24 xor edx edx eax=afterdp ecx=denom div ecx if eax=0 if started=1 temp=edx add eax 48 invoke writemem blank 0 3 eax dc=strcat dc blank eax=temp ecx=10 mul ecx afterdp=eax jmp douboas8 endif eax=afterdp ecx=10 mul ecx afterdp=eax if started=0 inc t #this determines the leading zeros if any endif jmp douboas8 endif if eax > 0 started=1 temp=edx add eax 48 invoke writemem blank 0 3 eax dc=strcat dc blank eax=temp ecx=10 mul ecx afterdp=eax endif douboas8: inc n endw st=NumToAsci beforedp st=strcat st stop ebx=0 c=0 dec t while ebx < t st=strcat st zero inc c ebx=c endw st=strcat st dc edx=2147483648 test double1 edx je douboas9 st=strcat min st douboas9: eax=st leave ret 4 endp #------------------------------------------------------------------------ proc WndProc dword hwnd dword msg dword wparam dword lparam dword fn 0 dword hdc 0 dword n 0 dword m 0 dword x 0 dword y 0 dword a 0 dword b 0 sequence c 12 sequence ps 64 sequence rect 16 dword ordata 0 dword d 0 push ebp mov ebp esp add esp -180 n = 0 cmp [msg] {WM_CREATE} je wmcreate cmp [msg] {WM_PAINT} je wmpaint cmp [msg] {WM_COMMAND} je wmcommand cmp [msg] {WM_DESTROY} jne default push 0 call PostQuitMessage jmp exit wmcreate: mov eax {WS_CHILD} or eax {WS_BORDER} or eax {WS_VISIBLE} ordata= eax invoke CreateWindowExA 0 btn comp ordata 300 120 100 25 hwnd 0 hInstance 0 mov hbtn1 eax invoke SendMessageA hbtn1 {WM_SETFONT} hfont1 0 mov eax {WS_CHILD} or eax {WS_BORDER} or eax {WS_VISIBLE} ordata= eax invoke CreateWindowExA 0 text blank ordata 100 20 300 25 hwnd 0 hInstance 0 mov htext1 eax invoke SendMessageA htext1 {WM_SETFONT} hfont1 0 mov eax {WS_CHILD} or eax {WS_BORDER} or eax {WS_VISIBLE} ordata= eax invoke CreateWindowExA 0 text blank ordata 100 50 300 25 hwnd 0 hInstance 0 mov htext2 eax invoke SendMessageA htext2 {WM_SETFONT} hfont1 0 mov eax {WS_CHILD} or eax {WS_BORDER} or eax {WS_VISIBLE} ordata= eax invoke CreateWindowExA 0 text blank ordata 100 80 300 25 hwnd 0 hInstance 0 mov htext3 eax invoke SendMessageA htext3 {WM_SETFONT} hfont1 0 mov eax {WS_CHILD} or eax {WS_VISIBLE} ordata= eax invoke CreateWindowExA 0 static s1 ordata 20 20 50 25 hwnd 0 [hInstance] 0 mov hst1 eax invoke SendMessageA hst1 {WM_SETFONT} hfont2 0 invoke CreateWindowExA 0 static s2 ordata 20 50 50 25 hwnd 0 hInstance 0 mov hst2 eax invoke SendMessageA hst2 {WM_SETFONT} hfont2 0 invoke CreateWindowExA 0 static s3 ordata 20 80 50 25 hwnd 0 hInstance 0 mov hst3 eax invoke SendMessageA hst3 {WM_SETFONT} hfont2 0 jmp exit wmpaint: lea eax [ps] invoke [BeginPaint] [hwnd] eax mov [hdc] eax lea eax [ps] invoke [EndPaint] [hwnd] eax jmp exit wmcommand: #menu items if lparam = 0 if wparam = 101 jmp exit endif if wparam = 102 jmp exit endif if wparam = 200 jmp exit endif if wparam = 202 jmp exit endif if wparam = 203 jmp exit endif if wparam = 204 endif if wparam = 806 endif jmp default endif btn1: mov eax [hbtn1] cmp [lparam] eax jne btn2 finit 0 invoke SendMessageA htext1 {WM_GETTEXT} 48 fpno1 invoke SendMessageA htext2 {WM_GETTEXT} 48 fpno2 n=0 m=0 invoke ascTodouble fpno1 float1 fld float1 invoke ascTodouble fpno2 float1 fadd float1 inc n fst float1 invoke doubleToasc float1 invoke SendMessageA htext3 {WM_SETTEXT} 0 eax jmp exit btn2: mov eax [hbtn2] cmp [lparam] eax jne btn3 jmp exit btn3: mov eax [hbtn3] cmp [lparam] eax jne btn4 jmp exit btn4: mov eax [hbtn4] cmp [lparam] eax jne btn5 jmp exit btn5: mov eax [hbtn5] cmp [lparam] eax jne btn6 jmp exit btn6: mov eax [hbtn6] cmp [lparam] eax jne default default: invoke DefWindowProcA hwnd msg wparam lparam leave ret 16 exit: xor eax eax leave ret 16 endp #------------------------------------------------------------------------ proc WinMain dword hinst dword previnst dword comline dword cmdshow sequence wc 48 dword ordata 0 dword len 0 dword topmenu 0 dword dropmenu 0 dword sepmenu 0 push ebp mov ebp esp add esp -80 mov eax fon2 mov [eax] 16 add eax 16 mov [eax] 400 add eax 12 invoke strcpy eax font2 hfont2 = CreateFontIndirectA fon2 mov eax fon1 mov [eax] 10 add eax 16 mov [eax] 400 add eax 12 invoke strcpy eax font1 hfont1 = CreateFontIndirectA fon1 [wc]= 48 [wc+4] =3 [wc+8]= WndProc [wc+12]= 0 [wc+16] =0 eax =[hInstance] [wc+20]= eax push 1 push [hInstance] call [LoadIconA] [wc+24]= eax [wc+44]= eax push {IDC_CROSS} push 0 call [LoadCursorA] [wc+28] =eax [wc+32]= 16 [wc+36]= 0 [wc+40]= ClassName lea eax [wc] invoke RegisterClassExA eax eax={WS_CAPTION} or eax {WS_SYSMENU} or eax {WS_MINIMIZEBOX} #or eax {WS_MAXIMIZEBOX} ordata=eax invoke CreateWindowExA {WS_CLIENTEDGE} ClassName WindowCaption ordata 50 50 450 200 0 0 hInstance 0 hwndMain= eax push 1 push [hwndMain] call [ShowWindow] push [hwndMain] call [UpdateWindow] MsgLoop: invoke [GetMessageA] msg 0 0 0 cmp eax 0 je exitprocess invoke [TranslateMessage] msg invoke [DispatchMessageA] msg jmp MsgLoop exitprocess: mov eax [msg+8] leave ret 16 endp #------------------------------------------------------------------------ EntryPoint push 0 call [GetModuleHandleA] mov [hInstance] eax call [GetCommandLineA] mov [CommandLine] eax invoke WinMain [hInstance] 0 [CommandLine] 10 push eax call [ExitProcess] end code #-----------------Resources--------------------------------------- begin resources icon win32app.ico end resources