asm

From: cherry (chanels2_at_excite.com)
Date: 03/14/04


Date: Sun, 14 Mar 2004 08:56:09 +0000 (UTC)

I am a newbie in assembly..I am working on a project for my assembly
class and I can't figure out why my code will not compute the function
of (n * fact)(n-1)..I am computing the factorial for the numbers 1-10
and I can't get it to work..I have tried everything..Any suggestions
that anyone can make I greatly appreciate...This is a hard language to
understand...Below is my code that I have used to calculate my
factorial...

 mov ebx,eax
mul eax
cmp eax,1
jnz else

else:
mul ebx
dec ebx

I have also tried:

MOV ebx, eax ; ebx=3
DEC ebx ; ebx=2
       JZ ; not zero, no jump
       MUL ebx ; eax=3*2=6
      JMP ; loop back
      DEC ebx ; ebx=1
       JZ ; not zero, no jump
       MUL ebx ; eax=6*1=6
       JMP ; loop back
       DEC ebx ; ebx=0
      JZ ; zero, jump out

Nothing works.please help....Thanks in advance to anyone who takes a
look at this..



Relevant Pages

  • Re: NASM 0.98.39 vs. NASM 2.03.01 disassembly
    ... mov ebx, -1 ... lsl eax, ebx ... code_size equ $ - $$ ...
    (alt.lang.asm)
  • Re: DivMod
    ... mov ebx, edx ... mov, edx ... // Require: Hi < D function UI32x2DivMod32: UInt64; assembler; register; nostackframe; asm div ecx ...
    (borland.public.delphi.language.basm)
  • Re: DivMod
    ... > var Remainder: Integer); ... mov ebx, edx ... mov, edx ...
    (borland.public.delphi.language.basm)