Previous 15994 Revisions Next

r6903 Sunday 3rd January, 2010 at 18:50:06 UTC by Miodrag Milanović
[MICRONIQUE]
- Fixed keyboard management
- Joystick remapped
- Timings for cassette adjusted [JJStacino]
[src/mess/drivers]hec2hrp.c interact.c
[src/mess/formats]hect_tap.c
[src/mess/includes]hec2hrp.h hectorkey.h
[src/mess/machine]hec2hrp.c

src/mess/includes/hectorkey.h
r6902r6903
1///////////////////////////////////////////////////////////////  Hectorkey.H
2// Thank's Daniel !
3/*      Hector 2HR+
4        Victor
5        Hector 2HR
6        Hector HRX
7        Hector MX40c
8        Hector MX80c
9        Hector 1
10        Interact
11
12        29/10/2009 Update skeleton to functional machine
13                          by yo_fr       (jj.stac@aliceadsl.fr)
14
15               => add Keyboard,
16               => add color,
17               => add cassette,
18               => add sn76477 sound and 1bit sound,
19               => add joysticks (stick, pot, fire)
20               => add BR/HR switching
21               => add bank switch for HRX
22               => add device MX80c and bank switching for the ROM
23    Importante note : the keyboard function add been piked from
24                      DChector project : http://dchector.free.fr/ made by DanielCoulom
25                      (thank's Daniel)
26    TODO : Add the cartridge function,
27           Adjust the one shot and A/D timing (sn76477)
28*/
29static const UINT8 hectorkey[0x100] = {
30
31///////////////////////////////////////// 0x00-0x0f
320xff, //0
330x00, //1= ESC --> Reset machine
340x11, //2=   1 --> 1
350x10, //3=   2 --> 2
360x27, //4=   3 --> 3
370x26, //5=   4 --> 4
380x25, //6=   5 --> 5
390x24, //7=   6 --> 6
400x23, //8=   7 --> 7
410x22, //9=   8 --> 8
420x21, //a=   9 --> 9
430x12, //b=   0 --> 0
440x15, //c=   ) --> -
450x17, //d=   = --> +
460x04, //e=BACK --> BACK
470x03, //f= TAB --> TAB
48
49///////////////////////////////////////// 0x10-0x1f
500x31, //0=   A --> A
510x60, //1=   Z --> Z
520x45, //2=   E --> E
530x50, //3=   R --> R
540x66, //4=   T --> T
550x61, //5=   Y --> Y
560x65, //6=   U --> U
570x41, //7=   I --> I
580x53, //8=   O --> O
590x52, //9=   P --> P
600xff, //a=   ^
610x35, //b=   $ --> =
620x02, //c= ENT --> RETURN
630x06, //d=CTRL --> CTRL
640x51, //e=   Q --> Q
650x67, //f=   S --> S
66
67///////////////////////////////////////// 0x20-0x2f
680x46, //0=   D --> D
690x44, //1=   F --> F
700x43, //2=   G --> G
710x42, //3=   H --> H
720x40, //4=   J --> J
730x57, //5=   K --> K
740x56, //6=   L --> L
750x55, //7=   M --> M
760x13, //8=   % --> /
770x08, //9=   ?? --> manette 0 ACTION
780x07, //a= MAJ --> SHIFT
790x00, //b=   * --> *
800x63, //c=   W --> W
810x62, //d=   X --> X
820x47, //e=   C --> C
830x64, //f=   V --> V
84
85///////////////////////////////////////// 0x30-0x3f
860x30, //0=   B --> B
870x54, //1=   N --> N
880x16, //2=   , --> ,
890x37, //3=   ; --> ;
900x14, //4=   : --> .
910x33, //5=   ! --> ?
920xff, //6= MAJ
930xff, //7
940xff, //8
950x01, //9=  SP --> SPACE
960x05, //a=LOCK --> LOCK
970xff, //b=  F1
980xff, //c=  F2
990xff, //d=  F3
1000xff, //e=  F4
1010xff, //f=  F5
102
103///////////////////////////////////////// 0x40-0x4f
1040xff, //0
1050xff, //1
1060xff, //2
1070xff, //3
1080xff, //4
1090xff, //5
1100xff, //6
1110x74, //7=   7 --> manette 1 GAUCHE
1120x77, //8=   8 --> manette 1 BAS
1130x75, //9=   9 --> manette 1 DROITE
1140x09, //a=   - --> manette 1 ACTION
1150x0b, //b=   <- --> pot0-
1160x72, //c=   5 --> manette 0 HAUT
1170x0a, //d=   <- --> pot0+
1180x08, //e=   + --> manette 0 ACTION
1190x70, //f=   1 --> manette 0 GAUCHE
120
121///////////////////////////////////////// 0x50-0x5f
1220x73, //0=   2 --> manette 0 BAS
1230x71, //1=   3 --> manette 0 DROITE
1240x0e, //2= INS --> pot1 ++
1250x0f, //3=SUPP -->^pot1 --
1260xff, //4
1270xff, //5
1280xff, //6    < -->
1290xff, //7
1300xff, //8
1310xff, //9
1320xff, //a
1330xff, //b
1340xff, //c
1350xff, //d
1360xff, //e
1370xff, //f
138
139///////////////////////////////////////// 0x60-0x6f
1400xff, //0=
1410xff, //1
1420xff, //2
1430xff, //3
1440xff, //4
1450xff, //5
1460xff, //6
1470xff, //7
1480xff, //8
1490xff, //9
1500xff, //a
1510xff, //b
1520xff, //c
1530xff, //d
1540xff, //e
1550xff, //f
156
157///////////////////////////////////////// 0x70-0x7f
1580xff, //0
1590xff, //1
1600xff, //2
1610xff, //3
1620xff, //4
1630xff, //5
1640xff, //6
1650xff, //7
1660xff, //8
1670xff, //9
1680xff, //a
1690xff, //b
1700xff, //c
1710xff, //d
1720xff, //e
1730xff, //f
174
175///////////////////////////////////////// 0x80-0x8f
1760xff, //0
1770xff, //1
1780xff, //2
1790xff, //3
1800xff, //4
1810xff, //5
1820xff, //6
1830xff, //7
1840xff, //8
1850xff, //9
1860xff, //a
1870xff, //b
1880xff, //c
1890xff, //d
1900xff, //e
1910xff, //f
192
193///////////////////////////////////////// 0x90-0x9f
1940xff, //0
1950xff, //1
1960xff, //2
1970xff, //3
1980xff, //4
1990xff, //5
2000xff, //6
2010xff, //7
2020xff, //8
2030xff, //9
2040xff, //a
2050xff, //b
2060x08, //c= ENT --> manette 0 ACTION
2070xff, //d= CTRL droit
2080xff, //e
2090xff, //f
210
211///////////////////////////////////////// 0xa0-0xaf
2120xff, //0
2130xff, //1
2140xff, //2
2150xff, //3
2160xff, //4
2170xff, //5
2180xff, //6
2190xff, //7
2200xff, //8
2210xff, //9
2220xff, //a
2230xff, //b
2240xff, //c
2250xff, //d
2260xff, //e
2270xff, //f
228
229///////////////////////////////////////// 0xb0-0xbf
2300xff, //0
2310xff, //1
2320xff, //2
2330xff, //3
2340xff, //4
2350x76, //5=   / --> manette 1 HAUT
2360xff, //6
2370xff, //7
2380xff, //8
2390xff, //9
2400xff, //a
2410xff, //b
2420xff, //c
2430xff, //d
2440xff, //e
2450xff, //f
246
247///////////////////////////////////////// 0xc0-0xcf
2480xff, //0
2490xff, //1
2500xff, //2
2510xff, //3
2520xff, //4
2530xff, //5
2540xff, //6
2550xff, //7=HOME
2560x0d, //8=  UP
2570x0f, //9= PUP
2580xff, //a
2590xff, //b
2600xff, //c
2610xff, //d
2620xff, //e
2630xff, //f= END
264
265///////////////////////////////////////// 0xd0-0xdf
2660x0c, //0=DOWN
2670x0e, //1=PDWN
2680xff, //2= INS
2690xff, //3= SUP
2700xff, //4
2710xff, //5
2720xff, //6
2730xff, //7
2740xff, //8
2750xff, //9
2760xff, //a
2770xff, //b
2780xff, //c
2790xff, //d
2800xff, //e
2810xff, //f
282
283///////////////////////////////////////// 0xe0-0xef
2840xff, //0
2850xff, //1
2860xff, //2
2870xff, //3
2880xff, //4
2890xff, //5
2900xff, //6
2910xff, //7
2920xff, //8
2930xff, //9
2940xff, //a
2950xff, //b
2960xff, //c
2970xff, //d
2980xff, //e
2990xff, //f
300
301///////////////////////////////////////// 0xf0-0xff
3020xff, //0
3030xff, //1
3040xff, //2
3050xff, //3
3060xff, //4
3070xff, //5
3080xff, //6
3090xff, //7
3100xff, //8
3110xff, //9
3120xff, //a
3130xff, //b
3140xff, //c
3150xff, //d
3160xff, //e
3170xff};//f
src/mess/includes/hec2hrp.h
r6902r6903
2525               => add BR/HR switching
2626               => add bank switch for HRX
2727               => add device MX80c and bank switching for the ROM
28    Importante note : the keyboard function add been piked from
29                      DChector project : http://dchector.free.fr/ made by DanielCoulom
30                      (thank's Daniel)
28      03/01/2010 Update and clean prog  by yo_fr       (jj.stac@aliceadsl.fr)
29            => add the port mapping for keyboard
30
31      don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom
32      (and thank's to Daniel!)             
33
3134    TODO : Add the cartridge function,
3235           Adjust the one shot and A/D timing (sn76477)
3336*/
3437
35// Protoype of memory Handler
38/* Protoype of memory Handler*/
3639extern WRITE8_HANDLER( hector_switch_bank_w );
3740extern READ8_HANDLER( hector_keyboard_r );
3841extern WRITE8_HANDLER( hector_keyboard_w );
r6902r6903
5154extern WRITE8_HANDLER( hector_mx40_io_port_w);
5255
5356
54// Prototype of video function
57/* Prototype of video function*/
5558extern void hector_80c(bitmap_t *bitmap, UINT8 *page, int ymax, int yram) ;
5659extern void hector_hr(bitmap_t *bitmap, UINT8 *page, int ymax, int yram) ;
5760VIDEO_START( hec2hrp );
5861VIDEO_UPDATE( hec2hrp );
5962
60// Global variables used in extern modules
63/* Global variables used in extern modules*/
6164
62// Status for screen definition
65/* Status for screen definition*/
6366extern UINT8 hector_flag_hr;
6467extern UINT8 hector_flag_80c;
6568
66// Ram video BR :
69/* Ram video BR :*/
6770extern UINT8 hector_videoram[0x04000];
6871
69// Color status
72/* Color status*/
7073extern UINT8 hector_color[4];
7174
72// Sound function
75/* Sound function*/
7376extern sn76477_interface hector_sn76477_interface;
7477
7578
76// Enum status for high memory bank (c000 - ffff)
79/* Enum status for high memory bank (c000 - ffff)*/
7780enum
7881{
7982   HECTOR_BANK_PROG = 0,              /* first BANK is program ram*/
8083   HECTOR_BANK_VIDEO               /* second BANK is Video ram */
8184};
82// Status for rom memory bank (0000 - 3fff) in MX machine
85/* Status for rom memory bank (0000 - 3fff) in MX machine*/
8386enum
8487{
8588   HECTORMX_BANK_PAGE0 = 0,           /* first BANK is base rom*/
8689   HECTORMX_BANK_PAGE1,            /* second BANK is basic rom */
8790   HECTORMX_BANK_PAGE2                 /* 3 BANK is monitrix / assemblex rom */
8891};
89
src/mess/machine/hec2hrp.c
r6902r6903
2323               => add BR/HR switching
2424               => add bank switch for HRX
2525               => add device MX80c and bank switching for the ROM
26    Importante note : the keyboard function add been piked from
27                      DChector project : http://dchector.free.fr/ made by DanielCoulom
28                      (thank's Daniel)
26      03/01/2010 Update and clean prog  by yo_fr       (jj.stac@aliceadsl.fr)
27            => add the port mapping for keyboard
28
29      don't forget to keep some information about these machines, see DChector project : http://dchector.free.fr/ made by DanielCoulom
30      (and thank's to Daniel!)
31
2932    TODO : Add the cartridge function,
3033           Adjust the one shot and A/D timing (sn76477)
3134*/
r6902r6903
3336#include "driver.h"
3437#include "devices/cassette.h"
3538#include "devices/printer.h"
36#include "sound/sn76477.h"   // for sn sound
37#include "sound/wave.h"      // for K7 sound
38#include "sound/discrete.h"  // for 1 Bit sound
39#include "machine/pckeybrd.h"
39#include "sound/sn76477.h"   /* for sn sound*/
40#include "sound/wave.h"      /* for K7 sound*/
41#include "sound/discrete.h"  /* for 1 Bit sound*/
4042#include "deprecat.h"
41
42#include "includes/hectorkey.h"      // Keyboard mapping
4343#include "includes/hec2hrp.h"
4444
4545
r6902r6903
4848
4949static const device_config *cassette_device_image(running_machine *machine);
5050
51static void Key(int pccode, int state, running_machine *machine);
52
53// Stat for the register in 0x3000
51/* Stat for the register in 0x3000*/
5452static UINT8 state3000=0;
5553static UINT8 write_cassette=0;
5654
57// Keyboard timer
58static TIMER_CALLBACK( Callback_keyboard );
59static emu_timer *keyboard_timer;
60
61// Cassette timer
55/* Cassette timer*/
6256static TIMER_CALLBACK( Callback_CK );
6357static emu_timer *Cassette_timer;
64static UINT8 CK_signal ;  // Synchro signal for K7
58static UINT8 CK_signal ;  /* Synchro signal for K7*/
6559
66// Status for CPU clock
67static UINT8 flag_clk=0;  // 0 5MHz (HR machine) - 1  1.75MHz (BR machine)
60/* Status for CPU clock*/
61static UINT8 flag_clk=0;  /* 0 5MHz (HR machine) - 1  1.75MHz (BR machine)*/
6862
63static double Pin_Value[29][2]; /* SN76477*/
64static int AU[17];              /* Pour les fils de bus audio du SN76477*/
65static int ValMixer;            /* for mixer*/
66static int oldstate3000;        /* Edge state mixer*/
67static int oldstate1000;        /* Edge state cassette*/
6968
7069
71static UINT8 actions=0xff;               //  keyboard key off
70/* joy map*/
71static UINT8 pot0 = 0x40, pot1 = 0x40;  /* State for joy resistor*/
72static UINT8 actions;               /* joy button off*/
7273
73static double Pin_Value[29][2]; // SN76477
74static int AU[17];              // Pour les fils de bus audio du SN76477
75static int ValMixer;            // for mixer
76static int oldstate3000;        // Edge state mixer
77static int oldstate1000;        // Edge state cassette
78
79
80//#include "drivers/hec2son.c" // need to create a header file...
81
82// Keyboard map
83static UINT8 touches[8];
84static UINT8 pot0 = 0x40, pot1 = 0x40;  // State for joy resistor
85
86// To generate the CK signal (K7)
8774static TIMER_CALLBACK( Callback_CK )
8875{
76/* To generate the CK signal (K7)*/
8977   CK_signal++;
9078}
9179
92static TIMER_CALLBACK( Callback_keyboard )
93{
94int touche ;
95int Code0 ;
96
97// update pot position
98if((actions & 0x04) != 0) if(pot0 > 0x00) pot0--;
99if((actions & 0x08) != 0) if(pot0 < 0x7f) pot0++;
100if((actions & 0x40) != 0) if(pot1 > 0x00) pot1--;
101if((actions & 0x80) != 0) if(pot1 < 0x7f) pot1++;
102
103// Keyboard => read
104at_keyboard_polling();
105touche = at_keyboard_read();
106if (touche ==-1) return; // Nothing to do => out!
107if ( (touche & 0x80) == 0 )
108{    // stroke on
109      Code0 = touche & 0x7F;
110      if (Code0==0x36) Code0=0x2A;  // Right shift
111      Key( Code0, 0x00, machine);
112}
113if ( (touche & 0x80) != 0 )
114{    // stroke off
115      Code0 = touche & 0x7F;
116      if (Code0==0x36) Code0=0x2A;  // Right shift
117      Key( Code0, 0x80, machine);
118}
119}
120
121static void Key(int pccode, int state, running_machine *machine)
122{
123 // Mise a jour de l'image du clavier /////////////////////////////////////////
124int i, j, n;
125 n = hectorkey[(pccode & 0x7f) | ((pccode & 0x100) >> 1)];
126// printf("\n touche = %x",pccode);
127 if(n > 0x77) return;
128
129 switch(n)
130 {
131  // Si c'est une demande joystick -> sortie directe avec le code
132  case 0x08: if(state) actions |=   1; else actions &= 0xfe; return; //b0=action0 +
133  case 0x09: if(state) actions |=   2; else actions &= 0xfd; return; //b1=action1 -
134  case 0x0a: if(state) actions |=   4; else actions &= 0xfb; return; //b2=gauche
135  case 0x0b: if(state) actions |=   8; else actions &= 0xf7; return; //b3=droite
136  case 0x0c: if(state) actions |=  16; else actions &= 0xef; return; //b4=bas
137  case 0x0d: if(state) actions |=  32; else actions &= 0xdf; return; //b5=haut
138  case 0x0e: if(state) actions |=  64; else actions &= 0xbf; return; //b6=pdown
139  case 0x0f: if(state) actions |= 128; else actions &= 0x7f; return; //b7=pup
140 }
141 j = 1;
142 if (n==0x00) // Reset machine ! (on ESC key)
143 {
144          cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE);
145          if (!strncmp(machine->gamedrv->name , "hec2xxxx" , 4) |
146              !strncmp(machine->gamedrv->name , "victor" , 6)     ) // aviable for all HR machines
147          {
148               memory_set_bank(machine, "bank1", HECTOR_BANK_PROG);
149               memory_set_bank(machine, "bank2", HECTORMX_BANK_PAGE0);
150               hector_flag_hr=1;
151          }
152          else
153               hector_flag_hr=0;
154          //Common flag
155          hector_flag_80c = 0;
156          flag_clk = 0;
157          return ;
158 }
159 for(i = 0; i < (n & 7); i++)
160       j += j;
161
162 i = (n >> 4) & 7;
163 if(state)
164      touches[i] |= j;
165 else
166      touches[i] &= ~j;
167}
168
16980WRITE8_HANDLER( hector_switch_bank_w )
17081{
171   if (offset==0x00)   {   // 0x800 et 0x000=> vid??o page, HR
82   if (offset==0x00)   {   /* 0x800 et 0x000=> video page, HR*/
17283                           memory_set_bank(space->machine, "bank1", HECTOR_BANK_VIDEO);
17384                     if (flag_clk ==1)
17485                     {
17586                              flag_clk=0;
176                        cputag_set_clock(space->machine, "maincpu", XTAL_5MHz);  // Augmentation CPU
87                        cputag_set_clock(space->machine, "maincpu", XTAL_5MHz);  /* Augmentation CPU*/
17788                     }
17889                  }
179   if (offset==0x04)   {   // 0x804 => vid??o page, BR
90   if (offset==0x04)   {   /* 0x804 => video page, BR*/
18091                     hector_flag_hr=0;
18192                           memory_set_bank(space->machine, "bank1", HECTOR_BANK_VIDEO);
18293                     if (flag_clk ==0)
18394                     {
18495                        flag_clk=1;
185                        cputag_set_clock(space->machine, "maincpu", XTAL_1_75MHz);  // Ralentissement CPU
96                        cputag_set_clock(space->machine, "maincpu", XTAL_1_75MHz);  /* Ralentissement CPU*/
18697                     }
18798                  }
188   if (offset==0x08)   {   // 0x808 => base page, HR
99   if (offset==0x08)   {   /* 0x808 => base page, HR*/
189100                     memory_set_bank(space->machine, "bank1", HECTOR_BANK_PROG);
190101                     if (flag_clk ==1)
191102                     {
192103                        flag_clk=0;
193                        cputag_set_clock(space->machine, "maincpu", XTAL_5MHz);  // Augmentation CPU
104                        cputag_set_clock(space->machine, "maincpu", XTAL_5MHz);  /* Augmentation CPU*/
194105                     }
195106
196107                  }
197   if (offset==0x0c)   {   // 0x80c => base page, BR
108   if (offset==0x0c)   {   /* 0x80c => base page, BR*/
198109                     hector_flag_hr=0;
199110                           memory_set_bank(space->machine, "bank1", HECTOR_BANK_PROG);
200111                     if (flag_clk ==0)
201112                     {
202113                        flag_clk=1;
203                        cputag_set_clock(space->machine, "maincpu", XTAL_1_75MHz);  // Ralentissement CPU
114                        cputag_set_clock(space->machine, "maincpu", XTAL_1_75MHz);  /* Ralentissement CPU*/
204115                     }
205116                  }
206117}
207118
208119WRITE8_HANDLER( hector_keyboard_w )
209120{
210                //nothing to do => Key() function manage the value
121   /*nothing to do => read function manage the value*/
211122}
212123
213124READ8_HANDLER( hector_keyboard_r )
214125{
215   return touches[offset]; //send the pre calculated value
126   UINT8 data = 0xff;
127   running_machine *machine = space->machine;
128
129   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8" };
130
131   if (offset ==7) /* Only when joy reading*/
132   {
133      /* Read special key for analog joystick emulation only (button and pot are analog signal!) and the reset */
134      data=input_port_read(machine, keynames[8]);
135
136      if (data & 0x01) /* Reset machine ! (on ESC key)*/
137      {
138          cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE);
139          if (!strncmp(machine->gamedrv->name , "hec2xxxx" , 4) |
140              !strncmp(machine->gamedrv->name , "victor" , 6)     ) /* aviable for all HR machines*/
141          {
142               memory_set_bank(machine, "bank1", HECTOR_BANK_PROG);
143               memory_set_bank(machine, "bank2", HECTORMX_BANK_PAGE0);
144               hector_flag_hr=1;
145          }
146          else
147               hector_flag_hr=0;
148          /*Common flag*/
149          hector_flag_80c = 0;
150          flag_clk = 0;
151         
152      }
153
154      actions = 0;
155      if (data & 0x02) /* Fire(0)*/
156         actions += 1;
157
158      if (data & 0x04) /* Fire(1)*/
159         actions += 2;
160
161      if (data & 0x08) /* Pot(0)+*/
162         pot0 += 1;
163      if (pot0>128) pot0 = 128;
164
165      if (data & 0x10) /* Pot(0)-*/
166         pot0 -= 1;
167
168      if (pot0>250) pot0 = 0;
169
170      if (data & 0x20) /* Pot(1)+*/
171         pot1 += 1;
172      if (pot1>128) pot1 = 128;
173
174      if (data & 0x40) /* Pot(1)-*/
175         pot1 -= 1;
176
177      if (pot1>250) pot1 = 0;
178   }
179
180   /* in all case return the request value*/
181   return input_port_read(space->machine, keynames[offset]);
216182}
217183
218184WRITE8_HANDLER( hector_sn_2000_w )
r6902r6903
233199static UINT8 cassette_bit_mem=0;
234200static UINT8 Data_K7=0;
235201
236if ((state3000 & 0x38) != 0x38 )   // Selon Sb choix cassette ou timer (74153)
202if ((state3000 & 0x38) != 0x38 )   /* Selon Sb choix cassette ou timer (74153)*/
237203{
238204
239   Data_K7 =  0x00;  // No cassette => clear bit
205   Data_K7 =  0x00;  /* No cassette => clear bit*/
240206       switch (state3000 & 0x38 )
241207       {
242          case 0x08: value = (actions & 1) ? 0x80 : 0; break;    //(actions & 1) ? 0x80 : 0;
208          case 0x08: value = (actions & 1) ? 0x80 : 0; break; 
243209          case 0x10: value = pot0; break;
244         case 0x20: value = (actions & 2) ? 0x80 : 0; break;   //(actions & 2) ? 0x80 : 0;
210         case 0x20: value = (actions & 2) ? 0x80 : 0; break;
245211          case 0x28: value = pot1; break;
246212          default: value = 0; break;
247213       }
r6902r6903
250216{
251217   if (write_cassette == 0)
252218    {
253      // Acc??e ?? la cassette
219      /* Accee a la cassette*/
254220      level = cassette_input(cassette_device_image(space->machine));
255221
256      // Travail du 741 en trigger
222      /* Travail du 741 en trigger*/
257223      if  (level < -0.08)
258224          cassette_bit = 0x00;
259225      if (level > +0.08)
260226         cassette_bit = 0x01;
261227   }
262    // Programme du sn7474 (bascule) : Changement ??tat bit Data K7 ?? chaque front montant de cassette_bit
228    /* Programme du sn7474 (bascule) : Changement ??tat bit Data K7 ?? chaque front montant de cassette_bit*/
263229    if ((cassette_bit != cassette_bit_mem) && (cassette_bit !=0))
264230    {
265231       if (Data_K7 == 0x00)
266         Data_K7 =  0x80;// En poids fort
232         Data_K7 =  0x80;/* En poids fort*/
267233       else
268234          Data_K7 =  0x00;
269235    }
270236   value = ( CK_signal & 0x7F ) + Data_K7;
271    cassette_bit_mem = cassette_bit;  // M??morisation ??tat bit cassette
237    cassette_bit_mem = cassette_bit;  /* Memorisation etat bit cassette*/
272238}
273239return value;
274240}
275241WRITE8_HANDLER( hector_sn_3000_w )
276242{
277    state3000 = data & 0xf8; // except bit 0 to 2
243    state3000 = data & 0xf8; /* except bit 0 to 2*/
278244   if ((data & 7) != oldstate3000 )
279245       {
280           // Update sn76477 only when necessary!
246           /* Update sn76477 only when necessary!*/
281247           Mise_A_Jour_Etat( 0x3000, data & 7 );
282248          Update_Sound(space, data & 7);
283249        }
r6902r6903
287253/* Color Interface */
288254WRITE8_HANDLER( hector_color_a_w )
289255{
290static int counter_write=0; // Attente de quelque cycles avant demettre en route
256static int counter_write=0; /* Attente de quelque cycles avant demettre en route*/
291257
292258       if (data & 0x40)
293259      {
294        // Bit 6 => motor ON/OFF => for cassette state!
260        /* Bit 6 => motor ON/OFF => for cassette state!*/
295261         if (write_cassette==0)
296262         {
297263          cassette_set_state(cassette_device_image(space->machine) , CASSETTE_PLAY || CASSETTE_SPEAKER_ENABLED);
298264         }
299265       }
300266       else
301       {   // stop motor
267       {   /* stop motor*/
302268           cassette_set_state(cassette_device_image(space->machine) , CASSETTE_STOPPED);
303269         write_cassette=0;
304270         counter_write =0;
305271       }
306      if (((data & 0x80) != (oldstate1000 & 0x80)) && ((oldstate1000 & 7)==(data & 7)) ) // Bit7 had change but not the color statement
272      if (((data & 0x80) != (oldstate1000 & 0x80)) && ((oldstate1000 & 7)==(data & 7)) ) /* Bit7 had change but not the color statement*/
307273       {
308       // Bit 7 => Write bit for cassette!
274       /* Bit 7 => Write bit for cassette!*/
309275      counter_write +=1;
310276
311277      if (counter_write > 5)
312278      {
313            // Wait several cycle before lauch the record to prevent somes bugs
279            /* Wait several cycle before lauch the record to prevent somes bugs*/
314280         counter_write = 6;
315281         if (write_cassette==0)
316         {   // C'est la 1er fois => record
282         {   /* C'est la 1er fois => record*/
317283            cassette_set_state(cassette_device_image(space->machine) , CASSETTE_RECORD );
318284            write_cassette=1;
319285         }
r6902r6903
322288      cassette_output(cassette_device_image(space->machine), ((data & 0x80) == 0x80) ? -1.0 : +1.0);
323289      }
324290
325        // Other bit : color definition
291        /* Other bit : color definition*/
326292   hector_color[0] =  data        & 0x07 ;
327293   hector_color[2] = ((data >> 3)  & 0x07) | (hector_color[2] & 0x40);
328294
329   oldstate1000=data; // For next step
295   oldstate1000=data; /* For next step*/
330296}
331297WRITE8_HANDLER( hector_color_b_w )
332298{
r6902r6903
334300          hector_color[1] =  data        & 0x07;
335301   hector_color[3] = (data >> 3)  & 0x07;
336302
337   // Half light on color 2 only on HR machines:
303   /* Half light on color 2 only on HR machines:*/
338304   if (data & 0x40) hector_color[2] |= 8; else hector_color[2] &= 7;
339305
340   // Play bit
306   /* Play bit*/
341307   discrete_sound_w(discrete, NODE_01,  (data & 0x80) ? 0:1 );
342308}
343309
r6902r6903
358324
359325READ8_HANDLER( hector_mx_io_port_r)
360326{
361   return 0;  // Imp ok
327   return 0;  // printer ok
362328}
363329WRITE8_HANDLER( hector_mx40_io_port_w)
364330{
365   if ((offset &0x0ff) == 0xf0) // Port A => to printer
331   if ((offset &0x0ff) == 0xf0) /* Port A => to printer*/
366332         printer_output(devtag_get_device(space->machine, "printer"), data);
367   if ((offset &0x0ff) == 0x40) // Port page 0
333   if ((offset &0x0ff) == 0x40) /* Port page 0*/
368334      memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE0);
369   if ((offset &0x0ff) == 0x41) // Port page 1
335   if ((offset &0x0ff) == 0x41) /* Port page 1*/
370336   {
371337      memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE1);
372338      hector_flag_80c=0;
373339   }
374   if ((offset &0x0ff) == 0x44) // Port page 2  // 42 pour MX80
340   if ((offset &0x0ff) == 0x44) /* Port page 2  => 42 pour MX80*/
375341      memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE2);
376   if ((offset &0x0ff) == 0x49) // Port screen resolution
377      hector_flag_80c=0;// No 80c in 40c !
342   if ((offset &0x0ff) == 0x49) /* Port screen resolution*/
343      hector_flag_80c=0;/* No 80c in 40c !*/
378344}
379345
380346WRITE8_HANDLER( hector_mx80_io_port_w)
381347{
382   if ((offset &0x0ff) == 0xf0) // Port A => to printer
348   if ((offset &0x0ff) == 0xf0) /* Port A => to printer*/
383349         printer_output(devtag_get_device(space->machine, "printer"), data);
384   if ((offset &0x0ff) == 0x40) // Port page 0
350   if ((offset &0x0ff) == 0x40) /* Port page 0*/
385351      memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE0);
386   if ((offset &0x0ff) == 0x41) // Port page 1
352   if ((offset &0x0ff) == 0x41) /* Port page 1*/
387353   {
388354      memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE1);
389355      hector_flag_80c=0;
390356   }
391   if ((offset &0x0ff) == 0x42) // Port page 2  => port different du MX40
357   if ((offset &0x0ff) == 0x42) /* Port page 2  => port different du MX40*/
392358      memory_set_bank(space->machine, "bank2", HECTORMX_BANK_PAGE2);
393   if ((offset &0x0ff) == 0x49) // Port screen resolution
359   if ((offset &0x0ff) == 0x49) /* Port screen resolution*/
394360      hector_flag_80c=1;
395361}
396362
397///////////////////////////////////////////////////////////////////////
398// Gestion du son
399///////////////////////////////////////////////////////////////////////
363/********************************************************************************
364 sound managment
365********************************************************************************/
400366
401367void Mise_A_Jour_Etat(int Adresse, int Value )
402368{
403// Adjust value depending on I/O main CPU request
369/* Adjust value depending on I/O main CPU request*/
404370 switch(Adresse )
405371 {
406372  case 0x2000:
407   // Modification AU0 / AU8
408   {  // AU0
373   /* Modification AU0 / AU8*/
374   {  /* AU0*/
409375      AU[ 0] =  ((Value & 0x080 )==0) ? 0 : 1 ;
410      // AU8 : 0
376      /* AU8 : 0*/
411377      AU[ 8] =  ((Value & 0x040 )==0) ? 0 : 1 ;
412378      break;
413379   }
414380  case 0x2001:
415   // Modification AU1 / AU9
416   {  // AU1
381   /* Modification AU1 / AU9*/
382   {  /* AU1*/
417383      AU[ 1] =  ((Value & 0x080 )==0) ? 0 : 1 ;
418      // AU9
384      /* AU9*/
419385      AU[ 9] =  ((Value & 0x040 )==0) ? 0 : 1 ;
420386      break;
421387   }
422388  case 0x2002:
423   // Modification AU2 / AU10
424   {  // AU2
389   /* Modification AU2 / AU10*/
390   {  /* AU2*/
425391      AU[ 2] =  ((Value & 0x080 )==0) ? 0 : 1 ;
426      // AU10
392      /* AU10*/
427393      AU[10] =  ((Value & 0x040 )==0) ? 0 : 1 ;
428394      break;
429395   }
430396   case 0x2003:
431   // Modification AU3 / AU11
432   {  // AU3
397   /* Modification AU3 / AU11*/
398   {  /* AU3*/
433399      AU[ 3] =  ((Value & 0x080 )==0) ? 0 : 1 ;
434      // AU11
400      /* AU11*/
435401      AU[11] =  ((Value & 0x040 )==0) ? 0 : 1 ;
436402      break;
437403   }
438404  case 0x2800:
439   // Modification AU4 / AU12
440   {  // AU4
405   /* Modification AU4 / AU12*/
406   {  /* AU4*/
441407      AU[ 4] =  ((Value & 0x080 )==0) ? 0 : 1 ;
442      // AU8
408      /* AU8*/
443409      AU[12] =  ((Value & 0x040 )==0) ? 0 : 1 ;
444410      break;
445411   }
446412  case 0x2801:
447   // Modification AU5 / AU13
448   {  // AU5
413   /* Modification AU5 / AU13*/
414   {  /* AU5*/
449415      AU[ 5] =  ((Value & 0x080 )==0) ? 0 : 1 ;
450      // AU13
416      /* AU13*/
451417      AU[13] =  ((Value & 0x040 )==0) ? 0 : 1 ;
452418     break;
453419   }
454420  case 0x2802:
455   {  // Modification AU6 / AU14
456      // AU6
421   {  /* Modification AU6 / AU14*/
422      /* AU6*/
457423      AU[ 6] = ((Value & 0x080 )==0) ? 0 : 1 ;
458      // AU14
424      /* AU14*/
459425      AU[14] = ((Value & 0x040 )==0) ? 0 : 1 ;
460426      break;
461427   }
462428  case 0x2803:
463   // Modification AU7 / AU15
464   {  // AU7
429   /* Modification AU7 / AU15*/
430   {  /* AU7*/
465431      AU[ 7] =  ((Value & 0x080 )==0) ? 0 : 1 ;
466      // AU15
432      /* AU15*/
467433      AU[15] =  ((Value & 0x040 )==0) ? 0 : 1 ;
468434      break;
469435   }
470436  case 0x3000:
471   // Mixer modification
437   /* Mixer modification*/
472438   {
473439      ValMixer = (Value & 7) ;
474440       break;
475441   }
476442  default: break;
477443
478 } //switch
444 } /*switch*/
479445}
480446
481447
482448static void Init_Value_SN76477_Hector(void)
483449{
484     // Remplissage des valeurs de resistance et capacite d'Hector
450     /* Remplissage des valeurs de resistance et capacite d'Hector*/
485451
486     // SetEnvelopControl( R10 , R7, C8 ) : Attack/Decay
487     // Decay R
488     Pin_Value[7][1] = RES_K(680.0); //680  vu
489     Pin_Value[7][0] = RES_K(252.325); // 142.325 (680 // 180KOhm)
452     /* Decay R*/
453     Pin_Value[7][1] = RES_K(680.0); /*680K  */
454    Pin_Value[7][0] = RES_K(252.325); /* 142.325 (680 // 180KOhm)*/
490455
491     // Capa A/D
492     Pin_Value[8][0] = CAP_U(0.47); // 0.47uf
493     Pin_Value[8][1] = CAP_U(1.47);  // 1.47
456     /* Capa A/D*/
457     Pin_Value[8][0] = CAP_U(0.47); /* 0.47uf*/
458     Pin_Value[8][1] = CAP_U(1.47);  /* 1.47*/
494459
495     // ATTACK R
496     Pin_Value[10][1]= RES_K(180.0);   // 180
497     Pin_Value[10][0]= RES_K(32.054); // 32.054 (180 // 39 KOhm)
460     /* ATTACK R*/
461     Pin_Value[10][1]= RES_K(180.0);   /* 180*/
462     Pin_Value[10][0]= RES_K(32.054); /* 32.054 (180 // 39 KOhm)*/
498463
499     // Version 3 : Ajust?? pour les frequences mesur??es :
500                // 4  0 SOUND 255 Hz => ajust?? ?? l'oreille
501                // 4  4 SOUND  65 Hz => ajust?? ?? l'oreille
502                // 4  8 SOUND  17 Hz =>  ajust?? ?? l'oreille
503                // 4 12 SOUND 4,3 Hz =>  ajust?? ?? l'oreille
504     // SLF C       Version 3
505     Pin_Value[21][0]= CAP_U(0.1);  //CAPU(0.1) vu
506     Pin_Value[21][1]= CAP_U(1.1);  //1.1
464     /* Version 3 : Ajuste pour les frequences mesurees :
465                // 4  0 SOUND 255 Hz => ajuste a l'oreille
466                // 4  4 SOUND  65 Hz => ajuste a l'oreille
467                // 4  8 SOUND  17 Hz =>  ajuste a l'oreille
468                // 4 12 SOUND 4,3 Hz =>  ajuste a l'oreille*/
469     /*   SLF C       Version 3*/
470     Pin_Value[21][0]= CAP_U(0.1);  /*CAPU(0.1) */
471     Pin_Value[21][1]= CAP_U(1.1);  /*1.1*/
507472
508     //SLF R        Version 3
473     /*SLF R        Version 3*/
509474     Pin_Value[20][1]= RES_K(180);    //180 vu
510475     Pin_Value[20][0]= RES_K(37.268); //37.268 (47//180 KOhms)
511476
512     // Capa VCO
513     // Version 3 : Ajust?? pour les frequences mesur??es :
477     /* Capa VCO*/
478     /* Version 3 : Ajust?? pour les frequences mesur??es :
514479             // 0 0  SOUND 5,5KHz => 5,1KHz
515480             // 0 16 SOUND 1,3KHz => 1,2KHz
516481             // 0 32 SOUND 580Hz  => 570Hz
517             // 0 48 SOUND 132Hz  => 120Hz
518     Pin_Value[17][0] = CAP_N(47.0) ;  //47,0 mesure ok   // CAPU(0.047)
519     Pin_Value[17][1] = CAP_N(580.0) ; //580  mesure ok   // CAPU(0.517)
520     // R VCO   Version 3
521     Pin_Value[18][1] = RES_K(1400.0   );//1300 mesure ok    // au lieu de 1Mohm
522     Pin_Value[18][0] = RES_K( 203.548 );//223  mesure ok    // au lieu de 193.548 (1000 // 240KOhm)
482             // 0 48 SOUND 132Hz  => 120Hz*/
483     Pin_Value[17][0] = CAP_N(47.0) ;  /*47,0 mesure ok */ 
484     Pin_Value[17][1] = CAP_N(580.0) ; /*580  mesure ok */
485     /* R VCO   Version 3*/
486     Pin_Value[18][1] = RES_K(1400.0   );/*1300 mesure ok    // au lieu de 1Mohm*/
487     Pin_Value[18][0] = RES_K( 203.548 );/*223  mesure ok    // au lieu de 193.548 (1000 // 240KOhm)*/
523488
524     // VCO Controle
525     Pin_Value[16][0] = 0.0;  //2.6; // Volts  // 0.1 vu
526     Pin_Value[16][1] = 1.41; //2;             // 2 =  10/15eme de 5V
489     /* VCO Controle*/
490     Pin_Value[16][0] = 0.0;  /* Volts  */
491     Pin_Value[16][1] = 1.41; /* 2 =  10/15eme de 5V*/
527492
528     // Pitch
529     Pin_Value[19][0] = 0.0;   //2; // Volts  // 0 vu
530     Pin_Value[19][1] = 1.41; //0.2;           // 2
493     /* Pitch*/
494     Pin_Value[19][0] = 0.0;   /*Volts */
495     Pin_Value[19][1] = 1.41;
531496
532497
533     // setVCO ( TOR_22)
534     Pin_Value[22][0] = 0; // TOR   //0
535     Pin_Value[22][1] = 1;          //1
498     Pin_Value[22][0] = 0; /* TOR */
499     Pin_Value[22][1] = 1;
536500
537     //setOneShot(R24, C23)
538     // R OneShot
539     Pin_Value[24][1] = RES_K(100);  //0
540     Pin_Value[24][0] = RES_K(1000);  //RES_M(1) infini sur Hector car non connect??e
501     /* R OneShot*/
502     Pin_Value[24][1] = RES_K(100); 
503    Pin_Value[24][0] = RES_K(1000);  /*RES_M(1) infini sur Hector car non connectee*/
541504
542     // Capa OneShot
543     Pin_Value[23][0] = 1.0;  //0     0.1 (0) et 0.0 (1)
544     Pin_Value[23][1] = 0.0;  //1   // Valeur Bidon sur Hector car mise au 5Volts sans capa
505     /* Capa OneShot*/
506     Pin_Value[23][0] = 1.0; 
507     Pin_Value[23][1] = 0.0;  /* Valeur Bidon sur Hector car mise au 5Volts sans capa*/
545508
546     // Enabled
547     Pin_Value[9][0] = 0;          //0
548     Pin_Value[9][1] = 1;          //1
509     /* Enabled*/
510     Pin_Value[9][0] = 0;   
511     Pin_Value[9][1] = 1;
549512
550     // Volume
551     Pin_Value[11][0] = 128; // Rapport 50% et 100%  //128
552     Pin_Value[11][1] = 255;                         //255
513     /* Volume*/
514     Pin_Value[11][0] = 128; /* Rapport 50% et 100%  128*/
515     Pin_Value[11][1] = 255; /*                      255*/
553516
554     // Noise filter
555     Pin_Value[6][0] = CAP_U(0.390);    // 0.390
556     Pin_Value[6][1] = CAP_U(08.60);    // 0.48
517     /* Noise filter*/
518     Pin_Value[6][0] = CAP_U(0.390);    /* 0.390*/
519     Pin_Value[6][1] = CAP_U(08.60);    /* 0.48*/
557520
558     // Valeur corrig?? par rapport au sch??ma :
559     Pin_Value[5][1] = RES_K(3.30 ) ;     // 330Kohm
560     Pin_Value[5][0] = RES_K(1.76 ) ;     // 76 Kohm
521     /* Valeur corrige par rapport au schema :*/
522     Pin_Value[5][1] = RES_K(3.30 ) ;     /* 330Kohm*/
523     Pin_Value[5][0] = RES_K(1.76 ) ;     /* 76 Kohm*/
561524
562     // Noise pas command?? par le bus audio !
563    // Seule la valeur [0] est document??e !
564     Pin_Value[4][0] = RES_K(47) ;      // 47 K ohm
565     Pin_Value[12][0] = RES_K(100);     // 100K ohm
566     Pin_Value[3][0] = 0 ;              // NC
525     /* Noise pas commande par le bus audio !*/
526    /* Seule la valeur [0] est documentee !*/
527     Pin_Value[4][0] = RES_K(47) ;      /* 47 K ohm*/
528     Pin_Value[12][0] = RES_K(100);     /* 100K ohm*/
529     Pin_Value[3][0] = 0 ;              /* NC*/
567530
568     // Gestion du type d'enveloppe
531     /* Gestion du type d'enveloppe*/
569532     Pin_Value[ 1][0] = 0;
570533     Pin_Value[ 1][1] = 1;
571534
572535     Pin_Value[28][0] = 0;
573536     Pin_Value[28][1] = 1;
574537
575     // Initialisation ?? 0 des pin du SN
538     /* Initialisation a 0 des pin du SN*/
576539     AU[0]=0;
577540     AU[1]=0;
578541     AU[2]=0;
r6902r6903
594557
595558void Update_Sound(const address_space *space, UINT8 data)
596559{
597   // keep device
560   /* keep device*/
598561   const device_config *sn76477 = devtag_get_device(space->machine, "sn76477");
599562
600   // MIXER
563   /* MIXER*/
601564   sn76477_mixer_a_w(sn76477, ((ValMixer & 0x04)==4) ? 1 : 0);
602565   sn76477_mixer_b_w(sn76477, ((ValMixer & 0x01)==1) ? 1 : 0);
603   sn76477_mixer_c_w(sn76477, ((ValMixer & 0x02)==2) ? 1 : 0);// Revu selon mesure ??lectronique
566   sn76477_mixer_c_w(sn76477, ((ValMixer & 0x02)==2) ? 1 : 0);/* Revu selon mesure electronique sur HRX*/
604567
605    // VCO oscillateur
568    /* VCO oscillateur*/
606569    if (AU[12]==1)
607        sn76477_vco_res_w(      sn76477, Pin_Value[18][AU[10]]/12.0); // en non AU11
570        sn76477_vco_res_w(      sn76477, Pin_Value[18][AU[10]]/12.0); /* en non AU11*/
608571    else
609        sn76477_vco_res_w(      sn76477, Pin_Value[18][AU[10]]); // en non AU11
572        sn76477_vco_res_w(      sn76477, Pin_Value[18][AU[10]]); /* en non AU11*/
610573
611574    sn76477_vco_cap_w(      sn76477, Pin_Value[17][AU[2 ]]);
612575    sn76477_pitch_voltage_w(sn76477, Pin_Value[19][AU[15]]);
613576    sn76477_vco_voltage_w(   sn76477, Pin_Value[16][AU[15]]);
614    sn76477_vco_w(          sn76477, Pin_Value[22][AU[12]]); // VCO Select Ext/SLF
577    sn76477_vco_w(          sn76477, Pin_Value[22][AU[12]]); /* VCO Select Ext/SLF*/
615578
616   // SLF
617    sn76477_slf_res_w( sn76477, Pin_Value[20][AU[ 9]]);//AU10
579   /* SLF*/
580    sn76477_slf_res_w( sn76477, Pin_Value[20][AU[ 9]]);/*AU10*/
618581    sn76477_slf_cap_w( sn76477, Pin_Value[21][AU[1 ]]);
619582
620    // One Shot
621    sn76477_one_shot_res_w(sn76477, Pin_Value[24][     0]); // NC
583    /* One Shot*/
584    sn76477_one_shot_res_w(sn76477, Pin_Value[24][     0]); /* NC*/
622585    sn76477_one_shot_cap_w(sn76477, Pin_Value[23][AU[13]]);
623586
624   // Ampli value
587   /* Ampli value*/
625588    sn76477_amplitude_res_w(sn76477, Pin_Value[11][AU[5]]);
626589
627    // Attack / Decay
590    /* Attack / Decay*/
628591    sn76477_attack_res_w(sn76477, Pin_Value[10][AU[ 8]]);
629    sn76477_decay_res_w( sn76477, Pin_Value[7 ][AU[11]]);//AU9
592    sn76477_decay_res_w( sn76477, Pin_Value[7 ][AU[11]]);/*AU9*/
630593    sn76477_attack_decay_cap_w(sn76477, Pin_Value[8][AU[0]]);
631594
632    // Filtre
595    /* Filtre*/
633596    sn76477_noise_filter_res_w(sn76477, Pin_Value[5][AU[4]]);
634597    sn76477_noise_filter_cap_w(sn76477, Pin_Value[6][AU[3]]);
635598
636    // Clock Extern Noise
637    sn76477_noise_clock_res_w(sn76477, Pin_Value[4][0]); // fix
638    sn76477_feedback_res_w(sn76477, Pin_Value[12][0]); //fix
599    /* Clock Extern Noise*/
600    sn76477_noise_clock_res_w(sn76477, Pin_Value[4][0]); /* fix*/
601    sn76477_feedback_res_w(sn76477, Pin_Value[12][0]);   /*fix*/
639602
640    //  Envelope
603    /*  Envelope*/
641604    sn76477_envelope_1_w(sn76477, Pin_Value[1 ][AU[6]]);
642605    sn76477_envelope_2_w(sn76477, Pin_Value[28][AU[7]]);
643606
644    // En dernier on lance (ou pas !)
607    /* En dernier on lance (ou pas !)*/
645608    sn76477_enable_w(sn76477, Pin_Value[9][AU[14]]);
646609}
647610
648611sn76477_interface hector_sn76477_interface =
649612{
650   RES_K(47),      //  4  noise_res
651   RES_K(330),      //  5  filter_res
652   CAP_P(390),      //  6  filter_cap
653   RES_K(680),      //  7  decay_res
654   CAP_U(47),      //  8  attack_decay_cap
655   RES_K(180),      // 10  attack_res
656   RES_K(33),      // 11  amplitude_res
657   RES_K(100),      // 12  feedback_res
658   2,            // 16  vco_voltage
659   CAP_N(47) ,      // 17  vco_cap
660   RES_K(1000),   // 18  vco_res
661   2,            // 19  pitch_voltage
662   RES_K(180),      // 20  slf_res
663   CAP_U(0.1),      // 21  slf_cap
664   CAP_U(1.00001),   // 23  oneshot_cap
665    RES_K(10000)   // 24  oneshot_res
613   RES_K(47),      /*  4  noise_res*/
614   RES_K(330),      /*  5  filter_res*/
615   CAP_P(390),      /*  6  filter_cap*/
616   RES_K(680),      /*  7  decay_res*/
617   CAP_U(47),      /*  8  attack_decay_cap*/
618   RES_K(180),      /* 10  attack_res*/
619   RES_K(33),      /* 11  amplitude_res*/
620   RES_K(100),      /* 12  feedback_res*/
621   2,            /* 16  vco_voltage*/
622   CAP_N(47) ,      /* 17  vco_cap*/
623   RES_K(1000),   /* 18  vco_res*/
624   2,            /* 19  pitch_voltage*/
625   RES_K(180),      /* 20  slf_res*/
626   CAP_U(0.1),      /* 21  slf_cap*/
627   CAP_U(1.00001),   /* 23  oneshot_cap*/
628    RES_K(10000)   /* 24  oneshot_res*/
666629};
667630
668631void hector_reset(running_machine *machine, int hr)
r6902r6903
674637
675638void hector_init(running_machine *machine)
676639{
677   int i;
678
679   // For keyboard
680   keyboard_timer = timer_alloc(machine, Callback_keyboard, 0);
681   timer_adjust_periodic(keyboard_timer, ATTOTIME_IN_MSEC(100), 0, ATTOTIME_IN_MSEC(20));//keyboard scan 25ms
682
683   for(i = 0; i < 8; i++) touches[i] = 0xff;     //all key off
684
685   // For Cassette synchro
640   /* For Cassette synchro*/
686641   Cassette_timer = timer_alloc(machine, Callback_CK, 0);
687   timer_adjust_periodic(Cassette_timer, ATTOTIME_IN_MSEC(100), 0, ATTOTIME_IN_USEC(64));// 11 * 6; 16 *4; 32 *2; 64 => real synchro scan speed for 15,624Khz
642   timer_adjust_periodic(Cassette_timer, ATTOTIME_IN_MSEC(100), 0, ATTOTIME_IN_USEC(64));/* => real synchro scan speed for 15,624Khz*/
688643
689   // Sound sn76477
690   Init_Value_SN76477_Hector();  //init R/C value
644   /* Sound sn76477*/
645   Init_Value_SN76477_Hector();  /*init R/C value*/
691646}
src/mess/formats/hect_tap.c
r6902r6903
1010 
1111 jj.stacino@aliceadsl.fr
1212
13Updated 3/1/10 : use real value for timing.
1314********************************************************************/
1415#include "hect_tap.h"
1516
r6902r6903
2223static int cas_size;
2324
2425
25int  Header_cycles = 66; //Valeur Théorique = 44100 * 1.5 / 1000  // mesuré sur jeu Formule1 = 1,75ms
26int  Zero_cycles =   17; //Valeur Théorique = 44100 * 0.4 / 1000  // mesuré sur jeu Formule1 = 0,61ms
27int  Un_cycles =     40; //Valeur Théorique = 44100 * 0.9 / 1000  // mesuré sur jeu Formule1 = 1,13ms
28
26int  Header_cycles = 77; /* Valeur Théorique 66 = 44100 * 1.5 / 1000  // mesuré sur jeu Formule1 = 1,75ms*/
27int  Zero_cycles =   27; /* Valeur Théorique 17 = 44100 * 0.4 / 1000  // mesuré sur jeu Formule1 = 0,61ms*/
28int  Un_cycles =     50; /* Valeur Théorique 40 = 44100 * 0.9 / 1000  // mesuré sur jeu Formule1 = 1,13ms*/
29/* Here I prefer use the value that I read on a real tape, and not the theorical value; note that these
30   value work best on my HRX...    Yo_fr   (jj.stacino@aliceadsl.fr)  */
31   
2932/*******************************************************************
3033   Generate one high-low cycle of sample data
3134********************************************************************/
r6902r6903
5356
5457INLINE int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
5558{
56// Writing an entire byte
59/* Writing an entire byte */
5760   int i, samples;
5861
5962   samples = 0;
r6902r6903
7275
7376INLINE int hector_tap_synchro(INT16 *buffer, int sample_pos, int nb_synchro)
7477{
75// Writing an entire byte
78/* Writing an entire byte */
7679   int i, samples;
7780
7881   samples = 0;
r6902r6903
9699   /* First 768 cycle of synchro */
97100   sample_count += hector_tap_synchro( buffer, sample_count, 768-4 );     
98101   
99   // Sur la longeure du fichier
102   /* on the entire file*/
100103    while( data_pos < cas_size )
101104   {
102105      UINT16   block_size;
r6902r6903
131134
132135        }
133136    }
134    //Finish by a zero
137    /*Finish by a zero*/
135138    sample_count += hector_tap_byte( buffer, sample_count, 0 );
136139   
137140   return sample_count;
138141}
139/////////////////////////////////////////////////////////////////////
142/*******************************************************************
140143////  FORTH DATA CASSETTE
141/////////////////////////////////////////////////////////////////////
144*******************************************************************/
142145
143146
144147static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
r6902r6903
151154    block_count = 0;
152155    previous_block = 0;
153156
154    // Out if len of file not modulo 822 octets   
157    /* Out if len of file not modulo 822 octets    */
155158   if ( (cas_size % 822) != 0 )
156159      return -1;
157160
158   // on the entire file
161   /* on the entire file*/
159162    while( data_pos < cas_size )
160163   {
161164      UINT16   block_size;
162165
163       // Starting a block with 768 cycle of synchro
166       /* Starting a block with 768 cycle of synchro*/
164167       sample_count += hector_tap_synchro( buffer, sample_count, 768 );
165168
166      // Handle block lenght on tape data
167      block_size = 822 ; // Fixed size for the forth
169      /* Handle block lenght on tape data */
170      block_size = 822 ; /* Fixed size for the forth*/
168171
169172      block_count=0;
170173
171      // Data samples
174      /* Data samples */
172175      for ( ; block_size ; data_pos++, block_size-- )
173176        {
174          // Make sure there are enough bytes left
177          /* Make sure there are enough bytes left */
175178          if ( data_pos > cas_size )
176179            return -1;
177180
r6902r6903
180183        }
181184    }
182185
183    //Finish by a zero
186    /*Finish by a zero*/
184187    sample_count += hector_tap_byte( buffer, sample_count, 0 );
185188   
186189   return sample_count;
187190}
188///////////////////////////////////////////////////////////////////////
191/*******************************************************************
189192/////  END FORTH DATA CASSETTE
190///////////////////////////////////////////////////////////////////////
193*******************************************************************/
191194
192195
193196/*******************************************************************
src/mess/drivers/interact.c
r6902r6903
3737               => add BR/HR switching
3838               => add bank switch for HRX
3939               => add device MX80c and bank switching for the ROM
40    Importante note : the keyboard function add been piked from
41                      DChector project : http://dchector.free.fr/ made by DanielCoulom
42                      (thank's Daniel)
40      03/01/2010 Update and clean prog  by yo_fr       (jj.stac@aliceadsl.fr)
41            => add the port mapping for keyboard
42
43      don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom
44      (and thank's to Daniel!)             
45
4346    TODO : Add the cartridge function,
4447           Adjust the one shot and A/D timing (sn76477)
4548
4649****************************************************************************/
50/* Mapping for joystick see hec2hrp.c*/
4751
4852#include "driver.h"
4953#include "cpu/z80/z80.h"
5054#include "cpu/i8085/i8085.h"
51#include "machine/pckeybrd.h"
5255#include "devices/cassette.h"
5356#include "formats/hect_tap.h"
5457#include "devices/printer.h"
55#include "sound/wave.h"      // for K7 sound
56#include "sound/sn76477.h"   // for sn sound
57#include "sound/discrete.h"  // for 1 Bit sound
58#include "sound/wave.h"      /* for K7 sound*/
59#include "sound/sn76477.h"   /* for sn sound*/
60#include "sound/discrete.h"  /* for 1 Bit sound*/
5861
5962#include "includes/hec2hrp.h"
6063
6164static ADDRESS_MAP_START(interact_mem, ADDRESS_SPACE_PROGRAM, 8)
6265   ADDRESS_MAP_UNMAP_HIGH
63    // Hardward address mapping
64//  AM_RANGE(0x0800,0x0808) AM_WRITE( hector_switch_bank_w)// Bank management not udsed in BR machine
65   AM_RANGE(0x1000,0x1000) AM_WRITE( hector_color_a_w)  // Color c0/c1
66   AM_RANGE(0x1800,0x1800) AM_WRITE( hector_color_b_w)  // Color c2/c3
67   AM_RANGE(0x2000,0x2003) AM_WRITE( hector_sn_2000_w)  // Sound
68   AM_RANGE(0x2800,0x2803) AM_WRITE( hector_sn_2800_w)  // Sound
69   AM_RANGE(0x3000,0x3000) AM_READWRITE( hector_cassette_r, hector_sn_3000_w)// Write necessary
70   AM_RANGE(0x3800,0x3807) AM_READWRITE( hector_keyboard_r, hector_keyboard_w)  // Keyboard
66    /* Hardward address mapping*/
67/*  AM_RANGE(0x0800,0x0808) AM_WRITE( hector_switch_bank_w)// Bank management not udsed in BR machine*/
68   AM_RANGE(0x1000,0x1000) AM_WRITE( hector_color_a_w)  /* Color c0/c1*/
69   AM_RANGE(0x1800,0x1800) AM_WRITE( hector_color_b_w)  /* Color c2/c3*/
70   AM_RANGE(0x2000,0x2003) AM_WRITE( hector_sn_2000_w)  /* Sound*/
71   AM_RANGE(0x2800,0x2803) AM_WRITE( hector_sn_2800_w)  /* Sound*/
72   AM_RANGE(0x3000,0x3000) AM_READWRITE( hector_cassette_r, hector_sn_3000_w)/* Write necessary*/
73   AM_RANGE(0x3800,0x3807) AM_READWRITE( hector_keyboard_r, hector_keyboard_w)  /* Keyboard*/
7174
72    // Main ROM page
73   AM_RANGE(0x0000,0x3fff) AM_ROM  //BANK(2)
74 //   AM_RANGE(0x1000,0x3fff) AM_RAM
75    /* Main ROM page*/
76   AM_RANGE(0x0000,0x3fff) AM_ROM  /*BANK(2)*/
77 /*   AM_RANGE(0x1000,0x3fff) AM_RAM*/
7578
76   // Vid??o br mapping
79   /* Video br mapping*/
7780   AM_RANGE(0x4000,0x49ff) AM_RAM AM_BASE_GENERIC(videoram)
78   // continous RAM
81   /* continous RAM*/
7982    AM_RANGE(0x4A00,0xffff) AM_RAM
8083
8184ADDRESS_MAP_END
r6902r6903
107110
108111static MACHINE_START(interact)
109112{
110   // Start keyboard
111    at_keyboard_init(machine, AT_KEYBOARD_TYPE_PC);
112    at_keyboard_reset(machine);
113    at_keyboard_set_scan_code_set(2);
114    at_keyboard_reset(machine);
115
116113   hector_init(machine);
117114}
118115
r6902r6903
128125   /* basic machine hardware */
129126   MDRV_CPU_ADD("maincpu", 8080, XTAL_2MHz)
130127   MDRV_CPU_PROGRAM_MAP(interact_mem)
131    MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) //  put on the 8080 irq in Hz
128    MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) /*  put on the 8080 irq in Hz*/
132129
133130   MDRV_MACHINE_RESET(interact)
134131    MDRV_MACHINE_START(interact)
r6902r6903
140137   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
141138   MDRV_SCREEN_SIZE(256, 79)
142139   MDRV_SCREEN_VISIBLE_AREA(0, 112, 0, 77)
143   MDRV_PALETTE_LENGTH(16)            // 8 colours, but only 4 at a time
140   MDRV_PALETTE_LENGTH(16)            /* 8 colours, but only 4 at a time*/
144141   MDRV_PALETTE_INIT(black_and_white)
145142
146143   MDRV_VIDEO_START(hec2hrp)
r6902r6903
148145      /* sound hardware */
149146   MDRV_SPEAKER_STANDARD_MONO("mono")
150147   MDRV_SOUND_WAVE_ADD("wave", "cassette")
151   MDRV_SOUND_ROUTE(0, "mono", 0.1)// Sound level for cassette, as it is in mono => output channel=0
148   MDRV_SOUND_ROUTE(0, "mono", 0.1)  /* Sound level for cassette, as it is in mono => output channel=0*/
152149
153150   MDRV_SOUND_ADD("sn76477", SN76477, 0)
154151   MDRV_SOUND_CONFIG(hector_sn76477_interface)
155152   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.1)
156153
157   MDRV_SOUND_ADD("discrete", DISCRETE, 0) // Son 1bit
154   MDRV_SOUND_ADD("discrete", DISCRETE, 0) /* Son 1bit*/
158155   MDRV_SOUND_CONFIG_DISCRETE( hec2hrp )
159156   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
160157
161    // Gestion cassette
158    /* Gestion cassette*/
162159    MDRV_CASSETTE_ADD( "cassette", interact_cassette_config )
163160
164161   /* printer */
r6902r6903
171168   /* basic machine hardware */
172169   MDRV_CPU_ADD("maincpu", Z80, XTAL_1_75MHz)
173170   MDRV_CPU_PROGRAM_MAP(interact_mem)
174    MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) //  put on the 8080 irq in Hz
171    MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) /*  put on the 8080 irq in Hz*/
175172
176173   MDRV_MACHINE_RESET(interact)
177174    MDRV_MACHINE_START(interact)
r6902r6903
183180   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
184181   MDRV_SCREEN_SIZE(256, 79)
185182   MDRV_SCREEN_VISIBLE_AREA(0, 112, 0, 77)
186   MDRV_PALETTE_LENGTH(16)            // 8 colours, but only 4 at a time
183   MDRV_PALETTE_LENGTH(16)            /* 8 colours, but only 4 at a time*/
187184   MDRV_PALETTE_INIT(black_and_white)
188185
189186   MDRV_VIDEO_START(hec2hrp)
r6902r6903
191188      /* sound hardware */
192189   MDRV_SPEAKER_STANDARD_MONO("mono")
193190   MDRV_SOUND_WAVE_ADD("wave", "cassette")
194   MDRV_SOUND_ROUTE(0, "mono", 0.1)// Sound level for cassette, as it is in mono => output channel=0
191   MDRV_SOUND_ROUTE(0, "mono", 0.1)/* Sound level for cassette, as it is in mono => output channel=0*/
195192
196193   MDRV_SOUND_ADD("sn76477", SN76477, 0)
197194   MDRV_SOUND_CONFIG(hector_sn76477_interface)
198195   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.1)
199196
200   MDRV_SOUND_ADD("discrete", DISCRETE, 0) // Son 1bit
197   MDRV_SOUND_ADD("discrete", DISCRETE, 0) /* Son 1bit*/
201198   MDRV_SOUND_CONFIG_DISCRETE( hec2hrp )
202199   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
203200
204    // Gestion cassette
201    /* Gestion cassette*/
205202    MDRV_CASSETTE_ADD( "cassette", interact_cassette_config )
206203
207204   /* printer */
r6902r6903
211208
212209/* Input ports */
213210static INPUT_PORTS_START( interact )
214   PORT_INCLUDE( at_keyboard )
211   /* keyboard input */
212   PORT_START("KEY0") /* [0] - port 3000 @ 0 */
213       PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)   PORT_CHAR('\\') PORT_CHAR('|')
214      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space")         PORT_CODE(KEYCODE_SPACE)
215      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return")         PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
216      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab")         PORT_CODE(KEYCODE_TAB)
217      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--")         PORT_CODE(KEYCODE_BACKSPACE)
218      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock")      PORT_CODE(KEYCODE_CAPSLOCK)   
219      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl")         PORT_CODE(KEYCODE_LCONTROL)   PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
220      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift")         PORT_CODE(KEYCODE_LSHIFT)     PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
221   PORT_START("KEY1") /* [1] - port 3000 @ 1 */    /* touches => 2  1  0  /  .  -  ,  +     */
222      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"")         PORT_CODE(KEYCODE_2)    PORT_CHAR('2')
223      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >")          PORT_CODE(KEYCODE_1)   PORT_CHAR('1')
224      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <")          PORT_CODE(KEYCODE_0)   PORT_CHAR('0')
225      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)       PORT_CHAR('.') PORT_CHAR('>')
226      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)   PORT_CHAR(',') PORT_CHAR('<')
227      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)   PORT_CHAR('-') PORT_CHAR('_')
228      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)
229      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)   PORT_CHAR('=') PORT_CHAR('+')
230
231   PORT_START("KEY2") /* [1] - port 3000 @ 2 */     /* touches => .. 9  8  7  6  5  4  3  */
232      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
233      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )")           PORT_CODE(KEYCODE_9)    PORT_CHAR('9')
234      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (")          PORT_CODE(KEYCODE_8)    PORT_CHAR('8')
235      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :")         PORT_CODE(KEYCODE_7)    PORT_CHAR('7')
236      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !")          PORT_CODE(KEYCODE_6)    PORT_CHAR('6')
237      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %")          PORT_CODE(KEYCODE_5)    PORT_CHAR('5')
238      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $")          PORT_CODE(KEYCODE_4)    PORT_CHAR('4')
239      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /")           PORT_CODE(KEYCODE_3)    PORT_CHAR('3')
240   PORT_START("KEY3") /* [1] - port 3000 @ 3 */    /* touches =>  B  A  ..  ? .. =   ..  ;       */
241      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)    PORT_CHAR('B')
242      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A")         PORT_CODE(KEYCODE_Q)    PORT_CHAR('Q')
243      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
244      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)   PORT_CHAR('[') PORT_CHAR('{')
245      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
246      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)   PORT_CHAR(']') PORT_CHAR('}')
247      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
248      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)      PORT_CHAR('/') PORT_CHAR('?')
249   PORT_START("KEY4") /* [1] - port 3000 @ 4 */
250      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)         PORT_CHAR('J')
251      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)          PORT_CHAR('I')
252      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)          PORT_CHAR('H')
253      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)         PORT_CHAR('G')
254      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)          PORT_CHAR('F')
255      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)         PORT_CHAR('E')
256      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)          PORT_CHAR('C')
257      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)         PORT_CHAR('D')
258
259   PORT_START("KEY5") /* [1] - port 3000 @ 5 */
260      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)         PORT_CHAR('R')
261      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q")         PORT_CODE(KEYCODE_A)         PORT_CHAR('A')
262      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)          PORT_CHAR('P')
263      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)         PORT_CHAR('O')
264      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)          PORT_CHAR('N')
265      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)
266      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)          PORT_CHAR('L')
267      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)         PORT_CHAR('K')
268
269   PORT_START("KEY6") /* [1] - port 3000 @ 6 */
270      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z")          PORT_CODE(KEYCODE_W)         PORT_CHAR('W')
271      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)          PORT_CHAR('Y')
272      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X")          PORT_CODE(KEYCODE_X)          PORT_CHAR('X')
273      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W")          PORT_CODE(KEYCODE_Z)         PORT_CHAR('Z')
274      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)          PORT_CHAR('V')
275      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)         PORT_CHAR('U')
276      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)          PORT_CHAR('T')
277      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)         PORT_CHAR('S')
278     
279   PORT_START("KEY7") /* [1] - port 3000 @ 7  JOYSTICK */
280      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT")      PORT_CODE(KEYCODE_LEFT)      PORT_CHAR(UCHAR_MAMEKEY(LEFT))
281      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) RIGHT")      PORT_CODE(KEYCODE_RIGHT)   PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
282      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) UP")         PORT_CODE(KEYCODE_UP)      PORT_CHAR(UCHAR_MAMEKEY(UP))
283      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) DOWN")      PORT_CODE(KEYCODE_DOWN)      PORT_CHAR(UCHAR_MAMEKEY(DOWN))
284      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) LEFT")      PORT_CODE(KEYCODE_1_PAD)    /* Joy(1) on numpad*/
285      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) RIGHT")      PORT_CODE(KEYCODE_3_PAD)   
286      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) UP")         PORT_CODE(KEYCODE_5_PAD)   
287      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN")      PORT_CODE(KEYCODE_2_PAD)
288
289   PORT_START("KEY8") /* [1] - port 3000 @ 8  not for the real machine, but to emulate the analog signal of the joystick */
290      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET")            PORT_CODE(KEYCODE_ESC)      PORT_CHAR(27)
291      PORT_BIT(0x02, IP_ACTIVE_LOW,  IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE")      PORT_CODE(KEYCODE_0_PAD)
292      PORT_BIT(0x04, IP_ACTIVE_LOW,  IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE")      PORT_CODE(KEYCODE_PLUS_PAD)
293      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)+") PORT_CODE(KEYCODE_INSERT)
294      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)-") PORT_CODE(KEYCODE_DEL)
295      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)+") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
296      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)-") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
297      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
215298INPUT_PORTS_END
216299
217300/* ROM definition */
r6902r6903
229312
230313/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS */
231314COMP(1979, interact, 0,       0,   interact,    interact, 0,    "Interact",   "Interact Family Computer", GAME_IMPERFECT_SOUND)
232COMP(????, hector1,  interact,    0,     hector1,    interact, 0,      "Micronique", "Hector 1",   GAME_IMPERFECT_SOUND)
315COMP(1983, hector1,  interact,    0,     hector1,    interact, 0,      "Micronique", "Hector 1",   GAME_IMPERFECT_SOUND)
src/mess/drivers/hec2hrp.c
r6902r6903
2121               => add BR/HR switching
2222               => add bank switch for HRX
2323               => add device MX80c and bank switching for the ROM
24    Importante note : the keyboard function add been piked from
25                      DChector project : http://dchector.free.fr/ made by DanielCoulom
26                      (thank's Daniel)
24      03/01/2010 Update and clean prog  by yo_fr       (jj.stac@aliceadsl.fr)
25            => add the port mapping for keyboard
26
27      don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom
28      (and thank's to Daniel!)             
29
2730    TODO : Add the cartridge function,
2831           Adjust the one shot and A/D timing (sn76477)
2932****************************************************************************/
30//
31// Joystick 0 :
32// clavier numerique :
33//                (UP)5
34//  (left)1                     (right)3
35//               (down)2
36//
37// Fire <+>
38// Pot =>  UP/DOWN (arrows)
39//
40// Joystick 1 :
41// clavier numrique :
42//                (UP)/
43//  (left)7                     (right)9
44//               (down)8
45//
46// Fire <-> or <?>
47// Pot => INS /SUPPR
48// Cassete : wav file (1 way, 16 bits, 44100hz)
33/* Joystick 1 :
34 clavier numerique :
35                (UP)5
36  (left)1                     (right)3
37               (down)2
4938
39 Fire <+>
40 Pot =>  home/end */
41
42 /* Joystick 0 :
43 arrows
44                (UP)^
45  (left)<-                     (right)->
46               (down)v
47
48 Fire <0> on numpad
49 Pot => INS /SUPPR
50 Cassete : wav file (1 way, 16 bits, 44100hz)
51            K7 file  (For data and games)
52           FOR file (for forth screen data)
53*/
54
5055#include "driver.h"
51#include "machine/pckeybrd.h"
56
5257#include "devices/cassette.h"
5358#include "formats/hect_tap.h"
5459#include "devices/printer.h"
55#include "sound/wave.h"      // for K7 sound
56#include "sound/sn76477.h"   // for sn sound
57#include "sound/discrete.h"  // for 1 Bit sound
60#include "sound/sn76477.h"   /* for sn sound*/
61#include "sound/wave.h"      /* for K7 sound*/
62#include "sound/discrete.h"  /* for 1 Bit sound*/
5863#include "cpu/z80/z80.h"
5964
6065#include "includes/hec2hrp.h"
6166
6267
63///////////////////////////////////////////////////////////////////////////////
68/*****************************************************************************/
6469static ADDRESS_MAP_START(hec2hrp_mem, ADDRESS_SPACE_PROGRAM, 8)
65///////////////////////////////////////////////////////////////////////////////
70/*****************************************************************************/
6671   ADDRESS_MAP_UNMAP_HIGH
6772
68    // Hardward address mapping
69   AM_RANGE(0x0800,0x0808) AM_WRITE( hector_switch_bank_w)// Bank management
70   AM_RANGE(0x1000,0x1000) AM_WRITE( hector_color_a_w)  // Color c0/c1
71   AM_RANGE(0x1800,0x1800) AM_WRITE( hector_color_b_w)  // Color c2/c3
72   AM_RANGE(0x2000,0x2003) AM_WRITE( hector_sn_2000_w)  // Sound
73   AM_RANGE(0x2800,0x2803) AM_WRITE( hector_sn_2800_w)  // Sound
74   AM_RANGE(0x3000,0x3000) AM_READWRITE( hector_cassette_r, hector_sn_3000_w)// Write necessary
75   AM_RANGE(0x3800,0x3807) AM_READWRITE( hector_keyboard_r, hector_keyboard_w)  // Keyboard
73    /* Hardward address mapping*/
74   AM_RANGE(0x0800,0x0808) AM_WRITE( hector_switch_bank_w)/* Bank management*/
75   AM_RANGE(0x1000,0x1000) AM_WRITE( hector_color_a_w)  /* Color c0/c1*/
76   AM_RANGE(0x1800,0x1800) AM_WRITE( hector_color_b_w)  /* Color c2/c3*/
77   AM_RANGE(0x2000,0x2003) AM_WRITE( hector_sn_2000_w)  /* Sound*/
78   AM_RANGE(0x2800,0x2803) AM_WRITE( hector_sn_2800_w)  /* Sound*/
79   AM_RANGE(0x3000,0x3000) AM_READWRITE( hector_cassette_r, hector_sn_3000_w)/* Write necessary*/
80   AM_RANGE(0x3800,0x3807) AM_READWRITE( hector_keyboard_r, hector_keyboard_w)  /* Keyboard*/
7681
77    // Main ROM page
82    /* Main ROM page*/
7883   AM_RANGE(0x0000,0x3fff) AM_ROMBANK("bank2")
7984
80   // Vid??o br mapping
85   /* Video br mapping*/
8186   AM_RANGE(0x4000,0x49ff) AM_RAM AM_BASE_GENERIC(videoram)
82   // continous RAM
87   /* continous RAM*/
8388    AM_RANGE(0x4A00,0xbfff) AM_RAM
84   // from 0xC000 to 0xFFFF => Bank Ram for vid??o and data !
89   /* from 0xC000 to 0xFFFF => Bank Ram for video and data !*/
8590   AM_RANGE(0xc000,0xffff) AM_RAMBANK("bank1")
8691ADDRESS_MAP_END
8792
r6902r6903
104109
105110/* Input ports */
106111static INPUT_PORTS_START( hec2hrp )
107   PORT_INCLUDE( at_keyboard )
112   /* keyboard input */
113   PORT_START("KEY0") /* [0] - port 3000 @ 0 */
114       PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)   PORT_CHAR('\\') PORT_CHAR('|')
115      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space")         PORT_CODE(KEYCODE_SPACE)
116      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return")         PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
117      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab")         PORT_CODE(KEYCODE_TAB)
118      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<--")         PORT_CODE(KEYCODE_BACKSPACE)
119      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock")      PORT_CODE(KEYCODE_CAPSLOCK)   
120      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl")         PORT_CODE(KEYCODE_LCONTROL)   PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
121      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift")         PORT_CODE(KEYCODE_LSHIFT)     PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
122   PORT_START("KEY1") /* [1] - port 3000 @ 1 */    /* touches => 2  1  0  /  .  -  ,  +     */
123      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"")         PORT_CODE(KEYCODE_2)    PORT_CHAR('2')
124      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >")          PORT_CODE(KEYCODE_1)   PORT_CHAR('1')
125      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <")          PORT_CODE(KEYCODE_0)   PORT_CHAR('0')
126      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)       PORT_CHAR('.') PORT_CHAR('>')
127      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)   PORT_CHAR(',') PORT_CHAR('<')
128      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)   PORT_CHAR('-') PORT_CHAR('_')
129      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)
130      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)   PORT_CHAR('=') PORT_CHAR('+')
131
132   PORT_START("KEY2") /* [1] - port 3000 @ 2 */     /* touches => .. 9  8  7  6  5  4  3  */
133      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
134      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )")           PORT_CODE(KEYCODE_9)    PORT_CHAR('9')
135      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (")          PORT_CODE(KEYCODE_8)    PORT_CHAR('8')
136      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 :")         PORT_CODE(KEYCODE_7)    PORT_CHAR('7')
137      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 !")          PORT_CODE(KEYCODE_6)    PORT_CHAR('6')
138      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %")          PORT_CODE(KEYCODE_5)    PORT_CHAR('5')
139      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $")          PORT_CODE(KEYCODE_4)    PORT_CHAR('4')
140      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /")           PORT_CODE(KEYCODE_3)    PORT_CHAR('3')
141   PORT_START("KEY3") /* [1] - port 3000 @ 3 */    /* touches =>  B  A  ..  ? .. =   ..  ;       */
142      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)    PORT_CHAR('B')
143      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A")         PORT_CODE(KEYCODE_Q)    PORT_CHAR('Q')
144      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
145      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)   PORT_CHAR('[') PORT_CHAR('{')
146      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
147      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)   PORT_CHAR(']') PORT_CHAR('}')
148      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
149      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)      PORT_CHAR('/') PORT_CHAR('?')
150   PORT_START("KEY4") /* [1] - port 3000 @ 4 */
151      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)         PORT_CHAR('J')
152      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)          PORT_CHAR('I')
153      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)          PORT_CHAR('H')
154      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)         PORT_CHAR('G')
155      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)          PORT_CHAR('F')
156      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)         PORT_CHAR('E')
157      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)          PORT_CHAR('C')
158      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)         PORT_CHAR('D')
159
160   PORT_START("KEY5") /* [1] - port 3000 @ 5 */
161      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)         PORT_CHAR('R')
162      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q")         PORT_CODE(KEYCODE_A)         PORT_CHAR('A')
163      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)          PORT_CHAR('P')
164      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)         PORT_CHAR('O')
165      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)          PORT_CHAR('N')
166      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)
167      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)          PORT_CHAR('L')
168      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)         PORT_CHAR('K')
169
170   PORT_START("KEY6") /* [1] - port 3000 @ 6 */
171      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z")          PORT_CODE(KEYCODE_W)         PORT_CHAR('W')
172      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)          PORT_CHAR('Y')
173      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X")          PORT_CODE(KEYCODE_X)          PORT_CHAR('X')
174      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W")          PORT_CODE(KEYCODE_Z)         PORT_CHAR('Z')
175      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)          PORT_CHAR('V')
176      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)         PORT_CHAR('U')
177      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)          PORT_CHAR('T')
178      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)         PORT_CHAR('S')
179     
180   PORT_START("KEY7") /* [1] - port 3000 @ 7  JOYSTICK */
181      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT")      PORT_CODE(KEYCODE_LEFT)      PORT_CHAR(UCHAR_MAMEKEY(LEFT))
182      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) RIGHT")      PORT_CODE(KEYCODE_RIGHT)   PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
183      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) UP")         PORT_CODE(KEYCODE_UP)      PORT_CHAR(UCHAR_MAMEKEY(UP))
184      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) DOWN")      PORT_CODE(KEYCODE_DOWN)      PORT_CHAR(UCHAR_MAMEKEY(DOWN))
185      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) LEFT")      PORT_CODE(KEYCODE_1_PAD)    // Joy(1) on numpad
186      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) RIGHT")      PORT_CODE(KEYCODE_3_PAD)   
187      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) UP")         PORT_CODE(KEYCODE_5_PAD)   
188      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN")      PORT_CODE(KEYCODE_2_PAD)
189
190   PORT_START("KEY8") /* [1] - port 3000 @ 8  not for the real machine, but to emulate the analog signal of the joystick */
191      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET")            PORT_CODE(KEYCODE_ESC)      PORT_CHAR(27)
192      PORT_BIT(0x02, IP_ACTIVE_LOW,  IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE")      PORT_CODE(KEYCODE_0_PAD)
193      PORT_BIT(0x04, IP_ACTIVE_LOW,  IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE")      PORT_CODE(KEYCODE_PLUS_PAD)
194      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)+") PORT_CODE(KEYCODE_INSERT)
195      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(0)-") PORT_CODE(KEYCODE_DEL)
196      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)+") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
197      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pot(1)-") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
198      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
108199INPUT_PORTS_END
109200
110///////////////////////////////////////////////////////////////////////////////
201/*****************************************************************************/
111202static MACHINE_START( hec2hrp )
112///////////////////////////////////////////////////////////////////////////////
203/*****************************************************************************/
113204{
114205UINT8 *RAM = memory_region(machine, "maincpu"); // pointer to mess ram
115206UINT8 *ROM1 = memory_region(machine, "page1"); // pointer to rom page 1
r6902r6903
122213    // Set bank HECTOR_BANK_PROG as basic bank
123214   memory_set_bank(machine, "bank1", HECTOR_BANK_PROG);
124215
125//////////////////////////////////////////////////////////SPECIFIQUE MX /////////////////
216/******************************************************SPECIFIQUE MX ***************************/
126217   memory_configure_bank(machine, "bank2", HECTORMX_BANK_PAGE0 , 1, &RAM[0x0000]  , 0); // Mess ram
127218   memory_configure_bank(machine, "bank2", HECTORMX_BANK_PAGE1 , 1, &ROM1[0x0000] , 0); // Rom page 1
128219   memory_configure_bank(machine, "bank2", HECTORMX_BANK_PAGE2 , 1, &ROM2[0x0000] , 0); // Rom page 2
129220   memory_set_bank(machine, "bank2", HECTORMX_BANK_PAGE0);
130//////////////////////////////////////////////////////////SPECIFIQUE MX /////////////////
131
132    // Start keyboard
133    at_keyboard_init(machine, AT_KEYBOARD_TYPE_PC);
134    at_keyboard_reset(machine);
135    at_keyboard_set_scan_code_set(2);
136    at_keyboard_reset(machine);
137
138
139    hector_init(machine);
221/******************************************************SPECIFIQUE MX ***************************/
222   hector_init(machine);
140223}
141224
142225static MACHINE_RESET(hec2hrp)
r6902r6903
166249   DISCRETE_OUTPUT(NODE_01, 5000)
167250DISCRETE_SOUND_END
168251
169///////////////////////////////////////////////////////////////////////////////
252/******************************************************************************/
170253static MACHINE_DRIVER_START( hec2hr )
171///////////////////////////////////////////////////////////////////////////////
254/******************************************************************************/
172255   /* basic machine hardware */
173256   MDRV_CPU_ADD("maincpu",Z80, XTAL_5MHz)
174257   MDRV_CPU_PROGRAM_MAP(hec2hrp_mem)
175258   MDRV_CPU_IO_MAP(hec2hrp_io)
176   MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) //  put on the Z80 irq in Hz
259   MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) /*  put on the Z80 irq in Hz*/
177260   MDRV_MACHINE_RESET(hec2hrp)
178261   MDRV_MACHINE_START(hec2hrp)
179262
r6902r6903
192275   /* sound hardware */
193276   MDRV_SPEAKER_STANDARD_MONO("mono")
194277   MDRV_SOUND_WAVE_ADD("wave", "cassette")
195   MDRV_SOUND_ROUTE(0, "mono", 0.1)// Sound level for cassette, as it is in mono => output channel=0
278   MDRV_SOUND_ROUTE(0, "mono", 0.1)
196279
197280   MDRV_SOUND_ADD("sn76477", SN76477, 0)
198281   MDRV_SOUND_CONFIG(hector_sn76477_interface)
199282   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.1)
200283
201   MDRV_SOUND_ADD("discrete", DISCRETE, 0) // Son 1bit
284   MDRV_SOUND_ADD("discrete", DISCRETE, 0) /* Son 1bit*/
202285   MDRV_SOUND_CONFIG_DISCRETE( hec2hrp )
203286   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
204287
205    // Gestion cassette
288    /* Gestion cassette*/
206289    MDRV_CASSETTE_ADD( "cassette", hector_cassette_config )
207290
208291   /* printer */
r6902r6903
210293
211294MACHINE_DRIVER_END
212295
213///////////////////////////////////////////////////////////////////////////////
296/*****************************************************************************/
214297static MACHINE_DRIVER_START( hec2hrp )
215///////////////////////////////////////////////////////////////////////////////
216   /* basic machine hardware */
298/*****************************************************************************/
299/* basic machine hardware */
217300   MDRV_CPU_ADD("maincpu",Z80, XTAL_5MHz)
218301   MDRV_CPU_PROGRAM_MAP(hec2hrp_mem)
219302   MDRV_CPU_IO_MAP(hec2hrp_io)
220   MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) //  put on the Z80 irq in Hz
303   MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) /*  put on the Z80 irq in Hz*/
221304   MDRV_MACHINE_RESET(hec2hrp)
222305   MDRV_MACHINE_START(hec2hrp)
223306
r6902r6903
254337
255338MACHINE_DRIVER_END
256339
257///////////////////////////////////////////////////////////////////////////////
340/*****************************************************************************/
258341static MACHINE_DRIVER_START( hec2mx40 )
259///////////////////////////////////////////////////////////////////////////////
260   /* basic machine hardware */
342/*****************************************************************************/
343/* basic machine hardware */
261344   MDRV_CPU_ADD("maincpu",Z80, XTAL_5MHz)
262345   MDRV_CPU_PROGRAM_MAP(hec2hrp_mem)
263346   MDRV_CPU_IO_MAP(hec2mx40_io)
r6902r6903
298381
299382MACHINE_DRIVER_END
300383
301///////////////////////////////////////////////////////////////////////////////
384/*****************************************************************************/
302385static MACHINE_DRIVER_START( hec2mx80 )
303///////////////////////////////////////////////////////////////////////////////
304   /* basic machine hardware */
386/*****************************************************************************/
387/* basic machine hardware */
305388   MDRV_CPU_ADD("maincpu",Z80, XTAL_5MHz)
306389   MDRV_CPU_PROGRAM_MAP(hec2hrp_mem)
307390   MDRV_CPU_IO_MAP(hec2mx80_io)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team