comparison gdb_remote.c @ 2500:d44fe974fb85

Get blastem compiling with new 68K core
author Michael Pavone <pavone@retrodev.com>
date Tue, 30 Apr 2024 22:32:08 -0700
parents d74d3998482c
children 7e86ec94c899
comparison
equal deleted inserted replaced
2499:d74d3998482c 2500:d44fe974fb85
105 } 105 }
106 106
107 uint32_t calc_status(m68k_context * context) 107 uint32_t calc_status(m68k_context * context)
108 { 108 {
109 uint32_t status = context->status << 3; 109 uint32_t status = context->status << 3;
110 #ifdef NEW_CORE
111 //TODO: implement me
112 #else
110 for (int i = 0; i < 5; i++) 113 for (int i = 0; i < 5; i++)
111 { 114 {
112 status <<= 1; 115 status <<= 1;
113 status |= context->flags[i]; 116 status |= context->flags[i];
114 } 117 }
118 #endif
115 return status; 119 return status;
116 } 120 }
117 121
118 void update_status(m68k_context * context, uint16_t value) 122 void update_status(m68k_context * context, uint16_t value)
119 { 123 {
120 context->status = value >> 8; 124 context->status = value >> 8;
125 #ifdef NEW_CORE
126 //TODO: implement me
127 #else
121 for (int i = 4; i >= 0; i--) 128 for (int i = 4; i >= 0; i--)
122 { 129 {
123 context->flags[i] = value & 1; 130 context->flags[i] = value & 1;
124 value >>= 1; 131 value >>= 1;
125 } 132 }
133 #endif
126 } 134 }
127 135
128 static uint8_t m68k_read_byte(m68k_context *context, uint32_t address) 136 static uint8_t m68k_read_byte(m68k_context *context, uint32_t address)
129 { 137 {
130 //TODO: share this implementation with builtin debugger 138 //TODO: share this implementation with builtin debugger
182 case 's': { 190 case 's': {
183 if (*(command+1) != 0) { 191 if (*(command+1) != 0) {
184 //TODO: implement resuming at an arbitrary address 192 //TODO: implement resuming at an arbitrary address
185 goto not_impl; 193 goto not_impl;
186 } 194 }
195 #ifndef NEW_CORE
187 m68kinst inst; 196 m68kinst inst;
188 genesis_context *gen = context->system; 197 genesis_context *gen = context->system;
189 uint32_t after = m68k_decode(m68k_instruction_fetch, context, &inst, pc & 0xFFFFFF); 198 uint32_t after = m68k_decode(m68k_instruction_fetch, context, &inst, pc & 0xFFFFFF);
190 199
191 if (inst.op == M68K_RTS) { 200 if (inst.op == M68K_RTS) {
204 } else { 213 } else {
205 after = m68k_branch_target(&inst, context->dregs, context->aregs) & 0xFFFFFF; 214 after = m68k_branch_target(&inst, context->dregs, context->aregs) & 0xFFFFFF;
206 } 215 }
207 } 216 }
208 insert_breakpoint(context, after, gdb_debug_enter); 217 insert_breakpoint(context, after, gdb_debug_enter);
218 #endif
209 219
210 cont = 1; 220 cont = 1;
211 expect_break_response = 1; 221 expect_break_response = 1;
212 break; 222 break;
213 } 223 }
439 cont = 1; 449 cont = 1;
440 expect_break_response = 1; 450 expect_break_response = 1;
441 break; 451 break;
442 case 's': 452 case 's':
443 case 'S': { 453 case 'S': {
454 #ifndef NEW_CORE
444 m68kinst inst; 455 m68kinst inst;
445 genesis_context *gen = context->system; 456 genesis_context *gen = context->system;
446 uint32_t after = m68k_decode(m68k_instruction_fetch, context, &inst, pc & 0xFFFFFF); 457 uint32_t after = m68k_decode(m68k_instruction_fetch, context, &inst, pc & 0xFFFFFF);
447 458
448 if (inst.op == M68K_RTS) { 459 if (inst.op == M68K_RTS) {
461 } else { 472 } else {
462 after = m68k_branch_target(&inst, context->dregs, context->aregs) & 0xFFFFFF; 473 after = m68k_branch_target(&inst, context->dregs, context->aregs) & 0xFFFFFF;
463 } 474 }
464 } 475 }
465 insert_breakpoint(context, after, gdb_debug_enter); 476 insert_breakpoint(context, after, gdb_debug_enter);
477 #endif
466 478
467 cont = 1; 479 cont = 1;
468 expect_break_response = 1; 480 expect_break_response = 1;
469 break; 481 break;
470 } 482 }