Un_Known Posted June 26, 2019 Posted June 26, 2019 (edited) Can anybody explain logic here It's ARM instruction set: Here dword_36BD38 is uninitialized variable in .bss section LDR R3, =(dword_36BD38 - 0x19D86C) ADD R3, PC, R3 ; dword_36BD38 CMP R0, #0 STR R0, [R3] MOVLT R2, #0x7FFFFFFF STRLT R2, [R3] I have a little idea what's happening here but couldn't understand whole logic! Edited June 26, 2019 by Un_Known
0 Un_Known Posted July 2, 2019 Author Posted July 2, 2019 (edited) 9 hours ago, Un_Known said: So finally I Got answer to this thnx to @saiaapiz . Posting Answer here because it can help many! The Program Counter is automatically incremented by the size of the instruction executed. This size is always 4 bytes in ARM state and 2 bytes in THUMB mode. When a branch instruction is being executed, the PC holds the destination address. During execution, PC stores the address of the current instruction plus 8 (two ARM instructions) in ARM state, and the current instruction plus 4 (two Thumb instructions) in Thumb(v1) state. This is different from x86 where PC always points to the next instruction to be executed. If above Answer is confusing this might be better explanation: In ARM State: PC (Program counter , R15). stores the address of the current instruction plus 8 (two ARM instructions) in ARM state. In Thumb State: For B, BL, CBNZ, and CBZ instructions, the value of the PC is the address of the current instruction plus 4 bytes. For all other instructions that use labels, the value of the PC is the address of the current instruction plus 4 bytes, with bit[1] of the result cleared to 0 to make it word-aligned. Edited July 2, 2019 by Un_Known
0 SRhaRDGAMES Posted July 4, 2019 Posted July 4, 2019 On 6/26/2019 at 3:02 AM, Un_Known said: Can anybody explain logic here It's ARM instruction set: Here dword_36BD38 is uninitialized variable in .bss section LDR R3, =(dword_36BD38 - 0x19D86C) ADD R3, PC, R3 ; dword_36BD38 CMP R0, #0 STR R0, [R3] MOVLT R2, #0x7FFFFFFF STRLT R2, [R3] I have a little idea what's happening here but couldn't understand whole logic! What is that for?
0 Un_Known Posted July 4, 2019 Author Posted July 4, 2019 (edited) It's for understanding game logic and then modding the game! Edited July 4, 2019 by Un_Known 1
Question
Un_Known
Can anybody explain logic here
It's ARM instruction set:
Here dword_36BD38 is uninitialized variable in .bss section
LDR R3, =(dword_36BD38 - 0x19D86C)
ADD R3, PC, R3 ; dword_36BD38
CMP R0, #0
STR R0, [R3]
MOVLT R2, #0x7FFFFFFF
STRLT R2, [R3]
I have a little idea what's happening here but couldn't understand whole logic!
Edited by Un_Known18 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now