List of commands. More...
#include <md.h>
Classes | |
struct | _carthead_ |
struct | dgen_debugger_cmd |
struct | patch_elem |
Public Types | |
enum | z80_core { Z80_CORE_NONE, Z80_CORE_TOTAL } |
enum | cpu_emu { CPU_EMU_NONE, CPU_EMU_TOTAL } |
Public Member Functions | |
void | md_set (bool set) |
unsigned int | vblank () |
void | m68k_state_dump () |
void | m68k_state_restore () |
void | z80_state_dump () |
void | z80_state_restore () |
int | myfm_write (int a, int v, int md) |
uint8_t | region_guess () |
Region to emulate according to dgen_region_order and ROM header. | |
int | one_frame (struct bmap *bm, unsigned char retpal[256], struct sndinfo *sndi) |
void | pad_update () |
int | okay () |
md (bool pal, char region) | |
MD constructor. | |
~md () | |
void | init_pal () |
Switch to PAL or NTSC. | |
bool | init_sound () |
Initialise sound. | |
int | plug_in (unsigned char *cart, int len) |
Plug a cart into the MD. | |
int | unplug () |
Unplug a cart from the system. | |
int | load (const char *name) |
Load a ROM. | |
int | reset () |
Resets everything (Z80, M68K, VDP, etc). | |
uint8_t | misc_readbyte (uint32_t a) |
Read a byte from the m68Ks ram. | |
void | misc_writebyte (uint32_t a, uint8_t d) |
write a byte to the m68Ks ram. | |
uint16_t | misc_readword (uint32_t a) |
Read a word from the m68k memory. | |
void | misc_writeword (uint32_t a, uint16_t d) |
Write a word to m68k memory. | |
void | z80_init () |
Initialise the Z80. | |
void | z80_reset () |
Reset the Z80. | |
uint8_t | z80_read (uint16_t a) |
Read one byte from the memory space. | |
void | z80_write (uint16_t a, uint8_t d) |
Write one byte to the memory. | |
uint8_t | z80_port_read (uint16_t a) |
Port read to Z80. | |
void | z80_port_write (uint16_t a, uint8_t d) |
Port write to z80 This is a Nop. | |
void | cycle_z80 () |
Cycle through Z80 CPU implementations. | |
void | cycle_cpu () |
Cycle between M68K CPU implementations. | |
int | import_gst (FILE *hand) |
int | export_gst (FILE *hand) |
int | z80dump () |
Dump Z80 ram to a file named "dgz80ram". | |
void | fix_rom_checksum () |
Replace the in-memory ROM checksum with a calculated checksum. | |
int | patch (const char *list, unsigned int *errors, unsigned int *applied, unsigned int *reverted) |
This takes a comma or whitespace-separated list of Game Genie and/or hex codes to patch the ROM with. | |
int | has_save_ram () |
int | get_save_ram (FILE *from) |
Get saveram from FILE*. | |
int | put_save_ram (FILE *into) |
Write a saveram to FILE*. | |
void | init_joysticks () |
void | deinit_joysticks () |
int | debug_despatch_cmd (int n_toks, char **args) |
Dispatch a command to the relevant handler method. | |
int | debug_cmd_cont (int n_args, char **args) |
Continue (cont) command handler. | |
int | debug_cmd_reg (int n_args, char **args) |
Dump registers (reg) command handler. | |
int | debug_cmd_help (int n_args, char **args) |
Help (help) command handler. | |
int | debug_cmd_break (int n_args, char **args) |
Breakpoint (break) command handler. | |
int | debug_cmd_quit (int n_args, char **args) |
Quit (quit) command handler. | |
int | debug_cmd_step (int n_args, char **args) |
Step (step) command handler for the current core. | |
int | debug_cmd_trace (int n_args, char **args) |
Trace toggle (trace) command handler. | |
int | debug_cmd_minus_break (int n_args, char **args) |
Breakpoint removal (-break) command handler. | |
int | debug_cmd_cpu (int n_args, char **args) |
Core/CPU selection (cpu) command. | |
int | debug_cmd_dis (int n_args, char **args) |
Disassemble (dis) command handler. | |
int | debug_cmd_mem (int n_args, char **args) |
Memory dump (mem) command handler. | |
int | debug_cmd_setbwlr (int n_args, char **args, unsigned int type) |
Memory/registers write (setb/setw/setl/setr) commands handler. | |
int | debug_cmd_setb (int n_args, char **args) |
Set byte (setb) command handler, see debug_cmd_setbwlr(). | |
int | debug_cmd_setw (int n_args, char **args) |
Set word (setw) command handler, see debug_cmd_setbwlr(). | |
int | debug_cmd_setl (int n_args, char **args) |
Set long word (setl) command handler, see debug_cmd_setbwlr(). | |
int | debug_cmd_setr (int n_args, char **args) |
Set register (setr) command handler, see debug_cmd_setbwlr(). | |
int | debug_cmd_watch (int n_args, char **args) |
Watchpoints (watch) command handler. | |
int | debug_cmd_minus_watch (int n_args, char **args) |
Watchpoint removal (-watch) command handler. | |
void | debug_enter (void) |
Enter debugger and show command prompt. | |
void | debug_leave (void) |
Leave debugger. | |
void | debug_update_wp_cache (struct dgen_wp *w) |
Update the data pointer of a single watchpoint. | |
void | debug_update_fired_wps (void) |
Resynchronise all watchpoints based on actual data. | |
void | debug_set_wp_m68k (uint32_t start_addr, uint32_t end_addr) |
Add a M68K watchpoint to a range of addresses. | |
void | debug_print_disassemble (uint32_t from, int len) |
Pretty print a M68K disassembly. | |
void | debug_show_m68k_regs (void) |
Pretty print the M68K registers using m68k_state from class md. | |
void | debug_show_z80_regs (void) |
Pretty print Z80 registers using z80_state from class md. | |
void | debug_dump_mem (uint32_t addr, uint32_t len) |
Pretty print a block of memory as a hex dump. |
Static Public Member Functions | |
static void | region_info (uint8_t region, int *pal, int *hz, int *vblank, int *lines, uint8_t *mem) |
Public Attributes | |
char * | break |
unsigned int | mclk |
unsigned int | clk0 |
unsigned int | clk1 |
unsigned int | lines |
unsigned int | vhz |
unsigned int | pal: 1 |
md_vdp | vdp |
m68k_state_t | m68k_state |
z80_state_t | z80_state |
struct md::_carthead_ | cart_head |
char | region |
int | pad [2] |
uint8_t | pad_com [2] |
unsigned char | coo4 |
unsigned char | coo5 |
bool | plugged |
enum md::z80_core | z80_core |
enum md::cpu_emu | cpu_emu |
char | romname [256] |
struct md::patch_elem * | patch_elem |
unsigned long | debug_m68k_instr_count |
bool | debug_trap |
int | m68k |
int | m68k_max |
int | z80 |
int | z80_max |
Static Public Attributes | |
static const uint8_t | no_rom [] |
This is the default ROM, used when nothing is loaded. | |
static const size_t | no_rom_size = sizeof(no_rom) |
static const struct md::dgen_debugger_cmd | debug_cmd_list [] |
Private Member Functions | |
unsigned char | calculate_coo8 () |
unsigned char | calculate_coo9 () |
int | may_want_to_get_pic (struct bmap *bm, unsigned char retpal[256], int mark) |
int | may_want_to_get_sound (struct sndinfo *sndi) |
int | m68k_odo () |
void | m68k_run () |
void | m68k_busreq_request () |
void | m68k_busreq_cancel () |
void | m68k_irq (int i) |
void | m68k_vdp_irq_trigger () |
void | m68k_vdp_irq_handler () |
int | z80_odo () |
void | z80_run () |
void | z80_sync (int fake) |
void | z80_irq (int vector) |
void | z80_irq_clear () |
unsigned int | frame_usecs () |
int | fm_timer_callback () |
int | myfm_read (int a) |
int | mysn_write (int v) |
void | fm_reset () |
void | dac_init () |
void | dac_clear () |
void | dac_submit (int d) |
void | dac_enable (int d) |
uint8_t | m68k_ROM_read (uint32_t a) |
uint8_t | m68k_IO_read (uint32_t a) |
uint8_t | m68k_VDP_read (uint32_t a) |
void | m68k_ROM_write (uint32_t, uint8_t) |
void | m68k_IO_write (uint32_t, uint8_t) |
Private Attributes | |
unsigned int | ok: 1 |
unsigned int | ok_ym2612: 1 |
unsigned int | ok_sn76496: 1 |
unsigned int | romlen |
unsigned char * | mem |
unsigned char * | rom |
unsigned char * | ram |
unsigned char * | z80ram |
unsigned char * | saveram |
unsigned | save_start |
unsigned | save_len |
int | save_prot |
int | save_active |
uint32_t | z80_bank68k |
unsigned int | z80_st_busreq: 1 |
unsigned int | z80_st_reset: 1 |
unsigned int | z80_st_running: 1 |
unsigned int | z80_st_irq: 1 |
unsigned int | m68k_st_running: 1 |
int | z80_irq_vector |
struct { | |
int m68k | |
int m68k_max | |
int z80 | |
int z80_max | |
} | odo |
int | ras |
int | aoo3_toggle |
int | aoo5_toggle |
int | aoo3_six |
int | aoo5_six |
int | aoo3_six_timeout |
int | aoo5_six_timeout |
uint8_t | hc_table [512][2] |
uint8_t | fm_sel [2] |
uint8_t | fm_tover |
int | fm_ticker [4] |
signed short | fm_reg [2][0x100] |
int | dac_data [0x138] |
int | dac_enabled |
int | dac_last |
Static Private Attributes | |
static bool | lock = false |
List of commands.
enum md::cpu_emu |
enum md::z80_core |
md::md | ( | bool | pal, |
char | region | ||
) |
MD constructor.
pal | True if we are running the MD in PAL mode. |
region | Region to emulate ('J', 'U', or 'E'). |
md::~md | ( | ) |
|
private |
|
private |
void md::cycle_cpu | ( | ) |
Cycle between M68K CPU implementations.
void md::cycle_z80 | ( | ) |
Cycle through Z80 CPU implementations.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
char & md::debug_cmd_break | ( | int | n_args, |
char ** | args | ||
) |
Breakpoint (break) command handler.
n_args | Number of arguments. | |
[in] | args | List of arguments. |
int md::debug_cmd_cont | ( | int | n_args, |
char ** | args | ||
) |
Continue (cont) command handler.
This command drops out of debug mode.
n_args | Number of arguments (ignored). |
args | Arguments (ignored). |
int md::debug_cmd_cpu | ( | int | n_args, |
char ** | args | ||
) |
Core/CPU selection (cpu) command.
Switch to the core/CPU given in args[0].
n_args | Number of arguments (should always be 1). |
args | List of arguments. |
int md::debug_cmd_dis | ( | int | n_args, |
char ** | args | ||
) |
Disassemble (dis) command handler.
n_args | Number of arguments. | |
[in] | args | Arguments list. |
int md::debug_cmd_help | ( | int | n_args, |
char ** | args | ||
) |
Help (help) command handler.
n_args | Number of arguments (ignored). |
args | List of arguments (ignored). |
int md::debug_cmd_mem | ( | int | n_args, |
char ** | args | ||
) |
Memory dump (mem) command handler.
n_args | Number of arguments. |
args | Arguments, see above. |
int md::debug_cmd_minus_break | ( | int | n_args, |
char ** | args | ||
) |
Breakpoint removal (-break) command handler.
If args[0] starts with a #, remove a breakpoint by ID. Otherwise, remove it by address.
n_args | Number of arguments (always 1). |
args | List of arguments. |
int md::debug_cmd_minus_watch | ( | int | n_args, |
char ** | args | ||
) |
Watchpoint removal (-watch) command handler.
If args[0] starts with a #, remove a watchpoint by ID. Otherwise, remove it by address.
n_args | Number of arguments (always 1). | |
[in] | args | List of arguments. |
int md::debug_cmd_quit | ( | int | n_args, |
char ** | args | ||
) |
Quit (quit) command handler.
This command makes DGen/SDL quit.
n_args | Number of arguments (ignored). |
args | List of arguments (ignored). |
int md::debug_cmd_reg | ( | int | n_args, |
char ** | args | ||
) |
Dump registers (reg) command handler.
This command pretty prints registers for the current context.
n_args | Number of arguments (ignored). | |
[in] | args | List of arguments (ignored). |
int md::debug_cmd_setb | ( | int | n_args, |
char ** | args | ||
) |
Set byte (setb) command handler, see debug_cmd_setbwlr().
int md::debug_cmd_setbwlr | ( | int | n_args, |
char ** | args, | ||
unsigned int | type | ||
) |
Memory/registers write (setb/setw/setl/setr) commands handler.
n_args | Number of arguments (ignored, always 2). |
args | Arguments, see above. |
type | Data type to write, see above. |
int md::debug_cmd_setl | ( | int | n_args, |
char ** | args | ||
) |
Set long word (setl) command handler, see debug_cmd_setbwlr().
int md::debug_cmd_setr | ( | int | n_args, |
char ** | args | ||
) |
Set register (setr) command handler, see debug_cmd_setbwlr().
int md::debug_cmd_setw | ( | int | n_args, |
char ** | args | ||
) |
Set word (setw) command handler, see debug_cmd_setbwlr().
int md::debug_cmd_step | ( | int | n_args, |
char ** | args | ||
) |
Step (step) command handler for the current core.
n_args | Number of arguments. |
args | List of arguments. |
int md::debug_cmd_trace | ( | int | n_args, |
char ** | args | ||
) |
Trace toggle (trace) command handler.
n_args | Number of arguments. |
args | Arguments. |
int md::debug_cmd_watch | ( | int | n_args, |
char ** | args | ||
) |
Watchpoints (watch) command handler.
n_args | Number of arguments. |
args | Arguments, see above. |
int md::debug_despatch_cmd | ( | int | n_toks, |
char ** | toks | ||
) |
Dispatch a command to the relevant handler method.
n_toks | Number of tokens (arguments). |
toks | List of tokens (arguments). |
void md::debug_dump_mem | ( | uint32_t | addr, |
uint32_t | len | ||
) |
Pretty print a block of memory as a hex dump.
addr | Start address. |
len | Length (in bytes) to dump. |
void md::debug_enter | ( | void | ) |
Enter debugger and show command prompt.
void md::debug_leave | ( | void | ) |
Leave debugger.
void md::debug_print_disassemble | ( | uint32_t | from, |
int | len | ||
) |
Pretty print a M68K disassembly.
from | Address to start disassembling from. |
len | Number of instructions to disassemble. |
void md::debug_set_wp_m68k | ( | uint32_t | start_addr, |
uint32_t | end_addr | ||
) |
Add a M68K watchpoint to a range of addresses.
start_addr | Start address of watchpoint range. |
end_addr | End address of watchpoint range. |
void md::debug_show_m68k_regs | ( | void | ) |
Pretty print the M68K registers using m68k_state from class md.
void md::debug_show_z80_regs | ( | void | ) |
Pretty print Z80 registers using z80_state from class md.
void md::debug_update_fired_wps | ( | void | ) |
Resynchronise all watchpoints based on actual data.
void md::debug_update_wp_cache | ( | struct dgen_wp * | w | ) |
Update the data pointer of a single watchpoint.
w | Watchpoint to update. |
void md::deinit_joysticks | ( | ) |
int md::export_gst | ( | FILE * | hand | ) |
void md::fix_rom_checksum | ( | ) |
Replace the in-memory ROM checksum with a calculated checksum.
|
private |
|
private |
|
private |
int md::get_save_ram | ( | FILE * | from | ) |
Get saveram from FILE*.
from | File to read from. |
|
inline |
int md::import_gst | ( | FILE * | hand | ) |
void md::init_joysticks | ( | ) |
void md::init_pal | ( | ) |
Switch to PAL or NTSC.
This method's name is a bit misleading. This switches to PAL or not depending on "md::pal".
bool md::init_sound | ( | ) |
Initialise sound.
int md::load | ( | const char * | name | ) |
Load a ROM.
[in] | name | File name of cart to load. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
void md::m68k_state_dump | ( | ) |
void md::m68k_state_restore | ( | ) |
|
private |
|
private |
|
private |
|
inlineprivate |
|
private |
void md::md_set | ( | bool | set | ) |
uint8_t md::misc_readbyte | ( | uint32_t | a | ) |
Read a byte from the m68Ks ram.
a | Address to read. |
uint16_t md::misc_readword | ( | uint32_t | a | ) |
Read a word from the m68k memory.
There are quirks with word wide reads see section 1.2 of http://cgfm2.emuviews.com/txt/gen-hw.txt
a | Address to read |
void md::misc_writebyte | ( | uint32_t | a, |
uint8_t | d | ||
) |
write a byte to the m68Ks ram.
a | Address to write. |
d | Date (byte) two write. |
void md::misc_writeword | ( | uint32_t | a, |
uint16_t | d | ||
) |
Write a word to m68k memory.
a | Address to write to. |
d | Data to write. |
|
private |
int md::myfm_write | ( | int | a, |
int | v, | ||
int | md | ||
) |
|
private |
|
inline |
void md::pad_update | ( | ) |
int md::patch | ( | const char * | list, |
unsigned int * | errors, | ||
unsigned int * | applied, | ||
unsigned int * | reverted | ||
) |
This takes a comma or whitespace-separated list of Game Genie and/or hex codes to patch the ROM with.
[in] | list | List of codes separated by '\t', '\n', or ','. |
[out] | errors | Number of codes that failed to apply. |
[out] | applied | Number of codes that applied correctly. |
[out] | reverted | Number of codes that were reverted. |
int md::plug_in | ( | unsigned char * | cart, |
int | len | ||
) |
Plug a cart into the MD.
[in] | cart | Cart's memory as a byte array. |
len | Length of the cart. |
int md::put_save_ram | ( | FILE * | into | ) |
Write a saveram to FILE*.
into | File to write to. |
uint8_t md::region_guess | ( | ) |
Region to emulate according to dgen_region_order and ROM header.
|
inlinestatic |
int md::reset | ( | ) |
Resets everything (Z80, M68K, VDP, etc).
int md::unplug | ( | ) |
Unplug a cart from the system.
unsigned int md::vblank | ( | ) |
void md::z80_init | ( | ) |
Initialise the Z80.
|
private |
|
private |
|
private |
uint8_t md::z80_port_read | ( | uint16_t | a | ) |
Port read to Z80.
This is a NOP
a | address (ignored) |
void md::z80_port_write | ( | uint16_t | a, |
uint8_t | d | ||
) |
Port write to z80 This is a Nop.
a | address (ignored) |
d | data (ignored) |
uint8_t md::z80_read | ( | uint16_t | a | ) |
Read one byte from the memory space.
a | Address to read |
void md::z80_reset | ( | ) |
Reset the Z80.
|
private |
void md::z80_state_dump | ( | ) |
void md::z80_state_restore | ( | ) |
|
private |
void md::z80_write | ( | uint16_t | a, |
uint8_t | d | ||
) |
Write one byte to the memory.
a | Address to read |
d | Data (byte) to write. |
int md::z80dump | ( | ) |
Dump Z80 ram to a file named "dgz80ram".
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
char* md::break |
struct md::_carthead_ md::cart_head |
unsigned int md::clk0 |
unsigned int md::clk1 |
unsigned char md::coo4 |
unsigned char md::coo5 |
enum md::cpu_emu md::cpu_emu |
|
private |
|
private |
|
private |
|
static |
unsigned long md::debug_m68k_instr_count |
bool md::debug_trap |
|
private |
|
private |
|
private |
|
private |
|
private |
unsigned int md::lines |
|
staticprivate |
int md::m68k |
int md::m68k_max |
|
private |
m68k_state_t md::m68k_state |
unsigned int md::mclk |
|
private |
|
static |
This is the default ROM, used when nothing is loaded.
|
static |
struct { ... } md::odo |
|
private |
|
private |
|
private |
int md::pad[2] |
uint8_t md::pad_com[2] |
unsigned int md::pal |
struct md::patch_elem * md::patch_elem |
bool md::plugged |
|
private |
|
private |
char md::region |
|
private |
|
private |
char md::romname[256] |
|
private |
|
private |
|
private |
|
private |
|
private |
md_vdp md::vdp |
unsigned int md::vhz |
int md::z80 |
|
private |
enum md::z80_core md::z80_core |
|
private |
int md::z80_max |
|
private |
|
private |
|
private |
|
private |
z80_state_t md::z80_state |
|
private |