src/mess/drivers/pegasus.c
| r7896 | r7897 | |
| 14 | 14 | #include "emu.h" |
| 15 | 15 | #include "cpu/m6809/m6809.h" |
| 16 | 16 | #include "machine/6821pia.h" |
| 17 | #include "devices/cartslot.h" |
| 18 | #include "devices/cassette.h" |
| 19 | #include "machine/ctronics.h" |
| 17 | 20 | #include "includes/pegasus.h" |
| 18 | 21 | |
| 19 | 22 | static UINT8 pegasus_kbd_row = 0; |
| 20 | 23 | static UINT8 pegasus_kbd_irq = 1; |
| 21 | 24 | static UINT8 pegasus_control_bits = 0; |
| 25 | static running_device *pegasus_cass; |
| 22 | 26 | |
| 27 | |
| 23 | 28 | static TIMER_DEVICE_CALLBACK( pegasus_firq ) |
| 24 | 29 | { |
| 25 | 30 | running_device *cpu = devtag_get_device( timer->machine, "maincpu" ); |
| r7896 | r7897 | |
| 64 | 69 | return pegasus_kbd_irq; |
| 65 | 70 | } |
| 66 | 71 | |
| 72 | static READ_LINE_DEVICE_HANDLER( pegasus_cassette_r ) |
| 73 | { |
| 74 | return cassette_input(pegasus_cass); |
| 75 | } |
| 76 | |
| 77 | static WRITE_LINE_DEVICE_HANDLER( pegasus_cassette_w ) |
| 78 | { |
| 79 | cassette_output(pegasus_cass, state ? 1 : -1); |
| 80 | } |
| 81 | |
| 67 | 82 | static ADDRESS_MAP_START(pegasus_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 68 | 83 | ADDRESS_MAP_UNMAP_HIGH |
| 69 | | AM_RANGE(0x0000, 0x1fff) AM_ROM AM_WRITENOP |
| 70 | | AM_RANGE(0x2000, 0xbdff) AM_RAM |
| 84 | AM_RANGE(0x0000, 0xbdff) AM_RAM |
| 71 | 85 | AM_RANGE(0xbe00, 0xbfff) AM_RAM AM_BASE(&pegasus_video_ram) |
| 72 | 86 | AM_RANGE(0xc000, 0xdfff) AM_ROM |
| 73 | 87 | AM_RANGE(0xe200, 0xe3ff) AM_RAM // PCG |
| r7896 | r7897 | |
| 173 | 187 | /* System - for keyboard, video, general housekeeping */ |
| 174 | 188 | static const pia6821_interface pegasus_pia_s_intf= |
| 175 | 189 | { |
| 176 | | DEVCB_NULL, /* port A input */ |
| 177 | | DEVCB_HANDLER(pegasus_keyboard_r), /* port B input */ // high nibble from keyboard |
| 178 | | DEVCB_NULL, /* CA1 input */ // from cassette |
| 179 | | DEVCB_NULL, /* CB1 input */ |
| 180 | | DEVCB_LINE(pegasus_keyboard_irq), /* CA2 input */ // do a IRQ when a key pressed |
| 181 | | DEVCB_NULL, /* CB2 input */ |
| 190 | DEVCB_NULL, /* port A input */ |
| 191 | DEVCB_HANDLER(pegasus_keyboard_r), /* port B input */ |
| 192 | DEVCB_LINE(pegasus_cassette_r), /* CA1 input */ |
| 193 | DEVCB_NULL, /* CB1 input */ |
| 194 | DEVCB_LINE(pegasus_keyboard_irq), /* CA2 input */ |
| 195 | DEVCB_NULL, /* CB2 input */ |
| 182 | 196 | DEVCB_HANDLER(pegasus_keyboard_w), /* port A output */ |
| 183 | | DEVCB_HANDLER(pegasus_controls), /* port B output */ // low nibble housekeeping |
| 184 | | DEVCB_NULL, /* CA2 output */ // to cassette |
| 197 | DEVCB_HANDLER(pegasus_controls), /* port B output */ |
| 198 | DEVCB_LINE(pegasus_cassette_w), /* CA2 output */ |
| 185 | 199 | DEVCB_DEVICE_LINE("maincpu", pegasus_firq_clr), /* CB2 output */ |
| 186 | 200 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE), /* IRQA output */ |
| 187 | 201 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE) /* IRQB output */ |
| r7896 | r7897 | |
| 204 | 218 | DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE) |
| 205 | 219 | }; |
| 206 | 220 | |
| 207 | | static MACHINE_RESET(pegasus) |
| 208 | | { |
| 221 | static const cassette_config pegasus_cassette_config = |
| 222 | { |
| 223 | cassette_default_formats, |
| 224 | NULL, |
| 225 | (cassette_state)(CASSETTE_STOPPED|CASSETTE_MOTOR_ENABLED) |
| 226 | }; |
| 227 | |
| 228 | static DEVICE_IMAGE_LOAD( pegasus_cart_1 ) |
| 229 | { |
| 230 | image_fread(image, memory_region(image->machine, "maincpu") + 0xc000, 0x1000); |
| 231 | |
| 232 | return INIT_PASS; |
| 209 | 233 | } |
| 210 | 234 | |
| 235 | static DEVICE_IMAGE_LOAD( pegasus_cart_2 ) |
| 236 | { |
| 237 | image_fread(image, memory_region(image->machine, "maincpu") + 0xd000, 0x1000); |
| 238 | |
| 239 | return INIT_PASS; |
| 240 | } |
| 241 | |
| 242 | static MACHINE_START( pegasus ) |
| 243 | { |
| 244 | pegasus_cass = devtag_get_device(machine, "cassette"); |
| 245 | } |
| 246 | |
| 211 | 247 | static MACHINE_DRIVER_START( pegasus ) |
| 212 | 248 | /* basic machine hardware */ |
| 213 | 249 | MDRV_CPU_ADD("maincpu", M6809E, XTAL_4MHz) // actually a 6809C |
| 214 | 250 | MDRV_CPU_PROGRAM_MAP(pegasus_mem) |
| 215 | 251 | |
| 216 | 252 | MDRV_TIMER_ADD_PERIODIC("pegasus_firq", pegasus_firq, HZ(50)) |
| 217 | | MDRV_MACHINE_RESET(pegasus) |
| 218 | | |
| 253 | MDRV_MACHINE_START(pegasus) |
| 219 | 254 | /* video hardware */ |
| 220 | 255 | MDRV_SCREEN_ADD("screen", RASTER) |
| 221 | 256 | MDRV_SCREEN_REFRESH_RATE(50) |
| r7896 | r7897 | |
| 230 | 265 | /* devices */ |
| 231 | 266 | MDRV_PIA6821_ADD( "pegasus_pia_s", pegasus_pia_s_intf ) |
| 232 | 267 | MDRV_PIA6821_ADD( "pegasus_pia_u", pegasus_pia_u_intf ) |
| 268 | MDRV_CARTSLOT_ADD("cart1") |
| 269 | MDRV_CARTSLOT_EXTENSION_LIST("bin") |
| 270 | MDRV_CARTSLOT_LOAD(pegasus_cart_1) |
| 271 | MDRV_CARTSLOT_ADD("cart2") |
| 272 | MDRV_CARTSLOT_EXTENSION_LIST("bin") |
| 273 | MDRV_CARTSLOT_LOAD(pegasus_cart_2) |
| 274 | MDRV_CASSETTE_ADD( "cassette", pegasus_cassette_config ) |
| 275 | // MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 233 | 276 | MACHINE_DRIVER_END |
| 234 | 277 | |
| 235 | 278 | /* ROM definition */ |
| 236 | 279 | ROM_START( pegasus ) |
| 237 | 280 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 238 | | // ROM_LOAD( "invaders.bin", 0x1000, 0x1000, CRC(e19be9e4) SHA1(77a2a3a7ddf2b30790860be994e9c4bab02c72d6) ) |
| 239 | 281 | ROM_LOAD( "mon11_2674.bin", 0xf000, 0x1000, CRC(1640ff7e) SHA1(8199643749fb40fb8be05e9f311c75620ca939b1) ) |
| 240 | 282 | ROM_FILL(0xf09e, 1, 0x20) // hack out the protection |
| 241 | 283 | // ROM_LOAD( "mon23_2601.bin", 0xf000, 0x1000, CRC(7dd451bb) SHA1(7843e9166151570f9c915589dc252feb0cb1cec4) ) |