Previous 199869 Revisions Next

r23494 Thursday 6th June, 2013 at 14:00:58 UTC by Curt Coder
(MESS) ep64: Modernized the Enterprise 64/128 driver. [Curt Coder]
[hash]ep64_cart.xml* ep64_cass.xml
[src/emu/imagedev]cassette.c
[src/lib]lib.mak
[src/lib/formats]ep64_dsk.c* ep64_dsk.h*
[src/mess]mess.mak
[src/mess/audio]dave.c dave.h
[src/mess/drivers]enterp.c ep64.c*
[src/mess/includes]ep64.h*
[src/mess/machine]ep64_exdos.c* ep64_exdos.h* ep64exp.c* ep64exp.h*
[src/mess/video]epnick.c epnick.h nick.c* nick.h*

trunk/src/emu/imagedev/cassette.c
r23493r23494
2424   cassette_default_formats,
2525   NULL,
2626   CASSETTE_PLAY,
27   NULL,
27   "cass",
2828   NULL
2929};
3030
trunk/src/lib/formats/ep64_dsk.c
r0r23494
1/***************************************************************************
2
3    Copyright Olivier Galibert
4    All rights reserved.
5
6    Redistribution and use in source and binary forms, with or without
7    modification, are permitted provided that the following conditions are
8    met:
9
10        * Redistributions of source code must retain the above copyright
11          notice, this list of conditions and the following disclaimer.
12        * Redistributions in binary form must reproduce the above copyright
13          notice, this list of conditions and the following disclaimer in
14          the documentation and/or other materials provided with the
15          distribution.
16        * Neither the name 'MAME' nor the names of its contributors may be
17          used to endorse or promote products derived from this software
18          without specific prior written permission.
19
20    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
21    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
24    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    POSSIBILITY OF SUCH DAMAGE.
31
32****************************************************************************/
33
34/*********************************************************************
35
36    formats/ep64_dsk.c
37
38    Enterprise Sixty Four disk image format
39
40*********************************************************************/
41
42#include "emu.h"
43#include "formats/ep64_dsk.h"
44
45ep64_format::ep64_format() : wd177x_format(formats)
46{
47}
48
49const char *ep64_format::name() const
50{
51   return "ep64";
52}
53
54const char *ep64_format::description() const
55{
56   return "Enteprise Sixty Four disk image";
57}
58
59const char *ep64_format::extensions() const
60{
61   return "img";
62}
63
64// Unverified gap sizes
65const ep64_format::format ep64_format::formats[] = {
66   {   /*  720K 3 1/2 inch double density */
67      floppy_image::FF_35,  floppy_image::DSDD, floppy_image::MFM,
68      2000,  9, 80, 2, 512, {}, 1, {}, 100, 22, 84
69   },
70   {}
71};
72
73const floppy_format_type FLOPPY_EP64_FORMAT = &floppy_image_format_creator<ep64_format>;
Property changes on: trunk/src/lib/formats/ep64_dsk.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/lib/formats/ep64_dsk.h
r0r23494
1/*********************************************************************
2
3    formats/ep64_dsk.h
4
5    Enterprise Sixty Four disk image format
6
7*********************************************************************/
8
9#ifndef EP64_DSK_H_
10#define EP64_DSK_H_
11
12#include "wd177x_dsk.h"
13
14class ep64_format : public wd177x_format {
15public:
16   ep64_format();
17
18   virtual const char *name() const;
19   virtual const char *description() const;
20   virtual const char *extensions() const;
21
22private:
23   static const format formats[];
24};
25
26extern const floppy_format_type FLOPPY_EP64_FORMAT;
27
28#endif
Property changes on: trunk/src/lib/formats/ep64_dsk.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/lib/lib.mak
r23493r23494
129129   $(LIBOBJ)/formats/dfi_dsk.o     \
130130   $(LIBOBJ)/formats/dim_dsk.o     \
131131   $(LIBOBJ)/formats/dsk_dsk.o     \
132   $(LIBOBJ)/formats/ep64_dsk.o    \
132133   $(LIBOBJ)/formats/esq8_dsk.o    \
133134   $(LIBOBJ)/formats/esq16_dsk.o   \
134135   $(LIBOBJ)/formats/fdi_dsk.o     \
trunk/src/mess/audio/dave.c
r23493r23494
11/**********************************************************************
22
3    "Dave" Sound Chip
3    Intelligent Designs DAVE emulation
44
5    DAVE SOUND CHIP FOUND IN ENTERPRISE
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
67
7     working:
8**********************************************************************/
89
9    - pure tone
10    - sampled sounds
11    - 1 kHz, 50 Hz and 1 Hz ints
12    - external ints (int1 and int2) - not correct speed yet
10#include "dave.h"
1311
14**********************************************************************/
1512
16#include "emu.h"
17#include "audio/dave.h"
1813
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
1917
20/***************************************************************************
21    MACROS / CONSTANTS
22***************************************************************************/
18#define LOG 0
2319
2420#define STEP 0x08000
2521
2622
27/***************************************************************************
28    IMPLEMENTATION
29***************************************************************************/
3023
31const device_type DAVE = &device_creator<dave_sound_device>;
24//**************************************************************************
25//  DEVICE DEFINITIONS
26//**************************************************************************
3227
33dave_sound_device::dave_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
34               : device_t(mconfig, DAVE, "Dave", tag, owner, clock),
35                  device_sound_interface(mconfig, *this)
36{
37}
28const device_type DAVE = &device_creator<dave_device>;
3829
30
31DEVICE_ADDRESS_MAP_START( z80_program_map, 8, dave_device )
32   AM_RANGE(0x0000, 0xffff) AM_READWRITE(program_r, program_w)
33ADDRESS_MAP_END
34
35DEVICE_ADDRESS_MAP_START( z80_io_map, 8, dave_device )
36   AM_RANGE(0x0000, 0xffff) AM_READWRITE(io_r, io_w)
37ADDRESS_MAP_END
38
39static ADDRESS_MAP_START( program_map, DAVE_AS_PROGRAM, 8, dave_device )
40ADDRESS_MAP_END
41
42static ADDRESS_MAP_START( io_map, DAVE_AS_IO, 8, dave_device )
43ADDRESS_MAP_END
44
45
46
47//**************************************************************************
48//  LIVE DEVICE
49//**************************************************************************
50
3951//-------------------------------------------------
40//  device_config_complete - perform any
41//  operations now that the configuration is
42//  complete
52//  dave_device - constructor
4353//-------------------------------------------------
4454
45void dave_sound_device::device_config_complete()
55dave_device::dave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
56   : device_t(mconfig, DAVE, "DAVE", tag, owner, clock),
57     device_memory_interface(mconfig, *this),
58     device_sound_interface(mconfig, *this),
59     m_program_space_config("program", ENDIANNESS_LITTLE, 8, 22, 0, *ADDRESS_MAP_NAME(program_map)),
60     m_io_space_config("I/O", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(io_map)),
61     m_write_irq(*this),
62     m_write_lh(*this),
63     m_write_rh(*this)
4664{
47   // inherit a copy of the static data
48   const dave_interface *intf = reinterpret_cast<const dave_interface *>(static_config());
49   if (intf != NULL)
50      *static_cast<dave_interface *>(this) = *intf;
51   
52   // or initialize to defaults if none provided
53   else
54   {
55      memset(&m_reg_r_cb, 0, sizeof(m_reg_r_cb));
56      memset(&m_reg_w_cb, 0, sizeof(m_reg_w_cb));
57      memset(&m_int_cb, 0, sizeof(m_int_cb));
58   }
5965}
6066
67
6168//-------------------------------------------------
6269//  device_start - device-specific startup
6370//-------------------------------------------------
6471
65void dave_sound_device::device_start()
72void dave_device::device_start()
6673{
67   m_reg_r.resolve(m_reg_r_cb, *this);
68   m_reg_w.resolve(m_reg_w_cb, *this);
69   m_int_callback.resolve(m_int_cb, *this);
74   // resolve callbacks
75   m_write_irq.resolve_safe();
76   m_write_lh.resolve_safe();
77   m_write_rh.resolve_safe();
78
79   // allocate timers
80   m_timer_1hz = timer_alloc(TIMER_1HZ);
81   m_timer_1hz->adjust(attotime::from_hz(2), 0, attotime::from_hz(2));
7082   
71   /* temp! */
72   m_nick_virq = 0;
73   
74   /* initialise 1kHz timer */
75   m_int_latch = 0;
76   m_int_input = 0;
77   m_int_enable = 0;
78   m_timer_irq = 0;
79   m_fifty_hz_state = 0;
80   m_one_khz_state = 0;
81   m_fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
82   m_one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;
83   machine().scheduler().timer_pulse(attotime::from_hz(1000), timer_expired_delegate(FUNC(dave_sound_device::dave_1khz_callback),this));
84   
83   m_timer_50hz = timer_alloc(TIMER_50HZ);
84   m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000));
85
86   // state saving
87   save_item(NAME(m_segment));
88   save_item(NAME(m_irq_status));
89   save_item(NAME(m_irq_enable));
90   save_item(NAME(m_period));
91   save_item(NAME(m_count));
92   save_item(NAME(m_level));
93   save_item(NAME(m_level_or));
94   save_item(NAME(m_level_and));
95   save_item(NAME(m_mame_volumes));
96
8597   for (int i = 0; i < 3; i++)
8698   {
8799      m_period[i] = (STEP * machine().sample_rate()) / 125000;
r23493r23494
94106   
95107   /* 3 tone channels + 1 noise channel */
96108   m_sound_stream_var = machine().sound().stream_alloc(*this, 0, 2, machine().sample_rate(), this);
97
98   save_item(NAME(m_regs));
99   save_item(NAME(m_int_latch));
100   save_item(NAME(m_int_enable));
101   save_item(NAME(m_int_input));
102   save_item(NAME(m_int_irq));
103   save_item(NAME(m_timer_irq));
104   save_item(NAME(m_one_khz_state));
105   save_item(NAME(m_one_hz_count));
106   save_item(NAME(m_fifty_hz_state));
107   save_item(NAME(m_fifty_hz_count));
108   save_item(NAME(m_period));
109   save_item(NAME(m_count));
110   save_item(NAME(m_level));
111   save_item(NAME(m_level_or));
112   save_item(NAME(m_level_and));
113   save_item(NAME(m_mame_volumes));
114   save_item(NAME(m_nick_virq));
115109}
116110
111
117112//-------------------------------------------------
118113//  device_reset - device-specific reset
119114//-------------------------------------------------
120115
121void dave_sound_device::device_reset()
116void dave_device::device_reset()
122117{
118   m_write_irq(CLEAR_LINE);
119
120   for (int i = 0; i < 4; i++)
121      m_segment[i] = 0;
122
123   m_irq_status = 0;
124   m_irq_enable = 0;
125
123126   for (int i = 0; i < 32; i++)
124127      m_regs[i] = 0;
125   
126   address_space &space = machine().driver_data()->generic_space();
127   reg_w(space, 0x10, 0);
128   reg_w(space, 0x11, 0);
129   reg_w(space, 0x12, 0);
130   reg_w(space, 0x13, 0);
131128}
132129
133130
134/*-------------------------------------------------
135    dave_refresh_ints
136-------------------------------------------------*/
131//-------------------------------------------------
132//  device_timer - handler timer events
133//-------------------------------------------------
137134
138void dave_sound_device::refresh_ints()
135void dave_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
139136{
140   int int_wanted;
137   switch (id)
138   {
139   case TIMER_1HZ:
140      m_irq_status ^= IRQ_1HZ_DIVIDER;
141141
142   logerror("int latch: %02x enable: %02x input: %02x\n", (int) m_int_latch, (int) m_int_enable, (int) m_int_input);
142      if (m_irq_status & IRQ_1HZ_DIVIDER)
143         m_irq_status |= IRQ_1HZ_LATCH;
144      break;
143145
144   int_wanted = ((m_int_enable << 1) & m_int_latch) != 0;
145   m_int_callback(int_wanted);
146   case TIMER_50HZ:
147      m_irq_status ^= IRQ_50HZ_DIVIDER;
148
149      if (m_irq_status & IRQ_50HZ_DIVIDER)
150         m_irq_status |= IRQ_50HZ_LATCH;
151      break;
152   }
153
154   update_interrupt();
146155}
147156
148157
149/*-------------------------------------------------
150    dave_refresh_selectable_int
151-------------------------------------------------*/
158//-------------------------------------------------
159//  memory_space_config - return a description of
160//  any address spaces owned by this device
161//-------------------------------------------------
152162
153void dave_sound_device::refresh_selectable_int()
163const address_space_config *dave_device::memory_space_config(address_spacenum spacenum) const
154164{
155   /* update 1kHz/50Hz/tg latch and int input */
156   switch ((m_regs[7]>>5) & 0x03)
165   switch (spacenum)
157166   {
158      /* 1kHz */
159      case 0:
160         m_int_latch &= ~(1<<1);
161         m_int_latch |= (m_int_irq >> 1) & 0x02;
167      case DAVE_AS_PROGRAM: return &m_program_space_config;
168      case DAVE_AS_IO: return &m_io_space_config;
169      default: return NULL;
170   }
171}
162172
163         /* set int input state */
164         m_int_input &= ~(1<<0);
165         m_int_input |= (m_one_khz_state & 0x01) << 0;
166         break;
167173
168      /* 50Hz */
169      case 1:
170         m_int_latch &= ~(1<<1);
171         m_int_latch |= m_int_irq & 0x02;
174//-------------------------------------------------
175//  sound_stream_update - handle a stream update
176//-------------------------------------------------
172177
173         /* set int input state */
174         m_int_input &= ~(1<<0);
175         m_int_input |= (m_fifty_hz_state & 0x01) << 0;
176         break;
178void dave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
179{
180   stream_sample_t *buffer1, *buffer2;
181   /* 0 = channel 0 left volume, 1 = channel 0 right volume,
182    2 = channel 1 left volume, 3 = channel 1 right volume,
183    4 = channel 2 left volume, 5 = channel 2 right volume
184    6 = noise channel left volume, 7 = noise channel right volume */
185   int output_volumes[8];
186   int left_volume;
187   int right_volume;
188   
189   //logerror("sound update!\n");
190   
191   buffer1 = outputs[0];
192   buffer2 = outputs[1];
193   
194   while (samples)
195   {
196      int vol[4];
197     
198      /* vol[] keeps track of how long each square wave stays */
199      /* in the 1 position during the sample period. */
200      vol[0] = vol[1] = vol[2] = vol[3] = 0;
201     
202      for (int i = 0; i < 3; i++)
203      {
204         if ((m_regs[7] & (1 << i))==0)
205         {
206            if (m_level[i]) vol[i] += m_count[i];
207            m_count[i] -= STEP;
208            /* Period[i] is the half period of the square wave. Here, in each */
209            /* loop I add Period[i] twice, so that at the end of the loop the */
210            /* square wave is in the same status (0 or 1) it was at the start. */
211            /* vol[i] is also incremented by Period[i], since the wave has been 1 */
212            /* exactly half of the time, regardless of the initial position. */
213            /* If we exit the loop in the middle, Output[i] has to be inverted */
214            /* and vol[i] incremented only if the exit status of the square */
215            /* wave is 1. */
216            while (m_count[i] <= 0)
217            {
218               m_count[i] += m_period[i];
219               if (m_count[i] > 0)
220               {
221                  m_level[i] ^= 0x0ffffffff;
222                  if (m_level[i]) vol[i] += m_period[i];
223                  break;
224               }
225               m_count[i] += m_period[i];
226               vol[i] += m_period[i];
227            }
228            if (m_level[i])
229               vol[i] -= m_count[i];
230         }
231      }
232     
233      /* update volume outputs */
234     
235      /* setup output volumes for each channel */
236      /* channel 0 */
237      output_volumes[0] = ((m_level[0] & m_level_and[0]) | m_level_or[0]) & m_mame_volumes[0];
238      output_volumes[1] = ((m_level[0] & m_level_and[1]) | m_level_or[1]) & m_mame_volumes[4];
239      /* channel 1 */
240      output_volumes[2] = ((m_level[1] & m_level_and[2]) | m_level_or[2]) & m_mame_volumes[1];
241      output_volumes[3] = ((m_level[1] & m_level_and[3]) | m_level_or[3]) & m_mame_volumes[5];
242      /* channel 2 */
243      output_volumes[4] = ((m_level[2] & m_level_and[4]) | m_level_or[4]) & m_mame_volumes[2];
244      output_volumes[5] = ((m_level[2] & m_level_and[5]) | m_level_or[5]) & m_mame_volumes[6];
245      /* channel 3 */
246      output_volumes[6] = ((m_level[3] & m_level_and[6]) | m_level_or[6]) & m_mame_volumes[3];
247      output_volumes[7] = ((m_level[3] & m_level_and[7]) | m_level_or[7]) & m_mame_volumes[7];
248     
249      left_volume = (output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6])>>2;
250      right_volume = (output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7])>>2;
251     
252      *(buffer1++) = left_volume;
253      *(buffer2++) = right_volume;
254     
255      samples--;
256   }
257}
177258
178259
179      default:
180         break;
181   }
260//-------------------------------------------------
261//  int1_w - interrupt 1 write
262//-------------------------------------------------
182263
183   refresh_ints();
264WRITE_LINE_MEMBER( dave_device::int1_w )
265{
266   if (!(m_irq_status & IRQ_INT1) && state)
267      m_irq_status |= IRQ_INT1_LATCH;
268
269   if (state)
270      m_irq_status |= IRQ_INT1;
271   else
272      m_irq_status &= ~IRQ_INT1;
273
274   update_interrupt();
184275}
185276
186277
187/*-------------------------------------------------
188    dave_1khz_callback
189-------------------------------------------------*/
278//-------------------------------------------------
279//  int2_w - interrupt 2 write
280//-------------------------------------------------
190281
191TIMER_CALLBACK_MEMBER(dave_sound_device::dave_1khz_callback)
282WRITE_LINE_MEMBER( dave_device::int2_w )
192283{
193   /* time over - want int */
194   m_one_khz_state ^= 0x0ffffffff;
284   if (!(m_irq_status & IRQ_INT2) && state)
285      m_irq_status |= IRQ_INT2_LATCH;
195286
196   /* lo-high transition causes int */
197   if (m_one_khz_state != 0)
198   {
199      m_int_irq |= (1<<2);
200   }
287   if (state)
288      m_irq_status |= IRQ_INT2;
289   else
290      m_irq_status &= ~IRQ_INT2;
201291
292   update_interrupt();
293}
202294
203   /* update fifty Hz counter */
204   m_fifty_hz_count--;
205295
206   if (m_fifty_hz_count == 0)
207   {
208      /* these two lines are temp here */
209      m_nick_virq ^= 0x0ffffffff;
210      set_external_int_state(DAVE_INT1_ID, m_nick_virq);
296//-------------------------------------------------
297//  program_r - program space read
298//-------------------------------------------------
211299
300READ8_MEMBER( dave_device::program_r )
301{
302   UINT8 segment = m_segment[offset >> 14];
303   offset = (segment << 14) | (offset & 0x3fff);
212304
213      m_fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
214      m_fifty_hz_state ^= 0x0ffffffff;
305   return m_addrspace[0]->read_byte(offset);
306}
215307
216      if (m_fifty_hz_state != 0)
217      {
218         m_int_irq |= (1<<1);
219      }
220   }
221308
222   m_one_hz_count--;
309//-------------------------------------------------
310//  program_w - program space write
311//-------------------------------------------------
223312
224   if (m_one_hz_count == 0)
313WRITE8_MEMBER( dave_device::program_w )
314{
315   UINT8 segment = m_segment[offset >> 14];
316   offset = (segment << 14) | (offset & 0x3fff);
317
318   m_addrspace[0]->write_byte(offset, data);
319}
320
321
322//-------------------------------------------------
323//  io_r - I/O space read
324//-------------------------------------------------
325
326READ8_MEMBER( dave_device::io_r )
327{
328   UINT8 data = 0;
329
330   switch (offset & 0xff)
225331   {
226      /* reload counter */
227      m_one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;
332   case 0xa0:
333   case 0xa1:
334   case 0xa2:
335   case 0xa3:
336   case 0xa4:
337   case 0xa5:
338   case 0xa6:
339   case 0xa7:
340   case 0xa8:
341   case 0xa9:
342   case 0xaa:
343   case 0xab:
344   case 0xac:
345   case 0xad:
346   case 0xae:
347   case 0xaf:
348   case 0xb8:
349   case 0xb9:
350   case 0xba:
351   case 0xbb:
352   case 0xbc:
353   case 0xbd:
354   case 0xbe:
355   case 0xbf:
356      data = 0xff;
357      break;
228358
229      /* change state */
230      m_int_input ^= (1<<2);
359   case 0xb0: case 0xb1: case 0xb2: case 0xb3:
360      data = m_segment[offset & 0x03];
361      break;
231362
232      if (m_int_input & (1<<2))
233      {
234         /* transition from 0->1 */
235         /* int requested */
236         m_int_latch |=(1<<3);
237      }
363   case 0xb4:
364      data = m_irq_status;
365      break;
366
367   default:
368      data = m_addrspace[1]->read_byte(offset);
238369   }
239370
240   refresh_selectable_int();
371   return data;
241372}
242373
243374
244/*-------------------------------------------------
245    dave_sound_w - used to update sound output
246    based on data writes
247-------------------------------------------------*/
375//-------------------------------------------------
376//  io_w - I/O space write
377//-------------------------------------------------
248378
249WRITE8_MEMBER(dave_sound_device::sound_w)
379WRITE8_MEMBER( dave_device::io_w )
250380{
251   /* update stream */
252   m_sound_stream_var->update();
253
254   /* new write */
255   switch (offset)
381   switch (offset & 0xff)
256382   {
257383      /* channel 0 down-counter */
258      case 0:
259      case 1:
384      case 0xa0:
385      case 0xa1:
260386      /* channel 1 down-counter */
261      case 2:
262      case 3:
387      case 0xa2:
388      case 0xa3:
263389      /* channel 2 down-counter */
264      case 4:
265      case 5:
266      {
267         int count = 0;
268         int channel_index = offset>>1;
390      case 0xa4:
391      case 0xa5:
392         {
393            int count = 0;
394            int channel_index = offset>>1;
269395
270         /* Fout = 125,000 / (n+1) Hz */
396            /* Fout = 125,000 / (n+1) Hz */
271397
272         /* sample rate/clock */
398            /* sample rate/clock */
273399
274400
275         /* get down-count */
276         switch (offset & 0x01)
277         {
278            case 0:
401            /* get down-count */
402            switch (offset & 0x01)
279403            {
280               count = (data & 0x0ff) | ((m_regs[offset + 1] & 0x0f)<<8);
281            }
282            break;
404               case 0:
405               {
406                  count = (data & 0x0ff) | ((m_regs[offset + 1] & 0x0f)<<8);
407               }
408               break;
283409
284            case 1:
285            {
286               count = (m_regs[offset - 1] & 0x0ff) | ((data & 0x0f)<<8);
410               case 1:
411               {
412                  count = (m_regs[offset - 1] & 0x0ff) | ((data & 0x0f)<<8);
287413
414               }
415               break;
288416            }
289            break;
290         }
291417
292         count++;
418            count++;
293419
294420
295         m_period[channel_index] = ((STEP  * machine().sample_rate())/125000) * count;
421            m_period[channel_index] = ((STEP  * machine().sample_rate())/125000) * count;
296422
297      }
298      break;
423            m_regs[offset & 0x01f] = data;
424         }
425         break;
299426
300427      /* channel 0 left volume */
301      case 8:
428      case 0xa8:
302429      /* channel 1 left volume */
303      case 9:
430      case 0xa9:
304431      /* channel 2 left volume */
305      case 10:
432      case 0xaa:
306433      /* noise channel left volume */
307      case 11:
434      case 0xab:
308435      /* channel 0 right volume */
309      case 12:
436      case 0xac:
310437      /* channel 1 right volume */
311      case 13:
438      case 0xad:
312439      /* channel 2 right volume */
313      case 14:
440      case 0xae:
314441      /* noise channel right volume */
315      case 15:
316      {
317         /* update mame version of volume from data written */
318         /* 0x03f->0x07e00. Max is 0x07fff */
319         /* I believe the volume is linear - to be checked! */
320         m_mame_volumes[offset - 8] = (data & 0x03f) << 9;
321      }
322      break;
442      case 0xaf:
443         {
444            /* update mame version of volume from data written */
445            /* 0x03f->0x07e00. Max is 0x07fff */
446            /* I believe the volume is linear - to be checked! */
447            m_mame_volumes[offset - 8] = (data & 0x03f) << 9;
323448
324      case 7:
449            m_regs[offset & 0x01f] = data;
450         }
451         break;
452
453      case 0xa6:
454         break;
455
456      case 0xa7:
325457      {
326458         /*  force => the value of this register is forced regardless of the wave
327459                 state,
r23493r23494
330462             use => the volume value is dependant on the wave state and is included
331463                 in the final volume calculation */
332464
333         logerror("selectable int ");
465         //logerror("selectable int ");
334466         switch ((data>>5) & 0x03)
335467         {
336468            case 0:
337469            {
338               logerror("1kHz\n");
470               //logerror("1kHz\n");
471               m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000));
339472            }
340473            break;
341474
342475            case 1:
343476            {
344               logerror("50Hz\n");
477               //logerror("50Hz\n");
478               m_timer_50hz->adjust(attotime::from_hz(100), 0, attotime::from_hz(100));
345479            }
346480            break;
347481
348482            case 2:
349483            {
350               logerror("tone channel 0\n");
484               //logerror("tone channel 0\n");
351485            }
352486            break;
353487
354488            case 3:
355489            {
356               logerror("tone channel 1\n");
490               //logerror("tone channel 1\n");
357491            }
358492            break;
359493         }
r23493r23494
435569            m_level_or[7] = 0x000;
436570            m_level_and[7] = 0xffff;
437571         }
572
573         m_regs[offset & 0x01f] = data;
438574      }
439575      break;
440576
441      default:
442         break;
443   }
444}
577   case 0xb0: case 0xb1: case 0xb2: case 0xb3:
578      m_segment[offset & 0x03] = data;
445579
580      m_regs[offset & 0x01f] = data;
581      break;
446582
447/*-------------------------------------------------
448    dave_reg_w
449-------------------------------------------------*/
583   case 0xb4:
584      m_irq_enable = data;
585      m_irq_status &= ~(m_irq_enable & IRQ_LATCH);
586      update_interrupt();
450587
451WRITE8_MEMBER( dave_sound_device::reg_w )
452{
453   logerror("dave w: %04x %02x\n",offset,data);
454
455   sound_w(space, offset, data, mem_mask);
456
457   m_regs[offset & 0x01f] = data;
458
459   switch (offset)
460   {
461      case 0x07:
462         refresh_selectable_int();
463         break;
464
465      case 0x014:
466         /* enabled ints */
467         m_int_enable = data & 0x055;
468         /* clear latches */
469         m_int_latch &=~(data & 0x0aa);
470
471         /* reset 1kHz, 50Hz latch */
472         if (data & (1<<1))
473         {
474            m_int_irq = 0;
475         }
476
477         /* refresh ints */
478         refresh_ints();
479         break;
480
481      default:
482         break;
483   }
484
485   m_reg_w(offset, data);
486}
487
488
489/*-------------------------------------------------
490    dave_set_reg
491-------------------------------------------------*/
492
493void dave_sound_device::set_reg(offs_t offset, UINT8 data)
494{
495   m_regs[offset & 0x01f] = data;
496}
497
498
499/*-------------------------------------------------
500    dave_reg_r
501-------------------------------------------------*/
502
503READ8_MEMBER( dave_sound_device::reg_r )
504{
505   logerror("dave r: %04x\n",offset);
506
507   m_reg_r(offset);
508
509   switch (offset)
510   {
511      case 0x000:
512      case 0x001:
513      case 0x002:
514      case 0x003:
515      case 0x004:
516      case 0x005:
517      case 0x006:
518      case 0x007:
519      case 0x008:
520      case 0x009:
521      case 0x00a:
522      case 0x00b:
523      case 0x00c:
524      case 0x00d:
525      case 0x00e:
526      case 0x00f:
527      case 0x018:
528      case 0x019:
529      case 0x01a:
530      case 0x01b:
531      case 0x01c:
532      case 0x01d:
533      case 0x01e:
534      case 0x01f:
535         return 0x0ff;
536
537      case 0x014:
538         return (m_int_latch & 0x0aa) | (m_int_input & 0x055);
539
540
541      default:
542         break;
543   }
544
545   return m_regs[offset & 0x01f];
546}
547
548
549/*-------------------------------------------------
550    dave_set_external_int_state - negative edge
551    triggered
552-------------------------------------------------*/
553
554void dave_sound_device::set_external_int_state(int int_id, int state)
555{
556   switch (int_id)
557   {
558      /* connected to Nick virq */
559      case DAVE_INT1_ID:
560      {
561         int previous_state;
562
563         previous_state = m_int_input;
564
565         m_int_input &= ~(1<<4);
566
567         if (state)
568         {
569            m_int_input |= (1<<4);
570         }
571
572         if ((previous_state ^ m_int_input) & (1<<4))
573         {
574            /* changed state */
575
576            if (m_int_input & (1<<4))
577            {
578               /* int request */
579               m_int_latch |= (1<<5);
580
581               refresh_ints();
582            }
583         }
584
585      }
588      m_regs[offset & 0x01f] = data;
586589      break;
587590
588      case DAVE_INT2_ID:
589      {
590         int previous_state;
591
592         previous_state = m_int_input;
593
594         m_int_input &= ~(1<<6);
595
596         if (state)
597         {
598            m_int_input |= (1<<6);
599         }
600
601         if ((previous_state ^ m_int_input) & (1<<6))
602         {
603            /* changed state */
604
605            if (m_int_input & (1<<6))
606            {
607               /* int request */
608               m_int_latch |= (1<<7);
609
610               refresh_ints();
611            }
612         }
613      }
591   case 0xbf:
592      m_regs[offset & 0x01f] = data;
614593      break;
615594
616      default:
617         break;
595   default:
596      m_addrspace[1]->write_byte(offset, data);
618597   }
619598}
620599
621/*
622Reg 4 READ:
623600
624b7 = 1: INT2 latch set
625b6 = INT2 input pin
626b5 = 1: INT1 latch set
627b4 = INT1 input pin
628b3 = 1: 1Hz latch set
629b2 = 1Hz input pin
630b1 = 1: 1kHz/50Hz/TG latch set
631b0 = 1kHz/50Hz/TG input
632
633Reg 4 WRITE:
634
635b7 = 1: Reset INT2 latch
636b6 = 1: Enable INT2
637b5 = 1: Reset INT1 latch
638b4 = 1: Enable INT1
639b3 = 1: Reset 1Hz interrupt latch
640b2 = 1: Enable 1Hz interrupt
641b1 = 1: Reset 1kHz/50Hz/TG latch
642b0 = 1: Enable 1kHz/50Hz/TG latch
643*/
644
645
646
647601//-------------------------------------------------
648//  sound_stream_update - handle a stream update
602//  update_interrupt -
649603//-------------------------------------------------
650604
651void dave_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
605void dave_device::update_interrupt()
652606{
653   stream_sample_t *buffer1, *buffer2;
654   /* 0 = channel 0 left volume, 1 = channel 0 right volume,
655    2 = channel 1 left volume, 3 = channel 1 right volume,
656    4 = channel 2 left volume, 5 = channel 2 right volume
657    6 = noise channel left volume, 7 = noise channel right volume */
658   int output_volumes[8];
659   int left_volume;
660   int right_volume;
661   
662   //logerror("sound update!\n");
663   
664   buffer1 = outputs[0];
665   buffer2 = outputs[1];
666   
667   while (samples)
668   {
669      int vol[4];
670     
671      /* vol[] keeps track of how long each square wave stays */
672      /* in the 1 position during the sample period. */
673      vol[0] = vol[1] = vol[2] = vol[3] = 0;
674     
675      for (int i = 0; i < 3; i++)
676      {
677         if ((m_regs[7] & (1 << i))==0)
678         {
679            if (m_level[i]) vol[i] += m_count[i];
680            m_count[i] -= STEP;
681            /* Period[i] is the half period of the square wave. Here, in each */
682            /* loop I add Period[i] twice, so that at the end of the loop the */
683            /* square wave is in the same status (0 or 1) it was at the start. */
684            /* vol[i] is also incremented by Period[i], since the wave has been 1 */
685            /* exactly half of the time, regardless of the initial position. */
686            /* If we exit the loop in the middle, Output[i] has to be inverted */
687            /* and vol[i] incremented only if the exit status of the square */
688            /* wave is 1. */
689            while (m_count[i] <= 0)
690            {
691               m_count[i] += m_period[i];
692               if (m_count[i] > 0)
693               {
694                  m_level[i] ^= 0x0ffffffff;
695                  if (m_level[i]) vol[i] += m_period[i];
696                  break;
697               }
698               m_count[i] += m_period[i];
699               vol[i] += m_period[i];
700            }
701            if (m_level[i])
702               vol[i] -= m_count[i];
703         }
704      }
705     
706      /* update volume outputs */
707     
708      /* setup output volumes for each channel */
709      /* channel 0 */
710      output_volumes[0] = ((m_level[0] & m_level_and[0]) | m_level_or[0]) & m_mame_volumes[0];
711      output_volumes[1] = ((m_level[0] & m_level_and[1]) | m_level_or[1]) & m_mame_volumes[4];
712      /* channel 1 */
713      output_volumes[2] = ((m_level[1] & m_level_and[2]) | m_level_or[2]) & m_mame_volumes[1];
714      output_volumes[3] = ((m_level[1] & m_level_and[3]) | m_level_or[3]) & m_mame_volumes[5];
715      /* channel 2 */
716      output_volumes[4] = ((m_level[2] & m_level_and[4]) | m_level_or[4]) & m_mame_volumes[2];
717      output_volumes[5] = ((m_level[2] & m_level_and[5]) | m_level_or[5]) & m_mame_volumes[6];
718      /* channel 3 */
719      output_volumes[6] = ((m_level[3] & m_level_and[6]) | m_level_or[6]) & m_mame_volumes[3];
720      output_volumes[7] = ((m_level[3] & m_level_and[7]) | m_level_or[7]) & m_mame_volumes[7];
721     
722      left_volume = (output_volumes[0] + output_volumes[2] + output_volumes[4] + output_volumes[6])>>2;
723      right_volume = (output_volumes[1] + output_volumes[3] + output_volumes[5] + output_volumes[7])>>2;
724     
725      *(buffer1++) = left_volume;
726      *(buffer2++) = right_volume;
727     
728      samples--;
729   }
607   int state = ((m_irq_status & (m_irq_enable << 1)) & IRQ_LATCH) ? ASSERT_LINE : CLEAR_LINE;
608
609   m_write_irq(state);
730610}
trunk/src/mess/audio/dave.h
r23493r23494
11/**********************************************************************
22
3    "Dave" Sound Chip
3    Intelligent Designs DAVE emulation
44
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
58**********************************************************************/
69
7#ifndef __DAVE_H__
8#define __DAVE_H__
10#pragma once
911
10#include "devcb.h"
12#ifndef __DAVE__
13#define __DAVE__
1114
15#include "emu.h"
1216
13#define DAVE_INT_SELECTABLE     0
14#define DAVE_INT_1KHZ_50HZ_TG   1
15#define DAVE_INT_1HZ            2
16#define DAVE_INT_INT1           3
17#define DAVE_INT_INT2           4
1817
19#define DAVE_FIFTY_HZ_COUNTER_RELOAD    20
20#define DAVE_ONE_HZ_COUNTER_RELOAD      1000
2118
22/* id's of external ints */
23enum
24{
25   DAVE_INT1_ID,
26   DAVE_INT2_ID
27};
19///*************************************************************************
20//  MACROS / CONSTANTS
21///*************************************************************************
2822
23#define DAVE_AS_PROGRAM      AS_0
24#define DAVE_AS_IO         AS_1
2925
30/***************************************************************************
31 TYPE DEFINITIONS
32 ***************************************************************************/
3326
34struct dave_interface
35{
36   devcb_read8 m_reg_r_cb;
37   devcb_write8 m_reg_w_cb;
38   devcb_write_line m_int_cb;
39};
4027
28///*************************************************************************
29//  INTERFACE CONFIGURATION MACROS
30///*************************************************************************
4131
42/***************************************************************************
43    MACROS / CONSTANTS
44***************************************************************************/
32#define MCFG_DAVE_ADD(_tag, _clock, _irq, _program_map, _io_map) \
33    MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") \
34   MCFG_SOUND_ADD(_tag, DAVE, _clock) \
35   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) \
36   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) \
37    MCFG_DEVICE_ADDRESS_MAP(DAVE_AS_PROGRAM, _program_map) \
38    MCFG_DEVICE_ADDRESS_MAP(DAVE_AS_IO, _io_map) \
39   downcast<dave_device *>(device)->set_irq_callback(DEVCB2_##_irq);
4540
46class dave_sound_device : public device_t,
47                     public device_sound_interface,
48                     public dave_interface
41
42
43///*************************************************************************
44//  TYPE DEFINITIONS
45///*************************************************************************
46
47// ======================> dave_device
48
49class dave_device : public device_t,
50               public device_memory_interface,
51               public device_sound_interface
4952{
5053public:
51   dave_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
52   ~dave_sound_device() {}
54   dave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5355
54   DECLARE_WRITE8_MEMBER(reg_w);
55   DECLARE_READ8_MEMBER(reg_r);
56   void set_reg(offs_t offset, UINT8 data);
56   template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
57   template<class _lh, class _rh> void set_dac_callbacks(_lh lh, _rh rh) {
58      m_write_lh.set_callback(lh);
59      m_write_rh.set_callback(rh);
60   }
5761
62   virtual DECLARE_ADDRESS_MAP(z80_program_map, 8);
63   virtual DECLARE_ADDRESS_MAP(z80_io_map, 8);
64
65   DECLARE_WRITE_LINE_MEMBER( int1_w );
66   DECLARE_WRITE_LINE_MEMBER( int2_w );
67
5868protected:
5969   // device-level overrides
60   virtual void device_config_complete();
6170   virtual void device_start();
6271   virtual void device_reset();
72   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
6373
74   // device_memory_interface overrides
75   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
76
6477   // sound stream update overrides
6578   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
6679
80   DECLARE_READ8_MEMBER( program_r );
81   DECLARE_WRITE8_MEMBER( program_w );
82
83   DECLARE_READ8_MEMBER( io_r );
84   DECLARE_WRITE8_MEMBER( io_w );
85
6786private:
68   // internal state
69   devcb_resolved_read8 m_reg_r;
70   devcb_resolved_write8 m_reg_w;
71   devcb_resolved_write_line m_int_callback;
87   enum
88   {
89      TIMER_1HZ,
90      TIMER_50HZ
91   };
7292
73   TIMER_CALLBACK_MEMBER(dave_1khz_callback);
74   DECLARE_WRITE8_MEMBER(sound_w);
75   void refresh_ints();
76   void refresh_selectable_int();
77   void set_external_int_state(int int_id, int state);
78   
93   enum
94   {
95      IRQ_50HZ_DIVIDER   = 0x01,
96      IRQ_50HZ_LATCH      = 0x02,
97      IRQ_1HZ_DIVIDER      = 0x04,
98      IRQ_1HZ_LATCH      = 0x08,
99      IRQ_INT1         = 0x10,
100      IRQ_INT1_LATCH      = 0x20,
101      IRQ_INT2         = 0x40,
102      IRQ_INT2_LATCH      = 0x80,
103      IRQ_LATCH           = IRQ_INT2_LATCH | IRQ_INT1_LATCH | IRQ_1HZ_LATCH | IRQ_50HZ_LATCH
104   };
105
106   void update_interrupt();
107
108   const address_space_config m_program_space_config;
109   const address_space_config m_io_space_config;
110
111   devcb2_write_line m_write_irq;
112   devcb2_write8 m_write_lh;
113   devcb2_write8 m_write_rh;
114
115   UINT8 m_segment[4];
116
117   UINT8 m_irq_status;
118   UINT8 m_irq_enable;
119
120   emu_timer *m_timer_1hz;
121   emu_timer *m_timer_50hz;
122
123   /* SOUND SYNTHESIS */
79124   UINT8 m_regs[32];
80   
81   /* int latches (used by 1Hz, int1 and int2) */
82   UINT32 m_int_latch;
83   /* int enables */
84   UINT32 m_int_enable;
85   /* int inputs */
86   UINT32 m_int_input;
87   
88   UINT32 m_int_irq;
89   
90   /* INTERRUPTS */
91   
92   /* internal timer */
93   /* bit 2: 1kHz timer irq */
94   /* bit 1: 50kHz timer irq */
95   int m_timer_irq;
96   /* 1khz timer - divided into 1kHz, 50Hz and 1Hz timer */
97   //emu_timer   *m_int_timer;
98   /* state of 1kHz timer */
99   UINT32 m_one_khz_state;
100   /* state of 50Hz timer */
101   UINT32 m_fifty_hz_state;
102   
103   /* counter used to trigger 50Hz from 1kHz timer */
104   UINT32 m_fifty_hz_count;
105   /* counter used to trigger 1Hz from 1kHz timer */
106   UINT32 m_one_hz_count;
107   
108   
109   /* SOUND SYNTHESIS */
110125   int m_period[4];
111126   int m_count[4];
112127   int m_level[4];
r23493r23494
127142   //int m_update_step;
128143   
129144   sound_stream *m_sound_stream_var;
130   
131   /* temp here */
132   int m_nick_virq;
133145};
134146
147
148// device type definition
135149extern const device_type DAVE;
136150
137#endif /* __DAVE_H__ */
151
152
153#endif
trunk/src/mess/machine/ep64exp.c
r0r23494
1/**********************************************************************
2
3    Enterprise Sixty Four / One Two Eight Expansion Bus emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "ep64exp.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type EP64_EXPANSION_BUS_SLOT = &device_creator<ep64_expansion_bus_slot_device>;
19
20
21
22//**************************************************************************
23//  DEVICE EP64_EXPANSION_BUS CARD INTERFACE
24//**************************************************************************
25
26//-------------------------------------------------
27//  device_ep64_expansion_bus_card_interface - constructor
28//-------------------------------------------------
29
30device_ep64_expansion_bus_card_interface::device_ep64_expansion_bus_card_interface(const machine_config &mconfig, device_t &device)
31   : device_slot_card_interface(mconfig, device)
32{
33   m_slot = dynamic_cast<ep64_expansion_bus_slot_device *>(device.owner());
34}
35
36
37
38//**************************************************************************
39//  LIVE DEVICE
40//**************************************************************************
41
42//-------------------------------------------------
43//  ep64_expansion_bus_slot_device - constructor
44//-------------------------------------------------
45
46ep64_expansion_bus_slot_device::ep64_expansion_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
47   device_t(mconfig, EP64_EXPANSION_BUS_SLOT, "Enterprise Sixty Four expansion bus slot", tag, owner, clock),
48   device_slot_interface(mconfig, *this),
49   m_write_irq(*this),
50   m_write_nmi(*this),
51   m_write_wait(*this)
52{
53}
54
55
56//-------------------------------------------------
57//  device_start - device-specific startup
58//-------------------------------------------------
59
60void ep64_expansion_bus_slot_device::device_start()
61{
62   m_dave = dynamic_cast<dave_device *>(m_owner->subdevice(m_dave_tag));
63   m_card = dynamic_cast<device_ep64_expansion_bus_card_interface *>(get_card_device());
64
65   // resolve callbacks
66   m_write_irq.resolve_safe();
67   m_write_nmi.resolve_safe();
68   m_write_wait.resolve_safe();
69}
70
71
72//-------------------------------------------------
73//  device_reset - device-specific reset
74//-------------------------------------------------
75
76void ep64_expansion_bus_slot_device::device_reset()
77{
78   if (m_card) get_card_device()->reset();
79}
80
81
82//-------------------------------------------------
83//  SLOT_INTERFACE( ep64_expansion_bus_cards )
84//-------------------------------------------------
85
86SLOT_INTERFACE_START( ep64_expansion_bus_cards )
87   SLOT_INTERFACE("exdos", EP64_EXDOS)
88SLOT_INTERFACE_END
Property changes on: trunk/src/mess/machine/ep64exp.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/machine/ep64exp.h
r0r23494
1/**********************************************************************
2
3    Enterprise Sixty Four / One Two Eight Expansion Bus emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9
10             LH SOUND IN    B1      A1      RH SOUND IN
11                     _WR    B2      A2      _RFSH
12                   _IORQ    B3      A3      _RD
13                   +17V*    B4      A4      +17V*
14                    _NMI    B5      A5      _MREQ
15                      A9    B6      A6      A8
16                     A11    B7      A7      A10
17                     A13    B8      A8      A12
18                     A15    B9      A9      A14
19                      A1    B10     A10     A0
20                      A3    B11     A11     A2
21                      A5    B12     A12     A4
22                      A7    B13     A13     A6
23                      D1    B14     A14     D0
24                      D3    B15     A15     D2
25                      D5    B16     A16     D4
26                      D7    B17     A17     D6
27                    _INT    B18     A18     _RESET
28                     GND    B19     A19     _WAIT
29                     GND    B20     A20     _M1
30                     GND    B21     A21     1M
31                     GND    B22     A22     phi
32                     GND    B23     A23     8M
33                     EC1    B24     A24     EC0
34                     EC3    B25     A25     EC2
35                     A16    B26     A26     _EXTC
36                     A18    B27     A27     A17
37                     A20    B28     A28     A19
38                     14M    B29     A29     A21
39                   VSYNC    B30     A30     _LOCATE
40                    _EXP    B31     A31     GND
41                     GND    B32     A32     HSYNC
42                     +9V    B33     A33     +9V
43
44**********************************************************************/
45
46#pragma once
47
48#ifndef __EP64_EXPANSION_BUS__
49#define __EP64_EXPANSION_BUS__
50
51#include "emu.h"
52#include "audio/dave.h"
53
54
55
56//**************************************************************************
57//  MACROS / CONSTANTS
58//**************************************************************************
59
60#define EP64_EXPANSION_BUS_TAG   "exp"
61
62
63
64//**************************************************************************
65//  INTERFACE CONFIGURATION MACROS
66//**************************************************************************
67
68#define MCFG_EP64_EXPANSION_BUS_SLOT_ADD(_tag, _dave_tag, _def_slot) \
69   MCFG_DEVICE_ADD(_tag, EP64_EXPANSION_BUS_SLOT, 0) \
70   MCFG_DEVICE_SLOT_INTERFACE(ep64_expansion_bus_cards, _def_slot, false) \
71   downcast<ep64_expansion_bus_slot_device *>(device)->set_dave_tag(_dave_tag);
72
73#define MCFG_EP64_EXPANSION_BUS_CALLBACKS(_irq, _nmi, _wait) \
74   downcast<ep64_expansion_bus_slot_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
75   downcast<ep64_expansion_bus_slot_device *>(device)->set_nmi_callback(DEVCB2_##_nmi); \
76   downcast<ep64_expansion_bus_slot_device *>(device)->set_wait_callback(DEVCB2_##_wait);
77
78
79
80//**************************************************************************
81//  TYPE DEFINITIONS
82//**************************************************************************
83
84// ======================> ep64_expansion_bus_slot_device
85
86class device_ep64_expansion_bus_card_interface;
87
88class ep64_expansion_bus_slot_device : public device_t,
89                              public device_slot_interface
90{
91   friend class device_ep64_expansion_bus_card_interface;
92
93public:
94   // construction/destruction
95   ep64_expansion_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
96
97   void set_dave_tag(const char* dave_tag) { m_dave_tag = dave_tag; }
98   template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
99   template<class _nmi> void set_nmi_callback(_nmi nmi) { m_write_nmi.set_callback(nmi); }
100   template<class _wait> void set_wait_callback(_wait wait) { m_write_wait.set_callback(wait); }
101
102   DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
103   DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_write_nmi(state); }
104   DECLARE_WRITE_LINE_MEMBER( wait_w ) { m_write_wait(state); }
105
106   address_space& program() { return m_dave->space(DAVE_AS_PROGRAM); }
107   address_space& io() { return m_dave->space(DAVE_AS_IO); }
108
109protected:
110   // device-level overrides
111   virtual void device_start();
112   virtual void device_reset();
113
114private:
115   devcb2_write_line m_write_irq;
116   devcb2_write_line m_write_nmi;
117   devcb2_write_line m_write_wait;
118
119   const char *m_dave_tag;
120   dave_device *m_dave;
121
122   device_ep64_expansion_bus_card_interface *m_card;
123};
124
125
126// ======================> device_ep64_expansion_bus_card_interface
127
128class device_ep64_expansion_bus_card_interface : public device_slot_card_interface
129{
130public:
131   // construction/destruction
132   device_ep64_expansion_bus_card_interface(const machine_config &mconfig, device_t &device);
133
134protected:
135   ep64_expansion_bus_slot_device  *m_slot;
136};
137
138
139// device type definition
140extern const device_type EP64_EXPANSION_BUS_SLOT;
141
142
143// slot devices
144#include "machine/ep64_exdos.h"
145
146SLOT_INTERFACE_EXTERN( ep64_expansion_bus_cards );
147
148
149
150#endif
Property changes on: trunk/src/mess/machine/ep64exp.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/machine/ep64_exdos.c
r0r23494
1/**********************************************************************
2
3    Intelligent Software EXDOS Disk Controller Module emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12Floppy Drive Controller PCB Layout
13----------------------------------
14
15INTELLIGENT SOFTWARE LTD DISK CONTROLLER
16ISS1
17 |--------------------------------------------|
18 |                                            |
19 |                                            |
20|-|  7438  74LS273             WD1770         |
21|I|                                           |
22|D|                                           |
23|C|                                  EPROM.IC2|
24|3|           74LS32  74LS02  74LS266         |
25|4|  7438                                     |
26|-|      74LS126  74LS10  74LS245  74LS266    |
27 |                                            |
28 |                                            |
29 |----------------------------|||||||||||||||||
30                              |---------------|
31Notes: (All IC's shown)
32
33This PCB plugs into the external expansion connector on the right side of the mainboard
34
35      EPROM.IC2 - 16k x8-bit EPROM labelled 'EXDOS V1.0 P/N 08-60' (DIP28)
36         WD1770 - Western Digital WD1770 Floppy Drive Controller (DIP28)
37         74LS02 - Quad 2-Input NOR Gate (DIP14)
38         74LS10 - Triple 3-input NAND Gate (DIP14)
39         74LS32 - Quad 2-Input Positive OR Gate (DIP14)
40           7438 - Quad 2-input NAND Buffer (DIP14)
41        74LS126 - Quad Bus Buffer (DIP14)
42        74LS245 - Octal Bus Tranceiver with Tri-State Outputs (DIP20)
43        74LS266 - Quad EXCLUSIVE-NOR Gate (DIP14)
44        74LS273 - Octal D-Type Flip-Flop With Clear (DIP20)
45          IDC34 - IDC 34-way flat cable connector for floppy drive data cable
46
47*/
48
49#include "ep64_exdos.h"
50
51
52
53//**************************************************************************
54//  MACROS/CONSTANTS
55//**************************************************************************
56
57#define WD1770_TAG   "u1"
58
59
60
61//**************************************************************************
62//  DEVICE DEFINITIONS
63//**************************************************************************
64
65const device_type EP64_EXDOS = &device_creator<ep64_exdos_device>;
66
67
68//-------------------------------------------------
69//  ROM( ep64_exdos )
70//-------------------------------------------------
71
72ROM_START( ep64_exdos )
73   ROM_REGION( 0x8000, "rom", 0 )
74   ROM_LOAD( "exdos13.rom", 0x0000, 0x8000, CRC(d1d7e157) SHA1(31c8be089526aa8aa019c380cdf51ddd3ee76454) )
75ROM_END
76
77
78//-------------------------------------------------
79//  rom_region - device-specific ROM region
80//-------------------------------------------------
81
82const rom_entry *ep64_exdos_device::device_rom_region() const
83{
84   return ROM_NAME( ep64_exdos );
85}
86
87
88//-------------------------------------------------
89//  SLOT_INTERFACE( ep64_exdos_floppies )
90//-------------------------------------------------
91
92FLOPPY_FORMATS_MEMBER( ep64_exdos_device::floppy_formats )
93   FLOPPY_EP64_FORMAT
94FLOPPY_FORMATS_END
95
96static SLOT_INTERFACE_START( ep64_exdos_floppies )
97   SLOT_INTERFACE( "35dd", FLOPPY_35_DD )
98SLOT_INTERFACE_END
99
100
101//-------------------------------------------------
102//  MACHINE_CONFIG_FRAGMENT( ep64_exdos )
103//-------------------------------------------------
104
105static MACHINE_CONFIG_FRAGMENT( ep64_exdos )
106   MCFG_WD1770x_ADD(WD1770_TAG, XTAL_8MHz)
107
108   MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", ep64_exdos_floppies, "35dd", ep64_exdos_device::floppy_formats)
109   MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":1", ep64_exdos_floppies, NULL,  ep64_exdos_device::floppy_formats)
110   MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":2", ep64_exdos_floppies, NULL,  ep64_exdos_device::floppy_formats)
111   MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":3", ep64_exdos_floppies, NULL,  ep64_exdos_device::floppy_formats)
112MACHINE_CONFIG_END
113
114
115//-------------------------------------------------
116//  machine_config_additions - device-specific
117//  machine configurations
118//-------------------------------------------------
119
120machine_config_constructor ep64_exdos_device::device_mconfig_additions() const
121{
122   return MACHINE_CONFIG_NAME( ep64_exdos );
123}
124
125
126
127//**************************************************************************
128//  LIVE DEVICE
129//**************************************************************************
130
131//-------------------------------------------------
132//  ep64_exdos_device - constructor
133//-------------------------------------------------
134
135ep64_exdos_device::ep64_exdos_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
136   device_t(mconfig, EP64_EXDOS, "EXDOS", tag, owner, clock, "ep64_exdos", __FILE__),
137   device_ep64_expansion_bus_card_interface(mconfig, *this),
138   m_fdc(*this, WD1770_TAG),
139   m_floppy0(*this, WD1770_TAG":0"),
140   m_floppy1(*this, WD1770_TAG":1"),
141   m_floppy2(*this, WD1770_TAG":2"),
142   m_floppy3(*this, WD1770_TAG":3"),
143   m_floppy(NULL),
144   m_rom(*this, "rom")
145{
146}
147
148
149//-------------------------------------------------
150//  device_start - device-specific startup
151//-------------------------------------------------
152
153void ep64_exdos_device::device_start()
154{
155   m_slot->program().install_rom(0x080000, 0x087fff, 0, 0, m_rom->base());
156
157   m_slot->io().install_readwrite_handler(0x10, 0x13, 0, 0x04, READ8_DEVICE_DELEGATE(wd_fdc_t, m_fdc, read), WRITE8_DEVICE_DELEGATE(wd_fdc_t, m_fdc, write));
158   m_slot->io().install_readwrite_handler(0x18, 0x18, 0, 0x04, READ8_DELEGATE(ep64_exdos_device, read), WRITE8_DELEGATE(ep64_exdos_device, write));
159}
160
161
162//-------------------------------------------------
163//  device_reset - device-specific reset
164//-------------------------------------------------
165
166void ep64_exdos_device::device_reset()
167{
168   m_fdc->reset();
169
170   m_floppy = NULL;
171   m_fdc->set_floppy(m_floppy);
172   m_fdc->dden_w(0);
173}
174
175
176//-------------------------------------------------
177//  read -
178//-------------------------------------------------
179
180READ8_MEMBER( ep64_exdos_device::read )
181{
182   /*
183   
184       bit     description
185   
186       0       
187       1       INTRQ
188       2       
189       3       
190       4       
191       5       
192       6       DCHG
193       7       DRQ
194   
195   */
196
197   UINT8 data = 0;
198
199   data |= m_fdc->intrq_r();
200   data |= m_fdc->drq_r() << 7;
201
202   data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 6;
203
204   return data;
205}
206
207
208//-------------------------------------------------
209//  write -
210//-------------------------------------------------
211
212WRITE8_MEMBER( ep64_exdos_device::write )
213{
214   /*
215   
216       bit     description
217   
218       0       SELECT 0
219       1       SELECT 1
220       2       SELECT 2
221       3       SELECT 3
222       4       SIDE 1
223       5       _DDEN
224       6       DISK CHANGE RESET
225       7       IN USE
226   
227   */
228
229   m_floppy = NULL;
230
231   if (BIT(data, 0)) m_floppy = m_floppy0->get_device();
232   if (BIT(data, 1)) m_floppy = m_floppy1->get_device();
233   if (BIT(data, 2)) m_floppy = m_floppy2->get_device();
234   if (BIT(data, 3)) m_floppy = m_floppy3->get_device();
235
236   m_fdc->set_floppy(m_floppy);
237
238   if (m_floppy)
239   {
240      m_floppy->ss_w(BIT(data, 4));
241   }
242
243   m_fdc->dden_w(BIT(data, 5));
244}
Property changes on: trunk/src/mess/machine/ep64_exdos.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/machine/ep64_exdos.h
r0r23494
1/**********************************************************************
2
3    Intelligent Software EXDOS Disk Controller Module emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __EP64_EXDOS__
13#define __EP64_EXDOS__
14
15#include "emu.h"
16#include "formats/ep64_dsk.h"
17#include "machine/ep64exp.h"
18#include "machine/wd_fdc.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> ep64_exdos_device
27
28class ep64_exdos_device : public device_t,
29                    public device_ep64_expansion_bus_card_interface
30{
31public:
32   // construction/destruction
33   ep64_exdos_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual const rom_entry *device_rom_region() const;
37   virtual machine_config_constructor device_mconfig_additions() const;
38
39   DECLARE_READ8_MEMBER( read );
40   DECLARE_WRITE8_MEMBER( write );
41
42   DECLARE_FLOPPY_FORMATS( floppy_formats );
43
44protected:
45   // device-level overrides
46   virtual void device_start();
47   virtual void device_reset();
48
49private:
50   required_device<wd1770_t> m_fdc;
51   required_device<floppy_connector> m_floppy0;
52   required_device<floppy_connector> m_floppy1;
53   required_device<floppy_connector> m_floppy2;
54   required_device<floppy_connector> m_floppy3;
55   floppy_image_device *m_floppy;
56   required_memory_region m_rom;
57};
58
59
60// device type definition
61extern const device_type EP64_EXDOS;
62
63
64
65#endif
Property changes on: trunk/src/mess/machine/ep64_exdos.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/video/epnick.c
r23493r23494
1/*****************************************************************************
2 *
3 * video/epnick.c
4 *
5 * Nick Graphics Chip - found in Enterprise
6 *
7 * this is a display list graphics chip, with bitmap,
8 * character and attribute graphics modes. Each entry in the
9 * display list defines a char line, with variable number of
10 * scanlines. Colour modes are 2,4, 16 and 256 colour.
11 * Nick has 256 colours, 3 bits for R and G, with 2 bits for Blue.
12 * It's a nice and flexible graphics processor..........
13 *
14 ****************************************************************************/
15
16#include "emu.h"
17#include "video/epnick.h"
18
19/* colour mode types */
20#define NICK_2_COLOUR_MODE  0
21#define NICK_4_COLOUR_MODE  1
22#define NICK_16_COLOUR_MODE 2
23#define NICK_256_COLOUR_MODE    3
24
25/* Display mode types */
26#define NICK_VSYNC_MODE 0
27#define NICK_PIXEL_MODE 1
28#define NICK_ATTR_MODE  2
29#define NICK_CH256_MODE 3
30#define NICK_CH128_MODE 4
31#define NICK_CH64_MODE  5
32#define NICK_UNUSED_MODE    6
33#define NICK_LPIXEL_MODE    7
34
35/* MODEBYTE defines */
36#define NICK_MB_VIRQ            (1<<7)
37#define NICK_MB_VRES            (1<<4)
38#define NICK_MB_LPT_RELOAD      (1<<0)
39
40/* Left margin defines */
41#define NICK_LM_MSBALT          (1<<7)
42#define NICK_LM_LSBALT          (1<<6)
43
44/* Right margin defines */
45#define NICK_RM_ALTIND1         (1<<7)
46#define NICK_RM_ALTIND0         (1<<6)
47
48/* useful macros */
49#define NICK_GET_LEFT_MARGIN(x)     (x & 0x03f)
50#define NICK_GET_RIGHT_MARGIN(x)    (x & 0x03f)
51#define NICK_GET_DISPLAY_MODE(x)    ((x>>1) & 0x07)
52#define NICK_GET_COLOUR_MODE(x)     ((x>>5) & 0x03)
53
54#define NICK_RELOAD_LPT(x)          (x & 0x080)
55#define NICK_CLOCK_LPT(x)           (x & 0x040)
56
57/* Macros to generate memory address is CHx modes */
58/* x = LD2, y = buf1 */
59#define ADDR_CH256(x,y)     (((x & 0x0ff)<<8) | (y & 0x0ff))
60#define ADDR_CH128(x,y)     (((x & 0x01ff)<<7) | (y & 0x07f))
61#define ADDR_CH64(x,y)      (((x & 0x03ff)<<6) | (y & 0x03f))
62
63
64const device_type NICK = &device_creator<nick_device>;
65
66//-------------------------------------------------
67//  stic_device - constructor
68//-------------------------------------------------
69
70nick_device::nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
71         device_t(mconfig, NICK, "Nick Graphics Chip", tag, owner, clock, "epnick", __FILE__),
72         m_videoram(NULL)
73{
74}
75
76
77//-------------------------------------------------
78//  ~stic_device - destructor
79//-------------------------------------------------
80
81nick_device::~nick_device()
82{
83}
84
85//-------------------------------------------------
86//  device_start - device-specific startup
87//-------------------------------------------------
88
89void nick_device::device_start()
90{
91   machine().primary_screen->register_screen_bitmap(m_bitmap);
92   
93   calc_visible_clocks(ENTERPRISE_SCREEN_WIDTH);
94
95   bitmap_ind16 m_bitmap;
96   
97   save_item(NAME(m_scanline_count));
98   save_item(NAME(m_FIXBIAS));
99   save_item(NAME(m_BORDER));
100   save_item(NAME(m_LPL));
101   save_item(NAME(m_LPH));
102   save_item(NAME(m_LD1));
103   save_item(NAME(m_LD2));
104   save_item(NAME(m_LPT.SC));
105   save_item(NAME(m_LPT.MB));
106   save_item(NAME(m_LPT.LM));
107   save_item(NAME(m_LPT.RM));
108   save_item(NAME(m_LPT.LD1L));
109   save_item(NAME(m_LPT.LD1H));
110   save_item(NAME(m_LPT.LD2L));
111   save_item(NAME(m_LPT.LD2H));
112   save_item(NAME(m_LPT.COL));
113   save_item(NAME(m_dest_pos));
114   save_item(NAME(m_dest_max_pos));
115   save_item(NAME(m_reg));
116   save_item(NAME(m_first_visible_clock));
117   save_item(NAME(m_last_visible_clock));
118}
119
120
121void nick_device::device_reset()
122{   
123   for (int i = 0; i < 256; i++)
124   {
125      int pen_index;
126     
127      pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1);
128      m_pen_idx_4col[i] = pen_index;
129     
130      pen_index =  (BIT(i, 7) << 0) | (BIT(i, 3) << 1) |  (BIT(i, 5) << 2) | (BIT(i, 1) << 3);
131      m_pen_idx_16col[i] = pen_index;
132   }
133   
134   //m_BORDER = 0;
135   //m_FIXBIAS = 0;
136}
137
138
139// MESS specific
140/* 8-bit pixel write! */
141void nick_device::write_pixel(int ci)
142{
143   if (m_dest_pos < m_dest_max_pos)
144   {
145      m_dest[m_dest_pos++] = ci;
146   }
147}
148
149
150/* No of highest resolution pixels per "clock" */
151#define NICK_PIXELS_PER_CLOCK   16
152
153/* "clocks" per line */
154#define NICK_TOTAL_CLOCKS_PER_LINE  64
155
156/* we align based on the clocks */
157void nick_device::calc_visible_clocks(int width)
158{
159   /* number of clocks we can see */
160   int no_visible_clocks = width / NICK_PIXELS_PER_CLOCK;
161   m_first_visible_clock = (NICK_TOTAL_CLOCKS_PER_LINE - no_visible_clocks) >> 1;
162   m_last_visible_clock = m_first_visible_clock + no_visible_clocks;
163}
164
165
166/* write border colour */
167void nick_device::write_border(int clocks)
168{
169   int col_index = m_BORDER;
170
171   for (int i = 0; i < (clocks << 4); i++)
172      write_pixel(col_index);
173}
174
175
176void nick_device::do_left_margin()
177{
178   UINT8 left = NICK_GET_LEFT_MARGIN(m_LPT.LM);
179
180   if (left > m_first_visible_clock)
181   {
182      /* some of the left margin is visible */
183      UINT8 left_visible = left - m_first_visible_clock;
184
185      /* render the border */
186      write_border(left_visible);
187   }
188}
189
190void nick_device::do_right_margin()
191{
192   UINT8 right = NICK_GET_RIGHT_MARGIN(m_LPT.RM);
193
194   if (right < m_last_visible_clock)
195   {
196      /* some of the right margin is visible */
197      UINT8 right_visible = m_last_visible_clock - right;
198
199      /* render the border */
200      write_border(right_visible);
201   }
202}
203
204int nick_device::get_color_index(int pen_index)
205{
206   if (pen_index & 0x08)
207      return ((m_FIXBIAS & 0x01f) << 3) | (pen_index & 0x07);
208   else
209      return m_LPT.COL[pen_index];
210}
211
212void nick_device::write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte)
213{
214   int col_index[2];
215   int pen_index;
216   UINT8 data = data_byte;
217
218   col_index[0] = get_color_index(pen0);
219   col_index[1] = get_color_index(pen1);
220
221   for (int i = 0; i < 8; i++)
222   {
223      pen_index = col_index[BIT(data, 7)];
224      write_pixel(pen_index);
225      data <<= 1;
226   }
227}
228
229void nick_device::write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte)
230{
231   int col_index[2];
232   int pen_index;
233   UINT8 data = data_byte;
234   
235   col_index[0] = get_color_index(pen0);
236   col_index[1] = get_color_index(pen1);
237   
238   for (int i = 0; i < 8; i++)
239   {
240      pen_index = col_index[BIT(data, 7)];
241      write_pixel(pen_index);
242      write_pixel(pen_index);
243      data <<= 1;
244   }
245}
246
247
248void nick_device::write_pixels(UINT8 data_byte, UINT8 char_idx)
249{
250   /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */
251   int pen_idx;
252   /* Col index = EP colour value */
253   int pal_idx;
254   UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB);
255   UINT8 data = data_byte;
256
257   switch (color_mode)
258   {
259      case NICK_2_COLOUR_MODE:
260      {
261         int pen_offs = 0;
262
263         /* do before displaying byte */
264
265         /* left margin attributes */
266         if (m_LPT.LM & NICK_LM_MSBALT)
267         {
268            if (data & 0x080)
269            {
270               pen_offs |= 2;
271            }
272
273            data &=~0x080;
274         }
275
276         if (m_LPT.LM & NICK_LM_LSBALT)
277         {
278            if (data & 0x001)
279            {
280               pen_offs |= 4;
281            }
282
283            data &=~0x01;
284         }
285
286         if (m_LPT.RM & NICK_RM_ALTIND1)
287         {
288            if (char_idx & 0x080)
289            {
290               pen_offs |= 0x02;
291            }
292         }
293
294#if 0
295         if (m_LPT.RM & NICK_RM_ALTIND0)
296         {
297            if (data & 0x040)
298            {
299               pen_offs |= 0x04;
300            }
301         }
302#endif
303
304
305         write_pixels2color(pen_offs, (pen_offs | 0x01), data);
306      }
307      break;
308
309      case NICK_4_COLOUR_MODE:
310      {
311         //mame_printf_info("4 colour\r\n");
312
313         /* left margin attributes */
314         if (m_LPT.LM & NICK_LM_MSBALT)
315         {
316            data &= ~0x080;
317         }
318
319         if (m_LPT.LM & NICK_LM_LSBALT)
320         {
321            data &= ~0x01;
322         }
323
324
325         for (int i = 0; i < 4; i++)
326         {
327            pen_idx = m_pen_idx_4col[data];
328            pal_idx = m_LPT.COL[pen_idx & 0x03];
329
330            write_pixel(pal_idx);
331            write_pixel(pal_idx);
332
333            data <<= 1;
334         }
335      }
336      break;
337
338      case NICK_16_COLOUR_MODE:
339      {
340         //mame_printf_info("16 colour\r\n");
341
342         /* left margin attributes */
343         if (m_LPT.LM & NICK_LM_MSBALT)
344         {
345            data &= ~0x080;
346         }
347
348         if (m_LPT.LM & NICK_LM_LSBALT)
349         {
350            data &= ~0x01;
351         }
352
353
354         for (int i = 0; i < 2; i++)
355         {
356            pen_idx = m_pen_idx_16col[data];
357
358            pal_idx = get_color_index(pen_idx);
359
360            write_pixel(pal_idx);
361            write_pixel(pal_idx);
362            write_pixel(pal_idx);
363            write_pixel(pal_idx);
364
365            data <<= 1;
366         }
367      }
368      break;
369
370      case NICK_256_COLOUR_MODE:
371      {
372         /* left margin attributes */
373         if (m_LPT.LM & NICK_LM_MSBALT)
374         {
375            data &= ~0x080;
376         }
377
378         if (m_LPT.LM & NICK_LM_LSBALT)
379         {
380            data &= ~0x01;
381         }
382
383
384         pal_idx = data;
385
386         write_pixel(pal_idx);
387         write_pixel(pal_idx);
388         write_pixel(pal_idx);
389         write_pixel(pal_idx);
390         write_pixel(pal_idx);
391         write_pixel(pal_idx);
392         write_pixel(pal_idx);
393         write_pixel(pal_idx);
394
395
396      }
397      break;
398   }
399}
400
401void nick_device::write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx)
402{
403   /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */
404   int pen_idx;
405   /* Col index = EP colour value */
406   int pal_idx;
407   UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB);
408   UINT8 data = data_byte;
409
410   switch (color_mode)
411   {
412      case NICK_2_COLOUR_MODE:
413      {
414         int pen_offs = 0;
415
416         /* do before displaying byte */
417
418         /* left margin attributes */
419         if (m_LPT.LM & NICK_LM_MSBALT)
420         {
421            if (data & 0x080)
422            {
423               pen_offs |= 2;
424            }
425
426            data &=~0x080;
427         }
428
429         if (m_LPT.LM & NICK_LM_LSBALT)
430         {
431            if (data & 0x001)
432            {
433               pen_offs |= 4;
434            }
435
436            data &=~0x01;
437         }
438
439         if (m_LPT.RM & NICK_RM_ALTIND1)
440         {
441            if (char_idx & 0x080)
442            {
443               pen_offs |= 0x02;
444            }
445         }
446
447#if 0
448         if (m_LPT.RM & NICK_RM_ALTIND0)
449         {
450            if (data & 0x040)
451            {
452               pen_offs |= 0x04;
453            }
454         }
455#endif
456
457
458         write_pixels2color_lpixel(pen_offs, (pen_offs | 0x01), data);
459      }
460      break;
461
462      case NICK_4_COLOUR_MODE:
463      {
464         //mame_printf_info("4 colour\r\n");
465
466         /* left margin attributes */
467         if (m_LPT.LM & NICK_LM_MSBALT)
468         {
469            data &= ~0x080;
470         }
471
472         if (m_LPT.LM & NICK_LM_LSBALT)
473         {
474            data &= ~0x01;
475         }
476
477
478         for (int i = 0; i < 4; i++)
479         {
480            pen_idx = m_pen_idx_4col[data];
481            pal_idx = m_LPT.COL[pen_idx & 0x03];
482
483            write_pixel(pal_idx);
484            write_pixel(pal_idx);
485            write_pixel(pal_idx);
486            write_pixel(pal_idx);
487
488            data <<= 1;
489         }
490      }
491      break;
492
493      case NICK_16_COLOUR_MODE:
494      {
495         //mame_printf_info("16 colour\r\n");
496
497         /* left margin attributes */
498         if (m_LPT.LM & NICK_LM_MSBALT)
499         {
500            data &= ~0x080;
501         }
502
503         if (m_LPT.LM & NICK_LM_LSBALT)
504         {
505            data &= ~0x01;
506         }
507
508
509         for (int i = 0; i < 2; i++)
510         {
511            pen_idx = m_pen_idx_16col[data];
512            pal_idx = get_color_index(pen_idx);
513
514            write_pixel(pal_idx);
515            write_pixel(pal_idx);
516            write_pixel(pal_idx);
517            write_pixel(pal_idx);
518            write_pixel(pal_idx);
519            write_pixel(pal_idx);
520            write_pixel(pal_idx);
521            write_pixel(pal_idx);
522
523            data <<= 1;
524         }
525      }
526      break;
527
528      case NICK_256_COLOUR_MODE:
529      {
530         /* left margin attributes */
531         if (m_LPT.LM & NICK_LM_MSBALT)
532         {
533            data &= ~0x080;
534         }
535
536         if (m_LPT.LM & NICK_LM_LSBALT)
537         {
538            data &= ~0x01;
539         }
540
541
542         pal_idx = data;
543
544         write_pixel(pal_idx);
545         write_pixel(pal_idx);
546         write_pixel(pal_idx);
547         write_pixel(pal_idx);
548         write_pixel(pal_idx);
549         write_pixel(pal_idx);
550         write_pixel(pal_idx);
551         write_pixel(pal_idx);
552
553         write_pixel(pal_idx);
554         write_pixel(pal_idx);
555         write_pixel(pal_idx);
556         write_pixel(pal_idx);
557         write_pixel(pal_idx);
558         write_pixel(pal_idx);
559         write_pixel(pal_idx);
560         write_pixel(pal_idx);
561
562
563      }
564      break;
565   }
566}
567
568
569void nick_device::do_pixel(int clocks_visible)
570{
571   UINT8 buf1, buf2;
572
573   for (int i = 0; i < clocks_visible; i++)
574   {
575      buf1 = fetch_byte(m_LD1);
576      m_LD1++;
577
578      buf2 = fetch_byte(m_LD1);
579      m_LD1++;
580
581      write_pixels(buf1, buf1);
582      write_pixels(buf2, buf1);
583   }
584}
585
586
587void nick_device::do_lpixel(int clocks_visible)
588{
589   UINT8 buf1;
590
591   for (int i = 0; i < clocks_visible; i++)
592   {
593      buf1 = fetch_byte(m_LD1);
594      m_LD1++;
595
596      write_pixels_lpixel(buf1, buf1);
597   }
598}
599
600void nick_device::do_attr(int clocks_visible)
601{
602   UINT8 buf1, buf2;
603
604   for (int i = 0; i < clocks_visible; i++)
605   {
606      buf1 = fetch_byte(m_LD1);
607      m_LD1++;
608
609      buf2 = fetch_byte(m_LD2);
610      m_LD2++;
611
612      {
613         UINT8 bg_color = ((buf1 >> 4) & 0x0f);
614         UINT8 fg_color = (buf1 & 0x0f);
615
616         write_pixels2color_lpixel(bg_color, fg_color, buf2);
617      }
618   }
619}
620
621void nick_device::do_ch256(int clocks_visible)
622{
623   UINT8 buf1, buf2;
624
625   for (int i = 0; i < clocks_visible; i++)
626   {
627      buf1 = fetch_byte(m_LD1);
628      m_LD1++;
629      buf2 = fetch_byte(ADDR_CH256(m_LD2, buf1));
630
631      write_pixels_lpixel(buf2, buf1);
632   }
633}
634
635void nick_device::do_ch128(int clocks_visible)
636{
637   UINT8 buf1, buf2;
638
639   for (int i = 0; i < clocks_visible; i++)
640   {
641      buf1 = fetch_byte(m_LD1);
642      m_LD1++;
643      buf2 = fetch_byte(ADDR_CH128(m_LD2, buf1));
644
645      write_pixels_lpixel(buf2, buf1);
646   }
647}
648
649void nick_device::do_ch64(int clocks_visible)
650{
651   UINT8 buf1, buf2;
652
653   for (int i = 0; i < clocks_visible; i++)
654   {
655      buf1 = fetch_byte(m_LD1);
656      m_LD1++;
657      buf2 = fetch_byte(ADDR_CH64(m_LD2, buf1));
658
659      write_pixels_lpixel(buf2, buf1);
660   }
661}
662
663
664void nick_device::do_display()
665{
666   LPT_ENTRY *pLPT = &m_LPT;
667   UINT8 clocks_visible;
668   UINT8 right_margin = NICK_GET_RIGHT_MARGIN(pLPT->RM);
669   UINT8 left_margin = NICK_GET_LEFT_MARGIN(pLPT->LM);
670
671   clocks_visible = right_margin - left_margin;
672
673   if (clocks_visible)
674   {
675      /* get display mode */
676      UINT8 display_mode = NICK_GET_DISPLAY_MODE(pLPT->MB);
677
678      if (m_scanline_count == 0)   // ||
679         //((pLPT->MB & NICK_MB_VRES)==0))
680      {
681         /* doing first line */
682         /* reload LD1, and LD2 (if necessary) regardless of display mode */
683         m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8);
684
685         if ((display_mode != NICK_LPIXEL_MODE) && (display_mode != NICK_PIXEL_MODE))
686         {
687            /* lpixel and pixel modes don't use LD2 */
688            m_LD2 = (pLPT->LD2L & 0xff) | ((pLPT->LD2H & 0xff) << 8);
689         }
690      }
691      else
692      {
693         /* not first line */
694         switch (display_mode)
695         {
696            case NICK_ATTR_MODE:
697            {
698               /* reload LD1 */
699               m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8);
700            }
701            break;
702
703            case NICK_CH256_MODE:
704            case NICK_CH128_MODE:
705            case NICK_CH64_MODE:
706            {
707               /* reload LD1 */
708               m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8);
709               m_LD2++;
710            }
711            break;
712
713            default:
714               break;
715         }
716      }
717
718      switch (display_mode)
719      {
720         case NICK_PIXEL_MODE:
721         {
722            do_pixel(clocks_visible);
723         }
724         break;
725
726         case NICK_ATTR_MODE:
727         {
728            //mame_printf_info("attr mode\r\n");
729            do_attr(clocks_visible);
730         }
731         break;
732
733         case NICK_CH256_MODE:
734         {
735            //mame_printf_info("ch256 mode\r\n");
736            do_ch256(clocks_visible);
737         }
738         break;
739
740         case NICK_CH128_MODE:
741         {
742            do_ch128(clocks_visible);
743         }
744         break;
745
746         case NICK_CH64_MODE:
747         {
748            //mame_printf_info("ch64 mode\r\n");
749            do_ch64(clocks_visible);
750         }
751         break;
752
753         case NICK_LPIXEL_MODE:
754         {
755            do_lpixel(clocks_visible);
756         }
757         break;
758
759         default:
760            break;
761      }
762   }
763}
764
765void nick_device::update_lpt()
766{
767   UINT16 CurLPT = (m_LPL & 0x0ff) | ((m_LPH & 0x0f) << 8);
768   CurLPT++;
769   m_LPL = CurLPT & 0x0ff;
770   m_LPH = (m_LPH & 0x0f0) | ((CurLPT >> 8) & 0x0f);
771}
772
773
774void nick_device::reload_lpt()
775{
776   /* get addr of LPT */
777   UINT32 LPT_Addr = ((m_LPL & 0x0ff) << 4) | ((m_LPH & 0x0f) << (8+4));
778
779   /* update internal LPT state */
780   m_LPT.SC = fetch_byte(LPT_Addr);
781   m_LPT.MB = fetch_byte(LPT_Addr + 1);
782   m_LPT.LM = fetch_byte(LPT_Addr + 2);
783   m_LPT.RM = fetch_byte(LPT_Addr + 3);
784   m_LPT.LD1L = fetch_byte(LPT_Addr + 4);
785   m_LPT.LD1H = fetch_byte(LPT_Addr + 5);
786   m_LPT.LD2L = fetch_byte(LPT_Addr + 6);
787   m_LPT.LD2H = fetch_byte(LPT_Addr + 7);
788   m_LPT.COL[0] = fetch_byte(LPT_Addr + 8);
789   m_LPT.COL[1] = fetch_byte(LPT_Addr + 9);
790   m_LPT.COL[2] = fetch_byte(LPT_Addr + 10);
791   m_LPT.COL[3] = fetch_byte(LPT_Addr + 11);
792   m_LPT.COL[4] = fetch_byte(LPT_Addr + 12);
793   m_LPT.COL[5] = fetch_byte(LPT_Addr + 13);
794   m_LPT.COL[6] = fetch_byte(LPT_Addr + 14);
795   m_LPT.COL[7] = fetch_byte(LPT_Addr + 15);
796}
797
798/* call here to render a line of graphics */
799void nick_device::do_line()
800{
801   UINT8 scanline;
802
803   if ((m_LPT.MB & NICK_MB_LPT_RELOAD)!=0)
804   {
805      /* reload LPT */
806
807      m_LPL = m_reg[2];
808      m_LPH = m_reg[3];
809
810      reload_lpt();
811   }
812
813   /* left border */
814   do_left_margin();
815
816   /* do visible part */
817   do_display();
818
819   /* right border */
820   do_right_margin();
821
822   // 0x0f7 is first!
823   /* scan line count for this LPT */
824   scanline = ((~m_LPT.SC) + 1) & 0x0ff;
825
826   //printf("scanline %02x\r\n", scanline);
827
828   /* update count of scanlines done so far */
829   m_scanline_count++;
830
831   if (m_scanline_count == scanline)
832   {
833      /* done all scanlines of this Line Parameter Table, get next */
834
835      m_scanline_count = 0;
836
837      update_lpt();
838      reload_lpt();
839   }
840}
841
842WRITE8_MEMBER( nick_device::reg_w )
843{
844   //mame_printf_info("Nick write %02x %02x\r\n",offset, data);
845
846   /* write to a nick register */
847   m_reg[offset & 0x0f] = data;
848
849   if ((offset == 0x03) || (offset == 0x02))
850   {
851      /* write LPH */
852
853      /* reload LPT base? */
854      //if (NICK_RELOAD_LPT(data))
855      {
856         /* reload LPT base pointer */
857         m_LPL = m_reg[2];
858         m_LPH = m_reg[3];
859
860         reload_lpt();
861      }
862   }
863
864   if (offset == 0x01)
865   {
866      m_BORDER = data;
867   }
868
869   if (offset == 0x00)
870   {
871      m_FIXBIAS = data;
872   }
873}
874
875void nick_device::do_screen(bitmap_ind16 &bm)
876{
877   int line = 0;
878
879   do
880   {
881      /* set write address for line */
882      m_dest = &bm.pix16(line);
883      m_dest_pos = 0;
884      m_dest_max_pos = bm.width();
885
886      /* write line */
887      do_line();
888
889      /* next line */
890      line++;
891   }
892   while (((m_LPT.MB & 0x080) == 0) && (line < ENTERPRISE_SCREEN_HEIGHT));
893
894}
895
896
897UINT32 nick_device::screen_update_epnick(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
898{
899   do_screen(m_bitmap);
900   copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
901   return 0;
902}
trunk/src/mess/video/epnick.h
r23493r23494
1#ifndef __EPNICK_H__
2#define __EPNICK_H__
3
4
5
6/* there are 64us per line, although in reality
7 about 50 are visible. */
8#define ENTERPRISE_SCREEN_WIDTH (50*16)
9
10/* there are 312 lines per screen, although in reality
11 about 35*8 are visible */
12#define ENTERPRISE_SCREEN_HEIGHT    (35*8)
13
14
15
16/* Nick executes a Display list, in the form of a list of Line Parameter
17 Tables, this is the form of the data */
18struct LPT_ENTRY
19{
20   UINT8 SC;       /* scanlines in this modeline (two's complement) */
21   UINT8 MB;       /* the MODEBYTE (defines video display mode) */
22   UINT8 LM;       /* left margin etc */
23   UINT8 RM;       /* right margin etc */
24   UINT8 LD1L;     /* (a7..a0) of line data pointer LD1 */
25   UINT8 LD1H;     /* (a8..a15) of line data pointer LD1 */
26   UINT8 LD2L;     /* (a7..a0) of line data pointer LD2 */
27   UINT8 LD2H;     /* (a8..a15) of line data pointer LD2 */
28   UINT8 COL[8];   /* COL0..COL7 */
29};
30
31
32class nick_device : public device_t
33{
34public:
35   nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
36   virtual ~nick_device();
37
38   void set_vram(UINT8 *vram) { m_videoram = vram; }
39   DECLARE_WRITE8_MEMBER(reg_w);
40
41   UINT32 screen_update_epnick(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
42
43protected:
44   // device-level overrides
45   virtual void device_start();
46   virtual void device_reset();
47
48private:
49   inline UINT8 fetch_byte(UINT32 offs) { return m_videoram[offs & 0x0ffff]; }
50   void write_pixel(int ci);
51   void calc_visible_clocks(int width);
52   void init();
53   void write_border(int clocks);
54   void do_left_margin();
55   void do_right_margin();
56
57   int get_color_index(int pen_index);
58   void write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte);
59   void write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte);
60   void write_pixels(UINT8 data_byte, UINT8 char_idx);
61   void write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx);
62
63   void do_pixel(int clocks_visible);
64   void do_lpixel(int clocks_visible);
65   void do_attr(int clocks_visible);
66   void do_ch256(int clocks_visible);
67   void do_ch128(int clocks_visible);
68   void do_ch64(int clocks_visible);
69   void do_display();
70   void update_lpt();
71   void reload_lpt();
72   void do_line();
73   void do_screen(bitmap_ind16 &bm);
74   
75   bitmap_ind16 m_bitmap;
76
77   /* horizontal position */
78   UINT8 horizontal_clock;
79   /* current scanline within LPT */
80   UINT8 m_scanline_count;
81   
82   UINT8 m_FIXBIAS;
83   UINT8 m_BORDER;
84   UINT8 m_LPL;
85   UINT8 m_LPH;
86   
87   UINT16 m_LD1;
88   UINT16 m_LD2;
89   
90   LPT_ENTRY   m_LPT;
91   
92   UINT16 *m_dest;
93   int m_dest_pos;
94   int m_dest_max_pos;
95   
96   UINT8 m_reg[16];
97   
98   /* first clock visible on left hand side */
99   int m_first_visible_clock;
100   /* first clock visible on right hand side */
101   int m_last_visible_clock;
102   
103   /* given a bit pattern, this will get the pen index */
104   UINT8 m_pen_idx_4col[256];
105   /* given a bit pattern, this will get the pen index */
106   UINT8 m_pen_idx_16col[256];
107   
108   UINT8 *m_videoram;
109};
110
111
112
113// device type definition
114extern const device_type NICK;
115
116
117/***************************************************************************
118 DEVICE CONFIGURATION MACROS
119 ***************************************************************************/
120
121#define MCFG_NICK_ADD(_tag) \
122   MCFG_DEVICE_ADD(_tag, NICK, 0)
123
124
125#endif
trunk/src/mess/video/nick.c
r0r23494
1/**********************************************************************
2
3    Intelligent Designs NICK emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "nick.h"
11
12
13
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
17
18#define LOG 0
19
20/* colour mode types */
21#define NICK_2_COLOUR_MODE  0
22#define NICK_4_COLOUR_MODE  1
23#define NICK_16_COLOUR_MODE 2
24#define NICK_256_COLOUR_MODE    3
25
26/* Display mode types */
27#define NICK_VSYNC_MODE 0
28#define NICK_PIXEL_MODE 1
29#define NICK_ATTR_MODE  2
30#define NICK_CH256_MODE 3
31#define NICK_CH128_MODE 4
32#define NICK_CH64_MODE  5
33#define NICK_UNUSED_MODE    6
34#define NICK_LPIXEL_MODE    7
35
36/* MODEBYTE defines */
37#define NICK_MB_VIRQ            (1<<7)
38#define NICK_MB_VRES            (1<<4)
39#define NICK_MB_LPT_RELOAD      (1<<0)
40
41/* Left margin defines */
42#define NICK_LM_MSBALT          (1<<7)
43#define NICK_LM_LSBALT          (1<<6)
44
45/* Right margin defines */
46#define NICK_RM_ALTIND1         (1<<7)
47#define NICK_RM_ALTIND0         (1<<6)
48
49/* useful macros */
50#define NICK_GET_LEFT_MARGIN(x)     (x & 0x03f)
51#define NICK_GET_RIGHT_MARGIN(x)    (x & 0x03f)
52#define NICK_GET_DISPLAY_MODE(x)    ((x>>1) & 0x07)
53#define NICK_GET_COLOUR_MODE(x)     ((x>>5) & 0x03)
54
55#define NICK_RELOAD_LPT(x)          (x & 0x080)
56#define NICK_CLOCK_LPT(x)           (x & 0x040)
57
58/* Macros to generate memory address is CHx modes */
59/* x = LD2, y = buf1 */
60#define ADDR_CH256(x,y)     (((x & 0x0ff)<<8) | (y & 0x0ff))
61#define ADDR_CH128(x,y)     (((x & 0x01ff)<<7) | (y & 0x07f))
62#define ADDR_CH64(x,y)      (((x & 0x03ff)<<6) | (y & 0x03f))
63
64/* No of highest resolution pixels per "clock" */
65#define NICK_PIXELS_PER_CLOCK   16
66
67/* "clocks" per line */
68#define NICK_TOTAL_CLOCKS_PER_LINE  64
69
70/* Enterprise has 256 colours, all may be on the screen at once!
71 the NICK_GET_RED8, NICK_GET_GREEN8, NICK_GET_BLUE8 macros
72 return a 8-bit colour value for the index specified.  */
73
74/* given a colour index in range 0..255 gives the Red component */
75#define NICK_GET_RED8(x) \
76   ((      \
77      (BIT(x, 0) << 2) | \
78      (BIT(x, 3) << 1) | \
79      (BIT(x, 6) << 0) \
80   ) << 5)
81
82/* given a colour index in range 0..255 gives the Red component */
83#define NICK_GET_GREEN8(x) \
84   ((  \
85      (BIT(x, 1) << 2) | \
86      (BIT(x, 4) << 1) | \
87      (BIT(x, 7) << 0) \
88   ) << 5)
89
90/* given a colour index in range 0..255 gives the Red component */
91#define NICK_GET_BLUE8(x) \
92   (( \
93      (BIT(x, 2) << 1) | \
94      (BIT(x, 5) << 0) \
95   ) << 6)
96
97
98
99//**************************************************************************
100//  DEVICE DEFINITIONS
101//**************************************************************************
102
103const device_type NICK = &device_creator<nick_device>;
104
105
106DEVICE_ADDRESS_MAP_START( vram_map, 8, nick_device )
107   AM_RANGE(0x0000, 0xffff) AM_READWRITE(vram_r, vram_w)
108ADDRESS_MAP_END
109
110DEVICE_ADDRESS_MAP_START( vio_map, 8, nick_device )
111   AM_RANGE(0x00, 0x00) AM_WRITE(fixbias_w)
112   AM_RANGE(0x01, 0x01) AM_WRITE(border_w)
113   AM_RANGE(0x02, 0x02) AM_WRITE(lpl_w)
114   AM_RANGE(0x03, 0x03) AM_WRITE(lph_w)
115ADDRESS_MAP_END
116
117static ADDRESS_MAP_START( nick_map, AS_0, 8, nick_device )
118   AM_RANGE(0x0000, 0xffff) AM_RAM
119ADDRESS_MAP_END
120
121
122
123//**************************************************************************
124//  LIVE DEVICE
125//**************************************************************************
126
127//-------------------------------------------------
128//  nick_device - constructor
129//-------------------------------------------------
130
131nick_device::nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
132   : device_t(mconfig, NICK, "NICK", tag, owner, clock),
133     device_memory_interface(mconfig, *this),
134     m_space_config("vram", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(nick_map)),
135     m_write_virq(*this)
136{
137}
138
139
140//-------------------------------------------------
141//  device_start - device-specific startup
142//-------------------------------------------------
143
144void nick_device::device_start()
145{
146   screen_device *screen = machine().first_screen();
147
148   screen->register_screen_bitmap(m_bitmap);
149   calc_visible_clocks(ENTERPRISE_SCREEN_WIDTH);
150
151   // initialize palette
152   for (int i = 0; i < 256; i++)
153      palette_set_color_rgb(machine(), i, NICK_GET_RED8(i), NICK_GET_GREEN8(i), NICK_GET_BLUE8(i));
154
155   // resolve callbacks
156   m_write_virq.resolve_safe();
157
158   // allocate timers
159   m_timer_scanline = timer_alloc();
160   m_timer_scanline->adjust(screen->time_until_pos(0, 0), 0, screen->scan_period());
161
162   // state saving
163   save_item(NAME(m_scanline_count));
164   save_item(NAME(m_FIXBIAS));
165   save_item(NAME(m_BORDER));
166   save_item(NAME(m_LPL));
167   save_item(NAME(m_LPH));
168   save_item(NAME(m_LD1));
169   save_item(NAME(m_LD2));
170   save_item(NAME(m_LPT.SC));
171   save_item(NAME(m_LPT.MB));
172   save_item(NAME(m_LPT.LM));
173   save_item(NAME(m_LPT.RM));
174   save_item(NAME(m_LPT.LD1L));
175   save_item(NAME(m_LPT.LD1H));
176   save_item(NAME(m_LPT.LD2L));
177   save_item(NAME(m_LPT.LD2H));
178   save_item(NAME(m_LPT.COL));
179   save_item(NAME(m_dest_pos));
180   save_item(NAME(m_dest_max_pos));
181   save_item(NAME(m_reg));
182   save_item(NAME(m_first_visible_clock));
183   save_item(NAME(m_last_visible_clock));
184}
185
186
187//-------------------------------------------------
188//  device_reset - device-specific reset
189//-------------------------------------------------
190
191void nick_device::device_reset()
192{
193   m_write_virq(CLEAR_LINE);
194   m_virq = 0;
195
196   for (int i = 0; i < 256; i++)
197   {
198      int pen_index;
199     
200      pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1);
201      m_pen_idx_4col[i] = pen_index;
202     
203      pen_index =  (BIT(i, 7) << 0) | (BIT(i, 3) << 1) |  (BIT(i, 5) << 2) | (BIT(i, 1) << 3);
204      m_pen_idx_16col[i] = pen_index;
205   }
206
207   m_scanline_count = 0;
208}
209
210
211//-------------------------------------------------
212//  device_timer - handler timer events
213//-------------------------------------------------
214
215void nick_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
216{
217   int scanline = machine().first_screen()->vpos();
218
219   if (scanline < ENTERPRISE_SCREEN_HEIGHT)
220   {
221      /* set write address for line */
222      m_dest = &m_bitmap.pix16(scanline);
223      m_dest_pos = 0;
224      m_dest_max_pos = m_bitmap.width();
225
226      /* write line */
227      do_line();
228   }
229}
230
231
232//-------------------------------------------------
233//  memory_space_config - return a description of
234//  any address spaces owned by this device
235//-------------------------------------------------
236
237const address_space_config *nick_device::memory_space_config(address_spacenum spacenum) const
238{
239   return (spacenum == 0) ? &m_space_config : NULL;
240}
241
242
243//-------------------------------------------------
244//  update_screen - update screen
245//-------------------------------------------------
246
247UINT32 nick_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
248{
249   copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
250
251   return 0;
252}
253
254
255//-------------------------------------------------
256//  vram_r - video RAM read
257//-------------------------------------------------
258
259READ8_MEMBER( nick_device::vram_r )
260{
261   return m_addrspace[0]->read_byte(offset);
262}
263
264
265//-------------------------------------------------
266//  vram_w - video RAM write
267//-------------------------------------------------
268
269WRITE8_MEMBER( nick_device::vram_w )
270{
271   m_addrspace[0]->write_byte(offset, data);
272}
273
274
275//-------------------------------------------------
276//  fixbias_w -
277//-------------------------------------------------
278
279WRITE8_MEMBER( nick_device::fixbias_w )
280{
281   m_FIXBIAS = data;
282}
283
284
285//-------------------------------------------------
286//  border_w -
287//-------------------------------------------------
288
289WRITE8_MEMBER( nick_device::border_w )
290{
291   m_BORDER = data;
292}
293
294
295//-------------------------------------------------
296//  lpl_w -
297//-------------------------------------------------
298
299WRITE8_MEMBER( nick_device::lpl_w )
300{
301   m_LPL = m_reg[2] = data;
302
303   update_lpt();
304}
305
306
307//-------------------------------------------------
308//  lph_w -
309//-------------------------------------------------
310
311WRITE8_MEMBER( nick_device::lph_w )
312{
313   m_LPH = m_reg[3] = data;
314
315   update_lpt();
316}
317
318
319// MESS specific
320/* 8-bit pixel write! */
321void nick_device::write_pixel(int ci)
322{
323   if (m_dest_pos < m_dest_max_pos)
324   {
325      m_dest[m_dest_pos++] = ci;
326   }
327}
328
329/* we align based on the clocks */
330void nick_device::calc_visible_clocks(int width)
331{
332   /* number of clocks we can see */
333   int no_visible_clocks = width / NICK_PIXELS_PER_CLOCK;
334   m_first_visible_clock = (NICK_TOTAL_CLOCKS_PER_LINE - no_visible_clocks) >> 1;
335   m_last_visible_clock = m_first_visible_clock + no_visible_clocks;
336}
337
338
339/* write border colour */
340void nick_device::write_border(int clocks)
341{
342   int col_index = m_BORDER;
343
344   for (int i = 0; i < (clocks << 4); i++)
345      write_pixel(col_index);
346}
347
348
349void nick_device::do_left_margin()
350{
351   UINT8 left = NICK_GET_LEFT_MARGIN(m_LPT.LM);
352
353   if (left > m_first_visible_clock)
354   {
355      /* some of the left margin is visible */
356      UINT8 left_visible = left - m_first_visible_clock;
357
358      /* render the border */
359      write_border(left_visible);
360   }
361}
362
363void nick_device::do_right_margin()
364{
365   UINT8 right = NICK_GET_RIGHT_MARGIN(m_LPT.RM);
366
367   if (right < m_last_visible_clock)
368   {
369      /* some of the right margin is visible */
370      UINT8 right_visible = m_last_visible_clock - right;
371
372      /* render the border */
373      write_border(right_visible);
374   }
375}
376
377int nick_device::get_color_index(int pen_index)
378{
379   if (pen_index & 0x08)
380      return ((m_FIXBIAS & 0x01f) << 3) | (pen_index & 0x07);
381   else
382      return m_LPT.COL[pen_index];
383}
384
385void nick_device::write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte)
386{
387   int col_index[2];
388   int pen_index;
389   UINT8 data = data_byte;
390
391   col_index[0] = get_color_index(pen0);
392   col_index[1] = get_color_index(pen1);
393
394   for (int i = 0; i < 8; i++)
395   {
396      pen_index = col_index[BIT(data, 7)];
397      write_pixel(pen_index);
398      data <<= 1;
399   }
400}
401
402void nick_device::write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte)
403{
404   int col_index[2];
405   int pen_index;
406   UINT8 data = data_byte;
407   
408   col_index[0] = get_color_index(pen0);
409   col_index[1] = get_color_index(pen1);
410   
411   for (int i = 0; i < 8; i++)
412   {
413      pen_index = col_index[BIT(data, 7)];
414      write_pixel(pen_index);
415      write_pixel(pen_index);
416      data <<= 1;
417   }
418}
419
420
421void nick_device::write_pixels(UINT8 data_byte, UINT8 char_idx)
422{
423   /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */
424   int pen_idx;
425   /* Col index = EP colour value */
426   int pal_idx;
427   UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB);
428   UINT8 data = data_byte;
429
430   switch (color_mode)
431   {
432      case NICK_2_COLOUR_MODE:
433      {
434         int pen_offs = 0;
435
436         /* do before displaying byte */
437
438         /* left margin attributes */
439         if (m_LPT.LM & NICK_LM_MSBALT)
440         {
441            if (data & 0x080)
442            {
443               pen_offs |= 2;
444            }
445
446            data &=~0x080;
447         }
448
449         if (m_LPT.LM & NICK_LM_LSBALT)
450         {
451            if (data & 0x001)
452            {
453               pen_offs |= 4;
454            }
455
456            data &=~0x01;
457         }
458
459         if (m_LPT.RM & NICK_RM_ALTIND1)
460         {
461            if (char_idx & 0x080)
462            {
463               pen_offs |= 0x02;
464            }
465         }
466
467#if 0
468         if (m_LPT.RM & NICK_RM_ALTIND0)
469         {
470            if (data & 0x040)
471            {
472               pen_offs |= 0x04;
473            }
474         }
475#endif
476
477
478         write_pixels2color(pen_offs, (pen_offs | 0x01), data);
479      }
480      break;
481
482      case NICK_4_COLOUR_MODE:
483      {
484         //mame_printf_info("4 colour\r\n");
485
486         /* left margin attributes */
487         if (m_LPT.LM & NICK_LM_MSBALT)
488         {
489            data &= ~0x080;
490         }
491
492         if (m_LPT.LM & NICK_LM_LSBALT)
493         {
494            data &= ~0x01;
495         }
496
497
498         for (int i = 0; i < 4; i++)
499         {
500            pen_idx = m_pen_idx_4col[data];
501            pal_idx = m_LPT.COL[pen_idx & 0x03];
502
503            write_pixel(pal_idx);
504            write_pixel(pal_idx);
505
506            data <<= 1;
507         }
508      }
509      break;
510
511      case NICK_16_COLOUR_MODE:
512      {
513         //mame_printf_info("16 colour\r\n");
514
515         /* left margin attributes */
516         if (m_LPT.LM & NICK_LM_MSBALT)
517         {
518            data &= ~0x080;
519         }
520
521         if (m_LPT.LM & NICK_LM_LSBALT)
522         {
523            data &= ~0x01;
524         }
525
526
527         for (int i = 0; i < 2; i++)
528         {
529            pen_idx = m_pen_idx_16col[data];
530
531            pal_idx = get_color_index(pen_idx);
532
533            write_pixel(pal_idx);
534            write_pixel(pal_idx);
535            write_pixel(pal_idx);
536            write_pixel(pal_idx);
537
538            data <<= 1;
539         }
540      }
541      break;
542
543      case NICK_256_COLOUR_MODE:
544      {
545         /* left margin attributes */
546         if (m_LPT.LM & NICK_LM_MSBALT)
547         {
548            data &= ~0x080;
549         }
550
551         if (m_LPT.LM & NICK_LM_LSBALT)
552         {
553            data &= ~0x01;
554         }
555
556
557         pal_idx = data;
558
559         write_pixel(pal_idx);
560         write_pixel(pal_idx);
561         write_pixel(pal_idx);
562         write_pixel(pal_idx);
563         write_pixel(pal_idx);
564         write_pixel(pal_idx);
565         write_pixel(pal_idx);
566         write_pixel(pal_idx);
567
568
569      }
570      break;
571   }
572}
573
574void nick_device::write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx)
575{
576   /* pen index colour 2-C (0,1), 4-C (0..3) 16-C (0..16) */
577   int pen_idx;
578   /* Col index = EP colour value */
579   int pal_idx;
580   UINT8 color_mode = NICK_GET_COLOUR_MODE(m_LPT.MB);
581   UINT8 data = data_byte;
582
583   switch (color_mode)
584   {
585      case NICK_2_COLOUR_MODE:
586      {
587         int pen_offs = 0;
588
589         /* do before displaying byte */
590
591         /* left margin attributes */
592         if (m_LPT.LM & NICK_LM_MSBALT)
593         {
594            if (data & 0x080)
595            {
596               pen_offs |= 2;
597            }
598
599            data &=~0x080;
600         }
601
602         if (m_LPT.LM & NICK_LM_LSBALT)
603         {
604            if (data & 0x001)
605            {
606               pen_offs |= 4;
607            }
608
609            data &=~0x01;
610         }
611
612         if (m_LPT.RM & NICK_RM_ALTIND1)
613         {
614            if (char_idx & 0x080)
615            {
616               pen_offs |= 0x02;
617            }
618         }
619
620#if 0
621         if (m_LPT.RM & NICK_RM_ALTIND0)
622         {
623            if (data & 0x040)
624            {
625               pen_offs |= 0x04;
626            }
627         }
628#endif
629
630
631         write_pixels2color_lpixel(pen_offs, (pen_offs | 0x01), data);
632      }
633      break;
634
635      case NICK_4_COLOUR_MODE:
636      {
637         //mame_printf_info("4 colour\r\n");
638
639         /* left margin attributes */
640         if (m_LPT.LM & NICK_LM_MSBALT)
641         {
642            data &= ~0x080;
643         }
644
645         if (m_LPT.LM & NICK_LM_LSBALT)
646         {
647            data &= ~0x01;
648         }
649
650
651         for (int i = 0; i < 4; i++)
652         {
653            pen_idx = m_pen_idx_4col[data];
654            pal_idx = m_LPT.COL[pen_idx & 0x03];
655
656            write_pixel(pal_idx);
657            write_pixel(pal_idx);
658            write_pixel(pal_idx);
659            write_pixel(pal_idx);
660
661            data <<= 1;
662         }
663      }
664      break;
665
666      case NICK_16_COLOUR_MODE:
667      {
668         //mame_printf_info("16 colour\r\n");
669
670         /* left margin attributes */
671         if (m_LPT.LM & NICK_LM_MSBALT)
672         {
673            data &= ~0x080;
674         }
675
676         if (m_LPT.LM & NICK_LM_LSBALT)
677         {
678            data &= ~0x01;
679         }
680
681
682         for (int i = 0; i < 2; i++)
683         {
684            pen_idx = m_pen_idx_16col[data];
685            pal_idx = get_color_index(pen_idx);
686
687            write_pixel(pal_idx);
688            write_pixel(pal_idx);
689            write_pixel(pal_idx);
690            write_pixel(pal_idx);
691            write_pixel(pal_idx);
692            write_pixel(pal_idx);
693            write_pixel(pal_idx);
694            write_pixel(pal_idx);
695
696            data <<= 1;
697         }
698      }
699      break;
700
701      case NICK_256_COLOUR_MODE:
702      {
703         /* left margin attributes */
704         if (m_LPT.LM & NICK_LM_MSBALT)
705         {
706            data &= ~0x080;
707         }
708
709         if (m_LPT.LM & NICK_LM_LSBALT)
710         {
711            data &= ~0x01;
712         }
713
714
715         pal_idx = data;
716
717         write_pixel(pal_idx);
718         write_pixel(pal_idx);
719         write_pixel(pal_idx);
720         write_pixel(pal_idx);
721         write_pixel(pal_idx);
722         write_pixel(pal_idx);
723         write_pixel(pal_idx);
724         write_pixel(pal_idx);
725
726         write_pixel(pal_idx);
727         write_pixel(pal_idx);
728         write_pixel(pal_idx);
729         write_pixel(pal_idx);
730         write_pixel(pal_idx);
731         write_pixel(pal_idx);
732         write_pixel(pal_idx);
733         write_pixel(pal_idx);
734
735
736      }
737      break;
738   }
739}
740
741
742void nick_device::do_pixel(int clocks_visible)
743{
744   UINT8 buf1, buf2;
745
746   for (int i = 0; i < clocks_visible; i++)
747   {
748      buf1 = m_addrspace[0]->read_byte(m_LD1);
749      m_LD1++;
750
751      buf2 = m_addrspace[0]->read_byte(m_LD1);
752      m_LD1++;
753
754      write_pixels(buf1, buf1);
755      write_pixels(buf2, buf1);
756   }
757}
758
759
760void nick_device::do_lpixel(int clocks_visible)
761{
762   UINT8 buf1;
763
764   for (int i = 0; i < clocks_visible; i++)
765   {
766      buf1 = m_addrspace[0]->read_byte(m_LD1);
767      m_LD1++;
768
769      write_pixels_lpixel(buf1, buf1);
770   }
771}
772
773void nick_device::do_attr(int clocks_visible)
774{
775   UINT8 buf1, buf2;
776
777   for (int i = 0; i < clocks_visible; i++)
778   {
779      buf1 = m_addrspace[0]->read_byte(m_LD1);
780      m_LD1++;
781
782      buf2 = m_addrspace[0]->read_byte(m_LD2);
783      m_LD2++;
784
785      {
786         UINT8 bg_color = ((buf1 >> 4) & 0x0f);
787         UINT8 fg_color = (buf1 & 0x0f);
788
789         write_pixels2color_lpixel(bg_color, fg_color, buf2);
790      }
791   }
792}
793
794void nick_device::do_ch256(int clocks_visible)
795{
796   UINT8 buf1, buf2;
797
798   for (int i = 0; i < clocks_visible; i++)
799   {
800      buf1 = m_addrspace[0]->read_byte(m_LD1);
801      m_LD1++;
802      buf2 = m_addrspace[0]->read_byte(ADDR_CH256(m_LD2, buf1));
803
804      write_pixels_lpixel(buf2, buf1);
805   }
806}
807
808void nick_device::do_ch128(int clocks_visible)
809{
810   UINT8 buf1, buf2;
811
812   for (int i = 0; i < clocks_visible; i++)
813   {
814      buf1 = m_addrspace[0]->read_byte(m_LD1);
815      m_LD1++;
816      buf2 = m_addrspace[0]->read_byte(ADDR_CH128(m_LD2, buf1));
817
818      write_pixels_lpixel(buf2, buf1);
819   }
820}
821
822void nick_device::do_ch64(int clocks_visible)
823{
824   UINT8 buf1, buf2;
825
826   for (int i = 0; i < clocks_visible; i++)
827   {
828      buf1 = m_addrspace[0]->read_byte(m_LD1);
829      m_LD1++;
830      buf2 = m_addrspace[0]->read_byte(ADDR_CH64(m_LD2, buf1));
831
832      write_pixels_lpixel(buf2, buf1);
833   }
834}
835
836
837void nick_device::do_display()
838{
839   LPT_ENTRY *pLPT = &m_LPT;
840   UINT8 clocks_visible;
841   UINT8 right_margin = NICK_GET_RIGHT_MARGIN(pLPT->RM);
842   UINT8 left_margin = NICK_GET_LEFT_MARGIN(pLPT->LM);
843
844   clocks_visible = right_margin - left_margin;
845
846   if (clocks_visible)
847   {
848      /* get display mode */
849      UINT8 display_mode = NICK_GET_DISPLAY_MODE(pLPT->MB);
850
851      if (m_scanline_count == 0)   // ||
852         //((pLPT->MB & NICK_MB_VRES)==0))
853      {
854         /* doing first line */
855         /* reload LD1, and LD2 (if necessary) regardless of display mode */
856         m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8);
857
858         if ((display_mode != NICK_LPIXEL_MODE) && (display_mode != NICK_PIXEL_MODE))
859         {
860            /* lpixel and pixel modes don't use LD2 */
861            m_LD2 = (pLPT->LD2L & 0xff) | ((pLPT->LD2H & 0xff) << 8);
862         }
863      }
864      else
865      {
866         /* not first line */
867         switch (display_mode)
868         {
869            case NICK_ATTR_MODE:
870            {
871               /* reload LD1 */
872               m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8);
873            }
874            break;
875
876            case NICK_CH256_MODE:
877            case NICK_CH128_MODE:
878            case NICK_CH64_MODE:
879            {
880               /* reload LD1 */
881               m_LD1 = (pLPT->LD1L & 0xff) | ((pLPT->LD1H & 0xff) << 8);
882               m_LD2++;
883            }
884            break;
885
886            default:
887               break;
888         }
889      }
890
891      switch (display_mode)
892      {
893         case NICK_PIXEL_MODE:
894         {
895            do_pixel(clocks_visible);
896         }
897         break;
898
899         case NICK_ATTR_MODE:
900         {
901            //mame_printf_info("attr mode\r\n");
902            do_attr(clocks_visible);
903         }
904         break;
905
906         case NICK_CH256_MODE:
907         {
908            //mame_printf_info("ch256 mode\r\n");
909            do_ch256(clocks_visible);
910         }
911         break;
912
913         case NICK_CH128_MODE:
914         {
915            do_ch128(clocks_visible);
916         }
917         break;
918
919         case NICK_CH64_MODE:
920         {
921            //mame_printf_info("ch64 mode\r\n");
922            do_ch64(clocks_visible);
923         }
924         break;
925
926         case NICK_LPIXEL_MODE:
927         {
928            do_lpixel(clocks_visible);
929         }
930         break;
931
932         default:
933            break;
934      }
935   }
936}
937
938void nick_device::update_lpt()
939{
940   UINT16 CurLPT = (m_LPL & 0x0ff) | ((m_LPH & 0x0f) << 8);
941   CurLPT++;
942   m_LPL = CurLPT & 0x0ff;
943   m_LPH = (m_LPH & 0x0f0) | ((CurLPT >> 8) & 0x0f);
944}
945
946
947void nick_device::reload_lpt()
948{
949   /* get addr of LPT */
950   UINT32 LPT_Addr = ((m_LPL & 0x0ff) << 4) | ((m_LPH & 0x0f) << (8+4));
951
952   /* update internal LPT state */
953   m_LPT.SC = m_addrspace[0]->read_byte(LPT_Addr);
954   m_LPT.MB = m_addrspace[0]->read_byte(LPT_Addr + 1);
955   m_LPT.LM = m_addrspace[0]->read_byte(LPT_Addr + 2);
956   m_LPT.RM = m_addrspace[0]->read_byte(LPT_Addr + 3);
957   m_LPT.LD1L = m_addrspace[0]->read_byte(LPT_Addr + 4);
958   m_LPT.LD1H = m_addrspace[0]->read_byte(LPT_Addr + 5);
959   m_LPT.LD2L = m_addrspace[0]->read_byte(LPT_Addr + 6);
960   m_LPT.LD2H = m_addrspace[0]->read_byte(LPT_Addr + 7);
961   m_LPT.COL[0] = m_addrspace[0]->read_byte(LPT_Addr + 8);
962   m_LPT.COL[1] = m_addrspace[0]->read_byte(LPT_Addr + 9);
963   m_LPT.COL[2] = m_addrspace[0]->read_byte(LPT_Addr + 10);
964   m_LPT.COL[3] = m_addrspace[0]->read_byte(LPT_Addr + 11);
965   m_LPT.COL[4] = m_addrspace[0]->read_byte(LPT_Addr + 12);
966   m_LPT.COL[5] = m_addrspace[0]->read_byte(LPT_Addr + 13);
967   m_LPT.COL[6] = m_addrspace[0]->read_byte(LPT_Addr + 14);
968   m_LPT.COL[7] = m_addrspace[0]->read_byte(LPT_Addr + 15);
969}
970
971/* call here to render a line of graphics */
972void nick_device::do_line()
973{
974   UINT8 scanline;
975
976   m_write_virq((m_LPT.MB & NICK_MB_VIRQ) ? ASSERT_LINE : CLEAR_LINE);
977
978   if (m_virq && !(m_LPT.MB & NICK_MB_VIRQ))
979   {
980      screen_device *screen = machine().first_screen();
981      m_timer_scanline->adjust(screen->time_until_pos(0, 0), 0, screen->scan_period());
982   }
983
984   m_virq = (m_LPT.MB & NICK_MB_VIRQ) ? 1 : 0;
985
986   if ((m_LPT.MB & NICK_MB_LPT_RELOAD)!=0)
987   {
988      /* reload LPT */
989
990      m_LPL = m_reg[2];
991      m_LPH = m_reg[3];
992
993      reload_lpt();
994   }
995
996   /* left border */
997   do_left_margin();
998
999   /* do visible part */
1000   do_display();
1001
1002   /* right border */
1003   do_right_margin();
1004
1005   // 0x0f7 is first!
1006   /* scan line count for this LPT */
1007   scanline = ((~m_LPT.SC) + 1) & 0x0ff;
1008
1009   //printf("scanline %02x\r\n", scanline);
1010
1011   /* update count of scanlines done so far */
1012   m_scanline_count++;
1013
1014   if (m_scanline_count == scanline)
1015   {
1016      /* done all scanlines of this Line Parameter Table, get next */
1017
1018      m_scanline_count = 0;
1019
1020      update_lpt();
1021      reload_lpt();
1022   }
1023}
Property changes on: trunk/src/mess/video/nick.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/video/nick.h
r0r23494
1/**********************************************************************
2
3    Intelligent Designs NICK emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __NICK__
13#define __NICK__
14
15#include "emu.h"
16
17
18
19///*************************************************************************
20//  INTERFACE CONFIGURATION MACROS
21///*************************************************************************
22
23#define MCFG_NICK_ADD(_tag, _screen_tag, _clock, _virq) \
24   MCFG_SCREEN_ADD(_screen_tag, RASTER) \
25   MCFG_SCREEN_REFRESH_RATE(50) \
26   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) \
27   MCFG_SCREEN_SIZE(ENTERPRISE_SCREEN_WIDTH, ENTERPRISE_SCREEN_HEIGHT) \
28   MCFG_SCREEN_VISIBLE_AREA(0, ENTERPRISE_SCREEN_WIDTH-1, 0, ENTERPRISE_SCREEN_HEIGHT-1) \
29   MCFG_SCREEN_UPDATE_DEVICE(_tag, nick_device, screen_update) \
30   MCFG_DEVICE_ADD(_tag, NICK, _clock) \
31   downcast<nick_device *>(device)->set_virq_callback(DEVCB2_##_virq); \
32   MCFG_PALETTE_LENGTH(256)
33
34
35/* there are 64us per line, although in reality
36 about 50 are visible. */
37#define ENTERPRISE_SCREEN_WIDTH (50*16)
38
39/* there are 312 lines per screen, although in reality
40 about 35*8 are visible */
41#define ENTERPRISE_SCREEN_HEIGHT    (35*8)
42
43
44///*************************************************************************
45//  TYPE DEFINITIONS
46///*************************************************************************
47
48/* Nick executes a Display list, in the form of a list of Line Parameter
49 Tables, this is the form of the data */
50struct LPT_ENTRY
51{
52   UINT8 SC;       /* scanlines in this modeline (two's complement) */
53   UINT8 MB;       /* the MODEBYTE (defines video display mode) */
54   UINT8 LM;       /* left margin etc */
55   UINT8 RM;       /* right margin etc */
56   UINT8 LD1L;     /* (a7..a0) of line data pointer LD1 */
57   UINT8 LD1H;     /* (a8..a15) of line data pointer LD1 */
58   UINT8 LD2L;     /* (a7..a0) of line data pointer LD2 */
59   UINT8 LD2H;     /* (a8..a15) of line data pointer LD2 */
60   UINT8 COL[8];   /* COL0..COL7 */
61};
62
63
64// ======================> nick_device
65
66class nick_device :  public device_t,
67                public device_memory_interface
68{
69public:
70   // construction/destruction
71   nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
72
73   template<class _virq> void set_virq_callback(_virq virq) { m_write_virq.set_callback(virq); }
74
75   virtual DECLARE_ADDRESS_MAP(vram_map, 8);
76   virtual DECLARE_ADDRESS_MAP(vio_map, 8);
77
78   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79
80protected:
81   // device-level overrides
82   virtual void device_start();
83   virtual void device_reset();
84   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
85
86   // device_memory_interface overrides
87   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
88
89   DECLARE_READ8_MEMBER( vram_r );
90   DECLARE_WRITE8_MEMBER( vram_w );
91
92   DECLARE_WRITE8_MEMBER( fixbias_w );
93   DECLARE_WRITE8_MEMBER( border_w );
94   DECLARE_WRITE8_MEMBER( lpl_w );
95   DECLARE_WRITE8_MEMBER( lph_w );
96
97   address_space_config m_space_config;
98
99private:
100   devcb2_write_line m_write_virq;
101
102   void write_pixel(int ci);
103   void calc_visible_clocks(int width);
104   void init();
105   void write_border(int clocks);
106   void do_left_margin();
107   void do_right_margin();
108
109   int get_color_index(int pen_index);
110   void write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte);
111   void write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte);
112   void write_pixels(UINT8 data_byte, UINT8 char_idx);
113   void write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx);
114
115   void do_pixel(int clocks_visible);
116   void do_lpixel(int clocks_visible);
117   void do_attr(int clocks_visible);
118   void do_ch256(int clocks_visible);
119   void do_ch128(int clocks_visible);
120   void do_ch64(int clocks_visible);
121   void do_display();
122   void update_lpt();
123   void reload_lpt();
124   void do_line();
125
126   /* horizontal position */
127   UINT8 horizontal_clock;
128   /* current scanline within LPT */
129   UINT8 m_scanline_count;
130   
131   UINT8 m_FIXBIAS;
132   UINT8 m_BORDER;
133   UINT8 m_LPL;
134   UINT8 m_LPH;
135   
136   UINT16 m_LD1;
137   UINT16 m_LD2;
138   
139   LPT_ENTRY   m_LPT;
140   
141   UINT16 *m_dest;
142   int m_dest_pos;
143   int m_dest_max_pos;
144   
145   UINT8 m_reg[16];
146   
147   /* first clock visible on left hand side */
148   int m_first_visible_clock;
149   /* first clock visible on right hand side */
150   int m_last_visible_clock;
151   
152   /* given a bit pattern, this will get the pen index */
153   UINT8 m_pen_idx_4col[256];
154   /* given a bit pattern, this will get the pen index */
155   UINT8 m_pen_idx_16col[256];
156
157   int m_virq;
158
159   bitmap_ind16 m_bitmap;
160
161   emu_timer *m_timer_scanline;
162};
163
164
165// device type definition
166extern const device_type NICK;
167
168
169
170#endif
Property changes on: trunk/src/mess/video/nick.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/includes/ep64.h
r0r23494
1/**********************************************************************
2
3    Enterprise Sixty Four / One Two Eight emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __EP64__
13#define __EP64__
14
15#include "emu.h"
16#include "audio/dave.h"
17#include "cpu/z80/z80.h"
18#include "imagedev/cartslot.h"
19#include "imagedev/cassette.h"
20#include "machine/ctronics.h"
21#include "machine/ep64exp.h"
22#include "machine/ram.h"
23#include "machine/serial.h"
24#include "video/nick.h"
25
26#define Z80_TAG         "u1"
27#define DAVE_TAG      "u3"
28#define NICK_TAG      "u4"
29#define CENTRONICS_TAG   "centronics"
30#define RS232_TAG      "rs232"
31#define CASSETTE1_TAG   "cassette1"
32#define CASSETTE2_TAG   "cassette2"
33#define SCREEN_TAG      "screen"
34
35class ep64_state : public driver_device
36{
37public:
38   ep64_state(const machine_config &mconfig, device_type type, const char *tag)
39      : driver_device(mconfig, type, tag),
40        m_maincpu(*this, Z80_TAG),
41        m_dave(*this, DAVE_TAG),
42        m_nick(*this, NICK_TAG),
43        m_centronics(*this, CENTRONICS_TAG),
44        m_rs232(*this, RS232_TAG),
45        m_cassette1(*this, CASSETTE1_TAG),
46        m_cassette2(*this, CASSETTE2_TAG),
47        m_ram(*this, RAM_TAG),
48        m_rom(*this, Z80_TAG),
49        m_y0(*this, "Y0"),
50        m_y1(*this, "Y1"),
51        m_y2(*this, "Y2"),
52        m_y3(*this, "Y3"),
53        m_y4(*this, "Y4"),
54        m_y5(*this, "Y5"),
55        m_y6(*this, "Y6"),
56        m_y7(*this, "Y7"),
57        m_y8(*this, "Y8"),
58        m_y9(*this, "Y9")
59   { }
60
61   required_device<cpu_device> m_maincpu;
62   required_device<dave_device> m_dave;
63   required_device<nick_device> m_nick;
64   required_device<centronics_device> m_centronics;
65   required_device<rs232_port_device> m_rs232;
66   required_device<cassette_image_device> m_cassette1;
67   required_device<cassette_image_device> m_cassette2;
68   required_device<ram_device> m_ram;
69   required_memory_region m_rom;
70   required_ioport m_y0;
71   required_ioport m_y1;
72   required_ioport m_y2;
73   required_ioport m_y3;
74   required_ioport m_y4;
75   required_ioport m_y5;
76   required_ioport m_y6;
77   required_ioport m_y7;
78   required_ioport m_y8;
79   required_ioport m_y9;
80
81   virtual void machine_start();
82   virtual void machine_reset();
83   
84   DECLARE_READ8_MEMBER( rd0_r );
85   DECLARE_WRITE8_MEMBER( wr0_w );
86   DECLARE_READ8_MEMBER( rd1_r );
87   DECLARE_WRITE8_MEMBER( wr1_w );
88   DECLARE_READ8_MEMBER( rd2_r );
89   DECLARE_WRITE8_MEMBER( wr2_w );
90
91   UINT8 m_key;
92};
93
94#endif
Property changes on: trunk/src/mess/includes/ep64.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/mess.mak
r23493r23494
14621462   $(MESS_DRIVERS)/rex6000.o   \
14631463
14641464$(MESSOBJ)/intelgnt.a:          \
1465   $(MESS_DRIVERS)/ep64.o      \
14651466   $(MESS_AUDIO)/dave.o        \
1466   $(MESS_VIDEO)/epnick.o      \
1467   $(MESS_DRIVERS)/enterp.o    \
1467   $(MESS_VIDEO)/nick.o        \
1468   $(MESS_MACHINE)/ep64exp.o   \
1469   $(MESS_MACHINE)/ep64_exdos.o\
14681470
14691471$(MESSOBJ)/interton.a:          \
14701472   $(MESS_AUDIO)/vc4000.o      \
trunk/src/mess/drivers/enterp.c
r23493r23494
1/*
2
3Enterprise Sixty Four / Enterprise One Two Eight
4Enterprise Computers Ltd. 1985
5
6MAIN PCB Layout
7--------------- 
8                                        DUAL
9|-----------| 9V                        TAPE_IN/OUT                             RES
10|HEATSINK   | DC_IN             MON1    AND REMOTE     SR1    PR1   CN2A CN1A   |-|                     
11|           |--||---|--||--|--| |--| |-||-||-||-||-| |----| |-----| |--| |--| |-|-|------|
12|-----------|7805   | MOD  |  |-|  |-|             |-|    |-|     |-|  |-|  |-|   EXP2 --|EXTERNAL           
13        |---+7805   |      |                         74LS06 74LS273 74LS86 74LS32      --|EXPANSION
14        |   |       |------|             74LS244                                       --|CONNECTOR
15        |   |78L12 POT1  LM386                               |-----|   |-----|   EXP1  --|
16   CART |   |          LM1889 LM1886                   74LS04|NICK |   |DAVE |         --|
17   CONN |   |   KEYB_8     POT2     KEYB_10                  |     |   |     |         --|
18        |   |            4.433619MHz     74LS145 POT3 LED    |-----|   |-----|         --|
19        |---+                                                                          --|
20            |                            74LS74      74LS244  74LS244  74LS245 |---------|
21            |                                                                  |           
22            | 74LS373                    4164  4164  74F157                    |
23            |                                                                  |
24            | 16-2-103   LM339    LM324  4164  4164  74F157           EXOS.IC2 |
25            |                                                 8MHz             |
26            | 74LS373                    4164  4164                            |
27            |                                                74LS04    Z80A    |
28            | 74LS273                    4164  4164                            |
29            |------------------------------------------------------------------|
30Notes: (all IC's shown)
31           Z80A - Z80A CPU, clock input 4MHz [8/2]
32       EXOS.IC2 - 32k x8-bit mask ROM usually 23256 manufactured by GI (DIP24). Contains EXOS operating
33                  system and built-in word processor software. A few official revisions were made and
34                  there were a few unofficial revision made with additional capabilities and bug-fixes
35                  ROM labelling of some official versions found....
36                  9256DS-0019 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 08-45-A GI
37                  9256DS-0036 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 05-23-A GI
38           4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16)
39           NICK - Custom graphics chip (QFP72)
40           DAVE - Custom sound chip (QFP72)
41          LM386 - National Semiconductor LM386 Low Voltage Audio Power Amplifier (DIP8)
42         LM1889 - National Semiconductor LM1889 TV Video Modulator (DIP18)
43         LM1886 - National Semiconductor LM1886 TV Video Matrix DAC (DIP20)
44          LM339 - SGS LM339 Low Power Low Offset Voltage Quad Comparator (DIP8)
45          LM324 - SGS LM324 Quad Operational Amplifier (DIP8)
46         74LS04 - Hex Inverter (DIP14)
47         74LS06 - Hex Inverter/Buffer with Open-Collector Outputs (DIP14)
48         74LS32 - Quad 2-Input Positive OR Gate (DIP14)
49         74LS74 - Dual Positive-Edge-Triggered D Flip-Flops with Preset, Clear and Complementary Outputs (DIP14)
50         74LS86 - Quad 2-Input Exclusive OR Gate (DIP14)
51        74LS145 - BCD to Deccimal Decoder/Driver (DIP16)
52         74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev mainboards use 74LS158 instead
53        74LS244 - Octal 3-State Noninverting Buffer/Line Driver/Line Receiver (DIP20)
54        74LS245 - Octal Bus Tranceiver with Tri-State Outputs (DIP20)
55        74LS273 - Octal D-Type Flip-Flop With Clear (DIP20)
56        74LS373 - Octal D-Type Transparent Latches and Edge-Triggered Flip-Flops (DIP20)
57           7805 - Voltage regulator. +9V DC input from DC power pack, +5V DC output
58          78L12 - Voltage regulator. Voltage input via small transformer on PCB. +12V DC output
59           POT1 - Potentiometer located near modulator and video output circuitry
60           POT2 - Potentiometer located near video output circuitry. Probably used to fine-tune the video clock
61           POT3 - Potentiometer. Possibly for video/NICK-related adjustments
62            LED - LED to show +5V is present
63       16-2-103 - Resistor Array (DIP16)
64         KEYB_8 - 8 pin keyboard connector
65        KEYB_10 - 10 pin keyboard connector
66           EXP1 - 28 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card
67           EXP2 - 10 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card
68            MOD - Astec UM1233 TV modulator
69            RES - Reset push button switch
70           MON1 - Monitor output connector. Pinout is....
71           
72                            Green  A1 B1 NC
73                            Ground A2 B2 Ground
74                  Mono Comp. Video A3 B3 Blue
75                             HSync A4 B4 Red
76                             VSync A5 B5 Composite Sync
77                                NC A6 B6 Mode Switch
78                        Left Audio A7 B7 Right Audio
79           
80            SR1 - Serial/Network connector. Pinout is....
81           
82                         Reference A1 B1 Ground
83                                 - A2 B2 -
84                               RTS A3 B3 Data Out
85                               CTS A4 B4 Data In
86
87            PR1 - Printer connector. Pinout is....
88                 
89                            Ground A1 B1 Ground
90                            Strobe A2 B2 Ready
91                            Data 3 A3 B3 Data 4
92                                 - A4 B4 -
93                            Data 2 A5 B5 Data 5
94                            Data 1 A6 B6 Data 6
95                            Data 0 A7 B7 Data 7
96
97           CN2A - Joystick 2 connector
98           CN1A - Joystick 1 connector
99                  Pinout is....
100                 
101                          Keyboard J A1 B1 Ground
102                          Keyboard L A2 B2 Keyboard K
103                                   - A3 B3 -
104                               Right A4 B4 +5V
105                                Down A5 B5 Left
106                                Fire A6 B6 Up
107
108
109Floppy Drive Controller PCB Layout
110----------------------------------
111
112INTELLIGENT SOFTWARE LTD DISK CONTROLLER
113ISS1
114 |--------------------------------------------|
115 |                                            |
116 |                                            |
117|-|  7438  74LS273             WD1770         |
118|I|                                           |
119|D|                                           |
120|C|                                  EPROM.IC2|
121|3|           74LS32  74LS02  74LS266         |
122|4|  7438                                     |
123|-|      74LS126  74LS10  74LS245  74LS266    |
124 |                                            |
125 |                                            |
126 |----------------------------|||||||||||||||||
127                              |---------------|
128Notes: (All IC's shown)
129
130This PCB plugs into the external expansion connector on the right side of the mainboard
131
132      EPROM.IC2 - 16k x8-bit EPROM labelled 'EXDOS V1.0 P/N 08-60' (DIP28)
133         WD1770 - Western Digital WD1770 Floppy Drive Controller (DIP28)
134         74LS02 - Quad 2-Input NOR Gate (DIP14)
135         74LS10 - Triple 3-input NAND Gate (DIP14)
136         74LS32 - Quad 2-Input Positive OR Gate (DIP14)
137           7438 - Quad 2-input NAND Buffer (DIP14)
138        74LS126 - Quad Bus Buffer (DIP14)
139        74LS245 - Octal Bus Tranceiver with Tri-State Outputs (DIP20)
140        74LS266 - Quad EXCLUSIVE-NOR Gate (DIP14)
141        74LS273 - Octal D-Type Flip-Flop With Clear (DIP20)
142          IDC34 - IDC 34-way flat cable connector for floppy drive data cable
143
144
145Internal Memory Expansion PCB Layout
146------------------------------------     
147
148|---------------------|
149|  4164 74LS00 PL3 PL2|
150|4164 74LS30 74F157   |
151|4164 4164            |
152|4164 4164   74F157   |
153|4164 4164 74LS32  PL1|
154|---------------------|
155Notes: (All IC's shown)
156          PL1 - 28-pin connector (solder pads only) hard-wired to solder pads EXP1 on mainboard
157      PL2/PL3 - 5-pin connectors (solder pads only) hard-wired to solder pads EXP2 on mainboard
158         4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16)
159       74LS00 - Quad 2-Input NAND Gate (DIP14)
160       74LS30 - 8-input NAND Gate (DIP14)
161       74LS32 - Quad 2-Input Positive OR Gate (DIP14)
162       74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev memory boards use 74LS158 instead
163
164*/
165
166/******************************************************************************
167 * Enterprise 128k driver
168 *
169 * Kevin Thacker 1999.
170 *
171 * James Boulton [EP help]
172 * Jean-Pierre Malisse [EP help]
173 *
174 * EP Hardware: Z80 (CPU), Dave (Sound Chip + I/O)
175 * Nick (Graphics), WD1772 (FDC). 128k ram.
176 *
177 * For an 8-bit machine, this kicks ass! A sound
178 * Chip which is as powerful, or more powerful than
179 * the C64 SID, and a graphics chip capable of some
180 * really nice graphics. Pity it doesn't have HW sprites!
181 ******************************************************************************/
182
183#include "emu.h"
184#include "cpu/z80/z80.h"
185#include "machine/wd17xx.h"
186#include "imagedev/flopdrv.h"
187#include "formats/basicdsk.h"
188#include "includes/enterp.h"
189
190#define ENTERPRISE_XTAL_X1  XTAL_8MHz
191
192
193/***************************************************************************
194    MEMORY / I/O
195***************************************************************************/
196
197void ep_state::enterprise_update_memory_page(address_space &space, offs_t page, int index)
198{
199   int start = (page - 1) * 0x4000;
200   int end = (page - 1) * 0x4000 + 0x3fff;
201   char page_num[10];
202   sprintf(page_num,"bank%d",page);
203
204   switch (index)
205   {
206   case 0x00:
207   case 0x01:
208   case 0x02:
209   case 0x03:
210      space.install_read_bank(start, end, page_num);
211      space.nop_write(start, end);
212      membank(page_num)->set_base(memregion("exos")->base() + (index * 0x4000));
213      break;
214
215   case 0x04:
216   case 0x05:
217   case 0x06:
218   case 0x07:
219      space.install_read_bank(start, end, page_num);
220      space.nop_write(start, end);
221      membank(page_num)->set_base(memregion("cartridges")->base() + ((index - 0x04) * 0x4000));
222      break;
223
224   case 0x20:
225   case 0x21:
226      space.install_read_bank(start, end, page_num);
227      space.nop_write(start, end);
228      membank(page_num)->set_base(memregion("exdos")->base() + ((index - 0x20) * 0x4000));
229      break;
230
231   case 0xf8:
232   case 0xf9:
233   case 0xfa:
234   case 0xfb:
235      /* additional 64k ram */
236      if (m_ram->size() == 128*1024)
237      {
238         space.install_readwrite_bank(start, end, page_num);
239         membank(page_num)->set_base(m_ram->pointer() + (index - 0xf4) * 0x4000);
240      }
241      else
242      {
243         space.unmap_readwrite(start, end);
244      }
245      break;
246
247   case 0xfc:
248   case 0xfd:
249   case 0xfe:
250   case 0xff:
251      /* basic 64k ram */
252      space.install_readwrite_bank(start, end, page_num);
253      membank(page_num)->set_base(m_ram->pointer() + (index - 0xfc) * 0x4000);
254      break;
255
256   default:
257      space.unmap_readwrite(start, end);
258   }
259}
260
261
262/* EP specific handling of dave register write */
263WRITE8_MEMBER(ep_state::enterprise_dave_reg_write)
264{
265   switch (offset)
266   {
267   case 0x10:
268   case 0x11:
269   case 0x12:
270   case 0x13:
271      enterprise_update_memory_page(m_maincpu->space(AS_PROGRAM), offset - 0x0f, data);
272      break;
273
274   case 0x15:
275      keyboard_line = data & 15;
276      break;
277   }
278}
279
280
281READ8_MEMBER(ep_state::enterprise_dave_reg_read)
282{
283   switch (offset)
284   {
285      case 0x015:
286         /* read keyboard line */
287         m_dave->set_reg(0x015, m_key[keyboard_line]->read());
288         break;
289
290      case 0x016:
291      {
292         int ExternalJoystickInputs;
293         int ExternalJoystickPortInput = m_joy->read();
294
295         if (keyboard_line <= 4)
296         {
297            ExternalJoystickInputs = ExternalJoystickPortInput>>(4-(keyboard_line));
298         }
299         else
300         {
301            ExternalJoystickInputs = 1;
302         }
303
304         m_dave->set_reg(0x016, (0x0fe | (ExternalJoystickInputs & 0x01)));
305      }
306      break;
307
308      default:
309         break;
310   }
311   return 0;
312}
313
314/* enterprise interface to dave - ok, so Dave chip is unique
315to Enterprise. But these functions make it nice and easy to see
316whats going on. */
317static const dave_interface enterprise_dave_interface =
318{
319   DEVCB_DRIVER_MEMBER(ep_state,enterprise_dave_reg_read),
320   DEVCB_DRIVER_MEMBER(ep_state,enterprise_dave_reg_write),
321   DEVCB_CPU_INPUT_LINE("maincpu", 0)
322};
323
324
325void ep_state::machine_start()
326{
327   m_maincpu->set_input_line_vector(0, 0xff);
328   m_nick->set_vram(m_ram->pointer());
329   
330   for (int i = 0; i < 10; i++)
331   {
332      char str[6];
333      sprintf(str, "LINE%i", i);
334      m_key[i] = ioport(str);
335   }
336}
337
338void ep_state::machine_reset()
339{
340   m_maincpu->set_input_line_vector(0, 0xff);
341}
342
343
344UINT32 ep_state::screen_update_enterp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
345{
346   m_nick->screen_update_epnick(screen, bitmap, cliprect);
347   return 0;
348}
349
350// FIXME: Should this be here or in the Nick device?!?
351
352/* Enterprise has 256 colours, all may be on the screen at once!
353 the NICK_GET_RED8, NICK_GET_GREEN8, NICK_GET_BLUE8 macros
354 return a 8-bit colour value for the index specified.  */
355
356/* given a colour index in range 0..255 gives the Red component */
357#define NICK_GET_RED8(x) \
358   ((      \
359      (BIT(x, 0) << 2) | \
360      (BIT(x, 3) << 1) | \
361      (BIT(x, 6) << 0) \
362   ) << 5)
363
364/* given a colour index in range 0..255 gives the Red component */
365#define NICK_GET_GREEN8(x) \
366   ((  \
367      (BIT(x, 1) << 2) | \
368      (BIT(x, 4) << 1) | \
369      (BIT(x, 7) << 0) \
370   ) << 5)
371
372/* given a colour index in range 0..255 gives the Red component */
373#define NICK_GET_BLUE8(x) \
374   (( \
375      (BIT(x, 2) << 1) | \
376      (BIT(x, 5) << 0) \
377   ) << 6)
378
379
380/* initial the palette */
381void ep_state::palette_init()
382{
383   for (int i = 0; i < 256; i++)
384      palette_set_color_rgb(machine(), i, NICK_GET_RED8(i), NICK_GET_GREEN8(i), NICK_GET_BLUE8(i));
385}
386
387
388/***************************************************************************
389    FLOPPY/EXDOS
390***************************************************************************/
391
392WRITE_LINE_MEMBER(ep_state::enterp_wd1770_intrq_w)
393{
394   if (state)
395      exdos_card_value |= 0x02;
396   else
397      exdos_card_value &= ~0x02;
398}
399
400WRITE_LINE_MEMBER(ep_state::enterp_wd1770_drq_w)
401{
402   if (state)
403      exdos_card_value |= 0x80;
404   else
405      exdos_card_value &= ~0x80;
406}
407
408
409/* bit 0 - ??
410   bit 1 - IRQ from WD1770
411   bit 2 - ??
412   bit 3 - ??
413   bit 4 - ??
414   bit 5 - ??
415   bit 6 - Disk change signal from disk drive
416   bit 7 - DRQ from WD1770
417*/
418READ8_MEMBER(ep_state::exdos_card_r)
419{
420   return exdos_card_value;
421}
422
423
424/* bit 0 - select drive 0,
425   bit 1 - select drive 1,
426   bit 2 - select drive 2,
427   bit 3 - select drive 3
428   bit 4 - side
429   bit 5 - mfm/fm select
430   bit 6 - disk change reset
431   bit 7 - in use
432*/
433WRITE8_MEMBER(ep_state::exdos_card_w)
434{
435   device_t *fdc = machine().device("wd1770");
436
437   /* drive */
438   if (BIT(data, 0)) wd17xx_set_drive(fdc, 0);
439   if (BIT(data, 1)) wd17xx_set_drive(fdc, 1);
440   if (BIT(data, 2)) wd17xx_set_drive(fdc, 2);
441   if (BIT(data, 3)) wd17xx_set_drive(fdc, 3);
442
443   wd17xx_set_side(fdc, BIT(data, 4));
444   wd17xx_dden_w(fdc, BIT(data, 5));
445}
446
447/***************************************************************************
448    ADDRESS MAPS
449***************************************************************************/
450
451static ADDRESS_MAP_START( enterprise_mem, AS_PROGRAM, 8, ep_state )
452   AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1")
453   AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2")
454   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank3")
455   AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank4")
456ADDRESS_MAP_END
457
458
459static ADDRESS_MAP_START( enterprise_io, AS_IO, 8, ep_state )
460   ADDRESS_MAP_GLOBAL_MASK(0xff)
461   AM_RANGE(0x10, 0x13) AM_MIRROR(0x04) AM_DEVREADWRITE_LEGACY("wd1770", wd17xx_r, wd17xx_w)
462   AM_RANGE(0x18, 0x18) AM_MIRROR(0x04) AM_READWRITE(exdos_card_r, exdos_card_w)
463   AM_RANGE(0x80, 0x8f) AM_DEVWRITE("nick", nick_device, reg_w)
464   AM_RANGE(0xa0, 0xbf) AM_DEVREADWRITE("custom", dave_sound_device, reg_r, reg_w)
465ADDRESS_MAP_END
466
467
468/***************************************************************************
469    INPUT PORTS
470***************************************************************************/
471
472/*
473Enterprise Keyboard Matrix
474
475        Bit
476Line    0    1    2    3    4    5    6    7
4770       n    \    b    c    v    x    z    SHFT
4781       h    N/C  g    d    f    s    a    CTRL
4792       u    q    y    r    t    e    w    TAB
4803       7    1    6    4    5    3    2    N/C
4814       F4   F8   F3   F6   F5   F7   F2   F1
4825       8    N/C  9    -    0    ^    DEL  N/C
4836       j    N/C  k    ;    l    :    ]    N/C
4847       STOP DOWN RGHT UP   HOLD LEFT RETN ALT
4858       m    ERSE ,    /    .    SHFT SPCE INS
4869       i    N/C  o    @    p    [    N/C  N/C
487
488N/C - Not connected or just dont know!
489
4902008-05 FP:
491Notice that I updated the matrix above with the following new info:
492l1:b1 is LOCK: you press it with CTRL to switch to Caps, you press it again to switch back
493    (you can also use it with ALT)
494l3:b7 is ESC: you use it to exit from nested programs (e.g. if you start to write a program in BASIC,
495    then start EXDOS, you can use ESC to go back to BASIC without losing the program you were writing)
496
497According to pictures and manuals, there seem to be no more keys connected, so I label the remaining N/C
498as IPT_UNUSED.
499
500Small note about natural keyboard support: currently
501- "Lock" is mapped to 'F9' (it acts like a CAPSLOCK, but no IPT_TOGGLE)
502- "Stop" is mapped to 'F10'
503- "Hold" is mapped to 'F11'
504*/
505
506
507static INPUT_PORTS_START( ep64 )
508   PORT_START("LINE0")     /* keyboard line 0 */
509   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)            PORT_CHAR('n') PORT_CHAR('N')
510   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)        PORT_CHAR('\\') PORT_CHAR('|')
511   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)            PORT_CHAR('b') PORT_CHAR('B')
512   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)            PORT_CHAR('c') PORT_CHAR('C')
513   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)            PORT_CHAR('v') PORT_CHAR('V')
514   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X)            PORT_CHAR('x') PORT_CHAR('X')
515   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z)            PORT_CHAR('z') PORT_CHAR('Z')
516   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)       PORT_CHAR(UCHAR_SHIFT_1)
517
518   PORT_START("LINE1")     /* keyboard line 1 */
519   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)            PORT_CHAR('h') PORT_CHAR('H')
520   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
521   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)            PORT_CHAR('g') PORT_CHAR('G')
522   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)            PORT_CHAR('d') PORT_CHAR('D')
523   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)            PORT_CHAR('f') PORT_CHAR('F')
524   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)            PORT_CHAR('s') PORT_CHAR('S')
525   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A)            PORT_CHAR('a') PORT_CHAR('A')
526   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)     PORT_CHAR(UCHAR_SHIFT_2)
527
528   PORT_START("LINE2")     /* keyboard line 2 */
529   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)            PORT_CHAR('u') PORT_CHAR('U')
530   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q)            PORT_CHAR('q') PORT_CHAR('Q')
531   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)            PORT_CHAR('y') PORT_CHAR('Y')
532   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)            PORT_CHAR('r') PORT_CHAR('R')
533   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)            PORT_CHAR('t') PORT_CHAR('T')
534   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)            PORT_CHAR('e') PORT_CHAR('E')
535   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W)            PORT_CHAR('w') PORT_CHAR('W')
536   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB)          PORT_CHAR('\t')
537
538   PORT_START("LINE3")     /* keyboard line 3 */
539   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)            PORT_CHAR('7') PORT_CHAR('\'')
540   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1)            PORT_CHAR('1') PORT_CHAR('!')
541   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)            PORT_CHAR('6') PORT_CHAR('&')
542   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)            PORT_CHAR('4') PORT_CHAR('$')
543   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)            PORT_CHAR('5') PORT_CHAR('%')
544   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 \xC2\xA3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3')
545   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2)            PORT_CHAR('2') PORT_CHAR('"')
546   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC)          PORT_CHAR(UCHAR_MAMEKEY(ESC))
547
548   PORT_START("LINE4")     /* keyboard line 4 */
549   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4)           PORT_CHAR(UCHAR_MAMEKEY(F4))
550   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8)           PORT_CHAR(UCHAR_MAMEKEY(F8))
551   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3)           PORT_CHAR(UCHAR_MAMEKEY(F3))
552   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6)           PORT_CHAR(UCHAR_MAMEKEY(F6))
553   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5)           PORT_CHAR(UCHAR_MAMEKEY(F5))
554   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7)           PORT_CHAR(UCHAR_MAMEKEY(F7))
555   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2)           PORT_CHAR(UCHAR_MAMEKEY(F2))
556   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1)           PORT_CHAR(UCHAR_MAMEKEY(F1))
557
558   PORT_START("LINE5")     /* keyboard line 5 */
559   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)            PORT_CHAR('8') PORT_CHAR('(')
560   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
561   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)            PORT_CHAR('9') PORT_CHAR(')')
562   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)        PORT_CHAR('-') PORT_CHAR('=')
563   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)            PORT_CHAR('0') PORT_CHAR('_')
564   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)       PORT_CHAR('^') PORT_CHAR('~')
565   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
566   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
567
568   PORT_START("LINE6")     /* keyboard line 6 */
569   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)            PORT_CHAR('j') PORT_CHAR('J')
570   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
571   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)            PORT_CHAR('k') PORT_CHAR('K')
572   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)        PORT_CHAR(';') PORT_CHAR('+')
573   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)            PORT_CHAR('l') PORT_CHAR('L')
574   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE)        PORT_CHAR(':') PORT_CHAR('*')
575   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)    PORT_CHAR(']') PORT_CHAR('}')
576   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
577
578   /* Notice that, in fact, ep128 only had the built-in joystick and no cursor arrow keys on the keyboard */
579   PORT_START("LINE7")     /* keyboard line 7 */
580   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP")           PORT_CODE(KEYCODE_END)              PORT_CHAR(UCHAR_MAMEKEY(F10))
581   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN)     PORT_CODE(JOYCODE_Y_DOWN_SWITCH)    PORT_CHAR(UCHAR_MAMEKEY(DOWN))
582   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT)    PORT_CODE(JOYCODE_X_RIGHT_SWITCH)   PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
583   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP)       PORT_CODE(JOYCODE_Y_UP_SWITCH)      PORT_CHAR(UCHAR_MAMEKEY(UP))
584   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HOLD")           PORT_CODE(KEYCODE_HOME)             PORT_CHAR(UCHAR_MAMEKEY(F11))
585   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT)     PORT_CODE(JOYCODE_X_LEFT_SWITCH)    PORT_CHAR(UCHAR_MAMEKEY(LEFT))
586   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER)                                        PORT_CHAR(13)
587   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT")            PORT_CODE(KEYCODE_LALT)             PORT_CHAR(UCHAR_MAMEKEY(LALT))
588
589   PORT_START("LINE8")     /* keyboard line 8 */
590   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)            PORT_CHAR('m') PORT_CHAR('M')
591   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL)          PORT_CHAR(UCHAR_MAMEKEY(DEL))
592   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)        PORT_CHAR(',') PORT_CHAR('<')
593   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)        PORT_CHAR('/') PORT_CHAR('?')
594   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)         PORT_CHAR('.') PORT_CHAR('>')
595   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT (right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
596   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)        PORT_CHAR(' ')
597   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT)       PORT_CHAR(UCHAR_MAMEKEY(INSERT))
598
599   PORT_START("LINE9")     /* keyboard line 9 */
600   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)            PORT_CHAR('i') PORT_CHAR('I')
601   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
602   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)            PORT_CHAR('o') PORT_CHAR('O')
603   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)    PORT_CHAR('@') PORT_CHAR('`')
604   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)            PORT_CHAR('p') PORT_CHAR('P')
605   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)   PORT_CHAR('[') PORT_CHAR('{')
606   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
607   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
608
609   PORT_START("JOY1")      /* external joystick 1 */
610   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXTERNAL JOYSTICK 1 RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_X_RIGHT_SWITCH)
611   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXTERNAL JOYSTICK 1 LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_X_LEFT_SWITCH)
612   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXTERNAL JOYSTICK 1 DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CODE(JOYCODE_Y_DOWN_SWITCH)
613   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXTERNAL JOYSTICK 1 UP") PORT_CODE(KEYCODE_UP) PORT_CODE(JOYCODE_Y_UP_SWITCH)
614   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXTERNAL JOYSTICK 1 FIRE") PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON1)
615INPUT_PORTS_END
616
617
618/***************************************************************************
619    MACHINE DRIVERS
620***************************************************************************/
621
622static const wd17xx_interface enterp_wd1770_interface =
623{
624   DEVCB_NULL,
625   DEVCB_DRIVER_LINE_MEMBER(ep_state,enterp_wd1770_intrq_w),
626   DEVCB_DRIVER_LINE_MEMBER(ep_state,enterp_wd1770_drq_w),
627   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
628};
629
630static LEGACY_FLOPPY_OPTIONS_START(enterprise)
631   LEGACY_FLOPPY_OPTION(enterprise, "dsk,img", "Enterprise disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
632      HEADS([2])
633      TRACKS([80])
634      SECTORS([9])
635      SECTOR_LENGTH([512])
636      FIRST_SECTOR_ID([1]))
637LEGACY_FLOPPY_OPTIONS_END
638
639static const floppy_interface enterprise_floppy_interface =
640{
641   DEVCB_NULL,
642   DEVCB_NULL,
643   DEVCB_NULL,
644   DEVCB_NULL,
645   DEVCB_NULL,
646   FLOPPY_STANDARD_3_5_DSDD,
647   LEGACY_FLOPPY_OPTIONS_NAME(enterprise),
648   "floppy_3_5",
649   NULL
650};
651
652static MACHINE_CONFIG_START( ep64, ep_state )
653   /* basic machine hardware */
654   MCFG_CPU_ADD("maincpu", Z80, ENTERPRISE_XTAL_X1/2) /* 4 MHz, generated by DAVE */
655   MCFG_CPU_PROGRAM_MAP(enterprise_mem)
656   MCFG_CPU_IO_MAP(enterprise_io)
657
658   /* video hardware */
659   MCFG_SCREEN_ADD("screen", RASTER)
660   MCFG_SCREEN_REFRESH_RATE(50)
661   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
662   MCFG_SCREEN_SIZE(ENTERPRISE_SCREEN_WIDTH, ENTERPRISE_SCREEN_HEIGHT)
663   MCFG_SCREEN_VISIBLE_AREA(0, ENTERPRISE_SCREEN_WIDTH-1, 0, ENTERPRISE_SCREEN_HEIGHT-1)
664   MCFG_SCREEN_UPDATE_DRIVER(ep_state, screen_update_enterp)
665
666   MCFG_PALETTE_LENGTH(NICK_PALETTE_SIZE)
667
668   MCFG_NICK_ADD("nick")
669
670   /* sound hardware */
671   MCFG_SPEAKER_STANDARD_MONO("mono")
672   MCFG_SOUND_ADD("custom", DAVE, 0)
673   MCFG_DEVICE_CONFIG( enterprise_dave_interface )
674   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
675
676   MCFG_WD1770_ADD("wd1770", enterp_wd1770_interface )
677
678   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(enterprise_floppy_interface)
679
680   /* internal ram */
681   MCFG_RAM_ADD(RAM_TAG)
682   MCFG_RAM_DEFAULT_SIZE("64K")
683
684   // software list
685   MCFG_SOFTWARE_LIST_ADD("cass_list", "ep64_cass")
686   MCFG_SOFTWARE_LIST_ADD("flop_list", "ep64_flop")
687MACHINE_CONFIG_END
688
689static MACHINE_CONFIG_DERIVED( ep128, ep64 )
690   /* internal ram */
691   MCFG_RAM_MODIFY(RAM_TAG)
692   MCFG_RAM_DEFAULT_SIZE("128K")
693MACHINE_CONFIG_END
694
695
696/***************************************************************************
697    ROM DEFINITIONS
698***************************************************************************/
699
700ROM_START( ep64 )
701   ROM_REGION(0x8000, "exos", 0)
702   ROM_LOAD("9256ds-0038_enter05-23-a.u2", 0x0000, 0x8000, CRC(d421795f) SHA1(6033a0535136c40c47137e4d1cd9273c06d5fdff))
703
704   /* 4 cartridge slots */
705   ROM_REGION(0x10000, "cartridges", 0)
706   ROM_LOAD("basic20.rom", 0x0000, 0x4000, CRC(d62e4fb7) SHA1(36e12c4ea782ca769225178f61b55bc9a9afb927))
707   ROM_FILL(0x4000, 0xc000, 0xff)
708
709   ROM_REGION(0x8000, "exdos", 0)
710   ROM_LOAD("exdos13.rom", 0x0000, 0x8000, CRC(d1d7e157) SHA1(31c8be089526aa8aa019c380cdf51ddd3ee76454))
711ROM_END
712
713ROM_START( ep128 )
714   ROM_REGION(0x10000, "exos", 0)
715   ROM_SYSTEM_BIOS(0, "exos21", "EXOS 2.1")
716   ROMX_LOAD("9256ds-0019_enter08-45-a.u2", 0x0000, 0x8000, CRC(982a3b44) SHA1(55315b20fecb4441a07ee4bc5dc7153f396e0a2e), ROM_BIOS(1))
717   ROM_FILL(0x8000, 0x8000, 0xff)
718   ROM_SYSTEM_BIOS(1, "exos22", "EXOS 2.2 (unofficial)")
719   ROMX_LOAD("exos22.rom", 0x0000, 0x10000, CRC(c82e699f) SHA1(40cda9573e0c20e6287d27105759e23b9025fa52), ROM_BIOS(2))
720   ROM_SYSTEM_BIOS(2, "exos23", "EXOS 2.3 (unofficial)")
721   ROMX_LOAD("exos23.rom", 0x0000, 0x10000, CRC(24838410) SHA1(c6241e1c248193108ce38b9a8e9dd33972cf47ba), ROM_BIOS(3))
722   ROM_SYSTEM_BIOS(3, "exos231", "EXOS 2.31 (unofficial)")
723   ROMX_LOAD("exos231.rom", 0x0000, 0x10000, CRC(d0ecee0d) SHA1(bd0ff3c46f57c88b82b71b0d94a8bda18ea9bafe), ROM_BIOS(4))
724
725   /* 4 cartridge slots */
726   ROM_REGION(0x10000, "cartridges", 0)
727   ROM_LOAD("9128ds-0237_enter08-46-a.u1", 0x0000, 0x4000, CRC(683cf455) SHA1(50a548d1df3ea86f9b5fa669afd8ff124050e776)) /* BASIC V2.1 */
728   ROM_FILL(0x4000, 0xc000, 0xff)
729
730   ROM_REGION(0x8000, "exdos", 0)
731   ROM_LOAD("exdos13.rom", 0x0000, 0x8000, CRC(d1d7e157) SHA1(31c8be089526aa8aa019c380cdf51ddd3ee76454))
732ROM_END
733
734ROM_START( phc64 )
735   ROM_REGION(0x8000, "exos", 0)
736   ROM_LOAD("9256ds-0038_enter05-23-a.u2", 0x0000, 0x8000, CRC(d421795f) SHA1(6033a0535136c40c47137e4d1cd9273c06d5fdff))
737
738   /* 4 cartridge slots */
739   ROM_REGION(0x10000, "cartridges", 0)
740   ROM_LOAD("basic20.rom", 0x0000, 0x4000, CRC(d62e4fb7) SHA1(36e12c4ea782ca769225178f61b55bc9a9afb927))
741   ROM_LOAD("brd.rom", 0x4000, 0x4000, CRC(f45a7454) SHA1(096c91fad6a4d10323cd67e133b3ebc5c50e2bb2))
742   ROM_FILL(0x8000, 0x8000, 0xff)
743
744   ROM_REGION(0x8000, "exdos", 0)
745   ROM_LOAD("exdos13.rom", 0x0000, 0x8000, CRC(d1d7e157) SHA1(31c8be089526aa8aa019c380cdf51ddd3ee76454))
746ROM_END
747
748/***************************************************************************
749    GAME DRIVERS
750***************************************************************************/
751
752/*    YEAR  NAME   PARENT  COMPAT  MACHINE  INPUT  INIT  COMPANY                 FULLNAME */
753COMP( 1985, ep64,  0,      0,      ep64,    ep64, driver_device, 0,     "Enterprise Computers", "Enterprise Sixty Four", GAME_IMPERFECT_SOUND )
754COMP( 1985, ep128, ep64,   0,      ep128,   ep64, driver_device, 0,     "Enterprise Computers", "Enterprise One Two Eight", GAME_IMPERFECT_SOUND )
755COMP( 1985, phc64, ep64,   0,      ep64,    ep64, driver_device, 0,     "Hegener & Glaser",     "Mephisto PHC 64", GAME_IMPERFECT_SOUND )
No newline at end of file
trunk/src/mess/drivers/ep64.c
r0r23494
1/**********************************************************************
2
3    Enterprise Sixty Four / One Two Eight emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12Enterprise Sixty Four / Enterprise One Two Eight
13Enterprise Computers Ltd. 1985
14
15MAIN PCB Layout
16--------------- 
17                                        DUAL
18|-----------| 9V                        TAPE_IN/OUT                             RES
19|HEATSINK   | DC_IN             MON1    AND REMOTE     SR1    PR1   CN2A CN1A   |-|                     
20|           |--||---|--||--|--| |--| |-||-||-||-||-| |----| |-----| |--| |--| |-|-|------|
21|-----------|7805   | MOD  |  |-|  |-|             |-|    |-|     |-|  |-|  |-|   EXP2 --|EXTERNAL           
22        |---+7805   |      |                         74LS06 74LS273 74LS86 74LS32      --|EXPANSION
23        |   |       |------|             74LS244                                       --|CONNECTOR
24        |   |78L12 POT1  LM386                               |-----|   |-----|   EXP1  --|
25   CART |   |          LM1889 LM1886                   74LS04|NICK |   |DAVE |         --|
26   CONN |   |   KEYB_8     POT2     KEYB_10                  |     |   |     |         --|
27        |   |            4.433619MHz     74LS145 POT3 LED    |-----|   |-----|         --|
28        |---+                                                                          --|
29            |                            74LS74      74LS244  74LS244  74LS245 |---------|
30            |                                                                  |           
31            | 74LS373                    4164  4164  74F157                    |
32            |                                                                  |
33            | 16-2-103   LM339    LM324  4164  4164  74F157           EXOS.IC2 |
34            |                                                 8MHz             |
35            | 74LS373                    4164  4164                            |
36            |                                                74LS04    Z80A    |
37            | 74LS273                    4164  4164                            |
38            |------------------------------------------------------------------|
39Notes: (all IC's shown)
40           Z80A - Z80A CPU, clock input 4MHz [8/2]
41       EXOS.IC2 - 32k x8-bit mask ROM usually 23256 manufactured by GI (DIP24). Contains EXOS operating
42                  system and built-in word processor software. A few official revisions were made and
43                  there were a few unofficial revision made with additional capabilities and bug-fixes
44                  ROM labelling of some official versions found....
45                  9256DS-0019 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 08-45-A GI
46                  9256DS-0036 (C)1984 INTELLIGENT SOFTWARE LTD ENTER 05-23-A GI
47           4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16)
48           NICK - Custom graphics chip (QFP72)
49           DAVE - Custom sound chip (QFP72)
50          LM386 - National Semiconductor LM386 Low Voltage Audio Power Amplifier (DIP8)
51         LM1889 - National Semiconductor LM1889 TV Video Modulator (DIP18)
52         LM1886 - National Semiconductor LM1886 TV Video Matrix DAC (DIP20)
53          LM339 - SGS LM339 Low Power Low Offset Voltage Quad Comparator (DIP8)
54          LM324 - SGS LM324 Quad Operational Amplifier (DIP8)
55         74LS04 - Hex Inverter (DIP14)
56         74LS06 - Hex Inverter/Buffer with Open-Collector Outputs (DIP14)
57         74LS32 - Quad 2-Input Positive OR Gate (DIP14)
58         74LS74 - Dual Positive-Edge-Triggered D Flip-Flops with Preset, Clear and Complementary Outputs (DIP14)
59         74LS86 - Quad 2-Input Exclusive OR Gate (DIP14)
60        74LS145 - BCD to Deccimal Decoder/Driver (DIP16)
61         74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev mainboards use 74LS158 instead
62        74LS244 - Octal 3-State Noninverting Buffer/Line Driver/Line Receiver (DIP20)
63        74LS245 - Octal Bus Tranceiver with Tri-State Outputs (DIP20)
64        74LS273 - Octal D-Type Flip-Flop With Clear (DIP20)
65        74LS373 - Octal D-Type Transparent Latches and Edge-Triggered Flip-Flops (DIP20)
66           7805 - Voltage regulator. +9V DC input from DC power pack, +5V DC output
67          78L12 - Voltage regulator. Voltage input via small transformer on PCB. +12V DC output
68           POT1 - Potentiometer located near modulator and video output circuitry
69           POT2 - Potentiometer located near video output circuitry. Probably used to fine-tune the video clock
70           POT3 - Potentiometer. Possibly for video/NICK-related adjustments
71            LED - LED to show +5V is present
72       16-2-103 - Resistor Array (DIP16)
73         KEYB_8 - 8 pin keyboard connector
74        KEYB_10 - 10 pin keyboard connector
75           EXP1 - 28 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card
76           EXP2 - 10 pin internal expansion connector (solder holes only) used for internal 64k memory expansion card
77            MOD - Astec UM1233 TV modulator
78            RES - Reset push button switch
79           MON1 - Monitor output connector. Pinout is....
80           
81                            Green  A1 B1 NC
82                            Ground A2 B2 Ground
83                  Mono Comp. Video A3 B3 Blue
84                             HSync A4 B4 Red
85                             VSync A5 B5 Composite Sync
86                                NC A6 B6 Mode Switch
87                        Left Audio A7 B7 Right Audio
88           
89            SR1 - Serial/Network connector. Pinout is....
90           
91                         Reference A1 B1 Ground
92                                 - A2 B2 -
93                               RTS A3 B3 Data Out
94                               CTS A4 B4 Data In
95
96            PR1 - Printer connector. Pinout is....
97                 
98                            Ground A1 B1 Ground
99                            Strobe A2 B2 Ready
100                            Data 3 A3 B3 Data 4
101                                 - A4 B4 -
102                            Data 2 A5 B5 Data 5
103                            Data 1 A6 B6 Data 6
104                            Data 0 A7 B7 Data 7
105
106           CN2A - Joystick 2 connector
107           CN1A - Joystick 1 connector
108                  Pinout is....
109                 
110                          Keyboard J A1 B1 Ground
111                          Keyboard L A2 B2 Keyboard K
112                                   - A3 B3 -
113                               Right A4 B4 +5V
114                                Down A5 B5 Left
115                                Fire A6 B6 Up
116
117
118Internal Memory Expansion PCB Layout
119------------------------------------     
120
121|---------------------|
122|  4164 74LS00 PL3 PL2|
123|4164 74LS30 74F157   |
124|4164 4164            |
125|4164 4164   74F157   |
126|4164 4164 74LS32  PL1|
127|---------------------|
128Notes: (All IC's shown)
129          PL1 - 28-pin connector (solder pads only) hard-wired to solder pads EXP1 on mainboard
130      PL2/PL3 - 5-pin connectors (solder pads only) hard-wired to solder pads EXP2 on mainboard
131         4164 - 64k x1-bit Dynamic RAM with Page Mode (DIP16)
132       74LS00 - Quad 2-Input NAND Gate (DIP14)
133       74LS30 - 8-input NAND Gate (DIP14)
134       74LS32 - Quad 2-Input Positive OR Gate (DIP14)
135       74F157 - Quad 2-Line to 1-Line Data Selector/Multiplexer (DIP16). Early rev memory boards use 74LS158 instead
136
137*/
138
139/*
140
141   TODO:
142
143   - POST RAM errors
144   - rewrite DAVE to output to discrete DAC
145   - rewrite NICK
146   - cassette
147   - external joysticks
148
149   http://ep.homeserver.hu/Dokumentacio/Konyvek/
150
151*/
152
153#include "includes/ep64.h"
154
155
156
157//**************************************************************************
158//  READ/WRITE HANDLERS
159//**************************************************************************
160
161//-------------------------------------------------
162//  rd0_r -
163//-------------------------------------------------
164
165READ8_MEMBER( ep64_state::rd0_r )
166{
167   UINT8 data = 0xff;
168
169   switch (m_key)
170   {
171   case 0: data &= m_y0->read(); break;
172   case 1: data &= m_y1->read(); break;
173   case 2: data &= m_y2->read(); break;
174   case 3: data &= m_y3->read(); break;
175   case 4: data &= m_y4->read(); break;
176   case 5: data &= m_y5->read(); break;
177   case 6: data &= m_y6->read(); break;
178   case 7: data &= m_y7->read(); break;
179   case 8: data &= m_y8->read(); break;
180   case 9: data &= m_y9->read(); break;
181   }
182
183   return data;
184}
185
186
187//-------------------------------------------------
188//  rd0_r -
189//-------------------------------------------------
190
191WRITE8_MEMBER( ep64_state::wr0_w )
192{
193   /*
194   
195       bit     description
196   
197       0       KEY A
198       1       KEY B
199       2       KEY C
200       3       KEY D
201       4       PRINTER _STB
202       5       CASSETTE OUT
203       6       REMOTE 1
204       7       REMOTE 2
205   
206   */
207
208   // keyboard
209   m_key = data & 0x0f;
210
211   // printer
212   m_centronics->strobe_w(!BIT(data, 4));
213
214   // cassette
215   m_cassette1->output(BIT(data, 5) ? -1.0 : +1.0);
216   m_cassette2->output(BIT(data, 5) ? -1.0 : +1.0);
217
218   // cassette
219   m_cassette1->change_state(BIT(data, 6) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
220   m_cassette2->change_state(BIT(data, 7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
221}
222
223
224//-------------------------------------------------
225//  rd1_r -
226//-------------------------------------------------
227
228READ8_MEMBER( ep64_state::rd1_r )
229{
230   /*
231   
232       bit     description
233   
234       0       KBJ
235       1       KBK
236       2       KBL
237       3       PRINTER _RDY
238       4       SERIAL/NET DATA IN
239       5       SERIAL/NET STATUS IN
240       6       CASSETTE IN
241       7       ?
242   
243   */
244
245   UINT8 data = 0;
246
247   // printer
248   data |= m_centronics->not_busy_r() << 3;
249
250   // serial
251   data |= m_rs232->rx() << 4;
252   data |= m_rs232->cts_r() << 5;
253
254   // cassette
255   data |= ((m_cassette1->input() < 0) || (m_cassette2->input() < 0)) << 6;
256
257   return data;
258}
259
260
261//-------------------------------------------------
262//  wr2_w -
263//-------------------------------------------------
264
265WRITE8_MEMBER( ep64_state::wr2_w )
266{
267   /*
268   
269       bit     description
270   
271       0       SERIAL/NET DATA OUT
272       1       SERIAL/NET STATUS OUT
273       2       
274       3       
275       4       
276       5       
277       6       
278       7       
279   
280   */
281
282   // serial
283   m_rs232->tx(!BIT(data, 0));
284   m_rs232->rts_w(!BIT(data, 1));
285}
286
287
288
289//**************************************************************************
290//  ADDRESS MAPS
291//**************************************************************************
292
293//-------------------------------------------------
294//  ADDRESS_MAP( ep64_mem )
295//-------------------------------------------------
296
297static ADDRESS_MAP_START( ep64_mem, AS_PROGRAM, 8, ep64_state )
298   AM_RANGE(0x0000, 0xffff) AM_DEVICE(DAVE_TAG, dave_device, z80_program_map)
299ADDRESS_MAP_END
300
301
302//-------------------------------------------------
303//  ADDRESS_MAP( ep64_io )
304//-------------------------------------------------
305
306static ADDRESS_MAP_START( ep64_io, AS_IO, 8, ep64_state )
307   AM_RANGE(0x0000, 0xffff) AM_DEVICE(DAVE_TAG, dave_device, z80_io_map)
308ADDRESS_MAP_END
309
310
311//-------------------------------------------------
312//  ADDRESS_MAP( dave_64k_mem )
313//-------------------------------------------------
314
315static ADDRESS_MAP_START( dave_64k_mem, DAVE_AS_PROGRAM, 8, ep64_state )
316   AM_RANGE(0x000000, 0x007fff) AM_ROM AM_REGION(Z80_TAG, 0)
317   AM_RANGE(0x010000, 0x01ffff) AM_ROM AM_REGION("cart", 0)
318   AM_RANGE(0x3f0000, 0x3fffff) AM_DEVICE(NICK_TAG, nick_device, vram_map)
319ADDRESS_MAP_END
320
321
322//-------------------------------------------------
323//  ADDRESS_MAP( dave_128k_mem )
324//-------------------------------------------------
325
326static ADDRESS_MAP_START( dave_128k_mem, DAVE_AS_PROGRAM, 8, ep64_state )
327   AM_IMPORT_FROM(dave_64k_mem)
328   AM_RANGE(0x3e0000, 0x3effff) AM_RAM
329ADDRESS_MAP_END
330
331
332//-------------------------------------------------
333//  ADDRESS_MAP( dave_io )
334//-------------------------------------------------
335
336static ADDRESS_MAP_START( dave_io, DAVE_AS_IO, 8, ep64_state )
337   ADDRESS_MAP_GLOBAL_MASK(0xff)
338   AM_RANGE(0x80, 0x8f) AM_DEVICE(NICK_TAG, nick_device, vio_map)
339   AM_RANGE(0xb5, 0xb5) AM_READWRITE(rd0_r, wr0_w)
340   AM_RANGE(0xb6, 0xb6) AM_READ(rd1_r) AM_DEVWRITE(CENTRONICS_TAG, centronics_device, write)
341   AM_RANGE(0xb7, 0xb7) AM_WRITE(wr2_w)
342ADDRESS_MAP_END
343
344
345
346//**************************************************************************
347//  INPUT PORTS
348//**************************************************************************
349
350//-------------------------------------------------
351//  INPUT_PORTS( ep64 )
352//-------------------------------------------------
353
354static INPUT_PORTS_START( ep64 )
355   PORT_START("Y0")
356   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)            PORT_CHAR('n') PORT_CHAR('N')
357   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)        PORT_CHAR('\\') PORT_CHAR('|')
358   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)            PORT_CHAR('b') PORT_CHAR('B')
359   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)            PORT_CHAR('c') PORT_CHAR('C')
360   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)            PORT_CHAR('v') PORT_CHAR('V')
361   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X)            PORT_CHAR('x') PORT_CHAR('X')
362   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z)            PORT_CHAR('z') PORT_CHAR('Z')
363   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)       PORT_CHAR(UCHAR_SHIFT_1)
364
365   PORT_START("Y1")
366   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)            PORT_CHAR('h') PORT_CHAR('H')
367   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
368   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)            PORT_CHAR('g') PORT_CHAR('G')
369   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)            PORT_CHAR('d') PORT_CHAR('D')
370   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)            PORT_CHAR('f') PORT_CHAR('F')
371   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)            PORT_CHAR('s') PORT_CHAR('S')
372   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A)            PORT_CHAR('a') PORT_CHAR('A')
373   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)     PORT_CHAR(UCHAR_SHIFT_2)
374
375   PORT_START("Y2")
376   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)            PORT_CHAR('u') PORT_CHAR('U')
377   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q)            PORT_CHAR('q') PORT_CHAR('Q')
378   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)            PORT_CHAR('y') PORT_CHAR('Y')
379   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)            PORT_CHAR('r') PORT_CHAR('R')
380   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)            PORT_CHAR('t') PORT_CHAR('T')
381   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)            PORT_CHAR('e') PORT_CHAR('E')
382   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W)            PORT_CHAR('w') PORT_CHAR('W')
383   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB)          PORT_CHAR('\t')
384
385   PORT_START("Y3")
386   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)            PORT_CHAR('7') PORT_CHAR('\'')
387   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1)            PORT_CHAR('1') PORT_CHAR('!')
388   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)            PORT_CHAR('6') PORT_CHAR('&')
389   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)            PORT_CHAR('4') PORT_CHAR('$')
390   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)            PORT_CHAR('5') PORT_CHAR('%')
391   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 \xC2\xA3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('\xA3')
392   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2)            PORT_CHAR('2') PORT_CHAR('"')
393   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC)          PORT_CHAR(UCHAR_MAMEKEY(ESC))
394
395   PORT_START("Y4")
396   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4)           PORT_CHAR(UCHAR_MAMEKEY(F4))
397   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8)           PORT_CHAR(UCHAR_MAMEKEY(F8))
398   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3)           PORT_CHAR(UCHAR_MAMEKEY(F3))
399   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6)           PORT_CHAR(UCHAR_MAMEKEY(F6))
400   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5)           PORT_CHAR(UCHAR_MAMEKEY(F5))
401   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7)           PORT_CHAR(UCHAR_MAMEKEY(F7))
402   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2)           PORT_CHAR(UCHAR_MAMEKEY(F2))
403   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1)           PORT_CHAR(UCHAR_MAMEKEY(F1))
404
405   PORT_START("Y5")
406   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)            PORT_CHAR('8') PORT_CHAR('(')
407   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
408   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)            PORT_CHAR('9') PORT_CHAR(')')
409   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)        PORT_CHAR('-') PORT_CHAR('=')
410   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)            PORT_CHAR('0') PORT_CHAR('_')
411   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)       PORT_CHAR('^') PORT_CHAR('~')
412   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
413   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
414
415   PORT_START("Y6")
416   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)            PORT_CHAR('j') PORT_CHAR('J')
417   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
418   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)            PORT_CHAR('k') PORT_CHAR('K')
419   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)        PORT_CHAR(';') PORT_CHAR('+')
420   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)            PORT_CHAR('l') PORT_CHAR('L')
421   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE)        PORT_CHAR(':') PORT_CHAR('*')
422   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)    PORT_CHAR(']') PORT_CHAR('}')
423   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
424
425   /* Notice that, in fact, ep128 only had the built-in joystick and no cursor arrow keys on the keyboard */
426   PORT_START("Y7")
427   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP")           PORT_CODE(KEYCODE_END)              PORT_CHAR(UCHAR_MAMEKEY(F10))
428   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN)     PORT_CODE(JOYCODE_Y_DOWN_SWITCH)    PORT_CHAR(UCHAR_MAMEKEY(DOWN))
429   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT)    PORT_CODE(JOYCODE_X_RIGHT_SWITCH)   PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
430   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP)       PORT_CODE(JOYCODE_Y_UP_SWITCH)      PORT_CHAR(UCHAR_MAMEKEY(UP))
431   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HOLD")           PORT_CODE(KEYCODE_HOME)             PORT_CHAR(UCHAR_MAMEKEY(F11))
432   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT)     PORT_CODE(JOYCODE_X_LEFT_SWITCH)    PORT_CHAR(UCHAR_MAMEKEY(LEFT))
433   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER)                                        PORT_CHAR(13)
434   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ALT")            PORT_CODE(KEYCODE_LALT)             PORT_CHAR(UCHAR_MAMEKEY(LALT))
435
436   PORT_START("Y8")
437   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)            PORT_CHAR('m') PORT_CHAR('M')
438   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL)          PORT_CHAR(UCHAR_MAMEKEY(DEL))
439   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)        PORT_CHAR(',') PORT_CHAR('<')
440   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)        PORT_CHAR('/') PORT_CHAR('?')
441   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)         PORT_CHAR('.') PORT_CHAR('>')
442   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT (right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
443   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)        PORT_CHAR(' ')
444   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT)       PORT_CHAR(UCHAR_MAMEKEY(INSERT))
445
446   PORT_START("Y9")
447   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)            PORT_CHAR('i') PORT_CHAR('I')
448   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
449   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)            PORT_CHAR('o') PORT_CHAR('O')
450   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)    PORT_CHAR('@') PORT_CHAR('`')
451   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)            PORT_CHAR('p') PORT_CHAR('P')
452   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)   PORT_CHAR('[') PORT_CHAR('{')
453   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
454   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
455INPUT_PORTS_END
456
457
458
459//**************************************************************************
460//  DEVICE CONFIGURATION
461//**************************************************************************
462
463//-------------------------------------------------
464//  rs232_port_interface rs232_intf
465//-------------------------------------------------
466
467static const rs232_port_interface rs232_intf =
468{
469   DEVCB_NULL,
470   DEVCB_NULL,
471   DEVCB_NULL,
472   DEVCB_NULL,
473   DEVCB_DEVICE_LINE_MEMBER(DAVE_TAG, dave_device, int2_w)
474};
475
476
477//-------------------------------------------------
478//  cassette_interface cass_intf
479//-------------------------------------------------
480
481static const cassette_interface cass_intf =
482{
483   cassette_default_formats,
484   NULL,
485   (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED),
486   "ep64_cass",
487   NULL
488};
489
490
491
492//**************************************************************************
493//  MACHINE INITIALIZATION
494//**************************************************************************
495
496//-------------------------------------------------
497//  MACHINE_START( ep64 )
498//-------------------------------------------------
499
500void ep64_state::machine_start()
501{
502   // state saving
503   save_item(NAME(m_key));
504}
505
506
507//-------------------------------------------------
508//  MACHINE_RESET( ep64 )
509//-------------------------------------------------
510
511void ep64_state::machine_reset()
512{
513   m_dave->reset();
514   m_nick->reset();
515
516   address_space &program = m_maincpu->space(AS_PROGRAM);
517   wr0_w(program, 0, 0);
518   m_centronics->write(0);
519   wr2_w(program, 0, 0);
520}
521
522
523
524//**************************************************************************
525//  MACHINE CONFIGURATION
526//**************************************************************************
527
528//-------------------------------------------------
529//  MACHINE_CONFIG( ep64 )
530//-------------------------------------------------
531
532static MACHINE_CONFIG_START( ep64, ep64_state )
533   // basic machine hardware
534   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_8MHz/2)
535   MCFG_CPU_PROGRAM_MAP(ep64_mem)
536   MCFG_CPU_IO_MAP(ep64_io)
537
538   // video hardware
539   MCFG_NICK_ADD(NICK_TAG, SCREEN_TAG, XTAL_8MHz, DEVWRITELINE(DAVE_TAG, dave_device, int1_w))
540
541   // sound hardware
542   MCFG_DAVE_ADD(DAVE_TAG, XTAL_8MHz, INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0), dave_64k_mem, dave_io)
543
544   // devices
545   MCFG_EP64_EXPANSION_BUS_SLOT_ADD(EP64_EXPANSION_BUS_TAG, DAVE_TAG, NULL)
546   MCFG_EP64_EXPANSION_BUS_CALLBACKS(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0), INPUTLINE(Z80_TAG, INPUT_LINE_NMI), INPUTLINE(Z80_TAG, Z80_INPUT_LINE_WAIT))
547   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, standard_centronics)
548   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL)
549   MCFG_CASSETTE_ADD(CASSETTE1_TAG, cass_intf)
550   MCFG_CASSETTE_ADD(CASSETTE2_TAG, cass_intf)
551
552   // internal RAM
553   MCFG_RAM_ADD(RAM_TAG)
554   MCFG_RAM_DEFAULT_SIZE("64K")
555
556   // cartridge
557   MCFG_CARTSLOT_ADD("cart")
558   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
559   MCFG_CARTSLOT_NOT_MANDATORY
560   MCFG_CARTSLOT_INTERFACE("ep64_cart")
561
562   // software lists
563   MCFG_SOFTWARE_LIST_ADD("cart_list", "ep64_cart")
564   MCFG_SOFTWARE_LIST_ADD("cass_list", "ep64_cass")
565   MCFG_SOFTWARE_LIST_ADD("flop_list", "ep64_flop")
566MACHINE_CONFIG_END
567
568
569//-------------------------------------------------
570//  MACHINE_CONFIG( ep128 )
571//-------------------------------------------------
572
573static MACHINE_CONFIG_DERIVED( ep128, ep64 )
574   MCFG_DEVICE_MODIFY(DAVE_TAG)
575   MCFG_DEVICE_ADDRESS_MAP(AS_0, dave_128k_mem)
576
577   // internal RAM
578   MCFG_RAM_MODIFY(RAM_TAG)
579   MCFG_RAM_DEFAULT_SIZE("128K")
580MACHINE_CONFIG_END
581
582
583
584//**************************************************************************
585//  ROMS
586//**************************************************************************
587
588//-------------------------------------------------
589//  ROM( ep64 )
590//-------------------------------------------------
591
592ROM_START( ep64 )
593   ROM_REGION( 0x8000, Z80_TAG, 0 )
594   ROM_LOAD( "9256ds-0038_enter05-23-a.u2", 0x0000, 0x8000, CRC(d421795f) SHA1(6033a0535136c40c47137e4d1cd9273c06d5fdff) )
595
596   ROM_REGION( 0x10000, "cart", 0 )
597   ROM_CART_LOAD( "cart", 0x00000, 0x10000, ROM_MIRROR )
598ROM_END
599
600#define rom_phc64   rom_ep64
601
602
603//-------------------------------------------------
604//  ROM( ep128 )
605//-------------------------------------------------
606
607ROM_START( ep128 )
608   ROM_REGION( 0x8000, Z80_TAG, 0 )
609   ROM_LOAD( "9256ds-0019_enter08-45-a.u2", 0x0000, 0x8000, CRC(982a3b44) SHA1(55315b20fecb4441a07ee4bc5dc7153f396e0a2e) )
610
611   ROM_REGION( 0x10000, "cart", 0 )
612   ROM_CART_LOAD( "cart", 0x00000, 0x10000, ROM_MIRROR )
613ROM_END
614
615
616
617//**************************************************************************
618//  SYSTEM DRIVERS
619//**************************************************************************
620
621//    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS
622COMP( 1985, ep64,  0,      0,      ep64,    ep64, driver_device, 0,     "Enterprise Computers", "Enterprise Sixty Four",     GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
623COMP( 1985, phc64, ep64,   0,      ep64,    ep64, driver_device, 0,     "Hegener & Glaser",     "Mephisto PHC 64 (Germany)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
624COMP( 1986, ep128, ep64,   0,      ep128,   ep64, driver_device, 0,     "Enterprise Computers", "Enterprise One Two Eight",  GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
Property changes on: trunk/src/mess/drivers/ep64.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/hash/ep64_cart.xml
r0r23494
1<?xml version="1.0"?>
2<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
3<softwarelist name="ep64_cart" description="Enterprise Sixty Four cartridges">
4   
5   <software name="basic">
6      <description>BASIC (v2.1)</description>
7      <year>198?</year>
8      <publisher>Intelligent Software</publisher>
9
10      <part name="cart" interface="ep64_cart">
11         <dataarea name="rom" size="0x4000">
12            <rom name="9128ds-0237_enter08-46-a.u1" size="0x4000" crc="683cf455" sha1="50a548d1df3ea86f9b5fa669afd8ff124050e776" offset="0" />
13         </dataarea>
14      </part>
15   </software>
16
17   <software name="basic10" cloneof="basic">
18      <description>BASIC (v1.0)</description>
19      <year>198?</year>
20      <publisher>Enterprise Computers</publisher>
21
22      <part name="cart" interface="ep64_cart">
23         <dataarea name="rom" size="0x4000">
24            <rom name="basic 1.0 - eprom 1-2 (198x)(enterprise).bin" size="0x2000" crc="681961cd" sha1="052ac869da3764b44031328cd584985f705a6516" offset="0x0000" />
25            <rom name="basic 1.0 - eprom 2-2 (198x)(enterprise).bin" size="0x2000" crc="9cddb79e" sha1="7551f74cc332f20923c36b24ae0ad3274f74ec37" offset="0x2000" />
26         </dataarea>
27      </part>
28   </software>
29
30   <software name="basic11" cloneof="basic">
31      <description>BASIC (v1.1)</description>
32      <year>198?</year>
33      <publisher>Enterprise Computers</publisher>
34
35      <part name="cart" interface="ep64_cart">
36         <dataarea name="rom" size="0x4000">
37            <rom name="basic 1.1 - eprom 1.1 (198x)(enterprise).bin" size="0x4000" crc="683cf455" sha1="50a548d1df3ea86f9b5fa669afd8ff124050e776" offset="0" />
38         </dataarea>
39      </part>
40   </software>
41
42   <software name="basic21" cloneof="basic">
43      <description>BASIC (v2.1, Alt)</description>
44      <year>198?</year>
45      <publisher>Intelligent Software</publisher>
46
47      <part name="cart" interface="ep64_cart">
48         <dataarea name="rom" size="0x4000">
49            <rom name="basic interpreter v2.1 (1985)(intelligent software).bin" size="0x4000" crc="55f96251" sha1="03bbb386cf530e804363acdfc1d13e64cf28af2e" offset="0" />
50         </dataarea>
51      </part>
52   </software>
53
54   <software name="epdos">
55      <description>EPDOS (v1.7)</description>
56      <year>198?</year>
57      <publisher>Haluska, Laszlo</publisher>
58
59      <part name="cart" interface="ep64_cart">
60         <dataarea name="rom" size="0x8000">
61            <rom name="epdos v1.7 (19xx)(haluska, laszlo).bin" size="0x8000" crc="201319eb" sha1="08da5017cb95c9f5edf07a66903eef414621cd7d" offset="0" />
62         </dataarea>
63      </part>
64   </software>
65
66   <software name="exdos">
67      <description>EX-DOS EPROM</description>
68      <year>198?</year>
69      <publisher>Enterprise Computers</publisher>
70
71      <part name="cart" interface="ep64_cart">
72         <dataarea name="rom" size="0x4000">
73            <rom name="ex-dos eprom (198x)(enterprise).bin" size="0x4000" crc="e6daa0e9" sha1="05ba161aa8796c04f227eb2d52496943ada814f2" offset="0" />
74         </dataarea>
75      </part>
76   </software>
77
78   <software name="exdosbf">
79      <description>EXDos BASIC + FORTH</description>
80      <year>198?</year>
81      <publisher>Enterprise Computers</publisher>
82
83      <part name="cart" interface="ep64_cart">
84         <dataarea name="rom" size="0x8000">
85            <rom name="exdos basic+forth (198x)(enterprise).bin" size="0x8000" crc="0cc38deb" sha1="e381f0efd7d3235336c23c32e9d9dc3f96059b7f" offset="0" />
86         </dataarea>
87      </part>
88   </software>
89
90   <software name="forth">
91      <description>Forth</description>
92      <year>198?</year>
93      <publisher>Enterprise Computers</publisher>
94
95      <part name="cart" interface="ep64_cart">
96         <dataarea name="rom" size="0x4000">
97            <rom name="forth (198x)(enterprise).bin" size="0x4000" crc="5077dc39" sha1="9ca625742444f87fdf82e1586fc1799bd3302209" offset="0" />
98         </dataarea>
99      </part>
100   </software>
101
102   <software name="pascal">
103      <description>HiSoft Pascal Enterprise (v1.01)</description>
104      <year>1985</year>
105      <publisher>HiSoft</publisher>
106
107      <part name="cart" interface="ep64_cart">
108         <dataarea name="rom" size="0x8000">
109            <rom name="hisoft pascal enterprise v1.01 (1985)(hisoft).bin" size="0x8000" crc="d62f2a46" sha1="05c0a9859e484d6ec051da7415b2a9070cf26f11" offset="0" />
110         </dataarea>
111      </part>
112   </software>
113
114   <software name="hp">
115      <description>HP Enterprise (v1.01)</description>
116      <year>1985</year>
117      <publisher>HiSoft</publisher>
118
119      <part name="cart" interface="ep64_cart">
120         <dataarea name="rom" size="0x4000">
121            <rom name="hp enterprise v1.01 (1985)(hisoft).bin" size="0x4000" crc="944c0baa" sha1="ad344075398a4cfa928201d2a97d51e6cdc37dd3" offset="0" />
122         </dataarea>
123      </part>
124   </software>
125
126   <software name="turboasm">
127      <description>Turbo AsMon (v1.5)</description>
128      <year>198?</year>
129      <publisher>Sandor Gyangy</publisher>
130
131      <part name="cart" interface="ep64_cart">
132         <dataarea name="rom" size="0x8000">
133            <rom name="turbo asmon 1.5 (19xx)(sandor gyangy).bin" size="0x8000" crc="9bebc655" sha1="0d1ef90a36e1014f29b2eeffbc585307da01ee56" offset="0" />
134         </dataarea>
135      </part>
136   </software>
137
138   <software name="texisdos">
139      <description>Turbo EXDOS+ISDOS</description>
140      <year>198?</year>
141      <publisher>Zoltan Nemeth</publisher>
142
143      <part name="cart" interface="ep64_cart">
144         <dataarea name="rom" size="0x8000">
145            <rom name="turbo exdos+isdos (19xx)(zoltan nemeth).bin" size="0x8000" crc="bc02efa9" sha1="ebfac10f92173942bb4fed6da8336ae8d257a1bd" offset="0" />
146         </dataarea>
147      </part>
148   </software>
149
150   <software name="uelisp">
151      <description>UELISP (v0.6)</description>
152      <year>198?</year>
153      <publisher>Enterprise Computers</publisher>
154
155      <part name="cart" interface="ep64_cart">
156         <dataarea name="rom" size="0x4000">
157            <rom name="uelisp v0.6 (198x)(enterprise).bin" size="0x3fff" crc="bf516194" sha1="0ca8588123e3573eed84c2b5fd030959e396aa88" offset="0" status="baddump" />
158         </dataarea>
159      </part>
160   </software>
161
162   <software name="zozotool">
163      <description>ZozoTools (v1.8)</description>
164      <year>198?</year>
165      <publisher>Zoltan Nemeth</publisher>
166
167      <part name="cart" interface="ep64_cart">
168         <dataarea name="rom" size="0x8000">
169            <rom name="zozotools v1.8 (19xx)(zoltan nemeth).bin" size="0x8000" crc="5e8d0aa9" sha1="8b7db07b0ade24b9420cf5d4531e729b637fa5c9" offset="0" />
170         </dataarea>
171      </part>
172   </software>
173
174   <software name="brd">
175      <description>brd</description>
176      <year>198?</year>
177      <publisher>&lt;unknown&gt;</publisher>
178
179      <part name="cart" interface="ep64_cart">
180         <dataarea name="rom" size="0x84000">
181            <rom name="brd.rom" size="0x4000" crc="f45a7454" sha1="096c91fad6a4d10323cd67e133b3ebc5c50e2bb2" offset="0" />
182         </dataarea>
183      </part>
184   </software>
185
186</softwarelist>
Property changes on: trunk/hash/ep64_cart.xml
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/xml
trunk/hash/ep64_cass.xml
r23493r23494
33<softwarelist name="ep64_cass" description="Enterprise Sixty Four cassettes">
44
55   <software name="3dstarfg">
6      <description>3D Starfighter</description>
6      <description>3D Star Fighter</description>
77      <year>198?</year>
8      <publisher>&lt;unknown&gt;</publisher>
8      <publisher>Code Masters</publisher>
99
1010      <part name="cass1" interface="ep64_cass">
1111         <dataarea name="cass" size="905728">
r23493r23494
1717   <software name="airwolf">
1818      <description>Airwolf</description>
1919      <year>198?</year>
20      <publisher>&lt;unknown&gt;</publisher>
20      <publisher>Elite</publisher>
2121
2222      <part name="cass1" interface="ep64_cass">
2323         <dataarea name="cass" size="509952">
r23493r23494
2727   </software>
2828
2929   <software name="nodes">
30      <description>Nodes</description>
31      <year>198?</year>
32      <publisher>&lt;unknown&gt;</publisher>
30      <description>Nodes of Yesod</description>
31      <year>1985</year>
32      <publisher>Odin Computer Graphics</publisher>
3333
3434      <part name="cass1" interface="ep64_cass">
3535         <dataarea name="cass" size="582656">

Previous 199869 Revisions Next


© 1997-2024 The MAME Team