On 12/10/2005 at 12:09 PM Chuck Guzis wrote:
Code-cruncher quiz: Could this be done in 8088
code without DAA or a jump
or a reference to a table in memory using only a single 8-bit register?
What? No takers?
I'll post my solution tomorrow if no one beats me to it. Uses only AL (or
A) register, no jumps, no tables and will work on x80 and x86.
Cheers,
Chuck
Ok, since you are pushing for a taker, I'll bite - also assuming you also disallow
stack (cuz that would be obvious), here's a simple way to do it (8080 code):
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
Cheers,
Dave
--
dave04a (at) Dave Dunfield
dunfield (dot) Firmware development services & tools:
www.dunfield.com
com Collector of vintage computing equipment:
http://www.parse.com/~ddunfield/museum/index.html