Re: Learning Assembly with an HLL
- From: NoSpam@xxxxxxxxxxx (Bob Masta)
- Date: Tue, 19 Jun 2007 11:19:10 GMT
On Mon, 18 Jun 2007 11:41:51 -0600, "James Van Buskirk"
<spamtrap@xxxxxxxxxx> wrote:
"Bob Masta" <NoSpam@xxxxxxxxxxx> wrote in message
news:467688e5.9302378@xxxxxxxxxxxxxxxxxxxxx
Actually, I agree with you on this in general. I almost never
use macros of any other sort; but INVOKE actually helps
isolate the beautiful simplicity of assembly from the
unavoidable API stuff. I'd strongly recommend it to a student
to remove the API clutter and concentrate on his own
assembly code. This also reduces the chance of confusing
the string of PUSHes needed by the API from those you want
in your own code (such as saving registers that you know the
API will trash).
I typically think of you as a sensible guy, Bob, which is makes
it more difficult to comprehend why you would recommend INVOKE.
Consider that (in Windows x64) immediately before the CALL
instruction, the stack must be aligned to a multiple of 16
bytes and that the 32 bytes at top of stack must be available
to the callee as a parameter save area. If the assembler is
not sure about stack alignment before the INVOKE macro, it
must generate code to align the stack at every invocation.
In that case it would also have to create the 32 byte area
unilaterally.
If the assembler doesn't know where the scratch space in the
stack frame is, it would have to PUSH caller-save registers
and any arguments past the fourth, rather than use simpler
MOV instructions.
If the assembler does know all of the above stuff, that means
it has to have complete control over the stack frame at all
times, which makes any procedure look more like it written in
HLL rather than ASM. When you you INVOKE, you have to know
which of the alternatives is in force so that you have to
keep track of HLL abstractions rather than concentrate on the
object of the exercise which should have been to write good
clean low-level code from the start.
First of all, I have never done any x64 coding, and x32 doesn't
seem to need any special handling.
However, even considering the x64 situation you mention, I fail to see
any problem with INVOKE. In x32 at least, INVOKE does nothing
more than push the specified data in the required order for the call.
I surely hope that the same is true in x64, and that any special
pre-manipulation of the stack is entirely up to you... the assembler
doesn't have complete control of anything. This makes the argument
for INVOKE even stronger, IMHO, since it isolates the purely
"mechanical" pushes from any special handling that may be
required. By putting the API stuff all on one line of code, you
can clearly distinguish API code from everything else, including
special set-up code, if needed.
Best regards,
Bob Masta
D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Signal Generator
Science with your sound card!
.
- References:
- Learning Assembly with an HLL
- From: Betov
- Re: Learning Assembly with an HLL
- From: sevag.krikorian@xxxxxxxxx
- Re: Learning Assembly with an HLL
- From: Betov
- Re: Learning Assembly with an HLL
- From: sevag.krikorian@xxxxxxxxx
- Re: Learning Assembly with an HLL
- From: Betov
- Re: Learning Assembly with an HLL
- From: sevag.krikorian
- Re: Learning Assembly with an HLL
- From: Terence
- Re: Learning Assembly with an HLL
- From: Bob Masta
- Re: Learning Assembly with an HLL
- From: Betov
- Re: Learning Assembly with an HLL
- From: Bob Masta
- Re: Learning Assembly with an HLL
- From: James Van Buskirk
- Learning Assembly with an HLL
- Prev by Date: Re: Learning Assembly with an HLL
- Next by Date: Re: User-mode profiler in Windows
- Previous by thread: Re: Learning Assembly with an HLL
- Next by thread: Re: Learning Assembly with an HLL
- Index(es):
Relevant Pages
|