Previous 15994 Revisions Next

r4272 Tuesday 17th February, 2009 at 16:30:55 UTC by Dirk Best
[THOMSON] Updated to use the new centronics support
[docs]messnew.txt
[src/mess/drivers]thomson.c
[src/mess/includes]thomson.h
[src/mess/machine]ctronics.c ctronics.h thomson.c

src/mess/includes/thomson.h
r4271r4272
1717#include "machine/6551.h"
1818#include "sound/dac.h"
1919#include "audio/mea8000.h"
20#include "machine/ctronics.h"
2021#include "devices/cartslot.h"
21#include "machine/centroni.h"
22#include "devices/printer.h"
2322#include "includes/serial.h"
2423#include "devices/cassette.h"
2524#include "machine/wd17xx.h"
r4271r4272
8180extern MACHINE_START ( to7 );
8281extern MACHINE_RESET ( to7 );
8382
83/* centronics */
84extern const centronics_interface to7_centronics_config;
85extern const centronics_interface mo6_centronics_config;
86
8487/* timer */
8588extern const mc6846_interface to7_timer;
8689
src/mess/machine/thomson.c
r4271r4272
1010#include "devices/thomflop.h"
1111#include "formats/thom_dsk.h"
1212#include "includes/thomson.h"
13#include "machine/ctronics.h"
1314
1415#define VERBOSE       0
1516#define VERBOSE_IRQ   0
1617#define VERBOSE_KBD   0  /* TO8 / TO9 / TO9+ keyboard */
1718#define VERBOSE_BANK  0
1819#define VERBOSE_VIDEO 0  /* video & lightpen */
19#define VERBOSE_IO    0  /* serial & parallel I/O */
20#define VERBOSE_IO    1  /* serial & parallel I/O */
2021#define VERBOSE_MIDI  0
2122
2223#define PRINT(x) mame_printf_info x
r4271r4272
562563{
563564   thom_set_mode_point( device->machine, data & 1 );          /* bit 0: video bank switch */
564565   thom_set_caps_led( device->machine, (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */
565   thom_set_border_color( device->machine,
566   thom_set_border_color( device->machine,
566567                ((data & 0x10) ? 1 : 0) |           /* bits 4-6: border color */
567568                ((data & 0x20) ? 2 : 0) |
568569                ((data & 0x40) ? 4 : 0) );
r4271r4272
675676      int keyline = pia_get_output_b( THOM_PIA_SYS );
676677      UINT8 val = 0xff;
677678      int i;
678      static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
679      static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
679680                                 "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" };
680     
681
681682      for ( i = 0; i < 8; i++ )
682683      {
683684         if ( ! (keyline & (1 << i)) )
r4271r4272
730731
731732static const device_config *printer_device(running_machine *machine)
732733{
733   return devtag_get_device(machine, PRINTER, "printer");
734   return devtag_get_device(machine, PRINTER, "centronics");
734735}
735736
736737/* test whether a parallel or a serial device is connected: both cannot
r4271r4272
747748
748749
749750
750static void to7_io_ack ( running_machine *machine, int n, int data, int mask )
751static WRITE_LINE_DEVICE_HANDLER( to7_io_ack )
751752{
752   /* acknowledge from centronics printer to PIA */
753   int ack = (data & CENTRONICS_ACKNOWLEDGE) ? 1 : 0;
753   pia_set_input_cb1(THOM_PIA_IO, state);
754754   //LOG_IO (( "%f to7_io_ack: CENTRONICS new state $%02X (ack=%i)\n", attotime_to_double(timer_get_time(machine)), data, ack ));
755   pia_set_input_cb1( THOM_PIA_IO, ack );
756755}
757756
758757
r4271r4272
774773
775774
776775
777static READ8_HANDLER ( to7_io_porta_in )
776static READ8_HANDLER( to7_io_porta_in )
778777{
778   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
779779   int cts = 1;
780780   int dsr = ( to7_io_line.input_state & SERIAL_STATE_DSR ) ? 0 : 1;
781781   int rd  = get_in_data_bit( to7_io_line.input_state );
r4271r4272
783783   if ( to7_io_mode(space->machine) == TO7_IO_RS232 )
784784      cts = to7_io_line.input_state & SERIAL_STATE_CTS ? 0 : 1;
785785   else
786      cts = ( centronics_read_handshake( space->machine, 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0;
786      cts = !centronics_busy_r(printer);
787787
788788   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to7_io_mode(space->machine), cts, dsr, rd ));
789789
r4271r4272
792792
793793
794794
795static WRITE8_HANDLER ( to7_io_portb_out )
795static WRITE8_HANDLER( to7_io_portb_out )
796796{
797   /* set 8-bit data */
797   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
798798
799799   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
800800
801   centronics_write_data( space->machine, 0, data );
801   /* set 8-bit data */
802   centronics_data_w(printer, 0, data);
802803}
803804
804805
805806
806static WRITE8_HANDLER ( to7_io_cb2_out )
807static WRITE8_HANDLER( to7_io_cb2_out )
807808{
808   /* send STROBE to printer */
809   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
809810
810811   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
811812
812   centronics_write_handshake( space->machine, 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
813   /* send STROBE to printer */
814   centronics_strobe_w(printer, data);
813815}
814816
815817
r4271r4272
832834};
833835
834836
835
836static const CENTRONICS_CONFIG to7_centronics = { PRINTER_CENTRONICS, to7_io_ack };
837
838
839
840static void thom_centronics_reset( running_machine *machine )
837const centronics_interface to7_centronics_config =
841838{
842   centronics_write_handshake
843      ( machine, 0,
844        CENTRONICS_SELECT | CENTRONICS_NOT_BUSY | CENTRONICS_STROBE,
845        CENTRONICS_SELECT | CENTRONICS_NO_RESET | CENTRONICS_NOT_BUSY |
846        CENTRONICS_STROBE | CENTRONICS_ACKNOWLEDGE );
839   FALSE,
840   DEVCB_LINE(to7_io_ack),
841   DEVCB_NULL,
842   DEVCB_NULL
843};
847844
848   centronics_write_handshake ( machine, 0, CENTRONICS_NO_RESET, CENTRONICS_NO_RESET );
849}
850845
851
852
853846static void to7_io_reset( running_machine *machine )
854847{
855848   LOG (( "to7_io_reset called\n" ));
856   thom_centronics_reset(machine);
849
857850   /* pia_reset() is called in MACHINE_RESET */
858851   pia_set_port_a_z_mask( THOM_PIA_IO, 0x03 );
859852   to7_io_line.input_state = SERIAL_STATE_CTS;
r4271r4272
869862{
870863   LOG (( "to7_io_init: CC 90-323 serial / parallel extension\n" ));
871864   pia_config( machine, THOM_PIA_IO, &to7_io );
872   centronics_config( machine, 0, &to7_centronics );
873865   serial_connection_init( machine, &to7_io_line );
874866   serial_connection_set_in_callback( machine, &to7_io_line, to7_io_in_cb );
875867}
r4271r4272
930922
931923ACIA6850_INTERFACE( to7_modem )
932924{
933   1200,
925   1200,
934926   1200, /* 1200 bauds, might be divided by 16 */
935927   DEVCB_LINE(to7_modem_rx_r), /*&to7_modem_rx,*/
936928   DEVCB_LINE(to7_modem_tx_w), /*&to7_modem_tx,*/
937   DEVCB_NULL,
938   DEVCB_NULL,
939929   DEVCB_NULL,
930   DEVCB_NULL,
931   DEVCB_NULL,
940932   DEVCB_LINE(to7_modem_cb)
941933};
942934
r4271r4272
971963
972964READ8_HANDLER ( to7_modem_mea8000_r )
973965{
974   if ( input_port_read(space->machine, "mconfig") & 1 )
966   if ( input_port_read(space->machine, "mconfig") & 1 )
975967   {
976968      const device_config* device = devtag_get_device(space->machine, MEA8000, "mea8000" );
977969      return mea8000_r( device, offset );
978970   }
979971   else
980   {   
972   {
981973      const device_config* device = devtag_get_device(space->machine, ACIA6850, "acia6850" );
982974      switch (offset) {
983975      case 0: return acia6850_stat_r( device, offset );
r4271r4272
998990   }
999991   else
1000992   {
1001      const device_config* device = devtag_get_device(space->machine, ACIA6850, "acia6850" );     
993      const device_config* device = devtag_get_device(space->machine, ACIA6850, "acia6850" );
1002994      switch (offset) {
1003995      case 0: acia6850_ctrl_w( device, offset, data );
1004996      case 1: acia6850_data_w( device, offset, data );
r4271r4272
15671559static READ8_HANDLER ( to770_sys_porta_in )
15681560{
15691561   /* keyboard */
1570   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
1562   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
15711563                              "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" };
15721564   int keyline = pia_get_output_b( THOM_PIA_SYS ) & 7;
1573   
1565
15741566   return input_port_read(space->machine, keynames[7 - keyline]);
15751567}
15761568
r4271r4272
16531645{
16541646   thom_set_mode_point( device->machine, data & 1 );          /* bit 0: video bank switch */
16551647   thom_set_caps_led( device->machine, (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */
1656   thom_set_border_color( device->machine,
1648   thom_set_border_color( device->machine,
16571649                ((data & 0x10) ? 1 : 0) |          /* 4-bit border color */
16581650                ((data & 0x20) ? 2 : 0) |
16591651                ((data & 0x40) ? 4 : 0) |
r4271r4272
18661858   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
18671859   int col = (portb >> 1) & 7;       /* key column */
18681860   int lin = 7 - ((portb >> 4) & 7); /* key line */
1869   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
1861   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
18701862                              "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" };
1871   
1863
18721864   return ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ? 0x80 : 0;
18731865}
18741866
r4271r4272
25272519{
25282520   int line, bit;
25292521   UINT8 port;
2530   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
2522   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
25312523                              "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" };
25322524
25332525   for ( line = 0; line < 10; line++ )
r4271r4272
27612753   int shift   = ! (input_port_read(machine, "keyboard_9") & 1);
27622754   int key = -1, line, bit;
27632755   UINT8 port;
2764   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
2756   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
27652757                              "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" };
27662758
27672759   for ( line = 0; line < 10; line++ )
r4271r4272
29442936/* afaik, P2-P7 are not connected, so, the warning about undefined 0xf0 can be safely ignored */
29452937
29462938
2947
2948static void to9_update_centronics ( running_machine *machine )
2949{
2950   UINT8 a = pia_get_output_a( THOM_PIA_SYS );
2951   UINT8 b = pia_get_output_b( THOM_PIA_SYS );
2952   UINT8 data = (a & 0xfe) | (b & 1);
2953   centronics_write_data( machine, 0, data );
2954   centronics_write_handshake( machine, 0, (b & 2) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
2955
2956   LOG_IO(( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n",
2957        cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), data,
2958        (b & 2) ? 1 : 0 ));
2959}
2960
2961
2962
29632939static READ8_HANDLER ( to9_sys_porta_in )
29642940{
29652941   UINT8 ktest = to9_kbd_ktest(space->machine);
r4271r4272
29732949
29742950static WRITE8_HANDLER ( to9_sys_porta_out )
29752951{
2976   to9_update_centronics(space->machine); /* bits 1-7: printer */
2952   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
2953   centronics_data_w(printer, 0, data & 0xfe);
29772954}
29782955
29792956
29802957
29812958static WRITE8_HANDLER ( to9_sys_portb_out )
29822959{
2983   to9_update_centronics(space->machine); /* bits 0-1: printer */
2960   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
2961
2962   centronics_d0_w(printer, BIT(data, 0));
2963   centronics_strobe_w(printer, BIT(data, 1));
2964
29842965   to9_update_ram_bank(space->machine);
29852966
29862967   if ( data & 4 ) /* bit 2: video overlay (TODO) */
r4271r4272
29982979};
29992980
30002981
3001static const CENTRONICS_CONFIG to9_centronics = { PRINTER_CENTRONICS, NULL };
30022982
30032983
30042984
r4271r4272
30393019   to7_game_reset(machine);
30403020   to9_floppy_reset(machine);
30413021   to9_kbd_reset(machine);
3042   thom_centronics_reset(machine);
30433022   to7_modem_reset(machine);
30443023   to7_midi_reset(machine);
30453024
r4271r4272
30713050   /* subsystems */
30723051   thom_irq_init(machine);
30733052   pia_config( machine, THOM_PIA_SYS, &to9_sys );
3074   centronics_config( machine, 0, &to9_centronics );
30753053   to7_game_init(machine);
30763054   to9_floppy_init( machine, mem + 0xe000, mem + 0x40000 );
30773055   to9_kbd_init(machine);
r4271r4272
31643142{
31653143   int line, bit;
31663144   UINT8 port;
3167   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
3145   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
31683146                              "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" };
31693147
31703148   if ( input_port_read(machine, "config") & 2 )
r4271r4272
31963174   int shift   = (input_port_read(machine, "keyboard_9") & 1) ? 0 : 0x080;
31973175   int key = -1, line, bit;
31983176   UINT8 port;
3199   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
3177   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
32003178                              "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" };
3201   
3179
32023180   if ( input_port_read(machine, "config") & 2 )
32033181      return -1; /* disabled */
32043182
r4271r4272
35893567      }
35903568   }
35913569
3592   if ( mess_ram_size == 512*1024 || bank < 16 )
3570   if ( mess_ram_size == 512*1024 || bank < 16 )
35933571   {
35943572      memory_set_bank( machine, THOM_CART_BANK, bank );
35953573   }
r4271r4272
38973875
38983876static WRITE8_HANDLER ( to8_sys_portb_out )
38993877{
3900   to9_update_centronics(space->machine); /* bits 0-1: printer */
3878   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
3879
3880   centronics_d0_w(printer, BIT(data, 0));
3881   centronics_strobe_w(printer, BIT(data, 1));
3882
39013883   to8_update_ram_bank(space->machine);
39023884
39033885   if ( data & 4 ) /* bit 2: video overlay (TODO) */
r4271r4272
39223904
39233905static READ8_DEVICE_HANDLER ( to8_timer_port_in )
39243906{
3907   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
39253908   int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0;
39263909   int cass = to7_get_cassette(device->machine) ? 0x80 : 0;
3927   int dtr = (centronics_read_handshake( device->machine, 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40;
3910   int dtr = centronics_busy_r(printer) << 6;
39283911   int lock = to8_kbd_caps ? 0 : 8; /* undocumented! */
39293912   return lightpen | cass | dtr | lock;
39303913}
r4271r4272
39953978   to7_game_reset(machine);
39963979   to8_floppy_reset(machine);
39973980   to8_kbd_reset(machine);
3998   thom_centronics_reset(machine);
39993981   to7_modem_reset(machine);
40003982   to7_midi_reset(machine);
40013983
r4271r4272
40384020   /* subsystems */
40394021   thom_irq_init(machine);
40404022   pia_config( machine, THOM_PIA_SYS, &to8_sys );
4041   centronics_config( machine, 0, &to9_centronics );
40424023   to7_game_init(machine);
40434024   to8_floppy_init(machine);
40444025   to8_kbd_init(machine);
r4271r4272
41124093
41134094static READ8_DEVICE_HANDLER ( to9p_timer_port_in )
41144095{
4096   const device_config *printer = devtag_get_device(device->machine, CENTRONICS, "centronics");
41154097   int lightpen = (input_port_read(device->machine, "lightpen_button") & 1) ? 2 : 0;
41164098   int cass = to7_get_cassette(device->machine) ? 0x80 : 0;
4117   int dtr = (centronics_read_handshake( device->machine, 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40;
4099   int dtr = centronics_busy_r(printer) << 6;
41184100   return lightpen | cass | dtr;
41194101}
41204102
r4271r4272
41564138   to7_game_reset(machine);
41574139   to8_floppy_reset(machine);
41584140   to9_kbd_reset(machine);
4159   thom_centronics_reset(machine);
41604141   to7_modem_reset(machine);
41614142   to7_midi_reset(machine);
41624143
r4271r4272
41994180   /* subsystems */
42004181   thom_irq_init(machine);
42014182   pia_config( machine, THOM_PIA_SYS, &to9p_sys );
4202   centronics_config( machine, 0, &to9_centronics );
42034183   to7_game_init(machine);
42044184   to8_floppy_init( machine );
42054185   to9_kbd_init(machine);
r4271r4272
44044384/* similar to SX 90-018, but with a few differences: mute, printer */
44054385
44064386
4407
4408static WRITE8_HANDLER ( mo6_game_porta_out )
4387static WRITE_LINE_DEVICE_HANDLER( mo6_centronics_busy )
44094388{
4410   /* centronics data */
4411   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
4412   centronics_write_data( space->machine, 0, data );
4389   pia_set_input_cb1(THOM_PIA_GAME, state);
44134390}
44144391
44154392
4393const centronics_interface mo6_centronics_config =
4394{
4395   FALSE,
4396   DEVCB_NULL,
4397   DEVCB_LINE(mo6_centronics_busy),
4398   DEVCB_NULL
4399};
44164400
4417static READ8_HANDLER ( mo6_game_cb1_in )
4401
4402static WRITE8_HANDLER ( mo6_game_porta_out )
44184403{
4419   int dtr = ( centronics_read_handshake( space->machine, 0 ) & CENTRONICS_NOT_BUSY ) ? 0 : 1;
4420   /* note: printer busy signal replaces button */
4421   LOG (( "$%04x %f mo6_game_cb1_in: CENTRONICS get dtr=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), dtr ));
4422   return dtr;
4404   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
4405
4406   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
4407
4408   /* centronics data */
4409   centronics_data_w(printer, 0, data);
44234410}
44244411
44254412
44264413
44274414static WRITE8_HANDLER ( mo6_game_cb2_out )
44284415{
4429   /* centronics strobe */
4416   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
4417
44304418   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
4431   centronics_write_handshake( space->machine, 0, data ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
4419
4420   /* centronics strobe */
4421   centronics_strobe_w(printer, data);
44324422}
44334423
44344424
r4271r4272
44364426static const pia6821_interface mo6_game =
44374427{
44384428   to7_game_porta_in, to7_game_portb_in,
4439   NULL, mo6_game_cb1_in, NULL, NULL,
4429   NULL, NULL, NULL, NULL,
44404430   mo6_game_porta_out, to7_game_portb_out, NULL, mo6_game_cb2_out,
44414431   thom_irq_1, thom_irq_1
44424432};
r4271r4272
45084498   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
45094499   int col = (portb >> 4) & 7;    /* B bits 4-6: kbd column */
45104500   int lin = (portb >> 1) & 7;    /* B bits 1-3: kbd line */
4511   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
4501   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3", "keyboard_4",
45124502                              "keyboard_5", "keyboard_6", "keyboard_7", "keyboard_8", "keyboard_9" };
45134503
45144504   if ( ! (porta & 8) )
45154505      lin = 8;     /* A bit 3: 9-th kbd line select */
45164506
45174507   return
4518      ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ?  0x80 : 0;
4508      ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ?  0x80 : 0;
45194509   /* bit 7: key up */
45204510}
45214511
r4271r4272
47434733   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x75 );
47444734   mo6_game_reset(machine);
47454735   to7_floppy_reset(machine);
4746   thom_centronics_reset(machine);
47474736   to7_modem_reset(machine);
47484737   to7_midi_reset(machine);
47494738   mo5_init_timer(machine);
r4271r4272
47834772   /* subsystems */
47844773   thom_irq_init(machine);
47854774   pia_config( machine, THOM_PIA_SYS, &mo6_sys );
4786   centronics_config( machine, 0, &to9_centronics );
47874775   mo6_game_init(machine);
47884776   to7_floppy_init( machine, mem + 0x30000 );
47894777   to9_palette_init(machine);
r4271r4272
48704858*/
48714859
48724860
4873
4874READ8_HANDLER ( mo5nr_prn_r )
4861READ8_HANDLER( mo5nr_prn_r )
48754862{
4876   switch ( offset )
4877   {
4863   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
4864   UINT8 result = 0;
48784865
4879   case 1:
4880      return centronics_read_data( space->machine, 0 );
4866   result |= !centronics_busy_r(printer) << 7;
48814867
4882   case 3:
4883      /* TODO: understand other bits */
4884      if ( centronics_read_handshake( space->machine, 0 ) & CENTRONICS_NOT_BUSY )
4885         return 0;
4886      else
4887         return 0x80;
4888
4889   default:
4890      logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset );
4891      return 0;
4892   }
4868   return result;
48934869}
48944870
48954871
4896
4897WRITE8_HANDLER ( mo5nr_prn_w )
4872WRITE8_HANDLER( mo5nr_prn_w )
48984873{
4899   switch ( offset )
4900   {
4874   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
49014875
4902   case 1:
4903      centronics_write_data( space->machine, 0, data );
4904      break;
4905
4906   case 3:
4907      /* TODO: understand other bits */
4908      centronics_write_handshake( space->machine, 0, ( data & 8 ) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
4909      break;
4910
4911   default:
4912      logerror( "$%04x %f mo5nr_prn_w: unhandled to reg %i (data=$%02X)\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset, data );
4913   }
4876   /* TODO: understand other bits */
4877   centronics_strobe_w(printer, BIT(data, 3));
49144878}
49154879
49164880
r4271r4272
49254889   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
49264890   int col = (portb >> 4) & 7;    /* B bits 4-6: kbd column */
49274891   int lin = (portb >> 1) & 7;    /* B bits 1-3: kbd line */
4928   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
4892   static const char *const keynames[] = { "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
49294893                              "keyboard_4", "keyboard_5", "keyboard_6", "keyboard_7" };
4930   
4931   return ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ? 0x80 : 0;
4894
4895   return ( input_port_read(space->machine, keynames[lin]) & (1 << col) ) ? 0x80 : 0;
49324896   /* bit 7: key up */
49334897}
49344898
r4271r4272
50104974   pia_set_port_a_z_mask( THOM_PIA_SYS, 0x65 );
50114975   mo5nr_game_reset(machine);
50124976   to7_floppy_reset(machine);
5013   thom_centronics_reset(machine);
50144977   to7_modem_reset(machine);
50154978   to7_midi_reset(machine);
50164979   mo5_init_timer(machine);
r4271r4272
50505013   /* subsystems */
50515014   thom_irq_init(machine);
50525015   pia_config( machine, THOM_PIA_SYS, &mo5nr_sys );
5053   centronics_config( machine, 0, &to9_centronics );
50545016   mo5nr_game_init(machine);
50555017   to7_floppy_init( machine, mem + 0x30000 );
50565018   to9_palette_init(machine);
src/mess/machine/ctronics.c
r4271r4272
180180      printer_output(centronics->printer, centronics->data);
181181
182182      /* timer to return BUSY to low, 5us max */
183      timer_set(machine, ATTOTIME_IN_USEC(4), ptr, FALSE, busy_callback);
183      timer_set(machine, ATTOTIME_IN_USEC(5), ptr, FALSE, busy_callback);
184184   }
185185}
186186
r4271r4272
197197   if (param == TRUE)
198198   {
199199      /* timer to turn ACK low to receive data */
200      timer_set(machine, ATTOTIME_IN_NSEC(250), ptr, FALSE, ack_callback);
200      timer_set(machine, ATTOTIME_IN_USEC(1), ptr, FALSE, ack_callback);
201201   }
202202   else
203203   {
204204      /* timer to return ACK to high state, 5us max */
205      timer_set(machine, ATTOTIME_IN_USEC(4), ptr, TRUE, ack_callback);
205      timer_set(machine, ATTOTIME_IN_USEC(5), ptr, TRUE, ack_callback);
206206   }
207207}
208208
r4271r4272
219219
220220
221221/*-------------------------------------------------
222    centronics_data_r - return current data
223-------------------------------------------------*/
224
225READ8_DEVICE_HANDLER( centronics_data_r )
226{
227   centronics_state *centronics = get_safe_token(device);
228   return centronics->data;
229}
230
231
232/*-------------------------------------------------
222233    set_line - helper to set individual bits
223234-------------------------------------------------*/
224235
r4271r4272
260271   if (centronics->strobe == TRUE && state == FALSE && centronics->busy == FALSE)
261272   {
262273      /* STROBE has gone low, data is ready */
263      timer_set(device->machine, ATTOTIME_IN_NSEC(250), centronics, TRUE, busy_callback);
274      timer_set(device->machine, ATTOTIME_IN_USEC(1), centronics, TRUE, busy_callback);
264275   }
265276
266277   centronics->strobe = state;
src/mess/machine/ctronics.h
r4271r4272
3333DEVICE_GET_INFO( centronics );
3434
3535WRITE8_DEVICE_HANDLER( centronics_data_w );
36READ8_DEVICE_HANDLER( centronics_data_r );
3637
3738/* access to the individual bits */
3839WRITE_LINE_DEVICE_HANDLER( centronics_d0_w );
src/mess/drivers/thomson.c
r4271r4272
7373*/
7474
7575#include "includes/thomson.h"
76#include "machine/ctronics.h"
7677
7778
7879/**************************** common *******************************/
r4271r4272
698699     MDRV_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.) /* speech synthesis */
699700
700701/* printer */
701     MDRV_PRINTER_ADD("printer")
702     MDRV_CENTRONICS_ADD("centronics", to7_centronics_config)
702703
703704/* cassette */
704705     MDRV_CASSETTE_ADD( "cassette", to7_cassette_config )
r4271r4272
720721
721722/* modem */
722723     MDRV_ACIA6850_ADD( "acia6850", to7_modem )
723     
724
724725     MDRV_WD2793_ADD("wd2793", default_wd17xx_interface )
725   
726
726727   /* cartridge */
727728   MDRV_CARTSLOT_ADD("cart")
728729   MDRV_CARTSLOT_EXTENSION_LIST("m7,rom")
r4271r4272
11181119     MDRV_CASSETTE_MODIFY( "cassette", mo5_cassette_config )
11191120
11201121     MDRV_MC6846_REMOVE( "mc6846" )
1121     
1122
11221123   MDRV_CARTSLOT_MODIFY("cart")
11231124   MDRV_CARTSLOT_EXTENSION_LIST("m5,rom")
11241125   MDRV_CARTSLOT_LOAD(mo5_cartridge)
r4271r4272
14691470     MDRV_CPU_MODIFY( "main" )
14701471     MDRV_CPU_PROGRAM_MAP ( to9, 0 )
14711472
1473   MDRV_CENTRONICS_REMOVE("centronics")
1474   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
1475
14721476     MDRV_MC6846_MODIFY( "mc6846", to9_timer )
14731477MACHINE_DRIVER_END
14741478
r4271r4272
17031707     MDRV_CPU_MODIFY( "main" )
17041708     MDRV_CPU_PROGRAM_MAP ( to8, 0 )
17051709
1710   MDRV_CENTRONICS_REMOVE("centronics")
1711   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
1712
17061713     MDRV_MC6846_MODIFY( "mc6846", to8_timer )
17071714MACHINE_DRIVER_END
17081715
r4271r4272
18581865     MDRV_CPU_MODIFY( "main" )
18591866     MDRV_CPU_PROGRAM_MAP ( to9p, 0 )
18601867
1868   MDRV_CENTRONICS_REMOVE("centronics")
1869   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
1870
18611871     MDRV_MC6846_MODIFY( "mc6846", to9p_timer )
18621872MACHINE_DRIVER_END
18631873
r4271r4272
22052215     MDRV_CPU_PROGRAM_MAP ( mo6, 0 )
22062216
22072217     MDRV_MC6846_REMOVE( "mc6846" )
2208     
2218
2219   MDRV_CENTRONICS_REMOVE("centronics")
2220   MDRV_CENTRONICS_ADD("centronics", mo6_centronics_config)
2221
22092222   MDRV_CARTSLOT_MODIFY("cart")
22102223   MDRV_CARTSLOT_EXTENSION_LIST("m5,rom")
22112224   MDRV_CARTSLOT_LOAD(mo5_cartridge)
r4271r4272
22632276     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
22642277     AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE ( mo5nr_net_r, mo5nr_net_w )
22652278     AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w )
2266     AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_READWRITE ( mo5nr_prn_r, mo5nr_prn_w )
2279     AM_RANGE ( 0xa7e1, 0xa7e1 ) AM_DEVREADWRITE(CENTRONICS, "centronics", centronics_data_r, centronics_data_w)
2280     AM_RANGE ( 0xa7e3, 0xa7e3 ) AM_READWRITE ( mo5nr_prn_r, mo5nr_prn_w )
22672281     AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r,
22682282                  mo6_gatearray_w )
22692283     AM_RANGE ( 0xa7e8, 0xa7eb ) AM_DEVREADWRITE(ACIA6551, "acia",  acia_6551_r, acia_6551_w )
r4271r4272
24352449     MDRV_CPU_PROGRAM_MAP ( mo5nr, 0 )
24362450
24372451     MDRV_MC6846_REMOVE( "mc6846" )
2438     
2452
2453   MDRV_CENTRONICS_REMOVE("centronics")
2454   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
2455
24392456   MDRV_CARTSLOT_MODIFY("cart")
24402457   MDRV_CARTSLOT_EXTENSION_LIST("m5,rom")
24412458   MDRV_CARTSLOT_LOAD(mo5_cartridge)
docs/messnew.txt
r4271r4272
5454
5555- [SORDM5] Updated to use the new centronics support.  [Dirk Best]
5656
57- [THOMSON] Updated to use the new centronics support.  [Dirk Best]
58
5759- [TI81, TI85, TI86] Added the new ROM_DEFAULT_BIOS feature to select the most
5860  recent rom versions.  [Hobie Troxell]
5961

Previous 15994 Revisions Next


© 1998-2018 The MESS Team