Here are just some general win32 assembly related questions. Why is it that there are these new registers, eax, (i know there are some more but can't remember their names) that start with e but seem to be copys of the normal ones (ax bx cx). Do we use a,b,cx much anymore? (Haven't really looked at asm in a week so that might sound crazy) When something says: '.while' is that just a general loop? (refering to tut3 or 4.). I think it broke out with .break (!eax) which looks kind of odd. is that 'Break if eax doesn't equal 0'? If related: If things equal 0, then they're true? (They don't really EQUAL 0, its just the equation that makes them that in memory(?)) Logical operands! Just seeing if I am correct: OR Lets you turns bits ON while keeping other bits at whatever they were. AND is the opposite, it turns bits off while leaving the other bits alone. XOR toggels bits on or off, and leaves the other ones alone. NOT 'inverts' the whole byte. So that 10001 is now 01110. Sorry I haven't looked at much asm this week and am a bit tired. So sorry if they sound very basic or horribly wrong.
One thing you have to remember about the 32 bit Pentium computer is it "grew" out of a simple 8 bit data/ 16 bit address processor, and some things are still leftover from the bad old days. Orgionally, the AX register was 16 bits. It was divided into 2 8 bit registers AH (the higher byte) and AL (the lower byte) so either could be saved to memory over the 8 bit data bus. When 32 bits came along, the register was expanded to that, and it was called "EAX" (the E meaning Expanded). The 'extra' 16 bit part was not named, as one usually wants either a byte (AL), a word (AX), or a dword (EAX) quantity. The only way to get just the high 16 bits of EAX is to somehow move it to the lower portion, by shifting it there. Tut #3 does have a ".BREAK .IF (!eax)" line. This means just that, break if eax is zero (if eax = zero, not zero is, well, something). Keep in mind .BREAK and .IF are macros, not really code. The compiler will generate the code needed (and it usually does a good job). I nver liked remembering ligical operations by definitions such as you use (though they are correct). I prefer truth tables: 0 or 0 = 0 1 or 0 = 1 0 or 1 = 1 1 or 1 = 1 0 and 0 = 0 1 and 0 = 0 0 and 1 = 0 1 and 1 = 1 0 xor 0 = 0 1 xor 0 = 1 0 xor 1 = 1 1 xor 1 = 0 not 0 = 1 not 1 = 0 Seems you are getting the groudwork covered just fine :-)
Ok that explains it well. Some more basic questions!!! w00t..arghh dos was soo easier About message processing: The Window goes into a loop where it gets it's messages, translates them from gibberish (keyboard scan codes) to readable stuff (ascii??), and then gives them back to windows, and windows will give it to the proper procedure (in tut3's case WndProc). -DispatchMessage just has the message send to the proper proc?- Ack i forgot what else to ask...um [10 secs later] Why does our message loop have to check for WM_QUIT? The message loop handles WM_DESTROY. Is there much difference between the two? If wm quit is recieved it breaks out of the proc and calls exitprocess, but if wm_destroy is recieved it calls postquitmessage.. So if one is called then the other won't get called. .BUT, perhaps this is happening: Windows sends WM_DESTROY, and our program calls PostQuitMessage which has windows send WM_CLOSE (??). Lastly, but not leastly: I want to get into making demos! (i want to do a lot of things though and it might not happen) Remember all the demos that the old virus zines had? These neat demos showing their group name floating around in techocolor and mabye some techo music in the background. How would you make one of these demos? They used dos back then, but how do you do console programming that puts the console into a video mode and puts these pixels to the screen? Do you use API for that or should you use pretend you're programming for dos? (ouch those blasted ints are harder to learn than APIs.) Oh wait, one more quick thing. Why use .DATA? instead of just .DATA? TASM ppl use data for everything (from the virii code ive seen at least). Is .data? just more effecient at using the memory perhaps? I was less tired here and it seems fairly well written. Thanks Ernie for answering those previous questions, would you mind answering more? :) BTW, how often do you check the messageboard? I know when i'm really interested in asm ill check it every hour and read the posts.. heh.. anways, BYE! Thanks in advance, .Matt , asking boring long basicquestions since April 2001
Matt, The difference between .DATA and .DATA? is whether the allocated variable is initialised to a value or not. In the .DATA section .DATA MyVar db "This is a text string that is zero terminated",0 This takes up space in the EXE file but if you need to have a GLOBAL value that you set at runtime, you don't need to take up that space in the EXE file so you use the .DATA? section for that. .DATA? MyString db 128 dup (?) This is usually called the uninitialised data section. Window messaging does the WM_CLOSE first, you can trap the message and do things like file save confirmation but when this message is processed by the default message handler in the WndProc, the WM_DESTROY is sent and the PostQuitMessage is sent to the main message loop, GetMessage() returns ZERO and the application exits the message loop and closes. There is a reasonably well developed DEMO scene in Europe but be aware that it can be very sophisticated stuff to write. What I would suggest to you is learn you basic hack windows coding first as it allows you to do many more things. If you start trying to code DEMOS before you learn the basic windows stuff, it will be very hard going. With only a few exceptions, the old TASM style of virus coding was really crappy code that was badly written with the "idiot savant" mentality. There is a lot of good code around that has much better architecture and clean fast and economical techniques. Iczelions code, Test Departments big collection of example code, MASM32 example code and code that is posted by many of the members of this forum. Have a good look through this stuff as it will help you to get a wider perspective of windows coding. Regards, email@example.com This message was edited by hutch--, on 5/12/2001 2:56:47 AM
Hutch, You referred to 'Test Departments big collection of example code'. What/Where is this? Is there a link to it? .Matt, with nothing witty to say
Matt, http://www.geocities.com/Paris/Cafe/8444/index.htm This URL will get you to Test Department's example code. Regards, firstname.lastname@example.org
As a tip, when ever you hear of a key word like 'test department', try a Google search under this keyword. I usually do and often find what i was looking for... NaN