2013-07-06 04:37:13 +00:00
|
|
|
/*
|
|
|
|
* Apple // emulator for Linux: Definitions for debugger
|
2013-06-11 07:08:15 +00:00
|
|
|
*
|
|
|
|
* Copyright 1994 Alexander Jean-Claude Bottema
|
|
|
|
* Copyright 1995 Stephen Lee
|
|
|
|
* Copyright 1997, 1998 Aaron Culliney
|
|
|
|
* Copyright 1998, 1999, 2000 Michael Deutschmann
|
|
|
|
*
|
|
|
|
* This software package is subject to the GNU General Public License
|
2013-07-06 04:37:13 +00:00
|
|
|
* version 2 or later (your choice) as published by the Free Software
|
2013-06-11 07:08:15 +00:00
|
|
|
* Foundation.
|
|
|
|
*
|
2013-07-06 04:37:13 +00:00
|
|
|
* THERE ARE NO WARRANTIES WHATSOEVER.
|
2013-06-11 07:08:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef A2_DEBUG_H
|
|
|
|
#define A2_DEBUG_H
|
|
|
|
|
2013-10-07 04:01:00 +00:00
|
|
|
#include "common.h"
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2014-03-22 18:24:57 +00:00
|
|
|
#ifdef DEBUGGER
|
|
|
|
extern volatile bool is_debugging;
|
|
|
|
#else
|
|
|
|
#define is_debugging false
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
STEPPING = 0,
|
|
|
|
NEXTING,
|
|
|
|
FINISHING,
|
|
|
|
UNTILING,
|
|
|
|
GOING
|
|
|
|
} stepping_type_t;
|
|
|
|
|
|
|
|
typedef struct stepping_struct_t {
|
|
|
|
stepping_type_t step_type;
|
|
|
|
uint16_t step_count;
|
|
|
|
uint16_t step_frame;
|
|
|
|
uint16_t step_pc;
|
|
|
|
bool should_break;
|
|
|
|
} stepping_struct_t;
|
|
|
|
|
|
|
|
#define DEBUGGER_BUF_X 39
|
|
|
|
#define DEBUGGER_BUF_Y 22
|
2013-07-06 04:37:13 +00:00
|
|
|
#define MAX_BRKPTS 16
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
/* debugger commands */
|
|
|
|
enum token_type { MEM, DIS, REGS, SETMEM, STEP, FINISH, UNTIL, GO, VM,
|
2013-07-06 04:37:13 +00:00
|
|
|
BREAK, WATCH, CLEAR, IGNORE, STATUS, OPCODES, LC, DRIVE,
|
|
|
|
SEARCH, HELP, LOG, BSAVE, BLOAD, SAVE, UNKNOWN };
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2014-03-22 18:24:57 +00:00
|
|
|
typedef enum {
|
2013-06-11 07:08:15 +00:00
|
|
|
addr_implied,
|
|
|
|
addr_accumulator,
|
|
|
|
addr_immediate,
|
|
|
|
addr_zeropage,
|
|
|
|
addr_zeropage_x,
|
|
|
|
addr_zeropage_y,
|
|
|
|
addr_absolute,
|
|
|
|
addr_absolute_x,
|
|
|
|
addr_absolute_y,
|
|
|
|
addr_indirect,
|
|
|
|
addr_indirect_x,
|
|
|
|
addr_indirect_y,
|
2013-07-06 04:37:13 +00:00
|
|
|
addr_j_indirect, /* non-zeropage indirects, used in JMP only */
|
2013-06-11 07:08:15 +00:00
|
|
|
addr_j_indirect_x,
|
|
|
|
addr_relative
|
2014-03-22 18:24:57 +00:00
|
|
|
} addressing_mode_t;
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
struct opcode_struct
|
|
|
|
{
|
|
|
|
const char *mnemonic;
|
2014-03-22 18:24:57 +00:00
|
|
|
addressing_mode_t mode;
|
2013-06-11 07:08:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct opcode_struct *opcodes;
|
|
|
|
|
2014-03-22 18:24:57 +00:00
|
|
|
// Debugger commands
|
2013-06-11 07:08:15 +00:00
|
|
|
void clear_debugger_screen();
|
|
|
|
void bload(FILE*, char*, int);
|
|
|
|
void show_misc_info();
|
2014-03-22 18:24:57 +00:00
|
|
|
uint8_t get_current_opcode();
|
2013-06-11 07:08:15 +00:00
|
|
|
void dump_mem(int, int, int, int, int);
|
|
|
|
void search_mem(char*, int, int);
|
|
|
|
void set_mem(int, char*);
|
|
|
|
void set_lc_mem(int, int, char*);
|
|
|
|
void disasm(int, int, int, int);
|
|
|
|
void clear_halt(int*, int);
|
|
|
|
void set_halt(int*, int);
|
|
|
|
void show_breakpts();
|
|
|
|
void show_regs();
|
|
|
|
void display_help();
|
|
|
|
void show_lc_info();
|
|
|
|
void show_disk_info();
|
2014-03-22 18:24:57 +00:00
|
|
|
void set_halt_opcode(uint8_t opcode);
|
2013-06-11 07:08:15 +00:00
|
|
|
void set_halt_65c02();
|
|
|
|
void clear_halt_65c02();
|
2014-03-22 18:24:57 +00:00
|
|
|
void clear_halt_opcode(uint8_t opcode);
|
2013-06-11 07:08:15 +00:00
|
|
|
void show_opcode_breakpts();
|
|
|
|
|
2014-03-22 18:24:57 +00:00
|
|
|
bool c_debugger_should_break();
|
|
|
|
void c_debugger_begin_stepping(stepping_struct_t s);
|
|
|
|
void c_interface_debugging();
|
2013-10-07 04:01:00 +00:00
|
|
|
|
2013-06-11 07:08:15 +00:00
|
|
|
extern const struct opcode_struct opcodes_6502[256];
|
|
|
|
extern const struct opcode_struct opcodes_65c02[256];
|
|
|
|
extern const struct opcode_struct opcodes_undoc[256];
|
2013-10-07 04:01:00 +00:00
|
|
|
extern const char* const disasm_templates[15];
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
#endif
|