Keep DAA! (was Re: 8086 bugs)

Chuck Guzis cclist at sydex.com
Sun Dec 11 00:07:53 CST 2005


On 12/10/2005 at 11:10 PM Dave Dunfield wrote:
>    ANI 15
>    SUI 10
>    SBI 0
>    ADI 11
>    SBI 10
>    ADI 11
>    SBI 10
>    ADI 11
>    SBI 10
>    ADI 11
>    SBI 10
>    ADI 11
>    SBI 10
>    ADI 11
>    SBI 10
>    ADI '0'+11

Good job!  That's pretty much the idea, my solution uses addition (here's
the 8086 version) and one fewer instruction (you could o the same by
changing the value on that
"SBI 0):

          AND     AL,0FH
          ADD     AL,0F6H
          ADC     AL,0AH
          ADD     AL,0F6H
          ADC     AL,0AH
          ADD     AL,0F6H
          ADC     AL,0AH
          ADD     AL,0F6H
          ADC     AL,0AH
          ADD     AL,0F6H
          ADC     AL,0AH
          ADD     AL,0F6H
          ADC     AL,0AH
          ADD     AL,0F6H
          ADC     AL,3AH

Next bit twiddler challenge--can anyone do this in fewer instructions?

Cheers,
Chuck




More information about the cctech mailing list