Previous 15994 Revisions Next

r1622 Monday 28th January, 2008 at 13:13:43 UTC by Dirk Best
[NASCOM] Added snapshot loading support (.nas files)
[docs]messnew.txt
[src/mess/drivers]nascom1.c
[src/mess/includes]nascom1.h
[src/mess/machine]nascom1.c

src/mess/includes/nascom1.h
r1621r1622
77#ifndef NASCOM1_H_
88#define NASCOM1_H_
99
10#include "devices/snapquik.h"
1011
12
1113/*----------- defined in machine/nascom1.c -----------*/
1214
1315DRIVER_INIT( nascom1 );
1416DEVICE_LOAD( nascom1_cassette );
1517DEVICE_UNLOAD( nascom1_cassette );
18SNAPSHOT_LOAD( nascom1 );
19
1620int nascom1_read_cassette (void);
1721int nascom1_init_cartridge (int id, mame_file *fp);
1822 READ8_HANDLER( nascom1_port_00_r);
src/mess/machine/nascom1.c
r1621r1622
1313#include "image.h"
1414#include "includes/nascom1.h"
1515#include "cpu/z80/z80.h"
16#include "devices/snapquik.h"
1617
1718
19
1820static   int      nascom1_tape_size = 0;
1921static   UINT8   *nascom1_tape_image = NULL;
2022static   int      nascom1_tape_index = 0;
r1621r1622
138140   Note <addr> and <byte> are in hex.
139141*/
140142
141int   nascom1_init_cartridge(int id, mame_file *file)
143SNAPSHOT_LOAD( nascom1 )
142144{
143   int      done;
144   char   fileaddr[5];
145   /* int   filebyt1, filebyt2, filebyt3, filebyt4;
146   int   filebyt5, filebyt6, filebyt7, filebyt8;
147   int   addr; */
145   UINT8 line[35];
148146
149   return (1);
150
151   if (file)
147   while (image_fread(image, &line, sizeof(line)) == sizeof(line))
152148   {
153      done = 0;
154      fileaddr[4] = 0;
155      while (!done)
156      {
157         mame_fread(file, (void *)fileaddr, 4);
158         logerror ("%4.4s\n", fileaddr);
159         if (fileaddr[0] == '.')
160         {
161            done = 1;
162         }
163         else
164         {
165            /* vsscanf (fileaddr, "%4X", &addr); */
166             /* logerror ("%04X: %02X %02X %02X %02X %02X %02X %02X %02X\n",
167                       addr, filebyt1, filebyt2, filebyt3, filebyt4,
168                           filebyt5, filebyt6, filebyt7, filebyt8); */
149      int addr, b0, b1, b2, b3, b4, b5, b6, b7, dummy;
169150
170         }
151      if (sscanf((char *)line, "%x %x %x %x %x %x %x %x %x %x\010\010\n",
152         &addr, &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &dummy) == 10)
153      {
154         program_write_byte_8(addr++, b0);
155         program_write_byte_8(addr++, b1);
156         program_write_byte_8(addr++, b2);
157         program_write_byte_8(addr++, b3);
158         program_write_byte_8(addr++, b4);
159         program_write_byte_8(addr++, b5);
160         program_write_byte_8(addr++, b6);
161         program_write_byte_8(addr++, b7);
171162      }
172163   }
173   else
174   {
175      return (1);
176   }
177164
178   return (0);
165   return INIT_PASS;
179166}
src/mess/drivers/nascom1.c
r1621r1622
182182   PORT_START   /* 8: count = 8 */
183183   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace ClearScreen") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8)
184184   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("New Line")              PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
185   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)      PORT_CHAR('-') PORT_CHAR('=')
185   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
186186   PORT_BIT(0x58, IP_ACTIVE_LOW, IPT_UNUSED)
187   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR('@')
187   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR(UCHAR_SHIFT_2) PORT_CHAR('@')
188188INPUT_PORTS_END
189189
190190/* Sound output */
r1621r1622
282282   }
283283}
284284
285static void nascom1_snapshot_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
286{
287   switch(state)
288   {
289      /* --- the following bits of info are returned as NULL-terminated strings --- */
290      case DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "nas"); break;
291
292      /* --- the following bits of info are returned as pointers to data or functions --- */
293      case DEVINFO_PTR_SNAPSHOT_LOAD:               info->f = (genf *) snapshot_load_nascom1; break;
294
295      /* --- the following bits of info are returned as doubles --- */
296      case DEVINFO_FLOAT_SNAPSHOT_DELAY:            info->d = 0.5; break;
297
298      default:                              snapshot_device_getinfo(devclass, state, info); break;
299   }
300}
301
285302SYSTEM_CONFIG_START(nascom1)
286303   CONFIG_IMPORT_FROM(nascom)
287304   CONFIG_DEVICE(nascom1_cassette_getinfo)
305   CONFIG_DEVICE(nascom1_snapshot_getinfo)
288306SYSTEM_CONFIG_END
289307
290308static void nascom2_cassette_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
r1621r1622
311329SYSTEM_CONFIG_START(nascom2)
312330   CONFIG_IMPORT_FROM(nascom)
313331   CONFIG_DEVICE(nascom2_cassette_getinfo)
332   CONFIG_DEVICE(nascom1_snapshot_getinfo)
314333SYSTEM_CONFIG_END
315334
316335/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT        CONFIG      COMPANY                     FULLNAME        FLAGS */
docs/messnew.txt
r1621r1622
3434  instead of dip switches and updated it to use the default black and white
3535  palette.  [Dirk Best]
3636
37- [NASCOM] Added snapshot loading support (.nas files)  [Dirk Best]
38
3739- [NES] Added support for mappers 42, 43, 44, 45 (partial), 46, 47, 49,
3840  51 (partial), 57, 58, 61, 62, 83 (partial), 112, 182, 188, 193 (not working),
3941  200, 201, 202, 203, 206, 240, 241 (partial), 242, 244, 246, 248.

Previous 15994 Revisions Next


© 1998-2018 The MESS Team