Re: Formatting in assembly



"?a\/b" <al@xxx> wrote in message news:1u1v22lpc9dvk0q2ms2ed14eokebrs8u7u@xxxxxxxxxx
On Sun, 02 Apr 2006 03:38:47 -0400, Frank Kotler
<fbkotler@xxxxxxxxxxx> wrote:
i
if you say
mul dword[dieci] ; in ci +/-oo
jc .ci

it is wrong because dieci==10, edx==0
so i have edx:eax=10*eax

and i have to see if edx!=0 (error)
not the overflow of assembly "mul" (multiplication is not intended
overflow never here for assembly instruction "mul")

Perhaps you can tell us what those flags *are* for?

what flag?

Here is the citation of MUL' description from "IA-32 Intel Architecture
Software Developer's Manual Volume 2A: Instruction Set Reference, A-M"
--
The result is stored in register AX, register pair DX:AX, or register
pair EDX:EAX (depending on the operand size), with the high-order bits
of the product contained in register AH, DX, or EDX, respectively.
If the high-order bits of the product are 0, the CF and OF flags are
cleared; otherwise, the flags are set.
--

There is no "intented" sense here,
just the specification of the CPU vendor.

The fragment

mul ...
cmp edx,0
jne .ci

can be replaced with

mul ...
jc .ci

since your next line' code and .ci' code ain't
depend on ZF/CF/OF/...

.



Relevant Pages

  • Re: Flags in CCR register after...
    ... with regards to what flags are set when the commands listed below are ... TSTA command tests register A for zero or minus -> A - $00 ... because a sub of 0 doesn't generate an overflow, ...
    (alt.lang.asm)
  • Re: Formatting in assembly
    ... not the overflow of assembly "mul" (multiplication is not intended ... Here is the citation of MUL' description from "IA-32 Intel Architecture ... The result is stored in register AX, register pair DX:AX, or register ... If the high-order bits of the product are 0, the CF and OF flags are ...
    (alt.lang.asm)
  • Re: Accessing flags
    ... overflow or carry bit? ... any flags at all. ... register to register moves, although it left the carry alone in those ... altered no flags on stores). ...
    (comp.lang.c)
  • Re: Formatting in assembly
    ... not the overflow of assembly "mul" (multiplication is not intended ... overflow never here for assembly instruction "mul") ... Perhaps you can tell us what those flags *are* for? ...
    (alt.lang.asm)
  • Re: Conclusions from my investigation about ioapic programming
    ... int num_entries, i, type, intr, r; ... register int num_entries, num, i, type; ... register LONG flags; ... printfScreenWithAttribute(screen, LTCYAN, "%08X ", val); ...
    (Linux-Kernel)

Loading