Simple debugger & disassembler for emu6502
Definition in file debugdll.c.#include "../dllkit/dllkit.h"
#include "../usrmsgs.h"
#include "resource.h"
#include "instructions.h"
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | Regs |
Registers. More... | |
Defines | |
#define | ADR(X, Y) (((Y) << 8) + (X)) |
#define | FN 0x80 |
#define | FV 0x40 |
#define | FB 0x10 |
#define | FD 0x08 |
#define | FI 0x04 |
#define | FZ 0x02 |
#define | FC 0x01 |
#define | GETFLAG(FL) ((regs->P & (FL)) == 0) ? 0 : 1 |
Functions | |
void | StartDebug () |
Starts debug. | |
void | DisAsm (int lower, int upper, HANDLE fil, int act) |
Disassembler. | |
void | DumpMemHex (HANDLE fil, UINT adr1, UINT adr2) |
Printer of memory in hex format. | |
void | DumpMem (HANDLE fil, UINT adr1, UINT adr2) |
Printer of memory in raw format. | |
void | printhelp () |
Displays usage instructions. | |
HANDLE | ofile () |
Shows save dialog. | |
HANDLE | orfile () |
Shows open dialog. | |
void | SetReg (Regs *regs, char *buf) |
Helper procedure for StartDebug. | |
void | printregs (Regs *regs) |
Prints actual state of registers onto console. | |
void | printfil (HANDLE fil, char *str) |
Prints message onto screen or into specified stream. | |
void | rinterval (UINT *adr1, UINT *adr2) |
Reads an address interval and controls if it is correct. | |
UINT | rhex (char *msg) |
Reads an hexadecimal integer and controls if it is correct. | |
void | mklpstr (char *str) |
Converts strings read from console to null terminated strings. | |
void | print (char *str) |
Prints given message onto the console. | |
void | rline (char *str) |
Reads one command from console. | |
void | printact (Regs *regs) |
Prints registers and dissassembled position in memory. | |
BOOL APIENTRY | DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) |
Entry point of this dll. | |
DLLEXPORT void __cdecl | InitDll (INITDLLSTRUCT *ids, INITDLLINFO *idi) |
Inits dll data structures. | |
DLLEXPORT void __cdecl | OnMessage (MESSAGEDLLSTRUCT *mds) |
Recieves registered messages from emu6502 application. | |
DLLEXPORT void __cdecl | IOFunc (UINT adr, unsigned char *data, iomode mode) |
IO function mapped into some adress in memory. | |
Variables | |
HANDLE | hThisModule |
MSGLIST | Msgs |
INITDLLSTRUCT | info |
HMENU | hMenu |
Handle to the main menu bar. | |
HMENU | hDebugMenu |
Handle to local debug menu which is appended to hMenu. |
|
BRK flag Definition at line 19 of file debugdll.c. |
|
Caryy flag Definition at line 23 of file debugdll.c. |
|
Decimal flag Definition at line 20 of file debugdll.c. |
|
Interrupt flag Definition at line 21 of file debugdll.c. |
|
Negative flag Definition at line 17 of file debugdll.c. |
|
Overflow flag Definition at line 18 of file debugdll.c. |
|
Zero flag Definition at line 22 of file debugdll.c. |
|
Disassembler.
Disassembles given range of memory and writes it into the stream specified
Definition at line 510 of file debugdll.c. |
|
Entry point of this dll.
Definition at line 149 of file debugdll.c. |
|
Printer of memory in raw format.
Prints given range of memory into given stream in raw format
Definition at line 639 of file debugdll.c. |
|
Printer of memory in hex format.
Prints given range of memory into given stream in hexadecimal format
Definition at line 646 of file debugdll.c. |
|
Inits dll data structures.
This function is called after dll is loaded. You have to implement this function. Useful informations are passed in its parameter. Also create, fill with messages to be catched and return MSGLIST structure.
Definition at line 164 of file debugdll.c. |
|
IO function mapped into some adress in memory.
Called directly when accesing adress to which is this function bound. Always write this function.
Definition at line 238 of file debugdll.c. |
|
Converts strings read from console to null terminated strings.
Definition at line 775 of file debugdll.c. |
|
Shows save dialog.
Shows save dialog and opens selected file.
Definition at line 693 of file debugdll.c. |
|
Recieves registered messages from emu6502 application.
This function is called by emu6502 when some message event registered by InitDll occures. Implement this function even when you don't want to catch any messages.
Definition at line 210 of file debugdll.c. |
|
Shows open dialog.
Shows open dialog and opens selected file.
Definition at line 660 of file debugdll.c. |
|
Prints given message onto the console.
Definition at line 793 of file debugdll.c. |
|
Prints registers and dissassembled position in memory.
Definition at line 727 of file debugdll.c. |
|
Prints message onto screen or into specified stream.
If the fil stream is NULL, the message will be printed onto console
Definition at line 782 of file debugdll.c. |
|
Displays usage instructions.
Definition at line 614 of file debugdll.c. |
|
Prints actual state of registers onto console.
Definition at line 738 of file debugdll.c. |
|
Reads an hexadecimal integer and controls if it is correct.
Definition at line 757 of file debugdll.c. |
|
Reads an address interval and controls if it is correct.
Definition at line 749 of file debugdll.c. |
|
Reads one command from console.
Definition at line 799 of file debugdll.c. |
|
Helper procedure for StartDebug.
Parses registers modifying commands.
Definition at line 402 of file debugdll.c. |
|
Starts debug.
Retrieves pointer to registers from the cpu plugin, if not present, shows an error message and stops debugging . Definition at line 243 of file debugdll.c. |
|
Handle to local debug menu which is appended to hMenu.
Definition at line 42 of file debugdll.c. |
|
Handle to the main menu bar.
Definition at line 40 of file debugdll.c. |