Previous 199869 Revisions Next

r31101 Wednesday 25th June, 2014 at 17:21:36 UTC by Tafoid
pve500.c - multiplex signals for the 7seg display from Felipe Sanches (nw)
[src/mess/drivers]pve500.c

trunk/src/mess/drivers/pve500.c
r31100r31101
88  Driver by Felipe Correa da Silva Sanches <juca@members.fsf.org>
99  Technical info at https://www.garoa.net.br/wiki/PVE-500
1010
11  Notes:
12  One can induce the self-diagnose by booting the device holding LEARN and P2-RESET buttons togheter
13  With the default keyboard map, this can be done by holding keys L and S while pressing F3.
14   (Don't forget to unlock the keyboard by using the UI TOGGLE key)
15
16   This self-diagnose routine displays the value C817, which is the checksum value of the subcpu ROM
17  and afterwards it displays the following message:
18
19  SELFdIAG Error___ _F3 F3_CtC3c
20
21  which means it detected an error in the CTC circuitry (it means we're emulating it wrong!)
22  F3 is the coordinate of the subcpu EEPROM chip in the PCB.
23
24   According to the service manual, this error code means: "ICF3 CTC CH-3 counter operation failure (No interruption)"
25
26  Known issues:
27  There's still an annoying blinking in the 7-seg display.
28
1129  Changelog:
1230
31    2014 JUN 24 [Felipe Sanches]:
32   * figured out the multiplexing signals for the 7seg display
33
34    2014 JUN 23 [Felipe Sanches]:
35   * hooked-up the RS422 ports
36
1337   2014 JAN 14 [Felipe Sanches]:
1438   * Initial driver skeleton
1539*/
1640
41#define LOG_7SEG_DISPLAY_SIGNALS 0
42#define DEBUGGING_INDUCE_SELFDIAGNOSE 0
43
1744#include "emu.h"
1845#include "cpu/z80/tmpz84c015.h"
1946#include "sound/beep.h"
r31100r31101
203230   io_LE = 0;
204231   io_SEL = 0;
205232   io_KY = 0;
206
207   for (int i=0; i<27; i++)
208      output_set_digit_value(i, 0x00);
209233}
210234
211235void pve500_state::machine_reset()
r31100r31101
217241
218242READ8_MEMBER(pve500_state::dualport_ram_left_r)
219243{
220   printf("dualport_ram: Left READ\n");
244   //printf("dualport_ram: Left READ\n");
221245   m_subcpu->trg1(1); //(INT_Right)
222246   return dualport_7FE_data;
223247}
224248
225249WRITE8_MEMBER(pve500_state::dualport_ram_left_w)
226250{
227   printf("dualport_ram: Left WRITE\n");
251   //printf("dualport_ram: Left WRITE\n");
228252   dualport_7FF_data = data;
229253   m_subcpu->trg1(0); //(INT_Right)
230254}
231255
232256READ8_MEMBER(pve500_state::dualport_ram_right_r)
233257{
234   printf("dualport_ram: Right READ\n");
258   //printf("dualport_ram: Right READ\n");
235259   m_maincpu->trg1(1); //(INT_Left)
236260   return dualport_7FF_data;
237261}
238262
239263WRITE8_MEMBER(pve500_state::dualport_ram_right_w)
240264{
241   printf("dualport_ram: Right WRITE\n");
265   //printf("dualport_ram: Right WRITE\n");
242266   dualport_7FE_data = data;
243267   m_maincpu->trg1(0); //(INT_Left)
244268}
245269
246270READ8_MEMBER(pve500_state::io_expander_r)
247271{
248   printf("READ IO_EXPANDER_PORT%c\n", 'A'+offset);
272//   printf("READ IO_EXPANDER_PORT%c\n", 'A'+offset);
249273   switch (offset){
250274      case IO_EXPANDER_PORTA:
251275         return io_SC;
r31100r31101
253277         return io_LE;
254278      case IO_EXPANDER_PORTC:
255279         io_KY = 0x00;
256         if (io_SC & 0x01) io_KY |= ioport("SCAN0")->read();
257         if (io_SC & 0x02) io_KY |= ioport("SCAN1")->read();
258         if (io_SC & 0x04) io_KY |= ioport("SCAN2")->read();
259         if (io_SC & 0x08) io_KY |= ioport("SCAN3")->read();
260         if (io_SC & 0x10) io_KY |= ioport("SCAN4")->read();
261         if (io_SC & 0x20) io_KY |= ioport("SCAN5")->read();
262         if (io_SC & 0x40) io_KY |= ioport("SCAN6")->read();
263         if (io_SC & 0x80) io_KY |= ioport("SCAN7")->read();
280         if (!BIT(io_SC, 0)) io_KY |= ioport("SCAN0")->read();
281         if (!BIT(io_SC, 1)) io_KY |= ioport("SCAN1")->read();
282         if (!BIT(io_SC, 2)) io_KY |= ioport("SCAN2")->read();
283         if (!BIT(io_SC, 3)) io_KY |= ioport("SCAN3")->read();
284         if (!BIT(io_SC, 4)) io_KY |= ioport("SCAN4")->read();
285         if (!BIT(io_SC, 5)) io_KY |= ioport("SCAN5")->read();
286         if (!BIT(io_SC, 6)) io_KY |= ioport("SCAN6")->read();
287         if (!BIT(io_SC, 7)) io_KY |= ioport("SCAN7")->read();
288#if DEBUGGING_INDUCE_SELFDIAGNOSE
289         io_KY = 0x42; //according to procedure described in the service manual
290#endif
264291         return io_KY;
265292      case IO_EXPANDER_PORTD:
266293         return io_LD;
r31100r31101
273300
274301WRITE8_MEMBER(pve500_state::io_expander_w)
275302{
303   static int LD_data[4];
304   int swap[4] = {2,1,0,3};
276305   switch (offset){
277306      case IO_EXPANDER_PORTA:
278         printf("io_expander_w: PORTA (io_SC=%02X)\n", data);
307#if LOG_7SEG_DISPLAY_SIGNALS
308printf("io_expander_w: PORTA (io_SC=%02X)\n", data);
309#endif
279310         io_SC = data;
311
312         for (int j=0; j<8; j++){
313            if (!BIT(io_SC,j)){
314               for (int i=0; i<4; i++)
315                  output_set_digit_value(8*swap[i] + j, LD_data[i]);
316            }
317         }
280318         break;
281319      case IO_EXPANDER_PORTB:
320#if LOG_7SEG_DISPLAY_SIGNALS
282321         printf("io_expander_w: PORTB (io_LE=%02X)\n", data);
322#endif
283323         io_LE = data;
284324         break;
285325      case IO_EXPANDER_PORTC:
326#if LOG_7SEG_DISPLAY_SIGNALS
286327         printf("io_expander_w: PORTC (io_KY=%02X)\n", data);
328#endif
287329         io_KY = data;
288330         break;
289331      case IO_EXPANDER_PORTD:
332#if LOG_7SEG_DISPLAY_SIGNALS
290333         printf("io_expander_w: PORTD (io_LD=%02X)\n", data);
334#endif
291335         io_LD = data;
292336         break;
293337      case IO_EXPANDER_PORTE:
338#if LOG_7SEG_DISPLAY_SIGNALS
339         printf("io_expander_w PORTE (io_SEL=%02X)\n", data);
340#endif
294341         io_SEL = data;
295         printf("io_expander_w PORTE (io_SEL=%02X)\n", data);
296342         for (int i=0; i<4; i++){
297            if (io_SEL & (1 << i)){
298               for (int j=0; j<8; j++){
299                  if (io_SC & (1<<j)){
300                     output_set_digit_value(8*i + j, BITSWAP8(io_LD & 0x7F, 7, 0, 1, 2, 3, 4, 5, 6));
301                  }
302               }
343            if (BIT(io_SEL, i)){
344               LD_data[i] = 0x7F & BITSWAP8(io_LD ^ 0xFF, 7, 0, 1, 2, 3, 4, 5, 6);
303345            }
304346         }
305347         break;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team