Previous 15994 Revisions Next

r1635 Tuesday 29th January, 2008 at 20:01:08 UTC by Dirk Best
[NASCOM] Added preliminary floppy support, cleaned up driver files
[docs]messnew.txt
[src/mess/drivers]nascom1.c
[src/mess/includes]nascom1.h
[src/mess/machine]nascom1.c

src/mess/includes/nascom1.h
r1634r1635
1717DEVICE_UNLOAD( nascom1_cassette );
1818SNAPSHOT_LOAD( nascom1 );
1919
20int nascom1_read_cassette (void);
21int nascom1_init_cartridge (int id, mame_file *fp);
22 READ8_HANDLER( nascom1_port_00_r);
23 READ8_HANDLER( nascom1_port_01_r);
24 READ8_HANDLER( nascom1_port_02_r);
20READ8_HANDLER( nascom2_fdc_select_r );
21WRITE8_HANDLER( nascom2_fdc_select_w );
22READ8_HANDLER( nascom2_fdc_status_r );
23DEVICE_LOAD( nascom2_floppy );
24
25READ8_HANDLER( nascom1_port_00_r);
26READ8_HANDLER( nascom1_port_01_r);
27READ8_HANDLER( nascom1_port_02_r);
2528WRITE8_HANDLER( nascom1_port_00_w);
2629WRITE8_HANDLER( nascom1_port_01_w);
2730
src/mess/machine/nascom1.c
r1634r1635
11/**********************************************************************
22
3  mess/machine/nascom1.c
3  machine/nascom1.c
44
5  Functions to emulate general aspects of the machine (RAM, ROM, interrups,
6  I/O ports)
7
85**********************************************************************/
96
7/* Core includes */
108#include <stdio.h>
119#include "driver.h"
12#include "mslegacy.h"
13#include "image.h"
1410#include "includes/nascom1.h"
11
12/* Components */
1513#include "cpu/z80/z80.h"
14#include "machine/wd17xx.h"
15
16/* Devices */
17#include "devices/basicdsk.h"
1618#include "devices/snapquik.h"
1719
1820
21#define NASCOM1_KEY_RESET   0x02
22#define NASCOM1_KEY_INCR   0x01
23#define NASCOM1_CAS_ENABLE   0x10
1924
20static   int      nascom1_tape_size = 0;
21static   UINT8   *nascom1_tape_image = NULL;
22static   int      nascom1_tape_index = 0;
2325
2426
27/*************************************
28 *
29 *  Global variables
30 *
31 *************************************/
32
33static int nascom1_tape_size = 0;
34static UINT8 *nascom1_tape_image = NULL;
35static int nascom1_tape_index = 0;
36
2537static   struct
2638{
2739   UINT8   stat_flags;
2840   UINT8   stat_count;
2941} nascom1_portstat;
3042
31#define NASCOM1_KEY_RESET   0x02
32#define NASCOM1_KEY_INCR   0x01
33#define NASCOM1_CAS_ENABLE   0x10
43static struct
44{
45   UINT8 select;
46   UINT8 irq;
47   UINT8 drq;
48} nascom2_fdc;
3449
3550
36DRIVER_INIT( nascom1 )
51
52/*************************************
53 *
54 *  Floppy
55 *
56 *************************************/
57
58static void nascom2_fdc_callback(wd17xx_state_t event, void *param)
3759{
38   switch (mess_ram_size)
60   switch (event)
3961   {
40   case 1 * 1024:
41      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
42         0x1400, 0x9000, 0, 0, MRA8_NOP, MWA8_NOP);
43      break;
62   case WD17XX_IRQ_SET: nascom2_fdc.irq = 1; break;
63   case WD17XX_IRQ_CLR: nascom2_fdc.irq = 0; break;
64   case WD17XX_DRQ_SET: nascom2_fdc.drq = 1; break;
65   case WD17XX_DRQ_CLR: nascom2_fdc.drq = 0; break;
66   }
67}
4468
45   case 16 * 1024:
46      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
47         0x1400, 0x4fff, 0, 0, MRA8_BANK1, MWA8_BANK1);
48      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
49         0x5000, 0xafff, 0, 0, MRA8_NOP, MWA8_NOP);
50      memory_set_bankptr(1, mess_ram);
51      break;
5269
53   case 32 * 1024:
54      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
55         0x1400, 0x8fff, 0, 0, MRA8_BANK1, MWA8_BANK1);
56      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
57         0x9000, 0xafff, 0, 0, MRA8_NOP, MWA8_NOP);
58      memory_set_bankptr(1, mess_ram);
59      break;
70READ8_HANDLER( nascom2_fdc_select_r )
71{
72   return nascom2_fdc.select | 0xa0;
73}
6074
61   case 40 * 1024:
62      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
63         0x1400, 0xafff, 0, 0, MRA8_BANK1, MWA8_BANK1);
64      memory_set_bankptr(1, mess_ram);
65      break;
75
76WRITE8_HANDLER( nascom2_fdc_select_w )
77{
78   nascom2_fdc.select = data;
79
80   logerror("nascom2_fdc_select_w: %02x\n", data);
81
82   if (data & 0x01) wd17xx_set_drive(0);
83   if (data & 0x02) wd17xx_set_drive(1);
84   if (data & 0x04) wd17xx_set_drive(2);
85   if (data & 0x08) wd17xx_set_drive(3);
86   if (data & 0x10) wd17xx_set_side((data & 0x10) >> 4);
87}
88
89
90/*
91 * D0 -- WD1793 IRQ
92 * D1 -- NOT READY
93 * D2 to D6 -- 0
94 * D7 -- WD1793 DRQ
95 *
96 */
97READ8_HANDLER( nascom2_fdc_status_r )
98{
99   return (nascom2_fdc.drq << 7) | nascom2_fdc.irq;
100}
101
102
103DEVICE_LOAD( nascom2_floppy )
104{
105   int sides, sectors;
106
107   if (!image_has_been_created(image))
108   {
109      switch (image_length(image))
110      {
111      case 80 * 2 * 2 * 8 * 256:
112         sides = 2;
113         sectors = 2 * 8;
114         wd17xx_set_density(DEN_FM_HI);
115         break;
116
117      case 80 * 1 * 2 * 8 * 256:
118         sides = 1;
119         sectors = 2 * 8;
120         wd17xx_set_density(DEN_FM_HI);
121         break;
122
123      default:
124         return INIT_FAIL;
125      }
66126   }
127   else
128   {
129      return INIT_FAIL;
130   }
131
132   if (device_load_basicdsk_floppy(image) != INIT_PASS)
133   {
134      return INIT_FAIL;
135   }
136
137   basicdsk_set_geometry(image, 80, sides, sectors, 256, 1, 0, FALSE);
138
139   return INIT_PASS;
67140}
68141
69142
143
144/*************************************
145 *
146 *  Keyboard
147 *
148 *************************************/
149
70150READ8_HANDLER ( nascom1_port_00_r )
71151{
72152   if (nascom1_portstat.stat_count < 9)
r1634r1635
75155   return (0xff);
76156}
77157
78READ8_HANDLER( nascom1_port_01_r )
79{
80   if (nascom1_portstat.stat_flags & NASCOM1_CAS_ENABLE)
81      return (nascom1_read_cassette());
82158
83   return 0;
84}
85
86READ8_HANDLER( nascom1_port_02_r )
87{
88   return nascom1_portstat.stat_flags & NASCOM1_CAS_ENABLE ? 0x80 : 0x00;
89}
90
91159WRITE8_HANDLER( nascom1_port_00_w )
92160{
93161   nascom1_portstat.stat_flags &= ~NASCOM1_CAS_ENABLE;
r1634r1635
104172   } else nascom1_portstat.stat_flags = NASCOM1_KEY_INCR;
105173}
106174
107WRITE8_HANDLER (   nascom1_port_01_w )
175
176WRITE8_HANDLER( nascom1_port_01_w )
108177{
109178}
110179
180
181
182/*************************************
183 *
184 *  Cassette
185 *
186 *************************************/
187
188int   nascom1_read_cassette(void)
189{
190   if (nascom1_tape_image && (nascom1_tape_index < nascom1_tape_size))
191      return (nascom1_tape_image[nascom1_tape_index++]);
192
193   return 0;
194}
195
196
197READ8_HANDLER( nascom1_port_01_r )
198{
199   if (nascom1_portstat.stat_flags & NASCOM1_CAS_ENABLE)
200      return (nascom1_read_cassette());
201
202   return 0;
203}
204
205
206READ8_HANDLER( nascom1_port_02_r )
207{
208   return nascom1_portstat.stat_flags & NASCOM1_CAS_ENABLE ? 0x80 : 0x00;
209}
210
211
111212DEVICE_LOAD( nascom1_cassette )
112213{
113214   nascom1_tape_size = image_length(image);
r1634r1635
119220   return INIT_PASS;
120221}
121222
223
122224DEVICE_UNLOAD( nascom1_cassette )
123225{
124226   nascom1_tape_image = NULL;
125227   nascom1_tape_size = nascom1_tape_index = 0;
126228}
127229
128int   nascom1_read_cassette(void)
129{
130   if (nascom1_tape_image && (nascom1_tape_index < nascom1_tape_size))
131               return (nascom1_tape_image[nascom1_tape_index++]);
132   return (0);
133}
134230
135/* Ascii .nas format
136231
137   <addr> <byte> x 8 ^H^H^J
138   .
232/*************************************
233 *
234 *  Snapshots
235 *
236 *  ASCII .nas format
237 *
238 *************************************/
139239
140   Note <addr> and <byte> are in hex.
141*/
142
143240SNAPSHOT_LOAD( nascom1 )
144241{
145242   UINT8 line[35];
r1634r1635
164261
165262   return INIT_PASS;
166263}
264
265
266
267/*************************************
268 *
269 *  Initialization
270 *
271 *************************************/
272
273DRIVER_INIT( nascom1 )
274{
275   switch (mess_ram_size)
276   {
277   case 1 * 1024:
278      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
279         0x1400, 0x9000, 0, 0, MRA8_NOP, MWA8_NOP);
280      break;
281
282   case 16 * 1024:
283      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
284         0x1400, 0x4fff, 0, 0, MRA8_BANK1, MWA8_BANK1);
285      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
286         0x5000, 0xafff, 0, 0, MRA8_NOP, MWA8_NOP);
287      memory_set_bankptr(1, mess_ram);
288      break;
289
290   case 32 * 1024:
291      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
292         0x1400, 0x8fff, 0, 0, MRA8_BANK1, MWA8_BANK1);
293      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
294         0x9000, 0xafff, 0, 0, MRA8_NOP, MWA8_NOP);
295      memory_set_bankptr(1, mess_ram);
296      break;
297
298   case 40 * 1024:
299      memory_install_readwrite8_handler(0, ADDRESS_SPACE_PROGRAM,
300         0x1400, 0xafff, 0, 0, MRA8_BANK1, MWA8_BANK1);
301      memory_set_bankptr(1, mess_ram);
302      break;
303   }
304
305   wd17xx_init(WD_TYPE_1793, nascom2_fdc_callback, NULL);
306}
src/mess/drivers/nascom1.c
r1634r1635
4848
4949************************************************************************/
5050
51/* Core includes */
5152#include "driver.h"
5253#include "includes/nascom1.h"
54
55/* Components */
5356#include "cpu/z80/z80.h"
57#include "machine/wd17xx.h"
58
59/* Devices */
60#include "devices/basicdsk.h"
5461#include "devices/cartslot.h"
5562
5663
57/* Memory w/r functions */
58static ADDRESS_MAP_START( nascom1_mem , ADDRESS_SPACE_PROGRAM, 8)
64
65/*************************************
66 *
67 *  Memory maps
68 *
69 *************************************/
70
71static ADDRESS_MAP_START( nascom1_mem, ADDRESS_SPACE_PROGRAM, 8 )
5972   AM_RANGE(0x0000, 0x07ff) AM_ROM
6073   AM_RANGE(0x0800, 0x0bff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
6174   AM_RANGE(0x0c00, 0x0fff) AM_RAM
r1634r1635
6679   AM_RANGE(0xb000, 0xffff) AM_ROM
6780ADDRESS_MAP_END
6881
69/* port i/o functions */
70static ADDRESS_MAP_START( nascom1_io , ADDRESS_SPACE_IO, 8)
82
83static ADDRESS_MAP_START( nascom1_io, ADDRESS_SPACE_IO, 8 )
84   ADDRESS_MAP_FLAGS( AMEF_ABITS(4) )
85   AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w)
86   AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w)
87   AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r)
88ADDRESS_MAP_END
89
90
91static ADDRESS_MAP_START( nascom2_io, ADDRESS_SPACE_IO, 8 )
7192   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
72   AM_RANGE(0x00, 0x00) AM_READWRITE( nascom1_port_00_r, nascom1_port_00_w )
73   AM_RANGE(0x01, 0x01) AM_READWRITE( nascom1_port_01_r, nascom1_port_01_w )
74   AM_RANGE(0x02, 0x02) AM_READ( nascom1_port_02_r )
93   AM_RANGE(0x00, 0x00) AM_READWRITE(nascom1_port_00_r, nascom1_port_00_w)
94   AM_RANGE(0x01, 0x01) AM_READWRITE(nascom1_port_01_r, nascom1_port_01_w)
95   AM_RANGE(0x02, 0x02) AM_READ(nascom1_port_02_r)
96   AM_RANGE(0xe0, 0xe3) AM_READWRITE(wd17xx_r, wd17xx_w)
97   AM_RANGE(0xe4, 0xe4) AM_READWRITE(nascom2_fdc_select_r, nascom2_fdc_select_w)
98   AM_RANGE(0xe5, 0xe5) AM_READ(nascom2_fdc_status_r)
7599ADDRESS_MAP_END
76100
77/* graphics output */
78101
102
103/*************************************
104 *
105 *  GFX layouts
106 *
107 *************************************/
108
79109static const gfx_layout nascom1_charlayout =
80110{
81111   8, 16,
r1634r1635
88118   8 * 16
89119};
90120
121
91122static GFXDECODE_START( nascom1 )
92   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, nascom1_charlayout, 0, 1 )
123   GFXDECODE_ENTRY(REGION_GFX1, 0x0000, nascom1_charlayout, 0, 1)
93124GFXDECODE_END
94125
126
95127static const gfx_layout nascom2_charlayout =
96128{
97129   8, 14,
r1634r1635
104136   8 * 16
105137};
106138
139
107140static GFXDECODE_START( nascom2 )
108   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, nascom2_charlayout, 0, 1 )
141   GFXDECODE_ENTRY(REGION_GFX1, 0x0000, nascom2_charlayout, 0, 1)
109142GFXDECODE_END
110143
111144
112/* Keyboard input */
113145
114static INPUT_PORTS_START (nascom1)
115   PORT_START   /* 0: count = 0 */
146/*************************************
147 *
148 *  Input ports
149 *
150 *************************************/
151
152static INPUT_PORTS_START( nascom1 )
153   PORT_START_TAG("keyboard_0")
116154   PORT_BIT(0x6f, IP_ACTIVE_LOW, IPT_UNUSED)
117155   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
118156
119   PORT_START   /* 1: count = 1 */
157   PORT_START_TAG("keyboard_1")
120158   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)  PORT_CHAR('H') PORT_CHAR('h')
121159   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)  PORT_CHAR('B') PORT_CHAR('b')
122160   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)  PORT_CHAR('5') PORT_CHAR('%')
r1634r1635
125163   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)  PORT_CHAR('T') PORT_CHAR('t')
126164   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
127165
128   PORT_START   /* 2: count = 2 */
166   PORT_START_TAG("keyboard_2")
129167   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)    PORT_CHAR('J') PORT_CHAR('j')
130168   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)    PORT_CHAR('N') PORT_CHAR('n')
131169   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)    PORT_CHAR('6') PORT_CHAR('&')
r1634r1635
134172   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)    PORT_CHAR('Y') PORT_CHAR('y')
135173   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
136174
137   PORT_START   /* 3: count = 3 */
175   PORT_START_TAG("keyboard_3")
138176   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)    PORT_CHAR('K') PORT_CHAR('k')
139177   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)    PORT_CHAR('M') PORT_CHAR('m')
140178   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)    PORT_CHAR('7') PORT_CHAR('\'')
r1634r1635
143181   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)    PORT_CHAR('U') PORT_CHAR('u')
144182   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
145183
146   PORT_START   /* 4: count = 4 */
184   PORT_START_TAG("keyboard_4")
147185   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)     PORT_CHAR('L') PORT_CHAR('l')
148186   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
149187   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)     PORT_CHAR('8') PORT_CHAR('(')
r1634r1635
152190   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)     PORT_CHAR('I') PORT_CHAR('i')
153191   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
154192
155   PORT_START   /* 5: count = 5 */
193   PORT_START_TAG("keyboard_5")
156194   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+')
157195   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)  PORT_CHAR('.') PORT_CHAR('>')
158196   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)     PORT_CHAR('9') PORT_CHAR(')')
r1634r1635
161199   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)     PORT_CHAR('O') PORT_CHAR('o')
162200   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
163201
164   PORT_START   /* 6: count = 6 */
202   PORT_START_TAG("keyboard_6")
165203   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
166204   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
167205   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)     PORT_CHAR('0')
r1634r1635
170208   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)     PORT_CHAR('P') PORT_CHAR('p')
171209   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
172210
173   PORT_START   /* 7: count = 7 */
211   PORT_START_TAG("keyboard_7")
174212   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)     PORT_CHAR('G') PORT_CHAR('g')
175213   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)     PORT_CHAR('V') PORT_CHAR('v')
176214   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)     PORT_CHAR('4') PORT_CHAR('$')
r1634r1635
179217   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)     PORT_CHAR('R') PORT_CHAR('r')
180218   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
181219
182   PORT_START   /* 8: count = 8 */
220   PORT_START_TAG("keyboard_8")
183221   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace ClearScreen") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8)
184222   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("New Line")              PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
185223   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
r1634r1635
187225   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR(UCHAR_SHIFT_2) PORT_CHAR('@')
188226INPUT_PORTS_END
189227
190/* Sound output */
191228
192static INTERRUPT_GEN( nascom_interrupt )
193{
194   cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
195}
229static INPUT_PORTS_START( nascom2 )
230   PORT_INCLUDE(nascom1)
196231
197/* Machine definition */
232   PORT_MODIFY("keyboard_6")
233   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                            PORT_CODE(KEYCODE_EQUALS)     PORT_CHAR('[') PORT_CHAR('\\')
234
235   PORT_MODIFY("keyboard_7")
236   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)                            PORT_CODE(KEYCODE_BACKSPACE)  PORT_CHAR(']') PORT_CHAR('_')
237
238   PORT_MODIFY("keyboard_8")
239   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back CS")       PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8)
240   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter  Escape") PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)  PORT_CHAR(27)
241INPUT_PORTS_END
242
243
244
245/*************************************
246 *
247 *  Machine drivers
248 *
249 *************************************/
250
198251static MACHINE_DRIVER_START( nascom1 )
199252   /* basic machine hardware */
200253   MDRV_CPU_ADD_TAG("main", Z80, 1000000)
201254   MDRV_CPU_PROGRAM_MAP(nascom1_mem, 0)
202255   MDRV_CPU_IO_MAP(nascom1_io, 0)
203   MDRV_CPU_VBLANK_INT(nascom_interrupt, 1)
204256   MDRV_SCREEN_REFRESH_RATE(50)
205257   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
206258
r1634r1635
209261   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
210262   MDRV_SCREEN_SIZE(48 * 8, 16 * 16)
211263   MDRV_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 16 - 1)
212   MDRV_GFXDECODE( nascom1 )
264   MDRV_GFXDECODE(nascom1)
213265   MDRV_PALETTE_LENGTH(2)
214266   MDRV_PALETTE_INIT(black_and_white)
215267
216   MDRV_VIDEO_START( generic )
217   MDRV_VIDEO_UPDATE( nascom1 )
268   MDRV_VIDEO_START(generic)
269   MDRV_VIDEO_UPDATE(nascom1)
218270MACHINE_DRIVER_END
219271
220272
221273static MACHINE_DRIVER_START( nascom2 )
222   MDRV_IMPORT_FROM( nascom1 )
223   MDRV_CPU_REPLACE( "main", Z80, 2000000 )
274   MDRV_IMPORT_FROM(nascom1)
275   MDRV_CPU_REPLACE("main", Z80, 2000000)
276   MDRV_CPU_IO_MAP(nascom2_io, 0)
277
278   /* video hardware */
224279   MDRV_SCREEN_SIZE(48 * 8, 16 * 14)
225280   MDRV_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 14 - 1)
226   MDRV_GFXDECODE( nascom2 )
227   MDRV_VIDEO_UPDATE( nascom2 )
281   MDRV_GFXDECODE(nascom2)
282   MDRV_VIDEO_UPDATE(nascom2)
228283MACHINE_DRIVER_END
229284
285
286
287/*************************************
288 *
289 *  ROM definitions
290 *
291 *************************************/
292
230293ROM_START(nascom1)
231294   ROM_REGION(0x10000, REGION_CPU1,0)
232   ROM_SYSTEM_BIOS( 0, "T4", "NasBug T4" )
295   ROM_SYSTEM_BIOS(0, "T4", "NasBug T4")
233296   ROMX_LOAD("nasbugt4.rom", 0x0000, 0x0800, CRC(f391df68) SHA1(00218652927afc6360c57e77d6a4fd32d4e34566), ROM_BIOS(1))
234   ROM_SYSTEM_BIOS( 1, "T1", "NasBug T1" )
297   ROM_SYSTEM_BIOS(1, "T1", "NasBug T1")
235298   ROMX_LOAD("nasbugt1.rom", 0x0000, 0x0400, CRC(8ea07054) SHA1(3f9a8632826003d6ea59d2418674d0fb09b83a4c), ROM_BIOS(2))
236   ROM_SYSTEM_BIOS( 2, "T2", "NasBug T2" )
299   ROM_SYSTEM_BIOS(2, "T2", "NasBug T2")
237300   ROMX_LOAD("nasbugt2.rom", 0x0000, 0x0400, CRC(e371b58a) SHA1(485b20a560b587cf9bb4208ba203b12b3841689b), ROM_BIOS(3))
238   ROM_REGION(0x0800, REGION_GFX1,0)
239   ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52))
301   ROM_REGION(0x0800, REGION_GFX1, 0)
302   ROM_LOAD("nascom1.chr",   0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52))
240303ROM_END
241304
305
242306ROM_START(nascom2)
243307   ROM_REGION(0x10000, REGION_CPU1,0)
244   ROM_SYSTEM_BIOS( 0, "NS3", "NasSys 3" )
308   ROM_SYSTEM_BIOS( 0, "NS3", "NasSys 3")
245309   ROMX_LOAD("nassys3.rom", 0x0000, 0x0800, CRC(3da17373) SHA1(5fbda15765f04e4cd08cf95c8d82ce217889f240), ROM_BIOS(1))
246   ROM_SYSTEM_BIOS( 1, "NS1", "NasSys 1" )
310   ROM_SYSTEM_BIOS( 1, "NS1", "NasSys 1")
247311   ROMX_LOAD("nassys1.rom", 0x0000, 0x0800, CRC(b6300716) SHA1(29da7d462ba3f569f70ed3ecd93b981f81c7adfa), ROM_BIOS(2))
248   ROM_LOAD("basic.rom", 0xe000, 0x2000, CRC(5cb5197b) SHA1(c41669c2b6d6dea808741a2738426d97bccc9b07))
249   ROM_REGION(0x1000, REGION_GFX1,0)
250   ROM_LOAD("nascom1.chr", 0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52))
251   ROM_LOAD("nasgra.chr", 0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae))
312   ROM_LOAD("nasdos.rom",   0xd000, 0x1000, CRC(54a36f6d) SHA1(1d063d04be5024f128bd589e6edc066e9a63fc1b))
313   ROM_LOAD("basic.rom",    0xe000, 0x2000, CRC(5cb5197b) SHA1(c41669c2b6d6dea808741a2738426d97bccc9b07))
314   ROM_REGION(0x1000, REGION_GFX1, 0)
315   ROM_LOAD("nascom1.chr",  0x0000, 0x0800, CRC(33e92a04) SHA1(be6e1cc80e7f95a032759f7df19a43c27ff93a52))
316   ROM_LOAD("nasgra.chr",   0x0800, 0x0800, CRC(2bc09d32) SHA1(d384297e9b02cbcb283c020da51b3032ff62b1ae))
252317ROM_END
253318
254SYSTEM_CONFIG_START(nascom)
255   CONFIG_RAM(1 * 1024)
256   CONFIG_RAM(16 * 1024)
257   CONFIG_RAM(32 * 1024)
258   CONFIG_RAM_DEFAULT(40 * 1024)
259#ifdef CART
260   CONFIG_DEVICE_CARTSLOT_REQ(1, "nas,bin", nascom1_init_cartridge, NULL, NULL)
261#endif
262SYSTEM_CONFIG_END
263319
320
321/*************************************
322 *
323 *  System configs
324 *
325 *************************************/
326
264327static void nascom1_cassette_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
265328{
266329   /* cassette */
r1634r1635
278341      case DEVINFO_PTR_UNLOAD:                  info->unload = device_unload_nascom1_cassette; break;
279342
280343      /* --- the following bits of info are returned as NULL-terminated strings --- */
281      case DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "nas,bin"); break;
344      case DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "cas"); break;
282345   }
283346}
284347
348
285349static void nascom1_snapshot_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
286350{
287351   switch(state)
r1634r1635
299363   }
300364}
301365
302SYSTEM_CONFIG_START(nascom1)
303   CONFIG_IMPORT_FROM(nascom)
304   CONFIG_DEVICE(nascom1_cassette_getinfo)
305   CONFIG_DEVICE(nascom1_snapshot_getinfo)
306SYSTEM_CONFIG_END
307366
308static void nascom2_cassette_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
367static void nascom2_floppy_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
309368{
310   /* cassette */
369   /* floppy */
311370   switch(state)
312371   {
313372      /* --- the following bits of info are returned as 64-bit signed integers --- */
314      case DEVINFO_INT_TYPE:                     info->i = IO_CASSETTE; break;
315      case DEVINFO_INT_READABLE:                  info->i = 1; break;
316      case DEVINFO_INT_WRITEABLE:                  info->i = 0; break;
317      case DEVINFO_INT_CREATABLE:                  info->i = 0; break;
318      case DEVINFO_INT_COUNT:                     info->i = 1; break;
373      case DEVINFO_INT_COUNT:                     info->i = 4; break;
319374
320375      /* --- the following bits of info are returned as pointers to data or functions --- */
321      case DEVINFO_PTR_LOAD:                     info->load = device_load_nascom1_cassette; break;
322      case DEVINFO_PTR_UNLOAD:                  info->unload = device_unload_nascom1_cassette; break;
376      case DEVINFO_PTR_LOAD:                     info->load = device_load_nascom2_floppy; break;
323377
324378      /* --- the following bits of info are returned as NULL-terminated strings --- */
325      case DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "cas,nas,bin"); break;
379      case DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "dsk"); break;
380
381      default:                              legacybasicdsk_device_getinfo(devclass, state, info); break;
326382   }
327383}
328384
329SYSTEM_CONFIG_START(nascom2)
330   CONFIG_IMPORT_FROM(nascom)
331   CONFIG_DEVICE(nascom2_cassette_getinfo)
385
386SYSTEM_CONFIG_START( nascom1 )
387   CONFIG_RAM(1 * 1024)
388   CONFIG_RAM(16 * 1024)
389   CONFIG_RAM(32 * 1024)
390   CONFIG_RAM_DEFAULT(40 * 1024)
391   CONFIG_DEVICE(nascom1_cassette_getinfo)
332392   CONFIG_DEVICE(nascom1_snapshot_getinfo)
333393SYSTEM_CONFIG_END
334394
395
396SYSTEM_CONFIG_START( nascom2 )
397   CONFIG_IMPORT_FROM(nascom1)
398   CONFIG_DEVICE(nascom2_floppy_getinfo)
399SYSTEM_CONFIG_END
400
401
402
403/*************************************
404 *
405 *  Driver definitions
406 *
407 *************************************/
408
335409/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT        CONFIG      COMPANY                     FULLNAME        FLAGS */
336410COMP( 1978, nascom1,    0,          0,      nascom1,    nascom1,    nascom1,    nascom1,    "Nascom Microcomputers",    "Nascom 1",     0 )
337COMP( 1979, nascom2,    nascom1,    0,      nascom2,    nascom1,    nascom1,    nascom2,    "Nascom Microcomputers",    "Nascom 2",     0 )
411COMP( 1979, nascom2,    nascom1,    0,      nascom2,    nascom2,    nascom1,    nascom2,    "Nascom Microcomputers",    "Nascom 2",     0 )
docs/messnew.txt
r1634r1635
3636
3737- [NASCOM] Added snapshot loading support (.nas files)  [Dirk Best]
3838
39- [NASCOM] Added preliminary floppy support.  [Dirk Best]
40
3941- [NES] Added support for mappers 42, 43, 44, 45 (partial), 46, 47, 49,
4042  51 (partial), 57, 58, 61, 62, 83 (partial), 112, 182, 188, 193 (not working),
4143  200, 201, 202, 203, 206, 240, 241 (partial), 242, 244, 246, 248.

Previous 15994 Revisions Next


© 1998-2018 The MESS Team