compare - Comparing R0 with R1 using assembly (Keil) -
i have 2 values stored in r0 , r1. comparing 2 follows:
mov r3, #(r0 xor r1) cjne r3,#0,not_equal apparently not possible use xor operator way. there way compare r0 r1 , check equal or not?
since want perform xor @ runtime, have use instructions accomplish that. unfortunately, xrl instruction operates on a register, might have rearranging. assuming a not available, r3 is, can do:
mov r3, ; save r3 mov a, r0 xrl a, r1 xch a, r3 ; restore , put result r3 cjne r3, #0, not_equal if a available, can use cjne accepting memory operand knowing registers memory mapped:
mov a, r0 cjne a, 1, not_equal ; 1 bank0 address of r1
Comments
Post a Comment