forked from mrzzzrm/mooboy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mrzzzrm/master
Updates
- Loading branch information
Showing
27 changed files
with
1,742 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,3 +105,4 @@ void rtc_advance_seconds(time_t seconds) { | |
rtc_tick(0); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include "break.h" | ||
|
||
#include <stdio.h> | ||
#include <assert.h> | ||
|
||
typedef struct { | ||
breakpoint_t breakpoint; | ||
int enabled; | ||
} breakpoint_handle_t; | ||
|
||
#define BREAKPOINT_BUFFER_SIZE 256 | ||
|
||
static breakpoint_handle_t breakpoints[BREAKPOINT_BUFFER_SIZE]; | ||
static int breakpoint_cursor = 0; | ||
static int now = 0; | ||
|
||
int break_enable(breakpoint_t breakpoint) { | ||
assert(breakpoint_cursor < BREAKPOINT_BUFFER_SIZE); | ||
|
||
breakpoint_handle_t handle; | ||
handle.breakpoint = breakpoint; | ||
handle.enabled = 1; | ||
|
||
breakpoints[breakpoint_cursor] = handle; | ||
breakpoints[breakpoint_cursor].enabled = 1; | ||
breakpoint_cursor++; | ||
|
||
switch(breakpoints[breakpoint_cursor-1].breakpoint.type) { | ||
case BREAKPOINT_ADDRESS: printf("Breakpoint %i set on address %.4X\n", breakpoint_cursor - 1, breakpoint.address.pc); break; | ||
case BREAKPOINT_EVENT: printf("Breakpoint %i set on event\n", breakpoint_cursor - 1); break; | ||
} | ||
|
||
return breakpoint_cursor - 1; | ||
} | ||
|
||
void break_disable(int id) { | ||
assert(id >= 0 && id < BREAKPOINT_BUFFER_SIZE); | ||
breakpoints[id].enabled = 0; | ||
} | ||
|
||
void break_handle_event(event_t event) { | ||
int b; | ||
for (b = 0; b < breakpoint_cursor; b++) { | ||
if (breakpoints[b].breakpoint.type == BREAKPOINT_EVENT) { | ||
if (event.type == EVENT_JOY_NOTICED) { | ||
now = 1; | ||
} | ||
} | ||
} | ||
} | ||
|
||
int break_now() { | ||
int tmp = now; | ||
if (now) { | ||
now = 0; | ||
} | ||
return tmp; | ||
} | ||
|
||
void debug_break() { printf("BREAKING\n"); | ||
now = 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef DEBUG_BREAK_H | ||
#define DEBUG_BREAK_H | ||
|
||
#include "core/defines.h" | ||
|
||
#include "event.h" | ||
|
||
typedef enum { | ||
BREAKPOINT_ADDRESS, | ||
BREAKPOINT_EVENT | ||
} BREAKPOINT_TYPE; | ||
|
||
typedef struct { | ||
BREAKPOINT_TYPE type; | ||
|
||
union { | ||
// BREAK_ADDRESS | ||
struct { | ||
u16 pc; | ||
} address; | ||
|
||
// BREAK_EVENT | ||
struct { | ||
EVENT_TYPE type; | ||
} event; | ||
}; | ||
} breakpoint_t; | ||
|
||
int break_enable(breakpoint_t breakpoint); | ||
void break_disable(int id); | ||
void break_handle_event(event_t event); | ||
int break_now(); | ||
void debug_break(); | ||
|
||
#endif // DEBUG_BREAK_H |
Oops, something went wrong.