home *** CD-ROM | disk | FTP | other *** search
- /* Jump.c: Jump logic emulation.
- *
- * 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"
-
- /*=========================================================================*
- * jp_nn *
- *=========================================================================*/
- void jp_nn()
- {
- #define jp_nn() PutPC(Getnextword())
-
- T(10);
- jp_nn();
- }
-
- /*=========================================================================*
- * jp_cc_nn *
- *=========================================================================*/
-
- #define jp_cc_nn(flag) { \
- T(10); \
- if(flag) \
- { \
- jp_nn(); \
- } \
- else \
- PC += 2; \
- }
-
-
- void jp_nz_nn() jp_cc_nn(!flags._Z);
- void jp_z_nn() jp_cc_nn(flags._Z);
- void jp_nc_nn() jp_cc_nn(!flags._C);
- void jp_c_nn() jp_cc_nn(flags._C);
- void jp_po_nn() jp_cc_nn(!flags._P);
- void jp_pe_nn() jp_cc_nn(flags._P);
- void jp_p_nn() jp_cc_nn(!flags._S);
- void jp_m_nn() jp_cc_nn(flags._S);
-
- #undef jp_cc_nn
- #undef jp_nn
-
- /*=========================================================================*
- * jr_e *
- *=========================================================================*/
- void jr_e()
- {
-
- #define jr_e() PC += ucharToUshort(readbyte(PC++));
-
- T(12);
- jr_e();
- }
-
- /*=========================================================================*
- * jr_cc_e *
- *=========================================================================*/
-
- #define jr_cc_e(flag) { \
- if(flag) \
- { \
- T(12); \
- jr_e(); \
- } \
- else \
- { \
- T(7); \
- PC++; \
- } \
- }
-
-
- void jr_c_e() jr_cc_e(flags._C);
- void jr_nc_e() jr_cc_e(!flags._C);
- void jr_z_e() jr_cc_e(flags._Z);
- void jr_nz_e() jr_cc_e(!flags._Z);
-
- #undef jr_cc_e
-
- /*=========================================================================*
- * jp_hl *
- *=========================================================================*/
- void jp_hl()
- {
- T(4);
- PutPC(HL);
- }
-
- /*=========================================================================*
- * jp_ix *
- *=========================================================================*/
- void jp_ix()
- {
- T(8);
- PutPC(IX);
- }
-
- /*=========================================================================*
- * jp_iy *
- *=========================================================================*/
- void jp_iy()
- {
- T(8);
- PutPC(IY);
- }
-
- /*=========================================================================*
- * djnz_e *
- *=========================================================================*/
- void djnz_e()
- {
- if(--B)
- {
- T(13);
- jr_e();
- }
- else
- {
- T(8);
- PC++;
- }
- }
-
- #undef jr_e
-
- /* EOF : Jump.c */
-