$ + 1

Discussion in 'Programmer's Corner' started by mpuvdd, Mar 29, 2008.

  1. mpuvdd

    Thread Starter Active Member

    Feb 11, 2007
    50
    0
    HI everyone,
    I'm learning C and some assembly language currently, and was told that $ + 1 would delay 2 instruction cycles instead of 1. Shouldn’t it just take 1 instruction cycle? How's that work? Also, $ does stand for PCL, right?

    Thanks,
    mpuvdd
     
  2. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    It would delay by two cycles, because all jump/branch instructions require two cycles to execute. Yes, $ is the current PCL.

    If you need four cycles delay, give a return instruction on any existing function a label and call that label. You get four cycles delay with only a single call instuction.
     
Loading...