revision 16:f383e7640da4
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 16:f383e7640da4 |
parent | 15:5194dd0fdb60 |
child | 17:944f75eea496 |
author | nkeynes |
date | Tue Dec 13 12:17:26 2005 +0000 (16 years ago) |
Cleanup init config => dreamcast_config
![]() | src/aica/aica.c | view | annotate | diff | log | |
![]() | src/dreamcast.c | view | annotate | diff | log | |
![]() | src/pvr2/pvr2.c | view | annotate | diff | log | |
![]() | src/sh4/sh4core.c | view | annotate | diff | log |
1.1 --- a/src/aica/aica.c Mon Dec 12 13:11:11 2005 +00001.2 +++ b/src/aica/aica.c Tue Dec 13 12:17:26 2005 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: aica.c,v 1.2 2005-12-12 13:11:11 nkeynes Exp $1.6 + * $Id: aica.c,v 1.3 2005-12-13 12:17:26 nkeynes Exp $1.7 *1.8 * This is the core sound system (ie the bit which does the actual work)1.9 *1.10 @@ -35,8 +35,6 @@1.11 */1.12 void aica_init( void )1.13 {1.14 - mem_create_ram_region( 0x00800000, 2 MB, MEM_REGION_AUDIO );1.15 - mem_create_ram_region( 0x00703000, 8 KB, MEM_REGION_AUDIO_SCRATCH ); /*???*/1.16 register_io_regions( mmio_list_spu );1.17 MMIO_NOTRACE(AICA0);1.18 MMIO_NOTRACE(AICA1);
2.1 --- a/src/dreamcast.c Mon Dec 12 13:11:11 2005 +00002.2 +++ b/src/dreamcast.c Tue Dec 13 12:17:26 2005 +00002.3 @@ -4,6 +4,7 @@2.4 #include "asic.h"2.5 #include "ide.h"2.6 #include "dreamcast.h"2.7 +#include "maple.h"2.8 #include "modules.h"2.10 /* Central switchboard for the system */2.11 @@ -11,35 +12,56 @@2.12 #define MAX_MODULES 322.13 static int num_modules = 0;2.14 static int dreamcast_state = 0;2.15 -dreamcast_module_t modules[];2.16 +dreamcast_module_t modules[MAX_MODULES];2.18 +/**2.19 + * This function is responsible for defining how all the pieces of the2.20 + * dreamcast actually fit together. Among other things, this lets us2.21 + * (reasonably) easily redefine the structure for eg various versions of the2.22 + * Naomi.2.23 + *2.24 + * Note currently the locations of the various MMIO pages are hard coded in2.25 + * the MMIO definitions - they should probably be moved here.2.26 + */2.27 void dreamcast_configure( )2.28 {2.29 + /* Register the memory framework */2.30 dreamcast_register_module( &mem_module );2.31 +2.32 + /* Setup standard memory map */2.33 + mem_create_ram_region( 0x0C000000, 16 MB, MEM_REGION_MAIN );2.34 + mem_create_ram_region( 0x00800000, 2 MB, MEM_REGION_AUDIO );2.35 + mem_create_ram_region( 0x00703000, 8 KB, MEM_REGION_AUDIO_SCRATCH );2.36 + mem_create_ram_region( 0x05000000, 8 MB, MEM_REGION_VIDEO );2.37 + mem_load_rom( "dcboot.rom", 0x00000000, 0x00200000, 0x89f2b1a1 );2.38 + mem_load_rom( "dcflash.rom",0x00200000, 0x00020000, 0x357c3568 );2.39 +2.40 + /* Load in the rest of the core modules */2.41 dreamcast_register_module( &sh4_module );2.42 dreamcast_register_module( &asic_module );2.43 dreamcast_register_module( &pvr2_module );2.44 dreamcast_register_module( &aica_module );2.45 dreamcast_register_module( &maple_module );2.46 dreamcast_register_module( &ide_module );2.47 +2.48 + /* Attach any default maple devices, ie a pair of controllers */2.49 + maple_device_t controller1 = controller_new();2.50 + maple_device_t controller2 = controller_new();2.51 + maple_attach_device( controller1, 0, 0 );2.52 + maple_attach_device( controller2, 1, 0 );2.53 }2.55 void dreamcast_register_module( dreamcast_module_t module )2.56 {2.57 modules[num_modules++] = module;2.58 + if( module->init != NULL )2.59 + module->init();2.60 }2.63 void dreamcast_init( void )2.64 {2.65 - int i;2.66 dreamcast_configure();2.67 - for( i=0; i<num_modules; i++ ) {2.68 - if( modules[i]->init != NULL )2.69 - modules[i]->init();2.70 - }2.71 - mem_load_rom( "dcboot.rom", 0x00000000, 0x00200000, 0x89f2b1a1 );2.72 - mem_load_rom( "dcflash.rom",0x00200000, 0x00020000, 0x357c3568 );2.73 }2.75 void dreamcast_reset( void )
3.1 --- a/src/pvr2/pvr2.c Mon Dec 12 13:11:11 2005 +00003.2 +++ b/src/pvr2/pvr2.c Tue Dec 13 12:17:26 2005 +00003.3 @@ -16,7 +16,6 @@3.5 void pvr2_init( void )3.6 {3.7 - mem_create_ram_region( 0x05000000, 8 MB, MEM_REGION_VIDEO );3.8 register_io_region( &mmio_region_PVR2 );3.9 video_base = mem_get_region_by_name( MEM_REGION_VIDEO );3.10 }
4.1 --- a/src/sh4/sh4core.c Mon Dec 12 13:11:11 2005 +00004.2 +++ b/src/sh4/sh4core.c Tue Dec 13 12:17:26 2005 +00004.3 @@ -6,16 +6,18 @@4.4 #include "mem.h"4.5 #include "intc.h"4.7 +void sh4_save( FILE *f );4.8 +void sh4_load( FILE *f );4.9 +4.10 struct dreamcast_module sh4_module = { "SH4", sh4_init, sh4_reset,4.11 NULL, sh4_stop,4.12 - NULL, NULL };4.13 + sh4_save, sh4_load };4.15 struct sh4_registers sh4r;4.16 static int running = 0;4.18 void sh4_init(void)4.19 {4.20 - mem_create_ram_region( 0x0C000000, 16 MB, MEM_REGION_MAIN );4.21 register_io_regions( mmio_list_sh4mmio );4.22 mmu_init();4.23 }4.24 @@ -43,6 +45,17 @@4.25 running = 0;4.26 }4.28 +void sh4_save( FILE *f )4.29 +{4.30 + fwrite( &sh4r, sizeof(sh4r), 1, f );4.31 + /* Save all additional on-board MMIO state */4.32 +}4.33 +4.34 +void sh4_load( FILE * f )4.35 +{4.36 +4.37 +}4.38 +4.39 void sh4_run(void)4.40 {4.41 running = 1;
.