Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Tutorial by BadLuckBrian
- In this tutorial i will show you how Read and Write in the memory.
- It's the same as 'PS3.GetMemory' and 'PS3.SetMemory' but it works a bit differently. Not really but its for the sake of understanding how it works !
- Reading memory
- We can read memory with 4 instructions.
- Code:
- lbz (1 byte)
- lhz (2 bytes)
- lwz (4 bytes)
- ld (8 bytes)
- we use them like this:
- Code:
- lwz RESULT, ADDRESS, TEMP_VAL
- Result = register containing the byte at the address
- ADDRESS = register containing the address to read from
- TEMP_VAL= we can use it as a temporary 'addic'
- example:
- Code:
- lis r3, 0xff r3 = 00 ff 00 00 (0xff0000)
- addic r3, r3, 0x1234 r3 = 00 ff 12 34 (0xff1234)
- lwz r4, r3, 0 r4 = the first 4 bytes at 0xff1234
- OR
- Code:
- lis r3, 0xff
- lwz r4, r3, 0x1234 <- we use it as a temporary addic to save a line !!! but WARNING: on the next line r3 will be restored to 00 ff 00 00 while
- using addic make it permanent !!!!
- another example
- reading the first 4 bytes at: 0x110d60c
- Code:
- lis r3, 0x0110
- lwz r4, r3, 0xd60c
- OR
- Code:
- lis r3, 0x0110
- addic r3,r3, 0xd60c
- lwz r4, r3, 0
- Writing in the memory is as easy as reading it.
- we will use:
- Code:
- stb (1 byte)
- sth (2 bytes)
- stw (4 bytes)
- std (8 bytes)
- we use them like this:
- Code:
- stw VALUE, ADDRESS, TEMP_VAL
- example, i want to write 0x15 at: 0x2100000
- Code:
- lis r3, 0x210 (0x2100000) || 02 10 00 00
- li r4, 0x15
- stw r4, r3, 0
- Another example would bwe to write 0x15 at: 0xFCA280
- Code:
- lis r3, 0xFC (r3 = 00 FC 00 00)
- li r4. 0x15
- stw r4, r3, 0xA280 (0xFCA280)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement