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
It is a relative address, Not absolute.
I have realized my mistake. and the core is working fine
I do understand that the title of the post was a little offensive specially to those who have designed the compiler. i will be careful in choosing title in future.
i am a student so i am used to a little admonishing but i appreciate the fact that seniors came out to help me and that is what really matters.
for others go through the docs carefully
jb b,raddr
raddr is the relative address here its 00000000 which then gets added to the program counter plus 1 to generate the rom address.
that's YOUR job
heve you even downloaded chapter 2? much more explicit that any datasheet
Erik
I think what he's saying is to anyone else that might read through this post, his advice is to go through the documents carefully. I don't think he's directing that at anyone in particular. In fact, I think he's confirming what you've been telling him.
one could easily see that the so called seniors are very rude. this guy might be wrong with the title of his post but than this is what he probably thought. Just because you know something doesn't mean that you have to be rude to others as it must have taken long time for you guys to learn.i didn't see any straight answers or clear reference to anything that these guys have given.
be nice to newbies as once you were also one
one could easily see that the so called seniors are very rude. There is, today an expectation that every statement is wrapped in pink cotton.
e.g. I posted "WHY do you refuse to work with chapter 2 of "the bible" instead of making incorrect statementsin the forum" instead of posting "I will gladly read the manual for you, find the relavant paragraph and quote it here, please come back when you need me to read the manual for you again"
if thst is what is supposed to be posted to not be "rude" expect rudeness (as you define it).