Previous 15994 Revisions Next

r3952 Sunday 21st December, 2008 at 12:57:05 UTC by Miodrag Milanović
SAM6883 changed to device
[docs]messnew.txt
[src/mess/drivers]coco.c
[src/mess/includes]coco.h
[src/mess/machine]6883sam.c 6883sam.h coco.c
[src/mess/video]coco.c coco3.c

src/mess/video/coco.c
r3951r3952
6262   pia_0_cb1_w(space, 0, data);
6363}
6464
65const UINT8 *get_video_ram_coco(running_machine *machine,int scanline)
66{
67   device_config *sam = (device_config*)device_list_find_by_tag( machine->config->devicelist, SAM6883, "sam");
68   return sam_m6847_get_video_ram(sam,scanline);
69}
70
6571static void internal_video_start_coco(running_machine *machine, m6847_type type)
6672{
6773   m6847_config cfg;
r3951r3952
7581      cfg.cpu0_timing_factor = 4;
7682
7783   cfg.get_attributes = coco_get_attributes;
78   cfg.get_video_ram = sam_m6847_get_video_ram;
84   cfg.get_video_ram = get_video_ram_coco;
7985   cfg.horizontal_sync_callback = coco_horizontal_sync_callback;
8086   cfg.field_sync_callback = coco_field_sync_callback;
8187
src/mess/video/coco3.c
r3951r3952
790790}
791791
792792
793const UINT8 *get_video_ram_coco3(running_machine *machine,int scanline)
794{
795   device_config *sam = (device_config*)device_list_find_by_tag( machine->config->devicelist, SAM6883_GIME, "sam");
796   return sam_m6847_get_video_ram(sam,scanline);
797}
793798
794799static void internal_video_start_coco3(running_machine *machine, m6847_type type)
795800{
r3951r3952
834839   cfg.type = type;
835840   cfg.cpu0_timing_factor = 4;
836841   cfg.get_attributes = coco_get_attributes;
837   cfg.get_video_ram = sam_m6847_get_video_ram;
842   cfg.get_video_ram = get_video_ram_coco3;
838843   cfg.horizontal_sync_callback = coco3_horizontal_sync_callback;
839844   cfg.field_sync_callback = coco3_field_sync_callback;
840845   cfg.custom_palette = video->palette_colors;
src/mess/includes/coco.h
r3951r3952
1111
1212#include "devices/snapquik.h"
1313#include "machine/wd17xx.h"
14#include "machine/6883sam.h"
1415
1516#define COCO_CPU_SPEED_HZ      894886   /* 0.894886 MHz */
1617#define COCO_FRAMES_PER_SECOND   (COCO_CPU_SPEED_HZ / 57.0 / 263)
r3951r3952
4142extern const wd17xx_interface dragon_wd17xx_interface;
4243extern const wd17xx_interface coco_wd17xx_interface;
4344extern const wd17xx_interface dgnalpha_wd17xx_interface;
45extern const sam6883_interface coco_sam_intf;
46extern const sam6883_interface coco3_sam_intf;
4447extern UINT8 coco3_gimereg[16];
4548
4649MACHINE_START( dragon32 );
src/mess/machine/coco.c
r3951r3952
135135static void d_pia0_irq_b(running_machine *machine, int state);
136136static void d_pia1_firq_a(running_machine *machine, int state);
137137static void d_pia1_firq_b(running_machine *machine, int state);
138static void d_sam_set_pageonemode(running_machine *machine,int val);
139static void d_sam_set_mpurate(running_machine *machine,int val);
140static void d_sam_set_memorysize(running_machine *machine,int val);
141static void d_sam_set_maptype(running_machine *machine,int val);
138static SAM6883_SET_PAGE_ONE_MODE( d_sam_set_pageonemode );
139static SAM6883_SET_MPU_RATE( d_sam_set_mpurate );
140static SAM6883_SET_MEMORY_SIZE( d_sam_set_memorysize);
141static SAM6883_SET_MAP_TYPE( d_sam_set_maptype );
142142static void coco_setcartline(running_machine *machine, coco_cartridge *cartridge, cococart_line line, cococart_line_value value);
143143static void twiddle_cart_line_if_q(running_machine *machine);
144144
r3951r3952
159159static void coco3_pia0_irq_b(running_machine *machine, int state);
160160static void coco3_pia1_firq_a(running_machine *machine, int state);
161161static void coco3_pia1_firq_b(running_machine *machine, int state);
162static void coco3_sam_set_maptype(running_machine *machine, int val);
163static const UINT8 *coco3_sam_get_rambase(running_machine *machine);
164162
163static SAM6883_SET_MAP_TYPE( coco3_sam_set_maptype );
164static SAM6883_GET_RAMBASE( coco3_sam_get_rambase );
165
165166/* Dragon 32 specific */
166167static READ8_HANDLER ( d_pia1_pb_r_dragon32 );
167168
r3951r3952
372373
373374};
374375
375static const sam6883_interface coco_sam_intf =
376const sam6883_interface coco_sam_intf =
376377{
377   SAM6883_ORIGINAL,
378378   NULL,
379379   d_sam_set_pageonemode,
380380   d_sam_set_mpurate,
r3951r3952
382382   d_sam_set_maptype
383383};
384384
385static const sam6883_interface coco3_sam_intf =
385const sam6883_interface coco3_sam_intf =
386386{
387   SAM6883_GIME,
388387   coco3_sam_get_rambase,
389388   NULL,
390389   d_sam_set_mpurate,
r3951r3952
456455
457456static void pak_load_trailer(running_machine *machine, const pak_decodedtrailer *trailer)
458457{
458   device_config *sam = (device_config*)device_list_find_by_tag( machine->config->devicelist, SAM6883, "sam");
459459   cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc);
460460   cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x);
461461   cpu_set_reg(machine->cpu[0], M6809_Y, trailer->reg_y);
r3951r3952
496496    * access that bit or or whether it is something else.  So that is why
497497    * I am specifying 0x7fff instead of 0xffff here
498498    */
499   sam_set_state(machine, trailer->sam, 0x7fff);
499   sam_set_state(sam, trailer->sam, 0x7fff);
500500}
501501
502502static int generic_pak_load(const device_config *image, int rambase_index, int rombase_index, int pakbase_index)
r3951r3952
18671867  Misc
18681868***************************************************************************/
18691869
1870static void d_sam_set_mpurate(running_machine *machine, int val)
1870static SAM6883_SET_MPU_RATE( d_sam_set_mpurate )
18711871{
18721872   /* The infamous speed up poke.
18731873    *
r3951r3952
18911891    * TODO:  Make the overclock more accurate.  In dual speed, ROM was a fast
18921892    * access but RAM was not.  I don't know how to simulate this.
18931893    */
1894    cpu_set_clockscale(machine->cpu[0], val ? 2 : 1);
1894    cpu_set_clockscale(device->machine->cpu[0], val ? 2 : 1);
18951895}
18961896
18971897READ8_HANDLER(dragon_alpha_mapped_irq_r)
r3951r3952
19521952
19531953   /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */
19541954   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
1955   UINT8 memsize   = get_sam_memorysize(machine);
1956   UINT8 maptype   = get_sam_maptype(machine);
1955   device_config *sam = (device_config*)device_list_find_by_tag( space->machine->config->devicelist, SAM6883, "sam");
1956   UINT8 memsize   = get_sam_memorysize(sam);
1957   UINT8 maptype   = get_sam_maptype(sam);
19571958//   UINT8 pagemode   = get_sam_pagemode(machine);
19581959   int       last_ram_block;      /* Last block that will be RAM, dependent on maptype */
19591960   int       block_index;      /* Index of block being processed */
r3951r3952
20202021}
20212022
20222023
2023static void d_sam_set_pageonemode(running_machine *machine, int val)
2024static SAM6883_SET_PAGE_ONE_MODE( d_sam_set_pageonemode )
20242025{
20252026   /* Page mode - allowed switching between the low 32k and the high 32k,
20262027    * assuming that 64k wasn't enabled
r3951r3952
20292030    * this (it probably ignored it)
20302031    */
20312032
2032   if (!get_sam_maptype(machine))      // Ignored in maptype 1
2033   if (!get_sam_maptype(device))      // Ignored in maptype 1
20332034   {
20342035      if((mess_ram_size>0x8000) && val)
20352036         bottom_32k=&mess_ram[0x8000];
20362037      else
20372038         bottom_32k=mess_ram;
20382039
2039      setup_memory_map(machine);
2040      setup_memory_map(device->machine);
20402041   }
20412042}
20422043
2043static void d_sam_set_memorysize(running_machine *machine, int val)
2044static SAM6883_SET_MEMORY_SIZE( d_sam_set_memorysize )
20442045{
20452046   /* Memory size - allowed restricting memory accesses to something less than
20462047    * 32k
r3951r3952
20662067    * TODO:  Verify that the CoCo 3 ignored this
20672068    */
20682069
2069   setup_memory_map(machine);
2070   setup_memory_map(device->machine);
20702071}
20712072
20722073
r3951r3952
21622163/* way as the CoCo 1/2 and Dragon 32, this now has been reduced to a call to */
21632164/* setup_memory_map() - 2007-01-02 phs. */
21642165
2165static void d_sam_set_maptype(running_machine *machine,int val)
2166static SAM6883_SET_MAP_TYPE( d_sam_set_maptype )
21662167{
21672168   if(val)
21682169      bottom_32k=mess_ram;   // Always reset, when in maptype 1
21692170
2170   setup_memory_map(machine);
2171   setup_memory_map(device->machine);
21712172}
21722173
21732174/*************************************
r3951r3952
25692570
25702571
25712572
2572static const UINT8 *coco3_sam_get_rambase(running_machine *machine)
2573static SAM6883_GET_RAMBASE( coco3_sam_get_rambase )
25732574{
25742575   UINT32 video_base;
25752576   video_base = coco3_get_video_base(0xE0, 0x3F);
r3951r3952
25792580
25802581
25812582
2582static void coco3_sam_set_maptype(running_machine *machine,int val)
2583static SAM6883_SET_MAP_TYPE( coco3_sam_set_maptype )
25832584{
25842585   coco3_enable_64k = val;
2585   coco3_mmu_update(machine, 4, 8);
2586   coco3_mmu_update(device->machine, 4, 8);
25862587}
25872588
25882589
r3951r3952
29242925
29252926   /* Do generic Inits */
29262927   generic_init_machine(machine, init);
2927
2928   /* Init SAM */
2929   sam_init(machine, &coco_sam_intf);
29302928}
29312929
29322930/******* Machine Setups Dragons **********/
r3951r3952
30963094
30973095   generic_init_machine(machine, &init);
30983096
3099   /* Init SAM */
3100   sam_init(machine, &coco3_sam_intf);
3101
31023097   /* CoCo 3 specific function pointers */
31033098   update_keyboard = coco3_update_keyboard;
31043099
src/mess/machine/6883sam.c
r3951r3952
5555
5656#define LOG_VIDEO_POSITION   0
5757
58typedef struct _sam6883 sam6883;
59struct _sam6883
58typedef enum
6059{
60   TYPE_SAM6883 = 0,
61   TYPE_SAM6883_GIME = 1,
62} SAM6883_VERSION;
63
64
65/*****************************************************************************
66 Type definitions
67*****************************************************************************/
68
69typedef struct _sam6883_t sam6883_t;
70struct _sam6883_t
71{
72   SAM6883_VERSION type;
6173   const sam6883_interface *intf;
6274   UINT16 state;
6375   UINT16 old_state;
r3951r3952
6577   int last_scanline;
6678};
6779
68static sam6883 sam;
69
7080static const UINT8 sam_video_mode_row_heights[] =
7181{
7282   12,   /* 0 - Text */
r3951r3952
91101   32   /* 7 - Reserved/Invalid */
92102};
93103
94static void sam_reset(running_machine *machine);
95104
96static void update_sam(running_machine *machine)
105/*****************************************************************************
106 Implementation
107*****************************************************************************/
108
109INLINE sam6883_t *get_safe_token(const device_config *device)
97110{
98   UINT16 xorval;
111   assert(device != NULL);
112   assert(device->token != NULL);
99113
100   xorval = sam.old_state ^ sam.state;
101   sam.old_state = sam.state;
114   return (sam6883_t *)device->token;
115}
102116
117static void update_sam(const device_config *device)
118{
119   sam6883_t *sam = get_safe_token(device);
120   UINT16 xorval;   
121
122   xorval = sam->old_state ^ sam->state;
123   sam->old_state = sam->state;
124
103125   /* Check changes in Page #1 */
104   if ((xorval & 0x0400) && sam.intf->set_pageonemode)
105      sam.intf->set_pageonemode(machine,(sam.state & 0x0400) / 0x0400);
126   if ((xorval & 0x0400) && sam->intf->set_pageonemode)
127      sam->intf->set_pageonemode(device,(sam->state & 0x0400) / 0x0400);
106128
107129   /* Check changes in MPU Rate */
108   if ((xorval & 0x1800) && sam.intf->set_mpurate)
109      sam.intf->set_mpurate(machine,(sam.state & 0x1800) / 0x0800);
130   if ((xorval & 0x1800) && sam->intf->set_mpurate)
131      sam->intf->set_mpurate(device,(sam->state & 0x1800) / 0x0800);
110132
111133   /* Check changes in Memory Size */
112   if ((xorval & 0x6000) && sam.intf->set_memorysize)
113      sam.intf->set_memorysize(machine,(sam.state & 0x6000) / 0x2000);
134   if ((xorval & 0x6000) && sam->intf->set_memorysize)
135      sam->intf->set_memorysize(device,(sam->state & 0x6000) / 0x2000);
114136
115137   /* Check changes in Map Type */
116   if ((xorval & 0x8000) && sam.intf->set_maptype)
117      sam.intf->set_maptype(machine,(sam.state & 0x8000) / 0x8000);
138   if ((xorval & 0x8000) && sam->intf->set_maptype)
139      sam->intf->set_maptype(device,(sam->state & 0x8000) / 0x8000);
118140}
119141
120142
121143
122144static STATE_POSTLOAD( update_sam_postload )
123145{
124   update_sam(machine);
146   const device_config *device = (const device_config *)param;
147   update_sam(device);
125148}
126149
127
128
129void sam_init(running_machine *machine, const sam6883_interface *intf)
150void sam_set_state(const device_config *device, UINT16 state, UINT16 mask)
130151{
131   sam.state = 0;
132   sam.old_state = ~0;
133   sam.intf = intf;
134
135   add_reset_callback(machine, sam_reset);
136
137   /* save state registration */
138   state_save_register_item(machine, "6883sam", NULL, 0, sam.state);
139   state_save_register_item(machine, "6883sam", NULL, 0, sam.video_position);
140   state_save_register_postload(machine, update_sam_postload, NULL);
152   sam6883_t *sam = get_safe_token(device);
153   sam->state &= ~mask;
154   sam->state |= (state & mask);
155   update_sam(device);
141156}
142157
143
144
145static void sam_reset(running_machine *machine)
158WRITE8_DEVICE_HANDLER(sam6883_w)
146159{
147   sam.state = 0;
148   sam.old_state = ~0;
149   update_sam(machine);
150}
151
152
153
154void sam_set_state(running_machine *machine, UINT16 state, UINT16 mask)
155{
156   sam.state &= ~mask;
157   sam.state |= (state & mask);
158   update_sam(machine);
159}
160
161
162
163WRITE8_HANDLER(sam_w)
164{
165160   UINT16 mask;
166
161   sam6883_t *sam = get_safe_token(device);
162   
167163   if (offset < 32)
168164   {
169165      mask = 1 << (offset / 2);
170166      if (offset & 1)
171         sam.state |= mask;
167         sam->state |= mask;
172168      else
173         sam.state &= ~mask;
174      update_sam(space->machine);
169         sam->state &= ~mask;
170      update_sam(device);
175171   }
176172}
177173
178
179
180const UINT8 *sam_m6847_get_video_ram(running_machine *machine,int scanline)
174const UINT8 *sam_m6847_get_video_ram(const device_config *device,int scanline)
181175{
176   sam6883_t *sam = get_safe_token(device);
182177   const UINT8 *ram_base;
183178   UINT16 video_position;
184179
185   if (scanline != sam.last_scanline)
180   if (scanline != sam->last_scanline)
186181   {
187182      /* first scanline? */
188183      if (scanline == 0)
189184      {
190185         /* reset video position */
191         sam.video_position = (sam.state & 0x03F8) << 6;
186         sam->video_position = (sam->state & 0x03F8) << 6;
192187      }
193188      else
194189      {
195190         /* time to advance a row? */
196         if ((scanline % sam_video_mode_row_heights[sam.state & 0x0007]) == 0)
197            sam.video_position += sam_video_mode_row_pitches[sam.state & 0x0007];
191         if ((scanline % sam_video_mode_row_heights[sam->state & 0x0007]) == 0)
192            sam->video_position += sam_video_mode_row_pitches[sam->state & 0x0007];
198193      }
199      sam.last_scanline = scanline;
194      sam->last_scanline = scanline;
200195   }
201196
202   video_position = sam.video_position;
197   video_position = sam->video_position;
203198
204   if (sam.intf->type != SAM6883_GIME)
199   if (sam->type != TYPE_SAM6883_GIME)
205200   {
206201      /* mask the video position according to the SAM's settings */
207      switch(sam.state & 0x6000)
202      switch(sam->state & 0x6000)
208203      {
209204         case 0x0000:   video_position &= 0x0FFF;   break;   /* 4k */
210205         case 0x2000:   video_position &= 0x3FFF;   break;   /* 16k */
r3951r3952
216211      logerror("sam_m6847_get_video_ram(): scanline=%d video_position=0x%04X\n", scanline, video_position);
217212
218213   /* return actual position */
219   ram_base = sam.intf->get_rambase ? sam.intf->get_rambase(machine) : mess_ram;
214   ram_base = sam->intf->get_rambase ? sam->intf->get_rambase(device) : mess_ram;
220215   return &ram_base[video_position];
221216}
222217
223UINT8 get_sam_memorysize(running_machine *machine)
218UINT8 get_sam_memorysize(const device_config *device)
224219{
225   return (sam.state & 0x6000) / 0x2000;
220   sam6883_t *sam = get_safe_token(device);
221   return (sam->state & 0x6000) / 0x2000;
226222}
227223
228UINT8 get_sam_pagemode(running_machine *machine)
224UINT8 get_sam_pagemode(const device_config *device)
229225{
230   return (sam.state & 0x0400) / 0x0400;
226   sam6883_t *sam = get_safe_token(device);
227   return (sam->state & 0x0400) / 0x0400;
231228}
232229
233UINT8 get_sam_maptype(running_machine *machine)
230UINT8 get_sam_maptype(const device_config *device)
234231{
235   return (sam.state & 0x8000) / 0x8000;
232   sam6883_t *sam = get_safe_token(device);
233   return (sam->state & 0x8000) / 0x8000;
236234}
235
236/* Device Interface */
237static device_start_err common_start(const device_config *device, SAM6883_VERSION device_type)
238{   
239   sam6883_t *sam = get_safe_token(device);
240   // validate arguments
241   assert(device != NULL);
242   assert(device->tag != NULL);
243   assert(strlen(device->tag) < 20);
244   assert(device->static_config != NULL);
245
246   sam->intf = device->static_config;
247
248   sam->type = device_type;
249   
250   sam->state = 0;
251   sam->old_state = ~0;
252   
253   /* save state registration */
254   state_save_register_item(device->machine, "6883sam", NULL, 0, sam->state);
255   state_save_register_item(device->machine, "6883sam", NULL, 0, sam->video_position);
256   state_save_register_postload(device->machine, update_sam_postload, (void*)device);
257   return DEVICE_START_OK;
258}
259
260static DEVICE_START( sam6883 )
261{
262   return common_start(device, TYPE_SAM6883);
263}
264
265static DEVICE_START( sam6883_gime )
266{
267   return common_start(device, TYPE_SAM6883_GIME);
268}
269
270static DEVICE_RESET( sam6883 )
271{
272   sam6883_t *sam = get_safe_token(device);
273   sam->state = 0;
274   sam->old_state = ~0;
275   update_sam(device);
276}
277
278static DEVICE_SET_INFO( sam6883 )
279{
280   switch (state)
281   {
282      /* no parameters to set */
283   }
284}
285
286DEVICE_GET_INFO( sam6883 )
287{
288   switch (state)
289   {
290      /* --- the following bits of info are returned as 64-bit signed integers --- */
291      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(sam6883_t);               break;
292      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
293      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
294
295      /* --- the following bits of info are returned as pointers to data or functions --- */
296      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(sam6883); break;
297      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(sam6883);      break;
298      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
299      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(sam6883);      break;
300
301      /* --- the following bits of info are returned as NULL-terminated strings --- */
302      case DEVINFO_STR_NAME:                     info->s = "6883 SAM";                  break;
303      case DEVINFO_STR_FAMILY:                  info->s = "6883 SAM";                  break;
304      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
305      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
306      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
307   }
308}
309
310DEVICE_GET_INFO( sam6883_gime )
311{
312   switch (state)
313   {
314      /* --- the following bits of info are returned as NULL-terminated strings --- */
315      case DEVINFO_STR_NAME:                     info->s = "6883 SAM GIME";            break;
316
317      /* --- the following bits of info are returned as pointers to data or functions --- */
318      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(sam6883_gime);   break;
319
320      default:                               DEVICE_GET_INFO_CALL(sam6883);            break;
321   }
322}
src/mess/machine/6883sam.h
r3951r3952
1919
2020#include "driver.h"
2121
22typedef enum
23{
24   SAM6883_ORIGINAL,
25   SAM6883_GIME
26} sam6883_type;
2722
23/***************************************************************************
24    MACROS
25***************************************************************************/
26
27#define SAM6883         DEVICE_GET_INFO_NAME(sam6883)
28#define SAM6883_GIME   DEVICE_GET_INFO_NAME(sam6883_gime)
29
30/***************************************************************************
31    TYPE DEFINITIONS
32***************************************************************************/
33typedef UINT8 *(*sam6883_get_rambase_func)(const device_config *device);
34#define SAM6883_GET_RAMBASE(name)   UINT8 *name(const device_config *device )
35
36typedef void (*sam6883_set_pageonemode_func)(const device_config *device, int val);
37#define SAM6883_SET_PAGE_ONE_MODE(name)   void name(const device_config *device, int val )
38
39typedef void (*sam6883_set_mpurate_func)(const device_config *device, int val);
40#define SAM6883_SET_MPU_RATE(name)   void name(const device_config *device, int val )
41
42typedef void (*sam6883_set_memorysize_func)(const device_config *device, int val);
43#define SAM6883_SET_MEMORY_SIZE(name)   void name(const device_config *device, int val )
44
45typedef void (*sam6883_set_map_type_func)(const device_config *device, int val);
46#define SAM6883_SET_MAP_TYPE(name)   void name(const device_config *device, int val )
47
48
2849typedef struct _sam6883_interface sam6883_interface;
2950struct _sam6883_interface
3051{
31   sam6883_type type;
32   const UINT8 *(*get_rambase)(running_machine *machine);
33   void (*set_pageonemode)(running_machine *machine, int val);
34   void (*set_mpurate)(running_machine *machine, int val);
35   void (*set_memorysize)(running_machine *machine, int val);
36   void (*set_maptype)(running_machine *machine, int val);
52   sam6883_get_rambase_func get_rambase;
53   sam6883_set_pageonemode_func set_pageonemode;
54   sam6883_set_mpurate_func set_mpurate;
55   sam6883_set_memorysize_func set_memorysize;
56   sam6883_set_map_type_func set_maptype;
3757};
3858
39/* initialize the SAM */
40void sam_init(running_machine *machine, const sam6883_interface *intf);
59/***************************************************************************
60    FUNCTION PROTOTYPES
61***************************************************************************/
4162
63/* device interface */
64DEVICE_GET_INFO( sam6883 );
65DEVICE_GET_INFO( sam6883_gime );
66
67/* Standard handlers */
68
69/* write to the SAM */
70WRITE8_DEVICE_HANDLER(sam6883_w);
71
4272/* set the state of the SAM */
43void sam_set_state(running_machine *machine,UINT16 state, UINT16 mask);
73void sam_set_state(const device_config *device,UINT16 state, UINT16 mask);
4474
4575/* used by video/m6847.c to read the position of the SAM */
46const UINT8 *sam_m6847_get_video_ram(running_machine *machine,int scanline);
76const UINT8 *sam_m6847_get_video_ram(const device_config *device,int scanline);
4777
48/* write to the SAM */
49WRITE8_HANDLER(sam_w);
50
5178/* used to get memory size and pagemode independent of callbacks */
52UINT8 get_sam_memorysize(running_machine *machine);
53UINT8 get_sam_pagemode(running_machine *machine);
54UINT8 get_sam_maptype(running_machine *machine);
79UINT8 get_sam_memorysize(const device_config *device);
80UINT8 get_sam_pagemode(const device_config *device);
81UINT8 get_sam_maptype(const device_config *device);
5582
83
84/***************************************************************************
85    DEVICE CONFIGURATION MACROS
86***************************************************************************/
87
88#define MDRV_SAM6883_ADD(_tag, _intrf) \
89   MDRV_DEVICE_ADD(_tag, SAM6883) \
90   MDRV_DEVICE_CONFIG(_intrf)
91
92#define MDRV_SAM6883_GIME_ADD(_tag, _intrf) \
93   MDRV_DEVICE_ADD(_tag, SAM6883_GIME) \
94   MDRV_DEVICE_CONFIG(_intrf)
95
96
5697#endif /* __6833SAM_H__ */
src/mess/drivers/coco.c
r3951r3952
5858   AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r,         coco_pia_1_w)
5959   AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r,   coco_cartridge_w)
6060   AM_RANGE(0xff90, 0xffbf) AM_NOP
61   AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w)
61   AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w)
6262   AM_RANGE(0xffe0, 0xffef) AM_NOP
6363   AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("main", 0x3ff0)
6464ADDRESS_MAP_END
r3951r3952
8989   AM_RANGE(0xff90, 0xff9f) AM_READWRITE(coco3_gime_r,         coco3_gime_w)
9090   AM_RANGE(0xffa0, 0xffaf) AM_READWRITE(coco3_mmu_r,         coco3_mmu_w)
9191   AM_RANGE(0xffb0, 0xffbf) AM_READWRITE(SMH_BANK10,         coco3_palette_w)
92   AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w)
92   AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883_GIME, "sam", sam6883_w)
9393   AM_RANGE(0xffe0, 0xffef) AM_NOP
9494   AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("main", 0x7ff0)
9595ADDRESS_MAP_END
r3951r3952
118118   AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r,            coco_pia_1_w)
119119   AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r,      coco_cartridge_w)
120120   AM_RANGE(0xff90, 0xffbf) AM_NOP
121   AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w)
121   AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w)
122122   AM_RANGE(0xffe0, 0xffef) AM_NOP
123123   AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("main", 0x3ff0)
124124ADDRESS_MAP_END
r3951r3952
152152   AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r,coco_pia_1_w)
153153   AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r,   coco_cartridge_w)
154154   AM_RANGE(0xff90, 0xffbf) AM_NOP
155   AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w)
155   AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w)
156156   AM_RANGE(0xffe0, 0xffe1) AM_NOP
157157   AM_RANGE(0xffe2, 0xffe2) AM_READWRITE(plus_reg_r,plus_reg_w)   /* Dragon plus control / status reg */
158158   AM_RANGE(0xffe3, 0xffef) AM_NOP
r3951r3952
233233   AM_RANGE(0xff2c, 0xff2f) AM_READWRITE(wd2797_r,         wd2797_w)   /* Alpha onboard disk interface */
234234   AM_RANGE(0xff40, 0xff8f) AM_READWRITE(coco_cartridge_r,   coco_cartridge_w)
235235   AM_RANGE(0xff90, 0xffbf) AM_NOP
236   AM_RANGE(0xffc0, 0xffdf) AM_WRITE(sam_w)
236   AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w)
237237   AM_RANGE(0xffe0, 0xffef) AM_NOP
238238   AM_RANGE(0xfff0, 0xffff) AM_READ(dragon_alpha_mapped_irq_r)
239239ADDRESS_MAP_END
r3951r3952
667667   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
668668   
669669   MDRV_WD179X_ADD("wd179x", dragon_wd17xx_interface )
670   
671   MDRV_SAM6883_ADD("sam", coco_sam_intf)
670672MACHINE_DRIVER_END
671673
672674static MACHINE_DRIVER_START( dragon64 )
r3951r3952
701703   MDRV_ACIA6551_ADD("acia")
702704   
703705   MDRV_WD179X_ADD("wd179x", dragon_wd17xx_interface )
706   
707   MDRV_SAM6883_ADD("sam", coco_sam_intf)
704708MACHINE_DRIVER_END
705709
706710static MACHINE_DRIVER_START( d64plus )
r3951r3952
735739   MDRV_DEVICE_ADD("acia", ACIA6551)
736740   
737741   MDRV_WD179X_ADD("wd179x", dragon_wd17xx_interface )
742   
743   MDRV_SAM6883_ADD("sam", coco_sam_intf)
738744MACHINE_DRIVER_END
739745
740746static MACHINE_DRIVER_START( dgnalpha )
r3951r3952
772778   MDRV_DEVICE_ADD("acia", ACIA6551)
773779   
774780   MDRV_WD179X_ADD("wd179x", dgnalpha_wd17xx_interface )
781   
782   MDRV_SAM6883_ADD("sam", coco_sam_intf)
775783MACHINE_DRIVER_END
776784
777785static MACHINE_DRIVER_START( tanodr64 )
r3951r3952
806814   MDRV_DEVICE_ADD("acia", ACIA6551)
807815   
808816   MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface )   
817   
818   MDRV_SAM6883_ADD("sam", coco_sam_intf)
809819MACHINE_DRIVER_END
810820
811821static MACHINE_DRIVER_START( coco )
r3951r3952
841851   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
842852   
843853   MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface )   
854   
855   MDRV_SAM6883_ADD("sam", coco_sam_intf)
844856MACHINE_DRIVER_END
845857
846858static MACHINE_DRIVER_START( coco2 )
r3951r3952
876888   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
877889   
878890   MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface )   
891   
892   MDRV_SAM6883_ADD("sam", coco_sam_intf)
879893MACHINE_DRIVER_END
880894
881895static MACHINE_DRIVER_START( coco2b )
r3951r3952
911925   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
912926   
913927   MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface )   
928   
929   MDRV_SAM6883_ADD("sam", coco_sam_intf)
914930MACHINE_DRIVER_END
915931
916932static MACHINE_DRIVER_START( coco3 )
r3951r3952
956972   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
957973   
958974   MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface )   
975   
976   MDRV_SAM6883_GIME_ADD("sam", coco3_sam_intf)
959977MACHINE_DRIVER_END
960978
961979static MACHINE_DRIVER_START( coco3p )
docs/messnew.txt
r3951r3952
9797
9898- Changed the NEC765 implementation to be a device.  [Miodrag Milanovic]
9999
100- Changed the SAM6883 implementation to be a device.  [Miodrag Milanovic]
101
100102- Various code cleanups.  [Atari Ace]
101103
102104- Fixed regression that could cause hanging when creating an image from the

Previous 15994 Revisions Next


© 1998-2018 The MESS Team