1,2,93,97, 9995, 9997, 38834, 38836, and 38838
Watch how many bits needed to store a value in 16 bits!
9995 * 3 = 29,985 7521h
38834 * 3 = 116,502 1c716h
MUL DX:AX = AX * BX
Carry is set if DX becomes non-zero
Also watch for signed versus unsigned branching!
Signed: Less - Greater
JG, JNLE, JGE, JNL, JLE, JNG, JL, JNGE
Unsigned: Above - Below
JA, JNBE, JAE, JNB, JBE, JNA, JB, JNAE
You are using JLE AX,1 which is a signed instruction. So anything > 32767 is negative! thus (<=)
Are you allowed to use a shift operation instead of a divide by 2? Divide is overkill!
Because
CODE
SHR AX,1 ; LSB now in carry bit
JNC Even ; Jump no carry if Even
; Odd
JZ Done ; if zero and carry was set then AX was (1)
CLI ; Why are you clearing the interrupts?
When do you initialize COUNTER ?
This post has been edited by wildgoose: 5 Oct, 2009 - 08:34 PM