Previous 15994 Revisions Next

r15286 Wednesday 23rd May, 2012 at 12:21:32 UTC by Robbbert
INSTRUCT - added cassette & quickload. Cassette not working.
[src/mess/drivers]instruct.c pipbug.c

src/mess/drivers/pipbug.c
r15285r15286
170170   MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, terminal_intf, 110)
171171
172172   /* quickload */
173   MCFG_QUICKLOAD_ADD("quickload", pipbug, "pgm", 0)
173   MCFG_QUICKLOAD_ADD("quickload", pipbug, "pgm", 1)
174174MACHINE_CONFIG_END
175175
176176
src/mess/drivers/instruct.c
r15285r15286
4141      not in the matrix, but are connected to hardware directly. This needs
4242      to be emulated.
4343    - Connect 10 toggle switches and 10 round red leds.
44    - Cassette interface.
44    - Cassette interface not working.
4545
4646****************************************************************************/
4747
4848#include "emu.h"
4949#include "cpu/s2650/s2650.h"
50#include "imagedev/snapquik.h"
51#include "imagedev/cassette.h"
52#include "sound/wave.h"
5053#include "instruct.lh"
5154
5255class instruct_state : public driver_device
r15285r15286
5558   instruct_state(const machine_config &mconfig, device_type type, const char *tag)
5659      : driver_device(mconfig, type, tag),
5760   m_maincpu(*this, "maincpu"),
58   m_p_ram(*this, "p_ram")
61   m_p_ram(*this, "p_ram"),
62   m_cass(*this, CASSETTE_TAG)
5963   { }
6064
61   required_device<cpu_device> m_maincpu;
6265   DECLARE_READ8_MEMBER(portfc_r);
6366   DECLARE_READ8_MEMBER(portfd_r);
6467   DECLARE_READ8_MEMBER(portfe_r);
r15285r15286
6770   DECLARE_WRITE8_MEMBER(portf9_w);
6871   DECLARE_WRITE8_MEMBER(portfa_w);
6972   virtual void machine_reset();
70   required_shared_ptr<UINT8> m_p_ram;
7173   UINT8 m_digit;
7274   bool m_valid_digit;
75   required_device<cpu_device> m_maincpu;
76   required_shared_ptr<UINT8> m_p_ram;
77   required_device<cassette_image_device> m_cass;
7378};
7479
7580// cassette port
r15285r15286
7782// saving can use bits 3,4,5
7883WRITE8_MEMBER( instruct_state::portf8_w )
7984{
85   m_cass->output(BIT(data, 3) ? -1.0 : +1.0);
8086}
8187
8288// segment output
r15285r15286
124130   return 0xff;
125131}
126132
127// read SENS key and cassin
133
134// Read cassette and SENS key
128135READ8_MEMBER( instruct_state::sense_r )
129136{
130   return 0;
137   return ( (m_cass->input() > 0.03) ? 1 : 0) | (ioport("HW")->read() & 1);
131138}
132139
133140static ADDRESS_MAP_START( instruct_mem, AS_PROGRAM, 8, instruct_state )
134141   ADDRESS_MAP_UNMAP_HIGH
135142   AM_RANGE(0x0000, 0x01ff) AM_RAM AM_SHARE("p_ram") // 512 bytes onboard ram
143   AM_RANGE(0x0200, 0x177f) AM_RAM // expansion ram needed by quickloads
136144   AM_RANGE(0x1780, 0x17ff) AM_RAM // 128 bytes in s2656 chip
137145   AM_RANGE(0x1800, 0x1fff) AM_ROM
138146ADDRESS_MAP_END
r15285r15286
207215   memcpy(m_p_ram, ROM+0x1800, 0x0200);
208216}
209217
218QUICKLOAD_LOAD( instruct )
219{
220   address_space *space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
221   int i;
222   int quick_addr = 0x0100;
223   int exec_addr;
224   int quick_length;
225   UINT8 *quick_data;
226   int read_;
210227
228   quick_length = image.length();
229   quick_data = (UINT8*)malloc(quick_length);
230   if (!quick_data)
231   {
232      image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
233      image.message(" Cannot open file");
234      return IMAGE_INIT_FAIL;
235   }
236
237   read_ = image.fread( quick_data, quick_length);
238   if (read_ != quick_length)
239   {
240      image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file");
241      image.message(" Cannot read the file");
242      return IMAGE_INIT_FAIL;
243   }
244
245   if (quick_data[0] != 0xc5)
246   {
247      image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header");
248      image.message(" Invalid header");
249      return IMAGE_INIT_FAIL;
250   }
251
252   exec_addr = quick_data[1] * 256 + quick_data[2];
253
254   if (exec_addr >= quick_length)
255   {
256      image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Exec address beyond end of file");
257      image.message(" Exec address beyond end of file");
258      return IMAGE_INIT_FAIL;
259   }
260
261   if (quick_length < 0x104)
262   {
263      image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too short");
264      image.message(" File too short");
265      return IMAGE_INIT_FAIL;
266   }
267
268   if (quick_length > 0x17c0)
269   {
270      image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too long");
271      image.message(" File too long");
272      return IMAGE_INIT_FAIL;
273   }
274
275   for (i = quick_addr; i < quick_length; i++)
276   {
277      space->write_byte(i, quick_data[i]);
278   }
279
280   /* display a message about the loaded quickload */
281   image.message(" Quickload: size=%04X : exec=%04X",quick_length,exec_addr);
282
283   // Start the quickload
284   cpu_set_reg(image.device().machine().device("maincpu"), STATE_GENPC, exec_addr);
285   return IMAGE_INIT_PASS;
286}
287
211288static MACHINE_CONFIG_START( instruct, instruct_state )
212289   /* basic machine hardware */
213290   MCFG_CPU_ADD("maincpu",S2650, XTAL_3_579545MHz / 4)
r15285r15286
216293
217294   /* video hardware */
218295   MCFG_DEFAULT_LAYOUT(layout_instruct)
296
297   /* quickload */
298   MCFG_QUICKLOAD_ADD("quickload", instruct, "pgm", 1)
299
300   /* cassette */
301   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
302   MCFG_SPEAKER_STANDARD_MONO("mono")
303   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
304   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
219305MACHINE_CONFIG_END
220306
221307/* ROM definition */
r15285r15286
227313/* Driver */
228314
229315/*    YEAR  NAME       PARENT   COMPAT   MACHINE    INPUT     INIT    COMPANY     FULLNAME                    FLAGS */
230COMP( 1978, instruct,  0,       0,       instruct,  instruct, 0,    "Signetics", "Signetics Instructor 50", GAME_NOT_WORKING | GAME_NO_SOUND_HW )
316COMP( 1978, instruct,  0,       0,       instruct,  instruct, 0,    "Signetics", "Signetics Instructor 50", 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team