Previous 15994 Revisions Next

r8174 Wednesday 26th May, 2010 at 17:29:25 UTC by Fabio Priuli
[X07] Added sound, nvram, save state and proper char rom (no more hardcoded fonts) [Sandro Ronco]
[src/mess/drivers]x07.c
[src/mess/includes]x07.h

src/mess/includes/x07.h
r8173r8174
7171
7272   /* kana */
7373   {0xc7, 0xcc, 0xb1, 0xb3, 0xb4, 0xb5, 0xd4, 0xd5},
74   {0xd6, 0xdc, 0xce, 0xcd, 0xc0,0xc3 , 0xb2, 0xbd},
74   {0xd6, 0xdc, 0xce, 0xcd, 0xc0, 0xc3, 0xb2, 0xbd},
7575   {0xb6, 0xdd, 0xc5, 0xc6, 0xd7, 0xbe, 0xde, 0xdf},
7676   {0xc1, 0xc4, 0xbc, 0xca, 0xb7, 0xb8, 0xcf, 0xc9},
7777   {0xd8, 0xda, 0xb9, 0xd1, 0xc2, 0xbb, 0xbf, 0xcb},
r8173r8174
9797   {0x1d, 0x1c, 0x1e, 0x1f, 0x16, 0x0b, 0x0d, 0x12}
9898};
9999
100static const UINT8 font[] =
101{
102   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
103   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
104   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
105   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
106   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
107   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
108   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
109   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
110   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
111   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
112   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
113   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
114   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
115   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
116   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
117   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
118   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
119   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
120   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
121   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
122   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
123   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
124   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
125   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
126   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
127   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
128   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
129   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
130   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
131   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
132   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
133   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
134   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
135   0x20, 0x70, 0x70, 0x20, 0x20, 0x00, 0x20, 0x00,
136   0xd8, 0xd8, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00,
137   0x00, 0x50, 0xf8, 0x50, 0x50, 0xf8, 0x50, 0x00,
138   0x40, 0x70, 0x80, 0x60, 0x10, 0xe0, 0x20, 0x00,
139   0xc0, 0xc8, 0x10, 0x20, 0x40, 0x98, 0x18, 0x00,
140   0x40, 0xa0, 0xa0, 0x40, 0xa8, 0x90, 0x68, 0x00,
141   0x60, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
142   0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00,
143   0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x00,
144   0x00, 0x50, 0x70, 0xf8, 0x70, 0x50, 0x00, 0x00,
145   0x00, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x00, 0x00,
146   0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x40,
147   0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
148   0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
149   0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00,
150   0x70, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x70, 0x00,
151   0x20, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00,
152   0x70, 0x88, 0x08, 0x30, 0x40, 0x80, 0xf8, 0x00,
153   0x70, 0x88, 0x08, 0x70, 0x08, 0x88, 0x70, 0x00,
154   0x10, 0x30, 0x50, 0x90, 0xf8, 0x10, 0x10, 0x00,
155   0xf8, 0x80, 0x80, 0xf0, 0x08, 0x88, 0x70, 0x00,
156   0x30, 0x40, 0x80, 0xf0, 0x88, 0x88, 0x70, 0x00,
157   0xf8, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40, 0x00,
158   0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00,
159   0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60, 0x00,
160   0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00,
161   0x00, 0x00, 0x60, 0x60, 0x00, 0x20, 0x60, 0x40,
162   0x10, 0x20, 0x40, 0x80, 0x40, 0x20, 0x10, 0x00,
163   0x00, 0x00, 0xf8, 0x00, 0x00, 0xf8, 0x00, 0x00,
164   0x40, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x00,
165   0x78, 0x88, 0x08, 0x30, 0x20, 0x00, 0x20, 0x00,
166   0x70, 0x88, 0xb8, 0xa8, 0xb8, 0x80, 0x70, 0x00,
167   0xf8, 0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x00,
168   0xf0, 0x88, 0x88, 0xf0, 0x88, 0x88, 0xf0, 0x00,
169   0xf8, 0x88, 0x80, 0x80, 0x80, 0x88, 0xf8, 0x00,
170   0xf0, 0x88, 0x88, 0x88, 0x88, 0x88, 0xf0, 0x00,
171   0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0xf8, 0x00,
172   0xf8, 0x80, 0x80, 0xf0, 0x80, 0x80, 0x80, 0x00,
173   0xf8, 0x88, 0x80, 0xb8, 0x88, 0x88, 0xf8, 0x00,
174   0x88, 0x88, 0x88, 0xf8, 0x88, 0x88, 0x88, 0x00,
175   0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00,
176   0x08, 0x08, 0x08, 0x08, 0x88, 0x88, 0xf8, 0x00,
177   0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x88, 0x00,
178   0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x00,
179   0x88, 0xf8, 0xa8, 0xa8, 0x88, 0x88, 0x88, 0x00,
180   0x88, 0xc8, 0xa8, 0x98, 0x88, 0x88, 0x88, 0x00,
181   0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00,
182   0xf8, 0x88, 0x88, 0xf8, 0x80, 0x80, 0x80, 0x00,
183   0x70, 0x88, 0x88, 0x88, 0xa8, 0x90, 0x68, 0x00,
184   0xf0, 0x88, 0x88, 0xf0, 0x90, 0x88, 0x88, 0x00,
185   0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, 0x00,
186   0xf8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
187   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0xf8, 0x00,
188   0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00,
189   0x88, 0x88, 0xa8, 0xa8, 0xa8, 0xa8, 0x50, 0x00,
190   0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00,
191   0x88, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x00,
192   0xf0, 0x10, 0x20, 0x40, 0x80, 0x80, 0xf0, 0x00,
193   0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00,
194   0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00,
195   0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00,
196   0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
197   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
198   0x60, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
199   0x00, 0x00, 0xf8, 0x08, 0xf8, 0x88, 0xf8, 0x00,
200   0x80, 0x80, 0xf8, 0x88, 0x88, 0x88, 0xf8, 0x00,
201   0x00, 0x00, 0xf8, 0x80, 0x80, 0x80, 0xf8, 0x00,
202   0x08, 0x08, 0x78, 0x88, 0x88, 0x88, 0x78, 0x00,
203   0x00, 0x00, 0xf8, 0x88, 0xf8, 0x80, 0xf8, 0x00,
204   0x30, 0x40, 0x40, 0xf0, 0x40, 0x40, 0x40, 0x00,
205   0x00, 0x00, 0xf8, 0x88, 0x88, 0xf8, 0x08, 0x78,
206   0x80, 0x80, 0xf0, 0x90, 0x90, 0x90, 0x90, 0x00,
207   0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
208   0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x90, 0x60,
209   0x80, 0x80, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x00,
210   0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x00,
211   0x00, 0x00, 0xf8, 0xa8, 0xa8, 0x88, 0x88, 0x00,
212   0x00, 0x00, 0xf0, 0x90, 0x90, 0x90, 0x90, 0x00,
213   0x00, 0x00, 0xf8, 0x88, 0x88, 0x88, 0xf8, 0x00,
214   0x00, 0x00, 0xf0, 0x88, 0x88, 0x88, 0xf0, 0x80,
215   0x00, 0x00, 0x78, 0x88, 0x88, 0x88, 0x78, 0x08,
216   0x00, 0x00, 0xb8, 0x48, 0x40, 0x40, 0xe0, 0x00,
217   0x00, 0x00, 0x70, 0x80, 0x70, 0x08, 0x70, 0x00,
218   0x00, 0x40, 0xf0, 0x40, 0x40, 0x50, 0x20, 0x00,
219   0x00, 0x00, 0x90, 0x90, 0x90, 0xb0, 0x50, 0x00,
220   0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00,
221   0x00, 0x00, 0x88, 0x88, 0xa8, 0xf8, 0x50, 0x00,
222   0x00, 0x00, 0x90, 0x90, 0x60, 0x90, 0x90, 0x00,
223   0x00, 0x00, 0x90, 0x90, 0x90, 0x70, 0x20, 0xc0,
224   0x00, 0x00, 0xf0, 0x10, 0x60, 0x80, 0xf0, 0x00,
225   0x30, 0x40, 0x40, 0xc0, 0x40, 0x40, 0x30, 0x00,
226   0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00,
227   0x60, 0x10, 0x10, 0x18, 0x10, 0x10, 0x60, 0x00,
228   0x50, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229   0xf8, 0xd8, 0xd8, 0xa8, 0xd8, 0xd8, 0xf8, 0x00,
230   0x00, 0x30, 0x78, 0xfc, 0x78, 0x30, 0x00, 0x00,
231   0x00, 0x30, 0x78, 0xfc, 0x78, 0x30, 0x00, 0x00,
232   0x00, 0x30, 0x78, 0xfc, 0x78, 0x30, 0x00, 0x00,
233   0x00, 0x00, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x00
234};
235
236
237100/***************************************************************************
238101    FUNCTION PROTOTYPES
239102***************************************************************************/
r8173r8174
242105static VIDEO_UPDATE( x07 );
243106static READ8_HANDLER( x07_IO_r );
244107static WRITE8_HANDLER( x07_IO_w );
108static NVRAM_HANDLER( x07 );
245109static TIMER_CALLBACK( irq_clear );
110static TIMER_CALLBACK( beep_stop );
246111static TIMER_CALLBACK( keyboard_clear );
247112static TIMER_DEVICE_CALLBACK( keyboard_poll );
248113static MACHINE_START( x07 );
src/mess/drivers/x07.c
r8173r8174
55   Driver by Sandro Ronco based on X-07 emu by J.Brigaud
66
77   TODO:
8   -External video
9   -Sound
10   -NVRAM and Save State
11   -Kana and graphic char
8   -External video (need X-720 dump)
129   -Serial port
1310
14
1511   Memory Map
1612
1713   0x0000 - 0x1fff   Internal RAM
r8173r8174
2016   0x6000 - 0x7fff   ROM Card
2117   0x8000 - 0x97ff   Video RAM
2218   0x9800 - 0x9fff   ?
23   0xA000 - 0xafff   TV ROM
19   0xa000 - 0xafff   TV ROM (no dump)
2420   0xb000 - 0xffff   ROM
2521
2622   CPU was actually a NSC800 (Z80 compatible)
r8173r8174
3026
3127#include "emu.h"
3228#include "cpu/z80/z80.h"
29#include "sound/beep.h"
3330#include "includes/x07.h"
3431
3532static void t6834_cmd (running_machine *machine, UINT8 cmd);
r8173r8174
5148   t6834_state(running_machine &machine) { }
5249
5350   /* General */
51   UINT8 *ram;
52   UINT16 ram_size;
5453   UINT8 t6834_ram[800];
5554   UINT8 regs_r[8];
5655   UINT8 regs_w[8];
r8173r8174
6564   UINT8 out_data[256];
6665   UINT8 out_size;
6766   UINT8 out_pos;
67   emu_timer *irq_clear;
68   emu_timer *beep_clear;
6869
6970   /* LCD */
7071   UINT8 lcd_on;
r8173r8174
7475   UINT8 cur_on;
7576   UINT8 cur_x;
7677   UINT8 cur_y;
77   UINT8 loc_on ;
78   UINT8 loc_on;
7879   UINT8 loc_x;
7980   UINT8 loc_y;
8081   UINT8 font_code;
r8173r8174
9293   UINT8 kb_wait;
9394   UINT8 kb_data[20];
9495   UINT8 kb_size;
96   emu_timer *kb_clear;
9597};
9698
9799
r8173r8174
308310      break;
309311
310312   case 0x16:   //udk write
311      p1 = state->in_data[state->in_pos++];
313      p1 = state->in_data[state->in_pos++] - 1;
312314      for(i = 0; i < ((p1 != 5 && p1 != 11) ? 0x2a : 0x2e); i++)
313315         state->t6834_ram[udk_ptr[p1] + i] = state->in_data[state->in_pos++];
314316      break;
315317
316318   case 0x17:   //udk read
317      p1 = state->in_data[state->in_pos++];
319      p1 = state->in_data[state->in_pos++] - 1;
318320      for(i = 0; i < ((p1 != 5 && p1 != 11) ? 0x2a : 0x2e); i++)
319321      {
320322         UINT8 code = state->t6834_ram[udk_ptr[p1] + i];
r8173r8174
341343      break;
342344
343345   case 0x1c:   //udc Init
344      memcpy(&state->udc, &font, sizeof(state->udc));
346      memcpy(&state->udc, (UINT8*)memory_region(machine, "gfx1"), memory_region_length(machine, "gfx1"));
345347      break;
346348
347349   case 0x1d:   //Pgm Write
r8173r8174
622624   state->shift = (row7 & 0x01) ? 1 : 0;
623625   state->ctrl = (row7 & 0x02) ? 1 : 0;
624626   state->graph = (row7 & 0x04) ? 1 : 0;
627   state->kana = (row7 & 0x10) ? 1 : 0;
625628
626629   if(state->udk)
627630      draw_udk(machine);
r8173r8174
673676   }
674677   else
675678   {
676      if (state->shift && !state->ctrl)
679      if (state->shift && !state->ctrl && !state->kana && !state->graph)
677680         kb_table = 1;
678      else if (!state->shift && state->ctrl)
681      else if (!state->shift && state->ctrl && !state->kana && !state->graph)
679682         kb_table = 2;
683      else if (!state->shift && state->kana && !state->ctrl && !state->graph)
684         kb_table = 3;
685      else if (state->shift && state->kana && !state->ctrl && !state->graph)
686         kb_table = 4;
687      else if (!state->shift && !state->kana && !state->ctrl && state->graph)
688         kb_table = 5;
689      else
690         kb_table = 0;
680691
681692      for (row = 0; row < 7; row++)
682693      {
r8173r8174
699710   {
700711      state->kb_wait = 1;
701712      irq_exec(machine);
702      timer_set(machine, ATTOTIME_IN_MSEC(150), NULL, 0, keyboard_clear);
713      timer_adjust_oneshot(state->kb_clear, ATTOTIME_IN_MSEC(150), 0);
703714   }
704715}
705716
r8173r8174
712723   {
713724      state->regs_r[0] = 0;
714725      state->regs_r[1] = state->kb_data[0];
715      memcpy(state->kb_data, &state->kb_data[1], sizeof(state->kb_data - 1));
726      memcpy(state->kb_data, &state->kb_data[1], sizeof(state->kb_data) - 1);
716727      state->kb_size--;
717728      state->regs_r[2] |= 0x01;
718729      cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE);
719      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 500), NULL, 0, irq_clear);
730      timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0);
720731      return;
721732   }
722733   else if (state->kb_brk)
r8173r8174
726737      state->regs_r[2] |= 0x01;
727738      state->kb_brk = 0;
728739      cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE );
729      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 500), NULL, 0, irq_clear);
740      timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0);
730741      return;
731742   }
732743   else if ( state->z80_irq&1 )
r8173r8174
734745      receive_from_t6834 (machine);
735746      state->z80_irq &= ~1;
736747      cputag_set_input_line(machine, "maincpu", NSC800_RSTA, ASSERT_LINE);
737      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 500), NULL, 0, irq_clear);
748      timer_adjust_oneshot(state->irq_clear, cputag_clocks_to_attotime(machine, "maincpu", 500), 0);
738749      return;
739750   }
740751}
r8173r8174
916927      state->enable_k7=((data & 0x0c) == 8) ? 1 : 0;
917928      if((data & 0x0e) == 0x0e)
918929      {
919         popmessage("Beep %x", state->regs_w[2] | (state->regs_w[3] << 8));
930         running_device *speaker = devtag_get_device(space->machine, "beep");
920931
932         beep_set_state(speaker, 1);
933         beep_set_frequency(speaker, 192000 / (state->regs_w[2] | (state->regs_w[3] << 8)));
934
935         timer_adjust_oneshot(state->beep_clear, ATTOTIME_IN_MSEC(state->ram[0x450] * 0x32), 0);
921936      }
922937
923938      break;
r8173r8174
933948
934949static ADDRESS_MAP_START(x07_mem, ADDRESS_SPACE_PROGRAM, 8)
935950   ADDRESS_MAP_UNMAP_HIGH
936   AM_RANGE(0x0000, 0x5fff) AM_RAM
951   AM_RANGE(0x0000, 0x5fff) AM_RAM AM_BASE_SIZE_MEMBER(t6834_state, ram, ram_size)
937952   AM_RANGE(0x6000, 0x7fff) AM_READONLY
938953   AM_RANGE(0x8000, 0x97ff) AM_RAM
939954   AM_RANGE(0x9800, 0x9fff) AM_NOP
r8173r8174
10331048      PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("shift") PORT_CODE(KEYCODE_LSHIFT)
10341049      PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ctrl") PORT_CODE(KEYCODE_LCONTROL)
10351050      PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("GRPH") PORT_CODE(KEYCODE_RCONTROL)
1036      PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_RSHIFT)
1051      PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Kana") PORT_CODE(KEYCODE_RALT)
1052      PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ON/Break") PORT_CODE(KEYCODE_RSHIFT)
10371053
10381054   PORT_START("ROW8")
10391055      PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1)
r8173r8174
10441060
10451061INPUT_PORTS_END
10461062
1063
1064static NVRAM_HANDLER( x07 )
1065{
1066   t6834_state *state = (t6834_state *)machine->driver_data;
1067
1068   if (read_or_write)
1069   {
1070      mame_fwrite(file, state->ram, state->ram_size);
1071      mame_fwrite(file, state->t6834_ram, sizeof(state->t6834_ram));
1072      mame_fwrite(file, state->udc, sizeof(state->udc));
1073   }
1074   else
1075   {
1076      if (file)
1077      {
1078         mame_fread(file, state->ram, state->ram_size);
1079         mame_fread(file, state->t6834_ram, sizeof(state->t6834_ram));
1080         mame_fread(file, state->udc, sizeof(state->udc));
1081
1082      }
1083      else
1084      {
1085         for(int i = 0; i < 12; i++)
1086            strcpy((char*)state->t6834_ram + udk_ptr[i], udk_ini[i]);
1087
1088         memcpy(&state->udc, (UINT8*)memory_region(machine, "gfx1"), memory_region_length(machine, "gfx1"));
1089      }
1090   }
1091}
1092
1093
10471094static TIMER_CALLBACK( irq_clear )
10481095{
10491096   cputag_set_input_line(machine, "maincpu", NSC800_RSTA, CLEAR_LINE);
10501097}
10511098
1099static TIMER_CALLBACK( beep_stop )
1100{
1101   running_device *speaker = devtag_get_device(machine, "beep");
1102   beep_set_state(speaker, 0);
1103}
1104
10521105static TIMER_CALLBACK( keyboard_clear )
10531106{
10541107   t6834_state *state = (t6834_state *)machine->driver_data;
r8173r8174
10611114   keyboard_scan (timer->machine);
10621115}
10631116
1117static const gfx_layout x07_charlayout =
1118{
1119   6, 8,               /* 6 x 8 characters */
1120   256,               /* 256 characters */
1121   1,                  /* 1 bits per pixel */
1122   { 0 },               /* no bitplanes */
1123   { 0, 1, 2, 3, 4, 5},
1124   { 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8},
1125   8*8                  /* 8 bytes */
1126};
1127
1128static GFXDECODE_START( x07 )
1129   GFXDECODE_ENTRY( "gfx1", 0x0000, x07_charlayout, 0, 1 )
1130GFXDECODE_END
1131
1132
10641133static MACHINE_START( x07 )
10651134{
10661135   t6834_state *state = (t6834_state *)machine->driver_data;
10671136
1068   state_save_register_global_pointer(machine, state->t6834_ram, sizeof(state->t6834_ram));
1137   state ->irq_clear = timer_alloc(machine, irq_clear, 0);
1138   state ->beep_clear = timer_alloc(machine, beep_stop, 0);
1139   state ->kb_clear = timer_alloc(machine, keyboard_clear, 0);
1140
1141   /* Save State */
1142
1143   state_save_register_global_array(machine, state->t6834_ram);
1144   state_save_register_global_array(machine, state->regs_r);
1145   state_save_register_global_array(machine, state->regs_w);
1146   state_save_register_global_array(machine, state->udc);
1147   state_save_register_global_array(machine, state->alarm);
1148   state_save_register_global(machine, state->enable_k7);
1149   state_save_register_global(machine, state->udk);
1150   state_save_register_global(machine, state->z80_irq);
1151   state_save_register_global_array(machine, state->in_data);
1152   state_save_register_global(machine, state->in_size);
1153   state_save_register_global(machine, state->in_pos);
1154   state_save_register_global_array(machine, state->out_data);
1155   state_save_register_global(machine, state->out_size);
1156   state_save_register_global(machine, state->out_pos);
1157   state_save_register_global(machine, state->lcd_on);
1158   state_save_register_global_2d_array(machine, state->lcd_map);
1159   state_save_register_global(machine, state->scroll_min);
1160   state_save_register_global(machine, state->scroll_max);
1161   state_save_register_global(machine, state->cur_on);
1162   state_save_register_global(machine, state->cur_x);
1163   state_save_register_global(machine, state->cur_y);
1164   state_save_register_global(machine, state->loc_on);
1165   state_save_register_global(machine, state->loc_x);
1166   state_save_register_global(machine, state->loc_y);
1167   state_save_register_global(machine, state->font_code);
1168   state_save_register_global(machine, state->kb_on);
1169   state_save_register_global(machine, state->ctrl);
1170   state_save_register_global(machine, state->shift);
1171   state_save_register_global(machine, state->kana);
1172   state_save_register_global(machine, state->graph);
1173   state_save_register_global(machine, state->stick);
1174   state_save_register_global(machine, state->strig);
1175   state_save_register_global(machine, state->strig1);
1176   state_save_register_global(machine, state->kb_brk);
1177   state_save_register_global(machine, state->kb_wait);
1178   state_save_register_global_array(machine, state->kb_data);
1179   state_save_register_global(machine, state->kb_size);
10691180}
10701181
10711182static MACHINE_RESET( x07 )
10721183{
10731184   t6834_state *state = (t6834_state *)machine->driver_data;
1074   UINT8 i;
1185
10751186   cpu_set_reg(devtag_get_device(machine, "maincpu"), Z80_PC, 0xc3c3);
10761187
1077   memset(state, 0, sizeof(t6834_state));
1188   memset(state->regs_r, 0, sizeof(state->regs_r));
1189   memset(state->regs_w, 0, sizeof(state->regs_w));
1190   memset(state->alarm, 0, sizeof(state->alarm));
1191   memset(state->in_data, 0, sizeof(state->in_data));
1192   memset(state->out_data, 0, sizeof(state->out_data));
1193   memset(state->lcd_map, 0, sizeof(state->lcd_map));
1194   memset(state->kb_data, 0, sizeof(state->kb_data));
10781195
1079   state->lcd_on      = 0x01;
1080   state->stick      = 0x30;
1081   state->strig      = 0xFF;
1082   state->strig1      = 0xFF;
1083   state->scroll_max   = 0x03;
1196   state->enable_k7 =    0;
1197   state->udk =       0;
1198   state->z80_irq =    0;
1199   state->in_size =    0;
1200   state->in_pos =    0;
1201   state->out_size =    0;
1202   state->out_pos =    0;
1203   state->lcd_on =    0x01;
1204   state->scroll_min = 0;
1205   state->scroll_max = 0x03;
1206   state->cur_on =    0;
1207   state->cur_x =       0;
1208   state->cur_y =       0;
1209   state->loc_on =    0;
1210   state->loc_x =       0;
1211   state->loc_y =       0;
1212   state->font_code =    0;
1213   state->kb_on =       0;
1214   state->ctrl =       0;
1215   state->shift =       0;
1216   state->kana =       0;
1217   state->graph =       0;
1218   state->stick =       0x30;
1219   state->strig =       0xff;
1220   state->strig1 =    0xff;
1221   state->kb_brk =    0;
1222   state->kb_wait =    0;
1223   state->kb_size =    0;
10841224
1085   for(i = 0; i < 12; i++)
1086      strcpy((char*)state->t6834_ram + udk_ptr[i], udk_ini[i]);
1087
10881225   state->regs_r[2] = input_port_read(machine, "CARDBATTERY");
1089
1090   memcpy(&state->udc, &font, sizeof(font));
10911226}
10921227
10931228static MACHINE_DRIVER_START( x07 )
r8173r8174
11121247   MDRV_PALETTE_LENGTH(2)
11131248   MDRV_PALETTE_INIT(x07)
11141249   MDRV_DEFAULT_LAYOUT(layout_lcd)
1250   MDRV_GFXDECODE(x07)
11151251   MDRV_VIDEO_UPDATE(x07)
11161252
1253
1254   MDRV_SPEAKER_STANDARD_MONO( "mono" )
1255   MDRV_SOUND_ADD( "beep", BEEP, 0 )
1256   MDRV_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
1257
11171258   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_poll, USEC(2500))
11181259
1260   MDRV_NVRAM_HANDLER(x07)
1261
11191262MACHINE_DRIVER_END
11201263
11211264/* ROM definition */
r8173r8174
11231266   /* very strange size... */
11241267   ROM_REGION( 0x11000, "maincpu", 0 )
11251268   ROM_LOAD( "x07.bin", 0xb000, 0x5001, CRC(61a6e3cc) SHA1(c53c22d33085ac7d5e490c5d8f41207729e5f08a) )
1269
1270   ROM_REGION( 0x0800, "gfx1", 0 )
1271   ROM_LOAD( "charset.rom", 0x0000, 0x0800, CRC(b1e59a6e) SHA1(b0c06315a2d5c940a8f288fb6a3428d738696e69) )
1272
11261273ROM_END
11271274
11281275/* Driver */
11291276
11301277/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME    FLAGS */
1131COMP( 1983, x07,    0,      0,       x07,       x07,     0,      "Canon",  "X-07",     GAME_NO_SOUND)
1278COMP( 1983, x07,    0,      0,       x07,       x07,     0,      "Canon",  "X-07",     GAME_SUPPORTS_SAVE)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team