[Coco] ANDCC

Phill Harvey-Smith afra at aurigae.demon.co.uk
Tue Jun 12 12:50:00 EDT 2007


Quoting "Ries, Rich (S&FS)" <Rich.Ries at Honeywell.com>:


> I always found "ANDCC #nn"/"ORCC #nn" to be a royal pain. Why should I

> need to remember where the various bits are positioned in the micro?

> Isn't that the type of thing the computer is good at?


You can of course always create some defined names that have the values
and then use something like :

ANDCC IRQ_OFF

etc.


> A nice assembler would recognize "SETCC N" or "CLRCC OV" and translate

> it into the proper hex codes. Honestly, in all my years of micro

> programming, I cannot remember needing to set or clear more than one bit

> of the PSW/CC at a time.


Having had a hand in some low level code for Nitros (Dragon floppy driver),
I have found that I often needed to enable and disable both the IRQ and FIRQ
inturrupts at the same time, whilst yes I could do to ANDCC instructions to
clear each, this seems a little wastefull, especially when code space
is tight, as it is on the Dragon boot track :(


> I guess an "almost nice" assembler would have macros with parameters, to

> allow creation of SETCC and CLRCC macros.


That's one way of doing it ofcourse, to use the above example you
could use something like INTS_OFF and INTS_ON, I actually do this sort
of thing when
programming in AVR assembler, to push and pop the index regs, as they
are 16 bit regs made up of 2 * 8 bit regs, however the AVR push
instructions will only handle 8 bit pushes, so I have a macro to do
this.....


Phill.


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





More information about the Coco mailing list