Re: [cc65] 6502.h

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-01-09 15:09:12


On Thu, Jan 09, 2003 at 02:51:08PM +0100, Piotr Fusik wrote:
> > So I will change this to %11001111 to remove the break flag.
>
> Again, why?
> Bits 4 and 5 are used for some extensions in other 65xx family CPUs, so I
> don't see a reason to always clear them.

Because I don't know what these bits may do on some other CPU. It is good
programming practice to program exactly according to a specification and to
exclude anything that lies outside of the specs.

Taking the 65816 as an example: The two bits masked out will switch the
accumulator and index register to 16 bits. Since the _sys() routine does not
support the 65816 explicitly, weird things will happen when these bits are
used. If the bit for switching the accumulator to 16 bits is used for example,
the code that is executed after return from the routine will fail, which will
cause the program to crash. Other 65XX family CPUs may use these bits for
other purposes. I don't think it's a good idea to enable them without knowing
what happens.

If you want to have support for the 816, then do that explicitly. Either by
using a separate function (which may also support 16 bit register values), or
by creating a separate library with 816 support.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-01-09 15:09:18 CET