ARM assembly if(data & 0x01) rGPGDAT &= ~(0x1<<7); -
now i'm study how control arm gpio assembly language. i'm trying change c source assembly language.
but i'm difficult writing part
if(data & 0x01) rgpgdat &= ~(0x1<<7); if(data & 0x02) rgpgdat &= ~(0x1<<6); if(data & 0x03) rgpgdat &= ~(0x1<<5); if(data & 0x04) rgpgdat &= ~(0x1<<4);
i think should use tst. don't know how dealt "if"
you should able without branches:
mov r1, <your data> ; change accordingly mov r2, <rgpgdat> ; change accordingly tst r1,#1 andne r2,#$ff -1 tst r1,#2 andne r2,#$ff -2 tst r1,#4 andne r2,#$ff -4 tst r1,#8 andne r2,#$ff -8
the key instruction , can define contition instruction executed (in case z=0) if bit set in r1, tst
clears 0 flag, , andne
clear bit in r2
(not sure if need andne or andeq here. loop more elegant but: i'm not @ home atm, can't write propper code)
Comments
Post a Comment