OUTI affecting Carry against Z80 documentation

By hope-hunter

Rookie (22)

hope-hunter's picture

12-02-2022, 23:58

I see that OUTI instruction is affecting Carry flag on BlueMSX. A friend check it on OpenMSX and saw that also other flags is affecting too. But Z80 documentations says that OUTI must affect only Z flag (according B register that is decremented). What can be done? Shocked!

On Blue MSX, for example:
HL=8000H => C
HL=80FxH => NC

Login or register to post comments

By Manuel

Ascended (19228)

Manuel's picture

13-02-2022, 00:18

By hope-hunter

Rookie (22)

hope-hunter's picture

13-02-2022, 00:25

Oh, very good this document! Thank you Manuel! Smile

The answer (page 24):
"• The INI/INIR/IND/INDR/OUTI/OUTD/OTIR/OTDR instructions do affect
the CF flag (some official documentation says they leave it unaffected, important!)
and the NF flag isn’t always set but may also be reset (see 4.3 for exact operation)."

By Grauw

Ascended (10684)

Grauw's picture

06-03-2022, 01:53

Note that unlike the Z80, on the R800 the flags do behave as the Z80 manual describes. So only the zero and add/subtract flags are affected, and carry etc are unchanged. See here.

Thanks to Japanese Twitter user @mdpc___ for discovering. He’s posted some other nice stuff too btw, worth checking out his channel and following.

By hope-hunter

Rookie (22)

hope-hunter's picture

31-03-2022, 06:58

Very interesting. Thank you Grauw!