S3C2440A RISC MICROPROCESSOR ARM INSTRUCTION SET
3-63
LOADING A WORD FROM AN UNKNOWN ALIGNMENT
; Enter with address in Ra (32 bits) uses
; Rb, Rc result in Rd. Note d must be less than c e.g. 0,1
BIC Rb,Ra,#3 ; Get word aligned address
LDMIA Rb,{Rd,Rc} ; Get 64 bits containing answer
AND Rb,Ra,#3 ; Correction factor in bytes
MOVS Rb,Rb,LSL#3 ; ...now in bits and test if aligned
MOVNE Rd,Rd,LSR Rb ; Produce bottom of result word (if not aligned)
RSBNE Rb,Rb,#32 ; Get other s hift amount
ORRNE Rd,Rd,Rc,LSL Rb ; Combine two halves to get result