Previous 15994 Revisions Next

r8763 Thursday 12th August, 2010 at 08:35:53 UTC by Angelo Salese
[JR-200]: rewrote I/O Device again
[src/mess/drivers]jr200.c

src/mess/drivers/jr200.c
r8762r8763
2020#include "sound/beep.h"
2121
2222static UINT8 *jr200_vram,*jr200_cram;
23static UINT8 *mn1271_ram;
2324static UINT8 jr200_border_col;
2425
2526/* TODO: double check this */
r8762r8763
249250   jr200_border_col = data;
250251}
251252
252static READ8_HANDLER( jr200_system_latch_1_r )
253static READ8_HANDLER( mn1271_io_r )
253254{
254   return 1; // needs this to be high otherwise system refuses to boot
255}
255   if((offset+0xc800) > 0xca00)
256      return 0xff;
256257
257static READ8_HANDLER( jr200_tape_r )
258{
259   return mame_rand(space->machine);
260}
258   switch(offset+0xc800)
259   {
260      case 0xc801: return mcu_keyb_r(space,0);
261      case 0xc803: return (mn1271_ram[0x03] & 0xcf) | 0x30; //---x ---- printer status ready (ACTIVE HIGH)
262      case 0xc807: return (mn1271_ram[0x07] & 0x80) | 0x60;
263      case 0xc80a: return (mn1271_ram[0x0a] & 0xfe);
264      case 0xc80c: return (mn1271_ram[0x0c] & 0xdf) | 0x20;
265      case 0xc80e: return 0;
266      case 0xc810: return 0;
267      case 0xc816: return 0x4e;
268      case 0xc81c: return (mn1271_ram[0x1c] & 0xfe) | 1; //bit 0 needs to be high otherwise system refuses to boot
269      case 0xc81d: return (mn1271_ram[0x1d] & 0xed);
270   }
261271
262static READ8_HANDLER( jr200_tape2_r )
263{
264   return mame_rand(space->machine);
272   return mn1271_ram[offset];
265273}
266274
267
268static READ8_HANDLER( mcu_portd_r )
275static WRITE8_HANDLER( mn1271_io_w )
269276{
270   /*
271   ---x ---- printer status ready (ACTIVE HIGH)
272   */
277   mn1271_ram[offset] = data;
273278
274   return 0x10;
279   switch(offset+0xc800)
280   {
281      case 0xc805: break; //LPT printer port W
282      case 0xc819: jr200_beep_w(space,0,data); break;
283      case 0xc81a:
284      case 0xc81b: jr200_beep_freq_w(space,offset-0x1a,data); break;
285      case 0xca00: jr200_border_col_w(space,0,data); break;
286   }
275287}
276288
277
278289static ADDRESS_MAP_START(jr200_mem, ADDRESS_SPACE_PROGRAM, 8)
279290/*
280291    0000-3fff RAM
r8762r8763
292303   AM_RANGE(0xc500, 0xc7ff) AM_RAM AM_BASE(&jr200_cram)
293304
294305//   0xc800 - 0xcfff I / O area
295   AM_RANGE(0xc801, 0xc801) AM_READ(mcu_keyb_r)
296   AM_RANGE(0xc803, 0xc803) AM_READ(mcu_portd_r) AM_WRITENOP //used in IRQ routine (0x01 -> 0x43)
297   AM_RANGE(0xc805, 0xc805) AM_WRITENOP //printer LPT port
298//   AM_RANGE(0xc806, 0xc806) //writes 0x78 there
299   AM_RANGE(0xc807, 0xc807) AM_READ(jr200_tape_r) //W bit 6 enables tape play
300   AM_RANGE(0xc80e, 0xc80e) AM_READ(jr200_tape2_r)
301   AM_RANGE(0xc819, 0xc819) AM_WRITE(jr200_beep_w)
302   AM_RANGE(0xc81a, 0xc81b) AM_WRITE(jr200_beep_freq_w)
303   AM_RANGE(0xc81c, 0xc81c) AM_READ(jr200_system_latch_1_r)
304   AM_RANGE(0xc81d, 0xc81d) AM_READNOP //jr200_system_latch_2_r
305   AM_RANGE(0xca00, 0xca00) AM_WRITE(jr200_border_col_w)
306   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(mn1271_io_r,mn1271_io_w) AM_BASE(&mn1271_ram)
306307
307308   AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(jr200_bios_char_r,jr200_bios_char_w) //BIOS PCG RAM area
308309   AM_RANGE(0xd800, 0xdfff) AM_ROM // cart space (header 0x7e)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team