home *** CD-ROM | disk | FTP | other *** search
- /* Flags.c: Z80 flags -- basic support routines.
- *
- * Copyright 1996 Rui Fernando Ferreira Ribeiro.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #include "env.h"
-
- #undef build_F
- #undef read_F
-
- /*=========================================================================*
- * build_flags *
- *=========================================================================*/
- void build_F()
- {
- /* defined as macro in z80.h */
- /* Build F from interpreter flags only we need them */
- F = (flags._C != 0) | ((flags._N != 0) << 1) | ((flags._P != 0) << 2) |
- ((flags._Y != 0) << 3) | ((flags._H != 0) << 4) | ((flags._X != 0) << 5) |
- ((flags._Z != 0) << 6) | ((flags._S != 0) << 7);
- }
-
- /*=========================================================================*
- * read_flags *
- *=========================================================================*/
- void read_F()
- {
- /* defined as macro in z80.h */
- /* Build interpreter flags with F */
- flags._S = (F & (UCHAR)BIT_7);
- flags._Z = (F & (UCHAR)BIT_6);
- flags._X = (F & (UCHAR)BIT_5);
- flags._H = (F & (UCHAR)BIT_4);
- flags._Y = (F & (UCHAR)BIT_3);
- flags._P = (F & (UCHAR)BIT_2);
- flags._N = (F & (UCHAR)BIT_1);
- flags._C = (F & (UCHAR)BIT_0);
- }
-
- /* EOF: Flags.c */
-