Page 1 of 1

INCB and CC...

Posted: Sat Jul 12, 2014 8:23 pm
by jedie
I compare some trace in my Emulator with the XRoar one.
For compare the CC values i add --add_cc in my add_info_in_trace.py with commit https://github.com/jedie/PyDragon32/com ... 2ad02c4c03

The thread here is about INCB and the CC flags. I saw this:

The XRoar trace:
9209| 46 RORA cc=84 a=00 b=ff dp=00 x=004f y=b39b u=03db s=7f28| E....Z.. | $9209: $8000-$9fff - CoCo - Extended Color BASIC ROM
920a| 5c INCB cc=84 a=00 b=00 dp=00 x=004f y=b39b u=03db s=7f28| E....Z.. | $920a: $8000-$9fff - CoCo - Extended Color BASIC ROM
920b| 26f4 BNE $9201 cc=84 a=00 b=00 dp=00 x=004f y=b39b u=03db s=7f28| E....Z.. | $920b: $8000-$9fff - CoCo - Extended Color BASIC ROM

DragonPy Emulator trace:
ed09| 46 RORA A=00 cc=84 a=00 b=ff dp=00 x=004f y=0000 u=01f2 s=0327 | E....Z.. | $ed09: $db00-$ffff - BASIC Interpreter
ed0a| 5c INCB B=00 cc=86 a=00 b=00 dp=00 x=004f y=0000 u=01f2 s=0327 | E....ZV. | $ed0a: ADD ONE TO EXPONENT DIFFERENCE
ed0b| 26 BNE ea:ed01 cc=86 a=00 b=00 dp=00 x=004f y=0000 u=01f2 s=0327 | E....ZV. | $ed0b: BRANCH IF EXPONENTS NOT =

B was $FF and INCB called. Look at the Overflow Flag V
XRoad didn't set V, why?

Re: INCB and CC...

Posted: Sat Jul 12, 2014 9:00 pm
by sixxie
jedie wrote: B was $FF and INCB called. Look at the Overflow Flag V
XRoad didn't set V, why?
Because V indicates *signed* overflow - you're incrementing from -1 to 0.

Re: INCB and CC...

Posted: Sat Jul 12, 2014 9:18 pm
by JeeK
jedie wrote:I compare some trace in my Emulator with the XRoar one.
For compare the CC values i add --add_cc in my add_info_in_trace.py with commit https://github.com/jedie/PyDragon32/com ... 2ad02c4c03

The thread here is about INCB and the CC flags. I saw this:

[..]
DragonPy Emulator trace:
ed09| 46 RORA A=00 cc=84 a=00 b=ff dp=00 x=004f y=0000 u=01f2 s=0327 | E....Z.. | $ed09: $db00-$ffff - BASIC Interpreter
ed0a| 5c INCB B=00 cc=86 a=00 b=00 dp=00 x=004f y=0000 u=01f2 s=0327 | E....ZV. | $ed0a: ADD ONE TO EXPONENT DIFFERENCE
ed0b| 26 BNE ea:ed01 cc=86 a=00 b=00 dp=00 x=004f y=0000 u=01f2 s=0327 | E....ZV. | $ed0b: BRANCH IF EXPONENTS NOT =

B was $FF and INCB called. Look at the Overflow Flag V
XRoad didn't set V, why?
Xroar is right. The overflow condition is always related to signed value operations. For INC this happens only if 0x7f (127) overflows the positive value range and becomes 0x80 (128 or signed -128). Vice versa for DEC.

Re: INCB and CC...

Posted: Sun Jul 13, 2014 10:09 am
by jedie