flat assembler
Message board for the users of flat assembler.
Index
> Windows > My Old Macros Dont Work in 1.55 (I think) |
Author |
|
MattBro 23 Sep 2004, 15:35
Here is a complete, compilable routine
Code: ; example of simplified Win32 programming using complex macro features include '%fasminc%/win32ax.inc' ; printf call to a message box ; requires a preallocated character array at _t777 ; and a title string in _atitle ; this version creates it's own local format string data ; formstr should be an immediate string variable macro Aprintf formstr, [args] { common local str00 jmp @f str00 db formstr,0 @@: pusha if ~ args eq cinvoke wsprintf, _t777, str00, args else cinvoke wsprintf, _t777, str00 end if invoke MessageBox, HWND_DESKTOP, _t777, _atitle ,MB_OK popa } .data _t777 db '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890',0 _atitle db 'Aprintf',0 .code start: mov eax, 0 mov ebx, 1 mov ecx, 2 mov edx, 3 Aprintf 'eax: %d ebx: %d ecx: %d edx: %d', eax, ebx, ecx, edx Aprintf 'eax: %d ebx: %d ecx: %d edx: %d', eax, ebx, ecx, edx invoke ExitProcess,0 .end start Sure enough the ebx register has been altered. This did not used to happen before. Here is the description of the pusha instruction from the manual: pusha saves the contents of the eight general register on the stack. This instruction has no operands. There are two version of this instruction, one 16–bit and one 32–bit, assembler automatically generates the right version for current mode, but it can be overridden by using pushaw or pushad mnemonic to always get the 16–bit or 32–bit version. What am I missing? Actually I'm also puzzled as to why this compiled. I forgot to load MessageBox from user32.dll Regards, -Matt B. _________________ -- ------------------------------------------------------- "I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus --------------------------------------------------------- |
|||
23 Sep 2004, 15:35 |
|
Tomasz Grysztar 23 Sep 2004, 15:57
For me it works correctly. How did you perform the update?
|
|||
23 Sep 2004, 15:57 |
|
MattBro 23 Sep 2004, 16:40
To perform the update I simply unpacked the new files into a new directory. However I dumped both the fasmw.exe and fasm.exe files all into the same directory, assuming that there would be no conflict and that they share the same include files etc. After all, what could possibly go wrong? (jk) I forget which one I dumped in there last, but it was probably the fasmc. I set my fasmw.ini to point to the include directory in the install directory (which I called fasm).
Here is another clue. I am providing a dump from Ollydebug for the program above compiled with the two versions. (see enclosure) The 1.55 versions adds an extra push eax call after the MessageBox call, which it would seem would mess up the stack, and yet 3 out of 4 of my registers are restored and I don't crash. Should I try a clean install in two separate directories? OK an update on this. I tried a clean install of fasmw and it worked. Which means that I probably overwrote some stuff with my fasm.exe install into the same directory. One of those installs I downloaded from sourceforge instead of Privalov's download page, which I could not access yesterday. I will now do a seperate install of fasm.exe and see if the problem is still gone. Yes now they both work, provided I don't try to mix include files. Actually it seems to be ok just to copy the fasm.exe executable over to the fasmw directory. Thanks for your help. -Matt
_________________ -- ------------------------------------------------------- "I am the Way and the Truth and the Light, no one comes to the Father except through me" - Jesus --------------------------------------------------------- |
|||||||||||
23 Sep 2004, 16:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.