Skip to content

Commit

Permalink
change address for cemu debug
Browse files Browse the repository at this point in the history
this is so it doesn't interfere with older versions
  • Loading branch information
mateoconlechuga committed Jul 19, 2020
1 parent 450948b commit 2fe4ff7
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/ce/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* @file
* @author Matt "MateoConLechuga" Waltz
* @brief Contains debugging features for use with a compatible debugger
*
* These debug functions are provided to help in the process of debugging
* an application. To enable them, use 'make debug' when compiling a program.
* More information can be found here: https://github.com/CE-Programming/toolchain/wiki/Debugging
*/

#include <stdio.h>
Expand Down Expand Up @@ -41,15 +45,15 @@ extern "C" {
*/
#define dbg_ClearConsole() \
do { \
*(volatile unsigned char*)0xFD0000 = 1; \
*(volatile unsigned char*)0xFFFFE0 = 10; \
} while (0)

/**
* Opens the emulator's debugger.
*/
#define dbg_Debugger() \
do { \
*(volatile unsigned char*)0xFFFFFF = (unsigned char)~0; \
*(volatile unsigned char*)0xFFFFE0 = (unsigned char)~0; \
} while (0)

/**
Expand All @@ -59,8 +63,8 @@ do { \
*/
#define dbg_SetBreakpoint(address) \
do { \
*(volatile unsigned int*)0xFFFFF0 = (unsigned int)(address); \
*(volatile unsigned char*)0xFFFFFF = 1; \
*(volatile unsigned int*)0xFFFFE4 = (unsigned int)(address); \
*(volatile unsigned char*)0xFFFFE0 = 1; \
} while (0)

/**
Expand All @@ -70,8 +74,8 @@ do { \
*/
#define dbg_RemoveBreakpoint(address) \
do { \
*(volatile unsigned int*)0xFFFFF0 = (address); \
*(volatile unsigned char*)0xFFFFFF = 2; \
*(volatile unsigned int*)0xFFFFE4 = (address); \
*(volatile unsigned char*)0xFFFFE0 = 2; \
} while (0)

/**
Expand All @@ -84,10 +88,10 @@ do { \
*/
#define dbg_SetWatchpoint(address_low, length, flags) \
do { \
*(volatile unsigned int*)0xFFFFF0 = (unsigned int)(address_low); \
*(volatile unsigned int*)0xFFFFF4 = ((unsigned int)(address_low) + (length)); \
*(volatile unsigned char*)0xFFFFF8 = (unsigned char)(flags); \
*(volatile unsigned char*)0xFFFFFF = 3; \
*(volatile unsigned int*)0xFFFFE4 = (unsigned int)(address_low); \
*(volatile unsigned int*)0xFFFFE8 = ((unsigned int)(address_low) + (length)); \
*(volatile unsigned char*)0xFFFFEC = (unsigned char)(flags); \
*(volatile unsigned char*)0xFFFFE0 = 3; \
} while (0)

/**
Expand All @@ -97,24 +101,24 @@ do { \
*/
#define dbg_RemoveWatchpoint(address) \
do { \
*(volatile unsigned int*)0xFFFFF0 = (unsigned int)(address); \
*(volatile unsigned char*)0xFFFFFF = 4; \
*(volatile unsigned int*)0xFFFFE4 = (unsigned int)(address); \
*(volatile unsigned char*)0xFFFFE0 = 4; \
} while (0)

/**
* Removes all emulated breakpoints.
*/
#define dbg_RemoveAllBreakpoints() \
do { \
*(volatile unsigned char*)0xFFFFFF = 6; \
*(volatile unsigned char*)0xFFFFE0 = 5; \
} while (0)

/**
* Removes all emulated watchpoints.
*/
#define dbg_RemoveAllWatchpoints() \
do { \
*(volatile unsigned char*)0xFFFFFF = 5; \
*(volatile unsigned char*)0xFFFFE0 = 6; \
} while (0)

#else
Expand Down

0 comments on commit 2fe4ff7

Please sign in to comment.