Previous 15994 Revisions Next

r4094 Thursday 8th January, 2009 at 12:01:05 UTC by Dirk Best
[SAMCOUPE] Changed to use ASSERT_LINE, cleanups
[src/mess/drivers]samcoupe.c
[src/mess/machine]samcoupe.c

src/mess/machine/samcoupe.c
r4093r4094
132132
133133WRITE8_HANDLER( samcoupe_ext_mem_w )
134134{
135   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
135   const address_space *space_program = cputag_get_address_space(space->machine, "main", ADDRESS_SPACE_PROGRAM);
136136   coupe_asic *asic = space->machine->driver_data;
137137
138138   if (offset & 1)
r4093r4094
187187
188188   samcoupe_update_memory(space);
189189}
190
src/mess/drivers/samcoupe.c
r4093r4094
5454
5555/* core includes */
5656#include "driver.h"
57#include "cpu/z80/z80.h"
5857#include "includes/samcoupe.h"
5958
6059/* components */
60#include "cpu/z80/z80.h"
6161#include "machine/wd17xx.h"
62#include "machine/msm6242.h"
6263#include "sound/saa1099.h"
6364#include "sound/speaker.h"
64#include "machine/msm6242.h"
6565
6666/* devices */
6767#include "devices/mflopimg.h"
r4093r4094
8181
8282static READ8_HANDLER( samcoupe_disk_r )
8383{
84   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
85   
84   const device_config *fdc = devtag_get_device(space->machine, WD1772, "wd1772");
85
8686   /* drive and side is encoded into bit 5 and 3 */
87   wd17xx_set_drive(fdc,(offset >> 4) & 1);
88   wd17xx_set_side(fdc,(offset >> 2) & 1);
87   wd17xx_set_drive(fdc, (offset >> 4) & 1);
88   wd17xx_set_side(fdc, (offset >> 2) & 1);
8989
9090   /* bit 1 and 2 select the controller register */
9191   switch (offset & 0x03)
r4093r4094
102102
103103static WRITE8_HANDLER( samcoupe_disk_w )
104104{
105   device_config *fdc = (device_config*)devtag_get_device(space->machine, WD1772, "wd1772");
105   const device_config *fdc = devtag_get_device(space->machine, WD1772, "wd1772");
106106
107107   /* drive and side is encoded into bit 5 and 3 */
108   wd17xx_set_drive(fdc,(offset >> 4) & 1);
109   wd17xx_set_side(fdc,(offset >> 2) & 1);
108   wd17xx_set_drive(fdc, (offset >> 4) & 1);
109   wd17xx_set_side(fdc, (offset >> 2) & 1);
110110
111111   /* bit 1 and 2 select the controller register */
112112   switch (offset & 0x03)
r4093r4094
121121
122122static READ8_HANDLER( samcoupe_pen_r )
123123{
124   const device_config *scr = space->machine->primary_screen;
124125   UINT8 data;
125126
126127   if (offset & 0x100)
127128   {
128129      /* return either the current line or 192 for the vblank area */
129      data = video_screen_get_vblank(space->machine->primary_screen) ? 192 : video_screen_get_vpos(space->machine->primary_screen);
130      data = video_screen_get_vblank(scr) ? 192 : video_screen_get_vpos(scr);
130131   }
131132   else
132133   {
133134      /* horizontal position is encoded into bits 3 to 8 */
134      data = video_screen_get_hpos(space->machine->primary_screen) & 0xfc;
135      data = video_screen_get_hpos(scr) & 0xfc;
135136   }
136137
137138   return data;
r4093r4094
180181
181182static WRITE8_HANDLER( samcoupe_lmpr_w )
182183{
183   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
184   const address_space *space_program = cputag_get_address_space(space->machine, "main", ADDRESS_SPACE_PROGRAM);
184185   coupe_asic *asic = space->machine->driver_data;
186
185187   asic->lmpr = data;
186188   samcoupe_update_memory(space_program);
187189}
r4093r4094
196198
197199static WRITE8_HANDLER( samcoupe_hmpr_w )
198200{
199   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
201   const address_space *space_program = cputag_get_address_space(space->machine, "main", ADDRESS_SPACE_PROGRAM);
200202   coupe_asic *asic = space->machine->driver_data;
203
201204   asic->hmpr = data;
202205   samcoupe_update_memory(space_program);
203206}
r4093r4094
212215
213216static WRITE8_HANDLER( samcoupe_vmpr_w )
214217{
215   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
218   const address_space *space_program = cputag_get_address_space(space->machine, "main", ADDRESS_SPACE_PROGRAM);
216219   coupe_asic *asic = space->machine->driver_data;
220
217221   asic->vmpr = data;
218222   samcoupe_update_memory(space_program);
219223}
r4093r4094
221225
222226static READ8_HANDLER( samcoupe_midi_r )
223227{
224   logerror("Read from midi port\n");
228   logerror("%s: read from midi port\n", cpuexec_describe_context(space->machine));
225229   return 0xff;
226230}
227231
228232
229233static WRITE8_HANDLER( samcoupe_midi_w )
230234{
231   logerror("Write to midi port: 0x%02x\n", data);
235   logerror("%s: write to midi port: 0x%02x\n", cpuexec_describe_context(space->machine), data);
232236}
233237
234238
r4093r4094
263267   asic->border = data;
264268
265269   /* DAC output state */
266   speaker_level_w(0,(data >> 4) & 0x01);
270   speaker_level_w(0, (data >> 4) & 0x01);
267271}
268272
269273
r4093r4094
333337   coupe_asic *asic = machine->driver_data;
334338
335339   /* clear interrupt */
336   cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
340   cputag_set_input_line(machine, "main", 0, CLEAR_LINE);
337341
338342   /* adjust STATUS register */
339343   asic->status |= param;
r4093r4094
344348{
345349   coupe_asic *asic = device->machine->driver_data;
346350
347   /* set irq and a timer to set it off again */
348   cpu_set_input_line(device, 0, HOLD_LINE);
351   /* assert irq and a timer to set it off again */
352   cpu_set_input_line(device, 0, ASSERT_LINE);
349353   timer_set(device->machine, ATTOTIME_IN_USEC(20), NULL, src, irq_off);
350354
351355   /* adjust STATUS register */
r4093r4094
543547   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
544548   MDRV_SOUND_ADD("saa1099", SAA1099, SAMCOUPE_XTAL_X1/3) /* 8 MHz */
545549   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
546   
547   MDRV_WD1772_ADD("wd1772", default_wd17xx_interface )   
550
551   MDRV_WD1772_ADD("wd1772", default_wd17xx_interface )
548552MACHINE_DRIVER_END
549553
550554

Previous 15994 Revisions Next


© 1998-2018 The MESS Team