Previous 15994 Revisions Next

r10270 Wednesday 2nd February, 2011 at 20:00:28 UTC by Angelo Salese
[CD32]: Added CD-ROM interface [David Haywood]
[src/mame/machine]cubocd32.c
[src/mess/drivers]ami1200.c

src/mame/machine/cubocd32.c
r10269r10270
55#include "sound/cdda.h"
66#include "machine/i2cmem.h"
77#include "includes/cubocd32.h"
8#include "imagedev/chd_cd.h"
89
910
10
1111/*********************************************************************************
1212
1313    Akiko custom chip emulation
r10269r10270
6565   emu_timer *dma_timer;
6666   emu_timer *frame_timer;
6767   device_t *i2cmem;
68
69   int cdrom_is_device;
6870};
6971
7072static TIMER_CALLBACK(akiko_dma_proc);
r10269r10270
8183static DEVICE_STOP( akiko )
8284{
8385   akiko_state *state = get_safe_token(device);
84   if( state->cdrom )
86   if (!state->cdrom_is_device)
8587   {
86      cdrom_close(state->cdrom);
87      state->cdrom = (cdrom_file *)NULL;
88      akiko_state *state = get_safe_token(device);
89      if( state->cdrom )
90      {
91         cdrom_close(state->cdrom);
92         state->cdrom = (cdrom_file *)NULL;
93      }
8894   }
8995}
9096
91static DEVICE_START( akiko )
97static DEVICE_RESET( akiko )
9298{
9399   running_machine *machine = device->machine;
94100   akiko_state *state = get_safe_token(device);
95101
96   state->machine = machine;
97   state->space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
98   state->c2p_input_index = 0;
99   state->c2p_output_index = 0;
102   device_t *cddevice;
103   cddevice = machine->device("cdrom");
104   if (cddevice!=NULL)
105   {
106      // MESS case
107      state->cdrom = cd_get_cdrom_file(cddevice);
108      state->cdrom_is_device = 1;
109   }
110   else
111   {
112      // MAME case
113      state->cdrom = cdrom_open(get_disk_handle(machine, "cdrom"));
114      state->cdrom_is_device = 0;
115   }
100116
101   state->i2c_scl_out = 0;
102   state->i2c_scl_dir = 0;
103   state->i2c_sda_out = 0;
104   state->i2c_sda_dir = 0;
105117
106   state->cdrom_status[0] = state->cdrom_status[1] = 0;
107   state->cdrom_address[0] = state->cdrom_address[1] = 0;
108   state->cdrom_track_index = 0;
109   state->cdrom_lba_start = 0;
110   state->cdrom_lba_end = 0;
111   state->cdrom_lba_cur = 0;
112   state->cdrom_readmask = 0;
113   state->cdrom_readreqmask = 0;
114   state->cdrom_dmacontrol = 0;
115   state->cdrom_numtracks = 0;
116   state->cdrom_speed = 0;
117   state->cdrom_cmd_start = 0;
118   state->cdrom_cmd_end = 0;
119   state->cdrom_cmd_resp = 0;
120   state->cdrom = cdrom_open(get_disk_handle(machine, "cdrom"));
121   state->cdrom_toc = NULL;
122   state->dma_timer = timer_alloc(machine, akiko_dma_proc, state);
123   state->frame_timer = timer_alloc(machine, akiko_frame_proc, state);
124   state->i2cmem = machine->device("i2cmem");
125
126118   /* create the TOC table */
127119   if ( state->cdrom != NULL && cdrom_get_last_track(state->cdrom) )
128120   {
r10269r10270
171163         p += 13;
172164      }
173165   }
166
174167}
175168
169static DEVICE_START( akiko )
170{
171   running_machine *machine = device->machine;
172   akiko_state *state = get_safe_token(device);
173
174   state->machine = machine;
175   state->space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
176   state->c2p_input_index = 0;
177   state->c2p_output_index = 0;
178
179   state->i2c_scl_out = 0;
180   state->i2c_scl_dir = 0;
181   state->i2c_sda_out = 0;
182   state->i2c_sda_dir = 0;
183
184   state->cdrom_status[0] = state->cdrom_status[1] = 0;
185   state->cdrom_address[0] = state->cdrom_address[1] = 0;
186   state->cdrom_track_index = 0;
187   state->cdrom_lba_start = 0;
188   state->cdrom_lba_end = 0;
189   state->cdrom_lba_cur = 0;
190   state->cdrom_readmask = 0;
191   state->cdrom_readreqmask = 0;
192   state->cdrom_dmacontrol = 0;
193   state->cdrom_numtracks = 0;
194   state->cdrom_speed = 0;
195   state->cdrom_cmd_start = 0;
196   state->cdrom_cmd_end = 0;
197   state->cdrom_cmd_resp = 0;
198
199   state->cdrom_toc = NULL;
200   state->dma_timer = timer_alloc(machine, akiko_dma_proc, state);
201   state->frame_timer = timer_alloc(machine, akiko_frame_proc, state);
202   state->i2cmem = machine->device("i2cmem");
203
204
205}
206
176207static void akiko_nvram_write(akiko_state *state, UINT32 data)
177208{
178209   state->i2c_scl_out = BIT(data,31);
r10269r10270
887918static const char DEVTEMPLATE_SOURCE[] = __FILE__;
888919
889920#define DEVTEMPLATE_ID(p,s)      p##akiko##s
890#define DEVTEMPLATE_FEATURES   DT_HAS_START | DT_HAS_STOP
921#define DEVTEMPLATE_FEATURES   DT_HAS_START | DT_HAS_STOP | DT_HAS_RESET
891922#define DEVTEMPLATE_NAME      "Akiko"
892923#define DEVTEMPLATE_FAMILY      "Amiga"
893924#include "devtempl.h"
src/mess/drivers/ami1200.c
r10269r10270
559559   MCFG_MOS8520_ADD("cia_0", AMIGA_68EC020_PAL_CLOCK / 10, cd32_cia_0_intf)
560560   MCFG_MOS8520_ADD("cia_1", AMIGA_68EC020_PAL_CLOCK / 10, cd32_cia_1_intf)
561561   
562   MCFG_CDROM_ADD( "cdrom" )
563   MCFG_CDROM_INTERFACE("cd32_cdrom")
564
562565   MCFG_DEVICE_ADD("akiko", AKIKO, 0)
563566MACHINE_CONFIG_END
564567

Previous 15994 Revisions Next


© 1998-2018 The MESS Team