[stella] BRK instruction: Request for clarification!

Subject: [stella] BRK instruction: Request for clarification!
From: "C. Bond" <cbond@xxxxxxxxxxxxx>
Date: Mon, 25 Jul 2005 17:12:47 -0400
I own a number of documents, books, and references devoted
to the 650x family. But I am amazed at how confusing and
outright contradictory the descriptions of the handling of
the BRK instruction are. According to the MOS Technology
Hardware Manual, the BRK instruction does NOT affect any
registers or flags. According to the Programmer's Manual,
the BRK instruction pushes the 'B' flag on the stack, but
does not modify the existing status register. Other
documents I have show that the BRK instruction sets the 'B'
flag in the existing status register and then pushes that
register on the stack. These can't all be right.

Since there are no native instructions to set or clear the
BRK flag ('B' flag) I would guess that, once set, it remains
set forever -- unless the programmer clears it by pushing
the existing status register, popping it into the
accumulator, clearing the bit, pushing the accumulator, and
then popping the status register. Otherwise, there must be
some operations which clear this bit, but which are not
described in any of the references at my disposal, including
the manufacturers documents. Nowhere do I find any hint that
the 'break' handler should clear this bit, even though a
failure to clear it could interfere with the suggested
handling of hardware interrupts.

What gives? Can anyone answer the following with confidence:

1) When a BRK instruction is executed, is the existing
status register altered?

2) Where and how should the BRK flag be cleared? Or is this
done automatically?

3) What happens to the IRQ flag during execution of the BRK?
is it ever changed? (It should normally be inactive when a
BRK occurs, but since it is ignored by BRK it could be in
any state.)

Democracy: The triumph of popularity over principle.

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread