Title: Assembly MPC55 how do I load the value of a ROM address in a register ? Post by: de_Fre on October 23, 2014, 10:11:30 AM First few steps in assembly code.
As I was playing with MED9.1 File, I was wondering how the function is called to load the value of a ROM address in my register say the value of address 0x045678 is F6 how can I put this value, F6 , into register r12 for example. With a variable it would look like lhz, r12, byte_45678 No idea how it works with a random ROM address. Thanks for helping Title: Re: Assembly MPC55 how do I load the value of a ROM address in a register ? Post by: daniel2345 on October 23, 2014, 12:06:27 PM It is done by indirect adressing.
The memory position is enclosed by [xxx] or it has an @ in front, depending on selected assembler. Title: Re: Assembly MPC55 how do I load the value of a ROM address in a register ? Post by: ozzy_rp on October 23, 2014, 10:24:58 PM Use next instructions:
1.Load Byte and Zero lbz rD,d(rA) The EA is the sum (rA|0) + d. The byte in memory addressed by the EA is loaded into the low-order eight bits of rD. The remaining bits in rD are cleared. 2.Load Byte and Zero Indexed lbzx rD,rA,rB The EA is the sum (rA|0) + (rB). The byte in memory addressed by the EA is loaded into the low-order eight bits of rD. The remaining bits in rD are cleared. 3.Load Byte and Zero with Update lbzu rD,d(rA) The EA is the sum (rA) + d. The byte in memory addressed by the EA is loaded into the low-order eight bits of rD. The remaining bits in rD are cleared. The EA is placed into rA. 4.Load Byte and Zero with Update Indexed lbzux rD,rA,rB The EA is the sum (rA) + (rB). The byte in memory addressed by the EA is loaded into the low-order eight bits of rD. The remaining bits in rD are cleared. The EA is placed into rA. Title: Re: Assembly MPC55 how do I load the value of a ROM address in a register ? Post by: de_Fre on October 26, 2014, 01:38:12 AM Thanks for the help guys,
I probably should read up a bit more, as I passed that instruction set, but it doesnt make sense to me yet. I have no assembler, so I write the code using pen and paper then insert it with a hex-editor. Indirect addressing based on S13 (0x7FFFFFF) but then I can't reach to the position I want to read. |