[Color Computer] [Coco] 6809 Test and Set instruction?
Brett K Heath
hcmth019 at csun.edu
Tue Jul 11 18:08:54 EDT 2006
On Tue, 11 Jul 2006, James Diffendaffer wrote:
> I think he was asking if the 6809 has an instruction similar to the
> 680x0 test-and-set instruction.
> That is, one instruction that tests the state of a bit and sets it.
> The condition code register would let you know the previous state.
> This prevents an interrupt or task switch from changing the bit
> between the time you test it and setting it so that you can restore
> the proper state later without screwing it up for another task.
> I believe the answer is no but you can imitate the behavior by
> disabling interrupts, execute the separate test and set operations and
> then enable interrupts.
> Yeah, it's no 68K but it's no 6502 either.
> >Rumor has it that Allen Huffman may have mentioned these words:
> >>Does the 6809 have a test and set instruction?
> >
> >Assuming I understand your question, yes.
> >
> >TST
> >TSTA, opcode 4D
> >TSTB, " 5D
> >
> >The memory TST instruction works with these addressing modes:
> >
> >Direct: opcode 0D
> >Extended: " 7D
> >Indexed/Indirect: 6D
> >
> >HTH!
> >Roger "Merch" Merchberger
Don't hold me to the specifics of how it was implemented but I believe the
6809 designers used CPU handshaking on dedicated pins to get atomic
read-modify-write cycles.
There are two main differences between the 6809 and the 6809E. One is the
clock generator built in to the 6809, the other is the definition of two
of those pins that aren't connected in the coco.
As I said I'm a little vague on the specifics but since multiprocessing
was implemented by having two CPUs share memory and access it during
opposite phases of the clock all that they needed to do to keep one CPU
from stepping on a read-modify-write cycle initiated by the other was to
signal it not to mess with memory during that cycle.
If memory serves there was a Busy/*BusAvailable pin on the master (6809)
and a corresponding pin on the slave (6809E) used to arbitrate this, with
read-modify-write instructions locking the bus until they were done
(typically 2-3 machine cycles).
If you really need to know exactly how it was done look at the Motorola
6809 Programmers manual.
HTH
Brett K.Heath
More information about the Coco
mailing list