Re: [cc65] 6502.h

Date view Thread view Subject view

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


Hi!

On Tue, Jan 07, 2003 at 10:44:08AM +0100, Piotr Fusik wrote:
> #define F_IEN  	   	0x04	/* I flag */
>
> >>> What's 'IEN' ? I is the 'Interrupt Disable' flag.

It was not a very good idea to use other names, so I have replaced all flag
definitions as follows:

--------------------------------------------------------------------------
/* Defines for the flags in the regs structure */
#define F6502_N         0x80    /* N flag */
#define F6502_V         0x40    /* V flag */
#define F6502_B         0x10    /* B flag */
#define F6502_D         0x08    /* D flag */
#define F6502_I         0x04    /* I flag */
#define F6502_Z         0x02    /* Z flag */
#define F6502_C         0x01    /* C flag */
--------------------------------------------------------------------------

Using the standard flag shortcuts should make it easier for programmers to use
the #defines. I will keep the old flag #defines in the header file for one
release but comment them out, so people can see what has changed when looking
into the header file.

>  * regs structure are passed into the routine and the results are passed
>  * out. Some of the flags are ignored on input. The called routine must
>  * end with an RTS.
>  */
> void __fastcall__ _sys (struct regs* r);
>
> >>> Which flags are ignored? Why?

The break and interrupt disable flag are ignored. I'm not sure if the break
flag can be set by PHA/PLP anyway. My copy of Rodney Zacks "Programming the
6502" says the B flag can be set by PLP, but other books disagree. Allowing to
set the I flag would make sense, I think.

> >>> There should be tax in place of first tay.

Ok, fixed.

>     	and	#%11001011
>
> >>> Bits 4 and 5 are ignored by plp on 6502, but not on 65816, I think.
> >>> I'm not sure about other CPUs.
> >>> Enabling interrupts is not a good idea IMHO.

So I will change this to %11001111 to remove the break flag.

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 12:37:33 CET