1.1 --- a/src/dreamcast.c Mon Dec 12 13:11:11 2005 +0000
1.2 +++ b/src/dreamcast.c Tue Dec 13 12:17:26 2005 +0000
1.6 #include "dreamcast.h"
1.10 /* Central switchboard for the system */
1.12 #define MAX_MODULES 32
1.13 static int num_modules = 0;
1.14 static int dreamcast_state = 0;
1.15 -dreamcast_module_t modules[];
1.16 +dreamcast_module_t modules[MAX_MODULES];
1.19 + * This function is responsible for defining how all the pieces of the
1.20 + * dreamcast actually fit together. Among other things, this lets us
1.21 + * (reasonably) easily redefine the structure for eg various versions of the
1.24 + * Note currently the locations of the various MMIO pages are hard coded in
1.25 + * the MMIO definitions - they should probably be moved here.
1.27 void dreamcast_configure( )
1.29 + /* Register the memory framework */
1.30 dreamcast_register_module( &mem_module );
1.32 + /* Setup standard memory map */
1.33 + mem_create_ram_region( 0x0C000000, 16 MB, MEM_REGION_MAIN );
1.34 + mem_create_ram_region( 0x00800000, 2 MB, MEM_REGION_AUDIO );
1.35 + mem_create_ram_region( 0x00703000, 8 KB, MEM_REGION_AUDIO_SCRATCH );
1.36 + mem_create_ram_region( 0x05000000, 8 MB, MEM_REGION_VIDEO );
1.37 + mem_load_rom( "dcboot.rom", 0x00000000, 0x00200000, 0x89f2b1a1 );
1.38 + mem_load_rom( "dcflash.rom",0x00200000, 0x00020000, 0x357c3568 );
1.40 + /* Load in the rest of the core modules */
1.41 dreamcast_register_module( &sh4_module );
1.42 dreamcast_register_module( &asic_module );
1.43 dreamcast_register_module( &pvr2_module );
1.44 dreamcast_register_module( &aica_module );
1.45 dreamcast_register_module( &maple_module );
1.46 dreamcast_register_module( &ide_module );
1.48 + /* Attach any default maple devices, ie a pair of controllers */
1.49 + maple_device_t controller1 = controller_new();
1.50 + maple_device_t controller2 = controller_new();
1.51 + maple_attach_device( controller1, 0, 0 );
1.52 + maple_attach_device( controller2, 1, 0 );
1.55 void dreamcast_register_module( dreamcast_module_t module )
1.57 modules[num_modules++] = module;
1.58 + if( module->init != NULL )
1.63 void dreamcast_init( void )
1.66 dreamcast_configure();
1.67 - for( i=0; i<num_modules; i++ ) {
1.68 - if( modules[i]->init != NULL )
1.69 - modules[i]->init();
1.71 - mem_load_rom( "dcboot.rom", 0x00000000, 0x00200000, 0x89f2b1a1 );
1.72 - mem_load_rom( "dcflash.rom",0x00200000, 0x00020000, 0x357c3568 );
1.75 void dreamcast_reset( void )