src/mess/machine/oric.c
| r4251 | r4252 | |
| 24 | 24 | #include "machine/6522via.h" |
| 25 | 25 | #include "machine/applefdc.h" |
| 26 | 26 | #include "machine/6551.h" |
| 27 | | #include "machine/centroni.h" |
| 27 | #include "machine/ctronics.h" |
| 28 | 28 | #include "devices/basicdsk.h" |
| 29 | 29 | #include "devices/mfmdisk.h" |
| 30 | | #include "devices/printer.h" |
| 31 | 30 | #include "devices/cassette.h" |
| 32 | 31 | #include "sound/ay8910.h" |
| 33 | 32 | |
| r4251 | r4252 | |
| 246 | 245 | if (oric_psg_control==0) |
| 247 | 246 | { |
| 248 | 247 | /* if psg not selected, write to printer */ |
| 249 | | centronics_write_data(device->machine,0,data); |
| 248 | const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics"); |
| 249 | centronics_data_w(printer, 0, data); |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
| r4251 | r4252 | |
| 309 | 309 | static unsigned char previous_portb_data = 0; |
| 310 | 310 | static WRITE8_DEVICE_HANDLER ( oric_via_out_b_func ) |
| 311 | 311 | { |
| 312 | | int printer_handshake; |
| 312 | const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics"); |
| 313 | 313 | |
| 314 | 314 | /* KEYBOARD */ |
| 315 | 315 | oric_keyboard_line = data & 0x07; |
| r4251 | r4252 | |
| 330 | 330 | /* cassette data out */ |
| 331 | 331 | cassette_output(cassette_device_image(device->machine), (data & (1<<7)) ? -1.0 : +1.0); |
| 332 | 332 | |
| 333 | /* centronics STROBE is connected to PB4 */ |
| 334 | centronics_strobe_w(printer, BIT(data, 4)); |
| 333 | 335 | |
| 334 | | /* PRINTER STROBE */ |
| 335 | | printer_handshake = 0; |
| 336 | | |
| 337 | | /* normal value is 1, 0 is the strobe */ |
| 338 | | if ((data & (1<<4))!=0) |
| 339 | | { |
| 340 | | printer_handshake = CENTRONICS_STROBE; |
| 341 | | } |
| 342 | | |
| 343 | | /* assumption: select is tied low */ |
| 344 | | centronics_write_handshake(device->machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 345 | | centronics_write_handshake(device->machine, 0, printer_handshake, CENTRONICS_STROBE); |
| 346 | | |
| 347 | 336 | oric_psg_connection_refresh(device->machine); |
| 348 | 337 | previous_portb_data = data; |
| 349 | | |
| 350 | 338 | } |
| 351 | 339 | |
| 352 | | static void oric_printer_handshake_in(running_machine *machine,int number, int data, int mask) |
| 353 | | { |
| 354 | | int acknowledge; |
| 355 | | const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0"); |
| 356 | 340 | |
| 357 | | acknowledge = 1; |
| 358 | | |
| 359 | | if (mask & CENTRONICS_ACKNOWLEDGE) |
| 360 | | { |
| 361 | | if (data & CENTRONICS_ACKNOWLEDGE) |
| 362 | | { |
| 363 | | acknowledge = 0; |
| 364 | | } |
| 365 | | } |
| 366 | | |
| 367 | | via_ca1_w(via_0, 0, acknowledge); |
| 368 | | } |
| 369 | | |
| 370 | | static const CENTRONICS_CONFIG oric_cent_config[1]={ |
| 371 | | { |
| 372 | | PRINTER_CENTRONICS, |
| 373 | | oric_printer_handshake_in |
| 374 | | }, |
| 375 | | }; |
| 376 | | |
| 377 | | |
| 378 | 341 | static READ8_DEVICE_HANDLER ( oric_via_in_ca2_func ) |
| 379 | 342 | { |
| 380 | 343 | return oric_psg_control & 1; |
| r4251 | r4252 | |
| 599 | 562 | const device_config *fdc = device_list_find_by_tag(machine->config->devicelist, |
| 600 | 563 | APPLEFDC, |
| 601 | 564 | "fdc"); |
| 602 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 565 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 603 | 566 | |
| 604 | 567 | memory_install_read8_handler(space, 0x0300, 0x030f, 0, 0, oric_IO_r); |
| 605 | 568 | memory_install_read8_device_handler(space, fdc, 0x0310, 0x031f, 0, 0, applefdc_r); |
| r4251 | r4252 | |
| 971 | 934 | { |
| 972 | 935 | unsigned char data = 0x0ff; |
| 973 | 936 | device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x"); |
| 974 | | |
| 937 | |
| 975 | 938 | switch (offset & 0x0ff) |
| 976 | 939 | { |
| 977 | 940 | /* microdisc floppy disc interface */ |
| r4251 | r4252 | |
| 1068 | 1031 | static void oric_install_microdisc_interface(running_machine *machine) |
| 1069 | 1032 | { |
| 1070 | 1033 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1071 | | |
| 1034 | |
| 1072 | 1035 | memory_install_read8_handler(space, 0x0300, 0x030f, 0, 0, oric_IO_r); |
| 1073 | 1036 | memory_install_read8_handler(space, 0x0310, 0x031f, 0, 0, oric_microdisc_r); |
| 1074 | 1037 | memory_install_read8_handler(space, 0x0320, 0x03ff, 0, 0, oric_IO_r); |
| r4251 | r4252 | |
| 1138 | 1101 | |
| 1139 | 1102 | static void oric_common_init_machine(running_machine *machine) |
| 1140 | 1103 | { |
| 1141 | | const device_config *via_0 = devtag_get_device(machine, VIA6522, "via6522_0"); |
| 1142 | | |
| 1143 | 1104 | /* clear all irqs */ |
| 1144 | 1105 | oric_irqs = 0; |
| 1145 | 1106 | oric_ram_0x0c000 = NULL; |
| 1146 | 1107 | |
| 1147 | 1108 | timer_pulse(machine, ATTOTIME_IN_HZ(4800), NULL, 0, oric_refresh_tape); |
| 1148 | | |
| 1149 | | centronics_config(machine, 0, oric_cent_config); |
| 1150 | | /* assumption: select is tied low */ |
| 1151 | | centronics_write_handshake(machine, 0, CENTRONICS_SELECT | CENTRONICS_NO_RESET, CENTRONICS_SELECT| CENTRONICS_NO_RESET); |
| 1152 | | via_ca1_w(via_0, 0, 1); |
| 1153 | 1109 | } |
| 1154 | 1110 | |
| 1155 | 1111 | MACHINE_START( oric ) |
| r4251 | r4252 | |
| 1166 | 1122 | { |
| 1167 | 1123 | int disc_interface_id = input_port_read(machine, "FLOPPY") & 0x07; |
| 1168 | 1124 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1169 | | |
| 1125 | |
| 1170 | 1126 | switch (disc_interface_id) |
| 1171 | 1127 | { |
| 1172 | 1128 | default: |
src/mess/drivers/oric.c
| r4251 | r4252 | |
| 20 | 20 | #include "cpu/m6502/m6502.h" |
| 21 | 21 | #include "sound/wave.h" |
| 22 | 22 | #include "includes/oric.h" |
| 23 | | #include "machine/centroni.h" |
| 24 | | #include "devices/printer.h" |
| 23 | #include "machine/ctronics.h" |
| 25 | 24 | #include "devices/mflopimg.h" |
| 26 | 25 | #include "devices/cassette.h" |
| 27 | 26 | #include "formats/ap2_dsk.h" |
| r4251 | r4252 | |
| 352 | 351 | CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED |
| 353 | 352 | }; |
| 354 | 353 | |
| 354 | static const centronics_interface oric_contronics_config = |
| 355 | { |
| 356 | FALSE, |
| 357 | DEVCB_DEVICE_HANDLER(VIA6522, "via6522_0", via_ca1_w), |
| 358 | DEVCB_NULL, |
| 359 | DEVCB_NULL |
| 360 | }; |
| 361 | |
| 355 | 362 | static MACHINE_DRIVER_START( oric ) |
| 356 | 363 | /* basic machine hardware */ |
| 357 | 364 | MDRV_CPU_ADD("main", M6502, 1000000) |
| r4251 | r4252 | |
| 383 | 390 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 384 | 391 | |
| 385 | 392 | /* printer */ |
| 386 | | MDRV_PRINTER_ADD("printer") |
| 393 | MDRV_CENTRONICS_ADD("centronics", oric_contronics_config) |
| 387 | 394 | |
| 388 | 395 | /* cassette */ |
| 389 | 396 | MDRV_CASSETTE_ADD( "cassette", oric_cassette_config ) |
| 390 | 397 | |
| 391 | 398 | /* via */ |
| 392 | 399 | MDRV_VIA6522_ADD( "via6522_0", 1000000, oric_6522_interface ) |
| 393 | | |
| 400 | |
| 394 | 401 | MDRV_WD179X_ADD("wd179x", oric_wd17xx_interface ) |
| 395 | 402 | MACHINE_DRIVER_END |
| 396 | 403 | |