enum command_result
command_quit (int argc, char **argv)
{
+ ccdbg_reset(s51_dbg);
exit(0);
return command_error;
}
dump_bytes(uint8_t *memory, int length, uint16_t start, char *format)
{
int group, i;
-
+
for (group = 0; group < length; group += 8) {
s51_printf(format, start + group);
for (i = group; i < length && i < group + 8; i++)
uint8_t memory[65536];
uint8_t status;
int length;
-
+
if (argc != 3)
return command_error;
if (parse_uint16(argv[1], &start) != command_success)
uint8_t memory[0x100];
uint8_t status;
int length;
-
+
if (argc != 3)
return command_error;
if (parse_uint8(argv[1], &start) != command_success)
uint8_t memory[65536];
uint8_t status;
int length;
-
+
if (argc != 3)
return command_error;
if (parse_uint16(argv[1], &start) != command_success)
for (i = 0; i < len; i++)
if (parse_uint8(argv[i+3], &data[i]) != command_success)
return command_error;
-
+
if (strcmp(argv[1], "xram") == 0) {
ccdbg_write_memory(s51_dbg, address, data, len);
} else if (strcmp(argv[1], "iram") == 0) {
struct hex_file *hex;
struct hex_image *image;
FILE *file;
-
+
if (argc != 2)
return command_error;
file = fopen (argv[1], "r");
disable_breakpoint(int b)
{
uint8_t status;
-
+
status = ccdbg_set_hw_brkpnt(s51_dbg, b, 0, breakpoints[b].address);
if (status != 0x00 && status != 0xff)
s51_printf("disable_breakpoint status 0x%02x\n", status);
enable_breakpoint(int b)
{
uint8_t status;
-
+
status = ccdbg_set_hw_brkpnt(s51_dbg, b, 1, breakpoints[b].address);
if (status != 0xff)
s51_printf("enable_breakpoint status 0x%02x\n", status);
uint16_t pc;
uint8_t status;
int b;
-
+
if (argv[1]) {
result = parse_uint16(argv[1], &start);
if (result != command_success)
enum command_result
command_load (int argc, char **argv)
{
- return command_error;
+ char *filename = argv[1];
+ FILE *file;
+ struct hex_file *hex;
+ struct hex_image *image;
+
+ if (!filename)
+ return command_error;
+ file = fopen(filename, "r");
+ if (!file) {
+ perror(filename);
+ return command_error;
+ }
+ hex = ccdbg_hex_file_read(file, filename);
+ fclose(file);
+ if (!hex) {
+ return command_error;
+ }
+ image = ccdbg_hex_image_create(hex);
+ ccdbg_hex_file_free(hex);
+ if (!image) {
+ fprintf(stderr, "image create failed\n");
+ return command_error;
+ }
+ if (image->address >= 0xf000) {
+ printf("Loading %d bytes to RAM at 0x%04x\n",
+ image->length, image->address);
+ ccdbg_write_hex_image(s51_dbg, image, 0);
+ } else {
+ fprintf(stderr, "Can only load to RAM\n");
+ }
+ ccdbg_hex_image_free(image);
+ return command_success;
}
enum command_result
}
return command_success;
}
-
+
}
static enum command_result
"List current breakpoints\n" },
{ "help", "?", info_help, "help",
"Print this list\n" },
-
+
{ NULL, NULL, NULL, NULL, NULL },
};
command_info(int argc, char **argv)
{
struct command_function *func;
-
+
if (argc < 2)
return command_error;
func = command_string_to_function(infos, argv[1]);
return command_success;
}
if (s51_interrupted || s51_check_input()) {
-
+
ccdbg_halt(s51_dbg);
status = ccdbg_read_status(s51_dbg);
cc_stopped(status);
}
}
}
-