Pages: [1]
Author Topic: Assembly MPC55 how do I load the value of a ROM address in a register ?  (Read 4211 times)
de_Fre
Jr. Member
**

Karma: +7/-2
Offline Offline

Posts: 25



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
Logged
daniel2345
Full Member
***

Karma: +11/-7
Offline Offline

Posts: 188


« Reply #1 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.
Logged
ozzy_rp
Jr. Member
**

Karma: +16/-1
Offline Offline

Posts: 49


« Reply #2 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.
Logged

MED17/EDC17 Reverse engineering
conversion sgo and frf to bin https://osotec.com/
de_Fre
Jr. Member
**

Karma: +7/-2
Offline Offline

Posts: 25


« Reply #3 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.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.026 seconds with 17 queries. (Pretty URLs adds 0.001s, 0q)