Re: A92: Questions about some instructions


[Prev][Next][Index][Thread]

Re: A92: Questions about some instructions




At 23:00 1998-06-06 -0500, you wrote:
>
>>BVS is when the result can't be calculated, aka overflow. [How can that
>happen? Anyone wanna explain?]
>
>
>maybe division by 0
> 

V if the oVerflow flag. It is set when a twocomplement instruction
overflows, unlike the carry, which is set when the "whole" number overflows.
Twocomplement overflow is when an operation gives a result with the wrong
sign, e.g. (-a)+(-a)>0.

For example:

	move.b		#$EF,d0
	add.b		#$1,d0

would cause the V flag to be set, but not the Carry flag.

	move.b		#$FF,d0
	add.b		#$1,d0

would only set the carry flag, since $FF=(-1) and (-1)+1 should be $00,
which is what d0 will contain afterwards. But the addition really gives
$100, which can't be fit in 8 bits, and so the carry is set.

And I thought I'd never have any use for that 68k course in computer
engineering ;-)


Niklas Brunlid - http://www.efd.lth.se/~e96nbr
PQF Quote follows:

"Yelp."
        -- Gaspode the wonder dog
           (Terry Pratchett, Moving Pictures)


References: