![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Newbie
Join Date: Mar 2006
Posts: 17
Rep Power: 0
![]() |
Could you point out the flaw in this piece of code also ?
In the mean time i also come up with this code :
mov ecx,32 mov eax,00fffff0h doshift: shl eax,1 jc setcount setcount: inc count loop doshift But then the result i got in count was 32 , Could you point out the flaw in this piece of code ? |
|
|
|
|
|
#12 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Sure. It jumps to 'setcount' if there's a carry, and falls through to 'setcount' if there's no carry. The result is to count, regardless. I recommend that you make a flowchart from your code and analyze it. For instructions like "loop", be sure and break them into their entire function. "loop", for instance, would be, "decrement ecx", "test ecx", and "jnz label operand".
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#13 |
|
Newbie
Join Date: Mar 2006
Posts: 17
Rep Power: 0
![]() |
Could you also help me with Context Free Grammar ?
Since its Assembly Language forum ,
Could you also help me with CFG's ( Context Free Grammar) ? or any other questions on Automata Theory ? |
|
|
|
|
|
#14 |
|
Programmer
|
be more specific
What language
asembly can be: masm, nasm, tasm, hla, casm, machine, binary, DA, c++ |
|
|
|
|
|
#15 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
You're mistaken. Assembly is not a tool. Assemblers are tools. Please try to contain yourself when it comes to dredging up old threads.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|