Previous 15994 Revisions Next

r3907 Saturday 20th December, 2008 at 12:06:08 UTC by Miodrag Milanović
More deprecat.h removal
[src/mess/devices]coco_fdc.c coco_pak.c cococart.c cococart.h orch90.c
[src/mess/machine]6883sam.c 6883sam.h coco.c mac.c mc10.c ncr5380.c ncr5380.h
[src/mess/video]apf.c atom.c coco.c m6847.c m6847.h vtech1.c

src/mess/video/coco.c
r3906r3907
6262   pia_0_cb1_w(space, 0, data);
6363}
6464
65
66
6765static void internal_video_start_coco(running_machine *machine, m6847_type type)
6866{
6967   m6847_config cfg;
src/mess/video/m6847.c
r3906r3907
109109   void (*horizontal_sync_callback)(running_machine *machine,int line);
110110   void (*field_sync_callback)(running_machine *machine,int line);
111111   UINT8 (*get_attributes)(UINT8 video_byte);
112   const UINT8 *(*get_video_ram)(int scanline);
112   const UINT8 *(*get_video_ram)(running_machine *machine, int scanline);
113113   int (*new_frame_callback)(void);   /* returns whether the M6847 is in charge of this frame */
114114   void (*custom_prepare_scanline)(int scanline);
115115
r3906r3907
14891489}
14901490
14911491
1492INLINE void prepare_scanline(int xpos)
1492INLINE void prepare_scanline(running_machine *machine, int xpos)
14931493{
14941494   UINT8 attrs, data, attr;
14951495   int scanline;
r3906r3907
15351535         scanline -= m6847->top_border_scanlines;
15361536         if ((scanline >= 0) && (scanline < m6847->display_scanlines))
15371537         {
1538            video_ram = m6847->get_video_ram(scanline);
1538            video_ram = m6847->get_video_ram(machine,scanline);
15391539            dirty = m6847->dirty;
15401540            scanline_data = m6847->screendata[scanline];
15411541
r3906r3907
16341634      attotime_make(0, m6847->horizontal_sync_period), 0);
16351635
16361636   set_horizontal_sync(machine);
1637   prepare_scanline(0);
1637   prepare_scanline(machine,0);
16381638}
16391639
16401640static TIMER_CALLBACK(fs_fall)
src/mess/video/m6847.h
r3906r3907
5454   void (*horizontal_sync_callback)(running_machine *machine, int line);
5555   void (*field_sync_callback)(running_machine *machine,int line);
5656   UINT8 (*get_attributes)(UINT8 video_byte) ATTR_CONST;
57   const UINT8 *(*get_video_ram)(int scanline);
57   const UINT8 *(*get_video_ram)(running_machine *machine, int scanline);
5858
5959   /* needed for the CoCo 3 */
6060   int (*new_frame_callback)(void);   /* returns whether the M6847 is in charge of this frame */
src/mess/video/atom.c
r3906r3907
2323   return result;
2424}
2525
26static const UINT8 *atom_get_video_ram(int scanline)
26static const UINT8 *atom_get_video_ram(running_machine *machine, int scanline)
2727{
2828   return videoram + (scanline / 12) * 0x20;
2929}
src/mess/video/apf.c
r3906r3907
4141
4242
4343
44static const UINT8 *apf_get_video_ram(int scanline)
44static const UINT8 *apf_get_video_ram(running_machine *machine, int scanline)
4545{
4646  if (apf_m6847_attr&M6847_AG) {
4747    /* apf has only 1kbyte ram and can't use all for video of course
src/mess/video/vtech1.c
r3906r3907
7171}
7272
7373
74static const UINT8 *vtech1_get_video_ram(int scanline)
74static const UINT8 *vtech1_get_video_ram(running_machine *machine, int scanline)
7575{
7676   return videoram + (scanline / (vtech1_latch & 0x08 ? 3 : 12)) * 0x20;
7777}
src/mess/machine/ncr5380.c
r3906r3907
2121 */
2222
2323#include "driver.h"
24#include "deprecat.h"
2524#include "ncr5380.h"
2625
2726#define VERBOSE   (0)
r3906r3907
360359   return rv;
361360}
362361
363void ncr5380_init( const struct NCR5380interface *interface )
362void ncr5380_init( running_machine *machine, const struct NCR5380interface *interface )
364363{
365364   int i;
366365
r3906r3907
376375      SCSIAllocInstance( interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
377376   }
378377
379   state_save_register_item_array(Machine, "ncr5380", NULL, 0, n5380_Registers);
380   state_save_register_item_array(Machine, "ncr5380", NULL, 0, n5380_Command);
381   state_save_register_item_array(Machine, "ncr5380", NULL, 0, n5380_Data);
382   state_save_register_item(Machine, "ncr5380", NULL, 0, last_id);
383   state_save_register_item(Machine, "ncr5380", NULL, 0, cmd_ptr);
384   state_save_register_item(Machine, "ncr5380", NULL, 0, d_ptr);
385   state_save_register_item(Machine, "ncr5380", NULL, 0, d_limit);
378   state_save_register_item_array(machine, "ncr5380", NULL, 0, n5380_Registers);
379   state_save_register_item_array(machine, "ncr5380", NULL, 0, n5380_Command);
380   state_save_register_item_array(machine, "ncr5380", NULL, 0, n5380_Data);
381   state_save_register_item(machine, "ncr5380", NULL, 0, last_id);
382   state_save_register_item(machine, "ncr5380", NULL, 0, cmd_ptr);
383   state_save_register_item(machine, "ncr5380", NULL, 0, d_ptr);
384   state_save_register_item(machine, "ncr5380", NULL, 0, d_limit);
386385}
387386
388387void ncr5380_exit( const struct NCR5380interface *interface )
src/mess/machine/ncr5380.h
r3906r3907
3838#define R5380_OUTDATA_DTACK   (R5380_OUTDATA | 0x10)
3939#define R5380_CURDATA_DTACK   (R5380_CURDATA | 0x10)
4040
41extern void ncr5380_init( const struct NCR5380interface *interface );
41extern void ncr5380_init( running_machine *machine, const struct NCR5380interface *interface );
4242extern void ncr5380_exit( const struct NCR5380interface *interface );
4343extern void ncr5380_read_data(int bytes, UINT8 *pData);
4444extern void ncr5380_write_data(int bytes, UINT8 *pData);
src/mess/machine/coco.c
r3906r3907
8282#include <assert.h>
8383
8484#include "driver.h"
85#include "deprecat.h"
8685#include "cpu/m6809/m6809.h"
8786#include "machine/6821pia.h"
8887#include "includes/coco.h"
r3906r3907
136135static void d_pia0_irq_b(running_machine *machine, int state);
137136static void d_pia1_firq_a(running_machine *machine, int state);
138137static void d_pia1_firq_b(running_machine *machine, int state);
139static void d_sam_set_pageonemode(int val);
140static void d_sam_set_mpurate(int val);
141static void d_sam_set_memorysize(int val);
142static void d_sam_set_maptype(int val);
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);
143142static void coco_setcartline(running_machine *machine, coco_cartridge *cartridge, cococart_line line, cococart_line_value value);
144143static void twiddle_cart_line_if_q(running_machine *machine);
145144
r3906r3907
160159static void coco3_pia0_irq_b(running_machine *machine, int state);
161160static void coco3_pia1_firq_a(running_machine *machine, int state);
162161static void coco3_pia1_firq_b(running_machine *machine, int state);
163static void coco3_sam_set_maptype(int val);
164static const UINT8 *coco3_sam_get_rambase(void);
162static void coco3_sam_set_maptype(running_machine *machine, int val);
163static const UINT8 *coco3_sam_get_rambase(running_machine *machine);
165164
166165/* Dragon 32 specific */
167166static READ8_HANDLER ( d_pia1_pb_r_dragon32 );
r3906r3907
497496    * access that bit or or whether it is something else.  So that is why
498497    * I am specifying 0x7fff instead of 0xffff here
499498    */
500   sam_set_state(trailer->sam, 0x7fff);
499   sam_set_state(machine, trailer->sam, 0x7fff);
501500}
502501
503502static int generic_pak_load(const device_config *image, int rambase_index, int rombase_index, int pakbase_index)
r3906r3907
14581457}
14591458
14601459/* Printer output functions used by d_pia1_pa_w */
1461static void (*printer_out)(int data);
1460static void (*printer_out)(running_machine *machine, int data);
14621461
14631462/* Printer output for the CoCo, output to bitbanger port */
1464static void printer_out_coco(int data)
1463static void printer_out_coco(running_machine *machine, int data)
14651464{
1466   bitbanger_output(bitbanger_image(Machine), (data & 2) >> 1);
1465   bitbanger_output(bitbanger_image(machine), (data & 2) >> 1);
14671466}
14681467
14691468/* Printer output for the Dragon, output to Paralel port */
1470static void printer_out_dragon(int data)
1469static void printer_out_dragon(running_machine *machine, int data)
14711470{
14721471   /* If strobe bit is high send data from pia0 port b to dragon parallel printer */
14731472   if (data & 0x02)
14741473   {
1475      printer_output(printer_image(Machine), pia_get_output_b(0));
1474      printer_output(printer_image(machine), pia_get_output_b(0));
14761475   }
14771476}
14781477
r3906r3907
15431542
15441543   /* Handle printer output, serial for CoCos, Paralell for Dragons */
15451544
1546   printer_out(data);
1545   printer_out(space->machine, data);
15471546}
15481547
15491548/*
r3906r3907
18681867  Misc
18691868***************************************************************************/
18701869
1871static void d_sam_set_mpurate(int val)
1870static void d_sam_set_mpurate(running_machine *machine, int val)
18721871{
18731872   /* The infamous speed up poke.
18741873    *
r3906r3907
18921891    * TODO:  Make the overclock more accurate.  In dual speed, ROM was a fast
18931892    * access but RAM was not.  I don't know how to simulate this.
18941893    */
1895    cpu_set_clockscale(Machine->cpu[0], val ? 2 : 1);
1894    cpu_set_clockscale(machine->cpu[0], val ? 2 : 1);
18961895}
18971896
18981897READ8_HANDLER(dragon_alpha_mapped_irq_r)
r3906r3907
19531952
19541953   /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */
19551954   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
1956   UINT8 memsize   = get_sam_memorysize();
1957   UINT8 maptype   = get_sam_maptype();
1958//   UINT8 pagemode   = get_sam_pagemode();
1955   UINT8 memsize   = get_sam_memorysize(machine);
1956   UINT8 maptype   = get_sam_maptype(machine);
1957//   UINT8 pagemode   = get_sam_pagemode(machine);
19591958   int       last_ram_block;      /* Last block that will be RAM, dependent on maptype */
19601959   int       block_index;      /* Index of block being processed */
19611960   int       wbank;         /* bank no to go in this block */
r3906r3907
20212020}
20222021
20232022
2024static void d_sam_set_pageonemode(int val)
2023static void d_sam_set_pageonemode(running_machine *machine, int val)
20252024{
20262025   /* Page mode - allowed switching between the low 32k and the high 32k,
20272026    * assuming that 64k wasn't enabled
r3906r3907
20302029    * this (it probably ignored it)
20312030    */
20322031
2033   if (!get_sam_maptype())      // Ignored in maptype 1
2032   if (!get_sam_maptype(machine))      // Ignored in maptype 1
20342033   {
20352034      if((mess_ram_size>0x8000) && val)
20362035         bottom_32k=&mess_ram[0x8000];
20372036      else
20382037         bottom_32k=mess_ram;
20392038
2040      setup_memory_map(Machine);
2039      setup_memory_map(machine);
20412040   }
20422041}
20432042
2044static void d_sam_set_memorysize(int val)
2043static void d_sam_set_memorysize(running_machine *machine, int val)
20452044{
20462045   /* Memory size - allowed restricting memory accesses to something less than
20472046    * 32k
r3906r3907
20672066    * TODO:  Verify that the CoCo 3 ignored this
20682067    */
20692068
2070   setup_memory_map(Machine);
2069   setup_memory_map(machine);
20712070}
20722071
20732072
r3906r3907
21632162/* way as the CoCo 1/2 and Dragon 32, this now has been reduced to a call to */
21642163/* setup_memory_map() - 2007-01-02 phs. */
21652164
2166static void d_sam_set_maptype(int val)
2165static void d_sam_set_maptype(running_machine *machine,int val)
21672166{
21682167   if(val)
21692168      bottom_32k=mess_ram;   // Always reset, when in maptype 1
21702169
2171   setup_memory_map(Machine);
2170   setup_memory_map(machine);
21722171}
21732172
21742173/*************************************
r3906r3907
25702569
25712570
25722571
2573static const UINT8 *coco3_sam_get_rambase(void)
2572static const UINT8 *coco3_sam_get_rambase(running_machine *machine)
25742573{
25752574   UINT32 video_base;
25762575   video_base = coco3_get_video_base(0xE0, 0x3F);
r3906r3907
25802579
25812580
25822581
2583static void coco3_sam_set_maptype(int val)
2582static void coco3_sam_set_maptype(running_machine *machine,int val)
25842583{
25852584   coco3_enable_64k = val;
2586   coco3_mmu_update(Machine, 4, 8);
2585   coco3_mmu_update(machine, 4, 8);
25872586}
25882587
25892588
r3906r3907
28262825   const pia6821_interface *piaintf;         /* PIA initializer */
28272826   int   piaintf_count;                     /* PIA count */
28282827   timer_fired_func recalc_interrupts_;         /* recalculate inturrupts callback */
2829   void (*printer_out_)(int data);            /* printer output callback */
2828   void (*printer_out_)(running_machine *machine, int data);            /* printer output callback */
28302829   timer_fired_func cart_timer_proc;            /* cartridge timer proc */
28312830   const char *fdc_cart_hardware;            /* normal cartridge hardware */
28322831   void (*map_memory)(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask);
src/mess/machine/6883sam.c
r3906r3907
9393
9494static void sam_reset(running_machine *machine);
9595
96static void update_sam(void)
96static void update_sam(running_machine *machine)
9797{
9898   UINT16 xorval;
9999
r3906r3907
102102
103103   /* Check changes in Page #1 */
104104   if ((xorval & 0x0400) && sam.intf->set_pageonemode)
105      sam.intf->set_pageonemode((sam.state & 0x0400) / 0x0400);
105      sam.intf->set_pageonemode(machine,(sam.state & 0x0400) / 0x0400);
106106
107107   /* Check changes in MPU Rate */
108108   if ((xorval & 0x1800) && sam.intf->set_mpurate)
109      sam.intf->set_mpurate((sam.state & 0x1800) / 0x0800);
109      sam.intf->set_mpurate(machine,(sam.state & 0x1800) / 0x0800);
110110
111111   /* Check changes in Memory Size */
112112   if ((xorval & 0x6000) && sam.intf->set_memorysize)
113      sam.intf->set_memorysize((sam.state & 0x6000) / 0x2000);
113      sam.intf->set_memorysize(machine,(sam.state & 0x6000) / 0x2000);
114114
115115   /* Check changes in Map Type */
116116   if ((xorval & 0x8000) && sam.intf->set_maptype)
117      sam.intf->set_maptype((sam.state & 0x8000) / 0x8000);
117      sam.intf->set_maptype(machine,(sam.state & 0x8000) / 0x8000);
118118}
119119
120120
121121
122122static STATE_POSTLOAD( update_sam_postload )
123123{
124   update_sam();
124   update_sam(machine);
125125}
126126
127127
r3906r3907
146146{
147147   sam.state = 0;
148148   sam.old_state = ~0;
149   update_sam();
149   update_sam(machine);
150150}
151151
152152
153153
154void sam_set_state(UINT16 state, UINT16 mask)
154void sam_set_state(running_machine *machine, UINT16 state, UINT16 mask)
155155{
156156   sam.state &= ~mask;
157157   sam.state |= (state & mask);
158   update_sam();
158   update_sam(machine);
159159}
160160
161161
r3906r3907
171171         sam.state |= mask;
172172      else
173173         sam.state &= ~mask;
174      update_sam();
174      update_sam(space->machine);
175175   }
176176}
177177
178178
179179
180const UINT8 *sam_m6847_get_video_ram(int scanline)
180const UINT8 *sam_m6847_get_video_ram(running_machine *machine,int scanline)
181181{
182182   const UINT8 *ram_base;
183183   UINT16 video_position;
r3906r3907
216216      logerror("sam_m6847_get_video_ram(): scanline=%d video_position=0x%04X\n", scanline, video_position);
217217
218218   /* return actual position */
219   ram_base = sam.intf->get_rambase ? sam.intf->get_rambase() : mess_ram;
219   ram_base = sam.intf->get_rambase ? sam.intf->get_rambase(machine) : mess_ram;
220220   return &ram_base[video_position];
221221}
222222
223UINT8 get_sam_memorysize(void)
223UINT8 get_sam_memorysize(running_machine *machine)
224224{
225225   return (sam.state & 0x6000) / 0x2000;
226226}
227227
228UINT8 get_sam_pagemode(void)
228UINT8 get_sam_pagemode(running_machine *machine)
229229{
230230   return (sam.state & 0x0400) / 0x0400;
231231}
232232
233UINT8 get_sam_maptype(void)
233UINT8 get_sam_maptype(running_machine *machine)
234234{
235235   return (sam.state & 0x8000) / 0x8000;
236236}
src/mess/machine/6883sam.h
r3906r3907
2929struct _sam6883_interface
3030{
3131   sam6883_type type;
32   const UINT8 *(*get_rambase)(void);
33   void (*set_pageonemode)(int val);
34   void (*set_mpurate)(int val);
35   void (*set_memorysize)(int val);
36   void (*set_maptype)(int val);
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);
3737};
3838
3939/* initialize the SAM */
4040void sam_init(running_machine *machine, const sam6883_interface *intf);
4141
4242/* set the state of the SAM */
43void sam_set_state(UINT16 state, UINT16 mask);
43void sam_set_state(running_machine *machine,UINT16 state, UINT16 mask);
4444
4545/* used by video/m6847.c to read the position of the SAM */
46const UINT8 *sam_m6847_get_video_ram(int scanline);
46const UINT8 *sam_m6847_get_video_ram(running_machine *machine,int scanline);
4747
4848/* write to the SAM */
4949WRITE8_HANDLER(sam_w);
5050
5151/* used to get memory size and pagemode independent of callbacks */
52UINT8 get_sam_memorysize(void);
53UINT8 get_sam_pagemode(void);
54UINT8 get_sam_maptype(void);
52UINT8 get_sam_memorysize(running_machine *machine);
53UINT8 get_sam_pagemode(running_machine *machine);
54UINT8 get_sam_maptype(running_machine *machine);
5555
5656#endif /* __6833SAM_H__ */
src/mess/machine/mac.c
r3906r3907
18751875
18761876MACHINE_START( macscsi )
18771877{
1878   ncr5380_init(&macplus_5380intf);
1878   ncr5380_init(machine, &macplus_5380intf);
18791879   
18801880   add_exit_callback(machine, macscsi_exit);
18811881}
src/mess/machine/mc10.c
r3906r3907
179179}
180180
181181
182static const UINT8 *mc10_get_video_ram(int scanline)
182static const UINT8 *mc10_get_video_ram(running_machine *machine, int scanline)
183183{
184184   offs_t offset = 0;
185185
src/mess/devices/cococart.h
r3906r3907
6767   genf *  f;                                             /* generic function pointers */
6868   char *   s;                                             /* generic strings */
6969
70   void   (*init)(coco_cartridge *cartridge);                     /* COCOCARTINFO_PTR_INIT */
71   UINT8   (*rh)(coco_cartridge *cartridge, UINT16 addr);            /* COCOCARTINFO_PTR_FF40_R */
72   void   (*wh)(coco_cartridge *cartridge, UINT16 addr, UINT8 data);   /* COCOCARTINFO_PTR_FF40_W */
70   void   (*init)(running_machine *machine,coco_cartridge *cartridge);                     /* COCOCARTINFO_PTR_INIT */
71   UINT8   (*rh)(running_machine *machine,coco_cartridge *cartridge, UINT16 addr);            /* COCOCARTINFO_PTR_FF40_R */
72   void   (*wh)(running_machine *machine,coco_cartridge *cartridge, UINT16 addr, UINT8 data);   /* COCOCARTINFO_PTR_FF40_W */
7373};
7474
7575typedef void (*cococart_getinfo)(UINT32 state, cococartinfo *info);
src/mess/devices/orch90.c
r3906r3907
3939    orch90_init - initializer for the Orch-90
4040-------------------------------------------------*/
4141
42static void orch90_init(coco_cartridge *cartridge)
42static void orch90_init(running_machine *machine, coco_cartridge *cartridge)
4343{
4444   orch90_info *info = orch90_get_info(cartridge);
4545
r3906r3907
5454    orch90_w - function to write to the Orch-90
5555-------------------------------------------------*/
5656
57static void orch90_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
57static void orch90_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data)
5858{
5959   orch90_info *info = orch90_get_info(cartridge);
6060
src/mess/devices/coco_pak.c
r3906r3907
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "device.h"
1211#include "cococart.h"
1312
r3906r3907
1615    pak_init - initializer for the PAKs
1716-------------------------------------------------*/
1817
19static void pak_init(coco_cartridge *cartridge)
18static void pak_init(running_machine *machine, coco_cartridge *cartridge)
2019{
21   cococart_set_line(Machine, cartridge, COCOCART_LINE_CART, COCOCART_LINE_VALUE_Q);
20   cococart_set_line(machine, cartridge, COCOCART_LINE_CART, COCOCART_LINE_VALUE_Q);
2221}
2322
2423
r3906r3907
5049    banked_pak_set_bank - function to set the bank
5150-------------------------------------------------*/
5251
53static void banked_pak_set_bank(coco_cartridge *cartridge, UINT32 bank)
52static void banked_pak_set_bank(running_machine *machine, coco_cartridge *cartridge, UINT32 bank)
5453{
55   cococart_map_memory(Machine, cartridge, bank * 0x4000, 0x3FFF);
54   cococart_map_memory(machine, cartridge, bank * 0x4000, 0x3FFF);
5655}
5756
5857
r3906r3907
6160    banked_pak_init
6261-------------------------------------------------*/
6362
64static void banked_pak_init(coco_cartridge *cartridge)
63static void banked_pak_init(running_machine *machine, coco_cartridge *cartridge)
6564{
66   pak_init(cartridge);
67   banked_pak_set_bank(cartridge, 0);
65   pak_init(machine,cartridge);
66   banked_pak_set_bank(machine,cartridge, 0);
6867}
6968
7069
r3906r3907
7372    banked_pak_w - function to write to $FF40
7473-------------------------------------------------*/
7574
76static void banked_pak_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
75static void banked_pak_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data)
7776{
7877   switch(addr)
7978   {
8079      case 0:
8180         /* set the bank */
82         banked_pak_set_bank(cartridge, data);
81         banked_pak_set_bank(machine, cartridge, data);
8382         break;
8483   }
8584}
src/mess/devices/coco_fdc.c
r3906r3907
6767*********************************************************************/
6868
6969#include "driver.h"
70#include "deprecat.h"
7170#include "cococart.h"
7271#include "coco_vhd.h"
7372#include "includes/coco.h"
r3906r3907
8584   unsigned drq : 1;
8685   unsigned intrq : 1;
8786
88   void (*update_lines)(coco_cartridge *cartridge);
87   void (*update_lines)(running_machine *machine, coco_cartridge *cartridge);
8988};
9089
9190
r3906r3907
133132         break;
134133   }
135134
136   (*info->update_lines)(cartridge);
135   (*info->update_lines)(device->machine,cartridge);
137136}
138137
139138extern coco_cartridge *coco_cart;
r3906r3907
157156    fdc_init - general function to initialize FDC
158157-------------------------------------------------*/
159158
160static void fdc_init(running_machine *machine,
161   coco_cartridge *cartridge,
162   void (*update_lines)(coco_cartridge *cartridge),
159static void fdc_init(coco_cartridge *cartridge,
160   void (*update_lines)(running_machine *machine,coco_cartridge *cartridge),
163161   int initial_drq)
164162{
165163   fdc_info *info = fdc_get_info(cartridge);
r3906r3907
168166   memset(info, 0, sizeof(*info));
169167   info->update_lines = update_lines;
170168   info->drq = initial_drq ? 1 : 0;
171
172   /* initialize FDC */
173//   wd17xx_init(machine, type, fdc_callback, (void *) cartridge);
174169}
175170
176171
r3906r3907
199194   controller lines
200195-------------------------------------------------*/
201196
202static void fdc_coco_update_lines(coco_cartridge *cartridge)
197static void fdc_coco_update_lines(running_machine *machine, coco_cartridge *cartridge)
203198{
204199   fdc_info *info = fdc_get_info(cartridge);
205200
r3906r3907
209204
210205   /* set the NMI line */
211206   cococart_set_line(
212      Machine,
207      machine,
213208      cartridge,
214209      COCOCART_LINE_NMI,
215210      ((info->intrq != 0) && (info->dskreg & 0x20)) ? COCOCART_LINE_VALUE_ASSERT : COCOCART_LINE_VALUE_CLEAR);
216211
217212   /* set the HALT line */
218213   cococart_set_line(
219      Machine,
214      machine,
220215      cartridge,
221216      COCOCART_LINE_HALT,
222217      ((info->drq == 0) && (info->dskreg & 0x80)) ? COCOCART_LINE_VALUE_ASSERT : COCOCART_LINE_VALUE_CLEAR);
r3906r3907
228223    fdc_coco_init - function to initialize CoCo FDC
229224-------------------------------------------------*/
230225
231static void fdc_coco_init(coco_cartridge *cartridge)
226static void fdc_coco_init(running_machine *machine, coco_cartridge *cartridge)
232227{
233   fdc_init(Machine, cartridge, fdc_coco_update_lines, 1);
228   fdc_init(cartridge, fdc_coco_update_lines, 1);
234229}
235230
236231
r3906r3907
240235   dskreg
241236-------------------------------------------------*/
242237
243static void fdc_coco_dskreg_w(coco_cartridge *cartridge, UINT8 data)
238static void fdc_coco_dskreg_w(running_machine *machine, coco_cartridge *cartridge, UINT8 data)
244239{
245   running_machine *machine = Machine;
246240   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1773, "wd1773");
247241   fdc_info *info = fdc_get_info(cartridge);
248242   UINT8 drive = 0;
r3906r3907
286280
287281   info->dskreg = data;
288282
289   (*info->update_lines)(cartridge);
283   (*info->update_lines)(machine, cartridge);
290284
291285   wd17xx_set_drive(fdc,drive);
292286   wd17xx_set_side(fdc,head);
r3906r3907
299293    fdc_coco_r - function to read from CoCo FDC
300294-------------------------------------------------*/
301295
302static UINT8 fdc_coco_r(coco_cartridge *cartridge, UINT16 addr)
296static UINT8 fdc_coco_r(running_machine *machine, coco_cartridge *cartridge, UINT16 addr)
303297{
304   running_machine *machine = Machine;
305298   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1773, "wd1773");
306299   UINT8 result = 0;
307300   switch(addr & 0xEF)
r3906r3907
328321    fdc_coco_w - function to write to CoCo FDC
329322-------------------------------------------------*/
330323
331static void fdc_coco_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
324static void fdc_coco_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data)
332325{
333   running_machine *machine = Machine;
334326   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD1773, "wd1773");
335327   switch(addr & 0xEF)
336328   {
337329      case 0: case 1: case 2: case 3:
338330      case 4: case 5: case 6: case 7:
339         fdc_coco_dskreg_w(cartridge, data);
331         fdc_coco_dskreg_w(machine, cartridge, data);
340332         break;
341333      case 8:
342334         wd17xx_command_w(fdc, 0, data);
r3906r3907
397389    real_time_clock
398390-------------------------------------------------*/
399391
400static rtc_type_t real_time_clock(void)
392static rtc_type_t real_time_clock(running_machine *machine)
401393{
402   return (rtc_type_t) (int) input_port_read_safe(Machine, "real_time_clock", 0x00);
394   return (rtc_type_t) (int) input_port_read_safe(machine, "real_time_clock", 0x00);
403395}
404396
405397
r3906r3907
408400    fdc_coco3plus_r
409401-------------------------------------------------*/
410402
411static UINT8 fdc_coco3plus_r(coco_cartridge *cartridge, UINT16 addr)
403static UINT8 fdc_coco3plus_r(running_machine *machine, coco_cartridge *cartridge, UINT16 addr)
412404{
413405   const device_config *dev;
414   running_machine *machine = Machine;
415406   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
416   UINT8 result = fdc_coco_r(cartridge, addr);
407   UINT8 result = fdc_coco_r(machine, cartridge, addr);
417408
418409   switch(addr)
419410   {
420411      case 0x10:   /* FF50 */
421         if (real_time_clock() == RTC_DISTO)
412         if (real_time_clock(machine) == RTC_DISTO)
422413         {
423414            dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto");
424415            result = msm6242_r(dev, msm6242_rtc_address);
r3906r3907
426417         break;
427418
428419      case 0x38:   /* FF78 */
429         if (real_time_clock() == RTC_CLOUD9)
420         if (real_time_clock(machine) == RTC_CLOUD9)
430421            ds1315_r_0(space, addr);
431422         break;
432423
433424      case 0x39:   /* FF79 */
434         if (real_time_clock() == RTC_CLOUD9)
425         if (real_time_clock(machine) == RTC_CLOUD9)
435426            ds1315_r_1(space, addr);
436427         break;
437428
438429      case 0x3C:   /* FF7C */
439         if (real_time_clock() == RTC_CLOUD9)
430         if (real_time_clock(machine) == RTC_CLOUD9)
440431            result = ds1315_r_data(space, addr);
441432         break;
442433
r3906r3907
460451    fdc_coco3plus_w
461452-------------------------------------------------*/
462453
463static void fdc_coco3plus_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
454static void fdc_coco3plus_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data)
464455{
465456   const device_config *dev;
466   running_machine *machine = Machine;
467457
468   fdc_coco_w(cartridge, addr, data);
458   fdc_coco_w(machine, cartridge, addr, data);
469459
470460   switch(addr)
471461   {
472462      case 0x10:   /* FF50 */
473         if (real_time_clock() == RTC_DISTO)
463         if (real_time_clock(machine) == RTC_DISTO)
474464         {
475465            dev = device_list_find_by_tag(machine->config->devicelist, MSM6242, "disto");
476466            msm6242_w(dev, msm6242_rtc_address, data);
r3906r3907
478468         break;
479469
480470      case 0x11:   /* FF51 */
481         if (real_time_clock() == RTC_DISTO)
471         if (real_time_clock(machine) == RTC_DISTO)
482472            msm6242_rtc_address = data & 0x0f;
483473         break;
484474
r3906r3907
528518   controller lines
529519-------------------------------------------------*/
530520
531static void fdc_dragon_update_lines(coco_cartridge *cartridge)
521static void fdc_dragon_update_lines(running_machine *machine, coco_cartridge *cartridge)
532522{
533523   fdc_info *info = fdc_get_info(cartridge);
534524
535525   /* set the NMI line */
536526   cococart_set_line(
537      Machine,
527      machine,
538528      cartridge,
539529      COCOCART_LINE_NMI,
540530      ((info->intrq != 0) && (info->dskreg & 0x20)) ? COCOCART_LINE_VALUE_ASSERT : COCOCART_LINE_VALUE_CLEAR);
541531
542532   /* set the CART line */
543533   cococart_set_line(
544      Machine,
534      machine,
545535      cartridge,
546536      COCOCART_LINE_CART,
547537      (info->drq != 0) ? COCOCART_LINE_VALUE_ASSERT : COCOCART_LINE_VALUE_CLEAR);
r3906r3907
554544   FDC
555545-------------------------------------------------*/
556546
557static void fdc_dragon_init(coco_cartridge *cartridge)
547static void fdc_dragon_init(running_machine *machine, coco_cartridge *cartridge)
558548{
559   fdc_init(Machine, cartridge, fdc_dragon_update_lines, 0);
549   fdc_init( cartridge, fdc_dragon_update_lines, 0);
560550}
561551
562552
r3906r3907
566556   Dragon dskreg
567557-------------------------------------------------*/
568558
569static void fdc_dragon_dskreg_w(coco_cartridge *cartridge, UINT8 data)
559static void fdc_dragon_dskreg_w(running_machine *machine,coco_cartridge *cartridge, UINT8 data)
570560{
571   running_machine *machine = Machine;
572561   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
573562   fdc_info *info = fdc_get_info(cartridge);
574563
r3906r3907
599588    fdc_dragon_r - function to read from Dragon FDC
600589-------------------------------------------------*/
601590
602static UINT8 fdc_dragon_r(coco_cartridge *cartridge, UINT16 addr)
591static UINT8 fdc_dragon_r(running_machine *machine, coco_cartridge *cartridge, UINT16 addr)
603592{
604   running_machine *machine = Machine;
605593   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
606594   UINT8 result = 0;
607595   switch(addr & 0xEF)
r3906r3907
628616    fdc_dragon_w - function to write to Dragon FDC
629617-------------------------------------------------*/
630618
631static void fdc_dragon_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
619static void fdc_dragon_w(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data)
632620{
633   running_machine *machine = Machine;
634621   device_config *fdc = (device_config*)device_list_find_by_tag( machine->config->devicelist, WD179X, "wd179x");
635622   switch(addr & 0xEF)
636623   {
r3906r3907
653640         break;
654641      case 8: case 9: case 10: case 11:
655642      case 12: case 13: case 14: case 15:
656         fdc_dragon_dskreg_w(cartridge, data);
643         fdc_dragon_dskreg_w(machine, cartridge, data);
657644         break;
658645   };
659646}
src/mess/devices/cococart.c
r3906r3907
1212
1313struct _coco_cartridge
1414{
15   UINT8            (*rh)(coco_cartridge *cartridge, UINT16 addr);
16   void            (*wh)(coco_cartridge *cartridge, UINT16 addr, UINT8 data);
15   UINT8            (*rh)(running_machine *machine, coco_cartridge *cartridge, UINT16 addr);
16   void            (*wh)(running_machine *machine, coco_cartridge *cartridge, UINT16 addr, UINT8 data);
1717   void            (*set_line)(running_machine *machine, coco_cartridge *cartridge, cococart_line line, cococart_line_value value);
1818   void            (*map_memory)(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask);
1919   void            *extra_data;
r3906r3907
6262   coco_cartridge *cartridge;
6363   cococart_getinfo cart_proc;
6464   size_t extra_data_size;
65   void (*init)(coco_cartridge *cartridge);
65   void (*init)(running_machine *machine,coco_cartridge *cartridge);
6666
6767   /* sanity check */
6868   assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call cococart_init at init time!");
r3906r3907
7777   memset(cartridge, '\0', sizeof(*cartridge) + extra_data_size - 1);
7878
7979   /* populate the cartridge structure */
80   cartridge->rh         = (UINT8 (*)(coco_cartridge *, UINT16)) cococart_get_info_fct(cart_proc, COCOCARTINFO_PTR_FF40_R);
81   cartridge->wh         = (void (*)(coco_cartridge *, UINT16, UINT8)) cococart_get_info_fct(cart_proc, COCOCARTINFO_PTR_FF40_W);
80   cartridge->rh         = (UINT8 (*)(running_machine *machine,coco_cartridge *, UINT16)) cococart_get_info_fct(cart_proc, COCOCARTINFO_PTR_FF40_R);
81   cartridge->wh         = (void (*)(running_machine *machine,coco_cartridge *, UINT16, UINT8)) cococart_get_info_fct(cart_proc, COCOCARTINFO_PTR_FF40_W);
8282   cartridge->extra_data   = (extra_data_size > 0) ? cartridge->dummy : NULL;
8383
8484   /* copy callbacks */
r3906r3907
8989   }
9090
9191   /* invoke init function */
92   init = (void (*)(coco_cartridge *cartridge)) cococart_get_info_fct(cart_proc, COCOCARTINFO_PTR_INIT);
92   init = (void (*)(running_machine *machine, coco_cartridge *cartridge)) cococart_get_info_fct(cart_proc, COCOCARTINFO_PTR_INIT);
9393   if (init != NULL)
94      init(cartridge);
94      init(machine, cartridge);
9595
9696   /* finish up */
9797   return cartridge;
r3906r3907
105105
106106UINT8 cococart_read(running_machine *machine, coco_cartridge *cartridge, UINT16 address)
107107{
108   return cartridge->rh ? cartridge->rh(cartridge, address) : 0xFF;
108   return cartridge->rh ? cartridge->rh(machine, cartridge, address) : 0xFF;
109109}
110110
111111
r3906r3907
117117void cococart_write(running_machine *machine, coco_cartridge *cartridge, UINT16 address, UINT8 data)
118118{
119119   if (cartridge->wh)
120      cartridge->wh(cartridge, address, data);
120      cartridge->wh(machine, cartridge, address, data);
121121}
122122
123123

Previous 15994 Revisions Next


© 1998-2018 The MESS Team