From: Ludwig Hähne on 23 Aug 2005 07:12 Hi John, > When Beta and VHS went head to head I was told > Beta was a better product. If for arguments > sake this was the case Beta still failed as VHS > apparently had more movie titles which was the > whole point of video tape in the first place. One interesting spot in your analogy is the following: Movie titles are consumer goods while in the coding area *you* are meant to be the producer. It may need a few very good ones (movies/tutorials) to get you inspired, but then you don't want to watch videos all day when you originally planned to make your own movie :) > And I think that would apply to operating systems > such as Linux vs. Windows or applications such as > MASM, TASM, NASM, FASM, RosAsm, GAS or HLA. In > the case of the list of assemblers read "tutorials" > instead of "titles". > > In my quest to get up to speed with Windows assembler > the cold reality is MASM has the examples. .... and most other assemblers have them as well. > Now when I first learnt assembler for DOS with TASM > and then went onto MASM the translation was easy as > none of the books used the high level constructs > and directives I see in the MASM Window examples. > > Thus I get an example like this, > > .. . . > > start: ; The CODE entry point to the program > > print chr$("Hey, this actually works.",13,10) > exit > ; > end start ; Tell MASM where the program ends > > Without any explanation of where the "print" instruction > came from or how to use it. > > As for Iczelion's tutorials they do assume a working > knowledge of MASM. So I wonder how many programmers > using NASM, FASM, RosASM etc actually learnt Windows > assembler using those assemblers? There are no beginner > tutorials for them so I suspect they learnt assembler > with MASM? I learnt the basics of (inline) assembler with Turbo Pascal and later Delphi, then switched to NASM because of its IMHO far superior syntax and with it I *really* learnt assembler. Finally, I tried RosAsm (its name was SpAsm back then) and gained fluency in writing assembler and learnt Win32 with it. The transition from one assembler to another is not that difficult as long as you avoid the use of macros and write plain asm. > Window examples don't look like the old assembly > language I learnt with DOS that is for sure! > > "Instead, a large number of the statements > are macro invocations. Now this may be great for > the programmer who has created all these macros > and intimately understands their operation. To > the 80x86 programmer who isn't familiar with > those macros, however, it's all gibberish." > > My thoughts exactly. Unless *fully* explained > they are all gibberish. As you are experienced with assembly you might prefer Test Departments Win32 demos written in plain asm and are also available for RosAsm: http://www.rosasm.org/TDtuts.zip They are well documented and don't require the knowledge of the advanced language features that the assemblers provide. > That's why, and I direct this to Rený in particular, > I have to use MASM. Whatever you like. > I don't have the education or time to learn from > the intel documentation when there is an easier > way. Let experts like Randy Hyde explain it to > me with his AoA the same way I learnt DOS > assembler from the assembler books I have on my > shelf. I have to use the assembler they use. You have to? Because they say so? :) > The only alternative is for those developing yet > another assembler is to realise that if they want > new blood they need to spend more time on tutorials > and less time on giving their product even more > bells and whistles. If you have the time, download the RosAsm package and the test department tutorials from the RosAsm page and have a look at the first tutorial. I would be interested of what someone experienced with asm but new to Win32 coding thinks of it ... Regards, Ludwig
From: Evenbit on 23 Aug 2005 07:16 JGCASEY wrote: > When Beta and VHS went head to head I was told > Beta was a better product. If for arguments > sake this was the case Beta still failed as VHS > apparently had more movie titles which was the > whole point of video tape in the first place. > > And I think that would apply to operating systems > such as Linux vs. Windows Your analogy fails here too. Linux is the higher quality product. Linux has more applications available for it (typically, it already comes with more than the average user needs right "out of the box"). Linux is user scalable and thus gets adapted to all the new platforms. Linux is free and thus gets spread to more machines than Windows -- so it wins the popularity contest too. Companies are abandoning MS products because they don't appreciate being locked-in to proprietary technology (this cost them more $$$ in the long run). For a long time now, Microsoft has been experiencing a difficult time selling upgrades to Windows because the upgrades don't offer any real incentive to "make the switch" -- certainly not enough to justify buying WinXP licenses for a 5,000 seat call center that works fine using Win9x, for instance [I can't remember the number...something like 20% or 40% of business, industrial, and institutional seats are still running (and plan to continue) "obsolete" OSs ... some even using Win95 and DOS]. Heck, Bill Gates already came to the conclusion (back when he wrote his book) that there is little future in selling operating systems now that they've become ubiquitous. That's one of the factors for why MS can no longer turn a profit. Bill is attempting to restructure the company's focus but is fighting against the inertia of the behemoth that he created plus he is fighting the new realities of the 'industry' at the same time. > As for Iczelion's tutorials they do assume a working > knowledge of MASM. So I wonder how many programmers > using NASM, FASM, RosASM etc actually learnt Windows > assembler using those assemblers? I think you are confused about a number of things here. Don't assume that a language and the tool to compile it are the same thing. The C language is still the C language no matter what compiler you use. Same thing with assembly. Also, the Windows API is still the same Windows API no matter what assembler you use. I suspected some of this confusion in your earlier posts... even though you seem to sometimes get it... then you do a 180 and seem to confuse things again... so, just to make sure you are clear on this: Assembly {or C, or Basic, or Pascal} language is seperate from the toolset used to create applications writen in assembly {or C, or Basic, or Pascal}. In other words: The compiler IS NOT the language. The 'stdlib' IS NOT the language. The header file IS NOT the language. The IDE IS NOT the language. The Form Designer IS NOT the language. The Application Framework IS NOT the language. The Windows API IS NOT the language. The Interupt Calls {just another API} IS NOT the language. The etc... "XOR EAX, EAX" is going to be encoded the same no matter which assembler you use -- just the way that you express it -- "xor( eax, eax )", "xor %eax, %eax" -- its syntax, changes. So, it is relatively trivial for a regular user of one assembler to read source code written for another assembler and 'translate' it to the proper syntax, etc.. for the compiler he/she is comfortable with. > > > Although I think I get the "invoke" statement there are > other statements such as, > > LOCAL wc:WNDCLASSEX ; create local variables on stack > > that are not explained in a way I could translate this > to say FASM. "wc" is a local variable. "WNDCLASSEX" is a record (or structure) defined in the header file. > > and what I presume are directives of some kind, > > .WHILE TRUE ; Enter message loop > invoke GetMessage, ADDR msg,NULL,0,0 > .BREAK .IF (!eax) > invoke TranslateMessage, ADDR msg > invoke DispatchMessage, ADDR msg > .ENDW > > leaving me wondering what is being tested for being TRUE? Answer: Nothing. This ".WHILE TRUE... .ENDW" simply sets up a loop that doesn't have a defined exit -- so it loops forever. HLA uses the "forever... endfor;" construction to do the same thing. In your DOS assembly, you probably did the same thing (and you can optionally do it here too if you are more comfortable with what you already know) by simply defining a label (like "here:" or "@@:") in place of the ".WHILE TRUE" and then using a jump to that label ("jmp here" or "jmp @B") in place of the ".ENDW" line. > I don't have the education or time to learn from > the intel documentation when there is an easier The Intel documentation isn't going to be of much help with Windows API programming -- Intel manufactures and sells CPUs, not GUI operating systems. Since you said you have been programming in high level languages, perhaps you would be more comfortable using one of those in your transition from DOS to Windows programming? Learn and explore the Windows API from there first, and THEN jump back to assembly. Here is a resource for Windows programming in Visual Basic, Delphi, and C++ Builder: http://www.cpcug.org/user/clemenzi/technical/Languages/WindowsAPI.htm And below you'll find the source code for the standard Windows application written in C (which I pulled from here: http://www.cplusplus.com/src/ ). See anything you recognize from those xillian tutes? .. . . . . . . . . . . . . . . . . . . . // written by jared bruni // for planetsourcecode // this was a request. // keep your coding requests coming ! // having multiple windows, using pure C #include <windows.h> #define BOPEN1 1 // function prototypes void InitApp(HINSTANCE); LRESULT APIENTRY MainProc(HWND,UINT,WPARAM,LPARAM); LRESULT APIENTRY OtherProc(HWND,UINT,WPARAM,LPARAM); // variables HWND hwnd; HWND other; HWND bopen; HINSTANCE g_hInst; // winmain entry point int APIENTRY WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR line,int CmdShow) { MSG msg; g_hInst = hInst; InitApp(hInst); while(GetMessage(&msg,0,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } // initlize application void InitApp(HINSTANCE hInst) { WNDCLASS wc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH); wc.hInstance = hInst; wc.hCursor = LoadCursor(NULL,IDC_ARROW); wc.hIcon = LoadIcon(NULL,IDI_APPLICATION); wc.lpfnWndProc = (WNDPROC) MainProc; wc.lpszClassName = "Main"; wc.lpszMenuName = NULL; wc.style = CS_HREDRAW | CS_VREDRAW; RegisterClass(&wc); wc.lpszClassName = "Other"; wc.lpfnWndProc = (WNDPROC) OtherProc; RegisterClass(&wc); hwnd = CreateWindow("Main","Main Window",WS_OVERLAPPEDWINDOW,0,0,170,55,0,0,hInst,0); other = CreateWindow("Other","Other",WS_OVERLAPPEDWINDOW,200,200,200,200,0,0,hInst,0); ShowWindow(hwnd,SW_SHOW); UpdateWindow(hwnd); } // Main Process CallBack Function LRESULT APIENTRY MainProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { case WM_DESTROY: PostQuitMessage(0); break; case WM_CREATE: { bopen = CreateWindow("Button","Open Window 2",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,5,5,150,20,hwnd,(HMENU)BOPEN1,g_hInst,0); } break; case WM_COMMAND: { switch(HIWORD(wParam)) { case BN_CLICKED: switch(LOWORD(wParam)) { case BOPEN1: ShowWindow(other,SW_SHOW); break; } break; } } break; default: return DefWindowProc(hwnd,msg,wParam,lParam); } return 0; } // Other Window CallBack Function LRESULT APIENTRY OtherProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { case WM_CLOSE: ShowWindow(hwnd,SW_HIDE); break; default: return DefWindowProc(hwnd,msg,wParam,lParam); } return 0; } .. . . . . . . . . . . . . . . . . . . . Nathan.
From: JGCASEY on 23 Aug 2005 17:21 Ludwig Hähne wrote: > As you are experienced with assembly you might > prefer Test Departments Win32 demos written in > plain asm and are also available for RosAsm: > > http://www.rosasm.org/TDtuts.zip I downloaded the Test Departement Win32 Tutorials but I only seem to get the .exe files? Regards, John
From: JGCASEY on 23 Aug 2005 17:22 Evenbit wrote: > JGCASEY wrote: > > and what I presume are directives of some kind, > > > > .WHILE TRUE ; Enter message loop > > invoke GetMessage, ADDR msg,NULL,0,0 > > .BREAK .IF (!eax) > > invoke TranslateMessage, ADDR msg > > invoke DispatchMessage, ADDR msg > > .ENDW > > > > leaving me wondering what is being tested for > > being TRUE? > > > > Answer: Nothing. This ".WHILE TRUE... .ENDW" > simply sets up a loop that doesn't have a defined > exit -- so it loops forever. So without the directives it would be written something like this? Here: invoke GetMessage, ADDR msg, NULL, 0, 0 cmp eax,0 jnz ExitLoop invoke TrasnlateMessage, ADDR msg invoke DispatchMessage, ADDR msg jmp Here ExitLoop: Thanks for the post I am starting to get a few misconceptions corrected, I think :) John.
From: f0dder on 23 Aug 2005 17:26
JGCASEY wrote: > Ludwig Hýhne wrote: > >> As you are experienced with assembly you might >> prefer Test Departments Win32 demos written in >> plain asm and are also available for RosAsm: >> >> http://www.rosasm.org/TDtuts.zip > > I downloaded the Test Departement Win32 Tutorials > but I only seem to get the .exe files? That is because RosASM follows the rather unusual method of embedding source code inside the executables. So you'll need RosASM or a hexeditor to use it. Or google for "test department", iirc the code was originally written for masm. |