hi i am using keil uVision3. i have written a simple code in assemply language which contains jump instructions like sjmp,jnz jb . when i generate the hex file from this asm file all the other values in the hex file are correct except for the jump addresses corresponding to these instructions
my asm file is as follows
reset: ljmp start nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop start: mov A,#00h -- mov P0,#0ffh -- mov P1,#0ffh -- jb p1.0,jump1 jump1: jnz jump2 -- mov a,P0 -- mov R0,a -- mov a,#00h -- inc a -- ret jump2: mov a,P0 -- mov R1,a -- sjmp jump3 -- ret jump3: mov A,R1 -- add A,R0 -- mov P0,A -- clr P1.2 -- setb P1.2 -- clr P1.2 -- ret -- end
(i have used "--" for formatting this msg its not part of actual .asm file ) and the hex file i get is like this
:1000000002001D00000000000000000000000000D1 :1000100000000000000000000000000000740075F7 :1000200080FF7590FF2090007007E580F874000451 :1000300022E580F9800122E928F580C292D292C29D :0200400092220A :00000001FF
here u can see that hex corresponding to jb is 20 (3rd line) after that address of port p1.0 which is 90 but the address that it should jump comes out to be 00 which is incorrect. the address should be 28(hex)
{you can calculate the address by writting one byte per line or generate a dua file from the hex file}
please tell me if i am missing out on something.......and tell me how to generate a correct hex file
I'm not entirely sure why there's so much hostility in this thread.
The "bible" Erik is referring to can be found here (he was nice enough to point me that direction with a problem I had in another thread):
www.8052.com/.../120112
As he mentioned, it gives information regarding the jump commands in chapter 2. If you read that portion, it should give you some insight on what the problem could be. I hope this helps!
I'm not entirely sure why there's so much hostility in this thread. I would not know about that, butwhen soneone post i have made 8051 core in vhdl and am prototyping it to xilinx fpga and show that (s)he has not even taken the time to understand the instruction set of the processor (s)he is synthesizing, "politically correct" responses is not to be expected. Especially when the post is not "I do not understand", but "incorrect hex generation from keil"
Erik