nikhildascl
Full Member level 3
- Joined
- Apr 15, 2012
- Messages
- 150
- Helped
- 15
- Reputation
- 30
- Reaction score
- 14
- Trophy points
- 1,318
- Location
- Kerala, India
- Activity points
- 2,115
I am about to do a project that converts HEX-to-assembly. Now i am just started studying about HEX files. I just wrote a simple assembly code and compiled using Keil. Then I just converted the HEX to assembly by hand. But I met some difference between them. Instead of calling B register they used some other instructions. Why it is happened so? Instead of calling B register I think they were calling @R1. The details about the codes are given below. Please help me to find out the real thing... Thank you in advance.
Code:
[B]This is the code I 've written.[/B]
ORG 00H
MOV DPTR,#2000
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
ADD A,B
INC DPTR
MOVX @DPTR,A
END
Code:
[B]The HEX code compiled using Keil[/B]
:0C0000009007D0E0F5F0A3E025F0A3F09D
:00000001FF
Code:
[B]The assembly code decompiled by myself[/B]
MOV DPTR,#immed
INC @R1
POP direct
MOVX A,@DPTR
MOV direct,A
MOVX @DPTR,A
INC DPTR
MOVX A,@DPTR
ADD A,direct
MOVX @DPTR,A
INC DPTR
MOVX @DPTR,A
--END-OF-FILE--