src/mess/machine/svi318.c
| r4313 | r4314 | |
| 13 | 13 | #include "machine/8255ppi.h" |
| 14 | 14 | #include "machine/ins8250.h" |
| 15 | 15 | #include "machine/wd17xx.h" |
| 16 | #include "machine/ctronics.h" |
| 16 | 17 | #include "devices/basicdsk.h" |
| 17 | | #include "devices/printer.h" |
| 18 | 18 | #include "devices/cassette.h" |
| 19 | 19 | #include "formats/svi_cas.h" |
| 20 | 20 | #include "sound/dac.h" |
| r4313 | r4314 | |
| 43 | 43 | UINT8 bankHigh2_read_only; |
| 44 | 44 | /* keyboard */ |
| 45 | 45 | UINT8 keyboard_row; |
| 46 | | /* printer */ |
| 47 | | UINT8 prn_data; |
| 48 | | UINT8 prn_strobe; |
| 49 | 46 | /* SVI-806 80 column card */ |
| 50 | 47 | UINT8 svi806_present; |
| 51 | 48 | UINT8 svi806_ram_enabled; |
| r4313 | r4314 | |
| 189 | 186 | static READ8_DEVICE_HANDLER ( svi318_ppi_port_b_r ) |
| 190 | 187 | { |
| 191 | 188 | int row; |
| 192 | | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", |
| 189 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", |
| 193 | 190 | "LINE6", "LINE7", "LINE8", "LINE9", "LINE10" }; |
| 194 | 191 | |
| 195 | 192 | row = svi.keyboard_row; |
| r4313 | r4314 | |
| 256 | 253 | ppi8255_w(device, offset + 2, data); |
| 257 | 254 | } |
| 258 | 255 | |
| 259 | | /* Printer port */ |
| 260 | 256 | |
| 261 | | static const device_config *printer_image(running_machine *machine) |
| 262 | | { |
| 263 | | return devtag_get_device(machine, PRINTER, "printer"); |
| 264 | | } |
| 265 | | |
| 266 | | static WRITE8_HANDLER( svi318_printer_w ) |
| 267 | | { |
| 268 | | if (!offset) |
| 269 | | svi.prn_data = data; |
| 270 | | else |
| 271 | | { |
| 272 | | if ( (svi.prn_strobe & 1) && !(data & 1) ) |
| 273 | | printer_output(printer_image(space->machine), svi.prn_data); |
| 274 | | |
| 275 | | svi.prn_strobe = data; |
| 276 | | } |
| 277 | | } |
| 278 | | |
| 279 | | static READ8_HANDLER( svi318_printer_r ) |
| 280 | | { |
| 281 | | return printer_is_ready(printer_image(space->machine)) ? 0xfe:0xff; /* 0xfe if printer is ready to work */ |
| 282 | | } |
| 283 | | |
| 284 | 257 | /* PSG */ |
| 285 | 258 | |
| 286 | 259 | /* |
| r4313 | r4314 | |
| 786 | 759 | READ8_HANDLER( svi318_io_ext_r ) |
| 787 | 760 | { |
| 788 | 761 | UINT8 data = 0xff; |
| 789 | | device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x"); |
| 762 | const device_config *fdc = devtag_get_device(space->machine, WD179X, "wd179x"); |
| 763 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 790 | 764 | |
| 791 | 765 | if (svi.bankLow == SVI_CART) { |
| 792 | 766 | return 0xff; |
| 793 | 767 | } |
| 794 | 768 | |
| 795 | | switch( offset ) { |
| 769 | switch( offset ) |
| 770 | { |
| 796 | 771 | case 0x12: |
| 797 | | data = svi318_printer_r(space, 0); |
| 772 | data = 0xfe | centronics_busy_r(printer); |
| 798 | 773 | break; |
| 799 | 774 | |
| 800 | 775 | case 0x20: |
| r4313 | r4314 | |
| 846 | 821 | |
| 847 | 822 | WRITE8_HANDLER( svi318_io_ext_w ) |
| 848 | 823 | { |
| 849 | | device_config *fdc = (device_config*)devtag_get_device(space->machine, WD179X, "wd179x"); |
| 850 | | |
| 824 | const device_config *fdc = devtag_get_device(space->machine, WD179X, "wd179x"); |
| 825 | const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics"); |
| 826 | |
| 851 | 827 | if (svi.bankLow == SVI_CART) { |
| 852 | 828 | return; |
| 853 | 829 | } |
| 854 | 830 | |
| 855 | | switch( offset ) { |
| 831 | switch( offset ) |
| 832 | { |
| 856 | 833 | case 0x10: |
| 834 | centronics_data_w(printer, 0, data); |
| 835 | break; |
| 836 | |
| 857 | 837 | case 0x11: |
| 858 | | svi318_printer_w(space, offset & 1, data); |
| 838 | centronics_strobe_w(printer, BIT(data, 0)); |
| 859 | 839 | break; |
| 860 | 840 | |
| 861 | 841 | case 0x20: |
src/mess/drivers/svi318.c
| r4313 | r4314 | |
| 17 | 17 | #include "video/tms9928a.h" |
| 18 | 18 | #include "machine/8255ppi.h" |
| 19 | 19 | #include "machine/wd17xx.h" |
| 20 | #include "machine/ctronics.h" |
| 20 | 21 | #include "devices/basicdsk.h" |
| 21 | | #include "devices/printer.h" |
| 22 | 22 | #include "devices/cartslot.h" |
| 23 | 23 | #include "devices/cassette.h" |
| 24 | 24 | #include "formats/svi_cas.h" |
| r4313 | r4314 | |
| 106 | 106 | - "Stop" is mapped to 'End' |
| 107 | 107 | - "Select" is mapped to 'F11' |
| 108 | 108 | - "CLS/HM" is mapped to 'Home' |
| 109 | | TODO: How are multiple keys (Copy, Cut, Paste, CLS/HM) expected to |
| 109 | TODO: How are multiple keys (Copy, Cut, Paste, CLS/HM) expected to |
| 110 | 110 | behave? Do they need multiple mapping in natural keyboard? |
| 111 | 111 | */ |
| 112 | 112 | |
| r4313 | r4314 | |
| 312 | 312 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 313 | 313 | |
| 314 | 314 | /* printer */ |
| 315 | | MDRV_PRINTER_ADD("printer") |
| 315 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 316 | 316 | |
| 317 | 317 | MDRV_CASSETTE_ADD( "cassette", svi318_cassette_config ) |
| 318 | | |
| 318 | |
| 319 | 319 | MDRV_WD179X_ADD("wd179x", svi_wd17xx_interface ) |
| 320 | | |
| 320 | |
| 321 | 321 | MDRV_IMPORT_FROM( svi318_cartslot ) |
| 322 | 322 | MACHINE_DRIVER_END |
| 323 | 323 | |
| r4313 | r4314 | |
| 391 | 391 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 392 | 392 | |
| 393 | 393 | /* printer */ |
| 394 | | MDRV_PRINTER_ADD("printer") |
| 394 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 395 | 395 | |
| 396 | 396 | MDRV_CASSETTE_ADD( "cassette", svi318_cassette_config ) |
| 397 | | |
| 397 | |
| 398 | 398 | MDRV_WD179X_ADD("wd179x", svi_wd17xx_interface ) |
| 399 | | |
| 399 | |
| 400 | 400 | MDRV_IMPORT_FROM( svi318_cartslot ) |
| 401 | 401 | MACHINE_DRIVER_END |
| 402 | 402 | |