Previous 15994 Revisions Next

r10845 Tuesday 15th March, 2011 at 21:08:15 UTC by Sandro Ronco
[PC4] Added a better RTC emulation
[src/mess/drivers]pc4.c
[src/mess/includes]pc4.h

src/mess/includes/pc4.h
r10844r10845
2424   virtual bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect);
2525   virtual void machine_start();
2626
27   DECLARE_WRITE8_MEMBER( clock_w );
28   DECLARE_READ8_MEMBER( clock_r );
2927   DECLARE_WRITE8_MEMBER( beep_w );
3028   DECLARE_WRITE8_MEMBER( bank_w );
3129   DECLARE_READ8_MEMBER( kb_r );
src/mess/drivers/pc4.c
r10844r10845
2626#include "emu.h"
2727#include "cpu/z80/z80.h"
2828#include "includes/pc4.h"
29#include "machine/tc8521.h"
2930#include "sound/beep.h"
3031#include "rendlay.h"
3132
r10844r10845
4243   return data;
4344}
4445
45
46READ8_MEMBER( pc4_state::clock_r )
47{
48   system_time systime;
49
50    //get the current date and time from the core
51   machine->current_datetime(systime);
52
53   switch(offset)
54   {
55      case 0x00:
56         return systime.local_time.second%10;
57      case 0x01:
58         return systime.local_time.second/10;
59      case 0x02:
60         return systime.local_time.minute%10;
61      case 0x03:
62         return systime.local_time.minute/10;
63      case 0x04:
64         return systime.local_time.hour%10;
65      case 0x05:
66         return systime.local_time.hour/10;
67      case 0x06:
68         return systime.local_time.weekday;
69      case 0x07:
70         return systime.local_time.mday%10;
71      case 0x08:
72         return systime.local_time.mday/10;
73      case 0x09:
74         return (systime.local_time.month+1)%10;
75      case 0x0a:
76         return systime.local_time.month/10;
77      case 0x0b:
78         return systime.local_time.year%10;
79      case 0x0c:
80         return (systime.local_time.year%100)/10;
81      case 0x0d:
82      case 0x0e:
83      case 0x0f:
84      default:
85         return 0;
86   }
87}
88
89WRITE8_MEMBER( pc4_state::clock_w )
90{
91   //TODO
92}
93
9446WRITE8_MEMBER( pc4_state::bank_w )
9547{
9648   //printf("set bank %x\n", data);
r10844r10845
11062
11163static ADDRESS_MAP_START(pc4_io, ADDRESS_SPACE_IO, 8, pc4_state)
11264   ADDRESS_MAP_UNMAP_HIGH
113   AM_RANGE(0x0000, 0x000f) AM_READWRITE(clock_r, clock_w)
65   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE_LEGACY("rtc", tc8521_r, tc8521_w)
11466   AM_RANGE(0x1000, 0x1000) AM_WRITE(beep_w)
11567   AM_RANGE(0x1fff, 0x1fff) AM_WRITE(bank_w)
11668
r10844r10845
251203   m_blink = 0;
252204}
253205
206static const tc8521_interface pc4_tc8521_interface =
207{
208   NULL
209};
210
254211static MACHINE_CONFIG_START( pc4, pc4_state )
255212    /* basic machine hardware */
256213    MCFG_CPU_ADD("maincpu", Z80, XTAL_4MHz)
r10844r10845
272229   MCFG_SPEAKER_STANDARD_MONO( "mono" )
273230   MCFG_SOUND_ADD( "beep", BEEP, 0 )
274231   MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
232
233   MCFG_TC8521_ADD("rtc", pc4_tc8521_interface)
275234MACHINE_CONFIG_END
276235
277236ROM_START( pc4 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team