#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2008
    Posts
    9
    Rep Power
    0

    Overflow with asr opcode


    I am learning assembly on a MC68HC12.

    Can someone explain to me why the overflow flag, V=1, using the asr instruction on following binary number:

    %1111 0100
    the asr shift would be;
    %1111 1010
    V=1

    another example
    %0000 0001
    the asr shift would be;
    %0000 0000
    why does V=1

    I think I understand how overflow works with addition and subtraction but haven't been able to find a good explanation for it implementation with the shift instructions. Any recommended reading?
    thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    The reference manual. In the instruction glossary the entry for ASR explains exactly how the value of V is determined.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo