Now, how about
lowercase hex (a-f instead of A-F)? Adjusting by 39
instead of 7 would be a sufficient pain that I do not consider this
algorithm suitable.
You don't need to, just OR the result with $20.
Grr, that's annoying. Here I was trying to come up with a way to do
conditional arithemtic in a single register without conditionals, and
you point out it's unnecessary. I was close, too - using rotates
through the carry and then instructions like SBI $00. I think it's
possible, though it needs lots of rotates. (Sequences like: use Dave
Dunfield's code up through the second-last instruction (SBI $09), then
SBI $F5; RLC; RLC; RLC; RLC; SBI $00; RRC; RRC; RRC; RRC. That gives
too wide a gap, but I think it could be modified into the kind of
solution I was thinking about.)
Still, it was fun to work on. Trying to do things in a ridiculously
constrained environment (like conditional arithmetic without
conditionals) can be fun.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B