Previous 15994 Revisions Next

r12596 Sunday 14th August, 2011 at 01:48:41 UTC by Robbbert
ZX - modernised
[src/mess/drivers]zx.c
[src/mess/includes]zx.h
[src/mess/machine]zx.c
[src/mess/video]zx.c

src/mess/machine/zx.c
r12595r12596
66
77****************************************************************************/
88
9#include "emu.h"
10#include "cpu/z80/z80.h"
119#include "includes/zx.h"
12#include "imagedev/cassette.h"
13#include "sound/speaker.h"
14#include "machine/ram.h"
1510
1611#define video_screen_get_refresh(screen)   (((screen_config *)(screen)->inline_config)->refresh)
1712
r12595r12596
4136}
4237
4338/* I know this looks really pointless... but it has to be here */
44READ8_HANDLER( zx_ram_r )
39READ8_MEMBER( zx_state::zx_ram_r )
4540{
46   UINT8 *RAM = space->machine().region("maincpu")->base();
41   UINT8 *RAM = machine().region("maincpu")->base();
4742   return RAM[offset | 0xc000];
4843}
4944
50DRIVER_INIT ( zx )
45DRIVER_INIT( zx )
5146{
5247   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
5348
r12595r12596
5651   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x4000);
5752}
5853
59DIRECT_UPDATE_HANDLER ( zx_setdirect )
54DIRECT_UPDATE_HANDLER( zx_setdirect )
6055{
6156   if (address & 0xc000)
6257      zx_ula_r(machine, address, "maincpu", 0);
6358   return address;
6459}
6560
66DIRECT_UPDATE_HANDLER ( pc8300_setdirect )
61DIRECT_UPDATE_HANDLER( pc8300_setdirect )
6762{
6863   if (address & 0xc000)
6964      zx_ula_r(machine, address, "gfx1", 0);
7065   return address;
7166}
7267
73DIRECT_UPDATE_HANDLER ( pow3000_setdirect )
68DIRECT_UPDATE_HANDLER( pow3000_setdirect )
7469{
7570   if (address & 0xc000)
7671      zx_ula_r(machine, address, "gfx1", 1);
7772   return address;
7873}
7974
80MACHINE_RESET ( zx80 )
75MACHINE_RESET( zx80 )
8176{
8277   zx_state *state = machine.driver_data<zx_state>();
8378   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(zx_setdirect), &machine));
8479   state->m_tape_bit = 0x80;
8580}
8681
87MACHINE_RESET ( pow3000 )
82MACHINE_RESET( pow3000 )
8883{
8984   zx_state *state = machine.driver_data<zx_state>();
9085   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(pow3000_setdirect), &machine));
9186   state->m_tape_bit = 0x80;
9287}
9388
94MACHINE_RESET ( pc8300 )
89MACHINE_RESET( pc8300 )
9590{
9691   zx_state *state = machine.driver_data<zx_state>();
9792   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(pc8300_setdirect), &machine));
r12595r12596
10499   state->m_tape_bit = 0x80;
105100}
106101
107READ8_HANDLER ( zx80_io_r )
102READ8_MEMBER( zx_state::zx80_io_r )
108103{
109   zx_state *state = space->machine().driver_data<zx_state>();
110104/* port FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out
111    The upper 8 bits are used to select a keyboard scan line
105    The upper 8 bits are used to select a keyboard scan line */
112106
113    The diode doesn't make any visual difference, but it's in the schematic, and used by the code. */
114
115107   UINT8 data = 0xff;
116108   UINT8 offs = offset & 0xff;
117109
118110   if (offs == 0xfe)
119111   {
120112      if ((offset & 0x0100) == 0)
121         data &= input_port_read(space->machine(), "ROW0");
113         data &= input_port_read(machine(), "ROW0");
122114      if ((offset & 0x0200) == 0)
123         data &= input_port_read(space->machine(), "ROW1");
115         data &= input_port_read(machine(), "ROW1");
124116      if ((offset & 0x0400) == 0)
125         data &= input_port_read(space->machine(), "ROW2");
117         data &= input_port_read(machine(), "ROW2");
126118      if ((offset & 0x0800) == 0)
127         data &= input_port_read(space->machine(), "ROW3");
119         data &= input_port_read(machine(), "ROW3");
128120      if ((offset & 0x1000) == 0)
129         data &= input_port_read(space->machine(), "ROW4");
121         data &= input_port_read(machine(), "ROW4");
130122      if ((offset & 0x2000) == 0)
131         data &= input_port_read(space->machine(), "ROW5");
123         data &= input_port_read(machine(), "ROW5");
132124      if ((offset & 0x4000) == 0)
133         data &= input_port_read(space->machine(), "ROW6");
125         data &= input_port_read(machine(), "ROW6");
134126      if ((offset & 0x8000) == 0)
135         data &= input_port_read(space->machine(), "ROW7");
127         data &= input_port_read(machine(), "ROW7");
136128
137      if (!input_port_read(space->machine(), "CONFIG"))
129      if (!input_port_read(machine(), "CONFIG"))
138130         data &= ~0x40;
139131
140      space->machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
132      machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
141133
142      if (state->m_ula_irq_active)
134      if (m_ula_irq_active)
143135      {
144         zx_ula_bkgnd(space->machine(), 0);
145         state->m_ula_irq_active = 0;
146
147//          LOG_ZX81_IOR("ULA IRQs off");
136         zx_ula_bkgnd(0);
137         m_ula_irq_active = 0;
148138      }
149139//      else
150140//      {
151         if (((space->machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && state->m_tape_bit)
141         if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit)
152142         {
153            state->m_tape_bit = 0x00;
154            space->machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
143            m_tape_bit = 0x00;
144            machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
155145         }
156146
157         data &= ~state->m_tape_bit;
158
159//          LOG_ZX81_IOR("Tape");
147         data &= ~m_tape_bit;
160148//      }
161      if (state->m_ula_frame_vsync == 3)
149      if (m_ula_frame_vsync == 3)
162150      {
163         state->m_ula_frame_vsync = 2;
164//          LOG_ZX81_VSYNC;
151         m_ula_frame_vsync = 2;
165152      }
166153   }
167   else
168      LOG_ZX81_IOR("Unmapped port");
169154
170155   return data;
171156}
172157
173READ8_HANDLER ( zx81_io_r )
158READ8_MEMBER( zx_state::zx81_io_r )
174159{
175   zx_state *state = space->machine().driver_data<zx_state>();
176160/* port FB = read printer status, not emulated
177161    FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out
178162    The upper 8 bits are used to select a keyboard scan line */
r12595r12596
183167   if (offs == 0xfe)
184168   {
185169      if ((offset & 0x0100) == 0)
186         data &= input_port_read(space->machine(), "ROW0");
170         data &= input_port_read(machine(), "ROW0");
187171      if ((offset & 0x0200) == 0)
188         data &= input_port_read(space->machine(), "ROW1");
172         data &= input_port_read(machine(), "ROW1");
189173      if ((offset & 0x0400) == 0)
190         data &= input_port_read(space->machine(), "ROW2");
174         data &= input_port_read(machine(), "ROW2");
191175      if ((offset & 0x0800) == 0)
192         data &= input_port_read(space->machine(), "ROW3");
176         data &= input_port_read(machine(), "ROW3");
193177      if ((offset & 0x1000) == 0)
194         data &= input_port_read(space->machine(), "ROW4");
178         data &= input_port_read(machine(), "ROW4");
195179      if ((offset & 0x2000) == 0)
196         data &= input_port_read(space->machine(), "ROW5");
180         data &= input_port_read(machine(), "ROW5");
197181      if ((offset & 0x4000) == 0)
198         data &= input_port_read(space->machine(), "ROW6");
182         data &= input_port_read(machine(), "ROW6");
199183      if ((offset & 0x8000) == 0)
200         data &= input_port_read(space->machine(), "ROW7");
184         data &= input_port_read(machine(), "ROW7");
201185
202      if (!input_port_read(space->machine(), "CONFIG"))
186      if (!input_port_read(machine(), "CONFIG"))
203187         data &= ~0x40;
204188
205      space->machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
189      machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
206190
207      if (state->m_ula_irq_active)
191      if (m_ula_irq_active)
208192      {
209         zx_ula_bkgnd(space->machine(), 0);
210         state->m_ula_irq_active = 0;
211
212//          LOG_ZX81_IOR("ULA IRQs off");
193         zx_ula_bkgnd(0);
194         m_ula_irq_active = 0;
213195      }
214196      else
215197      {
216         if (((space->machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && state->m_tape_bit)
198         if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit)
217199         {
218            state->m_tape_bit = 0x00;
219            space->machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
200            m_tape_bit = 0x00;
201            machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
220202         }
221203
222         data &= ~state->m_tape_bit;
223
224//          LOG_ZX81_IOR("Tape");
204         data &= ~m_tape_bit;
225205      }
226      if (state->m_ula_frame_vsync == 3)
206      if (m_ula_frame_vsync == 3)
227207      {
228         state->m_ula_frame_vsync = 2;
229//          LOG_ZX81_VSYNC;
208         m_ula_frame_vsync = 2;
230209      }
231210   }
232   else
233      LOG_ZX81_IOR("Unmapped port");
234211
235212   return data;
236213}
237214
238READ8_HANDLER ( pc8300_io_r )
215READ8_MEMBER( zx_state::pc8300_io_r )
239216{
240   zx_state *state = space->machine().driver_data<zx_state>();
241217/* port F5 = sound
242218    F6 = unknown
243219    FB = read printer status, not emulated
r12595r12596
247223
248224   UINT8 data = 0xff;
249225   UINT8 offs = offset & 0xff;
250   device_t *speaker = space->machine().device(SPEAKER_TAG);
226   device_t *speaker = machine().device(SPEAKER_TAG);
251227
252228   if (offs == 0xf5)
253229   {
254      state->m_speaker_state ^= 1;
255      speaker_level_w(speaker, state->m_speaker_state);
230      m_speaker_state ^= 1;
231      speaker_level_w(speaker, m_speaker_state);
256232   }
257233   else
258234   if (offs == 0xfe)
259235   {
260236      if ((offset & 0x0100) == 0)
261         data &= input_port_read(space->machine(), "ROW0");
237         data &= input_port_read(machine(), "ROW0");
262238      if ((offset & 0x0200) == 0)
263         data &= input_port_read(space->machine(), "ROW1");
239         data &= input_port_read(machine(), "ROW1");
264240      if ((offset & 0x0400) == 0)
265         data &= input_port_read(space->machine(), "ROW2");
241         data &= input_port_read(machine(), "ROW2");
266242      if ((offset & 0x0800) == 0)
267         data &= input_port_read(space->machine(), "ROW3");
243         data &= input_port_read(machine(), "ROW3");
268244      if ((offset & 0x1000) == 0)
269         data &= input_port_read(space->machine(), "ROW4");
245         data &= input_port_read(machine(), "ROW4");
270246      if ((offset & 0x2000) == 0)
271         data &= input_port_read(space->machine(), "ROW5");
247         data &= input_port_read(machine(), "ROW5");
272248      if ((offset & 0x4000) == 0)
273         data &= input_port_read(space->machine(), "ROW6");
249         data &= input_port_read(machine(), "ROW6");
274250      if ((offset & 0x8000) == 0)
275         data &= input_port_read(space->machine(), "ROW7");
251         data &= input_port_read(machine(), "ROW7");
276252
277      space->machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
253      machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
278254
279      if (state->m_ula_irq_active)
255      if (m_ula_irq_active)
280256      {
281         zx_ula_bkgnd(space->machine(), 0);
282         state->m_ula_irq_active = 0;
283
284//          LOG_ZX81_IOR("ULA IRQs off");
257         zx_ula_bkgnd(0);
258         m_ula_irq_active = 0;
285259      }
286260      else
287261      {
288         if (((space->machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && state->m_tape_bit)
262         if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit)
289263         {
290            state->m_tape_bit = 0x00;
291            space->machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
264            m_tape_bit = 0x00;
265            machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
292266         }
293267
294         data &= ~state->m_tape_bit;
295
296//          LOG_ZX81_IOR("Tape");
268         data &= ~m_tape_bit;
297269      }
298      if (state->m_ula_frame_vsync == 3)
270      if (m_ula_frame_vsync == 3)
299271      {
300         state->m_ula_frame_vsync = 2;
301//          LOG_ZX81_VSYNC;
272         m_ula_frame_vsync = 2;
302273      }
303274   }
304   else
305      LOG_ZX81_IOR("Unmapped port");
306275
307276   return data;
308277}
309278
310READ8_HANDLER ( pow3000_io_r )
279READ8_MEMBER( zx_state::pow3000_io_r )
311280{
312   zx_state *state = space->machine().driver_data<zx_state>();
313281/* port 7E = read NTSC/PAL diode
314282    F5 = sound
315283    F6 = unknown
r12595r12596
319287
320288   UINT8 data = 0xff;
321289   UINT8 offs = offset & 0xff;
322   device_t *speaker = space->machine().device(SPEAKER_TAG);
290   device_t *speaker = machine().device(SPEAKER_TAG);
323291
324292   if (offs == 0x7e)
325293   {
326      data = (input_port_read(space->machine(), "CONFIG"));
294      data = (input_port_read(machine(), "CONFIG"));
327295   }
328296   else
329297   if (offs == 0xf5)
330298   {
331      state->m_speaker_state ^= 1;
332      speaker_level_w(speaker, state->m_speaker_state);
299      m_speaker_state ^= 1;
300      speaker_level_w(speaker, m_speaker_state);
333301   }
334302   else
335303   if (offs == 0xfe)
336304   {
337305      if ((offset & 0x0100) == 0)
338         data &= input_port_read(space->machine(), "ROW0");
306         data &= input_port_read(machine(), "ROW0");
339307      if ((offset & 0x0200) == 0)
340         data &= input_port_read(space->machine(), "ROW1");
308         data &= input_port_read(machine(), "ROW1");
341309      if ((offset & 0x0400) == 0)
342         data &= input_port_read(space->machine(), "ROW2");
310         data &= input_port_read(machine(), "ROW2");
343311      if ((offset & 0x0800) == 0)
344         data &= input_port_read(space->machine(), "ROW3");
312         data &= input_port_read(machine(), "ROW3");
345313      if ((offset & 0x1000) == 0)
346         data &= input_port_read(space->machine(), "ROW4");
314         data &= input_port_read(machine(), "ROW4");
347315      if ((offset & 0x2000) == 0)
348         data &= input_port_read(space->machine(), "ROW5");
316         data &= input_port_read(machine(), "ROW5");
349317      if ((offset & 0x4000) == 0)
350         data &= input_port_read(space->machine(), "ROW6");
318         data &= input_port_read(machine(), "ROW6");
351319      if ((offset & 0x8000) == 0)
352         data &= input_port_read(space->machine(), "ROW7");
320         data &= input_port_read(machine(), "ROW7");
353321
354      space->machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
322      machine().device<cassette_image_device>(CASSETTE_TAG)->output(+1.0);
355323
356      if (state->m_ula_irq_active)
324      if (m_ula_irq_active)
357325      {
358         zx_ula_bkgnd(space->machine(), 0);
359         state->m_ula_irq_active = 0;
360         LOG_ZX81_IOR("ULA IRQs off");
326         zx_ula_bkgnd(0);
327         m_ula_irq_active = 0;
361328      }
362329      else
363330      {
364         if (((space->machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && state->m_tape_bit)
331         if (((machine().device<cassette_image_device>(CASSETTE_TAG))->input() < -0.75) && m_tape_bit)
365332         {
366            state->m_tape_bit = 0x00;
367            space->machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
333            m_tape_bit = 0x00;
334            machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse));
368335         }
369336
370         data &= ~state->m_tape_bit;
371
372//          LOG_ZX81_IOR("Tape");
337         data &= ~m_tape_bit;
373338      }
374      if (state->m_ula_frame_vsync == 3)
339      if (m_ula_frame_vsync == 3)
375340      {
376         state->m_ula_frame_vsync = 2;
377//          LOG_ZX81_VSYNC;
341         m_ula_frame_vsync = 2;
378342      }
379343   }
380   else
381      LOG_ZX81_IOR("Unknown port");
382344
383345   return data;
384346}
385347
386WRITE8_HANDLER( zx80_io_w )
348WRITE8_MEMBER( zx_state::zx80_io_w )
387349{
388350/* port FF = write HSYNC and cass data */
389351
390352   UINT8 offs = offset & 0xff;
391353
392354   if (offs == 0xff)
393      space->machine().device<cassette_image_device>(CASSETTE_TAG)->output(-1.0);
394   else
395      LOG_ZX81_IOR("Unmapped port");
355      machine().device<cassette_image_device>(CASSETTE_TAG)->output(-1.0);
396356}
397357
398WRITE8_HANDLER ( zx81_io_w )
358WRITE8_MEMBER( zx_state::zx81_io_w )
399359{
400   zx_state *state = space->machine().driver_data<zx_state>();
360   address_space *mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
401361/* port F5 = unknown, pc8300/pow3000/lambda only
402362    F6 = unknown, pc8300/pow3000/lambda only
403363    FB = write data to printer, not emulated
r12595r12596
405365    FE = turn on NMI generator
406366    FF = write HSYNC and cass data */
407367
408   screen_device *screen = space->machine().first_screen();
368   screen_device *screen = machine().first_screen();
409369   int height = screen->height();
410370   UINT8 offs = offset & 0xff;
411371
412372   if (offs == 0xfd)
413373   {
414      state->m_ula_nmi->reset();
415
416      LOG_ZX81_IOW("ULA NMIs off");
374      m_ula_nmi->reset();
417375   }
418376   else
419377   if (offs == 0xfe)
420378   {
421      state->m_ula_nmi->adjust(attotime::zero, 0, space->machine().device<cpu_device>("maincpu")->cycles_to_attotime(207));
379      m_ula_nmi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(207));
422380
423      LOG_ZX81_IOW("ULA NMIs on");
424
425381      /* remove the IRQ */
426      state->m_ula_irq_active = 0;
382      m_ula_irq_active = 0;
427383   }
428384   else
429385   if (offs == 0xff)
430386   {
431      space->machine().device<cassette_image_device>(CASSETTE_TAG)->output(-1.0);
432      zx_ula_bkgnd(space->machine(), 1);
433      if (state->m_ula_frame_vsync == 2)
387      machine().device<cassette_image_device>(CASSETTE_TAG)->output(-1.0);
388      zx_ula_bkgnd(1);
389      if (m_ula_frame_vsync == 2)
434390      {
435         device_spin_until_time(&space->device(),space->machine().primary_screen->time_until_pos(height - 1, 0));
436         state->m_ula_scanline_count = height - 1;
437         logerror ("S: %d B: %d\n", space->machine().primary_screen->vpos(), space->machine().primary_screen->hpos());
391         device_spin_until_time(&mem->device(),machine().primary_screen->time_until_pos(height - 1, 0));
392         m_ula_scanline_count = height - 1;
393         logerror ("S: %d B: %d\n", machine().primary_screen->vpos(), machine().primary_screen->hpos());
438394      }
439
440      LOG_ZX81_IOW("ULA IRQs on");
441395   }
442   else
443      LOG_ZX81_IOR("Unmapped port");
444396}
445397
src/mess/video/zx.c
r12595r12596
1616
1717****************************************************************************/
1818
19#include "emu.h"
20#include "cpu/z80/z80.h"
2119#include "includes/zx.h"
22#include "sound/dac.h"
2320
2421emu_timer *ula_nmi = NULL;
2522//emu_timer *ula_irq = NULL;
r12595r12596
3633 * (during tape IO or sound output) zx_ula_bkgnd() is used to
3734 * simulate the display of a ZX80/ZX81.
3835 */
39void zx_ula_bkgnd(running_machine &machine, int color)
36void zx_state::zx_ula_bkgnd(UINT8 color)
4037{
41   zx_state *state = machine.driver_data<zx_state>();
42   screen_device *screen = machine.first_screen();
38   screen_device *screen = machine().first_screen();
4339   int width = screen->width();
4440   int height = screen->height();
4541   const rectangle &visarea = screen->visible_area();
4642
47   if (state->m_ula_frame_vsync == 0 && color != state->m_old_c)
43   if (m_ula_frame_vsync == 0 && color != m_old_c)
4844   {
4945      int y, new_x, new_y;
5046      rectangle r;
51      bitmap_t *bitmap = machine.generic.tmpbitmap;
47      bitmap_t *bitmap = machine().generic.tmpbitmap;
5248
53      new_y = machine.primary_screen->vpos();
54      new_x = machine.primary_screen->hpos();
49      new_y = machine().primary_screen->vpos();
50      new_x = machine().primary_screen->hpos();
5551/*      logerror("zx_ula_bkgnd: %3d,%3d - %3d,%3d\n", state->m_old_x, state->m_old_y, new_x, new_y);*/
56      y = state->m_old_y;
52      y = m_old_y;
5753      for (;;)
5854      {
5955         if (y == new_y)
6056         {
61            r.min_x = state->m_old_x;
57            r.min_x = m_old_x;
6258            r.max_x = new_x;
6359            r.min_y = r.max_y = y;
6460            bitmap_fill(bitmap, &r, color);
r12595r12596
6662         }
6763         else
6864         {
69            r.min_x = state->m_old_x;
65            r.min_x = m_old_x;
7066            r.max_x = visarea.max_x;
7167            r.min_y = r.max_y = y;
7268            bitmap_fill(bitmap, &r, color);
73            state->m_old_x = 0;
69            m_old_x = 0;
7470         }
7571         if (++y == height)
7672            y = 0;
7773      }
78      state->m_old_x = (new_x + 1) % width;
79      state->m_old_y = new_y;
80      state->m_old_c = color;
74      m_old_x = (new_x + 1) % width;
75      m_old_y = new_y;
76      m_old_c = color;
8177   }
8278}
8379
src/mess/includes/zx.h
r12595r12596
77#ifndef ZX_H_
88#define ZX_H_
99
10#include "emu.h"
11#include "cpu/z80/z80.h"
12#include "sound/speaker.h"
13#include "sound/wave.h"
14#include "imagedev/cassette.h"
15#include "formats/zx81_p.h"
16#include "machine/ram.h"
1017
18
1119class zx_state : public driver_device
1220{
1321public:
1422   zx_state(const machine_config &mconfig, device_type type, const char *tag)
1523      : driver_device(mconfig, type, tag) { }
1624
25   DECLARE_READ8_MEMBER(zx_ram_r);
26   DECLARE_READ8_MEMBER(zx80_io_r);
27   DECLARE_READ8_MEMBER(zx81_io_r);
28   DECLARE_READ8_MEMBER(pc8300_io_r);
29   DECLARE_READ8_MEMBER(pow3000_io_r);
30   DECLARE_WRITE8_MEMBER(zx80_io_w);
31   DECLARE_WRITE8_MEMBER(zx81_io_w);
1732   emu_timer *m_ula_nmi;
1833   int m_ula_irq_active;
1934   int m_ula_frame_vsync;
r12595r12596
2237   UINT8 m_speaker_state;
2338   int m_old_x;
2439   int m_old_y;
25   int m_old_c;
40   UINT8 m_old_c;
2641   UINT8 m_charline[32];
2742   UINT8 m_charline_ptr;
2843   int m_offs1;
44   void zx_ula_bkgnd(UINT8 color);
2945};
3046
3147
r12595r12596
3652MACHINE_RESET( pow3000 );
3753MACHINE_RESET( pc8300 );
3854
39READ8_HANDLER( zx_ram_r );
40READ8_HANDLER ( pc8300_io_r );
41READ8_HANDLER ( pow3000_io_r );
42READ8_HANDLER ( zx80_io_r );
43WRITE8_HANDLER ( zx80_io_w );
44READ8_HANDLER ( zx81_io_r );
45WRITE8_HANDLER ( zx81_io_w );
46
4755/*----------- defined in video/zx.c -----------*/
4856
4957VIDEO_START( zx );
src/mess/drivers/zx.c
r12595r12596
1717    - Applied NTSC timings to pc8300 only, all others depend on the diode.
1818    - Many keyboard fixes, and descriptions added to keys.
1919    - Fixed .O files from causing an access violation.
20    - Enabled cassette saving (wav only).
20    - Enabled cassette saving.
2121    - Many general fixes to pow3000/lambda.
2222    - Added sound to pc8300/pow3000/lambda.
2323
r12595r12596
2525    - Added rom mirror, this fixes ringo470
2626    - Added back the F4 character display
2727
28    14/08/2011 (Robbbert)
29    - Modernised.
30
2831    To do / problems:
2932    - Some memory areas are not mirrored as they should.
3033    - Video hardware is not fully emulated, so it does not support pseudo hi-res and hi-res modes.
r12595r12596
3235    - lambda/pow3000 32k memory pack is unemulated, because where is the upper 16k mirror going to be?
3336    - h4th and tree4th need their address maps worked out (eg, the stack is set to FB80)
3437    - lambda/pow3000 joystick, connected in parallel with the 4,R,F,7,U keys, but the directions are unknown.
35    - Currently, cassettes will be saved in .wav format, even if you choose something else.
3638    - Many games don't work.
3739
3840
3941****************************************************************************/
42#define ADDRESS_MAP_MODERN
4043
41#include "emu.h"
42#include "cpu/z80/z80.h"
43#include "sound/speaker.h"
44#include "sound/wave.h"
4544#include "includes/zx.h"
46#include "imagedev/cassette.h"
47#include "formats/zx81_p.h"
48#include "machine/ram.h"
4945
5046/* Memory Maps */
5147
52static ADDRESS_MAP_START( zx80_map, AS_PROGRAM, 8 )
48static ADDRESS_MAP_START( zx80_map, AS_PROGRAM, 8, zx_state )
5349   AM_RANGE(0x0000, 0x1fff) AM_ROM AM_MIRROR(0x2000)
5450   AM_RANGE(0xc000, 0xffff) AM_RAM_READ(zx_ram_r)
5551ADDRESS_MAP_END
5652
57static ADDRESS_MAP_START( zx80_io_map, AS_IO, 8 )
53static ADDRESS_MAP_START( zx80_io_map, AS_IO, 8, zx_state )
5854   AM_RANGE(0x0000, 0xffff) AM_READWRITE(zx80_io_r, zx80_io_w)
5955ADDRESS_MAP_END
6056
61static ADDRESS_MAP_START( zx81_io_map, AS_IO, 8 )
57static ADDRESS_MAP_START( zx81_io_map, AS_IO, 8, zx_state )
6258   AM_RANGE(0x0000, 0xffff) AM_READWRITE(zx81_io_r, zx81_io_w)
6359ADDRESS_MAP_END
6460
65static ADDRESS_MAP_START( pc8300_io_map, AS_IO, 8 )
61static ADDRESS_MAP_START( pc8300_io_map, AS_IO, 8, zx_state )
6662   AM_RANGE(0x0000, 0xffff) AM_READWRITE(pc8300_io_r, zx81_io_w)
6763ADDRESS_MAP_END
6864
69static ADDRESS_MAP_START( pow3000_io_map, AS_IO, 8 )
65static ADDRESS_MAP_START( pow3000_io_map, AS_IO, 8, zx_state )
7066   AM_RANGE(0x0000, 0xffff) AM_READWRITE(pow3000_io_r, zx81_io_w)
7167ADDRESS_MAP_END
7268
r12595r12596
565561COMP( 1981, zx81,       0,      0,      zx81,       zx81,       zx,     "Sinclair Research Ltd",    "ZX-81",               0 )
566562COMP( 1982, ts1000,     zx81,   0,      ts1000,     zx81,       zx,     "Timex Sinclair",           "Timex Sinclair 1000", 0 )
567563COMP( 1983, ts1500,     zx81,   0,      ts1500,     zx81,       zx,     "Timex Sinclair",           "Timex Sinclair 1500", 0 )
568COMP( 1983, tk85,      zx81,   0,      ts1000,     zx81,       zx,     "Microdigital",             "TK85",                0 )
564COMP( 1983, tk85,       zx81,   0,      ts1000,     zx81,       zx,     "Microdigital",             "TK85",                0 )
569565COMP( 1983, ringo470,   zx81,   0,      ts1000,     zx81,       zx,     "Ritas do Brasil Ltda",     "Ringo 470",           0 )
570566COMP( 1984, pc8300,     zx81,   0,      pc8300,     pc8300,     zx,     "Your Computer",            "PC8300",              0 )
571567COMP( 1983, pow3000,    zx81,   0,      pow3000,    pow3000,    zx,     "Creon Enterprises",        "Power 3000",          0 )
572568COMP( 1982, lambda,     zx81,   0,      pow3000,    pow3000,    zx,     "Lambda Electronics Ltd",   "Lambda 8300",         0 )
573COMP( 1997, zx97,       zx81,   0,      zx81,       zx81,      zx,     "Wilf Rigter",              "ZX97",    GAME_NOT_WORKING | GAME_UNOFFICIAL )
569COMP( 1997, zx97,       zx81,   0,      zx81,       zx81,       zx,     "Wilf Rigter",              "ZX97", GAME_NOT_WORKING | GAME_UNOFFICIAL )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team