aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/h8300/ChangeLog5
-rw-r--r--sim/h8300/compile.c8
-rw-r--r--sim/h8300/run.c38
3 files changed, 28 insertions, 23 deletions
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index 2075c7c..e4cd0d4 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jul 15 09:59:01 1993 Doug Evans (dje@canuck.cygnus.com)
+
+ * run.c (main): If h8/300h binary detected, call set_h8300h.
+ * compile.c (sim_resume): Fix O_NEG insn.
+
Fri Jul 9 14:36:48 1993 Doug Evans (dje@canuck.cygnus.com)
* run.c (main): Add -h flag to enable h8/300h emulation.
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 2db45dd..b18f7ea 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -823,11 +823,11 @@ sim_resume (step)
res = rd + ea;
goto alu8;
-#define RD rd = fetch(&code->src);
-#define RD_EA rd = fetch(&code->dst); ea = fetch(&code->src);
+#define EA ea = fetch(&code->src);
+#define RD_EA ea = fetch(&code->src); rd = fetch(&code->dst);
- ALUOP (1, O_SUB, RD_EA; ea = -ea ; res = rd + ea);
- ALUOP (1, O_NEG, RD; ea = -ea ;rd = 0; res = rd + ea);
+ ALUOP (1, O_SUB, RD_EA; ea = -ea ; res = rd + ea);
+ ALUOP (1, O_NEG, EA; ea = -ea ; rd = 0; res = rd + ea);
case O(O_ADD,SB):
rd = GET_B_REG(code->dst.reg);
diff --git a/sim/h8300/run.c b/sim/h8300/run.c
index 5b0f732..3010433 100644
--- a/sim/h8300/run.c
+++ b/sim/h8300/run.c
@@ -56,29 +56,29 @@ main (ac, av)
if (verbose)
printf ("run %s\n", name);
- abfd = bfd_openr (name, "coff-h8300");
- if (abfd)
+ abfd = bfd_openr (name, "coff-h8300");
+ if (abfd)
+ {
+ if (bfd_check_format(abfd, bfd_object))
{
- if (bfd_check_format(abfd, bfd_object))
- {
-
- for (s = abfd->sections; s; s=s->next)
- {
- char *buffer = malloc(bfd_section_size(abfd,s));
- bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s));
- sim_write(s->vma, buffer, bfd_section_size(abfd,s));
- }
+ if (abfd->arch_info->mach == bfd_mach_h8300h)
+ set_h8300h ();
- start_address = bfd_get_start_address(abfd);
- sim_store_register(
- 9,start_address);
- sim_resume(0,0);
- if (verbose)
- sim_info (verbose);
- return 0;
+ for (s = abfd->sections; s; s=s->next)
+ {
+ char *buffer = malloc(bfd_section_size(abfd,s));
+ bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s));
+ sim_write(s->vma, buffer, bfd_section_size(abfd,s));
}
+
+ start_address = bfd_get_start_address(abfd);
+ sim_store_register(9,start_address);
+ sim_resume(0,0);
+ if (verbose)
+ sim_info (verbose);
+ return 0;
}
-
+ }
return 1;
}