??? 06/04/05 20:43 Read: times |
#94350 - Don't know if it helps. Responding to: ???'s previous message |
I also had the need to perform a 16bit/8bit divide. Using your routine and one I had written previously I came up with this one:
R1R0 is the 16 bit dividend R2 is the 8 bit divisor UIntDiv16: mov b,#8 mov a,r2 clr c subb A,r1 jc Exit ;Does the same thing as yours up to here Loop2: RotateL r1,r0 mov a,r1 subb a,r2 jc ItIs0 Itis1: mov r1,a ItIs0: djnz b,Loop2 ;The carry value of the subb instruction gets copied into ;r0 at the start of each loop ;At the end of the loop you have in r0 the complement of ;the result mov a,r0 rlc a ;you rotate once more to account for the last subb cpl a ;complement to get the result Exit: ret ;The macro rotates XHXL to the left Where: RotateL Macro XH,XL mov a,XL rlc a mov XL,a mov a,XH rlc a mov XH,a endm Performing the same division with both routines I got a bit over 25% improvement in time using this one. I hope it's not to unclear. |
Topic | Author | Date |
16bit by 8bit divide | 01/01/70 00:00 | |
Check This! | 01/01/70 00:00 | |
And This: | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
Re: | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
To Thelam: | 01/01/70 00:00 | |
well, if you look a bit to the left | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
Its just ben done | 01/01/70 00:00 | |
Non-iterative Division | 01/01/70 00:00 | |
Accuracy | 01/01/70 00:00 | |
No wonder | 01/01/70 00:00 | |
again and again | 01/01/70 00:00 | |
Efficient Division | 01/01/70 00:00 | |
the divide may ne the tip of the iceberg | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
the Titanic hit the iceberg | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
Don't know if it helps.![]() | 01/01/70 00:00 |