flat assembler
Message board for the users of flat assembler.
Index
> Windows > CreateThread and Proc |
Author |
|
revolution 27 Dec 2005, 08:37
I think you need to post a compilable subsection of your code here. That makes it easier for others to help you. Try to reduce it to just the parts that you are having the trouble with then show the working vs non-working code sets so we can compare and see what is going wrong.
|
|||
27 Dec 2005, 08:37 |
|
msmith 27 Dec 2005, 21:21
revolution,
I will try to do that. Please keep in mind that this is compiler gerated code which carries a lot of code that has nothing to do with the problem. I will either pare back a compiled file or, alternatively make a hand generated pgm that will demonstrate the problem. Either will take some time. With that said, I would think that someone could tell me if the proc in my post has correct ot incorrect framing, and why moving the frame around should have any affect. I think we are going to find out that there is an error in my framing or that there is an assembler bug. Thanks, Mike |
|||
27 Dec 2005, 21:21 |
|
r22 28 Dec 2005, 00:24
Quote:
What is the ! doing in your mov? Looks odd are you NOTing the memory address of the proc and then mov the ThreadHandle (in EAX) into that NOTed address? or is the ! meaningless, in which case your overwriting the ENTER instruction in your thread proc with EAX? Why is STATUS being used as a parameter for your thread proc and the parameter for the CreateThread function to return the threadID? If you want your thread proc to know its thread ID then pass the memory address to STATUS in the correct arg of CreateThread. Also, in your thread proc you have an ENTER opcode but you have no LEAVE opcode before the return statement. Why even bother using the PROC macro at all? More context (what your trying to accomplish) is need to fix your problem. |
|||
28 Dec 2005, 00:24 |
|
msmith 28 Dec 2005, 00:39
r22,
The ! is used because it is an acceptable char in a symbol name in fasm, but not to my compiler users. I allows the compiler to generate priviledged names. In fasm ! has nothing to do wit NOT, that is the c language. STATUS is a compiler variable set to the result of many (usually I/O) operations so that the user can see status. My usage of STATUS in the CreateThread is merely to allow the user to store away the ID if he wishes to. You will notice that the compiler stores away the handle for its own <later> use. There is nothing incorrect about this at all. Quote:
This is where someone may be able to help me. If you look at the earlier thread I mentioned, Comrade and I were trying to figure out what was nedded here and what the macros were doing. |
|||
28 Dec 2005, 00:39 |
|
msmith 28 Dec 2005, 01:50
r22,
Quote:
I think there is a lot of wisdom in this statement! I changed the proc to look like this: [code] CommTask: push esp ; LN:174 BEGIN LOOP _Lbl42: ; LN:175 GOSUB GetData call GetData ; LN:176 END LOOP jmp _Lbl42 _Lbl43: ; LN:177 END TASK pop esp ret Now it assembles fine under all of the conditions that it previously failed. I think maybe I should adjust the stack at the beginning to throw away the incoming arg? Is this correct. I think what it would be helpful if someone would describe all these framing macros. Another way of asking this is: if my pgm works fine without all these framing macros, why use them? Thanks, Mike |
|||
28 Dec 2005, 01:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.