src/mess/machine/amstrad.c
| r4255 | r4256 | |
| 40 | 40 | #include "machine/8255ppi.h" |
| 41 | 41 | #include "machine/mc146818.h" |
| 42 | 42 | #include "machine/nec765.h" |
| 43 | #include "machine/ctronics.h" |
| 43 | 44 | #include "devices/dsk.h" |
| 44 | 45 | #include "devices/cassette.h" |
| 45 | | #include "devices/printer.h" |
| 46 | 46 | #include "devices/snapquik.h" |
| 47 | 47 | #include "includes/amstrad.h" |
| 48 | 48 | #include "sound/ay8910.h" |
| r4255 | r4256 | |
| 128 | 128 | static UINT8 ppi_port_inputs[3]; |
| 129 | 129 | static UINT8 ppi_port_outputs[3]; |
| 130 | 130 | |
| 131 | | static UINT8 previous_printer_data_byte; |
| 132 | | |
| 133 | 131 | static int aleste_rtc_function; |
| 134 | 132 | static int aleste_fdc_int; |
| 135 | 133 | |
| r4255 | r4256 | |
| 269 | 267 | static void amstrad_rethinkMemory(running_machine *machine); |
| 270 | 268 | |
| 271 | 269 | |
| 272 | | static const device_config *printer_device(running_machine *machine) |
| 273 | | { |
| 274 | | return devtag_get_device(machine, PRINTER, "printer"); |
| 275 | | } |
| 276 | | |
| 277 | | |
| 278 | 270 | /* Initialise the palette */ |
| 279 | 271 | PALETTE_INIT( amstrad_cpc ) |
| 280 | 272 | { |
| r4255 | r4256 | |
| 400 | 392 | for(i=0; i<32; i++) |
| 401 | 393 | { |
| 402 | 394 | int r,g,b; |
| 403 | | |
| 395 | |
| 404 | 396 | b = (pal[0x140+i] >> 4) & 0x03; |
| 405 | 397 | g = (pal[0x140+i] >> 2) & 0x03; |
| 406 | 398 | r = pal[0x140+i] & 0x03; |
| 407 | | |
| 399 | |
| 408 | 400 | r = (r << 6); |
| 409 | 401 | g = (g << 6); |
| 410 | 402 | b = (b << 6); |
| 411 | 403 | |
| 412 | 404 | palette_set_color_rgb(machine, i, r, g, b); |
| 413 | 405 | } |
| 414 | | |
| 406 | |
| 415 | 407 | /* MSX colour palette is 6-bit RGB */ |
| 416 | 408 | for(i=0; i<64; i++) |
| 417 | 409 | { |
| r4255 | r4256 | |
| 786 | 778 | /* Apply vertical background scrolling */ |
| 787 | 779 | ra += ( ( amstrad_plus_asic_ram[0x2804] >> 4 ) & 0x07 ); |
| 788 | 780 | if ( ra > 7 ) |
| 789 | | { |
| 781 | { |
| 790 | 782 | ma += x_count; |
| 791 | | } |
| 783 | } |
| 792 | 784 | |
| 793 | 785 | for ( i = 0; i < x_count; i++ ) |
| 794 | 786 | { |
| r4255 | r4256 | |
| 841 | 833 | /* Apply vertical background scrolling */ |
| 842 | 834 | ra += ( ( amstrad_plus_asic_ram[0x2804] >> 4 ) & 0x07 ); |
| 843 | 835 | if ( ra > 7 ) |
| 844 | | { |
| 836 | { |
| 845 | 837 | ma += x_count; |
| 846 | | } |
| 838 | } |
| 847 | 839 | |
| 848 | 840 | for ( i = 0; i < x_count; i++ ) |
| 849 | 841 | { |
| r4255 | r4256 | |
| 1645 | 1637 | { |
| 1646 | 1638 | bank_base = &memory_region(machine, "main")[0x010000]; |
| 1647 | 1639 | } |
| 1648 | | else |
| 1640 | else |
| 1649 | 1641 | { |
| 1650 | 1642 | if(aleste_mode & 0x04) |
| 1651 | 1643 | bank_base = Aleste_RamBanks[0]; |
| r4255 | r4256 | |
| 1732 | 1724 | UINT8 *bank_base = NULL; |
| 1733 | 1725 | |
| 1734 | 1726 | /* b3 : "1" Upper rom area disable or "0" Upper rom area enable */ |
| 1735 | | if ( ! ( gate_array.mrer & 0x08 ) ) |
| 1727 | if ( ! ( gate_array.mrer & 0x08 ) ) |
| 1736 | 1728 | { |
| 1737 | 1729 | bank_base = Amstrad_ROM_Table[ gate_array.upper_bank ]; |
| 1738 | 1730 | } |
| 1739 | | else |
| 1731 | else |
| 1740 | 1732 | { |
| 1741 | 1733 | if(aleste_mode & 0x04) |
| 1742 | 1734 | bank_base = Aleste_RamBanks[3]; |
| r4255 | r4256 | |
| 2432 | 2424 | device_config *fdc = (device_config*)devtag_get_device( space->machine, NEC765A, "nec765"); |
| 2433 | 2425 | device_config *mc6845 = (device_config *) devtag_get_device( space->machine, MC6845, "mc6845" ); |
| 2434 | 2426 | |
| 2435 | | if ((offset & (1<<15)) == 0) |
| 2427 | static int printer_bit8_selected = FALSE; |
| 2428 | |
| 2429 | if ((offset & (1<<15)) == 0) |
| 2436 | 2430 | { |
| 2437 | 2431 | if(aleste_mode & 0x04) // Aleste mode |
| 2438 | 2432 | { |
| r4255 | r4256 | |
| 2441 | 2435 | else |
| 2442 | 2436 | { |
| 2443 | 2437 | /* if b15 = 0 and b14 = 1 : Gate-Array Write Selected*/ |
| 2444 | | if ((offset & (1<<14)) != 0) |
| 2438 | if ((offset & (1<<14)) != 0) |
| 2445 | 2439 | amstrad_GateArray_write(space->machine, data); |
| 2446 | 2440 | |
| 2447 | 2441 | /* if b15 = 0 : RAM Configuration Write Selected*/ |
| r4255 | r4256 | |
| 2459 | 2453 | mc6845_address_w( mc6845, 0, data ); |
| 2460 | 2454 | if ( amstrad_system_type == SYSTEM_PLUS || amstrad_system_type == SYSTEM_GX4000 ) |
| 2461 | 2455 | amstrad_plus_seqcheck(data); |
| 2456 | |
| 2457 | /* printer port d7 */ |
| 2458 | if (data == 0x0c && amstrad_system_type == SYSTEM_PLUS) |
| 2459 | printer_bit8_selected = TRUE; |
| 2460 | |
| 2462 | 2461 | break; |
| 2463 | 2462 | case 0x01: /* Write to selected internal 6845 register Write Only */ |
| 2464 | 2463 | video_screen_update_partial( space->machine->primary_screen, video_screen_get_vpos( space->machine->primary_screen ) ); |
| 2465 | 2464 | mc6845_register_w( mc6845, 0, data ); |
| 2465 | |
| 2466 | /* printer port bit 8 */ |
| 2467 | if (printer_bit8_selected && amstrad_system_type == SYSTEM_PLUS) |
| 2468 | { |
| 2469 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 2470 | centronics_d7_w(printer, BIT(data, 3)); |
| 2471 | printer_bit8_selected = FALSE; |
| 2472 | } |
| 2473 | |
| 2466 | 2474 | break; |
| 2467 | 2475 | default: |
| 2468 | 2476 | break; |
| r4255 | r4256 | |
| 2482 | 2490 | { |
| 2483 | 2491 | if ((offset & (1<<12)) == 0) |
| 2484 | 2492 | { |
| 2485 | | /* on CPC, write to printer through LS chip */ |
| 2486 | | /* the amstrad is crippled with a 7-bit port :( */ |
| 2487 | | /* bit 7 of the data is the printer /strobe */ |
| 2493 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 2488 | 2494 | |
| 2489 | | /* strobe state changed? */ |
| 2490 | | if (((previous_printer_data_byte^data) & (1<<7)) !=0 ) |
| 2491 | | { |
| 2492 | | /* check for only one transition */ |
| 2493 | | if ((data & (1<<7)) == 0) |
| 2494 | | { |
| 2495 | | /* output data to printer */ |
| 2496 | | printer_output(printer_device(space->machine), data & 0x07f); |
| 2497 | | } |
| 2498 | | } |
| 2499 | | previous_printer_data_byte = data; |
| 2495 | /* CPC has a 7-bit data port, bit 8 is the STROBE signal */ |
| 2496 | centronics_data_w(printer, 0, data & 0x7f); |
| 2497 | centronics_strobe_w(printer, BIT(data, 7)); |
| 2500 | 2498 | } |
| 2501 | 2499 | } |
| 2502 | 2500 | |
| r4255 | r4256 | |
| 2855 | 2853 | static void update_psg(running_machine *machine) |
| 2856 | 2854 | { |
| 2857 | 2855 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2858 | | |
| 2856 | |
| 2859 | 2857 | if(aleste_mode & 0x20) // RTC selected |
| 2860 | 2858 | { |
| 2861 | 2859 | switch(aleste_rtc_function) |
| r4255 | r4256 | |
| 2872 | 2870 | } |
| 2873 | 2871 | return; |
| 2874 | 2872 | } |
| 2875 | | switch (amstrad_Psg_FunctionSelected) |
| 2873 | switch (amstrad_Psg_FunctionSelected) |
| 2876 | 2874 | { |
| 2877 | | case 0: |
| 2875 | case 0: |
| 2878 | 2876 | {/* Inactive */ |
| 2879 | 2877 | } break; |
| 2880 | | case 1: |
| 2878 | case 1: |
| 2881 | 2879 | {/* b6 = 1 ? : Read from selected PSG register and make the register data available to PPI Port A */ |
| 2882 | 2880 | ppi_port_inputs[amstrad_ppi_PortA] = ay8910_read_port_0_r(space, 0); |
| 2883 | | } |
| 2881 | } |
| 2884 | 2882 | break; |
| 2885 | | case 2: |
| 2883 | case 2: |
| 2886 | 2884 | {/* b7 = 1 ? : Write to selected PSG register and write data to PPI Port A */ |
| 2887 | 2885 | ay8910_write_port_0_w(space, 0, ppi_port_outputs[amstrad_ppi_PortA]); |
| 2888 | | } |
| 2886 | } |
| 2889 | 2887 | break; |
| 2890 | | case 3: |
| 2888 | case 3: |
| 2891 | 2889 | {/* b6 and b7 = 1 ? : The register will now be selected and the user can read from or write to it. The register will remain selected until another is chosen.*/ |
| 2892 | 2890 | ay8910_control_port_0_w(space, 0, ppi_port_outputs[amstrad_ppi_PortA]); |
| 2893 | 2891 | prev_reg = ppi_port_outputs[amstrad_ppi_PortA]; |
| 2894 | | } |
| 2892 | } |
| 2895 | 2893 | break; |
| 2896 | 2894 | default: { |
| 2897 | 2895 | } break; |
| r4255 | r4256 | |
| 2952 | 2950 | /* Set b6 with Parallel/Printer port ready */ |
| 2953 | 2951 | if(amstrad_system_type != SYSTEM_GX4000) |
| 2954 | 2952 | { |
| 2955 | | if (printer_is_ready(printer_device(device->machine))==0 ) { |
| 2956 | | data |= (1<<6); |
| 2957 | | } |
| 2953 | const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics"); |
| 2954 | data |= centronics_busy_r(printer) << 6; |
| 2958 | 2955 | } |
| 2959 | 2956 | /* Set b4-b1 50Hz/60Hz state and manufacturer name defined by links on PCB */ |
| 2960 | 2957 | data |= (ppi_port_inputs[amstrad_ppi_PortB] & 0x1e); |
| r4255 | r4256 | |
| 3043 | 3040 | If keyboard matrix line 11-14 are selected, the byte is always &ff. |
| 3044 | 3041 | After testing on a real CPC, it is found that these never change, they always return &FF. */ |
| 3045 | 3042 | |
| 3046 | | static const char *const keynames[] = { "keyboard_row_0", "keyboard_row_1", "keyboard_row_2", "keyboard_row_3", "keyboard_row_4", |
| 3043 | static const char *const keynames[] = { "keyboard_row_0", "keyboard_row_1", "keyboard_row_2", "keyboard_row_3", "keyboard_row_4", |
| 3047 | 3044 | "keyboard_row_5", "keyboard_row_6", "keyboard_row_7", "keyboard_row_8", "keyboard_row_9", |
| 3048 | 3045 | "keyboard_row_10" }; |
| 3049 | 3046 | |
| 3050 | | if ( ( ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) > 10) |
| 3047 | if ( ( ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) > 10) |
| 3051 | 3048 | { |
| 3052 | 3049 | return 0xFF; |
| 3053 | | } |
| 3054 | | else |
| 3050 | } |
| 3051 | else |
| 3055 | 3052 | { |
| 3056 | 3053 | if(aleste_mode == 0x08 && ( ppi_port_outputs[amstrad_ppi_PortC] & 0x0F ) == 10) |
| 3057 | 3054 | return 0xff; |
| r4255 | r4256 | |
| 3213 | 3210 | static void amstrad_common_init(running_machine *machine) |
| 3214 | 3211 | { |
| 3215 | 3212 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 3216 | | |
| 3213 | |
| 3217 | 3214 | aleste_mode = 0; |
| 3218 | 3215 | |
| 3219 | 3216 | gate_array.mrer = 0; |
| r4255 | r4256 | |
| 3294 | 3291 | amstrad_common_init(machine); |
| 3295 | 3292 | amstrad_reset_machine(machine); |
| 3296 | 3293 | // amstrad_init_palette(machine); |
| 3297 | | |
| 3294 | |
| 3298 | 3295 | multiface_init(); |
| 3299 | 3296 | |
| 3300 | 3297 | } |
| r4255 | r4256 | |
| 3341 | 3338 | amstrad_plus_asic_ram[0x2805] = 0x01; // interrupt vector is undefined at startup, except that bit 0 is always 1. |
| 3342 | 3339 | AmstradCPC_GA_SetRamConfiguration(machine); |
| 3343 | 3340 | amstrad_GateArray_write(machine, 0x081); // Epyx World of Sports requires upper ROM to be enabled by default |
| 3344 | | |
| 3341 | |
| 3345 | 3342 | // multiface_init(); |
| 3346 | 3343 | } |
| 3347 | 3344 | |
src/mess/machine/ctronics.c
| r4255 | r4256 | |
| 33 | 33 | int busy;
|
| 34 | 34 | int ack;
|
| 35 | 35 | int auto_fd;
|
| 36 | int pe;
|
| 37 | int fault;
|
| 36 | 38 | |
| 37 | 39 | UINT8 data;
|
| 38 | 40 | };
|
| r4255 | r4256 | |
| 73 | 75 | {
|
| 74 | 76 | centronics_state *centronics = get_safe_token(device);
|
| 75 | 77 | const centronics_interface *intf = device->static_config;
|
| 76 | | char printer_tag[256];
|
| 77 | 78 | |
| 78 | 79 | /* validate some basic stuff */
|
| 79 | 80 | assert(device->static_config != NULL);
|
| 80 | 81 | |
| 81 | 82 | /* get printer device */
|
| 82 | | strcpy(printer_tag, device->tag);
|
| 83 | | strcat(printer_tag, "_p");
|
| 84 | | centronics->printer = devtag_get_device(device->machine, PRINTER, printer_tag);
|
| 85 | | |
| 83 | centronics->printer = devtag_get_device(device->machine, PRINTER, device->tag);
|
| 86 | 84 | assert(centronics->printer != NULL);
|
| 87 | 85 | |
| 88 | 86 | /* make sure it's running */
|
| r4255 | r4256 | |
| 107 | 105 | |
| 108 | 106 | static DEVICE_RESET( centronics )
|
| 109 | 107 | {
|
| 110 | | centronics_state *centronics = get_safe_token(device);
|
| 111 | | centronics->busy = printer_is_ready(centronics->printer) ? FALSE : TRUE;
|
| 112 | 108 | }
|
| 113 | 109 | |
| 114 | 110 | static DEVICE_SET_INFO( centronics )
|
| r4255 | r4256 | |
| 149 | 145 | ***************************************************************************/
|
| 150 | 146 | |
| 151 | 147 | /*-------------------------------------------------
|
| 152 | | update_busy_state - check printer device
|
| 153 | | status and update busy state
|
| 148 | centronics_printer_online - callback that
|
| 149 | sets us busy when the printer goes offline
|
| 154 | 150 | -------------------------------------------------*/
|
| 155 | 151 | |
| 156 | | static int update_busy_state(const device_config *device)
|
| 152 | void centronics_printer_online(const device_config *device, int state)
|
| 157 | 153 | {
|
| 158 | | centronics_state *centronics = get_safe_token(device);
|
| 159 | | centronics->busy = printer_is_ready(centronics->printer) ? FALSE : TRUE;
|
| 160 | | return centronics->busy;
|
| 154 | const device_config *c = devtag_get_device(device->machine, CENTRONICS, device->tag);
|
| 155 | centronics_state *centronics = get_safe_token(c);
|
| 156 | |
| 157 | /* when going online, set PE and FAULT high and BUSY low */
|
| 158 | centronics->pe = state;
|
| 159 | centronics->fault = state;
|
| 160 | centronics->busy = !state;
|
| 161 | 161 | }
|
| 162 | 162 | |
| 163 | 163 | |
| r4255 | r4256 | |
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | /*-------------------------------------------------
|
| 217 | set_line - helper to set individual bits
|
| 218 | -------------------------------------------------*/
|
| 219 | |
| 220 | static void set_line(const device_config *device, int line, int state)
|
| 221 | {
|
| 222 | centronics_state *centronics = get_safe_token(device);
|
| 223 | |
| 224 | if (state)
|
| 225 | centronics->data |= 1 << line;
|
| 226 | else
|
| 227 | centronics->data &= ~(1 << line);
|
| 228 | }
|
| 229 | |
| 230 | |
| 231 | /*-------------------------------------------------
|
| 232 | centronics_dx_w - write line dx print data
|
| 233 | -------------------------------------------------*/
|
| 234 | |
| 235 | WRITE_LINE_DEVICE_HANDLER( centronics_d0_w ) { set_line(device, 0, state); }
|
| 236 | WRITE_LINE_DEVICE_HANDLER( centronics_d1_w ) { set_line(device, 1, state); }
|
| 237 | WRITE_LINE_DEVICE_HANDLER( centronics_d2_w ) { set_line(device, 2, state); }
|
| 238 | WRITE_LINE_DEVICE_HANDLER( centronics_d3_w ) { set_line(device, 3, state); }
|
| 239 | WRITE_LINE_DEVICE_HANDLER( centronics_d4_w ) { set_line(device, 4, state); }
|
| 240 | WRITE_LINE_DEVICE_HANDLER( centronics_d5_w ) { set_line(device, 5, state); }
|
| 241 | WRITE_LINE_DEVICE_HANDLER( centronics_d6_w ) { set_line(device, 6, state); }
|
| 242 | WRITE_LINE_DEVICE_HANDLER( centronics_d7_w ) { set_line(device, 7, state); }
|
| 243 | |
| 244 | |
| 245 | /*-------------------------------------------------
|
| 217 | 246 | centronics_strobe_w - signal that data is
|
| 218 | 247 | ready
|
| 219 | 248 | -------------------------------------------------*/
|
| r4255 | r4256 | |
| 222 | 251 | {
|
| 223 | 252 | centronics_state *centronics = get_safe_token(device);
|
| 224 | 253 | |
| 225 | | /* ignore if we are busy */
|
| 226 | | if (state == FALSE && centronics->busy == FALSE)
|
| 254 | /* look for a high -> low transition */
|
| 255 | if (centronics->strobe == TRUE && state == FALSE && centronics->busy == FALSE)
|
| 227 | 256 | {
|
| 228 | 257 | /* STROBE has gone low, data is ready */
|
| 229 | 258 | timer_set(device->machine, ATTOTIME_IN_NSEC(250), centronics, TRUE, busy_callback);
|
| r4255 | r4256 | |
| 307 | 336 | |
| 308 | 337 | READ_LINE_DEVICE_HANDLER( centronics_pe_r )
|
| 309 | 338 | {
|
| 310 | | /* use the busy line as pe line for now */
|
| 311 | | return !update_busy_state(device);
|
| 339 | centronics_state *centronics = get_safe_token(device);
|
| 340 | return centronics->pe;
|
| 312 | 341 | }
|
| 313 | 342 | |
| 314 | 343 | |
| r4255 | r4256 | |
| 343 | 372 | |
| 344 | 373 | READ_LINE_DEVICE_HANDLER( centronics_fault_r )
|
| 345 | 374 | {
|
| 346 | | /* use the busy line as fault line for now */
|
| 347 | | return !update_busy_state(device);
|
| 375 | centronics_state *centronics = get_safe_token(device);
|
| 376 | return centronics->fault;
|
| 348 | 377 | }
|
src/mess/machine/ctronics.h
| r4255 | r4256 | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | /***************************************************************************
|
| 30 | | DEVICE CONFIGURATION MACROS
|
| 31 | | ***************************************************************************/
|
| 32 | | |
| 33 | | #define CENTRONICS DEVICE_GET_INFO_NAME(centronics)
|
| 34 | | |
| 35 | | #define MDRV_CENTRONICS_ADD(_tag, _intf) \
|
| 36 | | MDRV_PRINTER_ADD(_tag"_p") \
|
| 37 | | MDRV_DEVICE_ADD(_tag, CENTRONICS, 0) \
|
| 38 | | MDRV_DEVICE_CONFIG(_intf)
|
| 39 | | |
| 40 | | #define MDRV_CENTRONICS_REMOVE(_tag) \
|
| 41 | | MDRV_PRINTER_REMOVE(_tag"_p") \
|
| 42 | | MDRV_DEVICE_REMOVE(_tag, CENTRONICS)
|
| 43 | | |
| 44 | | |
| 45 | | /***************************************************************************
|
| 46 | 30 | FUNCTION PROTOTYPES
|
| 47 | 31 | ***************************************************************************/
|
| 48 | 32 | |
| r4255 | r4256 | |
| 50 | 34 | |
| 51 | 35 | WRITE8_DEVICE_HANDLER( centronics_data_w );
|
| 52 | 36 | |
| 37 | /* access to the individual bits */
|
| 38 | WRITE_LINE_DEVICE_HANDLER( centronics_d0_w );
|
| 39 | WRITE_LINE_DEVICE_HANDLER( centronics_d1_w );
|
| 40 | WRITE_LINE_DEVICE_HANDLER( centronics_d2_w );
|
| 41 | WRITE_LINE_DEVICE_HANDLER( centronics_d3_w );
|
| 42 | WRITE_LINE_DEVICE_HANDLER( centronics_d4_w );
|
| 43 | WRITE_LINE_DEVICE_HANDLER( centronics_d5_w );
|
| 44 | WRITE_LINE_DEVICE_HANDLER( centronics_d6_w );
|
| 45 | WRITE_LINE_DEVICE_HANDLER( centronics_d7_w );
|
| 46 | |
| 53 | 47 | WRITE_LINE_DEVICE_HANDLER( centronics_strobe_w );
|
| 54 | 48 | WRITE_LINE_DEVICE_HANDLER( centronics_prime_w );
|
| 55 | 49 | WRITE_LINE_DEVICE_HANDLER( centronics_init_w );
|
| r4255 | r4256 | |
| 62 | 56 | READ_LINE_DEVICE_HANDLER( centronics_vcc_r );
|
| 63 | 57 | READ_LINE_DEVICE_HANDLER( centronics_fault_r );
|
| 64 | 58 | |
| 59 | /* callback for the printer device */
|
| 60 | void centronics_printer_online(const device_config *device, int state);
|
| 65 | 61 | |
| 62 | |
| 66 | 63 | /***************************************************************************
|
| 64 | DEVICE CONFIGURATION MACROS
|
| 65 | ***************************************************************************/
|
| 66 | |
| 67 | #define CENTRONICS DEVICE_GET_INFO_NAME(centronics)
|
| 68 | |
| 69 | #define MDRV_CENTRONICS_ADD(_tag, _intf) \
|
| 70 | MDRV_PRINTER_ADD(_tag) \
|
| 71 | MDRV_PRINTER_ONLINE(centronics_printer_online) \
|
| 72 | MDRV_DEVICE_ADD(_tag, CENTRONICS, 0) \
|
| 73 | MDRV_DEVICE_CONFIG(_intf)
|
| 74 | |
| 75 | #define MDRV_CENTRONICS_REMOVE(_tag) \
|
| 76 | MDRV_PRINTER_REMOVE(_tag) \
|
| 77 | MDRV_DEVICE_REMOVE(_tag, CENTRONICS)
|
| 78 | |
| 79 | |
| 80 | /***************************************************************************
|
| 67 | 81 | DEFAULT INTERFACES
|
| 68 | 82 | ***************************************************************************/
|
| 69 | 83 | |
src/mess/devices/printer.c
| r4255 | r4256 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | /*------------------------------------------------- |
| 45 | DEVICE_IMAGE_LOAD( printer ) |
| 46 | -------------------------------------------------*/ |
| 44 | 47 | |
| 48 | static DEVICE_IMAGE_LOAD( printer ) |
| 49 | { |
| 50 | const printer_config *conf = image->inline_config; |
| 51 | |
| 52 | /* send notify that the printer is now online */ |
| 53 | if (conf != NULL && conf->online != NULL) |
| 54 | conf->online(image, TRUE); |
| 55 | |
| 56 | /* we don't need to do anything special */ |
| 57 | return INIT_PASS; |
| 58 | } |
| 59 | |
| 60 | |
| 45 | 61 | /*------------------------------------------------- |
| 62 | DEVICE_IMAGE_UNLOAD( printer ) |
| 63 | -------------------------------------------------*/ |
| 64 | |
| 65 | static DEVICE_IMAGE_UNLOAD( printer ) |
| 66 | { |
| 67 | const printer_config *conf = image->inline_config; |
| 68 | |
| 69 | /* send notify that the printer is now offline */ |
| 70 | if (conf != NULL && conf->online != NULL) |
| 71 | conf->online(image, FALSE); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | /*------------------------------------------------- |
| 46 | 76 | DEVICE_START(printer) |
| 47 | 77 | -------------------------------------------------*/ |
| 48 | 78 | |
| r4255 | r4256 | |
| 62 | 92 | { |
| 63 | 93 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 64 | 94 | case DEVINFO_INT_TOKEN_BYTES: info->i = 1; break; |
| 65 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 95 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(printer_config); break; |
| 66 | 96 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 67 | 97 | case DEVINFO_INT_IMAGE_TYPE: info->i = IO_PRINTER; break; |
| 68 | 98 | case DEVINFO_INT_IMAGE_READABLE: info->i = 0; break; |
| r4255 | r4256 | |
| 71 | 101 | |
| 72 | 102 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 73 | 103 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(printer); break; |
| 104 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(printer); break; |
| 105 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(printer); break; |
| 74 | 106 | |
| 75 | 107 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 76 | 108 | case DEVINFO_STR_NAME: strcpy(info->s, "Printer"); break; |
src/mess/drivers/amstrad.c
| r4255 | r4256 | |
| 78 | 78 | ---------------- |
| 79 | 79 | - CRTC all type support (0,1,2,3,4) ? |
| 80 | 80 | - Gate Array and CRTC aren't synchronised. (The Gate Array can change the color every microseconds?) So the multi-rasters in one line aren't supported (see yao demo p007's part)! |
| 81 | | - Implement full Asic for CPC+ emulation. Soft scroll is rather dodgy. 8-bit printer port (bit 3 of CRTC reg 12) not implemented. |
| 81 | - Implement full Asic for CPC+ emulation. Soft scroll is rather dodgy. |
| 82 | 82 | - The KC Compact should not reuse the gate array functionality. Instead z8536 support should be added. (bug #42) |
| 83 | 83 | |
| 84 | 84 | ******************************************************************************/ |
| r4255 | r4256 | |
| 88 | 88 | #include "includes/amstrad.h" |
| 89 | 89 | |
| 90 | 90 | /* Components */ |
| 91 | | #include "machine/centroni.h" |
| 92 | 91 | #include "machine/8255ppi.h" /* for 8255 ppi */ |
| 93 | 92 | #include "cpu/z80/z80.h" /* for cycle tables */ |
| 94 | 93 | #include "video/mc6845.h" /* CRTC */ |
| r4255 | r4256 | |
| 96 | 95 | #include "sound/ay8910.h" |
| 97 | 96 | #include "sound/wave.h" |
| 98 | 97 | #include "machine/mc146818.h" /* Aleste RTC */ |
| 98 | #include "machine/ctronics.h" |
| 99 | 99 | |
| 100 | 100 | /* Devices */ |
| 101 | 101 | #include "devices/dsk.h" /* for CPCEMU style disk images */ |
| 102 | 102 | #include "devices/basicdsk.h" /* for 720k MSX disk images (Aleste supports these) */ |
| 103 | | #include "includes/msx_slot.h" |
| 103 | #include "includes/msx_slot.h" |
| 104 | 104 | #include "includes/msx.h" /* MSX floppy device load */ |
| 105 | 105 | #include "devices/snapquik.h" |
| 106 | 106 | #include "devices/cartslot.h" |
| r4255 | r4256 | |
| 147 | 147 | aleste_interrupt, |
| 148 | 148 | NULL, |
| 149 | 149 | NULL, |
| 150 | | NEC765_RDY_PIN_CONNECTED |
| 150 | NEC765_RDY_PIN_CONNECTED |
| 151 | 151 | }; |
| 152 | 152 | |
| 153 | 153 | |
| r4255 | r4256 | |
| 541 | 541 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xC3\x96") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00D6) |
| 542 | 542 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('<') PORT_CHAR('>') |
| 543 | 543 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') |
| 544 | | |
| 544 | |
| 545 | 545 | PORT_MODIFY("keyboard_row_4") |
| 546 | 546 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') |
| 547 | 547 | INPUT_PORTS_END |
| r4255 | r4256 | |
| 550 | 550 | * The BIOS of the KC Compact would be able to recognize the keypresses |
| 551 | 551 | * generated by F5-F9. Unfortunately these keys are not present on the |
| 552 | 552 | * keyboard! Reference: http://www.cepece.info/amstrad/docs/kcc/kcc01.jpg |
| 553 | | * |
| 553 | * |
| 554 | 554 | */ |
| 555 | 555 | static INPUT_PORTS_START( kccomp ) |
| 556 | 556 | PORT_INCLUDE(amstrad_keyboard) |
| r4255 | r4256 | |
| 578 | 578 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 579 | 579 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR('\\') PORT_CHAR('`') |
| 580 | 580 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2) |
| 581 | | |
| 581 | |
| 582 | 582 | PORT_INCLUDE(crtc_links) |
| 583 | 583 | INPUT_PORTS_END |
| 584 | 584 | |
| r4255 | r4256 | |
| 680 | 680 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) |
| 681 | 681 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) |
| 682 | 682 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) |
| 683 | | |
| 683 | |
| 684 | 684 | PORT_START("keyboard_row_7") |
| 685 | 685 | PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED) |
| 686 | 686 | |
| r4255 | r4256 | |
| 878 | 878 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 879 | 879 | |
| 880 | 880 | /* printer */ |
| 881 | | MDRV_PRINTER_ADD("printer") |
| 881 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 882 | 882 | |
| 883 | 883 | /* snapshot */ |
| 884 | 884 | MDRV_SNAPSHOT_ADD(amstrad, "sna", 0) |
| 885 | 885 | |
| 886 | 886 | MDRV_CASSETTE_ADD( "cassette", amstrad_cassette_config ) |
| 887 | | |
| 887 | |
| 888 | 888 | MDRV_NEC765A_ADD("nec765", amstrad_nec765_interface) |
| 889 | 889 | MACHINE_DRIVER_END |
| 890 | 890 | |
| r4255 | r4256 | |
| 934 | 934 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 935 | 935 | |
| 936 | 936 | /* printer */ |
| 937 | | MDRV_PRINTER_ADD("printer") |
| 937 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 938 | 938 | |
| 939 | 939 | /* snapshot */ |
| 940 | 940 | MDRV_SNAPSHOT_ADD(amstrad, "sna", 0) |
| 941 | 941 | |
| 942 | 942 | MDRV_CASSETTE_ADD( "cassette", amstrad_cassette_config ) |
| 943 | | |
| 943 | |
| 944 | 944 | MDRV_NEC765A_ADD("nec765", amstrad_nec765_interface) |
| 945 | | |
| 945 | |
| 946 | 946 | MDRV_IMPORT_FROM(cpcplus_cartslot) |
| 947 | 947 | MACHINE_DRIVER_END |
| 948 | 948 | |
| r4255 | r4256 | |
| 1158 | 1158 | |
| 1159 | 1159 | |
| 1160 | 1160 | static SYSTEM_CONFIG_START( gx4000 ) |
| 1161 | | CONFIG_RAM_DEFAULT(64 * 1024) // has 64k RAM |
| 1161 | CONFIG_RAM_DEFAULT(64 * 1024) // has 64k RAM |
| 1162 | 1162 | SYSTEM_CONFIG_END |
| 1163 | 1163 | |
| 1164 | 1164 | |