Mercurial > repos > blastem
comparison debug.c @ 2413:64cf80e683aa
Initial support for Colecovision emulation
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 04 Jan 2024 22:56:35 -0800 |
parents | c97609fe8315 |
children | 1978bd770023 |
comparison
equal
deleted
inserted
replaced
2412:ed7b4d869989 | 2413:64cf80e683aa |
---|---|
15 #include "util.h" | 15 #include "util.h" |
16 #include "terminal.h" | 16 #include "terminal.h" |
17 #include "z80inst.h" | 17 #include "z80inst.h" |
18 #ifndef NO_Z80 | 18 #ifndef NO_Z80 |
19 #include "sms.h" | 19 #include "sms.h" |
20 #include "coleco.h" | |
20 #endif | 21 #endif |
21 | 22 |
22 #ifdef NEW_CORE | 23 #ifdef NEW_CORE |
23 #define Z80_OPTS opts | 24 #define Z80_OPTS opts |
24 #else | 25 #else |
1813 } | 1814 } |
1814 | 1815 |
1815 static debug_val debug_vram_get(debug_array *array, uint32_t index) | 1816 static debug_val debug_vram_get(debug_array *array, uint32_t index) |
1816 { | 1817 { |
1817 vdp_context *vdp = array->base; | 1818 vdp_context *vdp = array->base; |
1819 if (!(vdp->regs[REG_MODE_2] & BIT_MODE_5)) { | |
1820 index = mode4_address_map[index & 0x3FFF] ^ 1; | |
1821 } | |
1818 return debug_int(vdp->vdpmem[index]); | 1822 return debug_int(vdp->vdpmem[index]); |
1819 } | 1823 } |
1820 | 1824 |
1821 static void debug_vram_set(debug_array *array, uint32_t index, debug_val val) | 1825 static void debug_vram_set(debug_array *array, uint32_t index, debug_val val) |
1822 { | 1826 { |
1824 if (!debug_cast_int(val, &ival)) { | 1828 if (!debug_cast_int(val, &ival)) { |
1825 fprintf(stderr, "vram can only be set to integers\n"); | 1829 fprintf(stderr, "vram can only be set to integers\n"); |
1826 return; | 1830 return; |
1827 } | 1831 } |
1828 vdp_context *vdp = array->base; | 1832 vdp_context *vdp = array->base; |
1833 if (!(vdp->regs[REG_MODE_2] & BIT_MODE_5)) { | |
1834 index = mode4_address_map[index & 0x3FFF] ^ 1; | |
1835 } | |
1829 vdp->vdpmem[index] = ival; | 1836 vdp->vdpmem[index] = ival; |
1830 } | 1837 } |
1831 | 1838 |
1832 static debug_val debug_vsram_get(debug_array *array, uint32_t index) | 1839 static debug_val debug_vsram_get(debug_array *array, uint32_t index) |
1833 { | 1840 { |
5176 add_commands(root, common_commands, NUM_COMMON); | 5183 add_commands(root, common_commands, NUM_COMMON); |
5177 add_commands(root, z80_commands, NUM_Z80); | 5184 add_commands(root, z80_commands, NUM_Z80); |
5178 z80_names(root); | 5185 z80_names(root); |
5179 genesis_context *gen; | 5186 genesis_context *gen; |
5180 sms_context *sms; | 5187 sms_context *sms; |
5188 coleco_context *coleco; | |
5181 debug_var *var; | 5189 debug_var *var; |
5182 //TODO: populate names | 5190 //TODO: populate names |
5183 switch (current_system->type) | 5191 switch (current_system->type) |
5184 { | 5192 { |
5185 case SYSTEM_GENESIS: | 5193 case SYSTEM_GENESIS: |
5197 var = calloc(1, sizeof(debug_var)); | 5205 var = calloc(1, sizeof(debug_var)); |
5198 var->get = debug_frame_get; | 5206 var->get = debug_frame_get; |
5199 var->ptr = sms->vdp; | 5207 var->ptr = sms->vdp; |
5200 root->variables = tern_insert_ptr(root->variables, "frame", var); | 5208 root->variables = tern_insert_ptr(root->variables, "frame", var); |
5201 break; | 5209 break; |
5210 case SYSTEM_COLECOVISION: | |
5211 coleco = context->system; | |
5212 root->other_roots = tern_insert_ptr(root->other_roots, "vdp", find_vdp_root(coleco->vdp)); | |
5213 root->other_roots = tern_insert_ptr(root->other_roots, "psg", find_psg_root(coleco->psg)); | |
5214 break; | |
5202 //default: | 5215 //default: |
5203 //root->resolve = resolve_z80; | 5216 //root->resolve = resolve_z80; |
5204 } | 5217 } |
5205 root->read_mem = read_z80; | 5218 root->read_mem = read_z80; |
5206 root->write_mem = write_z80; | 5219 root->write_mem = write_z80; |