Re: Apologies seem to hurt




"Frank Kotler" <fbkotler@xxxxxxxxxxx> wrote in message
news:41qEi.44$cy3.38@xxxxxxxxxxx
Ratch wrote:
"Frank Kotler" <fbkotler@xxxxxxxxxxx> wrote in message



Are we talking MASM here? If not, I have no knowledge or comment
about it.

I tried to broaden the discussion to other "assemblers" (or not) which
also have... macros that aren't macros, or directives that emit code, or
"banana" that violates our Sacred OneToOne.

That so called one to one is not sacred to me. Sometimes I want to
output more than one to one. As long as I have control of what it does. I
am a MASM control freak.


(That is, one mnemonic and its operands generate exactly one opcode and
it's operands. I'm quite aware that every byte of the source doesn't map
to one byte in the object/executable. And that jb==jc==jnae... depending
on the assembler bcs, could be the same opcode, too.)

A assembler to me is a processor that can be made to group a precise
number of bytes each containing the particular value I specify into code and
data sections.



A 4-byte data word, a 1-byte data word, and a 2-byte word.

You're calling a "4-byte data word" "code"?

In the general sense, yes.

Okay, but if you try to execute it, I think you'll find that the CPU agrees
with me - "not code".

I don't agree. And neither does the CPU. How would it know the
difference. Of course, the "data" has to match some opcode the CPU knows
about. See below.

First the source:

MAIN:
MOV EBX,EAX
BYTE 08BH,0D8H
MOV EAX,OFFSET MAIN
BYTE 0B8H
DWORD OFFSET MAIN
INVOKE ExitProcess,EAX
END MAIN


Then the assembly:

00000000 .CODE
00000000 MAIN:
00000000 8B D8 MOV EBX,EAX
00000002 8B D8 BYTE 08BH,0D8H
00000004 B8 00000000 R MOV EAX,OFFSET MAIN
00000009 B8 BYTE 0B8H
0000000A 00000000 R DWORD OFFSET MAIN
INVOKE ExitProcess,EAX
0000000E 50 * push eax
0000000F E8 00000000 E * call ExitProcess
END MAIN

The code executes without errors. Notice the first and third
instruction lines are the way normal people code with instruction mnemonics.
The second, fourth and fifth lines uses the BYTE and DWORD data directives
to generate the same move instructions within the CODE segment. That is
probably the way Betov would do it.

Sorry, I was thinking of ASSUME. My mistake. The MODEL directive
does change the calling convention for INVOKE. Another interaction than
cannot be duplicated with MACRO statements.

If true, Masm's macros *are* weak, then.


Why? If MASM features the INVOKE directive, one can use that.

My INVOKIT MACRO never changes its reverse PUSHing.

Okay, *Could* it if you wanted it to?

No. I cannot get to the MODEL directive to "see" whether to change the
INVOKIT MACRO. Only a directive internal to MASM can do that.


I don't think all the functionality of INVOKE was coded in Randy's
MASM MACRO.

Okay. Betov's right, then.

About what?

MACROs are not only statement that can generate code and data.

Sure. "printf("hello world");" generates code and data, too.

My point exactly. Many MASM statements generate code and data. That
does not stop me from making MASM generate exactly what I want.

Masm's looking less and less like an "assembler" with every post from you.

Not by my definition. I can control every byte to output exactly the
code or data I want.

If Randy really did "cheat" on that macro, I owe Betov an apology!

Even if that MACRO did not have full functionality, who cares? One can
make MASM do exactly what you want it to with regard to code and data.

Ratch


.



Relevant Pages

  • Re: Between Assemblers
    ... For something like Masm, the macro processing facilities - ... Better to just add the TODO comment and let the user do the translation ... You'll actually have to have a full assembler, ...
    (alt.lang.asm)
  • Re: What is this code doing?
    ... > Implying that MASM is an abomination? ... Unless you're thinking that HLA ... MASM's macro facilities way back in 1996 when I was driven ... in the high-level assembler arena. ...
    (alt.lang.asm)
  • A whole group dedicated for programmers to throw crap at each other?
    ... The only other assembler im looking at is FASM because MASM source can be ... basics rather than get into HLA straight away. ... how good is FASM's macro language compared to MASM ...
    (alt.lang.asm)
  • Re: Beginner Learning Assembler
    ... MASM, TASM, NASM, FASM, RosAsm, GAS or HLA. ... Now when I first learnt assembler for DOS with TASM ... The COPY macro presented earlier is a good example. ...
    (alt.lang.asm)
  • Re: In search of the perfect Disassembler
    ... Does RosAsm not get it exactly right? ... Having written a couple of books on MASM (The ... > make use of Short and Long Jumps, ... there are far more examples of *very* sophisticated macro ...
    (alt.lang.asm)