??? 08/24/08 17:31 Read: times |
#157706 - HLL was just for example - easy to read Responding to: ???'s previous message |
I presented it in a high-level language just to make the concept with computed assignments clear. Please, no fight about C being high- or low-level now :)
But of course the concept works in assembler too. Too long since I last worked with C51 assembler so I better stay away from presenting a full implementation since I haven't a C51 emulator available right now to verify before I post. Define 6 bytes with the values 1,2,3,4,5,0 in the code. You may let DPTR point to the start of this table, and let A be any value in [0..5]. Then do MOVC A,@A + DPTR to get the next value into A. Repeat this instruction until time to end the loop. After you break out of the loop, use the value in A to perform 0 to 5 left-shifts of the value 1. Or use a second 6-element loop table to convert from the continuous sequence to your shifted single-bit values. |