Back to index

cell-binutils  2.17cvs20070401
cpu-z80.c
Go to the documentation of this file.
00001 /* BFD library support routines for the Z80 architecture.
00002    Copyright 2005 Free Software Foundation, Inc.
00003    Contributed by Arnold Metselaar <arnold_m@operamail.com>
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
00020    MA 02110-1301, USA.  */
00021 
00022 #include "bfd.h"
00023 #include "sysdep.h"
00024 #include "libbfd.h"
00025 
00026 const bfd_arch_info_type bfd_z80_arch;
00027 
00028 /* This routine is provided two arch_infos and
00029    returns whether they'd be compatible.  */
00030 
00031 static const bfd_arch_info_type *
00032 compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
00033 {
00034   if (a->arch != b->arch)
00035     return NULL;
00036 
00037   if (a->mach == b->mach)
00038     return a;
00039 
00040   return (a->arch == bfd_arch_z80) ? & bfd_z80_arch : NULL;
00041 }
00042 
00043 #define N(name,print,default,next)  \
00044 { 16, 16, 8, bfd_arch_z80, name, "z80", print, 0, default, \
00045     compatible, bfd_default_scan, next }
00046 
00047 #define M(n) &arch_info_struct[n]
00048 
00049 static const bfd_arch_info_type arch_info_struct[] =
00050 {
00051   N (bfd_mach_z80strict, "z80-strict", FALSE, M(1)),
00052   N (bfd_mach_z80,       "z80",        FALSE, M(2)),
00053   N (bfd_mach_z80full,   "z80-full",   FALSE, M(3)),
00054   N (bfd_mach_r800,      "r800",       FALSE, NULL)
00055 };
00056 
00057 const bfd_arch_info_type bfd_z80_arch = N (0, "z80-any", TRUE, M(0));