cpu-z80.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* BFD library support routines for the Z80 architecture.
  2. Copyright (C) 2005-2015 Free Software Foundation, Inc.
  3. Contributed by Arnold Metselaar <arnold_m@operamail.com>
  4. This file is part of BFD, the Binary File Descriptor library.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  16. MA 02110-1301, USA. */
  17. #include "sysdep.h"
  18. #include "bfd.h"
  19. #include "libbfd.h"
  20. const bfd_arch_info_type bfd_z80_arch;
  21. /* This routine is provided two arch_infos and
  22. returns whether they'd be compatible. */
  23. static const bfd_arch_info_type *
  24. compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
  25. {
  26. if (a->arch != b->arch)
  27. return NULL;
  28. if (a->mach == b->mach)
  29. return a;
  30. return (a->arch == bfd_arch_z80) ? & bfd_z80_arch : NULL;
  31. }
  32. #define N(name,print,default,next) \
  33. { 16, 16, 8, bfd_arch_z80, name, "z80", print, 0, default, \
  34. compatible, bfd_default_scan, bfd_arch_default_fill, next }
  35. #define M(n) &arch_info_struct[n]
  36. static const bfd_arch_info_type arch_info_struct[] =
  37. {
  38. N (bfd_mach_z80strict, "z80-strict", FALSE, M(1)),
  39. N (bfd_mach_z80, "z80", FALSE, M(2)),
  40. N (bfd_mach_z80full, "z80-full", FALSE, M(3)),
  41. N (bfd_mach_r800, "r800", FALSE, NULL)
  42. };
  43. const bfd_arch_info_type bfd_z80_arch = N (0, "z80-any", TRUE, M(0));