i want to copy nibble from source to destination A B 0101 1001 ; first data C D 0011 0110 ; second data i want to copy A to B, OR copy A to C, OR copy A to D OR copy B to A, OR copy B to C, OR copy B to D OR copy C to A, OR copy C to B, OR copy C to D OR copy D to A, OR copy D to B, OR copy D to C how can i copy it is it possible?????
how can i copy it in what language?
is it possible????? of course
Erik
In assembler, check out the SWAP instuction...
in Assembly Language
A B 0101 1001 ; first data C D 0011 0110 ; second data yes, swap works only A o B or B to A OR C to D or D to C but when i copy A to C or to D
then how ?
I didn't say that SWAP was a complete solution to your entire problem - just noted that you should consider how it might form a useful part of your solution...
What thought have you given to possible solutions so far...?
this is my ansa <precode> int atob ( int a , int b ) { int temp; temp = a; a = b; b = temp; } int atoc ( int a , int c ) { int temp; temp = a; a = c; c = temp; } int atod ( int a , int d ) { int temp; temp = a; a = d; d = temp; }
Gee, haramish, you just inflated your/the OP's code by a factor of 3. Brilliant.
LOL!!
Someone didn't understand "nibble".
And the OP talked about copying - not swapping - data, so overwrites are allowed.
That's what he said - but did he really mean that...?
Also, it's not clear whether the original nibble has to remain intact...
Anyhow, the 8051 SWAP instruction may well still be useful in achieving whatever the real goal actually is...
Of course the SWAP instruction may be useful.
But the code that did swap the contents of two int does try to solve a completely different problem.
Plus does not meet the requirement of being in assembly language.
That is less of a problem. In many situations, it's meaningful to use a proxy language to describe a concept.