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 GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
37 bfd_vma start_address
;
44 while ((i
= getopt (ac
, av
, "tv")) != EOF
)
66 printf ("run %s\n", name
);
68 abfd
= bfd_openr (name
, "coff-w65");
72 if (bfd_check_format (abfd
, bfd_object
))
75 for (s
= abfd
->sections
; s
; s
= s
->next
)
77 unsigned char *buffer
= malloc (bfd_section_size (abfd
, s
));
78 bfd_get_section_contents (abfd
,
82 bfd_section_size (abfd
, s
));
83 sim_write (s
->vma
, buffer
, bfd_section_size (abfd
, s
));
87 start_address
= bfd_get_start_address (abfd
);
88 sim_set_pc (start_address
);
102 sim_info (printf
, 0);
104 /* Find out what was in r0 and return that */
107 sim_fetch_register(0, b
);
120 fprintf (stderr
, "usage: run [-tv] program\n");