This is an alternative version of the Fibonacci code in the assembly used by my professor in this class, instead it is used as a new formula is.
f (n-2) / 2 + f (n-1) * 2 then the sequence 1, 2, 4, 9, 20, 44, 98, 218
I just have a few things that confuse me.
-
What does JB and J mean?
-
Is one and two two local variables? Do they take a different part of the equation?
-
[ebp-4] and [ebp-8], are they the registry?
Please help me, I have really lost the concept behind this code!
This code is
this code is
TITLE Mobonacci.586 Model FLAT, c. Mobonacci PROC; Will take N to EX; EBP Move EBP Push, ESP Mov EX, [EBP +8]; See that the eX is less than or equal to 1; CAPX, 2 JB one JJ JL1; Mobonacci calls; L1: Sub Special, 8; MOBO (N-1) * 2; Sub eX, 1 app call app call mobonachi; Mov Ebux, EX PopEx; 2 times ebx; SHL EBX, 1 Mop [EPP-4], EBX; Mobo (n-2) / 2; SubEx, 1AP Call App Call, Mobonkey MB EBX, EX POPEX; Divide the ebay from 2; Shr ebx, 1 mov [ebp-8], ebx; The sum of two numbers; Mov eax, add 0X, [EBP-4] add eX, [EPP-8]; neat pile; Mov esp, ebp jmp finished; Return 1; A: mov eax, closing 1 jmp; Return 2; Two: mov eax, 2 jmp finished; Return value in EX; End: Pop EBP ART MOBOONICIENDP End
post-text itemprop = "text">1) What is the
JB
andJ
mean?They jump into the x86 instruction set. Go to
jb
, andj
jumps if they are equal, determine whether "down" or "equals" is correct, based on recent operation which is x86 The flag affects the register. Or, in other ways, for example you comparedcmp eax, ebx
(eax
andebx
registers), thenJb foo
value downebx
value > andje foo
labelfoo
Would jump for if the values were the same. Google "x86 Jump Directions" for more information2) What is the
one
andtwo
two local variables? What part of the equation do they take in the input?No variables are labeled, which indicate the location that can jump from other places in the code. If you combine this information with the question # 1, then with the code
eax
with2
(cmp eax, 2
) and < Code> JB jumps to a labelone
if less thaneax
2
(its price is probably 1), and If the value ofjE
jumps toeax
is equal to2
, twotwo
label. Lastly, jumps tojl1
labelL1
if the value ofeax
is above the value is 2. Note that the next instruction label isL1
, it has no functional effect.3)
[ebp-4]
and[Ebp-8]
, are they the registry? Why are they elected?In the x86 architecture the code is the base pointer register. It usually has an address in the context of
[ebp-4]
and[ebp-8]
view the values that are in the placeebp-4
And in theebp-8
memory (the value of that address decreased from 4 to 8 and decreased to 8) why such a thing is done in this way, Google "x86 stack frame" .
No comments:
Post a Comment