I've quit highschool few years ago and now I decided to finish it. So I'm learning stuff by myself at home and then go and take exams.
Even though the purpose of a text book I'm using is not to teach us how to write anything more advanced than the most basic programs, book is still useless. It only explains each command very briefly and that's it. No examples, nada...
The following questions are all related to Motorola 6803
When I talk about C ( carry ), V ( overflow ), Z (Zero) and N ( negative ) flags, I'm reffering to the flags in CCR register.
1) In assembly command BGE can give you IF..THEN.. statement.
BGE 40 -->PC gets increased 42 by if N != V.
But if N==V then PC gets increased by 2.
- So if signed number overflows and if this number is also positive, then PC will be increased by 40.
- But if number doesn't overflow ( V = 0 ) and if number is positive ( N = 0 ) OR if number overflows ( N = 1 ) and if number is also negative ( N = 1 ), then PC gets increased by 2?!
I don't follow this logic.
Can you show me an example(s) of condition we must include into "if ( condition ) then.." statement using BGE 40 command:
a) What kind of IF ( CONDITION ) THEN .. statement would be TRUE and would fulfill the following criteria:
* signed number overflows ( V = 1 ) and is also positive ( N = 0 )
b) Can you show me an example of IF ( CONDITION ) THEN conditional statement, that would be FALSE and would fulfill the following criteria:
* number doesn't overflow ( V = 0 ) and number is positive ( N = 0 )
* number overflows( V = 1 ) and number is also negative ( N = 1 )
I just can't figure out "why N flag must not be equal to V flag
BVS 40 --> PC increases by 42 if overflow happens( V = 1 ).
Huh?! So if resulting value is either greater than 127 or smaller than -128, then statement is true?! Can you show me an example of this ( in both assembly and higher language code )?