Tim Ahrens

Embedded Assembly code compiled wrong?

Discussion created by Tim Ahrens on Feb 29, 2008
Latest reply on Mar 7, 2008 by CompilerGuru
Hi Folks,
 
I have embedded some assembly code in my C for the JM60
using CW 6.1.
 
What you see on the left is the source, and on the right
is the actual code that was generated in the 'assembly'
window.
 
How come the branch to location at 7900 isn't correct?
 
The code at 7900 should have the branch location as 78F4.
 
Thanks,
 
Tim
 
 
Key_temp = 0x00
Second_current = 0x01
 
 
Bottle_loop:
 asm{ 
  lda   Key_temp                   78F4  LDA  0x00B0
  cmp   #$00                       78F7  CMP  #0x00                       
  bne   check_keys                 78F9  BNE  *+14    ;abs = 0x7907
       
  lda   Second_current             78FB  LDA  0x0150           
  cmp   #$3b                       78FE  CMP  #0x3B            
  bne   Bottle_loop                7900  BNE  *+2     ;abs = 0x7902 <-- WRONG
                                                                  location, should 
                                                                     be 78F4
  jsr   update_clock               7902  JSR  0x79B6
  bra   Bottle_loop                7905  BRA  *+2     ;abs = 0x7907
       
check_keys:
    }

      

Outcomes