Previous 15994 Revisions Next

r14290 Tuesday 31st January, 2012 at 13:43:11 UTC by Curt Coder
[C64] Refactored the original C64 variants to use the PLA for memory mapping. This enables full cartridge support, and more accurate emulation of the hardware. WIP. [Curt Coder]
[src/mess]mess.lst mess.mak
[src/mess/drivers]c64.c c64x.c*
[src/mess/includes]c128.h c64.h c64x.h* c65.h
[src/mess/machine]c64.c c64_xl80.c c64exp.h cbmipt.c cbmipt.h
[src/mess/video]vic6567.c

src/mess/machine/cbmipt.c
r14289r14290
11091109   SLOT_INTERFACE("serialbox", SERIAL_BOX)
11101110SLOT_INTERFACE_END
11111111
1112SLOT_INTERFACE_START( sx1541_iec_devices )
1113   SLOT_INTERFACE("sx1541", SX1541)
1114SLOT_INTERFACE_END
1115
11121116SLOT_INTERFACE_START( cbm_ieee488_devices )
11131117   SLOT_INTERFACE("c2040", C2040)
11141118   SLOT_INTERFACE("c3040", C3040)
src/mess/machine/cbmipt.h
r14289r14290
8686
8787
8888extern const slot_interface slot_interface_cbm_iec_devices[];
89extern const slot_interface slot_interface_sx1541_iec_devices[];
8990extern const slot_interface slot_interface_cbm_ieee488_devices[];
9091extern const slot_interface slot_interface_vic20_expansion_cards[];
9192extern const slot_interface slot_interface_c64_expansion_cards[];
src/mess/machine/c64_xl80.c
r14289r14290
194194
195195   m_rom = subregion("roml")->base();
196196   m_char_rom = subregion(HD46505SP_TAG)->base();
197   m_video_ram = auto_alloc_array(machine(), UINT8, RAM_SIZE);;
197   m_video_ram = auto_alloc_array(machine(), UINT8, RAM_SIZE);
198198
199199   // state saving
200200   save_pointer(NAME(m_video_ram), RAM_SIZE);
src/mess/machine/c64.c
r14289r14290
4949
5050static void c64_nmi( running_machine &machine )
5151{
52   c64_state *state = machine.driver_data<c64_state>();
52   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
5353   device_t *cia_1 = machine.device("cia_1");
5454   int cia1irq = mos6526_irq_r(cia_1);
5555
r14289r14290
100100
101101static void c64_irq( running_machine &machine, int level )
102102{
103   c64_state *state = machine.driver_data<c64_state>();
103   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
104104   if (level != state->m_old_level)
105105   {
106106      DBG_LOG(machine, 3, "mos6510", ("irq %s\n", level ? "start" : "end"));
r14289r14290
111111
112112static void c64_cia0_interrupt( device_t *device, int level )
113113{
114   c64_state *state = device->machine().driver_data<c64_state>();
114   legacy_c64_state *state = device->machine().driver_data<legacy_c64_state>();
115115   c64_irq (device->machine(), level || state->m_vicirq);
116116}
117117
118WRITE_LINE_MEMBER( c64_state::c64_vic_interrupt )
118WRITE_LINE_MEMBER( legacy_c64_state::c64_vic_interrupt )
119119{
120120   device_t *cia_0 = machine().device("cia_0");
121121#if 1
r14289r14290
179179 */
180180static READ8_DEVICE_HANDLER( c64_cia1_port_a_r )
181181{
182   c64_state *state = device->machine().driver_data<c64_state>();
182   legacy_c64_state *state = device->machine().driver_data<legacy_c64_state>();
183183
184184   UINT8 value = 0xff;
185185
r14289r14290
194194
195195static WRITE8_DEVICE_HANDLER( c64_cia1_port_a_w )
196196{
197   c64_state *state = device->machine().driver_data<c64_state>();
197   legacy_c64_state *state = device->machine().driver_data<legacy_c64_state>();
198198   static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000};
199199
200200   state->m_iec->clk_w(!(data & 0x10));
r14289r14290
242242
243243WRITE8_HANDLER( c64_roml_w )
244244{
245   c64_state *state = space->machine().driver_data<c64_state>();
245   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
246246
247247   state->m_memory[offset + 0x8000] = data;
248248
r14289r14290
252252
253253WRITE8_HANDLER( c64_write_io )
254254{
255   c64_state *state = space->machine().driver_data<c64_state>();
255   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
256256   device_t *cia_0 = space->machine().device("cia_0");
257257   device_t *cia_1 = space->machine().device("cia_1");
258258   device_t *sid = space->machine().device("sid6581");
r14289r14290
282282
283283WRITE8_HANDLER( c64_ioarea_w )
284284{
285   c64_state *state = space->machine().driver_data<c64_state>();
285   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
286286   if (state->m_io_enabled)
287287      c64_write_io(space, offset, data);
288288   else
r14289r14290
291291
292292READ8_HANDLER( c64_read_io )
293293{
294   c64_state *state = space->machine().driver_data<c64_state>();
294   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
295295   device_t *cia_0 = space->machine().device("cia_0");
296296   device_t *cia_1 = space->machine().device("cia_1");
297297   device_t *sid = space->machine().device("sid6581");
r14289r14290
326326
327327READ8_HANDLER( c64_ioarea_r )
328328{
329   c64_state *state = space->machine().driver_data<c64_state>();
329   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
330330   return state->m_io_enabled ? c64_read_io(space, offset) : state->m_io_ram_r_ptr[offset];
331331}
332332
r14289r14290
446446
447447static void c64_bankswitch( running_machine &machine, int reset )
448448{
449   c64_state *state = machine.driver_data<c64_state>();
449   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
450450   int loram, hiram, charen;
451451   int ultimax_mode = 0;
452452   int data = m6510_get_port(machine.device<legacy_cpu_device>("maincpu")) & 0x07;
r14289r14290
549549
550550WRITE8_DEVICE_HANDLER(c64_m6510_port_write)
551551{
552   c64_state *state = device->machine().driver_data<c64_state>();
552   legacy_c64_state *state = device->machine().driver_data<legacy_c64_state>();
553553
554554   UINT8 direction = offset; // HACK ALERT!
555555
r14289r14290
600600
601601READ8_DEVICE_HANDLER(c64_m6510_port_read)
602602{
603   c64_state *state = device->machine().driver_data<c64_state>();
603   legacy_c64_state *state = device->machine().driver_data<legacy_c64_state>();
604604   UINT8 data = state->m_port_data;
605605
606606   if (state->m_tape_on)
r14289r14290
731731
732732READ8_HANDLER( c64_colorram_read )
733733{
734   c64_state *state = space->machine().driver_data<c64_state>();
734   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
735735   return state->m_colorram[offset & 0x3ff];
736736}
737737
738738WRITE8_HANDLER( c64_colorram_write )
739739{
740   c64_state *state = space->machine().driver_data<c64_state>();
740   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
741741   state->m_colorram[offset & 0x3ff] = data | 0xf0;
742742}
743743
r14289r14290
751751
752752static void c64_common_driver_init( running_machine &machine )
753753{
754   c64_state *state = machine.driver_data<c64_state>();
754   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
755755   cbm_common_init();
756756   state->m_game = 1;
757757   state->m_exrom = 1;
r14289r14290
781781
782782DRIVER_INIT( c64 )
783783{
784   c64_state *state = machine.driver_data<c64_state>();
784   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
785785   state->m_ultimax = 0;
786786   state->m_is_sx64 = 0;
787787   state->m_pal = 0;
r14289r14290
792792
793793DRIVER_INIT( c64pal )
794794{
795   c64_state *state = machine.driver_data<c64_state>();
795   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
796796   state->m_ultimax = 0;
797797   state->m_is_sx64 = 0;
798798   state->m_pal = 1;
r14289r14290
803803
804804DRIVER_INIT( ultimax )
805805{
806   c64_state *state = machine.driver_data<c64_state>();
806   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
807807   state->m_ultimax = 1;
808808   state->m_is_sx64 = 0;
809809   state->m_pal = 0;
r14289r14290
814814
815815DRIVER_INIT( c64gs )
816816{
817   c64_state *state = machine.driver_data<c64_state>();
817   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
818818   state->m_ultimax = 0;
819819   state->m_is_sx64 = 0;
820820   state->m_pal = 1;
r14289r14290
825825
826826DRIVER_INIT( sx64 )
827827{
828   c64_state *state = machine.driver_data<c64_state>();
828   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
829829   state->m_ultimax = 0;
830830   state->m_is_sx64 = 1;
831831   state->m_pal = 1;
r14289r14290
836836
837837MACHINE_START( c64 )
838838{
839   c64_state *state = machine.driver_data<c64_state>();
839   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
840840   state->m_port_data = 0x17;
841841
842842   state->m_io_mirror = auto_alloc_array(machine, UINT8, 0x1000);
r14289r14290
994994
995995static DEVICE_IMAGE_UNLOAD( c64_cart )
996996{
997   c64_state *state = image.device().machine().driver_data<c64_state>();
997   legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>();
998998   int i;
999999
10001000   for (i = 0; i < C64_MAX_ROMBANK; i++)
r14289r14290
10091009
10101010static DEVICE_START( c64_cart )
10111011{
1012   c64_state *state = device->machine().driver_data<c64_state>();
1012   legacy_c64_state *state = device->machine().driver_data<legacy_c64_state>();
10131013   /* In the first slot we can load a .crt file. In this case we want
10141014        to use game & exrom values from the header, not the default ones. */
10151015   state->m_cart.game = -1;
r14289r14290
10201020
10211021static int c64_crt_load( device_image_interface &image )
10221022{
1023   c64_state *state = image.device().machine().driver_data<c64_state>();
1023   legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>();
10241024   int size = image.length(), test, i = 0, ii;
10251025   int _80_loaded = 0, _90_loaded = 0, a0_loaded = 0, b0_loaded = 0, e0_loaded = 0, f0_loaded = 0;
10261026   const char *filetype = image.filetype();
r14289r14290
12781278   image.device().machine().firstcpu->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xdf00, 0xdf00, 0, 0xff, FUNC(_handler));
12791279
12801280#define allocate_cartridge_timer(_period, _func) \
1281   c64_state *state = image.device().machine().driver_data<c64_state>(); \
1281   legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>(); \
12821282   state->m_cartridge_timer = image.device().machine().scheduler().timer_alloc(FUNC(_func)); \
12831283   state->m_cartridge_timer->adjust(_period, 0);
12841284
12851285#define set_game_line(_machine, _state) \
1286   _machine.driver_data<c64_state>()->m_game = _state; \
1286   _machine.driver_data<legacy_c64_state>()->m_game = _state; \
12871287   c64_bankswitch(_machine, 0);
12881288
12891289INLINE void load_cartridge_region(device_image_interface &image, const char *name, offs_t offset, size_t size)
r14289r14290
12951295
12961296INLINE void map_cartridge_roml(running_machine &machine, offs_t offset)
12971297{
1298   c64_state *state = machine.driver_data<c64_state>();
1298   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
12991299   UINT8 *cart = machine.region("user1")->base();
13001300   memcpy(state->m_roml, cart + offset, 0x2000);
13011301}
13021302
13031303INLINE void map_cartridge_romh(running_machine &machine, offs_t offset)
13041304{
1305   c64_state *state = machine.driver_data<c64_state>();
1305   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
13061306   UINT8 *cart = machine.region("user1")->base();
13071307   memcpy(state->m_romh, cart + offset, 0x2000);
13081308}
13091309
13101310static void load_standard_c64_cartridge(device_image_interface &image)
13111311{
1312   c64_state *state = image.device().machine().driver_data<c64_state>();
1312   legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>();
13131313   UINT32 size;
13141314
13151315   // is there anything to load at 0x8000?
r14289r14290
14631463
14641464    */
14651465
1466   c64_state *state = space->machine().driver_data<c64_state>();
1466   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
14671467   UINT8 *cart = space->machine().region("user1")->base();
14681468
14691469   if (data == 0xff)
r14289r14290
15151515
15161516static WRITE8_HANDLER( multiscreen_bank_w )
15171517{
1518   c64_state *state = space->machine().driver_data<c64_state>();
1518   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
15191519   UINT8 *cart = space->machine().region("user1")->base();
15201520   int bank = data & 0x0f;
15211521   offs_t address = bank * 0x4000;
r14289r14290
15701570
15711571static READ8_HANDLER( super_explode_r )
15721572{
1573   c64_state *state = space->machine().driver_data<c64_state>();
1573   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
15741574
15751575   return state->m_roml[0x1f00 | offset];
15761576}
r14289r14290
15941594
15951595static void c64_software_list_cartridge_load(device_image_interface &image)
15961596{
1597   c64_state *state = image.device().machine().driver_data<c64_state>();
1597   legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>();
15981598
15991599   // initialize ROML and ROMH pointers
16001600   state->m_roml = state->m_c64_roml;
r14289r14290
16691669
16701670static DEVICE_IMAGE_LOAD( max_cart )
16711671{
1672   c64_state *state = image.device().machine().driver_data<c64_state>();
1672   legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>();
16731673   int result = IMAGE_INIT_PASS;
16741674
16751675   if (image.software_entry() != NULL)
r14289r14290
17091709
17101710static WRITE8_HANDLER( fc3_bank_w )
17111711{
1712   c64_state *state = space->machine().driver_data<c64_state>();
1712   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
17131713   // Type # 3
17141714   // working:
17151715   // not working:
r14289r14290
17391739
17401740static WRITE8_HANDLER( ocean1_bank_w )
17411741{
1742   c64_state *state = space->machine().driver_data<c64_state>();
1742   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
17431743   // Type # 5
17441744   // working: Double Dragon, Ghostbusters, Terminator 2
17451745   // not working: Pang, Robocop 2, Toki
r14289r14290
17741774
17751775static WRITE8_HANDLER( funplay_bank_w )
17761776{
1777   c64_state *state = space->machine().driver_data<c64_state>();
1777   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
17781778   // Type # 7
17791779   // working:
17801780   // not working:
r14289r14290
18041804
18051805static WRITE8_HANDLER( supergames_bank_w )
18061806{
1807   c64_state *state = space->machine().driver_data<c64_state>();
1807   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
18081808   // Type # 8
18091809   // working:
18101810   // not working:
r14289r14290
18431843
18441844static WRITE8_HANDLER( c64gs_bank_w )
18451845{
1846   c64_state *state = space->machine().driver_data<c64_state>();
1846   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
18471847   // Type # 15
18481848   // working:
18491849   // not working: The Last Ninja Remix
r14289r14290
18671867
18681868static READ8_HANDLER( dinamic_bank_r )
18691869{
1870   c64_state *state = space->machine().driver_data<c64_state>();
1870   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
18711871   // Type # 17
18721872   // working: Satan
18731873   // not working:
r14289r14290
18921892
18931893static READ8_HANDLER( zaxxon_bank_r )
18941894{
1895   c64_state *state = space->machine().driver_data<c64_state>();
1895   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
18961896   // Type # 18
18971897   // working:
18981898   // not working:
r14289r14290
19151915
19161916static WRITE8_HANDLER( domark_bank_w )
19171917{
1918   c64_state *state = space->machine().driver_data<c64_state>();
1918   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
19191919   // Type # 19
19201920   // working:
19211921   // not working:
r14289r14290
19381938
19391939static WRITE8_HANDLER( comal80_bank_w )
19401940{
1941   c64_state *state = space->machine().driver_data<c64_state>();
1941   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
19421942   // Type # 21
19431943   // working: Comal 80
19441944   // not working:
r14289r14290
19671967
19681968static void setup_c64_custom_mappers(running_machine &machine)
19691969{
1970   c64_state *state = machine.driver_data<c64_state>();
1970   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
19711971   address_space *space = machine.device( "maincpu")->memory().space( AS_PROGRAM );
19721972
19731973   switch (state->m_cart.mapper)
r14289r14290
20302030
20312031MACHINE_RESET( c64 )
20322032{
2033   c64_state *state = machine.driver_data<c64_state>();
2033   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
20342034   if (state->m_cart.n_banks)
20352035      setup_c64_custom_mappers(machine);
20362036}
src/mess/machine/c64exp.h
r14289r14290
7979};
8080
8181
82// ======================> device_c64_expansion_card_interface
82// ======================> c64_expansion_slot_device
8383
84// class representing interface-specific live c64_expansion card
85class device_c64_expansion_card_interface : public device_slot_card_interface
86{
87public:
88   // construction/destruction
89   device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device);
90   virtual ~device_c64_expansion_card_interface();
84class device_c64_expansion_card_interface;
9185
92   // memory access
93   virtual UINT8 c64_cd_r(offs_t offset, int roml, int romh, int io1, int io2) { return 0; };
94   virtual void c64_cd_w(offs_t offset, UINT8 data, int roml, int romh, int io1, int io2) { };
95
96   // memory banking
97   virtual int c64_game_r() { return 1; };
98   virtual int c64_exrom_r() { return 1; };
99
100   // reset
101   virtual void c64_reset_w() { };
102
103   // video
104   virtual UINT32 c64_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
105
106   virtual UINT8* get_cart_base() { return NULL; }
107};
108
109
110// ======================> c64_expansion_slot_device
111
11286class c64_expansion_slot_device : public device_t,
11387                          public c64_expansion_slot_interface,
11488                          public device_slot_interface,
r14289r14290
170144};
171145
172146
147// ======================> device_c64_expansion_card_interface
148
149class device_c64_expansion_card_interface : public device_slot_card_interface
150{
151public:
152   // construction/destruction
153   device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device);
154   virtual ~device_c64_expansion_card_interface();
155
156   // memory access
157   virtual UINT8 c64_cd_r(offs_t offset, int roml, int romh, int io1, int io2) { return 0; };
158   virtual void c64_cd_w(offs_t offset, UINT8 data, int roml, int romh, int io1, int io2) { };
159
160   // memory banking
161   virtual int c64_game_r() { return 1; };
162   virtual int c64_exrom_r() { return 1; };
163
164   // reset
165   virtual void c64_reset_w() { };
166
167   // video
168   virtual UINT32 c64_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
169
170   virtual UINT8* get_cart_base() { return NULL; }
171};
172
173
173174// device type definition
174175extern const device_type C64_EXPANSION_SLOT;
175176
src/mess/video/vic6567.c
r14289r14290
8080   vic2_type  type;
8181
8282   screen_device *screen;         // screen which sets bitmap properties
83   device_t *cpu;
83   cpu_device *cpu;
8484
8585   UINT8 rdy_cycles;
8686   UINT8 reg[0x80];
r14289r14290
997997   UINT8 mask;
998998   //static int adjust[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
999999
1000   UINT8 cpu_cycles = machine.device<cpu_device>("maincpu")->total_cycles() & 0xff;
1000   UINT8 cpu_cycles = vic2->cpu->total_cycles() & 0xff;
10011001   UINT8 vic_cycles = (vic2->cycles_counter + 1) & 0xff;
10021002   vic2->cycles_counter++;
10031003
r14289r14290
16071607
16081608   if ((cpu_cycles == vic_cycles) && (vic2->rdy_cycles > 0))
16091609   {
1610      device_spin_until_time (machine.firstcpu, machine.device<cpu_device>("maincpu")->cycles_to_attotime(vic2->rdy_cycles));
1610      device_spin_until_time (machine.firstcpu, vic2->cpu->cycles_to_attotime(vic2->rdy_cycles));
16111611      vic2->rdy_cycles = 0;
16121612   }
16131613
16141614   vic2->raster_x += 8;
1615   machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(pal_timer_callback), 0, vic2);
1615   machine.scheduler().timer_set(vic2->cpu->cycles_to_attotime(1), FUNC(pal_timer_callback), 0, vic2);
16161616}
16171617
16181618static TIMER_CALLBACK( ntsc_timer_callback )
r14289r14290
21912191   }
21922192
21932193   vic2->raster_x += 8;
2194   machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(ntsc_timer_callback), 0, vic2);
2194   machine.scheduler().timer_set(vic2->cpu->cycles_to_attotime(1), FUNC(ntsc_timer_callback), 0, vic2);
21952195}
21962196
21972197
r14289r14290
26072607   vic2->out_interrupt_func.resolve(intf->out_irq_cb, *device);
26082608   vic2->in_rdy_workaround_func.resolve(intf->in_rdy_cb, *device);
26092609
2610   vic2->cpu = device->machine().device(intf->cpu);
2610   vic2->cpu = device->machine().device<cpu_device>(intf->cpu);
26112611
26122612   vic2->screen = device->machine().device<screen_device>(intf->screen);
26132613   width = vic2->screen->width();
src/mess/includes/c65.h
r14289r14290
3737   UINT8 reg;
3838} expansion_ram_t;
3939
40class c65_state : public c64_state
40class c65_state : public legacy_c64_state
4141{
4242public:
4343   c65_state(const machine_config &mconfig, device_type type, const char *tag)
44      : c64_state(mconfig, type, tag) { }
44      : legacy_c64_state(mconfig, type, tag) { }
4545
4646   UINT8 *m_chargen;
4747   UINT8 *m_interface;
src/mess/includes/c128.h
r14289r14290
1717#include "includes/c64.h"
1818#include "machine/6526cia.h"
1919
20class c128_state : public c64_state
20class c128_state : public legacy_c64_state
2121{
2222public:
2323   c128_state(const machine_config &mconfig, device_type type, const char *tag)
24      : c64_state(mconfig, type, tag) { }
24      : legacy_c64_state(mconfig, type, tag) { }
2525
2626   DECLARE_READ8_MEMBER( vic_lightpen_x_cb );
2727   DECLARE_READ8_MEMBER( vic_lightpen_y_cb );
src/mess/includes/c64.h
r14289r14290
3232   UINT8       n_banks;
3333};
3434
35class c64_state : public driver_device
35class legacy_c64_state : public driver_device
3636{
3737public:
38   c64_state(const machine_config &mconfig, device_type type, const char *tag)
38   legacy_c64_state(const machine_config &mconfig, device_type type, const char *tag)
3939      : driver_device(mconfig, type, tag),
4040        m_iec(*this, CBM_IEC_TAG),
4141        m_roml_writable(0)
src/mess/includes/c64x.h
r0r14290
1#pragma once
2 
3#ifndef __C64X__
4#define __C64X__
5 
6#define ADDRESS_MAP_MODERN
7 
8#include "emu.h"
9#include "formats/cbm_snqk.h"
10#include "includes/cbm.h"
11#include "machine/6526cia.h"
12#include "machine/c64exp.h"
13#include "machine/c64user.h"
14#include "machine/cbmiec.h"
15#include "machine/cbmipt.h"
16#include "machine/ram.h"
17#include "sound/dac.h"
18#include "sound/sid6581.h"
19#include "video/vic6567.h"
20 
21#define M6510_TAG      "u7"
22#define MOS6567_TAG      "u19"
23#define MOS6569_TAG      "u19"
24#define MOS6851_TAG      "u18"
25#define MOS6526_1_TAG   "u1"
26#define MOS6526_2_TAG   "u2"
27#define SCREEN_TAG      "screen"
28#define TIMER_C1531_TAG   "c1531"
29 
30class c64_state : public driver_device
31{
32public:
33   c64_state(const machine_config &mconfig, device_type type, const char *tag)
34      : driver_device(mconfig, type, tag),
35        m_maincpu(*this, M6510_TAG),
36        m_vic(*this, MOS6569_TAG),
37        m_sid(*this, MOS6851_TAG),
38        m_cia1(*this, MOS6526_1_TAG),
39        m_cia2(*this, MOS6526_2_TAG),
40        m_iec(*this, CBM_IEC_TAG),
41        m_exp(*this, C64_EXPANSION_SLOT_TAG),
42        m_user(*this, C64_USER_PORT_TAG),
43        m_ram(*this, RAM_TAG),
44        m_cassette(*this, CASSETTE_TAG),
45        m_cassette_timer(*this, TIMER_C1531_TAG),
46        m_loram(1),
47        m_hiram(1),
48        m_charen(1),
49        m_cia1_irq(CLEAR_LINE),
50        m_cia2_irq(CLEAR_LINE),
51        m_vic_irq(CLEAR_LINE),
52        m_exp_irq(CLEAR_LINE),
53        m_exp_nmi(CLEAR_LINE),
54        m_cass_rd(1),
55        m_iec_srq(1)
56   { }
57 
58   required_device<cpu_device> m_maincpu;
59   required_device<device_t> m_vic;
60   required_device<device_t> m_sid;
61   required_device<mos6526_device> m_cia1;
62   required_device<mos6526_device> m_cia2;
63   optional_device<cbm_iec_device> m_iec;
64   required_device<c64_expansion_slot_device> m_exp;
65   required_device<c64_user_port_device> m_user;
66   required_device<ram_device> m_ram;
67   required_device<cassette_image_device> m_cassette;
68   required_device<timer_device> m_cassette_timer;
69 
70   virtual void machine_start();
71   virtual UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
72   
73   void check_interrupts();
74   void bankswitch(offs_t offset, offs_t va, int rw, int aec, int ba, int cas, int *casram, int *basic, int *kernal, int *charom, int *grw, int *io, int *roml, int *romh);
75   UINT8 read_memory(address_space &space, offs_t offset, int casram, int basic, int kernal, int charom, int io, int roml, int romh);
76   
77   DECLARE_READ8_MEMBER( read );
78   DECLARE_WRITE8_MEMBER( write );
79 
80   DECLARE_READ8_MEMBER( vic_lightpen_x_cb );
81   DECLARE_READ8_MEMBER( vic_lightpen_y_cb );
82   DECLARE_READ8_MEMBER( vic_lightpen_button_cb );
83   DECLARE_READ8_MEMBER( vic_dma_read );
84   DECLARE_READ8_MEMBER( vic_dma_read_color );
85   DECLARE_WRITE_LINE_MEMBER( vic_irq_w );
86   DECLARE_READ8_MEMBER( vic_rdy_cb );
87   DECLARE_WRITE_LINE_MEMBER( cia1_irq_w );
88   DECLARE_READ8_MEMBER( cia1_pa_r );
89   DECLARE_READ8_MEMBER( cia1_pb_r );
90   DECLARE_WRITE8_MEMBER( cia1_pb_w );
91   DECLARE_WRITE_LINE_MEMBER( cia2_irq_w );
92   DECLARE_READ8_MEMBER( cia2_pa_r );
93   DECLARE_WRITE8_MEMBER( cia2_pa_w );
94   DECLARE_READ8_MEMBER( cpu_r );
95   DECLARE_WRITE8_MEMBER( cpu_w );
96   DECLARE_WRITE_LINE_MEMBER( iec_srq_w );
97   DECLARE_WRITE_LINE_MEMBER( exp_irq_w );
98   DECLARE_WRITE_LINE_MEMBER( exp_nmi_w );
99   
100   // memory state
101   int m_loram;
102   int m_hiram;
103   int m_charen;
104   UINT8 *m_basic;
105   UINT8 *m_kernal;
106   UINT8 *m_charom;
107   
108   // video state
109   UINT8 *m_color_ram;
110   int m_va14;
111   int m_va15;
112   
113   // interrupt state
114   int m_cia1_irq;
115   int m_cia2_irq;
116   int m_vic_irq;
117   int m_exp_irq;
118   int m_exp_nmi;
119   int m_cass_rd;
120   int m_iec_srq;
121};
122 
123#endif
src/mess/mess.lst
r14289r14290
549549
550550max      // Commodore Max Machine (Japan)
551551c64      // Commodore 64 (NTSC)
552c64pal   // Commodore 64 (PAL)
553c64jpn   // Commodore 64 (Japan)
554c64swe   // Commodore 64 (Sweden)
555vic64s   // Commodore VIC 64S (Sweden)
552c64n
553c64p   // Commodore 64 (PAL)
554c64j   // Commodore 64 (Japan)
555c64sw   // Commodore 64 (Sweden)
556556pet64    // Commodore PET 64
557cbm4064   // Commodore CBM 4064
558557edu64    // Commodore Educator 64
559558//  clipper  // C64 in a briefcase with 3" floppy, electroluminescent flat screen, thermal printer
560559//  tesa6240  //  modified SX64 with label printer
src/mess/mess.mak
r14289r14290
747747   $(MESS_DRIVERS)/pet.o      \
748748   $(MESS_MACHINE)/pet.o      \
749749   $(MESS_DRIVERS)/c64.o      \
750   $(MESS_DRIVERS)/c64x.o      \
750751   $(MESS_MACHINE)/c64exp.o   \
751752   $(MESS_MACHINE)/c64user.o   \
752753   $(MESS_MACHINE)/c64_std.o   \
src/mess/drivers/c64.c
r14289r14290
399399 *************************************/
400400
401401static ADDRESS_MAP_START(ultimax_mem , AS_PROGRAM, 8)
402   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE_MEMBER(c64_state, m_memory)
403   AM_RANGE(0x8000, 0x9fff) AM_ROM AM_BASE_MEMBER(c64_state, m_c64_roml)
402   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE_MEMBER(legacy_c64_state, m_memory)
403   AM_RANGE(0x8000, 0x9fff) AM_ROM AM_BASE_MEMBER(legacy_c64_state, m_c64_roml)
404404   AM_RANGE(0xd000, 0xd3ff) AM_DEVREADWRITE("vic2", vic2_port_r, vic2_port_w)
405405   AM_RANGE(0xd400, 0xd7ff) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)
406   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE( c64_colorram_write) AM_BASE_MEMBER(c64_state, m_colorram) /* colorram  */
406   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE( c64_colorram_write) AM_BASE_MEMBER(legacy_c64_state, m_colorram) /* colorram  */
407407   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE("cia_0", mos6526_r, mos6526_w)
408   AM_RANGE(0xe000, 0xffff) AM_ROM AM_BASE_MEMBER(c64_state, m_c64_romh)            /* ram or kernel rom */
408   AM_RANGE(0xe000, 0xffff) AM_ROM AM_BASE_MEMBER(legacy_c64_state, m_c64_romh)            /* ram or kernel rom */
409409ADDRESS_MAP_END
410410
411411static ADDRESS_MAP_START(c64_mem, AS_PROGRAM, 8)
412   AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE_MEMBER(c64_state, m_memory)
412   AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE_MEMBER(legacy_c64_state, m_memory)
413413   AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank1") AM_WRITE(c64_roml_w)      /* ram or external roml */
414414   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank3") AM_WRITEONLY            /* ram or basic rom or external romh */
415415   AM_RANGE(0xc000, 0xcfff) AM_RAM
r14289r14290
460460INPUT_PORTS_END
461461
462462
463static INPUT_PORTS_START (vic64s)
464   PORT_INCLUDE( c64 )
465463
466   PORT_MODIFY( "ROW5" )
467   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa5") PORT_CODE(KEYCODE_OPENBRACE)   PORT_CHAR('\xA5')
468   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON)                        PORT_CHAR(';') PORT_CHAR(']')
469   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)                     PORT_CHAR('=')
470   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS)                        PORT_CHAR('-')
471
472   PORT_MODIFY( "ROW6" )
473   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa4") PORT_CODE(KEYCODE_BACKSLASH)   PORT_CHAR('\xA4')
474   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xb6") PORT_CODE(KEYCODE_QUOTE)      PORT_CHAR('\xB6')
475   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)                  PORT_CHAR('@')
476   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2)                  PORT_CHAR(':') PORT_CHAR('*')
477INPUT_PORTS_END
478
479464static INPUT_PORTS_START (vip64)
480465   PORT_INCLUDE( c64 )
481466
r14289r14290
523508   }
524509}
525510
526static PALETTE_INIT( pet64 )
527{
528   int i;
529   for (i = 0; i < 16; i++)
530      palette_set_color_rgb(machine, i, 0, c64_palette[i * 3 + 1], 0);
531}
532511
533
534512/*************************************
535513 *
536514 *  Sound definitions
r14289r14290
552530   DEVCB_HANDLER(c64_m6510_port_write)
553531};
554532
555static SLOT_INTERFACE_START( sx1541_iec_devices )
556   SLOT_INTERFACE("sx1541", SX1541)
557SLOT_INTERFACE_END
558
559533static CBM_IEC_INTERFACE( cbm_iec_intf )
560534{
561535   DEVCB_NULL,
r14289r14290
580554   return 0;
581555}
582556
583READ8_MEMBER( c64_state::c64_lightpen_x_cb )
557READ8_MEMBER( legacy_c64_state::c64_lightpen_x_cb )
584558{
585559   return input_port_read(machine(), "LIGHTX") & ~0x01;
586560}
587561
588READ8_MEMBER( c64_state::c64_lightpen_y_cb )
562READ8_MEMBER( legacy_c64_state::c64_lightpen_y_cb )
589563{
590564   return input_port_read(machine(), "LIGHTY") & ~0x01;
591565}
592566
593READ8_MEMBER( c64_state::c64_lightpen_button_cb )
567READ8_MEMBER( legacy_c64_state::c64_lightpen_button_cb )
594568{
595569   return input_port_read(machine(), "OTHER") & 0x04;
596570}
597571
598READ8_MEMBER( c64_state::c64_dma_read )
572READ8_MEMBER( legacy_c64_state::c64_dma_read )
599573{
600574   if (!m_game && m_exrom)
601575   {
r14289r14290
611585   return m_vicaddr[offset];
612586}
613587
614READ8_MEMBER( c64_state::c64_dma_read_ultimax )
588READ8_MEMBER( legacy_c64_state::c64_dma_read_ultimax )
615589{
616590   if (offset < 0x3000)
617591      return m_memory[offset];
r14289r14290
619593   return m_c64_romh[offset & 0x1fff];
620594}
621595
622READ8_MEMBER( c64_state::c64_dma_read_color )
596READ8_MEMBER( legacy_c64_state::c64_dma_read_color )
623597{
624598   return m_colorram[offset & 0x3ff] & 0xf;
625599}
626600
627READ8_MEMBER( c64_state::c64_rdy_cb )
601READ8_MEMBER( legacy_c64_state::c64_rdy_cb )
628602{
629603   return input_port_read(machine(), "CYCLES") & 0x07;
630604}
r14289r14290
633607   "screen",
634608   "maincpu",
635609   VIC6567,
636   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb),
637   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb),
638   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb),
639   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read),
640   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color),
641   DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt),
642   DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb)
610   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_x_cb),
611   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_y_cb),
612   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_button_cb),
613   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_dma_read),
614   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_dma_read_color),
615   DEVCB_DRIVER_LINE_MEMBER(legacy_c64_state, c64_vic_interrupt),
616   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_rdy_cb)
643617};
644618
645619static const vic2_interface c64_vic2_pal_intf = {
646620   "screen",
647621   "maincpu",
648622   VIC6569,
649   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb),
650   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb),
651   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb),
652   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read),
653   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color),
654   DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt),
655   DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb)
623   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_x_cb),
624   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_y_cb),
625   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_button_cb),
626   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_dma_read),
627   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_dma_read_color),
628   DEVCB_DRIVER_LINE_MEMBER(legacy_c64_state, c64_vic_interrupt),
629   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_rdy_cb)
656630};
657631
658632static const vic2_interface ultimax_vic2_intf = {
659633   "screen",
660634   "maincpu",
661635   VIC6567,
662   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb),
663   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb),
664   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb),
665   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_ultimax),
666   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color),
667   DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt),
668   DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb)
636   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_x_cb),
637   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_y_cb),
638   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_lightpen_button_cb),
639   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_dma_read_ultimax),
640   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_dma_read_color),
641   DEVCB_DRIVER_LINE_MEMBER(legacy_c64_state, c64_vic_interrupt),
642   DEVCB_DRIVER_MEMBER(legacy_c64_state, c64_rdy_cb)
669643};
670644
671645static C64_EXPANSION_INTERFACE( c64_expansion_intf )
r14289r14290
683657 *
684658 *************************************/
685659
686static MACHINE_CONFIG_START( ultimax, c64_state )
660static MACHINE_CONFIG_START( ultimax, legacy_c64_state )
687661   /* basic machine hardware */
688662   MCFG_CPU_ADD("maincpu", M6510, VIC6567_CLOCK)
689663   MCFG_CPU_PROGRAM_MAP( ultimax_mem)
r14289r14290
731705   MCFG_C64_EXPANSION_SLOT_ADD("exp", c64_expansion_intf, c64_expansion_cards, NULL, NULL)
732706MACHINE_CONFIG_END
733707
734static MACHINE_CONFIG_START( c64, c64_state )
708static MACHINE_CONFIG_START( c64, legacy_c64_state )
735709   /* basic machine hardware */
736710   MCFG_CPU_ADD("maincpu", M6510, VIC6567_CLOCK)
737711   MCFG_CPU_PROGRAM_MAP(c64_mem)
r14289r14290
783757   MCFG_C64_EXPANSION_SLOT_ADD("exp", c64_expansion_intf, c64_expansion_cards, NULL, NULL)
784758MACHINE_CONFIG_END
785759
786static MACHINE_CONFIG_START( c64pal, c64_state )
760static MACHINE_CONFIG_START( c64pal, legacy_c64_state )
787761   MCFG_CPU_ADD( "maincpu", M6510, VIC6569_CLOCK)
788762   MCFG_CPU_PROGRAM_MAP(c64_mem)
789763   MCFG_CPU_CONFIG( c64_m6510_interface )
r14289r14290
834808   MCFG_C64_EXPANSION_SLOT_ADD("exp", c64_expansion_intf, c64_expansion_cards, NULL, NULL)
835809MACHINE_CONFIG_END
836810
837static MACHINE_CONFIG_DERIVED( pet64, c64 )
838   MCFG_PALETTE_INIT( pet64 )
839MACHINE_CONFIG_END
840
841static MACHINE_CONFIG_START( c64gs, c64_state )
811static MACHINE_CONFIG_START( c64gs, legacy_c64_state )
842812   MCFG_CPU_ADD( "maincpu", M6510, VIC6569_CLOCK)
843813   MCFG_CPU_PROGRAM_MAP(c64_mem)
844814   MCFG_CPU_CONFIG( c64_m6510_interface )
r14289r14290
879849   MCFG_C64_EXPANSION_SLOT_ADD("exp", c64_expansion_intf, c64_expansion_cards, NULL, NULL)
880850MACHINE_CONFIG_END
881851
882static MACHINE_CONFIG_START( sx64, c64_state )
852static MACHINE_CONFIG_START( sx64, legacy_c64_state )
883853   MCFG_CPU_ADD( "maincpu", M6510, VIC6569_CLOCK)
884854   MCFG_CPU_PROGRAM_MAP(c64_mem)
885855   MCFG_CPU_CONFIG( c64_m6510_interface )
r14289r14290
961931   ROM_REGION( 0x80000, "user1", ROMREGION_ERASE00 )
962932ROM_END
963933
964#define rom_c64pal   rom_c64
965
966ROM_START( c64jpn )
967   ROM_REGION( 0x19400, "maincpu", 0 )
968   ROM_LOAD( "901226-01.bin", 0x10000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
969   ROM_LOAD( "906145-02.bin", 0x12000, 0x2000, CRC(3a9ef6f1) SHA1(4ff0f11e80f4b57430d8f0c3799ed0f0e0f4565d) )
970   ROM_LOAD( "906143-02.bin", 0x14000, 0x1000, CRC(1604f6c1) SHA1(0fad19dbcdb12461c99657b2979dbb5c2e47b527) )
971
972   ROM_REGION( 0x80000, "user1", ROMREGION_ERASE00 )
973ROM_END
974
975
976ROM_START( vic64s )
977   ROM_REGION( 0x19400, "maincpu", 0 )
978   ROM_LOAD( "901226-01.bin",   0x10000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
979   ROM_LOAD( "kernel.swe",   0x12000, 0x2000, CRC(f10c2c25) SHA1(e4f52d9b36c030eb94524eb49f6f0774c1d02e5e) )
980   ROM_SYSTEM_BIOS(0, "default", "Swedish Characters" )
981   ROMX_LOAD( "charswe.bin",0x14000, 0x1000, CRC(bee9b3fd) SHA1(446ae58f7110d74d434301491209299f66798d8a), ROM_BIOS(1) )
982   ROM_SYSTEM_BIOS(1, "alt", "Swedish Characters (Alt)" )
983   ROMX_LOAD( "charswe2.bin",0x14000, 0x1000, CRC(377a382b) SHA1(20df25e0ba1c88f31689c1521397c96968967fac), ROM_BIOS(2) )
984
985   ROM_REGION( 0x80000, "user1", ROMREGION_ERASE00 )
986ROM_END
987
988#define rom_c64swe   rom_vic64s
989
990ROM_START( pet64 )
991   ROM_REGION( 0x19400, "maincpu", 0 )
992   ROM_LOAD( "901226-01.bin", 0x10000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
993   ROM_LOAD( "901246-01.bin", 0x12000, 0x2000, CRC(789c8cc5) SHA1(6c4fa9465f6091b174df27dfe679499df447503c) )
994   ROM_LOAD( "901225-01.bin", 0x14000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) )
995
996   ROM_REGION( 0x80000, "user1", ROMREGION_ERASE00 )
997ROM_END
998
999#define rom_cbm4064 rom_pet64
1000#define rom_edu64   rom_c64
1001
1002934ROM_START( sx64 )
1003935   ROM_REGION( 0x19400, "maincpu", 0 )
1004936   ROM_LOAD( "901226-01.ud4", 0x10000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
r14289r14290
10871019COMP(1982, max,      0,    0,    ultimax, c64,     ultimax, "Commodore Business Machines", "Commodore Max Machine", 0)
10881020
10891021COMP(1982, c64,     0,    0,    c64,     c64,     c64,     "Commodore Business Machines", "Commodore 64 (NTSC)", 0)
1090COMP(1982, c64pal,  c64,  0,    c64pal,  c64,     c64pal,  "Commodore Business Machines", "Commodore 64 (PAL)",  0)
1091COMP(1982, c64jpn,  c64,  0,    c64,     c64,     c64,     "Commodore Business Machines", "Commodore 64 (Japan)", 0)
1092COMP(1982, vic64s,  c64,  0,    c64pal,  vic64s,  c64pal,  "Commodore Business Machines", "VIC 64S", 0)
1093COMP(1982, c64swe,  c64,  0,    c64pal,  vic64s,  c64pal,  "Commodore Business Machines", "Commodore 64 (Sweden/Finland)", 0)
10941022
1095COMP(1983, pet64,   c64,  0,    pet64,   c64,     c64,     "Commodore Business Machines", "PET 64 (NTSC)", 0)
1096COMP(1983, cbm4064, c64,  0,    pet64,   c64,     c64,     "Commodore Business Machines", "CBM 4064 (NTSC)", 0)
1097COMP(1983, edu64,   c64,  0,    pet64,   c64,     c64,     "Commodore Business Machines", "Educator 64 (NTSC)", 0) // maybe different palette?
10981023//COMP(1983, clipper,  c64,  0, c64pal,  clipper, c64pal,  "PDC", "Clipper", GAME_NOT_WORKING) // C64 in a briefcase with 3" floppy, electroluminescent flat screen, thermal printer
10991024//COMP(1983, tesa6240, c64,  0, c64pal,  c64,     c64pal,  "Tesa", "6240", GAME_NOT_WORKING) // modified SX64 with label printer
11001025
src/mess/drivers/c64x.c
r0r14290
1/*
2 
3   TODO:
4   
5   - PLA dump (http://www.zimmers.net/cbmpics/cbm/c64/pla.txt)
6   - cartridge loading
7   - migrate remaining drivers from c64.c
8 
9*/
10 
11#include "includes/c64x.h"
12 
13 
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
17 
18#define A15 BIT(offset, 15)
19#define A14 BIT(offset, 14)
20#define A13 BIT(offset, 13)
21#define A12 BIT(offset, 12)
22#define VA13 BIT(va, 13)
23#define VA12 BIT(va, 12)
24 
25 
26 
27//**************************************************************************
28//  INTERRUPTS
29//**************************************************************************
30 
31//-------------------------------------------------
32//  check_interrupts -
33//-------------------------------------------------
34 
35void c64_state::check_interrupts()
36{
37   int restore = BIT(input_port_read(machine(), "SPECIAL"), 7);
38   
39   m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_cia1_irq | m_vic_irq | m_exp_irq);
40   m_maincpu->set_input_line(INPUT_LINE_NMI, m_cia2_irq | restore | m_exp_nmi);
41   
42   mos6526_flag_w(m_cia1, m_cass_rd & m_iec_srq);
43}
44 
45 
46 
47//**************************************************************************
48//  MEMORY MANAGEMENT UNIT
49//**************************************************************************
50 
51//-------------------------------------------------
52//  bankswitch -
53//-------------------------------------------------
54 
55void c64_state::bankswitch(offs_t offset, offs_t va, int rw, int aec, int ba, int cas, int *casram, int *basic, int *kernal, int *charom, int *grw, int *io, int *roml, int *romh)
56{
57   int game = m_exp->game_r();
58   int exrom = m_exp->exrom_r();
59 
60   *romh = (m_hiram & A15 & !A14 & A13 & !aec & rw & !exrom & !game 
61         || A15 & A14 & A13 & !aec & exrom & !game 
62         || aec & exrom & !game & VA13 & VA12);
63 
64   *roml = (m_loram & m_hiram & A15 & !A14 & !A13 & !aec & rw & !exrom 
65         || A15 & !A14 & !A13 & !aec & exrom & !game);
66 
67   *io = (m_hiram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & game 
68         || m_hiram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & game 
69         || m_loram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & game 
70         || m_loram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & game 
71         || m_hiram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & !exrom & !game 
72         || m_hiram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & !exrom & !game 
73         || m_loram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & !exrom & !game 
74         || m_loram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & !exrom & !game 
75         || A15 & A14 & !A13 & A12 & ba & !aec & rw & exrom & !game 
76         || A15 & A14 & !A13 & A12 & !aec & !rw & exrom & !game);
77 
78   *grw = (!cas & A15 & A14 & !A13 & A12 &   !aec & !rw);
79   
80   *charom = (m_hiram & !m_charen & A15 & A14 & !A13 & A12 & !aec & rw & game 
81         || m_loram & !m_charen & A15 & A14 & !A13 & A12 & !aec & rw & game 
82         || m_hiram & !m_charen & A15 & A14 & !A13 & A12 & !aec & rw & !exrom & !game 
83         || m_va14 & aec & game & !VA13 & VA12 
84         || m_va14 & aec & !exrom & !game & !VA13 & VA12);               
85 
86   *kernal = (m_hiram & A15 & A14 & A13 & !aec & rw & game 
87         || m_hiram & A15 & A14 & A13 & !aec & rw & !exrom & !game);
88             
89   *basic = (m_loram & m_hiram & A15 & !A14 & A13 & !aec & rw & game);
90 
91   *casram = !(m_loram & m_hiram & A15 & !A14 & A13 & !aec & rw & game 
92         || m_hiram & A15 & A14 & A13 & !aec & rw & game 
93         || m_hiram & A15 & A14 & A13 & !aec & rw & !exrom & !game 
94         || m_hiram & !m_charen & A15 & A14 & !A13 & A12 & !aec & rw & game 
95         || m_loram & !m_charen & A15 & A14 & !A13 & A12 & !aec & rw & game 
96         || m_hiram & !m_charen & A15 & A14 & !A13 & A12 & !aec & rw & !exrom & !game 
97         || m_va14 & aec & game & !VA13 & VA12 
98         || m_va14 & aec & !exrom & !game & !VA13 & VA12 
99         || m_hiram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & game 
100         || m_hiram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & game 
101         || m_loram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & game 
102         || m_loram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & game 
103         || m_hiram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & !exrom & !game 
104         || m_hiram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & !exrom & !game 
105         || m_loram & m_charen & A15 & A14 & !A13 & A12 & ba & !aec & rw & !exrom & !game 
106         || m_loram & m_charen & A15 & A14 & !A13 & A12 & !aec & !rw & !exrom & !game 
107         || A15 & A14 & !A13 & A12 & ba & !aec & rw & exrom & !game 
108         || A15 & A14 & !A13 & A12 & !aec & !rw & exrom & !game 
109         || m_loram & m_hiram & A15 & !A14 & !A13 & !aec & rw & !exrom 
110         || A15 & !A14 & !A13 & !aec & exrom & !game 
111         || m_hiram & A15 & !A14 & A13 & !aec & rw & !exrom & !game 
112         || A15 & A14 & A13 & !aec & exrom & !game 
113         || aec & exrom & !game & VA13 & VA12 
114         || !A15 & !A14 & A12 & exrom & !game 
115         || !A15 & !A14 & A13 & exrom & !game 
116         || !A15 & A14 & exrom & !game 
117         || A15 & !A14 & A13 & exrom & !game 
118         || A15 & A14 & !A13 & !A12 & exrom & !game 
119         || cas);
120}
121 
122 
123//-------------------------------------------------
124//  read_memory -
125//-------------------------------------------------
126 
127UINT8 c64_state::read_memory(address_space &space, offs_t offset, int casram, int basic, int kernal, int charom, int io, int roml, int romh)
128{
129   UINT8 data = 0;
130   
131   if (casram)
132   {
133      data = m_ram->pointer()[offset];
134   }
135   else if (basic)
136   {
137      data = m_basic[offset & 0x1fff];
138   }
139   else if (kernal)
140   {
141      data = m_kernal[offset & 0x1fff];
142   }
143   else if (charom)
144   {
145      data = m_charom[offset & 0xfff];
146   }
147   else if (io)
148   {
149      switch ((offset >> 10) & 0x03)
150      {
151      case 0: // VIC
152         data = vic2_port_r(m_vic, offset & 0x3f);
153         break;
154 
155      case 1: // SID
156         data = sid6581_r(m_sid, offset & 0x1f);
157         break;
158 
159      case 2: // COLOR
160         data = m_color_ram[offset & 0x3ff];
161         break;
162 
163      case 3: // CIAS
164         switch ((offset >> 8) & 0x03)
165         {
166         case 0: // CIA1
167            if (offset & 1)
168               cia_set_port_mask_value(m_cia1, 1, input_port_read(machine(), "CTRLSEL") & 0x80 ? c64_keyline[9] : c64_keyline[8] );
169            else
170               cia_set_port_mask_value(m_cia1, 0, input_port_read(machine(), "CTRLSEL") & 0x80 ? c64_keyline[8] : c64_keyline[9] );
171               
172            data = mos6526_r(m_cia1, offset & 0x0f);
173            break;
174             
175         case 1: // CIA2
176            data = mos6526_r(m_cia2, offset & 0x0f);
177            break;
178             
179         case 2: // I/O1
180            data = m_exp->io1_r(space, offset);
181            break;
182             
183         case 3: // I/O2
184            data = m_exp->io2_r(space, offset);
185            break;
186         }
187         break;
188      }
189   }
190   else if (roml)
191   {
192      data = m_exp->roml_r(space, offset);
193   }
194   else if (romh)
195   {
196      data = m_exp->romh_r(space, offset);
197   }
198   
199   return data;
200}
201 
202 
203//-------------------------------------------------
204//  read -
205//-------------------------------------------------
206 
207READ8_MEMBER( c64_state::read )
208{
209   int casram, basic, kernal, charom, grw, io, roml, romh;
210   
211   bankswitch(offset, 0, 1, 0, 1, 0, &casram, &basic, &kernal, &charom, &grw, &io, &roml, &romh);
212   
213   return read_memory(space, offset, casram, basic, kernal, charom, io, roml, romh);
214}
215 
216 
217//-------------------------------------------------
218//  write -
219//-------------------------------------------------
220 
221WRITE8_MEMBER( c64_state::write )
222{
223   int casram, basic, kernal, charom, grw, io, roml, romh;
224   
225   bankswitch(offset, 0, 0, 0, 1, 0, &casram, &basic, &kernal, &charom, &grw, &io, &roml, &romh);
226 
227   if (casram)
228   {
229      m_ram->pointer()[offset] = data;
230   }
231   else if (io)
232   {
233      switch ((offset >> 10) & 0x03)
234      {
235      case 0: // VIC
236         vic2_port_w(m_vic, offset & 0x3f, data);
237         break;
238 
239      case 1: // SID
240         sid6581_w(m_sid, offset & 0x1f, data);
241         break;
242 
243      case 2: // COLOR
244         if (grw) m_color_ram[offset & 0x3ff] = 0xf0 | data;
245         break;
246 
247      case 3: // CIAS
248         switch ((offset >> 8) & 0x03)
249         {
250         case 0: // CIA1
251            mos6526_w(m_cia1, offset & 0x0f, data);
252            break;
253             
254         case 1: // CIA2
255            mos6526_w(m_cia2, offset & 0x0f, data);
256            break;
257             
258         case 2: // I/O1
259            m_exp->io1_w(space, offset, data);
260            break;
261             
262         case 3: // I/O2
263            m_exp->io2_w(space, offset, data);
264            break;
265         }
266         break;
267      }
268   }
269}
270 
271 
272 
273//**************************************************************************
274//  ADDRESS MAPS
275//**************************************************************************
276 
277//-------------------------------------------------
278//  ADDRESS_MAP( c64_mem )
279//-------------------------------------------------
280 
281static ADDRESS_MAP_START( c64_mem, AS_PROGRAM, 8, c64_state )
282   AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write)
283ADDRESS_MAP_END
284 
285 
286 
287//**************************************************************************
288//  INPUT PORTS
289//**************************************************************************
290 
291//-------------------------------------------------
292//  INPUT_PORTS( c64 )
293//-------------------------------------------------
294 
295static INPUT_PORTS_START( c64 )
296   PORT_INCLUDE( common_cbm_keyboard )      // ROW0 -> ROW7
297 
298   PORT_INCLUDE( c64_special )            // SPECIAL
299 
300   PORT_INCLUDE( c64_controls )         // CTRLSEL, JOY0, JOY1, PADDLE0 -> PADDLE3, TRACKX, TRACKY, LIGHTX, LIGHTY, OTHER
301INPUT_PORTS_END
302 
303 
304//-------------------------------------------------
305//  INPUT_PORTS( c64sw )
306//-------------------------------------------------
307 
308static INPUT_PORTS_START( c64sw )
309   PORT_INCLUDE( c64 )
310 
311   PORT_MODIFY( "ROW5" )
312   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa5") PORT_CODE(KEYCODE_OPENBRACE)   PORT_CHAR('\xA5')
313   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON)                        PORT_CHAR(';') PORT_CHAR(']')
314   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)                     PORT_CHAR('=')
315   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS)                        PORT_CHAR('-')
316 
317   PORT_MODIFY( "ROW6" )
318   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xa4") PORT_CODE(KEYCODE_BACKSLASH)   PORT_CHAR('\xA4')
319   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xc3\xb6") PORT_CODE(KEYCODE_QUOTE)      PORT_CHAR('\xB6')
320   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)                  PORT_CHAR('@')
321   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2)                  PORT_CHAR(':') PORT_CHAR('*')
322INPUT_PORTS_END
323 
324 
325 
326//**************************************************************************
327//  DEVICE CONFIGURATION
328//**************************************************************************
329 
330//-------------------------------------------------
331//  vic2_interface vic_intf
332//-------------------------------------------------
333 
334static const unsigned char c64_palette[] =
335{
336// black, white, red, cyan
337// purple, green, blue, yellow
338// orange, brown, light red, dark gray,
339// medium gray, light green, light blue, light gray
340// taken from the vice emulator
341   0x00, 0x00, 0x00,  0xfd, 0xfe, 0xfc,  0xbe, 0x1a, 0x24,  0x30, 0xe6, 0xc6,
342   0xb4, 0x1a, 0xe2,  0x1f, 0xd2, 0x1e,  0x21, 0x1b, 0xae,  0xdf, 0xf6, 0x0a,
343   0xb8, 0x41, 0x04,  0x6a, 0x33, 0x04,  0xfe, 0x4a, 0x57,  0x42, 0x45, 0x40,
344   0x70, 0x74, 0x6f,  0x59, 0xfe, 0x59,  0x5f, 0x53, 0xfe,  0xa4, 0xa7, 0xa2
345};
346 
347static PALETTE_INIT( c64 )
348{
349   int i;
350 
351   for (i = 0; i < sizeof(c64_palette) / 3; i++)
352   {
353      palette_set_color_rgb(machine, i, c64_palette[i * 3], c64_palette[i * 3 + 1], c64_palette[i * 3 + 2]);
354   }
355}
356 
357static PALETTE_INIT( pet64 )
358{
359   int i;
360   for (i = 0; i < 16; i++)
361      palette_set_color_rgb(machine, i, 0, c64_palette[i * 3 + 1], 0);
362}
363 
364UINT32 c64_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
365{
366   vic2_video_update(m_vic, bitmap, cliprect);
367 
368   return 0;
369}
370 
371static INTERRUPT_GEN( c64_frame_interrupt )
372{
373   c64_state *state = device->machine().driver_data<c64_state>();
374   
375   state->check_interrupts();
376   cbm_common_interrupt(device);
377}
378 
379READ8_MEMBER( c64_state::vic_lightpen_x_cb )
380{
381   return input_port_read(machine(), "LIGHTX") & ~0x01;
382}
383 
384READ8_MEMBER( c64_state::vic_lightpen_y_cb )
385{
386   return input_port_read(machine(), "LIGHTY") & ~0x01;
387}
388 
389READ8_MEMBER( c64_state::vic_lightpen_button_cb )
390{
391   return input_port_read(machine(), "OTHER") & 0x04;
392}
393 
394READ8_MEMBER( c64_state::vic_dma_read )
395{
396   int casram, basic, kernal, charom, grw, io, roml, romh;
397   
398   offset = (!m_va15 << 15) | (!m_va14 << 14) | offset;
399   
400   bankswitch(0, offset, 1, 1, 0, 0, &casram, &basic, &kernal, &charom, &grw, &io, &roml, &romh);
401   
402   return read_memory(space, offset, casram, basic, kernal, charom, io, roml, romh);
403}
404 
405READ8_MEMBER( c64_state::vic_dma_read_color )
406{
407   return m_color_ram[offset & 0x3ff];
408}
409 
410WRITE_LINE_MEMBER( c64_state::vic_irq_w )
411{
412   m_vic_irq = state;
413   
414   check_interrupts();
415}
416 
417READ8_MEMBER( c64_state::vic_rdy_cb )
418{
419   return input_port_read(machine(), "CYCLES") & 0x07;
420}
421 
422static const vic2_interface vic_ntsc_intf = 
423{
424   SCREEN_TAG,
425   M6510_TAG,
426   VIC6567,
427   DEVCB_DRIVER_MEMBER(c64_state, vic_lightpen_x_cb),
428   DEVCB_DRIVER_MEMBER(c64_state, vic_lightpen_y_cb),
429   DEVCB_DRIVER_MEMBER(c64_state, vic_lightpen_button_cb),
430   DEVCB_DRIVER_MEMBER(c64_state, vic_dma_read),
431   DEVCB_DRIVER_MEMBER(c64_state, vic_dma_read_color),
432   DEVCB_DRIVER_LINE_MEMBER(c64_state, vic_irq_w),
433   DEVCB_DRIVER_MEMBER(c64_state, vic_rdy_cb)
434};
435 
436static const vic2_interface vic_pal_intf = 
437{
438   SCREEN_TAG,
439   M6510_TAG,
440   VIC6569,
441   DEVCB_DRIVER_MEMBER(c64_state, vic_lightpen_x_cb),
442   DEVCB_DRIVER_MEMBER(c64_state, vic_lightpen_y_cb),
443   DEVCB_DRIVER_MEMBER(c64_state, vic_lightpen_button_cb),
444   DEVCB_DRIVER_MEMBER(c64_state, vic_dma_read),
445   DEVCB_DRIVER_MEMBER(c64_state, vic_dma_read_color),
446   DEVCB_DRIVER_LINE_MEMBER(c64_state, vic_irq_w),
447   DEVCB_DRIVER_MEMBER(c64_state, vic_rdy_cb)
448};
449 
450 
451//-------------------------------------------------
452//  sid6581_interface sid_intf
453//-------------------------------------------------
454 
455static int c64_paddle_read( device_t *device, int which )
456{
457   running_machine &machine = device->machine();
458   c64_state *state = device->machine().driver_data<c64_state>();
459   
460   int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp;
461   UINT8 cia0porta = mos6526_pa_r(state->m_cia1, 0);
462   int controller1 = input_port_read(machine, "CTRLSEL") & 0x07;
463   int controller2 = input_port_read(machine, "CTRLSEL") & 0x70;
464   // Notice that only a single input is defined for Mouse & Lightpen in both ports
465   switch (controller1)
466   {
467      case 0x01:
468         if (which)
469            pot2 = input_port_read(machine, "PADDLE2");
470         else
471            pot1 = input_port_read(machine, "PADDLE1");
472         break;
473 
474      case 0x02:
475         if (which)
476            pot2 = input_port_read(machine, "TRACKY");
477         else
478            pot1 = input_port_read(machine, "TRACKX");
479         break;
480 
481      case 0x03:
482         if (which && (input_port_read(machine, "JOY1_2B") & 0x20))   // Joy1 Button 2
483            pot1 = 0x00;
484         break;
485 
486      case 0x04:
487         if (which)
488            pot2 = input_port_read(machine, "LIGHTY");
489         else
490            pot1 = input_port_read(machine, "LIGHTX");
491         break;
492 
493      case 0x06:
494         if (which && (input_port_read(machine, "OTHER") & 0x04))   // Lightpen Signal
495            pot2 = 0x00;
496         break;
497 
498      case 0x00:
499      case 0x07:
500         break;
501 
502      default:
503         logerror("Invalid Controller Setting %d\n", controller1);
504         break;
505   }
506 
507   switch (controller2)
508   {
509      case 0x10:
510         if (which)
511            pot4 = input_port_read(machine, "PADDLE4");
512         else
513            pot3 = input_port_read(machine, "PADDLE3");
514         break;
515 
516      case 0x20:
517         if (which)
518            pot4 = input_port_read(machine, "TRACKY");
519         else
520            pot3 = input_port_read(machine, "TRACKX");
521         break;
522 
523      case 0x30:
524         if (which && (input_port_read(machine, "JOY2_2B") & 0x20))   // Joy2 Button 2
525            pot4 = 0x00;
526         break;
527 
528      case 0x40:
529         if (which)
530            pot4 = input_port_read(machine, "LIGHTY");
531         else
532            pot3 = input_port_read(machine, "LIGHTX");
533         break;
534 
535      case 0x60:
536         if (which && (input_port_read(machine, "OTHER") & 0x04))   // Lightpen Signal
537            pot4 = 0x00;
538         break;
539 
540      case 0x00:
541      case 0x70:
542         break;
543 
544      default:
545         logerror("Invalid Controller Setting %d\n", controller1);
546         break;
547   }
548 
549   if (input_port_read(machine, "CTRLSEL") & 0x80)      // Swap
550   {
551      temp = pot1; pot1 = pot3; pot3 = temp;
552      temp = pot2; pot2 = pot4; pot4 = temp;
553   }
554 
555   switch (cia0porta & 0xc0)
556   {
557      case 0x40:
558         return which ? pot2 : pot1;
559 
560      case 0x80:
561         return which ? pot4 : pot3;
562 
563      case 0xc0:
564         return which ? pot2 : pot1;
565 
566      default:
567         return 0;
568   }
569}
570 
571static const sid6581_interface sid_intf =
572{
573   c64_paddle_read
574};
575 
576 
577//-------------------------------------------------
578//  mos6526_interface cia1_intf
579//-------------------------------------------------
580 
581WRITE_LINE_MEMBER( c64_state::cia1_irq_w )
582{
583   m_cia1_irq = state;
584   
585   check_interrupts();
586}
587 
588READ8_MEMBER( c64_state::cia1_pa_r )
589{
590   /*
591       
592      bit      description
593       
594      PA0      COL0, JOY B0
595      PA1      COL1, JOY B1
596      PA2      COL2, JOY B2
597      PA3      COL3, JOY B3
598      PA4      COL4, BTNB
599      PA5      COL5
600      PA6      COL6
601      PA7      COL7
602       
603   */
604 
605   UINT8 cia0portb = mos6526_pb_r(m_cia1, 0);
606 
607   return cbm_common_cia0_port_a_r(m_cia1, cia0portb);
608}
609 
610READ8_MEMBER( c64_state::cia1_pb_r )
611{
612   /*
613       
614      bit      description
615       
616      PB0      JOY A0
617      PB1      JOY A1
618      PB2      JOY A2
619      PB3      JOY A3
620      PB4      BTNA/_LP
621      PB5
622      PB6
623      PB7
624       
625   */
626 
627   UINT8 cia0porta = mos6526_pa_r(m_cia1, 0);
628 
629   return cbm_common_cia0_port_b_r(m_cia1, cia0porta);
630}
631 
632WRITE8_MEMBER( c64_state::cia1_pb_w )
633{
634   /*
635       
636      bit      description
637       
638      PB0      ROW0
639      PB1      ROW1
640      PB2      ROW2
641      PB3      ROW3
642      PB4      ROW4
643      PB5      ROW5
644      PB6      ROW6
645      PB7      ROW7
646       
647   */
648   
649   vic2_lightpen_write(m_vic, BIT(data, 4));
650}
651 
652static const mos6526_interface cia1_intf =
653{
654   10,
655   DEVCB_DRIVER_LINE_MEMBER(c64_state, cia1_irq_w),
656   DEVCB_NULL,
657   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, sp1_w),
658   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, cnt1_w),
659   DEVCB_DRIVER_MEMBER(c64_state, cia1_pa_r),
660   DEVCB_NULL,
661   DEVCB_DRIVER_MEMBER(c64_state, cia1_pb_r),
662   DEVCB_DRIVER_MEMBER(c64_state, cia1_pb_w)
663};
664 
665 
666//-------------------------------------------------
667//  mos6526_interface cia2_intf
668//-------------------------------------------------
669 
670WRITE_LINE_MEMBER( c64_state::cia2_irq_w )
671{
672   m_cia2_irq = state;
673   
674   check_interrupts();
675}
676 
677READ8_MEMBER( c64_state::cia2_pa_r )
678{
679   /*
680       
681      bit      description
682       
683      PA0
684      PA1
685      PA2      USER PORT
686      PA3
687      PA4
688      PA5
689      PA6      CLK
690      PA7      DATA
691       
692   */
693   
694   UINT8 data = 0;
695   
696   // user port
697   data |= m_user->pa2_r() << 2;
698   
699   // IEC bus
700   data |= m_iec->clk_r() << 6;
701   data |= m_iec->data_r() << 7;
702   
703   return data;
704}
705 
706WRITE8_MEMBER( c64_state::cia2_pa_w )
707{
708   /*
709       
710      bit      description
711       
712      PA0      _VA14
713      PA1      _VA15
714      PA2      USER PORT
715      PA3      ATN OUT
716      PA4      CLK OUT
717      PA5      DATA OUT
718      PA6
719      PA7
720       
721   */
722   
723   // VIC banking
724   m_va14 = BIT(data, 0);
725   m_va15 = BIT(data, 1);
726   
727   // user port
728   m_user->pa2_w(BIT(data, 2));
729   
730   // IEC bus
731   m_iec->atn_w(!BIT(data, 3));
732   m_iec->clk_w(!BIT(data, 4));
733   m_iec->data_w(!BIT(data, 5));
734}
735 
736static const mos6526_interface cia2_intf =
737{
738   10,
739   DEVCB_DRIVER_LINE_MEMBER(c64_state, cia2_irq_w),
740   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pc2_w),
741   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, sp2_w),
742   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, cnt2_w),
743   DEVCB_DRIVER_MEMBER(c64_state, cia2_pa_r),
744   DEVCB_DRIVER_MEMBER(c64_state, cia2_pa_w),
745   DEVCB_DEVICE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pb_r),
746   DEVCB_DEVICE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, pb_w)
747};
748 
749 
750//-------------------------------------------------
751//  m6502_interface cpu_intf
752//-------------------------------------------------
753 
754READ8_MEMBER( c64_state::cpu_r )
755{
756   /*
757       
758      bit      description
759       
760      P0      1
761      P1      1
762      P2      1
763      P3
764      P4      CASS SENS
765      P5       
766       
767   */
768   
769   UINT8 data = 0x07;
770   
771   data |= ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 4;
772   
773   return data;
774}
775 
776WRITE8_MEMBER( c64_state::cpu_w )
777{
778   /*
779       
780      bit      description
781       
782      P0      LORAM
783      P1      HIRAM
784      P2      CHAREN
785      P3      CASS WRT
786      P4
787      P5      CASS MOTOR
788       
789   */
790 
791   // HACK apply pull-up resistors
792   data |= (offset ^ 0x07) & 0x07;
793   
794   m_loram = BIT(data, 0);
795   m_hiram = BIT(data, 1);
796   m_charen = BIT(data, 2);
797   
798   // cassette write
799   m_cassette->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
800   
801   // cassette motor
802   if (!BIT(data, 5))
803   {
804      m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
805      m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
806   }
807   else
808   {
809      m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
810      m_cassette_timer->reset();
811   }
812}
813 
814static const m6502_interface cpu_intf =
815{
816   NULL,
817   NULL,
818   DEVCB_DRIVER_MEMBER(c64_state, cpu_r),
819   DEVCB_DRIVER_MEMBER(c64_state, cpu_w)
820};
821 
822 
823//-------------------------------------------------
824//  TIMER_DEVICE_CALLBACK( cassette_tick )
825//-------------------------------------------------
826 
827static TIMER_DEVICE_CALLBACK( cassette_tick )
828{
829   c64_state *state = timer.machine().driver_data<c64_state>();
830 
831   state->m_cass_rd = state->m_cassette->input() > +0.0;
832   
833   state->check_interrupts();
834}
835 
836 
837//-------------------------------------------------
838//  CBM_IEC_INTERFACE( iec_intf )
839//-------------------------------------------------
840 
841WRITE_LINE_MEMBER( c64_state::iec_srq_w )
842{
843   m_iec_srq = state;
844   
845   check_interrupts();
846}
847 
848static CBM_IEC_INTERFACE( iec_intf )
849{
850   DEVCB_DRIVER_LINE_MEMBER(c64_state, iec_srq_w),
851   DEVCB_DEVICE_LINE_MEMBER(C64_USER_PORT_TAG, c64_user_port_device, atn_w),
852   DEVCB_NULL,
853   DEVCB_NULL,
854   DEVCB_NULL
855};
856 
857 
858//-------------------------------------------------
859//  C64_EXPANSION_INTERFACE( expansion_intf )
860//-------------------------------------------------
861 
862WRITE_LINE_MEMBER( c64_state::exp_irq_w )
863{
864   m_exp_irq = state;
865   
866   check_interrupts();
867}
868 
869WRITE_LINE_MEMBER( c64_state::exp_nmi_w )
870{
871   m_exp_nmi = state;
872   
873   check_interrupts();
874}
875 
876static C64_EXPANSION_INTERFACE( expansion_intf )
877{
878   DEVCB_DRIVER_LINE_MEMBER(c64_state, exp_irq_w),
879   DEVCB_DRIVER_LINE_MEMBER(c64_state, exp_nmi_w),
880   DEVCB_NULL, // DMA
881   DEVCB_CPU_INPUT_LINE(M6510_TAG, INPUT_LINE_RESET)
882};
883 
884 
885//-------------------------------------------------
886//  C64_USER_PORT_INTERFACE( user_intf )
887//-------------------------------------------------
888 
889static C64_USER_PORT_INTERFACE( user_intf )
890{
891   DEVCB_DEVICE_LINE(MOS6526_1_TAG, mos6526_sp_w),
892   DEVCB_DEVICE_LINE(MOS6526_1_TAG, mos6526_cnt_w),
893   DEVCB_DEVICE_LINE(MOS6526_2_TAG, mos6526_sp_w),
894   DEVCB_DEVICE_LINE(MOS6526_2_TAG, mos6526_cnt_w),
895   DEVCB_DEVICE_LINE(MOS6526_2_TAG, mos6526_flag_w),
896   DEVCB_CPU_INPUT_LINE(M6510_TAG, INPUT_LINE_RESET)
897};
898 
899 
900 
901//**************************************************************************
902//  MACHINE INITIALIZATION
903//**************************************************************************
904 
905//-------------------------------------------------
906//  MACHINE_START( c64 )
907//-------------------------------------------------
908 
909void c64_state::machine_start()
910{
911   // find memory regions
912   m_basic = machine().region("basic")->base();
913   m_kernal = machine().region("kernal")->base();
914   m_charom = machine().region("charom")->base();
915   
916   // allocate memory
917   m_color_ram = auto_alloc_array(machine(), UINT8, 0x400);
918   
919   // state saving
920   save_item(NAME(m_loram));
921   save_item(NAME(m_hiram));
922   save_item(NAME(m_charen));
923   save_pointer(NAME(m_color_ram), 0x400);
924   save_item(NAME(m_va14));
925   save_item(NAME(m_va15));
926   save_item(NAME(m_cia1_irq));
927   save_item(NAME(m_cia2_irq));
928   save_item(NAME(m_vic_irq));
929   save_item(NAME(m_exp_irq));
930   save_item(NAME(m_exp_nmi));
931   save_item(NAME(m_cass_rd));
932   save_item(NAME(m_iec_srq));
933}
934 
935 
936 
937//**************************************************************************
938//  MACHINE DRIVERS
939//**************************************************************************
940 
941//-------------------------------------------------
942//  MACHINE_CONFIG( ntsc )
943//-------------------------------------------------
944 
945static MACHINE_CONFIG_START( ntsc, c64_state )
946   // basic hardware
947   MCFG_CPU_ADD(M6510_TAG, M6510, VIC6567_CLOCK)
948   MCFG_CPU_PROGRAM_MAP(c64_mem)
949   MCFG_CPU_CONFIG(cpu_intf)
950   MCFG_CPU_VBLANK_INT(SCREEN_TAG, c64_frame_interrupt)
951   MCFG_QUANTUM_TIME(attotime::from_hz(60))
952 
953   // video hardware
954   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
955   MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE)
956   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
957   MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES)
958   MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1)
959   MCFG_SCREEN_UPDATE_DRIVER(c64_state, screen_update)
960 
961   MCFG_PALETTE_INIT(c64)
962   MCFG_PALETTE_LENGTH(ARRAY_LENGTH(c64_palette) / 3)
963 
964   MCFG_VIC2_ADD(MOS6567_TAG, vic_ntsc_intf)
965 
966   // sound hardware
967   MCFG_SPEAKER_STANDARD_MONO("mono")
968   MCFG_SOUND_ADD(MOS6851_TAG, SID6581, VIC6567_CLOCK)
969   MCFG_SOUND_CONFIG(sid_intf)
970   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
971   MCFG_SOUND_ADD("dac", DAC, 0)
972   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
973 
974   // devices
975   MCFG_MOS6526R1_ADD(MOS6526_1_TAG, VIC6567_CLOCK, cia1_intf)
976   MCFG_MOS6526R1_ADD(MOS6526_2_TAG, VIC6567_CLOCK, cia2_intf)
977   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
978   MCFG_CASSETTE_ADD(CASSETTE_TAG, cbm_cassette_interface)
979   MCFG_TIMER_ADD(TIMER_C1531_TAG, cassette_tick)
980   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
981   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, expansion_intf, c64_expansion_cards, NULL, NULL)
982   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
983 
984   // software list
985   MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart")
986   MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "NTSC")
987   MCFG_SOFTWARE_LIST_ADD("disk_list", "c64_flop")
988   MCFG_SOFTWARE_LIST_FILTER("disk_list", "NTSC")
989 
990   // internal ram
991   MCFG_RAM_ADD(RAM_TAG)
992   MCFG_RAM_DEFAULT_SIZE("64K")
993MACHINE_CONFIG_END
994 
995 
996//-------------------------------------------------
997//  MACHINE_CONFIG( pet64 )
998//-------------------------------------------------
999 
1000static MACHINE_CONFIG_DERIVED( pet64, ntsc )
1001   MCFG_PALETTE_INIT( pet64 )
1002MACHINE_CONFIG_END
1003 
1004 
1005//-------------------------------------------------
1006//  MACHINE_CONFIG( pal )
1007//-------------------------------------------------
1008 
1009static MACHINE_CONFIG_START( pal, c64_state )
1010   // basic hardware
1011   MCFG_CPU_ADD(M6510_TAG, M6510, VIC6569_CLOCK)
1012   MCFG_CPU_PROGRAM_MAP(c64_mem)
1013   MCFG_CPU_CONFIG(cpu_intf)
1014   MCFG_CPU_VBLANK_INT(SCREEN_TAG, c64_frame_interrupt)
1015   MCFG_QUANTUM_TIME(attotime::from_hz(50))
1016 
1017   // video hardware
1018   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
1019   MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE)
1020   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
1021   MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES)
1022   MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1)
1023   MCFG_SCREEN_UPDATE_DRIVER(c64_state, screen_update)
1024 
1025   MCFG_PALETTE_INIT(c64)
1026   MCFG_PALETTE_LENGTH(ARRAY_LENGTH(c64_palette) / 3)
1027 
1028   MCFG_VIC2_ADD(MOS6569_TAG, vic_pal_intf)
1029 
1030   // sound hardware
1031   MCFG_SPEAKER_STANDARD_MONO("mono")
1032   MCFG_SOUND_ADD(MOS6851_TAG, SID6581, VIC6569_CLOCK)
1033   MCFG_SOUND_CONFIG(sid_intf)
1034   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
1035   MCFG_SOUND_ADD("dac", DAC, 0)
1036   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
1037 
1038   // devices
1039   MCFG_MOS6526R1_ADD(MOS6526_1_TAG, VIC6569_CLOCK, cia1_intf)
1040   MCFG_MOS6526R1_ADD(MOS6526_2_TAG, VIC6569_CLOCK, cia2_intf)
1041   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
1042   MCFG_CASSETTE_ADD(CASSETTE_TAG, cbm_cassette_interface)
1043   MCFG_TIMER_ADD(TIMER_C1531_TAG, cassette_tick)
1044   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
1045   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, expansion_intf, c64_expansion_cards, NULL, NULL)
1046   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
1047 
1048   // software list
1049   MCFG_SOFTWARE_LIST_ADD("cart_list_c64", "c64_cart")
1050   MCFG_SOFTWARE_LIST_FILTER("cart_list_c64", "PAL")
1051   MCFG_SOFTWARE_LIST_ADD("disk_list", "c64_flop")
1052   MCFG_SOFTWARE_LIST_FILTER("disk_list", "PAL")
1053 
1054   // internal ram
1055   MCFG_RAM_ADD(RAM_TAG)
1056   MCFG_RAM_DEFAULT_SIZE("64K")
1057MACHINE_CONFIG_END
1058 
1059 
1060 
1061//**************************************************************************
1062//  ROMS
1063//**************************************************************************
1064 
1065//-------------------------------------------------
1066//  ROM( c64n )
1067//-------------------------------------------------
1068 
1069ROM_START( c64n )
1070   ROM_REGION( 0x2000, "basic", 0 )
1071   ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
1072 
1073   ROM_REGION( 0x2000, "kernal", 0 )
1074   ROM_DEFAULT_BIOS("r3")
1075   ROM_SYSTEM_BIOS(0, "r1", "Kernal rev. 1" )
1076   ROMX_LOAD( "901227-01.u4", 0x0000, 0x2000, CRC(dce782fa) SHA1(87cc04d61fc748b82df09856847bb5c2754a2033), ROM_BIOS(1) )
1077   ROM_SYSTEM_BIOS(1, "r2", "Kernal rev. 2" )
1078   ROMX_LOAD( "901227-02.u4", 0x0000, 0x2000, CRC(a5c687b3) SHA1(0e2e4ee3f2d41f00bed72f9ab588b83e306fdb13), ROM_BIOS(2) )
1079   ROM_SYSTEM_BIOS(2, "r3", "Kernal rev. 3" )
1080   ROMX_LOAD( "901227-03.u4", 0x0000, 0x2000, CRC(dbe3e7c7) SHA1(1d503e56df85a62fee696e7618dc5b4e781df1bb), ROM_BIOS(3) )
1081   ROM_SYSTEM_BIOS(3, "jiffydos", "JiffyDOS v6.01" )
1082   ROMX_LOAD( "jiffydos c64.u4", 0x0000, 0x2000, CRC(2f79984c) SHA1(31e73e66eccb28732daea8ec3ad1addd9b39a017), ROM_BIOS(4) )
1083 
1084   ROM_REGION( 0x1000, "charom", 0 )
1085   ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) )
1086   
1087   ROM_REGION( 0x100, "pla", 0 )
1088   ROM_LOAD( "906114-01.u17", 0x000, 0x100, NO_DUMP )
1089ROM_END
1090 
1091 
1092//-------------------------------------------------
1093//  ROM( c64j )
1094//-------------------------------------------------
1095 
1096ROM_START( c64j )
1097   ROM_REGION( 0x2000, "basic", 0 )
1098   ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
1099 
1100   ROM_REGION( 0x2000, "kernal", 0 )
1101   ROM_LOAD( "906145-02.u4", 0x0000, 0x2000, CRC(3a9ef6f1) SHA1(4ff0f11e80f4b57430d8f0c3799ed0f0e0f4565d) )
1102 
1103   ROM_REGION( 0x1000, "charom", 0 )
1104   ROM_LOAD( "906143-02.u5", 0x0000, 0x1000, CRC(1604f6c1) SHA1(0fad19dbcdb12461c99657b2979dbb5c2e47b527) )
1105   
1106   ROM_REGION( 0x100, "pla", 0 )
1107   ROM_LOAD( "906114-01.u17", 0x000, 0x100, NO_DUMP )
1108ROM_END
1109 
1110 
1111//-------------------------------------------------
1112//  ROM( c64p )
1113//-------------------------------------------------
1114 
1115#define rom_c64p rom_c64n
1116 
1117 
1118//-------------------------------------------------
1119//  ROM( c64sw )
1120//-------------------------------------------------
1121 
1122ROM_START( c64sw )
1123   ROM_REGION( 0x2000, "basic", 0 )
1124   ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
1125 
1126   ROM_REGION( 0x2000, "kernal", 0 )
1127   ROM_LOAD( "kernel.u4",   0x0000, 0x2000, CRC(f10c2c25) SHA1(e4f52d9b36c030eb94524eb49f6f0774c1d02e5e) )
1128 
1129   ROM_REGION( 0x1000, "charom", 0 )
1130   ROM_SYSTEM_BIOS( 0, "default", "Swedish Characters" )
1131   ROMX_LOAD( "charswe.u5", 0x0000, 0x1000, CRC(bee9b3fd) SHA1(446ae58f7110d74d434301491209299f66798d8a), ROM_BIOS(1) )
1132   ROM_SYSTEM_BIOS( 1, "alt", "Swedish Characters (Alt)" )
1133   ROMX_LOAD( "charswe2.u5", 0x0000, 0x1000, CRC(377a382b) SHA1(20df25e0ba1c88f31689c1521397c96968967fac), ROM_BIOS(2) )
1134   
1135   ROM_REGION( 0x100, "pla", 0 )
1136   ROM_LOAD( "906114-01.u17", 0x000, 0x100, NO_DUMP )
1137ROM_END
1138 
1139 
1140//-------------------------------------------------
1141//  ROM( pet64 )
1142//-------------------------------------------------
1143 
1144ROM_START( pet64 )
1145   ROM_REGION( 0x2000, "basic", 0 )
1146   ROM_LOAD( "901226-01.u3", 0x0000, 0x2000, CRC(f833d117) SHA1(79015323128650c742a3694c9429aa91f355905e) )
1147 
1148   ROM_REGION( 0x2000, "kernal", 0 )
1149   ROM_LOAD( "901246-01.u4", 0x0000, 0x2000, CRC(789c8cc5) SHA1(6c4fa9465f6091b174df27dfe679499df447503c) )
1150 
1151   ROM_REGION( 0x1000, "charom", 0 )
1152   ROM_LOAD( "901225-01.u5", 0x0000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) )
1153   
1154   ROM_REGION( 0x100, "pla", 0 )
1155   ROM_LOAD( "906114-01.u17", 0x000, 0x100, NO_DUMP )
1156ROM_END
1157 
1158 
1159//-------------------------------------------------
1160//  ROM( edu64 )
1161//-------------------------------------------------
1162 
1163#define rom_edu64   rom_c64n
1164 
1165 
1166 
1167//**************************************************************************
1168//  SYSTEM DRIVERS
1169//**************************************************************************
1170 
1171//    YEAR  NAME    PARENT  COMPAT  MACHINE    INPUT      INIT    COMPANY                        FULLNAME                               FLAGS
1172COMP( 1982,   c64n,   0,     0,      ntsc,      c64,      0,      "Commodore Business Machines", "Commodore 64 (NTSC)",                    0 )
1173COMP( 1982,   c64j,   c64n,     0,      ntsc,      c64,      0,      "Commodore Business Machines", "Commodore 64 (Japan)",                   0 )
1174COMP( 1982,   c64p,   c64n,     0,      pal,      c64,      0,      "Commodore Business Machines", "Commodore 64 (PAL)",                    0 )
1175COMP( 1982,   c64sw,   c64n,   0,      pal,      c64sw,      0,      "Commodore Business Machines", "Commodore 64 / VIC-64S (Sweden/Finland)",    0 )
1176COMP( 1983, pet64,   c64n,     0,       pet64,      c64,        0,        "Commodore Business Machines", "PET 64 / CBM 4064 (NTSC)",                0 )
1177COMP( 1983, edu64,  c64n,     0,       pet64,      c64,        0,        "Commodore Business Machines", "Educator 64 (NTSC)",                   0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team