src/mess/drivers/supracan.c
| r0 | r6838 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Skeleton driver file for Super A'Can console. |
| 4 | |
| 5 | The system unit contains a reset button. |
| 6 | |
| 7 | Controllers: |
| 8 | - 4 directional buttons |
| 9 | - A, B, X, Y, buttons |
| 10 | - Start, select buttons |
| 11 | - L, R shoulder buttons |
| 12 | |
| 13 | f00000 - bit 15 is probably vblank bit. |
| 14 | |
| 15 | ***************************************************************************/ |
| 16 | |
| 17 | #include "driver.h" |
| 18 | #include "cpu/m68000/m68000.h" |
| 19 | #include "cpu/m6502/m6502.h" |
| 20 | #include "devices/cartslot.h" |
| 21 | |
| 22 | |
| 23 | static UINT16 supracan_m6502_reset; |
| 24 | static UINT8 *supracan_soundram; |
| 25 | static UINT16 *supracan_soundram_16; |
| 26 | |
| 27 | |
| 28 | static READ16_HANDLER( supracan_unk1_r ); |
| 29 | static WRITE16_HANDLER( supracan_soundram_w ); |
| 30 | static WRITE16_HANDLER( supracan_sound_w ); |
| 31 | |
| 32 | |
| 33 | static ADDRESS_MAP_START( supracan_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 34 | AM_RANGE( 0x000000, 0x07ffff ) AM_ROM AM_REGION( "cart", 0 ) |
| 35 | AM_RANGE( 0xe80300, 0xe80301 ) AM_READ( supracan_unk1_r ) |
| 36 | AM_RANGE( 0xe88400, 0xe88c87 ) AM_RAM /* Unknown, some data gets copied here during boot */ |
| 37 | AM_RANGE( 0xe8f000, 0xe8ffff ) AM_RAM_WRITE( supracan_soundram_w ) AM_BASE( &supracan_soundram_16 ) |
| 38 | AM_RANGE( 0xe90000, 0xe9001f ) AM_WRITE( supracan_sound_w ) |
| 39 | AM_RANGE( 0xf00000, 0xf001ff ) AM_RAM /* Unknown */ |
| 40 | AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM /* Unknown, some data gets copied here during boot */ |
| 41 | AM_RANGE( 0xf40000, 0xf43fff ) AM_RAM /* Unknown, some data gets copied here during boot */ |
| 42 | AM_RANGE( 0xf44000, 0xf4401f ) AM_RAM /* Unknown */ |
| 43 | AM_RANGE( 0xf44200, 0xf443ff ) AM_RAM /* Unknown, some data gets copied here during boot. Possibly a tilemap?? */ |
| 44 | AM_RANGE( 0xf44400, 0xf445ff ) AM_RAM /* Unknown, some data gets copied here during boot */ |
| 45 | AM_RANGE( 0xfc0000, 0xfcffff ) AM_RAM /* System work ram */ |
| 46 | AM_RANGE( 0xff8000, 0xffffff ) AM_RAM /* System work ram */ |
| 47 | ADDRESS_MAP_END |
| 48 | |
| 49 | |
| 50 | static ADDRESS_MAP_START( supracan_sound_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 51 | AM_RANGE( 0x0000, 0x01ff ) AM_RAM |
| 52 | AM_RANGE( 0xf000, 0xffff ) AM_RAM AM_BASE( &supracan_soundram ) |
| 53 | ADDRESS_MAP_END |
| 54 | |
| 55 | |
| 56 | static INPUT_PORTS_START( supracan ) |
| 57 | INPUT_PORTS_END |
| 58 | |
| 59 | |
| 60 | static WRITE16_HANDLER( supracan_soundram_w ) |
| 61 | { |
| 62 | supracan_soundram_16[offset] = data; |
| 63 | |
| 64 | supracan_soundram[offset*2 + 1] = data & 0xff; |
| 65 | supracan_soundram[offset*2 + 0] = data >> 8; |
| 66 | } |
| 67 | |
| 68 | |
| 69 | static READ16_HANDLER( supracan_unk1_r ) |
| 70 | { |
| 71 | /* No idea what hardware this is connected to. */ |
| 72 | return 0xffff; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | static WRITE16_HANDLER( supracan_sound_w ) |
| 77 | { |
| 78 | switch ( offset ) |
| 79 | { |
| 80 | case 0x001c/2: /* Sound cpu control. Bit 0 tied to sound cpu RESET line */ |
| 81 | if ( data & 0x01 ) |
| 82 | { |
| 83 | if ( ! supracan_m6502_reset ) |
| 84 | { |
| 85 | /* Reset and enable the sound cpu */ |
| 86 | cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_HALT, CLEAR_LINE); |
| 87 | cputag_reset( space->machine, "soundcpu" ); |
| 88 | } |
| 89 | } |
| 90 | else |
| 91 | { |
| 92 | /* Halt the sound cpu */ |
| 93 | cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_HALT, ASSERT_LINE); |
| 94 | } |
| 95 | supracan_m6502_reset = data & 0x01; |
| 96 | break; |
| 97 | default: |
| 98 | logerror("supracan_sound_w: writing %04x to unknown address %08x\n", data, 0xe90000 + offset * 2 ); |
| 99 | break; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | |
| 104 | static DEVICE_IMAGE_LOAD( supracan_cart ) |
| 105 | { |
| 106 | UINT8 *cart = memory_region( image->machine, "cart" ); |
| 107 | int size = image_length( image ); |
| 108 | |
| 109 | if ( size != 0x80000 ) |
| 110 | { |
| 111 | image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size" ); |
| 112 | return INIT_FAIL; |
| 113 | } |
| 114 | |
| 115 | if ( image_fread( image, cart, size ) != size ) |
| 116 | { |
| 117 | image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" ); |
| 118 | return INIT_FAIL; |
| 119 | } |
| 120 | |
| 121 | return INIT_PASS; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | static MACHINE_RESET( supracan ) |
| 126 | { |
| 127 | cputag_set_input_line(machine, "soundcpu", INPUT_LINE_HALT, ASSERT_LINE); |
| 128 | } |
| 129 | |
| 130 | |
| 131 | static MACHINE_DRIVER_START( supracan ) |
| 132 | MDRV_CPU_ADD( "maincpu", M68000, XTAL_10_738635MHz ) /* Correct frequency unknown */ |
| 133 | MDRV_CPU_PROGRAM_MAP( supracan_mem ) |
| 134 | |
| 135 | MDRV_CPU_ADD( "soundcpu", M6502, XTAL_3_579545MHz ) /* TODO: Verfiy actual clock */ |
| 136 | MDRV_CPU_PROGRAM_MAP( supracan_sound_mem ) |
| 137 | |
| 138 | MDRV_MACHINE_RESET( supracan ) |
| 139 | |
| 140 | MDRV_SCREEN_ADD( "screen", LCD ) |
| 141 | MDRV_SCREEN_FORMAT( BITMAP_FORMAT_RGB32 ) |
| 142 | MDRV_SCREEN_SIZE( 320, 240 ) |
| 143 | MDRV_SCREEN_VISIBLE_AREA( 0, 319, 0, 239 ) |
| 144 | MDRV_SCREEN_REFRESH_RATE( 60 ) |
| 145 | |
| 146 | MDRV_CARTSLOT_ADD( "cart" ) |
| 147 | MDRV_CARTSLOT_EXTENSION_LIST( "bin" ) |
| 148 | MDRV_CARTSLOT_MANDATORY |
| 149 | MDRV_CARTSLOT_LOAD( supracan_cart ) |
| 150 | MACHINE_DRIVER_END |
| 151 | |
| 152 | |
| 153 | ROM_START( supracan ) |
| 154 | ROM_REGION( 0x80000, "cart", ROMREGION_ERASEFF ) |
| 155 | ROM_END |
| 156 | |
| 157 | |
| 158 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 159 | CONS( 1995, supracan, 0, 0, supracan, supracan, 0, "Funtech Entertainment", "Super A'Can", GAME_NOT_WORKING ) |
| 160 | |
| 161 | |