From: santosh on
Evenbit wrote:

> On Mar 31, 8:17 pm, chno...(a)gmail.com wrote:
>> On Apr 1, 12:13 am, chno...(a)gmail.com wrote:
>>
>>
>>
>> > On Mar 31, 11:03 pm, Frank Kotler <fbkot...(a)verizon.net> wrote:
>>
>> > > chno...(a)gmail.com wrote:
>> > > > Hello :)
>> > > > I was using gas for a while with a syntax like that
>> > > > imull $5, %edx
>> > > > However, HLA does not accept the second operand
>> > > > imul (5, edx)
>>
>> > > Try "intmul (5, edx);"
>>
>> > > Alien syntax, y'know...
>>
>> > > Best,
>> > > Frank
>>
>> > Thank you very much! It works!
>> > If anyone has a clue why imul in hla is different from normal
>> > imul, please, let me know :)
>>
>> Or may be gas automatically translates imull to something else?
>
> No. HLA is the oddball. It is not your "everyday, run-of-the-mill"
> assembler; it is, instead, a teaching tool.

Isn't this getting rather old? According to Randy HLA was the result of
his efforts to write UCRLib v2, for which MASM was woefully inadequate.
Also Randy wanted a tool that he himself (being a real power user)
would enjoy using, and he hoped, power asm programmers. The main reason
it became a teaching tool, I think, is because AoA32 was written for
it.

From: Frank Kotler on
chnorik(a)gmail.com wrote:
> On Mar 31, 11:03 pm, Frank Kotler <fbkot...(a)verizon.net> wrote:
>
>>chno...(a)gmail.com wrote:
>>
>>>Hello :)
>>>I was using gas for a while with a syntax like that
>>>imull $5, %edx
>>>However, HLA does not accept the second operand
>>>imul (5, edx)
>>
>>Try "intmul (5, edx);"
>>
>>Alien syntax, y'know...
>>
>>Best,
>>Frank
>
>
> Thank you very much! It works!
> If anyone has a clue why imul in hla is different from normal imul,
> please, let me know :)

Well... "mul" does a 32-bit * 32-bit multiplication for a 64-bit result
(edx:eax). (Smaller sizes are available, too.) The one-operand form of
"imul" does the same thing, only signed. (HLA uses "imul" for this,
AFAIK) The three-operand form of "imul" does a 32-bit * 32-bit multiply,
and stores the result in 32-bits - any "overflow" is lost. The
two-operand form is just a special case of the three-operand form. So
there really *are* two different operations...

Gas, and Nasm... (AFAIK, "all" other assemblers) use the same mnemonic
for both (all three)... To be honest, I *think* the reason HLA uses two
different mnemonics is that the tools he was using, Flex and Bison, had
trouble parsing one mnemonic to do two different things. It may also be
intended for "clarity"... but only to those who *don't* already know
assembly language (which you apparently *do*)...

All assemblers do the same thing, essentially, but we have to "say it"
differently for each... and HLA is rather "spectacular" in this regard.
HLAlien syntax... Get used to it, or go back to Gas. :)

Best,
Frank
From: Herbert Kleebauer on
chnorik(a)gmail.com wrote:
>
> On Mar 31, 11:03 pm, Frank Kotler <fbkot...(a)verizon.net> wrote:
> > chno...(a)gmail.com wrote:
> > > Hello :)
> > > I was using gas for a while with a syntax like that
> > > imull $5, %edx
> > > However, HLA does not accept the second operand
> > > imul (5, edx)
> >
> > Try "intmul (5, edx);"
> >
> > Alien syntax, y'know...
> >
> > Best,
> > Frank
>
> Thank you very much! It works!
> If anyone has a clue why imul in hla is different from normal imul,
> please, let me know :)

One logical and self explaining way of writing the mult instruction would be:


muls.b ADRS,r0,m0|r0

muls.l ADRS,r0,r1|r0
muls.l ADRS,rk,rk ; k=0..7
muls.l #imm32,ADRS,rk ; k=0..7

muls.w ADRS,r0,r1|r0
muls.w ADRS,rk,rk ; k=0..7
muls.w #imm16,ADRS,rk ; k=0..7

mulsq.l #imm8,ADRS,rk ; k=0..7

mulsq.w #imm8,ADRS,rk ; k=0..7

mulu.b ADRS,r0,m0|r0

mulu.l ADRS,r0,r1|r0

mulu.w ADRS,r0,r1|r0


But you have to ask the authors of the assemblers why they choose such
a crazy syntax.
From: Frank Kotler on
santosh wrote:
> Evenbit wrote:
>
>
>>On Mar 31, 8:17 pm, chno...(a)gmail.com wrote:
>>
>>>On Apr 1, 12:13 am, chno...(a)gmail.com wrote:
....
>>>>If anyone has a clue why imul in hla is different from normal
>>>>imul, please, let me know :)
>>>
>>>Or may be gas automatically translates imull to something else?
>>
>>No. HLA is the oddball.

Any assembler generates a different opcode for the one-operand and
three-operand forms of "imul" (the two-operand form doesn't really
exist). So in a sense, Chnorik is right...

>>It is not your "everyday, run-of-the-mill"
>>assembler; it is, instead, a teaching tool.
>
>
> Isn't this getting rather old? According to Randy HLA was the result of
> his efforts to write UCRLib v2, for which MASM was woefully inadequate.
> Also Randy wanted a tool that he himself (being a real power user)
> would enjoy using, and he hoped, power asm programmers. The main reason
> it became a teaching tool, I think, is because AoA32 was written for
> it.

Too old, or not old enough... The way *I* remember Randy tellin' the
story, the primary goal was the 32-bit AoA. (I recall UCRLib v2 still
being 16-bit, but I could misremember that) IMHO, he *could* have done
that with Masm - or even Nasm - but not the way he wanted to do it. And
he wanted to do it the way he wanted to do it! (this urge may be
familiar to some of us :)

Curiously, perhaps, the HLA Standard Library code *doesn't* use the
"high level" features much... Calling the library, in an "easy" way for
a teaching tool, is where the "power" gets used... (from what I can see).

Incidentally, Randy has discovered that he *does* have internet access
in Morocco, so we have to watch what we say about him! :)

Best,
Frank
From: Evenbit on
On Apr 1, 4:25 am, Frank Kotler <fbkot...(a)verizon.net> wrote:
>
> >>No. HLA is the oddball.
>
> Any assembler generates a different opcode for the one-operand and
> three-operand forms of "imul" (the two-operand form doesn't really
> exist). So in a sense, Chnorik is right...
>

[sarcasm]

You are correct! I have just tested all the other assemblers and
every one of them ( even Herbert's ) sucks down "intmul" with no
complaint. All except for gas, that is. Gas is the oddball!

[/sarcasm]
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6
Prev: Directly Reading/Writing to Disk
Next: remplace Ascii