diff options
Diffstat (limited to 'sim/m68hc11/dv-m68hc11.c')
-rw-r--r-- | sim/m68hc11/dv-m68hc11.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/sim/m68hc11/dv-m68hc11.c b/sim/m68hc11/dv-m68hc11.c index 25449cdb571..669a045357a 100644 --- a/sim/m68hc11/dv-m68hc11.c +++ b/sim/m68hc11/dv-m68hc11.c @@ -1,6 +1,6 @@ /* dv-m68hc11.c -- CPU 68HC11&68HC12 as a device. Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - Written by Stephane Carrez (stcarrez@worldnet.fr) + Written by Stephane Carrez (stcarrez@nerim.fr) (From a driver model Contributed by Cygnus Solutions.) This program is free software; you can redistribute it and/or modify @@ -24,6 +24,7 @@ #include "sim-hw.h" #include "hw-main.h" #include "sim-options.h" +#include "hw-base.h" #include <limits.h> /* DEVICE @@ -159,6 +160,7 @@ enum { SET_PORT_A, SET_PORT_C, SET_PORT_D, + CPU_WRITE_PORT, PORT_A, PORT_B, PORT_C, @@ -178,6 +180,8 @@ static const struct hw_port_descriptor m68hc11cpu_ports[] = { { "set-port-c", SET_PORT_C, 0, input_port, }, { "set-port-d", SET_PORT_D, 0, input_port, }, + { "cpu-write-port", CPU_WRITE_PORT, 0, input_port, }, + /* Events generated for connection to other devices. */ { "cpu-reset", CPU_RESET_PORT, 0, output_port, }, @@ -317,6 +321,13 @@ attach_m68hc11_regs (struct hw *me, cpu->cpu_frequency = 8*1000*1000; } + if (hw_find_property (me, "use_bank") != NULL) + hw_attach_address (hw_parent (me), 0, + exec_map, + 0x08000, + 0x04000, + me); + cpu_mode = "expanded"; if (hw_find_property (me, "mode") != NULL) cpu_mode = hw_find_string_property (me, "mode"); @@ -532,6 +543,9 @@ m68hc11cpu_port_event (struct hw *me, m68hc11cpu_set_port (me, cpu, M6811_PORTD, level); break; + case CPU_WRITE_PORT: + break; + default: hw_abort (me, "bad switch"); break; @@ -829,6 +843,14 @@ m68hc11cpu_io_read_buffer (struct hw *me, sd = hw_system (me); cpu = STATE_CPU (sd, 0); + if (base >= 0x8000 && base < 0xc000) + { + address_word virt_addr = phys_to_virt (cpu, base); + if (virt_addr != base) + return sim_core_read_buffer (sd, cpu, space, dest, + virt_addr, nr_bytes); + } + /* Handle reads for the sub-devices. */ base -= controller->attach_address; result = sim_core_read_buffer (sd, cpu, @@ -1002,7 +1024,7 @@ m68hc11cpu_io_write (struct hw *me, sim_cpu *cpu, /* Update IO mapping. Detach from the old address and attach to the new one. */ - if ((old_bank & 0xF0) != (val & 0xF0)) + if ((old_bank & 0x0F) != (val & 0x0F)) { struct m68hc11cpu *controller = hw_data (me); @@ -1018,7 +1040,7 @@ m68hc11cpu_io_write (struct hw *me, sim_cpu *cpu, controller->attach_size, me); } - if ((old_bank & 0x0F) != (val & 0x0F)) + if ((old_bank & 0xF0) != (val & 0xF0)) { ; } @@ -1068,6 +1090,14 @@ m68hc11cpu_io_write_buffer (struct hw *me, sd = hw_system (me); cpu = STATE_CPU (sd, 0); + + if (base >= 0x8000 && base < 0xc000) + { + address_word virt_addr = phys_to_virt (cpu, base); + if (virt_addr != base) + return sim_core_write_buffer (sd, cpu, space, source, + virt_addr, nr_bytes); + } base -= controller->attach_address; result = sim_core_write_buffer (sd, cpu, io_map, source, base, nr_bytes); |