On 3 May 2005 03:54:01 -0700, "Lanarcam" <lanarcam1@yahoo.fr> wrote:>> Although "branch" instructions usually take as a parameter, the >> *distance* to the target, every assembler that I have ever seen >> takes *the address of the target itself*, and assembles that into >> the "distance to jump". > >For the good old M68K you have BRA dest or JMP dest. In both cases >dest is the address of the destination, but the machine code for >BRA has a pc relative displacement whereas for jump it has an >absolute address.The interesting question is relative to _which_ PC value ? For various architectures there might be at lest the following cases: 1. The value of the PC instruction (I can't remember any) 2. The PC value between OPcode and displacement (especially with 8 bit processors) 3. The PC value of the _next_ instruction (most common)>Ever used BRA * ?Are you trying to destroy that memory location by overheating the core? :-) Paul
PIC18 Branch, simple question.
Started by ●May 2, 2005
Reply by ●May 3, 20052005-05-03
Reply by ●May 3, 20052005-05-03
Paul Keinanen wrote:> On 3 May 2005 03:54:01 -0700, "Lanarcam" <lanarcam1@yahoo.fr> wrote: > > >> Although "branch" instructions usually take as a parameter, the > >> *distance* to the target, every assembler that I have ever seen > >> takes *the address of the target itself*, and assembles that into > >> the "distance to jump". > > > >For the good old M68K you have BRA dest or JMP dest. In both cases > >dest is the address of the destination, but the machine code for > >BRA has a pc relative displacement whereas for jump it has an > >absolute address. > > The interesting question is relative to _which_ PC value ? Forvarious> architectures there might be at lest the following cases: > > 1. The value of the PC instruction (I can't remember any) > 2. The PC value between OPcode and displacement (especially with 8bit> processors) > 3. The PC value of the _next_ instruction (most common) > > >Ever used BRA * ? > > Are you trying to destroy that memory location by overheating the > core? :-)That's how, in the case of a serious error, the device was reset thanks to a watch dog who wasn't fed;)