Re: Beginner Learning Assembler
- From: "Evenbit" <nbaker2328@xxxxxxxxxxx>
- Date: 23 Aug 2005 04:16:00 -0700
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.
.
- Follow-Ups:
- Re: Beginner Learning Assembler
- From: JGCASEY
- Re: Beginner Learning Assembler
- References:
- Beginner Learning Assembler
- From: JGCASEY
- Beginner Learning Assembler
- Prev by Date: Re: Beginner Learning Assembler
- Next by Date: Re: Bugs in donkey.lib
- Previous by thread: Re: Beginner Learning Assembler
- Next by thread: Re: Beginner Learning Assembler
- Index(es):