[Opendispense] large numbers on a hc11
Sun Aug 3 16:11:47 2003
So I was just about to send the following question, and as I laid out
the numbers, the answer jumped out at me. But I thought some people
might be interested so here it is anyway :)
Just uncovered in the disassembly what I want to claim is a division
function for large numbers (>65535). What I can't for the life of me
figure out is how large numbers are represented internally. It seems to
use a mantissa, but to some mysterious base.
Here are some numbers and their expected meanings:
0x2710 paired with 0 (0x00) to make 10,000 <- 0x2710 = 10000
0x86a0 paired with 1 (0x01) to make 100,000
0x4240 paired with 15 (0x0f) to make 1,000,000
0x9680 paired with 152 (0x98) to make 10,000,000
Can anybody see a relationship that will get c from a & b?
Well the answer is to put b with a, then unhex it. eg, 0x86a0 and 0x01
become 0x0186a0 which is 100000, and so on.
Hopefully our compiler will do something smart like this for us too :)