2013-07-06 04:37:13 +00:00
|
|
|
/*
|
2015-10-22 05:13:26 +00:00
|
|
|
* Apple // emulator for *ix
|
|
|
|
*
|
|
|
|
* This software package is subject to the GNU General Public License
|
|
|
|
* version 3 or later (your choice) as published by the Free Software
|
|
|
|
* Foundation.
|
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
|
2015-10-22 05:13:26 +00:00
|
|
|
* Copyright 2013-2015 Aaron Culliney
|
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
|
|
|
extern volatile bool is_debugging;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
STEPPING = 0,
|
|
|
|
NEXTING,
|
|
|
|
FINISHING,
|
|
|
|
UNTILING,
|
2014-03-30 19:23:08 +00:00
|
|
|
TYPING,
|
2014-03-30 20:58:34 +00:00
|
|
|
LOADING,
|
2014-03-22 18:24:57 +00:00
|
|
|
GOING
|
|
|
|
} stepping_type_t;
|
|
|
|
|
2016-07-03 23:21:22 +00:00
|
|
|
// FIXME TODO : make opaque type ...
|
2014-03-22 18:24:57 +00:00
|
|
|
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;
|
2014-03-30 19:23:08 +00:00
|
|
|
time_t timeout;
|
|
|
|
const char *step_text;
|
2016-07-03 23:21:22 +00:00
|
|
|
const bool step_deterministically;
|
2014-03-22 18:24:57 +00:00
|
|
|
} 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,
|
2014-03-30 19:23:08 +00:00
|
|
|
SEARCH, HELP, LOG, BSAVE, BLOAD, SAVE, FBSHA1, TYPE,
|
|
|
|
LOAD, 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-30 17:53:57 +00:00
|
|
|
#ifdef INTERFACE_CLASSIC
|
2017-08-05 18:59:07 +00:00
|
|
|
void c_interface_debugging(uint8_t *stagingFB);
|
2014-03-30 17:53:57 +00:00
|
|
|
#endif
|
2013-06-11 07:08:15 +00:00
|
|
|
|
2016-07-03 23:21:22 +00:00
|
|
|
void debugger_setInputText(const char *text, const bool deterministically);
|
2018-07-29 23:43:36 +00:00
|
|
|
void debugger_setBreakCallback(bool(*cb)(void));
|
2015-09-06 22:15:33 +00:00
|
|
|
void c_debugger_go(void);
|
|
|
|
bool c_debugger_should_break(void);
|
2014-03-30 19:23:08 +00:00
|
|
|
void c_debugger_set_timeout(const unsigned int secs);
|
2014-03-30 19:35:09 +00:00
|
|
|
bool c_debugger_set_watchpoint(const uint16_t addr);
|
2016-02-18 06:22:55 +00:00
|
|
|
void c_debugger_clear_watchpoints(void);
|
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];
|
2014-11-18 04:46:29 +00:00
|
|
|
extern const uint8_t opcodes_65c02_numargs[256];
|
2013-06-11 07:08:15 +00:00
|
|
|
|
|
|
|
#endif
|