Re: Structures in Assembly Language
From: Betov (betov_at_free.fr)
Date: 08/18/04
- Next message: Betov: "Re: a common belief or a wrong C[++] compiler?"
- Previous message: Randall Hyde: "Structures in Assembly Language"
- In reply to: Randall Hyde: "Structures in Assembly Language"
- Next in thread: Randall Hyde: "Re: Structures in Assembly Language"
- Reply: Randall Hyde: "Re: Structures in Assembly Language"
- Reply: Percival: "Re: Structures in Assembly Language"
- Reply: hutch--: "Re: Structures in Assembly Language"
- Reply: f0dder: "Re: Structures in Assembly Language"
- Reply: luvr: "Re: Structures in Assembly Language"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Aug 2004 16:04:18 GMT
"Randall Hyde" <randyhyde@earthlink.net> écrivait news:RwKUc.6023$3O3.5451
@newsread2.news.pas.earthlink.net:
> Hi All,
>
> [... Tons of insane bullshits, as usual...]
To beginners:
* Take care of such Posts: They are not at all designed
to help you in any manner, at understanding anything
about Assembly. Their only purpose is to misslead you,
and to sell you a pure horror, called HLA.
* There is no concept similar to C-Like Structures in
Assembler and there will never be any, for the very simple
reason, that, an Assembler offering C-Like Structures is
no longuer an Assembler, but, an Assembly Compiler.
* The implementation of C-like Structures in an Assembly
Compiler have only inconvenients and no advantage.
- What is a C-Like Structure:
A C-Like Structure is the Abstration of a Data Chunk, that
is nothing but a group of hidden Equates. The reason why
you cannot have hidden Equates, with an Assembler, is that
an Assembler is not a Tool that _hides_ anything, but a Tool
that _shows_ everything possible to show.
- How to implement Structures in an "Asm Compatible" way:
Though C-Like Structures are nothing but hidden Equates,
and though you can perfectely, of course, declare these
Equates, the Assembly Structures may come under 3 forms:
* Equates set (universal usage)
* Stack Displacements (For Structures on the Stack)
* Simple Data Sets.
Here is one example of the inaccurate things the wrong
choice of C-Like Structures would push you to do. This
one comes from a MASM32 Demo, called "RichEdit":
____________________________________________________
WinMain proc hInst :DWORD,
hPrevInst :DWORD,
CmdLine :DWORD,
CmdShow :DWORD
;====================
; Put LOCALs on stack
;====================
LOCAL Wwd :DWORD
LOCAL Wht :DWORD
LOCAL Wtx :DWORD
LOCAL Wty :DWORD
LOCAL lpArg:DWORD
LOCAL sWid :DWORD
LOCAL sHgt :DWORD
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
; --------------------------------------------------
; Fill WNDCLASSEX structure with required variables
; --------------------------------------------------
invoke LoadIcon,hInst,500 ; icon ID
mov hIcon, eax
szText szClassName,"Rich_Edit_Class"
mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
m2m wc.hInstance, hInst
mov wc.hbrBackground, NULL
m2m wc.lpszMenuName, NULL
mov wc.lpszClassName, offset szClassName
m2m wc.hIcon, hIcon
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor, eax
m2m wc.hIconSm, hIcon
invoke RegisterClassEx, ADDR wc
________________________________________________________
Notice that all of the Initializations of the Structure
are done, on the Stack, AT RUN-TIME. Such Methods, and,
most of all, their _generalizations_ (in some cases, this
is accurate to do something similar to this...), would
completely defeate any reason for programming Assembly:
Such a Structure should, evidently, be declared in Data,
as simple Data, and it should be initialized, for all the
known Members, AT WRITE-TIME.
The fact that the "Assemblers" (...) pushed by Master Pdf
do not have any integrated feature to support the various
way of doing Structures the proper way, in Assembly, is
one another story.
Betov.
< http://betov.free.fr/RosAsm.html >
- Next message: Betov: "Re: a common belief or a wrong C[++] compiler?"
- Previous message: Randall Hyde: "Structures in Assembly Language"
- In reply to: Randall Hyde: "Structures in Assembly Language"
- Next in thread: Randall Hyde: "Re: Structures in Assembly Language"
- Reply: Randall Hyde: "Re: Structures in Assembly Language"
- Reply: Percival: "Re: Structures in Assembly Language"
- Reply: hutch--: "Re: Structures in Assembly Language"
- Reply: f0dder: "Re: Structures in Assembly Language"
- Reply: luvr: "Re: Structures in Assembly Language"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]