flat assembler
Message board for the users of flat assembler.
Index
> Windows > [SOLVED] What is hidden behind a macro? (Wasn't even one...) |
Author |
|
typedef 11 Jan 2012, 21:25
If you are originating from the high level world, it should be easy to understand.
But if this is your first programming language then you'll need to learn a couple of things first before you get to this part. |
|||
11 Jan 2012, 21:25 |
|
Apos 11 Jan 2012, 21:30
I have been programming in Java for the past 3 years and I've done a lot of c programming in University. So far, I haven't had much problems with ASM, it doesn't feel too different from the high level world (Of course there is still a lot to learn.).
After writing the OP, I've realized that I should probably look more into how macros work. |
|||
11 Jan 2012, 21:30 |
|
AsmGuru62 11 Jan 2012, 22:11
When you see invoke -- it calls a Win32 API function, so WriteConsole is not a macro. To see, what WriteConsole does -- load that code into debugger (I suggest OllyDbg) and once debugger stops at that line -- press F7 -- and debugger should STEP-INTO the function in question. However, I must say, that code there is just a set of calls to other functions in Windows Core.
|
|||
11 Jan 2012, 22:11 |
|
Apos 11 Jan 2012, 22:23
Whoa, that's neat! Thanks.
|
|||
11 Jan 2012, 22:23 |
|
Tyler 11 Jan 2012, 23:19
As a general explanation, code like that is usually very OS dependent. I remember when I was getting into asm, I wanted to learn how to write the stuff to the console myself and do everything else at the most basic level, and I assume that's what you're after. The problem is that a lot of it can't be done so simply and a lot of it isn't as interesting and low-level as you might think. The actual implementation of WriteConsole is probably just a call to an API that implements an emulated terminal as just another window, which, like all windows, is drawn by the GUI compositor (thing that draws pixels for the GUI). You could probably get just as much information from debugging how a window is drawn.
To anyone who knows, can drivers be debugged? That would be an obvious prerequisite to seeing how the Windows driver draws the pixels. And even then, you'd probably just see a call to the GPU, which you can't debug. |
|||
11 Jan 2012, 23:19 |
|
Apos 11 Jan 2012, 23:42
The thing is, I tought it was the way everything was done in ASM. Anytime someone woul talk to me about ASM, it would seem like it was way too hard and useless. Then I started to talk to retired programmers and most of them would tell me they never programmed in any other language than ASM. This week, I found the book "Art of Assembly Language Programming and HLA" by
Randall Hyde so I'm starting to see for myself. |
|||
11 Jan 2012, 23:42 |
|
Tyler 11 Jan 2012, 23:52
They're retired because they're old. They probably recommend Fortran, too. Don't listen to that, either. There used to be a lot of programming in asm (before HLLs were invented and widely used).That's not really the case anymore. It's just not productive enough to be used commercially without a REALLY good reason.
I look at it more as a hobby, something to learn because you value the knowledge itself, not because you expect to get a job doing it. |
|||
11 Jan 2012, 23:52 |
|
typedef 11 Jan 2012, 23:55
Yes drivers can be debugged but not the way you debug User mode apps.
The WinDDK comes with debugging tools for such purposes. WinDbg is one of the best debuggers too. It can do kernel mode(via ports) and User mode debugging. |
|||
11 Jan 2012, 23:55 |
|
Apos 12 Jan 2012, 13:28
Wait, invoke appears to be a macro:
Code: invoke WriteConsole,[outhandle],string1,12,numwritten,0 is the same as: Code: push 0 push numwritten push 12 push string1 push [outhandle] call [WriteConsole] |
|||
12 Jan 2012, 13:28 |
|
AsmGuru62 12 Jan 2012, 15:17
Yes -- the same.
|
|||
12 Jan 2012, 15:17 |
|
cod3b453 12 Jan 2012, 18:14
I'd recommend you download AMD Volume 3 (or Intel Volume 2) manual for a list of general instructions, as this will help you to disambiguate instructions from assembler directives and macros [as well as help you understand what happens in hardware]. You'll notice that some of these map to C operators e.g. shl is <<, not is ~.
|
|||
12 Jan 2012, 18:14 |
|
DOS386 13 Jan 2012, 08:51
> invoke AllocConsole
if you set subsystem to console you don't have to alloc it later > I'd recommend you download AMD Volume 3 (or Intel Volume 2) or the only volume on Intel 80386 (less instructions) |
|||
13 Jan 2012, 08:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.