On 12/8/2005 at 7:03 PM woodelf wrote:
Chuck Guzis wrote:
MOV CX,9680H
MOV DL, 98H
TOP:
...all those stinkin instructions...
LOOP TOP
DEC DL
JNZ TOP
; IS THIS WHAT YOU MENT?
MOV DL,98H
TOP: MOV CX,9680H
TOP2:
; MY STINKING INSTRUCTIONS
LOOP TOP2
DEC DL
JNZ TOP
Nope, but it did copy the number down wrong off my HP-16C. That should be
99H, not 98H loaded into DL. Alternatively, you could change the bottom
JNZ to a JNS.
Consider what happens. You execute one iteration of 38528 times through
the inner loop. The remainder of 152 trips through the outer loop, you
execute 65536 iterations each time for 9961472 total iterations. Add the
38528 for the first time and you get (surprise!) 10000000.
Cheers,
Chuck