Previous 199869 Revisions Next

r31878 Tuesday 2nd September, 2014 at 20:56:57 UTC by Fabio Priuli
(MESS) atari400.c: start attempt to untangle a bit the video &
machine code. nw.
[src/mame/drivers]bartop52.c maxaflex.c
[src/mame/includes]atari.h
[src/mame/machine]atari.c
[src/mame/video]antic.c gtia.c gtia.h
[src/mess/drivers]atari400.c

trunk/src/mess/drivers/atari400.c
r31877r31878
260260   DECLARE_MACHINE_START(a800xl);
261261   DECLARE_MACHINE_START(a5200);
262262   DECLARE_PALETTE_INIT(a400);
263   
263
264   DECLARE_MACHINE_RESET(a400);
265
264266   DECLARE_WRITE8_MEMBER(a600xl_pia_pb_w);
265267   DECLARE_WRITE8_MEMBER(a800xl_pia_pb_w);
266268   
r31877r31878
299301   
300302   void setup_ram(int bank,UINT32 size);
301303   void setup_cart(int type);
304
305   // start helper (until GTIA & ANTIC are device-fied)
306   void common_start();
307   void a5200_start();
302308};
303309
304310
r31877r31878
18571863   }   
18581864}
18591865
1866static UINT8 console_read(address_space &space)
1867{
1868   return space.machine().root_device().ioport("console")->read();
1869}
18601870
1871static void console_write(address_space &space, UINT8 data)
1872{
1873   dac_device *dac = space.machine().device<dac_device>("dac");
1874   if (data & 0x08)
1875      dac->write_unsigned8((UINT8)-120);
1876   else
1877      dac->write_unsigned8(+120);
1878}
1879
1880
1881void a400_state::common_start()
1882{   
1883   /* GTIA */
1884   gtia_interface gtia_intf;
1885   gtia_intf.console_read = console_read;
1886   gtia_intf.console_write = console_write;
1887   gtia_init(machine(), &gtia_intf);
1888   
1889   /* ANTIC */
1890   antic_start(machine());
1891}
1892
1893void a400_state::a5200_start()
1894{
1895   /* GTIA */
1896   gtia_interface gtia_intf;
1897   memset(&gtia_intf, 0, sizeof(gtia_intf));
1898   gtia_init(machine(), &gtia_intf);   
1899   
1900   /* ANTIC */
1901   antic_start(machine());
1902}
1903
1904MACHINE_RESET_MEMBER( a400_state, a400 )
1905{
1906   pokey_device *pokey = machine().device<pokey_device>("pokey");
1907   pokey->write(15,0);
1908   antic_reset();
1909}
1910
1911
18611912MACHINE_START_MEMBER( a400_state, a400 )
18621913{
1863   atari_machine_start();
1914   common_start();
18641915   setup_ram(0, m_ram->size());
18651916   setup_ram(1, m_ram->size());
18661917   setup_ram(2, m_ram->size());
r31877r31878
18731924
18741925MACHINE_START_MEMBER( a400_state, a800 )
18751926{
1876   atari_machine_start();
1927   common_start();
18771928   setup_ram(0, m_ram->size());
18781929   setup_ram(1, m_ram->size());
18791930   setup_ram(2, m_ram->size());
r31877r31878
18881939{
18891940   m_mmu = 0xfd;
18901941   m_ext_bank = 0x03;   // only used by a130xe
1891   atari_machine_start();
1942   common_start();
18921943   setup_cart(m_cartslot->get_cart_type());
18931944
18941945   save_item(NAME(m_cart_disabled));
r31877r31878
19001951
19011952MACHINE_START_MEMBER( a400_state, a5200 )
19021953{
1903   atari_machine_start();
1954   a5200_start();
19041955   setup_cart(m_cartslot->get_cart_type());
19051956
19061957   save_item(NAME(m_cart_disabled));
r31877r31878
19471998   /* basic machine hardware */
19481999   MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
19492000
2001   MCFG_MACHINE_RESET_OVERRIDE( a400_state, a400 )
2002
19502003   /* video hardware */
19512004   MCFG_SCREEN_ADD("screen", RASTER)
19522005   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1))
trunk/src/mame/drivers/bartop52.c
r31877r31878
3030      : atari_common_state(mconfig, type, tag),
3131      m_maincpu(*this, "maincpu") { }
3232
33   virtual void machine_start();
34   virtual void machine_reset();
3335   required_device<cpu_device> m_maincpu;
3436};
3537
r31877r31878
100102INPUT_PORTS_END
101103
102104
105void bartop52_state::machine_start()
106{
107   /* GTIA */
108   gtia_interface gtia_intf;
109   memset(&gtia_intf, 0, sizeof(gtia_intf));
110   gtia_init(machine(), &gtia_intf);   
111   
112   /* ANTIC */
113   antic_start(machine());
114}
115
116void bartop52_state::machine_reset()
117{
118   pokey_device *pokey = machine().device<pokey_device>("pokey");
119   pokey->write(15,0);
120   antic_reset();
121}
122
123
103124static MACHINE_CONFIG_START( a5200, bartop52_state )
104125   /* basic machine hardware */
105126   MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
trunk/src/mame/drivers/maxaflex.c
r31877r31878
6868   TIMER_DEVICE_CALLBACK_MEMBER(mcu_timer_proc);
6969   int atari_input_disabled();
7070   virtual void machine_start();
71   virtual void machine_reset();
7172   required_device<cpu_device> m_maincpu;
7273   required_device<cpu_device> m_mcu;
7374   required_device<speaker_sound_device> m_speaker;
r31877r31878
405406
406407void maxaflex_state::machine_start()
407408{
408   atari_machine_start();
409   /* GTIA */
410   gtia_interface gtia_intf;
411   memset(&gtia_intf, 0, sizeof(gtia_intf));
412   gtia_init(machine(), &gtia_intf);   
413   
414   /* ANTIC */
415   antic_start(machine());
409416}
410417
418void maxaflex_state::machine_reset()
419{
420   pokey_device *pokey = machine().device<pokey_device>("pokey");
421   pokey->write(15,0);
422   antic_reset();
423}
424
425
411426static MACHINE_CONFIG_START( a600xl, maxaflex_state )
412427   /* basic machine hardware */
413428   MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
trunk/src/mame/machine/atari.c
r31877r31878
1313#include "includes/atari.h"
1414#include "sound/pokey.h"
1515#include "sound/dac.h"
16#include "video/gtia.h"
1716
1817#define VERBOSE_POKEY   1
1918#define VERBOSE_SERIAL  1
2019#define VERBOSE_TIMERS  1
2120
22static void pokey_reset(running_machine &machine);
23
2421void atari_interrupt_cb(pokey_device *device, int mask)
2522{
2623   if (VERBOSE_POKEY)
r31877r31878
194191
195192   return ret;
196193}
197
198
199/*************************************
200 *
201 *  Generic Atari Code
202 *
203 *************************************/
204
205
206static void pokey_reset(running_machine &machine)
207{
208   pokey_device *pokey = downcast<pokey_device *>(machine.device("pokey"));
209   pokey->write(15,0);
210}
211
212
213static UINT8 console_read(address_space &space)
214{
215   return space.machine().root_device().ioport("console")->read();
216}
217
218
219static void console_write(address_space &space, UINT8 data)
220{
221   dac_device *dac = space.machine().device<dac_device>("dac");
222   if (data & 0x08)
223      dac->write_unsigned8((UINT8)-120);
224   else
225      dac->write_unsigned8(+120);
226}
227
228
229static void _antic_reset(running_machine &machine)
230{
231   antic_reset();
232}
233
234
235void atari_common_state::atari_machine_start()
236{
237   gtia_interface gtia_intf;
238
239   /* GTIA */
240   memset(&gtia_intf, 0, sizeof(gtia_intf));
241   if (machine().root_device().ioport("console") != NULL)
242      gtia_intf.console_read = console_read;
243   if (machine().device<dac_device>("dac") != NULL)
244      gtia_intf.console_write = console_write;
245   gtia_init(machine(), &gtia_intf);
246
247   /* pokey */
248   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(pokey_reset), &machine()));
249
250   /* ANTIC */
251   machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(_antic_reset), &machine()));
252
253   /* save states */
254   machine().save().save_pointer(NAME((UINT8 *) &antic.r), sizeof(antic.r));
255   machine().save().save_pointer(NAME((UINT8 *) &antic.w), sizeof(antic.w));
256}
trunk/src/mame/includes/atari.h
r31877r31878
2323      : driver_device(mconfig, type, tag),
2424      tv_artifacts(0) { }
2525
26   /* This is needed in MESS as well for Atari 8bit drivers */
27   void atari_machine_start();
28
2926   virtual void video_start();
3027   UINT32 screen_update_atari(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3128
r31877r31878
562559
563560extern ANTIC antic;
564561
562void antic_start(running_machine &machine);
565563void antic_reset(void);
566564
567565
r31877r31878
610608ANTIC_RENDERER( antic_mode_f_32 );
611609ANTIC_RENDERER( antic_mode_f_40 );
612610ANTIC_RENDERER( antic_mode_f_48 );
611ANTIC_RENDERER( gtia_mode_1_32 );
612ANTIC_RENDERER( gtia_mode_1_40 );
613ANTIC_RENDERER( gtia_mode_1_48 );
614ANTIC_RENDERER( gtia_mode_2_32 );
615ANTIC_RENDERER( gtia_mode_2_40 );
616ANTIC_RENDERER( gtia_mode_2_48 );
617ANTIC_RENDERER( gtia_mode_3_32 );
618ANTIC_RENDERER( gtia_mode_3_40 );
619ANTIC_RENDERER( gtia_mode_3_48 );
613620
614621#endif /* ATARI_H */
trunk/src/mame/video/antic.c
r31877r31878
2020
2121ANTIC antic;
2222
23void antic_start(running_machine &machine)
24{   
25   /* save states */
26   machine.save().save_pointer(NAME((UINT8 *) &antic.r), sizeof(antic.r));
27   machine.save().save_pointer(NAME((UINT8 *) &antic.w), sizeof(antic.w));
28}
29
2330/**************************************************************
2431 *
2532 * Reset ANTIC
r31877r31878
585592   REP48(MODEF);
586593   POST_GFX(48);
587594}
595
596/*************  ANTIC mode 0F : GTIA mode 1 ********************
597 * graphics mode 8x1:16 (32/40/48 byte per line)
598 ***************************************************************/
599#define GTIA1(s) COPY4(dst, antic.pf_gtia1[video->data[s]])
600
601ANTIC_RENDERER( gtia_mode_1_32 )
602{
603   PREPARE_GFXG1(space, 32);
604   REP32(GTIA1);
605   POST_GFX(32);
606}
607ANTIC_RENDERER( gtia_mode_1_40 )
608{
609   PREPARE_GFXG1(space, 40);
610   REP40(GTIA1);
611   POST_GFX(40);
612}
613ANTIC_RENDERER( gtia_mode_1_48 )
614{
615   PREPARE_GFXG1(space, 48);
616   REP48(GTIA1);
617   POST_GFX(48);
618}
619
620/*************  ANTIC mode 0F : GTIA mode 2 ********************
621 * graphics mode 8x1:16 (32/40/48 byte per line)
622 ***************************************************************/
623#define GTIA2(s) COPY4(dst, antic.pf_gtia2[video->data[s]])
624
625ANTIC_RENDERER( gtia_mode_2_32 )
626{
627   PREPARE_GFXG2(space, 32);
628   REP32(GTIA2);
629   POST_GFX(32);
630}
631ANTIC_RENDERER( gtia_mode_2_40 )
632{
633   PREPARE_GFXG2(space, 40);
634   REP40(GTIA2);
635   POST_GFX(40);
636}
637ANTIC_RENDERER( gtia_mode_2_48 )
638{
639   PREPARE_GFXG2(space, 48);
640   REP48(GTIA2);
641   POST_GFX(48);
642}
643
644/*************  ANTIC mode 0F : GTIA mode 3 ********************
645 * graphics mode 8x1:16 (32/40/48 byte per line)
646 ***************************************************************/
647#define GTIA3(s) COPY4(dst, antic.pf_gtia3[video->data[s]])
648
649ANTIC_RENDERER( gtia_mode_3_32 )
650{
651   PREPARE_GFXG3(space, 32);
652   REP32(GTIA3);
653   POST_GFX(32);
654}
655ANTIC_RENDERER( gtia_mode_3_40 )
656{
657   PREPARE_GFXG3(space, 40);
658   REP40(GTIA3);
659   POST_GFX(40);
660}
661ANTIC_RENDERER( gtia_mode_3_48 )
662{
663   PREPARE_GFXG3(space, 48);
664   REP48(GTIA3);
665   POST_GFX(48);
666}
trunk/src/mame/video/gtia.c
r31877r31878
10681068   gtia.w.grafp3[1] = gtia.w.grafp3[0];
10691069   gtia.w.grafm[1] = gtia.w.grafm[0];
10701070}
1071
1072/*************  ANTIC mode 0F : GTIA mode 1 ********************
1073 * graphics mode 8x1:16 (32/40/48 byte per line)
1074 ***************************************************************/
1075#define GTIA1(s) COPY4(dst, antic.pf_gtia1[video->data[s]])
1076
1077ANTIC_RENDERER( gtia_mode_1_32 )
1078{
1079   PREPARE_GFXG1(space, 32);
1080   REP32(GTIA1);
1081   POST_GFX(32);
1082}
1083ANTIC_RENDERER( gtia_mode_1_40 )
1084{
1085   PREPARE_GFXG1(space, 40);
1086   REP40(GTIA1);
1087   POST_GFX(40);
1088}
1089ANTIC_RENDERER( gtia_mode_1_48 )
1090{
1091   PREPARE_GFXG1(space, 48);
1092   REP48(GTIA1);
1093   POST_GFX(48);
1094}
1095
1096/*************  ANTIC mode 0F : GTIA mode 2 ********************
1097 * graphics mode 8x1:16 (32/40/48 byte per line)
1098 ***************************************************************/
1099#define GTIA2(s) COPY4(dst, antic.pf_gtia2[video->data[s]])
1100
1101ANTIC_RENDERER( gtia_mode_2_32 )
1102{
1103   PREPARE_GFXG2(space, 32);
1104   REP32(GTIA2);
1105   POST_GFX(32);
1106}
1107ANTIC_RENDERER( gtia_mode_2_40 )
1108{
1109   PREPARE_GFXG2(space, 40);
1110   REP40(GTIA2);
1111   POST_GFX(40);
1112}
1113ANTIC_RENDERER( gtia_mode_2_48 )
1114{
1115   PREPARE_GFXG2(space, 48);
1116   REP48(GTIA2);
1117   POST_GFX(48);
1118}
1119
1120/*************  ANTIC mode 0F : GTIA mode 3 ********************
1121 * graphics mode 8x1:16 (32/40/48 byte per line)
1122 ***************************************************************/
1123#define GTIA3(s) COPY4(dst, antic.pf_gtia3[video->data[s]])
1124
1125ANTIC_RENDERER( gtia_mode_3_32 )
1126{
1127   PREPARE_GFXG3(space, 32);
1128   REP32(GTIA3);
1129   POST_GFX(32);
1130}
1131ANTIC_RENDERER( gtia_mode_3_40 )
1132{
1133   PREPARE_GFXG3(space, 40);
1134   REP40(GTIA3);
1135   POST_GFX(40);
1136}
1137ANTIC_RENDERER( gtia_mode_3_48 )
1138{
1139   PREPARE_GFXG3(space, 48);
1140   REP48(GTIA3);
1141   POST_GFX(48);
1142}
trunk/src/mame/video/gtia.h
r31877r31878
135135
136136void gtia_init(running_machine &machine, const gtia_interface *intf);
137137
138ANTIC_RENDERER( gtia_mode_1_32 );
139ANTIC_RENDERER( gtia_mode_1_40 );
140ANTIC_RENDERER( gtia_mode_1_48 );
141ANTIC_RENDERER( gtia_mode_2_32 );
142ANTIC_RENDERER( gtia_mode_2_40 );
143ANTIC_RENDERER( gtia_mode_2_48 );
144ANTIC_RENDERER( gtia_mode_3_32 );
145ANTIC_RENDERER( gtia_mode_3_40 );
146ANTIC_RENDERER( gtia_mode_3_48 );
147138void gtia_render(VIDEO *video);
148139
149140#endif /* __GTIA_H__ */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team