| View previous topic :: View next topic |
| Author |
Message |
Kajih Cheater
Reputation: 1
Joined: 08 Feb 2021 Posts: 32
|
Posted: Tue Aug 10, 2021 12:42 pm Post subject: How do I store an address from two registers |
|
|
Hi guys, I seem to have hit an issue where my brain no longer seems to be working. I can't for the life of me remember how to get the resulting address from combining two registers. For example, I have a compare:
| Code: | | comiss xmm7,[rcx+rbx+70] |
I am trying to get the address of just [rcx+rbx]. I setup a symbol basePTR and tried doing:
| Code: | push eax
mov eax, [rcx+rbx]
mov [basePTR], eax
pop eax |
But this doesn't seem to be working. I know it's probably quite simple but I just can't seem to figure it out. |
|
| Back to top |
|
 |
DanyDollaro Master Cheater
Reputation: 3
Joined: 01 Aug 2019 Posts: 334
|
Posted: Tue Aug 10, 2021 2:09 pm Post subject: |
|
|
EAX is a 32-bit register, RCX and RBX are 64-bit registers.
This should work for you:
| Code: | push rax
lea rax, [rcx+rbx] // Notice this is a lea, not a mov
mov [basePTR], rax
pop rax |
EDIT, you can also do:
| Code: | | lea rax, [rcx+rbx+70] |
|
|
| Back to top |
|
 |
Kajih Cheater
Reputation: 1
Joined: 08 Feb 2021 Posts: 32
|
Posted: Tue Aug 10, 2021 2:51 pm Post subject: |
|
|
oh for f**k sakes... I honestly can't believe I actually missed that. I swear, I do know basic assembly! lol |
|
| Back to top |
|
 |
devAnd Newbie cheater
Reputation: 0
Joined: 22 Jun 2020 Posts: 13 Location: C#, java and ASM
|
Posted: Tue Aug 10, 2021 10:43 pm Post subject: |
|
|
| Kajih wrote: | oh for f**k sakes... I honestly can't believe I actually missed that. I swear, I do know basic assembly! lol |
hahaha it happens bro. |
|
| Back to top |
|
 |
|