Previous 199869 Revisions Next

r32454 Sunday 28th September, 2014 at 21:18:51 UTC by Tafoid
If #includes are not in source, code should not exist in source.  (nw)
[src/mess/drivers]rainbow.c
[src/mess/includes]hp48.h
[src/mess/machine]hp48.c thomson.c

trunk/src/mess/machine/hp48.c
r32453r32454
5858
5959
6060
61#ifdef CHARDEV
62#include "devices/chardev.h"
63#endif
6461
6562
6663/***************************************************************************
r32453r32454
135132   /* protocol action */
136133   //if ( xmodem && xmodem->exists() ) xmodem_receive_byte( &xmodem->device(), param );
137134   //else if ( kermit && kermit->exists() ) kermit_receive_byte( &kermit->device(), param );
138//#ifdef CHARDEV
139//  else chardev_out( m_chardev, param );
140//#endif
141135}
142136
143137/* CPU initiates a send event */
r32453r32454
156150}
157151
158152
159#ifdef CHARDEV
160153
161TIMER_CALLBACK_MEMBER(hp48_state::hp48_chardev_byte_recv_cb)
162{
163   UINT8 data = chardev_in( m_chardev );
164154
165   LOG_SERIAL(( "%f hp48_chardev_byte_recv_cb: end of receive, data=%02x\n",
166            machine().time().as_double(), data ));
167
168   m_io[0x14] = data & 0xf; /* receive zone */
169   m_io[0x15] = data >> 4;
170   m_io[0x11] &= ~2; /* clear byte receiving */
171   m_io[0x11] |= 1;  /* set byte received */
172
173   /* interrupt */
174   if ( m_io[0x10] & 2 )
175   {
176      hp48_pulse_irq( SATURN_IRQ_LINE );
177   }
178}
179
180void hp48_state::hp48_chardev_start_recv_byte( chardev_err status )
181{
182   if ( status != CHARDEV_OK ) return;
183
184   LOG_SERIAL(( "%f hp48_chardev_start_recv_byte: start receiving\n",
185            machine().time().as_double() ));
186
187   m_io[0x11] |= 2;  /* set byte receiving */
188
189   /* interrupt */
190   if ( m_io[0x10] & 1 )
191   {
192      hp48_pulse_irq( SATURN_IRQ_LINE );
193   }
194
195   /* schedule end of reception */
196   machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_chardev_byte_recv_cb),this));
197}
198
199void hp48_state::hp48_chardev_ready_to_send(  )
200{
201   m_io[0x12] &= ~3;
202
203   /* interrupt */
204   if ( m_io[0x10] & 4 )
205   {
206      hp48_pulse_irq( SATURN_IRQ_LINE );
207   }
208}
209
210static const chardev_interface hp48_chardev_iface =
211{ hp48_chardev_start_recv_byte, hp48_chardev_ready_to_send };
212
213#endif
214
215
216155/* ------ Saturn's IN / OUT registers ---------- */
217156
218157
r32453r32454
11991138   machine().save().register_postload( save_prepost_delegate(FUNC(hp48_state::hp48_update_annunciators), this ));
12001139   machine().save().register_postload( save_prepost_delegate(FUNC(hp48_state::hp48_apply_modules), this ));
12011140
1202#ifdef CHARDEV
1203   /* direct I/O */
1204   m_chardev = chardev_open_pty( machine(), &hp48_chardev_iface );
1205#endif
12061141}
12071142
12081143
trunk/src/mess/machine/thomson.c
r32453r32454
10181018   (using, e.g., character device special files on some UNIX).
10191019*/
10201020
1021#ifdef CHARDEV
1022
1023#include "devices/chardev.h"
1024
10251021/* Features an EF 6850 ACIA
10261022
10271023   MIDI protocol is a serial asynchronous protocol
r32453r32454
10381034*/
10391035
10401036
1041static UINT8 to7_midi_status;   /* 6850 status word */
1042static UINT8 to7_midi_overrun;  /* pending overrun */
1043static UINT8 to7_midi_intr;     /* enabled interrupts */
1044
1045static chardev* to7_midi_chardev;
1046
1047
1048
1049void thomson_state::to7_midi_update_irq (  )
1050{
1051   if ( (to7_midi_intr & 4) && (to7_midi_status & ACIA_6850_RDRF) )
1052      to7_midi_status |= ACIA_6850_irq; /* byte received interrupt */
1053
1054   if ( (to7_midi_intr & 4) && (to7_midi_status & ACIA_6850_OVRN) )
1055      to7_midi_status |= ACIA_6850_irq; /* overrun interrupt */
1056
1057   if ( (to7_midi_intr & 3) == 1 && (to7_midi_status & ACIA_6850_TDRE) )
1058      to7_midi_status |= ACIA_6850_irq; /* ready to transmit interrupt */
1059
1060   thom_irq_4( machine, to7_midi_status & ACIA_6850_irq );
1061}
1062
1063
1064
1065void thomson_state::to7_midi_byte_received_cb( chardev_err s )
1066{
1067   to7_midi_status |= ACIA_6850_RDRF;
1068   if ( s == CHARDEV_OVERFLOW )
1069      to7_midi_overrun = 1;
1070   to7_midi_update_irq( machine );
1071}
1072
1073
1074
1075void thomson_state::to7_midi_ready_to_send_cb(  )
1076{
1077   to7_midi_status |= ACIA_6850_TDRE;
1078   to7_midi_update_irq( machine );
1079}
1080
1081
1082
10831037READ8_MEMBER( thomson_state::to7_midi_r )
10841038{
1085   /* ACIA 6850 registers */
1086
1087   switch ( offset )
1088   {
1089   case 0: /* get status */
1090      /* bit 0:     data received */
1091      /* bit 1:     ready to transmit data */
1092      /* bit 2:     data carrier detect (ignored) */
1093      /* bit 3:     clear to send (ignored) */
1094      /* bit 4:     framing error (ignored) */
1095      /* bit 5:     overrun */
1096      /* bit 6:     parity error (ignored) */
1097      /* bit 7:     interrupt */
1098      LOG_MIDI(( "%s %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
1099            space.machine().describe_context(), space.machine().time().as_double(), to7_midi_status,
1100            (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
1101            (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0,
1102            (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
1103            (to7_midi_status & ACIA_6850_irq) ? 1 : 0 ));
1104      return to7_midi_status;
1105
1106
1107   case 1: /* get input data */
1108   {
1109            UINT8 data = chardev_in( to7_midi_chardev );
1110            if ( !space.debugger_access() )
1111            {
1112                  to7_midi_status &= ~(ACIA_6850_irq | ACIA_6850_RDRF);
1113                  if ( to7_midi_overrun )
1114                        to7_midi_status |= ACIA_6850_OVRN;
1115                  else
1116                        to7_midi_status &= ~ACIA_6850_OVRN;
1117                  to7_midi_overrun = 0;
1118                  LOG_MIDI(( "%s %f to7_midi_r: read data $%02X\n",
1119                           space.machine().describe_context(), space.machine().time().as_double(), data ));
1120                  to7_midi_update_irq();
1121            }
1122            return data;
1123   }
1124
1125
1126   default:
1127      logerror( "%s to7_midi_r: invalid offset %i\n",
1128            space.machine().describe_context(),  offset );
1129      return 0;
1130   }
1131}
1132
1133
1134
1135WRITE8_MEMBER( thomson_state::to7_midi_w )
1136{
1137   /* ACIA 6850 registers */
1138
1139   switch ( offset )
1140   {
1141   case 0: /* set control */
1142      /* bits 0-1: clock divide (ignored) or reset */
1143      if ( (data & 3) == 3 )
1144      {
1145         /* reset */
1146         LOG_MIDI(( "%s %f to7_midi_w: reset (data=$%02X)\n", space.machine().describe_context(), space.machine().time().as_double(), data ));
1147         to7_midi_overrun = 0;
1148         to7_midi_status = 2;
1149         to7_midi_intr = 0;
1150         chardev_reset( to7_midi_chardev );
1151      }
1152      else
1153      {
1154         /* bits 2-4: parity  */
1155         /* bits 5-6: interrupt on transmit */
1156         /* bit 7:    interrupt on receive */
1157         to7_midi_intr = data >> 5;
1158         {
1159            static const int bits[8] = { 7,7,7,7,8,8,8,8 };
1160            static const int stop[8] = { 2,2,1,1,2,1,1,1 };
1161            static const char parity[8] = { 'e','o','e','o','-','-','e','o' };
1162            LOG_MIDI(( "%s %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
1163                  space.machine().describe_context(), space.machine().time().as_double(),
1164                  data,
1165                  bits[ (data >> 2) & 7 ],
1166                  stop[ (data >> 2) & 7 ],
1167                  parity[ (data >> 2) & 7 ],
1168                  to7_midi_intr >> 2,
1169                  (to7_midi_intr & 3) ? 1 : 0));
1170         }
1171      }
1172      to7_midi_update_irq( );
1173      break;
1174
1175
1176   case 1: /* output data */
1177      LOG_MIDI(( "%s %f to7_midi_w: write data $%02X\n", space.machine().describe_context(), space.machine().time().as_double(), data ));
1178      if ( data == 0x55 )
1179         /* cable-detect: shortcut */
1180         chardev_fake_in( to7_midi_chardev, 0x55 );
1181      else
1182      {
1183         /* send to MIDI */
1184         to7_midi_status &= ~(ACIA_6850_irq | ACIA_6850_TDRE);
1185         chardev_out( to7_midi_chardev, data );
1186      }
1187      break;
1188
1189
1190   default:
1191      logerror( "%s to7_midi_w: invalid offset %i (data=$%02X) \n", space.machine().describe_context(), offset, data );
1192   }
1193}
1194
1195
1196
1197static const chardev_interface to7_midi_interface =
1198{
1199   to7_midi_byte_received_cb,
1200   to7_midi_ready_to_send_cb,
1201};
1202
1203
1204
1205void thomson_state::to7_midi_reset(  )
1206{
1207   LOG (( "to7_midi_reset called\n" ));
1208   to7_midi_overrun = 0;
1209   to7_midi_status = 0;
1210   to7_midi_intr = 0;
1211   chardev_reset( to7_midi_chardev );
1212}
1213
1214
1215
1216void thomson_state::to7_midi_init(  )
1217{
1218   LOG (( "to7_midi_init\n" ));
1219   to7_midi_chardev = chardev_open( &machine, "/dev/snd/midiC0D0", "/dev/snd/midiC0D1", &to7_midi_interface );
1220   save_item(NAME(to7_midi_status );
1221   save_item(NAME(to7_midi_overrun );
1222   save_item(NAME(to7_midi_intr );
1223}
1224
1225
1226
1227#else
1228
1229
1230
1231READ8_MEMBER( thomson_state::to7_midi_r )
1232{
12331039   logerror( "to7_midi_r: not implemented\n" );
12341040   return 0;
12351041}
r32453r32454
12571063
12581064
12591065
1260#endif
1261
1262
1263
12641066/* ------------ init / reset ------------ */
12651067
12661068
trunk/src/mess/includes/hp48.h
r32453r32454
66
77**********************************************************************/
88
9#ifdef CHARDEV
10#include "devices/chardev.h"
11#endif
129#include "sound/dac.h"
1310/* model */
1411typedef enum {
r32453r32454
7774   UINT16 m_crc;
7875   UINT8 m_timer1;
7976   UINT32 m_timer2;
80#ifdef CHARDEV
81   chardev* m_chardev;
82#endif
8377   UINT8 m_screens[ HP48_NB_SCREENS ][ 64 ][ 144 ];
8478   int m_cur_screen;
8579   UINT8* m_rom;
trunk/src/mess/drivers/rainbow.c
r32453r32454
196196// WORKAROUNDS:
197197// (1) FORCE LOGO: - not valid for 100-A ROM -
198198//#define FORCE_RAINBOW_B_LOGO
199// (2) KEYBOARD_WORKAROUND : also requires FORCE...LOGO !
200//#define KEYBOARD_WORKAROUND
201//#define KBD_DELAY 8500
202199
203200// ----------------------------------------------------------------------------------------------
204201#include "emu.h"
r32453r32454
226223public:
227224   rainbow_state(const machine_config &mconfig, device_type type, const char *tag) :
228225      driver_device(mconfig, type, tag),
229#ifdef KEYBOARD_WORKAROUND
230   #include "m_kbd1.c" // KEYBOARD_WORKAROUND
231#endif
232226      m_inp1(*this, "W13"),
233227      m_inp2(*this, "W14"),
234228      m_inp3(*this, "W15"),
r32453r32454
291285
292286   DECLARE_WRITE_LINE_MEMBER(irq_hi_w);
293287
294#ifdef KEYBOARD_WORKAROUND
295   #include "port9x_Ax.c" // KEYBOARD_WORKAROUND
296#endif
297288   UINT32 screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
298289   INTERRUPT_GEN_MEMBER(vblank_irq);
299290   DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock);
r32453r32454
317308      IRQ_8088_MAX
318309   };
319310
320#ifdef KEYBOARD_WORKAROUND
321   #include "m_kbd2.c" // KEYBOARD_WORKAROUND
322#endif
323311   required_ioport m_inp1;
324312   required_ioport m_inp2;
325313   required_ioport m_inp3;
r32453r32454
430418      rom[0xf437b] = 0xeb;
431419#endif
432420
433#ifdef KEYBOARD_WORKAROUND
434   #include "rainbow_keyboard0.c"
435#endif
436421}
437422
438423static ADDRESS_MAP_START( rainbow8088_map, AS_PROGRAM, 8, rainbow_state)
r32453r32454
534519   // ===========================================================
535520   // 0x70 -> 0x7f ***** EXTENDED COMM. OPTION / Option Select 4.
536521   // ===========================================================
537#ifdef KEYBOARD_WORKAROUND
538   #include "am_range_9x_Ax.c" // KEYBOARD_WORKAROUND
539#endif
540522ADDRESS_MAP_END
541523
542524static ADDRESS_MAP_START(rainbowz80_mem, AS_PROGRAM, 8, rainbow_state)
r32453r32454
559541/* DIP switches */
560542static INPUT_PORTS_START( rainbow100b_in )
561543
562#ifdef KEYBOARD_WORKAROUND
563   #include "rainbow_ipt.c"
564#endif
565544      PORT_START("MONITOR TYPE")
566545      PORT_DIPNAME( 0x03, 0x03, "MONOCHROME MONITOR")
567546PORT_DIPSETTING(0x01, "WHITE")
r32453r32454
695674
696675}
697676
698#ifdef KEYBOARD_WORKAROUND
699   #include "rainbow_keyboard2.c"
700#endif
701677
702678UINT32 rainbow_state::screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
703679{

Previous 199869 Revisions Next


© 1997-2024 The MAME Team