/* sim-main.h -- Simulator for Motorola 68HC11 & 68HC12
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2007, 2008
+ Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@nerim.fr)
This file is part of GDB, the GNU debugger.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _SIM_MAIN_H
#define _SIM_MAIN_H
#define A_REGNUM 5
#define B_REGNUM 6
#define PSW_REGNUM 7
-#define Z_REGNUM 8
-#define PAGE_REGNUM 9
+#define PAGE_REGNUM 8
+#define Z_REGNUM 9
typedef struct m6811_regs {
unsigned short d;
int mode);
extern void print_io_byte (SIM_DESC sd, const char *name,
io_reg_desc *desc, uint8 val, uint16 addr);
+extern void print_io_word (SIM_DESC sd, const char *name,
+ io_reg_desc *desc, uint16 val, uint16 addr);
/* List of special 68HC11&68HC12 instructions that are not handled by the
/* The mode in which the CPU is configured (MODA and MODB pins). */
unsigned int cpu_mode;
+ const char* cpu_start_mode;
/* The cpu being configured. */
enum cpu_type cpu_type;
uint8 ios[MAX_PORTS];
+ /* Memory bank parameters which describe how the memory bank window
+ is mapped in memory and how to convert it in virtual address. */
+ uint16 bank_start;
+ uint16 bank_end;
+ address_word bank_virtual;
+ unsigned bank_shift;
+
+
struct hw *hw_cpu;
/* ... base type ... */
#define cpu_get_sp(PROC) ((PROC)->cpu_regs.sp)
#define cpu_get_a(PROC) ((PROC->cpu_regs.d >> 8) & 0x0FF)
#define cpu_get_b(PROC) ((PROC->cpu_regs.d) & 0x0FF)
-#define cpu_get_page(PROC) (PROC->cpu_regs.page)
+#define cpu_get_page(PROC) ((PROC)->cpu_regs.page)
/* 68HC12 specific and Motorola internal registers. */
#define cpu_get_tmp3(PROC) (0)
#define cpu_set_d(PROC,VAL) (((PROC)->cpu_regs.d) = (VAL))
#define cpu_set_x(PROC,VAL) (((PROC)->cpu_regs.ix) = (VAL))
#define cpu_set_y(PROC,VAL) (((PROC)->cpu_regs.iy) = (VAL))
-#define cpu_set_page(PROC,VAL) ((PROC->cpu_regs.page) = (VAL))
+#define cpu_set_page(PROC,VAL) (((PROC)->cpu_regs.page) = (VAL))
/* 68HC12 specific and Motorola internal registers. */
#define cpu_set_tmp3(PROC,VAL) (0)
inline address_word
phys_to_virt (sim_cpu *cpu, address_word addr)
{
- if (addr >= 0x8000 && addr < 0xc000)
- return ((address_word) (addr) - 0x8000)
- + (((address_word) cpu->cpu_regs.page) << 14) + 0x01000000;
+ if (addr >= cpu->bank_start && addr < cpu->bank_end)
+ return ((address_word) (addr - cpu->bank_start)
+ + (((address_word) cpu->cpu_regs.page) << cpu->bank_shift)
+ + cpu->bank_virtual);
else
return (address_word) (addr);
}
extern void sim_set_profile_size (int n);
extern void sim_board_reset (SIM_DESC sd);
-extern const char *cycle_to_string (sim_cpu *cpu, signed64 t);
+#define PRINT_TIME 0x01
+#define PRINT_CYCLE 0x02
+extern const char *cycle_to_string (sim_cpu *cpu, signed64 t, int flags);
#endif