comparison debug.c @ 1983:a7b753e260a2 mame_interp

Merge from default
author Michael Pavone <pavone@retrodev.com>
date Sat, 09 May 2020 23:39:44 -0700
parents 374a5ae694e8 3a46ff899fa6
children b119e0de9a70
comparison
equal deleted inserted replaced
1937:cafde1255ad3 1983:a7b753e260a2
93 return; 93 return;
94 } 94 }
95 } 95 }
96 } 96 }
97 97
98 static uint8_t m68k_read_byte(uint32_t address, m68k_context *context)
99 {
100 //TODO: share this implementation with GDB debugger
101 return read_byte(address, (void **)context->mem_pointers, &context->options->gen, context);
102 }
103
98 uint16_t m68k_read_word(uint32_t address, m68k_context *context) 104 uint16_t m68k_read_word(uint32_t address, m68k_context *context)
99 { 105 {
100 return read_word(address, (void **)context->mem_pointers, &context->options->gen, context); 106 return read_word(address, (void **)context->mem_pointers, &context->options->gen, context);
101 } 107 }
102 108
156 } else if ((param[0] == '0' && param[1] == 'x') || param[0] == '$') { 162 } else if ((param[0] == '0' && param[1] == 'x') || param[0] == '$') {
157 char *after; 163 char *after;
158 uint32_t p_addr = strtol(param+(param[0] == '0' ? 2 : 1), &after, 16); 164 uint32_t p_addr = strtol(param+(param[0] == '0' ? 2 : 1), &after, 16);
159 if (after[0] == '.' && after[1] == 'l') { 165 if (after[0] == '.' && after[1] == 'l') {
160 value = m68k_read_long(p_addr, context); 166 value = m68k_read_long(p_addr, context);
167 } else if (after[0] == '.' && after[1] == 'b') {
168 value = m68k_read_byte(p_addr, context);
161 } else { 169 } else {
162 value = m68k_read_word(p_addr, context); 170 value = m68k_read_word(p_addr, context);
163 } 171 }
164 } else if(param[0] == '(' && (param[1] == 'a' || param[1] == 'd') && param[2] >= '0' && param[2] <= '7' && param[3] == ')') { 172 } else if(param[0] == '(' && (param[1] == 'a' || param[1] == 'd') && param[2] >= '0' && param[2] <= '7' && param[3] == ')') {
165 uint8_t reg = param[2] - '0'; 173 uint8_t reg = param[2] - '0';
166 uint32_t p_addr = param[1] == 'a' ? context->aregs[reg] : context->dregs[reg]; 174 uint32_t p_addr = param[1] == 'a' ? context->aregs[reg] : context->dregs[reg];
167 if (param[4] == '.' && param[5] == 'l') { 175 if (param[4] == '.' && param[5] == 'l') {
168 value = m68k_read_long(p_addr, context); 176 value = m68k_read_long(p_addr, context);
177 } else if (param[4] == '.' && param[5] == 'b') {
178 value = m68k_read_byte(p_addr, context);
169 } else { 179 } else {
170 value = m68k_read_word(p_addr, context); 180 value = m68k_read_word(p_addr, context);
171 } 181 }
172 } else { 182 } else {
173 fprintf(stderr, "Unrecognized parameter to p: %s\n", param); 183 fprintf(stderr, "Unrecognized parameter to p: %s\n", param);