1 /* run front end support for W65
2 Copyright (C) 1995 Free Software Foundation, Inc.
4 This file is part of W65 SIM
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
33 #ifdef NEED_DECLARATION_PRINTF
46 bfd_vma start_address;
53 while ((i = getopt (ac, av, "tv")) != EOF)
75 printf ("run %s\n", name);
77 abfd = bfd_openr (name, "coff-w65");
81 if (bfd_check_format (abfd, bfd_object))
84 for (s = abfd->sections; s; s = s->next)
86 unsigned char *buffer = malloc (bfd_section_size (abfd, s));
87 bfd_get_section_contents (abfd,
91 bfd_section_size (abfd, s));
92 sim_write (s->vma, buffer, bfd_section_size (abfd, s));
96 start_address = bfd_get_start_address (abfd);
97 sim_set_pc (start_address);
111 sim_info (printf, 0);
113 /* Find out what was in r0 and return that */
116 sim_fetch_register(0, b, 4);
129 fprintf (stderr, "usage: run [-tv] program\n");