Previous 15994 Revisions Next

r12395 Saturday 30th July, 2011 at 18:56:49 UTC by Wilbert Pol
tms9928a.c: Converted to a C++ device.
[src/emu/video]tms9928a.c tms9928a.h
[src/mess/drivers]adam.c bbcbc.c coleco.c crvision.c einstein.c m5.c msx.c mtx.c pv2000.c sg1000.c svi318.c ti99_4x.c ti99_8.c tm990189.c tutor.c
[src/mess/includes]mtx.h sg1000.h svi318.h
[src/mess/machine]msx.c mtx.c svi318.c
[src/mess/machine/ti99]tiboard.c videowrp.c videowrp.h

src/emu/video/tms9928a.c
r12394r12395
1313** Improved over the years by MESS and MAME teams.
1414**
1515** Todo:
16** - Convert implementation to modern device.
17** - The screen image is rendered in `one go'. Modifications during
18**   screen build up are not shown.
1916** - Colours are incorrect. [fixed by R Nabet ?]
2017** - Sprites 8-31 are ghosted/cloned in mode 3 when using less than
2118**   three pattern tables. Exact behaviour is not known.
r12394r12395
2320
2421#include "emu.h"
2522#include "tms9928a.h"
23#include "machine/devhelpr.h"
2624
2725
26const device_type TMS9928A = &device_creator<tms9928a_device>;
27const device_type TMS9918  = &device_creator<tms9918_device>;
28const device_type TMS9918A = &device_creator<tms9918a_device>;
29const device_type TMS9118  = &device_creator<tms9118_device>;
30const device_type TMS9128  = &device_creator<tms9128_device>;
31const device_type TMS9929  = &device_creator<tms9929_device>;
32const device_type TMS9929A = &device_creator<tms9929a_device>;
33const device_type TMS9129  = &device_creator<tms9129_device>;
34
35
2836/*
2937    New palette (R. Nabet).
3038
r12394r12395
5361    E Gray          0.80    0.47    0.47    0.80    0.80    0.80    204 204 204
5462    F White         1.00    0.47    0.47    1.00    1.00    1.00    255 255 255
5563*/
56static const rgb_t TMS9928A_palette[16] =
64static const rgb_t tms9928a_palette[16] =
5765{
5866   RGB_BLACK,
5967   RGB_BLACK,
r12394r12395
7381   RGB_WHITE
7482};
7583
76/*
77** Forward declarations of internal functions.
78*/
79static void draw_mode0 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
80static void draw_mode1 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
81static void draw_mode2 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
82static void draw_mode12 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
83static void draw_mode3 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
84static void draw_mode23 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
85static void draw_modebogus (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
86static void draw_sprites (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect);
87static void change_register (running_machine &machine, int reg, UINT8 data);
8884
89static void (*const ModeHandlers[])(device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) = {
90        draw_mode0, draw_mode1, draw_mode2,  draw_mode12,
91        draw_mode3, draw_modebogus, draw_mode23,
92        draw_modebogus
93};
94
95#define IMAGE_SIZE (256*192)        /* size of rendered image        */
96
97#define LEFT_BORDER         15      /* a bit less for 9918a??? */
98#define RIGHT_BORDER      15      /* 13 for 9929a */
99#define TOP_BORDER_60HZ      27
100#define BOTTOM_BORDER_60HZ   24
101#define TOP_BORDER_50HZ      51      /* unknown (102 for top+bottom?) */
102#define BOTTOM_BORDER_50HZ   51      /* unknown (102 for top+bottom?) */
103#define TOP_BORDER         tms.top_border
104#define BOTTOM_BORDER      tms.bottom_border
105
106#define TMS_50HZ ((tms.model == TMS9929) || (tms.model == TMS9929A))
107#define TMS_REVA ((tms.model == TMS99x8A) || (tms.model == TMS9929A))
108#define TMS_MODE ( (TMS_REVA ? (tms.Regs[0] & 2) : 0) | \
109   ((tms.Regs[1] & 0x10)>>4) | ((tms.Regs[1] & 8)>>1))
110
111typedef struct {
112    /* TMS9928A internal settings */
113    UINT8 ReadAhead,Regs[8],StatusReg,FifthSprite,latch,INT;
114    INT32 Addr;
115    int colour,pattern,nametbl,spriteattribute,spritepattern;
116    int colourmask,patternmask;
117    void (*INTCallback)(running_machine &, int);
118    /* memory */
119    UINT8 *vMem, *dBackMem;
120    bitmap_t *tmpbmp;
121    int vramsize, model;
122    /* emulation settings */
123    int LimitSprites; /* max 4 sprites on a row, like original TMS9918A */
124    int top_border, bottom_border;
125    rectangle visarea;
126} TMS9928A;
127
128static TMS9928A tms;
129
13085/*
13186** initialize the palette
13287*/
133static PALETTE_INIT( tms9928a )
88PALETTE_INIT( tms9928a )
13489{
135   palette_set_colors(machine, 0, TMS9928A_palette, TMS9928A_PALETTE_SIZE);
90   palette_set_colors(machine, 0, tms9928a_palette, TMS9928A_PALETTE_SIZE);
13691}
13792
13893
139/*
140** The init, reset and shutdown functions
141*/
142void TMS9928A_reset () {
143    int  i;
144
145    for (i=0;i<8;i++) tms.Regs[i] = 0;
146    tms.StatusReg = 0; tms.FifthSprite = 0;
147    tms.nametbl = tms.pattern = tms.colour = 0;
148    tms.spritepattern = tms.spriteattribute = 0;
149    tms.colourmask = tms.patternmask = 0;
150    tms.Addr = tms.ReadAhead = tms.INT = 0;
151   tms.latch = 0;
94tms9928a_device::tms9928a_device( const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_50hz, bool is_reva )
95   : device_t( mconfig, type, name, tag, owner, clock )
96{
97   m_50hz = is_50hz;
98   m_reva = is_reva;
15299}
153100
154static void TMS9928A_start (running_machine &machine, const TMS9928a_interface *intf)
101
102tms9928a_device::tms9928a_device( const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock )
103   : device_t( mconfig, TMS9928A, "tms9928a", tag, owner, clock )
155104{
156    assert_always(((intf->vram == 0x1000) || (intf->vram == 0x2000) || (intf->vram == 0x4000)), "4, 8 or 16 kB vram please");
105   m_50hz = false;
106   m_reva = true;
107}
157108
158    tms.model = intf->model;
159109
160   tms.top_border = TMS_50HZ ? TOP_BORDER_50HZ : TOP_BORDER_60HZ;
161   tms.bottom_border = TMS_50HZ ? BOTTOM_BORDER_50HZ : BOTTOM_BORDER_60HZ;
110READ8_MEMBER( tms9928a_device::vram_read )
111{
112   UINT8 data = m_ReadAhead;
162113
163   tms.INTCallback = intf->int_callback;
114   m_ReadAhead = m_vMem[ m_Addr ];
115   m_Addr = (m_Addr + 1) & (m_vram_size - 1);
116   m_latch = 0;
164117
165   /* determine the visible area */
166   tms.visarea.min_x = LEFT_BORDER - MIN(intf->borderx, LEFT_BORDER);
167   tms.visarea.max_x = LEFT_BORDER + 32*8 - 1 + MIN(intf->borderx, RIGHT_BORDER);
168   tms.visarea.min_y = tms.top_border - MIN(intf->bordery, tms.top_border);
169   tms.visarea.max_y = tms.top_border + 24*8 - 1 + MIN(intf->bordery, tms.bottom_border);
118   return data;
119}
170120
171   /* configure the screen if we weren't overridden */
172   if (machine.primary_screen->width() == LEFT_BORDER+32*8+RIGHT_BORDER &&
173       machine.primary_screen->height() == TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ)
174      machine.primary_screen->configure(LEFT_BORDER + 32*8 + RIGHT_BORDER, tms.top_border + 24*8 + tms.bottom_border, tms.visarea, machine.primary_screen->frame_period().attoseconds);
175121
176    /* Video RAM */
177    tms.vramsize = intf->vram;
178    tms.vMem = auto_alloc_array_clear(machine, UINT8, intf->vram);
122WRITE8_MEMBER( tms9928a_device::vram_write )
123{
124   m_vMem[ m_Addr ] = data;
125   m_Addr = (m_Addr + 1) & (m_vram_size - 1);
126   m_ReadAhead = data;
127   m_latch = 0;
128}
179129
180    /* Sprite back buffer */
181    tms.dBackMem = auto_alloc_array(machine, UINT8, IMAGE_SIZE);
182130
183    /* back bitmap */
184    tms.tmpbmp = auto_bitmap_alloc (machine, 256, 192, machine.primary_screen->format());
131READ8_MEMBER( tms9928a_device::register_read )
132{
133   UINT8 data = m_StatusReg;
185134
186    TMS9928A_reset ();
187    tms.LimitSprites = 1;
135   m_StatusReg = m_FifthSprite;
136   if (m_INT) {
137      m_INT = 0;
138      if ( !m_irq_changed.isnull() )
139         m_irq_changed( m_INT );
140   }
141   m_latch = 0;
188142
189   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[0]);
190   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[1]);
191   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[2]);
192   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[3]);
193   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[4]);
194   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[5]);
195   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[6]);
196   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Regs[7]);
197   state_save_register_item(machine, "tms9928a", NULL, 0, tms.StatusReg);
198   state_save_register_item(machine, "tms9928a", NULL, 0, tms.FifthSprite);
199   state_save_register_item(machine, "tms9928a", NULL, 0, tms.ReadAhead);
200   state_save_register_item(machine, "tms9928a", NULL, 0, tms.latch);
201   state_save_register_item(machine, "tms9928a", NULL, 0, tms.Addr);
202   state_save_register_item(machine, "tms9928a", NULL, 0, tms.INT);
203   state_save_register_item_pointer(machine, "tms9928a", NULL, 0, tms.vMem, intf->vram);
143   return data;
204144}
205145
206146
207void TMS9928A_post_load (running_machine &machine) {
208   int i;
147void tms9928a_device::change_register(UINT8 reg, UINT8 val) {
148   static const UINT8 Mask[8] =
149      { 0x03, 0xfb, 0x0f, 0xff, 0x07, 0x7f, 0x07, 0xff };
150   static const char *const modes[] =
151   {
152      "Mode 0 (GRAPHIC 1)", "Mode 1 (TEXT 1)", "Mode 2 (GRAPHIC 2)",
153      "Mode 1+2 (TEXT 1 variation)", "Mode 3 (MULTICOLOR)",
154      "Mode 1+3 (BOGUS)", "Mode 2+3 (MULTICOLOR variation)",
155      "Mode 1+2+3 (BOGUS)"
156   };
157   UINT8 b;
209158
210   /* all registers need to be re-written, so tables are recalculated */
211   for (i=0;i<8;i++)
212      change_register (machine, i, tms.Regs[i]);
159   val &= Mask[reg];
160   m_Regs[reg] = val;
213161
214   /* make sure the interrupt request is set properly */
215   if (tms.INTCallback) tms.INTCallback (machine, tms.INT);
216}
162   logerror("TMS9928A('%s'): Reg %d = %02xh\n", tag(), reg, (int)val);
217163
218
219/*
220** The I/O functions.
221*/
222READ8_HANDLER (TMS9928A_vram_r) {
223    UINT8 ret = tms.ReadAhead;
224    tms.ReadAhead = tms.vMem[tms.Addr];
225    tms.Addr = (tms.Addr + 1) & (tms.vramsize - 1);
226    tms.latch = 0;
227    return ret;
164   switch (reg)
165   {
166   case 0:
167      /* re-calculate masks and pattern generator & colour */
168      if (val & 2)
169      {
170         m_colour = ((m_Regs[3] & 0x80) * 64) & (m_vram_size - 1);
171         m_colourmask = (m_Regs[3] & 0x7f) * 8 | 7;
172         m_pattern = ((m_Regs[4] & 4) * 2048) & (m_vram_size - 1);
173         m_patternmask = ( (m_Regs[4] & 3) << 8 ) | (m_colourmask & 0xff);
174      }
175      else
176      {
177         m_colour = (m_Regs[3] * 64) & (m_vram_size - 1);
178         m_pattern = (m_Regs[4] * 2048) & (m_vram_size - 1);
179      }
180      m_mode = ( (m_reva ? (m_Regs[0] & 2) : 0) | ((m_Regs[1] & 0x10)>>4) | ((m_Regs[1] & 8)>>1));
181      logerror("TMS9928A('%s'): %s\n", tag(), modes[m_mode]);
182      break;
183   case 1:
184      /* check for changes in the INT line */
185      b = (val & 0x20) && (m_StatusReg & 0x80) ;
186      if (b != m_INT)
187      {
188         m_INT = b;
189         if ( !m_irq_changed.isnull() )
190            m_irq_changed( m_INT );
191      }
192      m_mode = ( (m_reva ? (m_Regs[0] & 2) : 0) | ((m_Regs[1] & 0x10)>>4) | ((m_Regs[1] & 8)>>1));
193      logerror("TMS9928A('%s'): %s\n", tag(), modes[m_mode]);
194      break;
195   case 2:
196      m_nametbl = (val * 1024) & (m_vram_size - 1);
197      break;
198   case 3:
199      if (m_Regs[0] & 2)
200      {
201         m_colour = ((val & 0x80) * 64) & (m_vram_size - 1);
202         m_colourmask = ( (val & 0x7f) * 8 ) | 7;
203      }
204      else
205      {
206         m_colour = (val * 64) & (m_vram_size - 1);
207      }
208      m_patternmask = ( (m_Regs[4] & 3) * 256 ) | (m_colourmask & 255);
209      break;
210   case 4:
211      if (m_Regs[0] & 2)
212      {
213         m_pattern = ((val & 4) * 2048) & (m_vram_size - 1);
214         m_patternmask = ( (val & 3) * 256 ) | 255;
215      }
216      else
217      {
218         m_pattern = (val * 2048) & (m_vram_size - 1);
219      }
220      break;
221   case 5:
222      m_spriteattribute = (val * 128) & (m_vram_size - 1);
223      break;
224   case 6:
225      m_spritepattern = (val * 2048) & (m_vram_size - 1);
226      break;
227   case 7:
228      /* The backdrop is updated at TMS9928A_refresh() */
229      break;
230   }
228231}
229232
230WRITE8_HANDLER (TMS9928A_vram_w) {
231    tms.vMem[tms.Addr] = data;
232    tms.Addr = (tms.Addr + 1) & (tms.vramsize - 1);
233    tms.ReadAhead = data;
234    tms.latch = 0;
235}
236233
237READ8_HANDLER (TMS9928A_register_r) {
238    UINT8 ret = tms.StatusReg;
239    tms.StatusReg = tms.FifthSprite;
240    if (tms.INT) {
241        tms.INT = 0;
242        if (tms.INTCallback) tms.INTCallback (space->machine(), tms.INT);
243    }
244    tms.latch = 0;
245    return ret;
246}
247
248WRITE8_HANDLER (TMS9928A_register_w) {
249   int reg;
250
251   if (tms.latch) {
234WRITE8_MEMBER( tms9928a_device::register_write )
235{
236   if (m_latch) {
252237      /* set high part of read/write address */
253      tms.Addr = ((UINT16)data << 8 | (tms.Addr & 0xff)) & (tms.vramsize - 1);
238      m_Addr = ((data << 8) | (m_Addr & 0xff)) & (m_vram_size - 1);
254239
255240      if (data & 0x80) {
256241         /* register write */
257         reg = data & 7;
258         change_register (space->machine(), reg, tms.Addr & 0xff);
242         change_register (data & 7, m_Addr & 0xff);
259243      } else {
260244         if ( !(data & 0x40) ) {
261245            /* read ahead */
262            TMS9928A_vram_r   (space,0);
246            vram_read(space, 0);
263247         }
264248      }
265      tms.latch = 0;
249      m_latch = 0;
266250   } else {
267251      /* set low part of read/write address */
268      tms.Addr = ((tms.Addr & 0xff00) | data) & (tms.vramsize - 1);
269      tms.latch = 1;
252      m_Addr = ((m_Addr & 0xff00) | data) & (m_vram_size - 1);
253      m_latch = 1;
270254   }
271255}
272256
273static void change_register (running_machine &machine, int reg, UINT8 val) {
274    static const UINT8 Mask[8] =
275        { 0x03, 0xfb, 0x0f, 0xff, 0x07, 0x7f, 0x07, 0xff };
276    static const char *const modes[] = {
277        "Mode 0 (GRAPHIC 1)", "Mode 1 (TEXT 1)", "Mode 2 (GRAPHIC 2)",
278        "Mode 1+2 (TEXT 1 variation)", "Mode 3 (MULTICOLOR)",
279        "Mode 1+3 (BOGUS)", "Mode 2+3 (MULTICOLOR variation)",
280        "Mode 1+2+3 (BOGUS)"
281    };
282    UINT8 b;
283257
284    val &= Mask[reg];
285    tms.Regs[reg] = val;
258void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
259{
260   int vpos = m_screen->vpos();
261   UINT16 BackColour = m_Regs[7] & 15;
262   UINT16 *p = BITMAP_ADDR16( m_tmpbmp, vpos, 0 );
286263
287    logerror("TMS9928A: Reg %d = %02xh\n", reg, (int)val);
288    switch (reg) {
289    case 0:
290      /* re-calculate masks and pattern generator & colour */
291      if (val & 2) {
292         tms.colour = ((tms.Regs[3] & 0x80) * 64) & (tms.vramsize - 1);
293         tms.colourmask = (tms.Regs[3] & 0x7f) * 8 | 7;
294         tms.pattern = ((tms.Regs[4] & 4) * 2048) & (tms.vramsize - 1);
295         tms.patternmask = (tms.Regs[4] & 3) * 256 |
296            (tms.colourmask & 255);
297      } else {
298         tms.colour = (tms.Regs[3] * 64) & (tms.vramsize - 1);
299         tms.pattern = (tms.Regs[4] * 2048) & (tms.vramsize - 1);
300      }
301        logerror("TMS9928A: %s\n", modes[TMS_MODE]);
302        break;
303    case 1:
304        /* check for changes in the INT line */
305        b = (val & 0x20) && (tms.StatusReg & 0x80) ;
306        if (b != tms.INT) {
307            tms.INT = b;
308            if (tms.INTCallback) tms.INTCallback (machine, tms.INT);
309        }
310        logerror("TMS9928A: %s\n", modes[TMS_MODE]);
311        break;
312    case 2:
313        tms.nametbl = (val * 1024) & (tms.vramsize - 1);
314        break;
315    case 3:
316        if (tms.Regs[0] & 2) {
317            tms.colour = ((val & 0x80) * 64) & (tms.vramsize - 1);
318            tms.colourmask = (val & 0x7f) * 8 | 7;
319        } else {
320            tms.colour = (val * 64) & (tms.vramsize - 1);
321        }
322      tms.patternmask = (tms.Regs[4] & 3) * 256 | (tms.colourmask & 255);
323        break;
324    case 4:
325        if (tms.Regs[0] & 2) {
326            tms.pattern = ((val & 4) * 2048) & (tms.vramsize - 1);
327            tms.patternmask = (val & 3) * 256 | 255;
328        } else {
329            tms.pattern = (val * 2048) & (tms.vramsize - 1);
330        }
331        break;
332    case 5:
333        tms.spriteattribute = (val * 128) & (tms.vramsize - 1);
334        break;
335    case 6:
336        tms.spritepattern = (val * 2048) & (tms.vramsize - 1);
337        break;
338    case 7:
339        /* The backdrop is updated at TMS9928A_refresh() */
340        break;
341    }
342}
264   if (!BackColour)
265      BackColour=1;
343266
344/*
345** Interface functions
346*/
267   if ( vpos == 0 )
268   {
269      rgb_t oldcolor = palette_get_color(machine(), 0);
347270
348void TMS9928A_set_spriteslimit (int limit) {
349    tms.LimitSprites = limit;
350}
271      /* note we preserve the alpha here; this is so that it can be controlled independently */
272      /* see cliffhgr.c for an example */
273      palette_set_color(machine(), 0, (tms9928a_palette[BackColour] & MAKE_ARGB(0,255,255,255)) | (oldcolor & MAKE_ARGB(255,0,0,0)));
274   }
351275
352/*
353** Updates the screen (the dMem memory area).
354*/
355SCREEN_UPDATE( tms9928a )
356{
357    INT32 BackColour = tms.Regs[7] & 15;
358    rgb_t oldcolor = palette_get_color(screen->machine(), 0);
276   int y = vpos - m_top_border;
359277
360   if (!BackColour) BackColour=1;
361   /* note we preserve the alpha here; this is so that it can be controlled independently */
362   /* see cliffhgr.c for an example */
363    palette_set_color(screen->machine(), 0, (TMS9928A_palette[BackColour] & MAKE_ARGB(0,255,255,255)) | (oldcolor & MAKE_ARGB(255,0,0,0)));
278   if ( y < 0 || y >= 192 || ! (m_Regs[1] & 0x40) )
279   {
280      /* Draw backdrop colour */
281      for ( int i = 0; i < TMS9928A_TOTAL_HORZ; i++ )
282         p[i] = BackColour;
364283
365   if (! (tms.Regs[1] & 0x40))
366      bitmap_fill(bitmap, cliprect, screen->machine().pens[BackColour]);
284      /* Check for end of active display */
285      if ( y == 192 )
286      {
287         UINT8 b;
288
289         m_StatusReg |= 0x80;
290         b = (m_Regs[1] & 0x20) != 0;
291         if (b != m_INT) {
292            m_INT = b;
293            if ( !m_irq_changed.isnull() )
294               m_irq_changed( m_INT );
295         }
296      }
297   }
367298   else
368299   {
369      (*ModeHandlers[TMS_MODE])(screen, tms.tmpbmp, cliprect);
300      /* Draw regular line */
370301
371      copybitmap(bitmap, tms.tmpbmp, 0, 0, LEFT_BORDER, TOP_BORDER, cliprect);
302      /* Left border */
303      for ( int i = 0; i < TMS9928A_HORZ_DISPLAY_START; i++ )
304         p[i] = BackColour;
305
306      /* Active display */
307
308      switch( m_mode )
372309      {
373         rectangle rt;
310      case 0:            /* MODE 0 */
311         // if (vpos==100 ) popmessage("TMS9928A MODE 0");
312         {
313            UINT16 addr = m_nametbl + ( ( y & 0xF8 ) << 2 );
374314
375         /* set borders */
376         rt.min_x = 0; rt.max_x = LEFT_BORDER+256+RIGHT_BORDER-1;
377         rt.min_y = 0; rt.max_y = TOP_BORDER-1;
378         bitmap_fill (bitmap, &rt, BackColour);
379         rt.min_y = TOP_BORDER+192; rt.max_y = TOP_BORDER+192+BOTTOM_BORDER-1;
380         bitmap_fill (bitmap, &rt, BackColour);
315            for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
316            {
317               UINT8 charcode = m_vMem[ addr ];
318               UINT8 pattern = m_vMem[ m_pattern + ( charcode << 3 ) + ( y & 7 ) ];
319               UINT8 colour = m_vMem[ m_colour + ( charcode >> 3 ) ];
320               UINT16 fg = colour >> 4;
321               UINT16 bg = colour & 15;
381322
382         rt.min_y = TOP_BORDER; rt.max_y = TOP_BORDER+192-1;
383         rt.min_x = 0; rt.max_x = LEFT_BORDER-1;
384         bitmap_fill (bitmap, &rt, BackColour);
385         rt.min_x = LEFT_BORDER+256; rt.max_x = LEFT_BORDER+256+RIGHT_BORDER-1;
386         bitmap_fill (bitmap, &rt, BackColour);
387      }
388      draw_sprites(screen, bitmap, cliprect);
389   }
323               for ( int i = 0; i < 8; pattern <<= 1, i++ )
324                  p[x+i] = ( pattern & 0x80 ) ? fg : bg;
325            }
326         }
327         break;
390328
391   return 0;
392}
329      case 1:            /* MODE 1 */
330         //if (vpos==100 ) popmessage("TMS9928A MODE 1");
331         {
332            UINT16 addr = m_nametbl + ( ( y >> 3 ) * 40 );
333            UINT16 fg = m_Regs[7] >> 4;
334            UINT16 bg = m_Regs[7] & 15;
393335
394int TMS9928A_interrupt(running_machine &machine) {
395    int b;
336            /* Extra 8 pixels left border */
337            for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 8; x++ )
338               p[x] = bg;
396339
397    /* when skipping frames, calculate sprite collision */
398    if (machine.video().skip_this_frame()) {
399      draw_sprites (machine.primary_screen, NULL, NULL);
400    }
340            for ( int x = TMS9928A_HORZ_DISPLAY_START + 8; x < TMS9928A_HORZ_DISPLAY_START + 248; x+= 6, addr++ )
341            {
342               UINT16 charcode = m_vMem[ addr ];
343               UINT8 pattern = m_vMem[ m_pattern + ( charcode << 3 ) + ( y & 7 ) ];
401344
402    tms.StatusReg |= 0x80;
403    b = (tms.Regs[1] & 0x20) != 0;
404    if (b != tms.INT) {
405        tms.INT = b;
406        if (tms.INTCallback) tms.INTCallback (machine, tms.INT);
407    }
345               for ( int i = 0; i < 6; pattern <<= 1, i++ )
346                  p[x+i] = ( pattern & 0x80 ) ? fg : bg;
347            }
408348
409    return b;
410}
349            /* Extra 8 pixels right border */
350            for ( int x = TMS9928A_HORZ_DISPLAY_START + 248; x < TMS9928A_HORZ_DISPLAY_START + 256; x++ )
351               p[x] = bg;
352         }
353         break;
411354
412static void draw_mode1 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
413    int pattern,x,y,yy,xx,name,charcode;
414    UINT8 fg,bg,*patternptr;
415    rectangle rt;
416    const pen_t *pens;
355      case 2:            /* MODE 2 */
356         //if (vpos==100 ) popmessage("TMS9928A MODE 2");
357         {
358            UINT16 addr = m_nametbl + ( ( y >> 3 ) * 32 );
417359
418    pens = screen->machine().pens;
419    fg = pens[tms.Regs[7] / 16];
420    bg = pens[tms.Regs[7] & 15];
360            for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
361            {
362               UINT16 charcode = m_vMem[ addr ] + ( ( y >> 6 ) << 8 );
363               UINT8 pattern = m_vMem[ m_pattern + ( ( charcode & m_patternmask ) << 3 ) + ( y & 7 ) ];
364               UINT8 colour = m_vMem[ m_colour + ( ( charcode & m_colourmask ) << 3 ) + ( y & 7 ) ];
365               UINT16 fg = colour >> 4;
366               UINT16 bg = colour & 15;
421367
422   /* colours at sides must be reset */
423   rt.min_y = 0; rt.max_y = 191;
424   rt.min_x = 0; rt.max_x = 7;
425   bitmap_fill (bitmap, &rt, bg);
426   rt.min_y = 0; rt.max_y = 191;
427   rt.min_x = 248; rt.max_x = 255;
428   bitmap_fill (bitmap, &rt, bg);
368               for ( int i = 0; i < 8; pattern <<= 1, i++ )
369                  p[x+i] = ( pattern & 0x80 ) ? fg : bg;
370            }
371         }
372         break;
429373
430    name = 0;
431    for (y=0;y<24;y++) {
432        for (x=0;x<40;x++) {
433            charcode = tms.vMem[tms.nametbl+name];
434            name++;
435            patternptr = tms.vMem + tms.pattern + (charcode*8);
436            for (yy=0;yy<8;yy++) {
437                pattern = *patternptr++;
438                for (xx=0;xx<6;xx++) {
439               *BITMAP_ADDR16(bitmap, y*8+yy, 8+x*6+xx) = (pattern & 0x80) ? fg : bg;
440                    pattern *= 2;
441                }
442            }
443        }
444    }
445}
374      case 3:            /* MODE 1+2 */
375         //if (vpos==100) popmessage("TMS9928A MODE1+2");
376         {
377            UINT16 addr = m_nametbl + ( ( y >> 3 ) * 40 );
378            UINT16 fg = m_Regs[7] >> 4;
379            UINT16 bg = m_Regs[7] & 15;
446380
447static void draw_mode12 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
448    int pattern,x,y,yy,xx,name,charcode;
449    UINT8 fg,bg,*patternptr;
450    const pen_t *pens;
451    rectangle rt;
381            /* Extra 8 pixels left border */
382            for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 8; x++ )
383               p[x] = bg;
452384
453    pens = screen->machine().pens;
454    fg = pens[tms.Regs[7] / 16];
455    bg = pens[tms.Regs[7] & 15];
385            for ( int x = TMS9928A_HORZ_DISPLAY_START + 8; x < TMS9928A_HORZ_DISPLAY_START + 248; x+= 6, addr++ )
386            {
387               UINT16 charcode = ( m_vMem[ addr ] + ( ( y >> 6 ) << 8 ) ) & m_patternmask;
388               UINT8 pattern = m_vMem[ m_pattern + ( charcode << 3 ) + ( y & 7 ) ];
456389
457   /* colours at sides must be reset */
458   rt.min_y = 0; rt.max_y = 191;
459   rt.min_x = 0; rt.max_x = 7;
460   bitmap_fill (bitmap, &rt, bg);
461   rt.min_y = 0; rt.max_y = 191;
462   rt.min_x = 248; rt.max_x = 255;
463   bitmap_fill (bitmap, &rt, bg);
390               for ( int i = 0; i < 6; pattern <<= 1, i++ )
391                  p[x+i] = ( pattern & 0x80 ) ? fg : bg;
392            }
464393
465    name = 0;
466    for (y=0;y<24;y++) {
467        for (x=0;x<40;x++) {
468            charcode = (tms.vMem[tms.nametbl+name]+(y/8)*256)&tms.patternmask;
469            name++;
470            patternptr = tms.vMem + tms.pattern + (charcode*8);
471            for (yy=0;yy<8;yy++) {
472                pattern = *patternptr++;
473                for (xx=0;xx<6;xx++) {
474               *BITMAP_ADDR16(bitmap, y*8+yy, 8+x*6+xx) = (pattern & 0x80) ? fg : bg;
475                    pattern *= 2;
476                }
477            }
478        }
479    }
480}
394            /* Extra 8 pixels right border */
395            for ( int x = TMS9928A_HORZ_DISPLAY_START + 248; x < TMS9928A_HORZ_DISPLAY_START + 256; x++ )
396               p[x] = bg;
397         }
398         break;
481399
482static void draw_mode0 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
483    int pattern,x,y,yy,xx,name,charcode,colour;
484    UINT8 fg,bg,*patternptr;
485    const pen_t *pens;
400      case 4:            /* MODE 3 */
401         //if (vpos==100 ) popmessage("TMS9928A MODE 3");
402         {
403            UINT16 addr = m_nametbl + ( ( y >> 3 ) * 32 );
486404
487    pens = screen->machine().pens;
488    name = 0;
489    for (y=0;y<24;y++) {
490        for (x=0;x<32;x++) {
491            charcode = tms.vMem[tms.nametbl+name];
492            name++;
493            patternptr = tms.vMem + tms.pattern + charcode*8;
494            colour = tms.vMem[tms.colour+charcode/8];
495            fg = pens[colour / 16];
496            bg = pens[colour & 15];
497            for (yy=0;yy<8;yy++) {
498                pattern=*patternptr++;
499                for (xx=0;xx<8;xx++) {
500               *BITMAP_ADDR16(bitmap, y*8+yy, x*8+xx) = (pattern & 0x80) ? fg : bg;
501                    pattern *= 2;
502                }
503            }
504        }
505    }
506}
405            for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
406            {
407               UINT8 charcode = m_vMem[ addr ];
408               UINT8 colour = m_vMem[ m_pattern + ( charcode << 3 ) + ( ( y >> 2 ) & 7 ) ];
409               UINT16 fg = colour >> 4;
410               UINT16 bg = colour & 15;
507411
508static void draw_mode2 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
509    int colour,name,x,y,yy,pattern,xx,charcode;
510    UINT8 fg,bg;
511    const pen_t *pens;
512    UINT8 *colourptr,*patternptr;
412               p[x+0] = p[x+1] = p[x+2] = p[x+3] = fg;
413               p[x+4] = p[x+5] = p[x+6] = p[x+7] = bg;
414            }
415         }
416         break;
513417
514    pens = screen->machine().pens;
515    name = 0;
516    for (y=0;y<24;y++) {
517        for (x=0;x<32;x++) {
518            charcode = tms.vMem[tms.nametbl+name]+(y/8)*256;
519            name++;
520            colour = (charcode&tms.colourmask);
521            pattern = (charcode&tms.patternmask);
522            patternptr = tms.vMem+tms.pattern+colour*8;
523            colourptr = tms.vMem+tms.colour+pattern*8;
524            for (yy=0;yy<8;yy++) {
525                pattern = *patternptr++;
526                colour = *colourptr++;
527                fg = pens[colour / 16];
528                bg = pens[colour & 15];
529                for (xx=0;xx<8;xx++) {
530               *BITMAP_ADDR16(bitmap, y*8+yy, x*8+xx) = (pattern & 0x80) ? fg : bg;
531                    pattern *= 2;
532                }
533            }
534        }
535    }
536}
418      case 5:   case 7:      /* MODE bogus */
419         //if (vpos==100 ) popmessage("TMS9928A MODE bogus");
420         {
421            UINT16 fg = m_Regs[7] >> 4;
422            UINT16 bg = m_Regs[7] & 15;
537423
538static void draw_mode3 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
539    int x,y,yy,yyy,name,charcode;
540    UINT8 fg,bg,*patternptr;
541    const pen_t *pens;
424            /* Extra 8 pixels left border */
425            for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 8; x++ )
426               p[x] = bg;
542427
543    pens = screen->machine().pens;
544    name = 0;
545    for (y=0;y<24;y++) {
546        for (x=0;x<32;x++) {
547            charcode = tms.vMem[tms.nametbl+name];
548            name++;
549            patternptr = tms.vMem+tms.pattern+charcode*8+(y&3)*2;
550            for (yy=0;yy<2;yy++) {
551                fg = pens[(*patternptr / 16)];
552                bg = pens[((*patternptr++) & 15)];
553                for (yyy=0;yyy<4;yyy++) {
554         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+0) = fg;
555         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+1) = fg;
556         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+2) = fg;
557         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+3) = fg;
558         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+4) = bg;
559         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+5) = bg;
560         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+6) = bg;
561         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+7) = bg;
562                }
563            }
564        }
565    }
566}
428            for ( int x = TMS9928A_HORZ_DISPLAY_START + 8; x < TMS9928A_HORZ_DISPLAY_START + 248; x+= 6 )
429            {
430               p[x+0] = p[x+1] = p[x+2] = p[x+3] = fg;
431               p[x+4] = p[x+5] = bg;
432            }
567433
568static void draw_mode23 (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
569    int x,y,yy,yyy,name,charcode;
570    UINT8 fg,bg,*patternptr;
571    const pen_t *pens;
434            /* Extra 8 pixels right border */
435            for ( int x = TMS9928A_HORZ_DISPLAY_START + 248; x < TMS9928A_HORZ_DISPLAY_START + 256; x++ )
436               p[x] = bg;
437         }
438         break;
572439
573    pens = screen->machine().pens;
574    name = 0;
575    for (y=0;y<24;y++) {
576        for (x=0;x<32;x++) {
577            charcode = tms.vMem[tms.nametbl+name];
578            name++;
579            patternptr = tms.vMem + tms.pattern +
580                ((charcode+(y&3)*2+(y/8)*256)&tms.patternmask)*8;
581            for (yy=0;yy<2;yy++) {
582                fg = pens[(*patternptr / 16)];
583                bg = pens[((*patternptr++) & 15)];
584                for (yyy=0;yyy<4;yyy++) {
585         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+0) = fg;
586         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+1) = fg;
587         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+2) = fg;
588         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+3) = fg;
589         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+4) = bg;
590         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+5) = bg;
591         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+6) = bg;
592         *BITMAP_ADDR16(bitmap, y*8+yy*4+yyy, x*8+7) = bg;
593                }
594            }
595        }
596    }
597}
440      case 6:            /* MODE 2+3 */
441         //if (vpos==100 ) popmessage("TMS9928A MODE 2+3");
442         {
443            UINT16 addr = m_nametbl + ( ( y >> 3 ) * 32 );
598444
599static void draw_modebogus (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
600    UINT8 fg,bg;
601    int x,y,n,xx;
602    const pen_t *pens;
445            for ( int x = TMS9928A_HORZ_DISPLAY_START; x < TMS9928A_HORZ_DISPLAY_START + 256; x+= 8, addr++ )
446            {
447               UINT8 charcode = m_vMem[ addr ];
448               UINT8 colour = m_vMem[ m_pattern + ( ( ( charcode + ( ( y >> 2 ) & 7 ) + ( ( y >> 6 ) << 8 ) ) & m_patternmask ) << 3 ) ];
449               UINT16 fg = colour >> 4;
450               UINT16 bg = colour & 15;
603451
604    pens = screen->machine().pens;
605    fg = pens[tms.Regs[7] / 16];
606    bg = pens[tms.Regs[7] & 15];
452               p[x+0] = p[x+1] = p[x+2] = p[x+3] = fg;
453               p[x+4] = p[x+5] = p[x+6] = p[x+7] = bg;
454            }
455         }
456         break;
457      }
607458
608    for (y=0;y<192;y++) {
609        xx=0;
610        n=8; while (n--) *BITMAP_ADDR16(bitmap, y, xx++) = bg;
611        for (x=0;x<40;x++) {
612            n=4; while (n--) *BITMAP_ADDR16(bitmap, y, xx++) = fg;
613            n=2; while (n--) *BITMAP_ADDR16(bitmap, y, xx++) = bg;
614        }
615        n=8; while (n--) *BITMAP_ADDR16(bitmap, y, xx++) = bg;
616    }
617}
459      /* Draw sprites */
460      if ( ( m_Regs[1] & 0x50 ) != 0x40 )
461      {
462         /* sprites are disabled */
463         m_FifthSprite = 31;
464      }
465      else
466      {
467         UINT8 sprite_size = ( m_Regs[1] & 0x02 ) ? 16 : 8;
468         UINT8 sprite_mag = m_Regs[1] & 0x01;
469         UINT8 sprite_height = sprite_size * ( sprite_mag + 1 );
470         UINT8 spr_drawn[32+256+32] = { 0 };
471         UINT8 num_sprites = 0;
618472
619/*
620** This function renders the sprites. Sprite collision is calculated in
621** in a back buffer (tms.dBackMem), because sprite collision detection
622** is rather complicated (transparent sprites also cause the sprite
623** collision bit to be set, and ``illegal'' sprites do not count
624** (they're not displayed)).
625**
626** This code should be optimized. One day.
627*/
628static void draw_sprites (device_t *screen, bitmap_t *bitmap, const rectangle *cliprect) {
629    UINT8 *attributeptr,*patternptr,c;
630    int p,x,y,size,i,j,large,yy,xx,limit[192],
631        illegalsprite,illegalspriteline;
632    UINT16 line,line2;
633    const pen_t *pens;
473         for ( UINT16 sprattr = 0; sprattr < 128; sprattr += 4 )
474         {
475            int spr_y = m_vMem[ m_spriteattribute + sprattr + 0 ];
634476
635    if ((tms.Regs[1] & 0x50) != 0x40) {
636        /* sprites are disabled */
637        tms.FifthSprite = 31;
638        return;
639    }
477            /* Stop processing sprites */
478            if ( spr_y == 208 )
479               break;
640480
641    pens = screen->machine().pens;
642    attributeptr = tms.vMem + tms.spriteattribute;
643    size = (tms.Regs[1] & 2) ? 16 : 8;
644    large = (int)(tms.Regs[1] & 1);
481            if ( spr_y > 0xE0 )
482               spr_y -= 256;
645483
646    for (x=0;x<192;x++) limit[x] = 4;
647    tms.StatusReg &= ~0x20; /* reset collision */
648    illegalspriteline = 255;
649    illegalsprite = 0;
484            /* vert pos 255 is displayed on the first line of the screen */
485            spr_y++;
650486
651    memset (tms.dBackMem, 0, IMAGE_SIZE);
652    for (p=0;p<32;p++) {
653        y = *attributeptr++;
654        if (y == 208) break;
655        if (y > 208) {
656            y=-(~y&255);
657        } else {
658            y++;
659        }
660        x = *attributeptr++;
661        patternptr = tms.vMem + tms.spritepattern +
662            ((size == 16) ? *attributeptr & 0xfc : *attributeptr) * 8;
663        attributeptr++;
664        c = (*attributeptr & 0x0f);
665        if (*attributeptr & 0x80) x -= 32;
666        attributeptr++;
487            /* is sprite enabled on this line? */
488            if ( spr_y <= y && y < spr_y + sprite_height )
489            {
490               int spr_x = m_vMem[ m_spriteattribute + sprattr + 1 ];
491               UINT8 sprcode = m_vMem[ m_spriteattribute + sprattr + 2 ];
492               UINT8 sprcol = m_vMem[ m_spriteattribute + sprattr + 3 ];
493               UINT16 pataddr = m_spritepattern + ( ( sprite_size == 16 ) ? sprcode & ~0x03 : sprcode ) * 8;
667494
668        if (!large) {
669            /* draw sprite (not enlarged) */
670            for (yy=y;yy<(y+size);yy++) {
671                if ( (yy < 0) || (yy > 191) ) continue;
672                if (limit[yy] == 0) {
673                    /* illegal sprite line */
674                    if (yy < illegalspriteline) {
675                        illegalspriteline = yy;
676                        illegalsprite = p;
677                    } else if (illegalspriteline == yy) {
678                        if (illegalsprite > p) {
679                            illegalsprite = p;
680                        }
681                    }
682                    if (tms.LimitSprites) continue;
683                } else limit[yy]--;
684                line = 256*patternptr[yy-y] + patternptr[yy-y+16];
685                for (xx=x;xx<(x+size);xx++) {
686                    if (line & 0x8000) {
687                        if ((xx >= 0) && (xx < 256)) {
688                            if (tms.dBackMem[yy*256+xx]) {
689                                tms.StatusReg |= 0x20;
690                            } else {
691                                tms.dBackMem[yy*256+xx] = 0x01;
692                            }
693                            if (c && ! (tms.dBackMem[yy*256+xx] & 0x02))
694                            {
695                                tms.dBackMem[yy*256+xx] |= 0x02;
696                                if (bitmap)
697                                    *BITMAP_ADDR16(bitmap, TOP_BORDER+yy, LEFT_BORDER+xx) = pens[c];
698                            }
699                        }
700                    }
701                    line *= 2;
702                }
703            }
704        } else {
705            /* draw enlarged sprite */
706            for (i=0;i<size;i++) {
707                yy=y+i*2;
708                line2 = 256*patternptr[i] + patternptr[i+16];
709                for (j=0;j<2;j++) {
710                    if ( (yy >= 0) && (yy <= 191) ) {
711                        if (limit[yy] == 0) {
712                            /* illegal sprite line */
713                            if (yy < illegalspriteline) {
714                                illegalspriteline = yy;
715                                illegalsprite = p;
716                            } else if (illegalspriteline == yy) {
717                                if (illegalsprite > p) {
718                                    illegalsprite = p;
719                                }
720                            }
721                            if (tms.LimitSprites) continue;
722                        } else limit[yy]--;
723                        line = line2;
724                        for (xx=x;xx<(x+size*2);xx+=2) {
725                            if (line & 0x8000) {
726                                if ((xx >=0) && (xx < 256)) {
727                                    if (tms.dBackMem[yy*256+xx]) {
728                                        tms.StatusReg |= 0x20;
729                                    } else {
730                                        tms.dBackMem[yy*256+xx] = 0x01;
731                                    }
732                                    if (c && ! (tms.dBackMem[yy*256+xx] & 0x02))
733                                    {
734                                        tms.dBackMem[yy*256+xx] |= 0x02;
735                                        if (bitmap)
736                                            *BITMAP_ADDR16(bitmap, TOP_BORDER+yy, LEFT_BORDER+xx) = pens[c];
737                                    }
738                                }
739                                if (((xx+1) >=0) && ((xx+1) < 256)) {
740                                    if (tms.dBackMem[yy*256+xx+1]) {
741                                        tms.StatusReg |= 0x20;
742                                    } else {
743                                        tms.dBackMem[yy*256+xx+1] = 0x01;
744                                    }
745                                    if (c && ! (tms.dBackMem[yy*256+xx+1] & 0x02))
746                                    {
747                                        tms.dBackMem[yy*256+xx+1] |= 0x02;
748                                        if (bitmap)
749                                            *BITMAP_ADDR16(bitmap, TOP_BORDER+yy, LEFT_BORDER+xx+1) = pens[c];
750                                    }
751                                }
752                            }
753                            line *= 2;
754                        }
755                    }
756                    yy++;
757                }
758            }
759        }
760    }
495               num_sprites++;
761496
762    /* The sprite number is only updated if the overflow bit is clear,
763    ** and the overflow bit will only be set if bit 6 and 7 are both clear. */
764    if (illegalspriteline == 255) tms.FifthSprite = (p > 31) ? 31 : p;
765    else tms.FifthSprite = illegalsprite;
766    if (~tms.StatusReg & 0x40) {
767        tms.StatusReg |= tms.FifthSprite;
768        if (~tms.StatusReg & 0x80) tms.StatusReg |= 0x40;
769    }
770}
497               /* Fifth sprite encountered? */
498               if( num_sprites == 5 )
499               {
500                  m_FifthSprite = sprattr / 4;
771501
772static TMS9928a_interface sIntf;
502                  if (~m_StatusReg & 0x40)
503                  {
504                     m_StatusReg |= m_FifthSprite;
505                     if (~m_StatusReg & 0x80) m_StatusReg |= 0x40;
506                  }
507               }
773508
509               if ( sprite_mag )
510                  pataddr += ( ( ( y - spr_y ) & 0x1F ) >> 1 );
511               else
512                  pataddr += ( ( y - spr_y ) & 0x0F );
774513
775void TMS9928A_configure (const TMS9928a_interface *intf)
514               UINT8 pattern = m_vMem[ pataddr ];
515
516               if ( sprcol & 0x80 )
517                  spr_x -= 32;
518
519               sprcol &= 0x0f;
520
521               for ( int s = 0; s < sprite_size; s += 8 )
522               {
523                  for ( int i = 0; i < 8; pattern <<= 1, i++ )
524                  {
525                     int colission_index = spr_x + ( sprite_mag ? i * 2 : i ) + 32;
526
527                     for ( int z = 0; z <= sprite_mag; colission_index++, z++ )
528                     {
529                        /* Check for colission */
530                        if ( spr_drawn[ colission_index ] )
531                           m_StatusReg |= 0x20;
532                        spr_drawn[ colission_index ] |= 0x01;
533
534                        /* Check if pixel should be drawn */
535                        if ( ( pattern & 0x80 ) && sprcol && num_sprites < 5 )
536                        {
537                           if ( colission_index >= 32 && colission_index < 32 + 256 )
538                           {
539                              /* Has another sprite already drawn here? */
540                              if ( ! ( spr_drawn[ colission_index ] & 0x02 ) )
541                              {
542                                 spr_drawn[ colission_index ] |= 0x02;
543                                 p[ TMS9928A_HORZ_DISPLAY_START + colission_index - 32 ] = sprcol;
544                              }
545                           }
546                        }
547                     }
548                  }
549
550                  pattern = m_vMem[ pataddr + 16 ];
551                  spr_x += sprite_mag ? 16 : 8;
552               }
553            }
554         }
555      }
556
557      /* Right border */
558      for ( int i = TMS9928A_HORZ_DISPLAY_START + 256; i < TMS9928A_TOTAL_HORZ; i++ )
559         p[i] = BackColour;
560   }
561
562   /* Schedule next callback */
563   m_line_timer->adjust( m_screen->time_until_pos( ( vpos + 1 ) % m_screen->height() , 0 ) );
564}
565
566
567void tms9928a_device::update( bitmap_t *bitmap, const rectangle *cliprect )
776568{
777   sIntf = *intf;
569   copybitmap( bitmap, m_tmpbmp, 0, 0, 0, 0, cliprect );
778570}
779571
780572
781VIDEO_START( tms9928a )
573void tms9928a_device::device_config_complete()
782574{
783   assert(sIntf.model != TMS_INVALID_MODEL);
784   TMS9928A_start(machine, &sIntf);
575   const tms9928a_interface *intf = reinterpret_cast<const tms9928a_interface *>(static_config());
576
577   if ( intf != NULL )
578   {
579      *static_cast<tms9928a_interface *>(this) = *intf;
580   }
581   else
582   {
583      m_vram_size = 0;
584      memset(&m_out_int_line, 0, sizeof(m_out_int_line));
585   }
785586}
786587
787588
788MACHINE_CONFIG_FRAGMENT( tms9928a )
589void tms9928a_device::device_start()
590{
591   assert_always(((m_vram_size == 0x1000) || (m_vram_size == 0x2000) || (m_vram_size == 0x4000)), "4, 8 or 16 kB vram please");
789592
790   /* video hardware */
791   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
593   m_screen = machine().device<screen_device>( m_screen_tag );
594   assert( m_screen != NULL );
792595
793   MCFG_SCREEN_ADD("screen", RASTER)
794   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
795   MCFG_SCREEN_SIZE(LEFT_BORDER+32*8+RIGHT_BORDER, TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ)
796   MCFG_SCREEN_VISIBLE_AREA(LEFT_BORDER-12, LEFT_BORDER+32*8+12-1, TOP_BORDER_60HZ-9, TOP_BORDER_60HZ+24*8+9-1)
797   MCFG_SCREEN_UPDATE(tms9928a)
596   m_top_border = m_50hz ? TMS9928A_VERT_DISPLAY_START_PAL : TMS9928A_VERT_DISPLAY_START_NTSC;
798597
799   MCFG_PALETTE_LENGTH(TMS9928A_PALETTE_SIZE)
800   MCFG_PALETTE_INIT(tms9928a)
598   m_irq_changed.resolve( m_out_int_line, *this );
801599
802   MCFG_VIDEO_START(tms9928a)
803MACHINE_CONFIG_END
600   /* Video RAM */
601   m_vMem = auto_alloc_array_clear(machine(), UINT8, m_vram_size);
804602
603   /* back bitmap */
604   m_tmpbmp = auto_bitmap_alloc(machine(), TMS9928A_TOTAL_HORZ, TMS9928A_TOTAL_VERT_PAL, m_screen->format());
605
606   m_line_timer = timer_alloc(TIMER_LINE);
607
608   m_LimitSprites = 1;
609
610   save_item(NAME(m_Regs[0]));
611   save_item(NAME(m_Regs[1]));
612   save_item(NAME(m_Regs[2]));
613   save_item(NAME(m_Regs[3]));
614   save_item(NAME(m_Regs[4]));
615   save_item(NAME(m_Regs[5]));
616   save_item(NAME(m_Regs[6]));
617   save_item(NAME(m_Regs[7]));
618   save_item(NAME(m_StatusReg));
619   save_item(NAME(m_FifthSprite));
620   save_item(NAME(m_ReadAhead));
621   save_item(NAME(m_latch));
622   save_item(NAME(m_Addr));
623   save_item(NAME(m_INT));
624   save_pointer(NAME(m_vMem), m_vram_size);
625   save_item(NAME(m_colour));
626   save_item(NAME(m_colourmask));
627   save_item(NAME(m_pattern));
628   save_item(NAME(m_patternmask));
629   save_item(NAME(m_nametbl));
630   save_item(NAME(m_spriteattribute));
631   save_item(NAME(m_spritepattern));
632   save_item(NAME(m_mode));
633}
634
635
636void tms9928a_device::device_reset()
637{
638   for ( int i = 0; i < 8; i++ )
639      m_Regs[i] = 0;
640
641   m_StatusReg = 0;
642   m_FifthSprite = 31;
643   m_nametbl = 0;
644   m_pattern = 0;
645   m_colour = 0;
646   m_spritepattern = 0;
647   m_spriteattribute = 0;
648   m_colourmask = 0;
649   m_patternmask = 0;
650   m_Addr = 0;
651   m_ReadAhead = 0;
652   m_INT = 0;
653   m_latch = 0;
654   m_mode = 0;
655
656   m_line_timer->adjust( m_screen->time_until_pos( 0, 0 ) );
657}
658
src/emu/video/tms9928a.h
r12394r12395
2323
2424*/
2525
26#ifndef __TMS9928A_H__
27#define __TMS9928A_H__
28
29#include "emu.h"
30#include "machine//devhelpr.h"
31
32
2633#define TMS9928A_PALETTE_SIZE           16
2734
28/*
29** The different models
30*/
31typedef enum
35
36/* Some defines used in defining the screens */
37#define TMS9928A_TOTAL_HORZ               342
38#define TMS9928A_TOTAL_VERT_NTSC         262
39#define TMS9928A_TOTAL_VERT_PAL            313
40
41#define TMS9928A_HORZ_DISPLAY_START         (2 + 14 + 8 + 13)
42#define TMS9928A_VERT_DISPLAY_START_PAL      (13 + 51)
43#define TMS9928A_VERT_DISPLAY_START_NTSC   (13 + 27)
44
45
46#define TMS9928A_INTERFACE(name) \
47   const tms9928a_interface (name) =
48
49
50#define MCFG_TMS9928A_ADD(_tag, _variant, _config) \
51   MCFG_DEVICE_ADD(_tag, _variant, XTAL_10_738635MHz / 2 ) \
52   MCFG_DEVICE_CONFIG(_config) \
53   MCFG_PALETTE_LENGTH(TMS9928A_PALETTE_SIZE) \
54   MCFG_PALETTE_INIT(tms9928a) \
55
56
57#define MCFG_TMS9928A_SCREEN_ADD_NTSC(_screen_tag) \
58   MCFG_SCREEN_ADD( _screen_tag, RASTER ) \
59   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) \
60   MCFG_SCREEN_RAW_PARAMS( XTAL_10_738635MHz / 2, TMS9928A_TOTAL_HORZ, TMS9928A_HORZ_DISPLAY_START-12, TMS9928A_HORZ_DISPLAY_START + 256 + 12, \
61       TMS9928A_TOTAL_VERT_NTSC, TMS9928A_VERT_DISPLAY_START_NTSC - 12, TMS9928A_VERT_DISPLAY_START_NTSC + 192 + 12 )
62
63
64#define MCFG_TMS9928A_SCREEN_ADD_PAL(_screen_tag) \
65   MCFG_SCREEN_ADD(_screen_tag, RASTER ) \
66   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) \
67   MCFG_SCREEN_RAW_PARAMS( XTAL_10_738635MHz / 2, TMS9928A_TOTAL_HORZ, TMS9928A_HORZ_DISPLAY_START-12, TMS9928A_HORZ_DISPLAY_START + 256 + 12,   \
68       TMS9928A_TOTAL_VERT_PAL, TMS9928A_VERT_DISPLAY_START_PAL - 12, TMS9928A_VERT_DISPLAY_START_PAL + 192 + 12 )
69
70
71extern const device_type TMS9918;
72extern const device_type TMS9918A;
73extern const device_type TMS9118;
74extern const device_type TMS9928A;
75extern const device_type TMS9128;
76extern const device_type TMS9929;
77extern const device_type TMS9929A;
78extern const device_type TMS9129;
79
80
81typedef struct _tms9928a_interface tms9928a_interface;
82struct _tms9928a_interface
3283{
33   TMS_INVALID_MODEL,
34   TMS99x8,
35   TMS9929,
36   TMS99x8A,
37   TMS9929A
38} tms9928a_model;
84   const char         *m_screen_tag;
85   int               m_vram_size;   /* 4K, 8K, or 16K. This should be replaced by fetching data from an address space? */
86   devcb_write_line   m_out_int_line;   /* Callback is called whenever the state of the INT output changes */
87};
3988
40/*
41** MachineDriver video declarations for the TMS9928A chip
42*/
43typedef struct TMS9928a_interface
89
90PALETTE_INIT( tms9928a );
91
92
93class tms9928a_device :   public device_t,
94                  public tms9928a_interface
4495{
45   tms9928a_model model;      /* model: tms9929(a) runs at 50Hz instead of 60Hz */
46   int vram;               /* VRAM size in bytes (4k, 8k or 16k) */
47   int borderx, bordery;      /* number of border pixels to show in each direction */
48   void (*int_callback)(running_machine &, int);   /* callback which is called whenever the state
49                                ** of the INT output of the TMS9918A changes (may be NULL)*/
50} TMS9928a_interface;
96public:
97   // construction/destruction
98   tms9928a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
99   tms9928a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_50hz = false, bool is_reva = true);
51100
52/*
53** configuration function
54*/
55extern void TMS9928A_configure (const TMS9928a_interface *intf);
101   DECLARE_READ8_MEMBER( vram_read );
102   DECLARE_WRITE8_MEMBER( vram_write );
103   DECLARE_READ8_MEMBER( register_read );
104   DECLARE_WRITE8_MEMBER( register_write );
56105
57/*
58** reset function
59*/
60extern void TMS9928A_reset (void);
106   /* update the screen */
107   void update( bitmap_t *bitmap, const rectangle *cliprect );
61108
62/*
63** The I/O functions
64*/
65extern READ8_HANDLER (TMS9928A_vram_r);
66extern WRITE8_HANDLER (TMS9928A_vram_w);
67extern READ8_HANDLER (TMS9928A_register_r);
68extern WRITE8_HANDLER (TMS9928A_register_w);
109protected:
110   // device-level overrides
111   virtual void device_config_complete();
112   virtual void device_start();
113   virtual void device_reset();
114   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
69115
70/*
71** Call this function to render the screen.
72*/
73extern VIDEO_START( tms9928a );
74extern SCREEN_UPDATE( tms9928a );
116   // device_memory_interface overrides
117   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_0) ? &m_space_config : NULL; }
75118
76/*
77** This next function must be called 50 (tms9929a) or 60 (tms99x8a) times per second,
78** to generate the necessary interrupts
79*/
80int TMS9928A_interrupt (running_machine &machine);
119private:
120   void change_register(UINT8 reg, UINT8 val);
81121
82/*
83** Set display of illegal sprites on or off
84*/
85void TMS9928A_set_spriteslimit (int);
122   static const device_timer_id TIMER_LINE = 0;
86123
87/*
88** After loading a state, call this function
89*/
90void TMS9928A_post_load (running_machine &machine);
124   screen_device   *m_screen;
91125
92/*
93** MachineDriver video declarations for the TMS9928A chip
94*/
95MACHINE_CONFIG_EXTERN( tms9928a );
126   /* TMS9928A internal settings */
127   UINT8   m_ReadAhead;
128   UINT8   m_Regs[8];
129   UINT8   m_StatusReg;
130   UINT8   m_FifthSprite;
131   UINT8   m_latch;
132   UINT8   m_INT;
133   UINT16   m_Addr;
134   UINT16   m_colour;
135   UINT16   m_pattern;
136   UINT16   m_nametbl;
137   UINT16   m_spriteattribute;
138   UINT16   m_spritepattern;
139   int      m_colourmask;
140   int      m_patternmask;
141   devcb_resolved_write_line   m_irq_changed;
142   bool   m_50hz;
143   bool   m_reva;
144
145   /* memory */
146   const address_space_config      m_space_config;
147
148   UINT8      *m_vMem;
149   bitmap_t   *m_tmpbmp;
150   emu_timer   *m_line_timer;
151   UINT8      m_mode;
152
153   /* emulation settings */
154   int         m_LimitSprites; /* max 4 sprites on a row, like original TMS9918A */
155   int         m_top_border;
156};
157
158
159class tms9918_device : public tms9928a_device
160{
161public:
162   tms9918_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
163      : tms9928a_device( mconfig, TMS9918, "tms9918", tag, owner, clock, false, false ) { }
164};
165
166
167class tms9918a_device :   public tms9928a_device
168{
169public:
170   tms9918a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
171      : tms9928a_device( mconfig, TMS9918A, "tms9918a", tag, owner, clock, false, true ) { }
172};
173
174
175class tms9118_device : public tms9928a_device
176{
177public:
178   tms9118_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
179      : tms9928a_device( mconfig, TMS9118, "tms9118", tag, owner, clock, false, false ) { }
180};
181
182
183class tms9128_device : public tms9928a_device
184{
185public:
186   tms9128_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
187      : tms9928a_device( mconfig, TMS9128, "tms9128", tag, owner, clock, false, false ) { }
188};
189
190
191class tms9929_device : public tms9928a_device
192{
193public:
194   tms9929_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
195      : tms9928a_device( mconfig, TMS9929, "tms9929", tag, owner, clock, false, true ) { }
196};
197
198
199class tms9929a_device : public tms9928a_device
200{
201public:
202   tms9929a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
203      : tms9928a_device( mconfig, TMS9929A, "tms9929a", tag, owner, clock, true, true ) { }
204};
205
206
207class tms9129_device : public tms9928a_device
208{
209public:
210   tms9129_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
211      : tms9928a_device( mconfig, TMS9129, "tms9129", tag, owner, clock, true, false ) { }
212};
213
214
215#endif
src/mess/machine/ti99/videowrp.c
r12394r12395
4646READ16_DEVICE_HANDLER( ti_tms991x_r16 )
4747{
4848   ti99_video_state *video = get_safe_token(device);
49   tms9928a_device *tms9928a = device->machine().device<tms9928a_device>( TMS9928A_TAG );
4950//  device_adjust_icount(video->cpu, -4);
5051
5152   if (offset & 1)
5253   {   /* read VDP status */
53      return ((int) TMS9928A_register_r(video->space, 0)) << 8;
54      return ((int) tms9928a->register_read(*(video->space), 0)) << 8;
5455   }
5556   else
5657   {   /* read VDP RAM */
57      return ((int) TMS9928A_vram_r(video->space, 0)) << 8;
58      return ((int) tms9928a->vram_read(*(video->space), 0)) << 8;
5859   }
5960}
6061
r12394r12395
6465READ8Z_DEVICE_HANDLER( ti8_tms991x_rz )
6566{
6667   ti99_video_state *video = get_safe_token(device);
68   tms9928a_device *tms9928a = device->machine().device<tms9928a_device>( TMS9928A_TAG );
6769//  device_adjust_icount(video->cpu, -4);
6870
6971   if (offset & 2)
7072   {   /* read VDP status */
71      *value = TMS9928A_register_r(video->space, 0);
73      *value = tms9928a->register_read(*(video->space), 0);
7274   }
7375   else
7476   {   /* read VDP RAM */
75      *value = TMS9928A_vram_r(video->space, 0);
77      *value = tms9928a->vram_read(*(video->space), 0);
7678   }
7779}
7880
r12394r12395
100102WRITE16_DEVICE_HANDLER( ti_tms991x_w16 )
101103{
102104   ti99_video_state *video = get_safe_token(device);
105   tms9928a_device *tms9928a = device->machine().device<tms9928a_device>( TMS9928A_TAG );
103106//  device_adjust_icount(video->cpu, -4);
104107
105108   if (offset & 1)
106109   {   /* write VDP address */
107      TMS9928A_register_w(video->space, 0, (data >> 8) & 0xff);
110      tms9928a->register_write(*(video->space), 0, (data >> 8) & 0xff);
108111   }
109112   else
110113   {   /* write VDP data */
111      TMS9928A_vram_w(video->space, 0, (data >> 8) & 0xff);
114      tms9928a->vram_write(*(video->space), 0, (data >> 8) & 0xff);
112115   }
113116}
114117
r12394r12395
118121WRITE8_DEVICE_HANDLER( ti8_tms991x_w )
119122{
120123   ti99_video_state *video = get_safe_token(device);
124   tms9928a_device *tms9928a = device->machine().device<tms9928a_device>( TMS9928A_TAG );
121125//  device_adjust_icount(video->cpu, -4);
122126
123127   if (offset & 2)
124128   {   /* write VDP address */
125      TMS9928A_register_w(video->space, 0, data);
129      tms9928a->register_write(*(video->space), 0, data);
126130   }
127131   else
128132   {   /* write VDP data */
129      TMS9928A_vram_w(video->space, 0, data);
133      tms9928a->vram_write(*(video->space), 0, data);
130134   }
131135}
132136
r12394r12395
241245   video->space = device->machine().device("maincpu")->memory().space(AS_PROGRAM);
242246   video->chip = conf->chip;
243247
244   if (video->chip==TI_TMS991X)
248   if (video->chip!=TI_TMS991X)
245249   {
246      TMS9928A_configure(conf->tmsparam);
247   }
248   else
249   {
250250      running_machine &machine = device->machine();
251251      VIDEO_START_CALL(generic_bitmapped);
252252   }
r12394r12395
259259static DEVICE_RESET( ti99_video )
260260{
261261   const ti99_video_config* conf = (const ti99_video_config*)get_config(device);
262   if (conf->chip==TI_TMS991X)
262   if (conf->chip!=TI_TMS991X)
263263   {
264      TMS9928A_reset();
265   }
266   else
267   {
268264      running_machine &machine = device->machine();
269265      int memsize = (input_port_read(machine, "V9938-MEM")==0)? 0x20000 : 0x30000;
270266
src/mess/machine/ti99/videowrp.h
r12394r12395
1010#include "video/tms9928a.h"
1111#include "video/v9938.h"
1212
13#define TMS9928A_TAG   "tms9928a"
14#define SCREEN_TAG      "screen"
15
1316#define READ8Z_DEVICE_HANDLER(name)      void name(ATTR_UNUSED device_t *device, ATTR_UNUSED offs_t offset, UINT8 *value)
1417
1518#define TI_TMS991X 1
r12394r12395
1720
1821typedef struct _ti99_video_config
1922{
20   TMS9928a_interface         *tmsparam;
2123   int                     chip;
2224   void                  (*callback)(running_machine &, int);
2325
r12394r12395
3840
3941DECLARE_LEGACY_DEVICE( TIVIDEO, ti99_video );
4042
41#define MCFG_TI_TMS991x_ADD(_tag, _chip, _rate, _screen, _blank, _tmsparam)      \
42   MCFG_DEVICE_ADD(_tag, TIVIDEO, 0)                        \
43   MCFG_DEVICE_CONFIG_DATAPTR(ti99_video_config, tmsparam, _tmsparam)   \
44   MCFG_DEVICE_CONFIG_DATA32(ti99_video_config, chip, TI_TMS991X)      \
45   MCFG_FRAGMENT_ADD(_chip)                              \
46   MCFG_SCREEN_MODIFY(_screen)                              \
47   MCFG_SCREEN_REFRESH_RATE(_rate)                           \
48   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(_blank))
43#define MCFG_TI_TMS991x_ADD_NTSC(_tag, _chip, _screen_update, _tmsparam)   \
44   MCFG_DEVICE_ADD(_tag, TIVIDEO, 0)                              \
45   MCFG_DEVICE_CONFIG_DATA32(ti99_video_config, chip, TI_TMS991X)         \
46   MCFG_TMS9928A_ADD( TMS9928A_TAG, _chip, _tmsparam )                \
47   MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG )                      \
48   MCFG_SCREEN_UPDATE( _screen_update )
4949
50#define MCFG_TI_TMS991x_ADD_PAL(_tag, _chip, _screen_update, _tmsparam)      \
51   MCFG_DEVICE_ADD(_tag, TIVIDEO, 0)                              \
52   MCFG_DEVICE_CONFIG_DATA32(ti99_video_config, chip, TI_TMS991X)         \
53   MCFG_TMS9928A_ADD( TMS9928A_TAG, _chip, _tmsparam )                  \
54   MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG )                        \
55   MCFG_SCREEN_UPDATE( _screen_update )
56
5057#define MCFG_TI_V9938_ADD(_tag, _rate, _screen, _blank, _x, _y, _int)      \
51   MCFG_DEVICE_ADD(_tag, TIVIDEO, 0)                        \
52   MCFG_DEVICE_CONFIG_DATAPTR(ti99_video_config, tmsparam, NULL)   \
53   MCFG_DEVICE_CONFIG_DATAPTR(ti99_video_config, callback, _int)   \
54   MCFG_DEVICE_CONFIG_DATA32(ti99_video_config, chip, TI_V9938)      \
55   MCFG_SCREEN_ADD(_screen, RASTER)   \
56   MCFG_SCREEN_REFRESH_RATE(_rate)                           \
57   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)   \
58   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(_blank))   \
59   MCFG_SCREEN_SIZE(_x, _y)   \
60   MCFG_SCREEN_VISIBLE_AREA(0, _x - 1, 0, _y - 1)   \
61   MCFG_SCREEN_UPDATE(generic_bitmapped)   \
62   MCFG_PALETTE_LENGTH(512)   \
58   MCFG_DEVICE_ADD(_tag, TIVIDEO, 0)                              \
59   MCFG_DEVICE_CONFIG_DATAPTR(ti99_video_config, callback, _int)         \
60   MCFG_DEVICE_CONFIG_DATA32(ti99_video_config, chip, TI_V9938)         \
61   MCFG_SCREEN_ADD(_screen, RASTER)                              \
62   MCFG_SCREEN_REFRESH_RATE(_rate)                                 \
63   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)                        \
64   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(_blank))               \
65   MCFG_SCREEN_SIZE(_x, _y)                                    \
66   MCFG_SCREEN_VISIBLE_AREA(0, _x - 1, 0, _y - 1)                     \
67   MCFG_SCREEN_UPDATE(generic_bitmapped)                           \
68   MCFG_PALETTE_LENGTH(512)                                    \
6369   MCFG_PALETTE_INIT(v9938)
6470
6571#endif /* __TIVIDEO__ */
src/mess/machine/ti99/tiboard.c
r12394r12395
6969   device_t *dev = device->machine().device("ti_board");
7070   tiboard_state *board = get_safe_token(dev);
7171
72   TMS9928A_interrupt(device->machine());
73
7472   if (board->handset != NULL)
7573      ti99_handset_task(board->handset);
7674   if (board->mecmouse != NULL)
src/mess/machine/svi318.c
r12394r12395
389389
390390VIDEO_START( svi328_806 )
391391{
392   VIDEO_START_CALL(tms9928a);
393392}
394393
395394SCREEN_UPDATE( svi328_806 )
396395{
397   if (!strcmp(screen->tag(), "screen"))
396   if (!strcmp(screen->tag(), "svi806"))
398397   {
399      SCREEN_UPDATE_CALL(tms9928a);
400   }
401   else if (!strcmp(screen->tag(), "svi806"))
402   {
403398      mc6845_device *mc6845 = screen->machine().device<mc6845_device>("crtc");
404399      mc6845->update(bitmap, cliprect);
405400   }
r12394r12395
568563   memset (state->m_svi.empty_bank, 0xff, 0x8000);
569564}
570565
571static const TMS9928a_interface svi318_tms9928a_interface =
572{
573   TMS99x8A,
574   0x4000,
575   15,
576   15,
577   svi318_vdp_interrupt
578};
579
580static const TMS9928a_interface svi318_tms9929a_interface =
581{
582   TMS9929A,
583   0x4000,
584   13,
585   13,
586   svi318_vdp_interrupt
587};
588
589566MACHINE_START( svi318_ntsc )
590567{
591   TMS9928A_configure(&svi318_tms9928a_interface);
592568}
593569
594570MACHINE_START( svi318_pal )
595571{
596   TMS9928A_configure(&svi318_tms9929a_interface);
597572}
598573
599574static void svi318_load_proc(device_image_interface &image)
r12394r12395
621596{
622597   svi318_state *state = machine.driver_data<svi318_state>();
623598   int drive;
624   /* video stuff */
625   TMS9928A_reset();
626599
627600   state->m_svi.bank_switch = 0xff;
628601   svi318_set_banks(machine);
r12394r12395
633606   }
634607}
635608
636INTERRUPT_GEN( svi318_interrupt )
637{
638   int set;
639
640   set = input_port_read(device->machine(), "CONFIG");
641   TMS9928A_set_spriteslimit (set & 0x20);
642   TMS9928A_interrupt(device->machine());
643}
644
645609/* Memory */
646610
647611WRITE8_HANDLER( svi318_writemem1 )
src/mess/machine/msx.c
r12394r12395
1919#include "machine/wd17xx.h"
2020#include "imagedev/flopdrv.h"
2121#include "formats/basicdsk.h"
22#include "video/tms9928a.h"
2322#include "cpu/z80/z80.h"
2423#include "video/v9938.h"
2524#include "machine/ctronics.h"
r12394r12395
322321   msx_memory_map_all (machine);
323322}
324323
325static const TMS9928a_interface tms9928a_interface =
326{
327   TMS99x8A,
328   0x4000,
329   0, 0,
330   msx_vdp_interrupt
331};
332
333324MACHINE_START( msx )
334325{
335   TMS9928A_configure(&tms9928a_interface);
336326   MACHINE_START_CALL( msx2 );
337327}
338328
r12394r12395
345335
346336MACHINE_RESET( msx )
347337{
348   TMS9928A_reset ();
349338   msx_ch_reset_core (machine);
350339}
351340
r12394r12395
512501      state->m_mouse[i] = input_port_read(device->machine(), i ? "MOUSE1" : "MOUSE0");
513502      state->m_mouse_stat[i] = -1;
514503   }
515
516   TMS9928A_set_spriteslimit (input_port_read(device->machine(), "DSW") & 0x20);
517   TMS9928A_interrupt(device->machine());
518504}
519505
520506/*
src/mess/machine/mtx.c
r12394r12395
329329}
330330
331331/***************************************************************************
332    DEVICE CONFIGURATION
333***************************************************************************/
334
335/*-------------------------------------------------
336    TMS9928a_interface tms9928a_interface
337-------------------------------------------------*/
338
339static void mtx_tms9929a_interrupt(running_machine &machine, int data)
340{
341   mtx_state *state = machine.driver_data<mtx_state>();
342
343   z80ctc_trg0_w(state->m_z80ctc, data ? 0 : 1);
344}
345
346static const TMS9928a_interface tms9928a_interface =
347{
348   TMS9929A,
349   0x4000,
350   0, 0,
351   mtx_tms9929a_interrupt
352};
353
354INTERRUPT_GEN( mtx_interrupt )
355{
356   TMS9928A_interrupt(device->machine());
357}
358
359/***************************************************************************
360332    SNAPSHOT
361333***************************************************************************/
362334
r12394r12395
416388   memory_configure_bank(machine, "bank2", 0, 8, machine.region("user2")->base(), 0x2000);
417389   memory_configure_bank(machine, "bank3", 0, ram_get_size(messram)/0x4000/2, ram_get_ptr(messram), 0x4000);
418390   memory_configure_bank(machine, "bank4", 0, ram_get_size(messram)/0x4000/2, ram_get_ptr(messram) + ram_get_size(messram)/2, 0x4000);
419
420   /* setup tms9928a */
421   TMS9928A_configure(&tms9928a_interface);
422391}
423392
424393/*-------------------------------------------------
src/mess/includes/sg1000.h
r12394r12395
22#define __SG1000__
33
44#include "machine/ram.h"
5#include "video/tms9928a.h"
65#include "imagedev/cassette.h"
76
87#define SCREEN_TAG      "screen"
r12394r12395
1413#define UPD9255_0_TAG   "upd9255_0"
1514#define UPD9255_1_TAG   "upd9255_1"
1615#define CENTRONICS_TAG   "centronics"
16#define TMS9918A_TAG   "tms9918a"
1717
1818#define IS_CARTRIDGE_TV_DRAW(ptr) \
1919   (!strncmp("annakmn", (const char *)&ptr[0x13b3], 7))
r12394r12395
2727#define IS_CARTRIDGE_MUSIC_EDITOR(ptr) \
2828   (!strncmp("PIANO", (const char *)&ptr[0x0841], 5))
2929
30extern const TMS9928a_interface tms9928a_interface;
3130INPUT_PORTS_EXTERN( sk1100 );
32extern INTERRUPT_GEN( sg1000_int );
3331extern const i8255_interface ( sc3000_ppi_intf );
3432extern const cassette_interface sc3000_cassette_interface;
3533
src/mess/includes/mtx.h
r12394r12395
5050
5151MACHINE_START( mtx512 );
5252MACHINE_RESET( mtx512 );
53INTERRUPT_GEN( mtx_interrupt );
5453SNAPSHOT_LOAD( mtx );
5554
5655WRITE8_HANDLER( mtx_bankswitch_w );
src/mess/includes/svi318.h
r12394r12395
7474DEVICE_IMAGE_LOAD( svi318_cart );
7575DEVICE_IMAGE_UNLOAD( svi318_cart );
7676
77INTERRUPT_GEN( svi318_interrupt );
78void svi318_vdp_interrupt(running_machine &machine, int i);
79
8077WRITE8_HANDLER( svi318_writemem1 );
8178WRITE8_HANDLER( svi318_writemem2 );
8279WRITE8_HANDLER( svi318_writemem3 );
src/mess/drivers/adam.c
r12394r12395
12411241//  AM_RANGE(0x5f, 0x5f) Optional Modem Control Status
12421242   AM_RANGE(0x60, 0x60) AM_MIRROR(0x1f) AM_READWRITE(mioc_r, mioc_w)
12431243   AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_w)
1244   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
1245   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
1244   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write)
1245   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)
12461246   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(joystick_w)
12471247   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w)
12481248   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(input1_r)
r12394r12395
14951495//  TMS9928a_interface tms9928a_interface
14961496//-------------------------------------------------
14971497
1498static INTERRUPT_GEN( adam_interrupt )
1498static WRITE_LINE_DEVICE_HANDLER(adam_vdp_interrupt)
14991499{
1500   TMS9928A_interrupt(device->machine());
1501}
1500   adam_state *driver_state = device->machine().driver_data<adam_state>();
15021501
1503static void adam_vdp_interrupt(running_machine &machine, int state)
1504{
1505   adam_state *driver_state = machine.driver_data<adam_state>();
1506
15071502   if (state && !driver_state->m_vdp_nmi)
15081503   {
1509      cputag_set_input_line(machine, Z80_TAG, INPUT_LINE_NMI, PULSE_LINE);
1504      cputag_set_input_line(device->machine(), Z80_TAG, INPUT_LINE_NMI, PULSE_LINE);
15101505   }
15111506
15121507   driver_state->m_vdp_nmi = state;
15131508}
15141509
1515static const TMS9928a_interface tms9928a_interface =
1510static TMS9928A_INTERFACE(adam_tms9928a_interface)
15161511{
1517   TMS99x8A,
1512   "screen",
15181513   0x4000,
1519   0, 0,
1520   adam_vdp_interrupt
1514   DEVCB_LINE(adam_vdp_interrupt)
15211515};
15221516
1517static SCREEN_UPDATE( adam )
1518{
1519   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
15231520
1521   tms9928a->update( bitmap, cliprect );
1522   return 0;
1523}
1524
1525
15241526//-------------------------------------------------
15251527//  cassette_interface adam_cassette_interface
15261528//-------------------------------------------------
r12394r12395
16151617
16161618void adam_state::machine_start()
16171619{
1618   // configure VDP
1619   TMS9928A_configure(&tms9928a_interface);
1620
16211620   // register for state saving
16221621   state_save_register_global(machine(), m_mioc);
16231622   state_save_register_global(machine(), m_game);
r12394r12395
17101709   MCFG_CPU_ADD(M6801_SPI_TAG, M6801, XTAL_4MHz)
17111710   MCFG_DEVICE_DISABLE()
17121711
1713   MCFG_CPU_VBLANK_INT(SCREEN_TAG, adam_interrupt)
1714
17151712   // video hardware
1716   MCFG_FRAGMENT_ADD(tms9928a)
1717   MCFG_SCREEN_MODIFY(SCREEN_TAG)
1718   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
1713   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, adam_tms9928a_interface )
1714   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
1715   MCFG_SCREEN_UPDATE( adam )
17191716
17201717   // sound hardware
17211718   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/ti99_8.c
r12394r12395
501501GFXDECODE_END
502502
503503
504static const TMS9928a_interface tms9118_interface =
504static WRITE_LINE_DEVICE_HANDLER(set_int2)
505505{
506   TMS99x8A,
507   0x4000,
508   15, 15,
509   tms9901_set_int2
510};
506   tms9901_set_int2( device->machine(), state );
507}
511508
512static const TMS9928a_interface tms9129_interface =
509static TMS9928A_INTERFACE(ti99_8_tms9928a_interface)
513510{
514   TMS9929A,
511   SCREEN_TAG,
515512   0x4000,
516   13, 13,
517   tms9901_set_int2
513   DEVCB_LINE(set_int2)
518514};
519515
520516static const struct tms9995reset_param ti99_8_processor_config =
r12394r12395
591587{
592588}
593589
590static SCREEN_UPDATE( ti99_8 )
591{
592   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( TMS9928A_TAG );
593
594   tms9928a->update( bitmap, cliprect );
595   return 0;
596}
597
594598static MACHINE_CONFIG_START( ti99_8_60hz, ti99_8_state )
595599   /* basic machine hardware */
596600   /* TMS9995-MP9537 CPU @ 10.7 MHz */
r12394r12395
603607   MCFG_MACHINE_RESET( ti99_8 )
604608
605609   /* video hardware */
606   MCFG_TI_TMS991x_ADD("video", tms9928a, 60, "screen", 2500, &tms9118_interface)
610   MCFG_TI_TMS991x_ADD_NTSC("video", TMS9118, ti99_8, ti99_8_tms9928a_interface)
607611
608612   MCFG_GFXDECODE(ti99_8)
609613
r12394r12395
648652   MCFG_MACHINE_RESET( ti99_8 )
649653
650654   /* video hardware */
651   MCFG_TI_TMS991x_ADD("video", tms9928a, 50, "screen", 2500, &tms9129_interface)
655   MCFG_TI_TMS991x_ADD_PAL("video", TMS9129, ti99_8, ti99_8_tms9928a_interface)
652656
653657   MCFG_GFXDECODE(ti99_8)
654658
src/mess/drivers/tm990189.c
r12394r12395
107107   tm990189_state *state = machine.driver_data<tm990189_state>();
108108   state->m_displayena_timer = machine.scheduler().timer_alloc(FUNC_NULL);
109109}
110static const TMS9928a_interface tms9918_interface =
110
111static TMS9928A_INTERFACE(tms9918_interface)
111112{
112   TMS99x8,
113   "screen",
113114   0x4000,
114   0, 0,
115   NULL
115   DEVCB_NULL
116116};
117117
118118static MACHINE_START( tm990_189_v )
119119{
120120   tm990189_state *state = machine.driver_data<tm990189_state>();
121   TMS9928A_configure(&tms9918_interface);
122121
123122   state->m_displayena_timer = machine.scheduler().timer_alloc(FUNC_NULL);
124123
r12394r12395
131130static MACHINE_RESET( tm990_189_v )
132131{
133132   hold_load(machine);
134
135   TMS9928A_reset();
136133}
137134
138135
r12394r12395
238235static SCREEN_UPDATE( tm990_189_v )
239236{
240237   tm990189_state *state = screen->machine().driver_data<tm990189_state>();
241   SCREEN_UPDATE_CALL(tms9928a);
238   tms9918_device *tms9918 = screen->machine().device<tms9918_device>( "tms9918" );
242239
240   tms9918->update( bitmap, cliprect );
241
243242   plot_box(bitmap, state->m_LED_display_window_left, state->m_LED_display_window_top, state->m_LED_display_window_width, state->m_LED_display_window_height, screen->machine().pens[1]);
244243   update_common(screen->machine(), bitmap,
245244               state->m_LED_display_window_left, state->m_LED_display_window_top,
r12394r12395
515514static  READ8_HANDLER(video_vdp_r)
516515{
517516   tm990189_state *state = space->machine().driver_data<tm990189_state>();
517   tms9918_device *tms9918 = space->machine().device<tms9918_device>( "tms9918" );
518518   int reply = 0;
519519
520520   /* When the tms9980 reads @>2000 or @>2001, it actually does a word access:
r12394r12395
532532    it. */
533533
534534   if (offset & 2)
535      reply = TMS9928A_register_r(space, 0);
535      reply = tms9918->register_read(*space, 0);
536536   else
537      reply = TMS9928A_vram_r(space, 0);
537      reply = tms9918->vram_read(*space, 0);
538538
539539   if (!(offset & 1))
540540      state->m_bogus_read_save = reply;
r12394r12395
548548{
549549   if (offset & 1)
550550   {
551      tms9918_device *tms9918 = space->machine().device<tms9918_device>( "tms9918" );
552
551553      if (offset & 2)
552         TMS9928A_register_w(space, 0, data);
554         tms9918->register_write(*space, 0, data);
553555      else
554         TMS9928A_vram_w(space, 0, data);
556         tms9918->vram_write(*space, 0, data);
555557   }
556558}
557559
r12394r12395
853855   MCFG_MACHINE_RESET( tm990_189_v )
854856
855857   /* video hardware */
856   MCFG_FRAGMENT_ADD(tms9928a)
857   MCFG_SCREEN_MODIFY("screen")
858   MCFG_SCREEN_REFRESH_RATE(60)
859   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
860   MCFG_SCREEN_SIZE(LEFT_BORDER+32*8+RIGHT_BORDER, TOP_BORDER_60HZ+24*8+BOTTOM_BORDER_60HZ + 32)
861   MCFG_SCREEN_VISIBLE_AREA(LEFT_BORDER-12, LEFT_BORDER+32*8+12-1, TOP_BORDER_60HZ-9, TOP_BORDER_60HZ+24*8+9-1 + 32)
858   MCFG_TMS9928A_ADD( "tms9918", TMS9918, tms9918_interface )
859   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
862860   MCFG_SCREEN_UPDATE(tm990_189_v)
863861   MCFG_SCREEN_EOF(tm990_189)
864862
src/mess/drivers/sg1000.c
r12394r12395
7676#include "machine/i8255.h"
7777#include "machine/msm8251.h"
7878#include "machine/upd765.h"
79#include "video/tms9928a.h"
7980#include "sound/sn76496.h"
8081#include "crsshair.h"
8182#include "includes/sg1000.h"
r12394r12395
166167static ADDRESS_MAP_START( sg1000_io_map, AS_IO, 8, sg1000_state )
167168   ADDRESS_MAP_GLOBAL_MASK(0xff)
168169   AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w)
169   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
170   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
170   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
171   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
171172   AM_RANGE(0xdc, 0xdc) AM_READ_PORT("PA7")
172173   AM_RANGE(0xdd, 0xdd) AM_READ_PORT("PB7")
173174   AM_RANGE(0xde, 0xde) AM_READ(joysel_r) AM_WRITENOP
r12394r12395
191192static ADDRESS_MAP_START( omv_io_map, AS_IO, 8, sg1000_state )
192193   ADDRESS_MAP_GLOBAL_MASK(0xff)
193194   AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w)
194   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
195   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
195   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
196   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
196197   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x38) AM_READ_PORT("C0")
197198   AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x38) AM_READ_PORT("C1")
198199   AM_RANGE(0xc2, 0xc2) AM_MIRROR(0x38) AM_READ_PORT("C2")
r12394r12395
218219static ADDRESS_MAP_START( sc3000_io_map, AS_IO, 8, sg1000_state )
219220   ADDRESS_MAP_GLOBAL_MASK(0xff)
220221   AM_RANGE(0x7f, 0x7f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w)
221   AM_RANGE(0xbe, 0xbe) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
222   AM_RANGE(0xbf, 0xbf) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
222   AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
223   AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
223224   AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write)
224225ADDRESS_MAP_END
225226
r12394r12395
228229    ADDRESS_MAP_GLOBAL_MASK(0xff)
229230    AM_RANGE(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE(UPD9255_TAG, i8255_device, read, write)
230231    AM_RANGE(0x00, 0x00) AM_MIRROR(0x7f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w)
231    AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
232    AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
232    AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
233    AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
233234    AM_RANGE(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r)
234235ADDRESS_MAP_END
235236*/
r12394r12395
250251static ADDRESS_MAP_START( sf7000_io_map, AS_IO, 8, sf7000_state )
251252   ADDRESS_MAP_GLOBAL_MASK(0xff)
252253   AM_RANGE(0x7f, 0x7f) AM_DEVWRITE_LEGACY(SN76489A_TAG, sn76496_w)
253   AM_RANGE(0xbe, 0xbe) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
254   AM_RANGE(0xbf, 0xbf) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
254   AM_RANGE(0xbe, 0xbe) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, vram_read, vram_write)
255   AM_RANGE(0xbf, 0xbf) AM_DEVREADWRITE(TMS9918A_TAG, tms9918a_device, register_read, register_write)
255256   AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE(UPD9255_0_TAG, i8255_device, read, write)
256257   AM_RANGE(0xe0, 0xe0) AM_DEVREAD_LEGACY(UPD765_TAG, upd765_status_r)
257258   AM_RANGE(0xe1, 0xe1) AM_DEVREADWRITE_LEGACY(UPD765_TAG, upd765_data_r, upd765_data_w)
r12394r12395
531532    TMS9928a_interface tms9928a_interface
532533-------------------------------------------------*/
533534
534INTERRUPT_GEN( sg1000_int )
535static WRITE_LINE_DEVICE_HANDLER(sg1000_vdp_interrupt)
535536{
536    TMS9928A_interrupt(device->machine());
537   cputag_set_input_line(device->machine(), Z80_TAG, INPUT_LINE_IRQ0, state);
537538}
538539
539static void sg1000_vdp_interrupt(running_machine &machine, int state)
540static TMS9928A_INTERFACE(sg1000_tms9918a_interface)
540541{
541   cputag_set_input_line(machine, Z80_TAG, INPUT_LINE_IRQ0, state);
542}
543
544const TMS9928a_interface tms9928a_interface =
545{
546   TMS99x8A,
542   "screen",
547543   0x4000,
548   0, 0,
549   sg1000_vdp_interrupt
544   DEVCB_LINE(sg1000_vdp_interrupt)
550545};
551546
547static SCREEN_UPDATE( sg1000 )
548{
549   tms9918a_device *tms9918a = screen->machine().device<tms9918a_device>( TMS9918A_TAG );
550
551   tms9918a->update( bitmap, cliprect );
552   return 0;
553}
554
552555/*-------------------------------------------------
553556    I8255_INTERFACE( sc3000_ppi_intf )
554557-------------------------------------------------*/
r12394r12395
977980
978981void sg1000_state::machine_start()
979982{
980   /* configure VDP */
981   TMS9928A_configure(&tms9928a_interface);
982
983983   /* toggle light gun crosshair */
984984   machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
985985
r12394r12395
993993
994994void sc3000_state::machine_start()
995995{
996   /* configure VDP */
997   TMS9928A_configure(&tms9928a_interface);
998
999996   /* toggle light gun crosshair */
1000997   machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
1001998
r12394r12395
10111008
10121009void sf7000_state::machine_start()
10131010{
1014   /* configure VDP */
1015   TMS9928A_configure(&tms9928a_interface);
1016
10171011   /* configure memory banking */
10181012   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base(), 0);
10191013   memory_configure_bank(machine(), "bank1", 1, 1, ram_get_ptr(m_ram), 0);
r12394r12395
10481042   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3)
10491043   MCFG_CPU_PROGRAM_MAP(sg1000_map)
10501044   MCFG_CPU_IO_MAP(sg1000_io_map)
1051   MCFG_CPU_VBLANK_INT(SCREEN_TAG, sg1000_int)
10521045
10531046    /* video hardware */
1054   MCFG_FRAGMENT_ADD(tms9928a)
1055   MCFG_SCREEN_MODIFY(SCREEN_TAG)
1056   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
1057   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
1047   MCFG_TMS9928A_ADD( TMS9918A_TAG, TMS9918A, sg1000_tms9918a_interface )
1048   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
1049   MCFG_SCREEN_UPDATE( sg1000 )
10581050
10591051   /* sound hardware */
10601052   MCFG_SPEAKER_STANDARD_MONO("mono")
r12394r12395
11031095   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3) // LH0080A
11041096   MCFG_CPU_PROGRAM_MAP(sc3000_map)
11051097   MCFG_CPU_IO_MAP(sc3000_io_map)
1106   MCFG_CPU_VBLANK_INT(SCREEN_TAG, sg1000_int)
11071098
11081099    /* video hardware */
1109   MCFG_FRAGMENT_ADD(tms9928a)
1110   MCFG_SCREEN_MODIFY(SCREEN_TAG)
1111   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
1112   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
1100   MCFG_TMS9928A_ADD( TMS9918A_TAG, TMS9918A, sg1000_tms9918a_interface )
1101   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
1102   MCFG_SCREEN_UPDATE( sg1000 )
11131103
11141104   /* sound hardware */
11151105   MCFG_SPEAKER_STANDARD_MONO("mono")
r12394r12395
11441134   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_10_738635MHz/3)
11451135   MCFG_CPU_PROGRAM_MAP(sf7000_map)
11461136   MCFG_CPU_IO_MAP(sf7000_io_map)
1147   MCFG_CPU_VBLANK_INT(SCREEN_TAG, sg1000_int)
11481137
11491138    /* video hardware */
1150   MCFG_FRAGMENT_ADD(tms9928a)
1151   MCFG_SCREEN_MODIFY(SCREEN_TAG)
1152   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
1153   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
1139   MCFG_TMS9928A_ADD( TMS9918A_TAG, TMS9918A, sg1000_tms9918a_interface )
1140   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
1141   MCFG_SCREEN_UPDATE( sg1000 )
11541142
11551143   /* sound hardware */
11561144   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/crvision.c
r12394r12395
164164static ADDRESS_MAP_START( crvision_map, AS_PROGRAM, 8, crvision_state )
165165   AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM
166166   AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write)
167   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_READ_LEGACY(TMS9928A_vram_r)
168   AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_READ_LEGACY(TMS9928A_register_r)
169   AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_WRITE_LEGACY(TMS9928A_vram_w)
170   AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_WRITE_LEGACY(TMS9928A_register_w)
167   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD("tms9928a", tms9928a_device, vram_read)
168   AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_DEVREAD("tms9928a", tms9928a_device, register_read)
169   AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_DEVWRITE("tms9928a", tms9928a_device, vram_write)
170   AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_DEVWRITE("tms9928a", tms9928a_device, register_write)
171171   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(BANK_ROM2)
172172   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(BANK_ROM1)
173173//  AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK(3)
r12394r12395
184184static ADDRESS_MAP_START( lasr2001_map, AS_PROGRAM, 8, laser2001_state )
185185   AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM
186186   AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_device, read, write)
187   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_READ_LEGACY(TMS9928A_vram_r)
188   AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_READ_LEGACY(TMS9928A_register_r)
189   AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_WRITE_LEGACY(TMS9928A_vram_w)
190   AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_WRITE_LEGACY(TMS9928A_register_w)
187   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_DEVREAD("tms9928a", tms9928a_device, vram_read)
188   AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_DEVREAD("tms9928a", tms9928a_device, register_read)
189   AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x0ffe) AM_DEVWRITE("tms9928a", tms9928a_device, vram_write)
190   AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_DEVWRITE("tms9928a", tms9928a_device, register_write)
191191   AM_RANGE(0x4000, 0x7fff) AM_RAMBANK(BANK_ROM2)
192192   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(BANK_ROM1)
193193   AM_RANGE(0xc000, 0xffff) AM_ROM AM_REGION(M6502_TAG, 0)
r12394r12395
499499    TMS9928a_interface tms9918_intf
500500-------------------------------------------------*/
501501
502static INTERRUPT_GEN( crvision_int )
502static WRITE_LINE_DEVICE_HANDLER(crvision_vdp_interrupt)
503503{
504   TMS9928A_interrupt(device->machine());
504   cputag_set_input_line(device->machine(), M6502_TAG, INPUT_LINE_IRQ0, state);
505505}
506506
507static void crvision_vdp_interrupt(running_machine &machine, int state)
507static TMS9928A_INTERFACE(crvision_tms9928a_interface)
508508{
509   cputag_set_input_line(machine, M6502_TAG, INPUT_LINE_IRQ0, state);
510}
511
512static const TMS9928a_interface tms9918_intf =
513{
514   TMS99x8,
509   "screen",
515510   0x4000,
516   0, 0,
517   crvision_vdp_interrupt
511   DEVCB_LINE(crvision_vdp_interrupt)
518512};
519513
520/*-------------------------------------------------
521    TMS9928a_interface tms9929_intf
522-------------------------------------------------*/
523
524static const TMS9928a_interface tms9929_intf =
514static SCREEN_UPDATE( crvision )
525515{
526   TMS9929,
527   0x4000,
528   0, 0,
529   crvision_vdp_interrupt
530};
516   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
531517
532/*-------------------------------------------------
533    TMS9928a_interface tms9929a_intf
534-------------------------------------------------*/
518   tms9928a->update( bitmap, cliprect );
519   return 0;
520}
535521
536static const TMS9928a_interface tms9929a_intf =
537{
538   TMS9929A,
539   0x4000,
540   0, 0,
541   crvision_vdp_interrupt
542};
543
544522/*-------------------------------------------------
545523    pia6821_interface pia_intf
546524-------------------------------------------------*/
r12394r12395
851829
852830void crvision_state::machine_start()
853831{
854   // this totally needs to be a device
855   TMS9928A_configure(&tms9918_intf);
856
857832   // state saving
858833   save_item(NAME(m_keylatch));
859834}
860835
861836void crvision_pal_state::machine_start()
862837{
863   // this totally needs to be a device
864   TMS9928A_configure(&tms9929_intf);
865
866838   // state saving
867839   save_item(NAME(m_keylatch));
868840}
r12394r12395
873845
874846void laser2001_state::machine_start()
875847{
876   // this totally needs to be a device
877   TMS9928A_configure(&tms9929a_intf);
878
879848   // state saving
880849   save_item(NAME(m_keylatch));
881850}
r12394r12395
1005974   // basic machine hardware
1006975   MCFG_CPU_ADD(M6502_TAG, M6502, XTAL_2MHz)
1007976   MCFG_CPU_PROGRAM_MAP(crvision_map)
1008   MCFG_CPU_VBLANK_INT(SCREEN_TAG, crvision_int)
1009977
1010978   // devices
1011979   MCFG_PIA6821_ADD(PIA6821_TAG, pia_intf)
r12394r12395
10421010
10431011static MACHINE_CONFIG_DERIVED( ntsc, creativision )
10441012    // video hardware
1045   MCFG_FRAGMENT_ADD(tms9928a)
1046   MCFG_SCREEN_MODIFY(SCREEN_TAG)
1047   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
1048   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // inaccurate
1013   MCFG_TMS9928A_ADD( "tms9928a", TMS9918, crvision_tms9928a_interface )
1014   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
1015   MCFG_SCREEN_UPDATE( crvision )
10491016MACHINE_CONFIG_END
10501017
10511018/*-------------------------------------------------
r12394r12395
10541021
10551022static MACHINE_CONFIG_DERIVED_CLASS( pal, creativision, crvision_pal_state )
10561023   // video hardware
1057   MCFG_FRAGMENT_ADD(tms9928a)
1058   MCFG_SCREEN_MODIFY(SCREEN_TAG)
1059   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/313)
1060   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // inaccurate
1024   MCFG_TMS9928A_ADD( "tms9928a", TMS9929, crvision_tms9928a_interface )
1025   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
1026   MCFG_SCREEN_UPDATE( crvision )
10611027MACHINE_CONFIG_END
10621028
10631029/*-------------------------------------------------
r12394r12395
10681034   // basic machine hardware
10691035   MCFG_CPU_ADD(M6502_TAG, M6502, 17734470/9)
10701036   MCFG_CPU_PROGRAM_MAP(lasr2001_map)
1071   MCFG_CPU_VBLANK_INT(SCREEN_TAG, crvision_int)
10721037
10731038   // devices
10741039   MCFG_PIA6821_ADD(PIA6821_TAG, lasr2001_pia_intf)
r12394r12395
10771042   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, lasr2001_centronics_intf)
10781043
10791044   // video hardware
1080   MCFG_FRAGMENT_ADD(tms9928a)
1081   MCFG_SCREEN_MODIFY(SCREEN_TAG)
1082   MCFG_SCREEN_REFRESH_RATE((float)10738000/2/342/313)
1083   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // inaccurate
1045   MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, crvision_tms9928a_interface )
1046   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
1047   MCFG_SCREEN_UPDATE( crvision )
10841048
10851049   // sound hardware
10861050   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/einstein.c
r12394r12395
401401    MACHINE EMULATION
402402***************************************************************************/
403403
404static const TMS9928a_interface tms9928a_interface =
404static TMS9928A_INTERFACE(einstein_tms9929a_interface)
405405{
406   TMS9929A,
406   "screen",
407407   0x4000, /* 16k RAM, provided by IC i040 and i041 */
408   0, 0,
409   NULL
408   DEVCB_NULL
410409};
411410
411static SCREEN_UPDATE( einstein )
412{
413   tms9929a_device *tms9929a = screen->machine().device<tms9929a_device>( "tms9929a" );
414
415   tms9929a->update( bitmap, cliprect );
416   return 0;
417}
418
412419static MACHINE_START( einstein )
413420{
414   TMS9928A_configure(&tms9928a_interface);
415421}
416422
417423static MACHINE_RESET( einstein )
r12394r12395
430436   einstein->m_rom_enabled = 1;
431437   einstein_page_rom(machine);
432438
433   TMS9928A_reset();
434
435439   /* a reset causes the fire int, adc int, keyboard int mask
436440    to be set to 1, which causes all these to be DISABLED */
437441   einstein->m_interrupt = 0;
r12394r12395
485489   einstein_state *einstein = screen->machine().driver_data<einstein_state>();
486490
487491   if (screen == einstein->m_color_screen)
488      SCREEN_UPDATE_CALL(tms9928a);
492      SCREEN_UPDATE_CALL(einstein);
489493   else if (screen == einstein->m_crtc_screen)
490494      einstein->m_mc6845->update( bitmap, cliprect);
491495   else
r12394r12395
510514   AM_RANGE(0x02, 0x02) AM_MIRROR(0xff04) AM_DEVREADWRITE(IC_I030, ay8910_r, ay8910_address_w)
511515   AM_RANGE(0x03, 0x03) AM_MIRROR(0xff04) AM_DEVWRITE(IC_I030, ay8910_data_w)
512516   /* block 1, tms9928a vdp */
513   AM_RANGE(0x08, 0x08) AM_MIRROR(0xff06) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
514   AM_RANGE(0x09, 0x09) AM_MIRROR(0xff06) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
517   AM_RANGE(0x08, 0x08) AM_MIRROR(0xff06) AM_DEVREADWRITE_MODERN("tms9929a", tms9929a_device, vram_read, vram_write)
518   AM_RANGE(0x09, 0x09) AM_MIRROR(0xff06) AM_DEVREADWRITE_MODERN("tms9929a", tms9929a_device, register_read, register_write)
515519   /* block 2, msm8251 uart */
516520   AM_RANGE(0x10, 0x10) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, msm8251_data_r, msm8251_data_w)
517521   AM_RANGE(0x11, 0x11) AM_MIRROR(0xff06) AM_DEVREADWRITE(IC_I060, msm8251_status_r, msm8251_control_w)
r12394r12395
801805   MCFG_DEVICE_ADD("fire_daisy", EINSTEIN_FIRE_DAISY, 0)
802806
803807   /* video hardware */
804   MCFG_FRAGMENT_ADD(tms9928a)
805   MCFG_SCREEN_MODIFY("screen")
806   MCFG_SCREEN_REFRESH_RATE(50)
807   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
808   MCFG_TMS9928A_ADD( "tms9929a", TMS9929A, einstein_tms9929a_interface )
809   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
810   MCFG_SCREEN_UPDATE( einstein )
808811
809812   /* sound hardware */
810813   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/tutor.c
r12394r12395
215215}
216216
217217
218static const TMS9928a_interface tms9929a_interface =
218static TMS9928A_INTERFACE(tutor_tms9928a_interface)
219219{
220   TMS9929A,
220   "screen",
221221   0x4000,
222   0, 0,
223   /*tms9901_set_int2*/NULL
222   DEVCB_NULL
224223};
225224
225static SCREEN_UPDATE( tutor )
226{
227   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
228
229   tms9928a->update( bitmap, cliprect );
230   return 0;
231}
232
226233static MACHINE_START(tutor)
227234{
228   TMS9928A_configure(&tms9929a_interface);
229235}
230236
231237static MACHINE_RESET(tutor)
r12394r12395
239245   state->m_printer_strobe = 0;
240246}
241247
242static INTERRUPT_GEN( tutor_vblank_interrupt )
243{
244   /* No vblank interrupt? */
245   TMS9928A_interrupt(device->machine());
246}
247
248248/*
249249    Keyboard:
250250
r12394r12395
534534   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_WRITENOP /*BASIC ROM & cartridge ROM*/
535535   AM_RANGE(0xc000, 0xdfff) AM_NOP   /*free for expansion, or cartridge ROM?*/
536536
537   AM_RANGE(0xe000, 0xe000) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)   /*VDP data*/
538   AM_RANGE(0xe002, 0xe002) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)/*VDP status*/
537   AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE_MODERN("tms9928a", tms9928a_device, vram_read, vram_write)   /*VDP data*/
538   AM_RANGE(0xe002, 0xe002) AM_DEVREADWRITE_MODERN("tms9928a", tms9928a_device, register_read, register_write)/*VDP status*/
539539   AM_RANGE(0xe100, 0xe1ff) AM_READWRITE(tutor_mapper_r, tutor_mapper_w)   /*cartridge mapper*/
540540   AM_RANGE(0xe200, 0xe200) AM_DEVWRITE("sn76489a", sn76496_w)   /*sound chip*/
541541   AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE("printer",tutor_printer_r, tutor_printer_w)   /*printer*/
r12394r12395
691691   MCFG_CPU_CONFIG(tutor_processor_config)
692692   MCFG_CPU_PROGRAM_MAP(tutor_memmap)
693693   MCFG_CPU_IO_MAP(tutor_io)
694   MCFG_CPU_VBLANK_INT("screen", tutor_vblank_interrupt)
695694
696695   MCFG_MACHINE_START( tutor )
697696   MCFG_MACHINE_RESET( tutor )
698697
699698   /* video hardware */
700   MCFG_FRAGMENT_ADD(tms9928a)
701   MCFG_SCREEN_MODIFY("screen")
702   MCFG_SCREEN_REFRESH_RATE(60)
703   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
699   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, tutor_tms9928a_interface )
700   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
701   MCFG_SCREEN_UPDATE( tutor )
704702
705703   /* sound */
706704   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/svi318.c
r12394r12395
4545   ADDRESS_MAP_UNMAP_HIGH
4646   ADDRESS_MAP_GLOBAL_MASK(0xff)
4747   AM_RANGE( 0x00, 0x38) AM_READWRITE( svi318_io_ext_r, svi318_io_ext_w )
48   AM_RANGE( 0x80, 0x80) AM_WRITE( TMS9928A_vram_w )
49   AM_RANGE( 0x81, 0x81) AM_WRITE( TMS9928A_register_w )
50   AM_RANGE( 0x84, 0x84) AM_READ( TMS9928A_vram_r )
51   AM_RANGE( 0x85, 0x85) AM_READ( TMS9928A_register_r )
48   AM_RANGE( 0x80, 0x80) AM_DEVWRITE_MODERN( "tms9928a", tms9928a_device, vram_write )
49   AM_RANGE( 0x81, 0x81) AM_DEVWRITE_MODERN( "tms9928a", tms9928a_device, register_write )
50   AM_RANGE( 0x84, 0x84) AM_DEVREAD_MODERN( "tms9928a", tms9928a_device, vram_read )
51   AM_RANGE( 0x85, 0x85) AM_DEVREAD_MODERN( "tms9928a", tms9928a_device, register_read )
5252   AM_RANGE( 0x88, 0x88) AM_DEVWRITE("ay8910", ay8910_address_w )
5353   AM_RANGE( 0x8c, 0x8c) AM_DEVWRITE("ay8910", ay8910_data_w )
5454   AM_RANGE( 0x90, 0x90) AM_DEVREAD("ay8910", ay8910_r )
r12394r12395
6060   ADDRESS_MAP_UNMAP_HIGH
6161   ADDRESS_MAP_GLOBAL_MASK(0xff)
6262   AM_RANGE( 0x00, 0x58) AM_READWRITE( svi318_io_ext_r, svi318_io_ext_w )
63   AM_RANGE( 0x80, 0x80) AM_WRITE( TMS9928A_vram_w )
64   AM_RANGE( 0x81, 0x81) AM_WRITE( TMS9928A_register_w )
65   AM_RANGE( 0x84, 0x84) AM_READ( TMS9928A_vram_r )
66   AM_RANGE( 0x85, 0x85) AM_READ( TMS9928A_register_r )
63   AM_RANGE( 0x80, 0x80) AM_DEVWRITE_MODERN( "tms9928a", tms9928a_device, vram_write )
64   AM_RANGE( 0x81, 0x81) AM_DEVWRITE_MODERN( "tms9928a", tms9928a_device, register_write )
65   AM_RANGE( 0x84, 0x84) AM_DEVREAD_MODERN( "tms9928a", tms9928a_device, vram_read )
66   AM_RANGE( 0x85, 0x85) AM_DEVREAD_MODERN( "tms9928a", tms9928a_device, register_read )
6767   AM_RANGE( 0x88, 0x88) AM_DEVWRITE("ay8910", ay8910_address_w )
6868   AM_RANGE( 0x8c, 0x8c) AM_DEVWRITE("ay8910", ay8910_data_w )
6969   AM_RANGE( 0x90, 0x90) AM_DEVREAD("ay8910", ay8910_r )
r12394r12395
265265   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, svi318_psg_port_b_w)
266266};
267267
268static WRITE_LINE_DEVICE_HANDLER(vdp_interrupt)
269{
270    cputag_set_input_line(device->machine(), "maincpu", 0, (state ? HOLD_LINE : CLEAR_LINE));
271}
272
273static TMS9928A_INTERFACE(svi318_tms9928a_interface)
274{
275   "screen",
276    0x4000,
277    DEVCB_LINE(vdp_interrupt)
278};
279
280static SCREEN_UPDATE( svi318 )
281{
282   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
283
284   tms9928a->update( bitmap, cliprect );
285   return 0;
286}
287
268288static const cassette_interface svi318_cassette_interface =
269289{
270290   svi_cassette_formats,
r12394r12395
305325   MCFG_CPU_ADD( "maincpu", Z80, 3579545 )   /* 3.579545 MHz */
306326   MCFG_CPU_PROGRAM_MAP( svi318_mem)
307327   MCFG_CPU_IO_MAP( svi318_io)
308   MCFG_CPU_VBLANK_INT("screen", svi318_interrupt)
309328   MCFG_QUANTUM_TIME(attotime::from_hz(60))
310329
311330   MCFG_MACHINE_START( svi318_pal )
r12394r12395
317336   MCFG_INS8250_ADD( "ins8250_1", svi318_ins8250_interface[1] )
318337
319338   /* Video hardware */
320   MCFG_FRAGMENT_ADD(tms9928a)
321   MCFG_SCREEN_MODIFY("screen")
322   MCFG_SCREEN_REFRESH_RATE(50)
323   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
339   MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, svi318_tms9928a_interface )
340   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
341   MCFG_SCREEN_UPDATE( svi318 )
324342
325343   /* Sound hardware */
326344   MCFG_SPEAKER_STANDARD_MONO("mono")
r12394r12395
355373
356374static MACHINE_CONFIG_DERIVED( svi318n, svi318 )
357375
358   MCFG_SCREEN_MODIFY("screen")
359   MCFG_SCREEN_REFRESH_RATE(60)
376   MCFG_DEVICE_REMOVE("tms9928a")
377   MCFG_DEVICE_REMOVE("screen")
378   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, svi318_tms9928a_interface )
379   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
380   MCFG_SCREEN_UPDATE( svi318 )
360381
361382   MCFG_MACHINE_START( svi318_ntsc )
362383   MCFG_MACHINE_RESET( svi318 )
r12394r12395
415436   MCFG_CPU_ADD( "maincpu", Z80, 3579545 )   /* 3.579545 MHz */
416437   MCFG_CPU_PROGRAM_MAP( svi328_806_mem)
417438   MCFG_CPU_IO_MAP( svi328_806_io)
418   MCFG_CPU_VBLANK_INT("screen", svi318_interrupt)
419439   MCFG_QUANTUM_TIME(attotime::from_hz(60))
420440
421441   MCFG_MACHINE_START( svi318_pal )
r12394r12395
429449   /* Video hardware */
430450   MCFG_DEFAULT_LAYOUT( layout_dualhsxs )
431451
432   MCFG_FRAGMENT_ADD(tms9928a)
433   MCFG_SCREEN_MODIFY("screen")
452   MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, svi318_tms9928a_interface )
453   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
454   MCFG_SCREEN_UPDATE( svi318 )
434455   MCFG_PALETTE_LENGTH(TMS9928A_PALETTE_SIZE + 2)   /* 2 additional entries for monochrome svi806 output */
435   MCFG_SCREEN_REFRESH_RATE(50)
436   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
437456
438457   MCFG_SCREEN_ADD("svi806", RASTER)
439458   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mess/drivers/m5.c
r12394r12395
254254   ADDRESS_MAP_UNMAP_HIGH
255255   ADDRESS_MAP_GLOBAL_MASK(0xff)
256256   AM_RANGE(0x00, 0x03) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY(Z80CTC_TAG, z80ctc_r, z80ctc_w)
257   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
258   AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
257   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write)
258   AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)
259259   AM_RANGE(0x20, 0x20) AM_MIRROR(0x0f) AM_DEVWRITE_LEGACY(SN76489AN_TAG, sn76496_w)
260260   AM_RANGE(0x30, 0x30) AM_READ_PORT("Y0") // 64KBF bank select
261261   AM_RANGE(0x31, 0x31) AM_READ_PORT("Y1")
r12394r12395
434434//  TMS9928a_interface vdp_intf
435435//-------------------------------------------------
436436
437static void sordm5_video_interrupt_callback(running_machine &machine, int state)
437static WRITE_LINE_DEVICE_HANDLER(sordm5_video_interrupt_callback)
438438{
439   m5_state *driver_state = machine.driver_data<m5_state>();
439   m5_state *driver_state = device->machine().driver_data<m5_state>();
440440
441441   if (state)
442442   {
r12394r12395
445445   }
446446}
447447
448static INTERRUPT_GEN( sord_interrupt )
448static TMS9928A_INTERFACE(m5_tms9928a_interface)
449449{
450   TMS9928A_interrupt(device->machine());
451}
452
453static const TMS9928a_interface ntsc_vdp_intf =
454{
455   TMS99x8A,
450   "screen",
456451   0x4000,
457   0, 0,
458   sordm5_video_interrupt_callback
452   DEVCB_LINE(sordm5_video_interrupt_callback)
459453};
460454
461static const TMS9928a_interface pal_vdp_intf =
455static SCREEN_UPDATE( m5 )
462456{
463   TMS9929A,
464   0x4000,
465   0, 0,
466   sordm5_video_interrupt_callback
467};
457   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
468458
459   tms9928a->update( bitmap, cliprect );
460   return 0;
461}
462
469463//-------------------------------------------------
470464//  I8255_INTERFACE( ppi_intf )
471465//-------------------------------------------------
r12394r12395
624618{
625619   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
626620
627   // configure VDP
628   TMS9928A_configure(m_vdp_intf);
629
630621   // configure RAM
631622   switch (ram_get_size(m_ram))
632623   {
r12394r12395
656647
657648void m5_state::machine_reset()
658649{
659   TMS9928A_reset();
660650}
661651
662652
r12394r12395
674664   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_14_31818MHz/4)
675665   MCFG_CPU_PROGRAM_MAP(m5_mem)
676666   MCFG_CPU_IO_MAP(m5_io)
677   MCFG_CPU_VBLANK_INT(SCREEN_TAG, sord_interrupt)
678667   MCFG_CPU_CONFIG(m5_daisy_chain)
679668
680669   MCFG_CPU_ADD(Z80_FD5_TAG, Z80, XTAL_14_31818MHz/4)
r12394r12395
716705
717706static MACHINE_CONFIG_DERIVED( ntsc, m5 )
718707   // video hardware
719   MCFG_FRAGMENT_ADD(tms9928a)
720   MCFG_SCREEN_MODIFY(SCREEN_TAG)
721   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
722   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate
708   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, m5_tms9928a_interface )
709   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
710   MCFG_SCREEN_UPDATE( m5 )
723711MACHINE_CONFIG_END
724712
725713
r12394r12395
729717
730718static MACHINE_CONFIG_DERIVED( pal, m5 )
731719   // video hardware
732   MCFG_FRAGMENT_ADD(tms9928a)
733   MCFG_SCREEN_MODIFY(SCREEN_TAG)
734   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/313)
735   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not accurate
720   MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, m5_tms9928a_interface )
721   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
722   MCFG_SCREEN_UPDATE( m5 )
736723MACHINE_CONFIG_END
737724
738725
r12394r12395
780767
781768static DRIVER_INIT( ntsc )
782769{
783   m5_state *state = machine.driver_data<m5_state>();
784
785   state->m_vdp_intf = &ntsc_vdp_intf;
786770}
787771
788772
r12394r12395
792776
793777static DRIVER_INIT( pal )
794778{
795   m5_state *state = machine.driver_data<m5_state>();
796
797   state->m_vdp_intf = &pal_vdp_intf;
798779}
799780
800781
src/mess/drivers/msx.c
r12394r12395
331331   AM_RANGE( 0x91, 0x91) AM_DEVWRITE("centronics", msx_printer_data_w)
332332   AM_RANGE( 0xa0, 0xa7) AM_DEVREADWRITE("ay8910", ay8910_r, msx_ay8910_w )
333333   AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE_MODERN("ppi8255", i8255_device, read, write)
334   AM_RANGE( 0x98, 0x98) AM_READWRITE( TMS9928A_vram_r, TMS9928A_vram_w )
335   AM_RANGE( 0x99, 0x99) AM_READWRITE( TMS9928A_register_r, TMS9928A_register_w )
334   AM_RANGE( 0x98, 0x98) AM_DEVREADWRITE_MODERN("tms9928a", tms9928a_device, vram_read, vram_write)
335   AM_RANGE( 0x99, 0x99) AM_DEVREADWRITE_MODERN("tms9928a", tms9928a_device, register_read, register_write)
336336   AM_RANGE( 0xd8, 0xd9) AM_READWRITE( msx_kanji_r, msx_kanji_w )
337337ADDRESS_MAP_END
338338
r12394r12395
10511051   MCFG_CPU_ADD("maincpu", Z80, 3579545)        /* 3.579545 MHz */
10521052   MCFG_CPU_PROGRAM_MAP(msx_memory_map)
10531053   MCFG_CPU_IO_MAP(msx_io_map)
1054   MCFG_CPU_VBLANK_INT("screen", msx_interrupt)
1054   MCFG_CPU_VBLANK_INT("screen", msx_interrupt)   /* Needed for mouse updates */
10551055   MCFG_QUANTUM_TIME(attotime::from_hz(60))
10561056
10571057   MCFG_MACHINE_START( msx )
r12394r12395
10591059
10601060   MCFG_I8255_ADD( "ppi8255", msx_ppi8255_interface )
10611061
1062   /* video hardware */
1063   MCFG_FRAGMENT_ADD(tms9928a)
1064   MCFG_SCREEN_MODIFY("screen")
1065   MCFG_SCREEN_REFRESH_RATE(60)
1066   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
1067   MCFG_SCREEN_SIZE(MSX_TOTAL_XRES_PIXELS, MSX_TOTAL_YRES_PIXELS)
1068   MCFG_SCREEN_VISIBLE_AREA(MSX_XBORDER_PIXELS - MSX_VISIBLE_XBORDER_PIXELS, MSX_TOTAL_XRES_PIXELS - MSX_XBORDER_PIXELS + MSX_VISIBLE_XBORDER_PIXELS - 1, MSX_YBORDER_PIXELS - MSX_VISIBLE_YBORDER_PIXELS, MSX_TOTAL_YRES_PIXELS - MSX_YBORDER_PIXELS + MSX_VISIBLE_YBORDER_PIXELS - 1)
1069
10701062   /* sound hardware */
10711063   MCFG_SPEAKER_STANDARD_MONO("mono")
10721064   MCFG_SOUND_ADD("dac", DAC, 0)
r12394r12395
10941086MACHINE_CONFIG_END
10951087
10961088
1089static WRITE_LINE_DEVICE_HANDLER(tms9928a_interrupt)
1090{
1091   cputag_set_input_line(device->machine(), "maincpu", 0, (state ? HOLD_LINE : CLEAR_LINE));
1092}
1093
1094
1095static SCREEN_UPDATE( msx )
1096{
1097   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
1098
1099   tms9928a->update( bitmap, cliprect );
1100   return 0;
1101}
1102
1103
1104static TMS9928A_INTERFACE(msx_tms9928a_interface)
1105{
1106   "screen",
1107   0x4000,
1108   DEVCB_LINE(tms9928a_interrupt)
1109};
1110
1111
1112static MACHINE_CONFIG_DERIVED( msx_ntsc, msx )
1113   /* Video hardware */
1114   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, msx_tms9928a_interface )
1115   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
1116   MCFG_SCREEN_UPDATE( msx )
1117MACHINE_CONFIG_END
1118
1119
10971120static MACHINE_CONFIG_DERIVED( msx_pal, msx )
1098   MCFG_SCREEN_MODIFY("screen")
1099   MCFG_SCREEN_REFRESH_RATE(50)
1121   /* Video hardware */
1122   MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, msx_tms9928a_interface )
1123   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
1124   MCFG_SCREEN_UPDATE( msx )
11001125MACHINE_CONFIG_END
11011126
1127
11021128#define MSX2_XBORDER_PIXELS      16
11031129#define MSX2_YBORDER_PIXELS      28
11041130#define MSX2_TOTAL_XRES_PIXELS      256 * 2 + (MSX2_XBORDER_PIXELS * 2)
r12394r12395
38123838COMP(1983, ax170,   msx,   0,   msx_pal,  msx,      msx,     "Al Alamiah", "AX-170" , 0)
38133839COMP(1983, canonv10,  msx,   0,   msx_pal,  msx,      msx,     "Canon", "V-10" , 0)
38143840COMP(1983, canonv20,  msx,   0,   msx_pal,  msx,      msx,     "Canon", "V-20" , 0)
3815COMP(1984, dpc100,   msx,   0,   msx,     msxkr,    msx,     "Daewoo", "IQ-1000 DPC-100 (Korea)" , 0)
3816COMP(1984, dpc180,   msx,   0,   msx,     msxkr,    msx,     "Daewoo", "IQ-1000 DPC-180 (Korea)" , 0)
3817COMP(1984, dpc200,   msx,   0,   msx,     msxkr,    msx,     "Daewoo", "IQ-1000 DPC-200 (Korea)" , 0)
3841COMP(1984, dpc100,   msx,   0,   msx_ntsc, msxkr,    msx,     "Daewoo", "IQ-1000 DPC-100 (Korea)" , 0)
3842COMP(1984, dpc180,   msx,   0,   msx_ntsc, msxkr,    msx,     "Daewoo", "IQ-1000 DPC-180 (Korea)" , 0)
3843COMP(1984, dpc200,   msx,   0,   msx_ntsc, msxkr,    msx,     "Daewoo", "IQ-1000 DPC-200 (Korea)" , 0)
38183844COMP(1983, gsfc200,   msx,   0,   msx_pal,  msx,      msx,     "Goldstar", "FC-200" , 0)
3819COMP(1983, expert10, msx,   0,   msx,     expert10, msx,     "Gradiente", "Expert 1.0 (Brazil)" , 0)
3820COMP(1984, expert11, msx,   0,   msx,     expert11, msx,     "Gradiente", "Expert 1.1 (Brazil)" , 0)
3821COMP(1984, expert13, msx,   0,   msx,     expert11, msx,     "Gradiente", "Expert 1.3 (Brazil)" , 0)
3822COMP(1985, expertdp, msx,   0,   msx,     expert11, msx,     "Gradiente", "Expert DDPlus (Brazil)", 0 )
3823COMP(1984, expertpl, msx,   0,   msx,     expert11, msx,     "Gradiente", "Expert Plus (Brazil)" , 0)
3845COMP(1983, expert10, msx,   0,   msx_ntsc, expert10, msx,     "Gradiente", "Expert 1.0 (Brazil)" , 0)
3846COMP(1984, expert11, msx,   0,   msx_ntsc, expert11, msx,     "Gradiente", "Expert 1.1 (Brazil)" , 0)
3847COMP(1984, expert13, msx,   0,   msx_ntsc, expert11, msx,     "Gradiente", "Expert 1.3 (Brazil)" , 0)
3848COMP(1985, expertdp, msx,   0,   msx_ntsc, expert11, msx,     "Gradiente", "Expert DDPlus (Brazil)", 0 )
3849COMP(1984, expertpl, msx,   0,   msx_ntsc, expert11, msx,     "Gradiente", "Expert Plus (Brazil)" , 0)
38243850COMP(1983, jvchc7gb,  msx,   0,   msx_pal,  msx,      msx,     "JVC", "HC-7GB" , 0)
38253851COMP(1983, mlf80,     msx,   0,   msx_pal,  msx,      msx,     "Mitsubishi", "ML-F80" , 0)
38263852COMP(1983, mlfx1,     msx,   0,   msx_pal,  msx,      msx,     "Mitsubishi", "ML-FX1" , 0)
3827COMP(1984, cf1200,   msx,   0,  msx,      msxjp,    msx,     "National / Matsushita", "CF-1200 (Japan)" , 0)
3828COMP(1983, cf2000,   msx,   0,  msx,      msxjp,    msx,     "National / Matsushita", "CF-2000 (Japan)" , 0)
3829COMP(1984, cf2700,   msx,   0,  msx,      msxjp,    msx,     "National / Matsushita", "CF-2700 (Japan)" , 0)
3830COMP(1984, cf3000,   msx,   0,  msx,      msxjp,    msx,     "National / Matsushita", "CF-3000 (Japan)" , 0)
3831COMP(1985, cf3300,   msx,   0,  msx,      msxjp,    msx,     "National / Matsushita", "CF-3300 (Japan)", 0 )
3832COMP(1985, fs1300,   msx,   0,  msx,      msxjp,    msx,     "National / Matsushita", "FS-1300 (Japan)" , 0)
3833COMP(1985, fs4000,   msx,   0,  msx,      msxjp,    msx,     "National / Matsushita", "FS-4000 (Japan)" , 0)
3853COMP(1984, cf1200,   msx,   0,  msx_ntsc, msxjp,    msx,     "National / Matsushita", "CF-1200 (Japan)" , 0)
3854COMP(1983, cf2000,   msx,   0,  msx_ntsc, msxjp,    msx,     "National / Matsushita", "CF-2000 (Japan)" , 0)
3855COMP(1984, cf2700,   msx,   0,  msx_ntsc, msxjp,    msx,     "National / Matsushita", "CF-2700 (Japan)" , 0)
3856COMP(1984, cf3000,   msx,   0,  msx_ntsc, msxjp,    msx,     "National / Matsushita", "CF-3000 (Japan)" , 0)
3857COMP(1985, cf3300,   msx,   0,  msx_ntsc, msxjp,    msx,     "National / Matsushita", "CF-3300 (Japan)", 0 )
3858COMP(1985, fs1300,   msx,   0,  msx_ntsc, msxjp,    msx,     "National / Matsushita", "FS-1300 (Japan)" , 0)
3859COMP(1985, fs4000,   msx,   0,  msx_ntsc, msxjp,    msx,     "National / Matsushita", "FS-4000 (Japan)" , 0)
38343860COMP(1983, nms801,     msx,   0,   msx_pal,  msx,      msx,     "Philips", "NMS-801" , 0)
3835COMP(1984, vg8000,  msx,   0,   msx,     msx,      msx,     "Philips",    "VG-8000" , GAME_NOT_WORKING)
3836COMP(1984, vg8010,  msx,   0,   msx,     msx,      msx,     "Philips",    "VG-8010" , GAME_NOT_WORKING)
3837COMP(1984, vg8010f,  msx,   0,   msx,     msx,      msx,     "Philips",    "VG-8010F" , GAME_NOT_WORKING)
3838COMP(1985, vg802000,  msx,   0,   msx,     msx,      msx,     "Philips",    "VG-8020-00" , 0)
3839COMP(1985, vg802020, msx,   0,   msx,     msx,      msx,     "Philips",    "VG-8020-20" , 0)
3861COMP(1984, vg8000,  msx,   0,   msx_ntsc, msx,      msx,     "Philips",    "VG-8000" , GAME_NOT_WORKING)
3862COMP(1984, vg8010,  msx,   0,   msx_ntsc, msx,      msx,     "Philips",    "VG-8010" , GAME_NOT_WORKING)
3863COMP(1984, vg8010f,  msx,   0,   msx_ntsc, msx,      msx,     "Philips",    "VG-8010F" , GAME_NOT_WORKING)
3864COMP(1985, vg802000,  msx,   0,   msx_ntsc, msx,      msx,     "Philips",    "VG-8020-00" , 0)
3865COMP(1985, vg802020, msx,   0,   msx_ntsc, msx,      msx,     "Philips",    "VG-8020-20" , 0)
38403866COMP(1985, piopx7,     msx,   0,   msx_pal,  msx,      msx,     "Pioneer",    "PX-07" , 0)
38413867COMP(1985, mpc100,     msx,   0,   msx_pal,  msx,      msx,     "Sanyo",    "MPC-100" , 0)
3842COMP(1985, hotbit11, msx,   0,   msx,     hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.1" , 0)
3843COMP(1985, hotbit12, msx,   0,   msx,     hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.2" , 0)
3844COMP(1985, hotbi13b, msx,   0,   msx,     hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.3b" , 0)
3845COMP(1985, hotbi13p, msx,   0,   msx,     hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.3p" , 0)
3868COMP(1985, hotbit11, msx,   0,   msx_ntsc, hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.1" , 0)
3869COMP(1985, hotbit12, msx,   0,   msx_ntsc, hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.2" , 0)
3870COMP(1985, hotbi13b, msx,   0,   msx_ntsc, hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.3b" , 0)
3871COMP(1985, hotbi13p, msx,   0,   msx_ntsc, hotbit,   msx,     "Sharp / Epcom",    "HB-8000 Hotbit 1.3p" , 0)
38463872COMP(1985, hb10p,    msx,   0,  msx_pal,  msx,     msx,     "Sony", "HB-10P" , 0)
38473873COMP(1985, hb20p,    msx,   0,  msx_pal,  msx,     msx,     "Sony", "HB-20P (Spanish)" , 0)
3848COMP(1985, hb201,    msx,   0,  msx,      msxjp,    msx,     "Sony", "HB-201 (Japan)" , 0)
3874COMP(1985, hb201,    msx,   0,  msx_ntsc, msxjp,    msx,     "Sony", "HB-201 (Japan)" , 0)
38493875COMP(1985, hb201p,   msx,   0,   msx_pal,  msx,      msx,     "Sony", "HB-201P" , 0)
38503876COMP(1984, hb501p,   msx,   0,   msx_pal,  msx,      msx,     "Sony", "HB-501P" , 0)
38513877COMP(1983, hb55d,    msx,   0,   msx_pal,  msx,      msx,     "Sony", "HB-55D (Germany)" , 0)
src/mess/drivers/coleco.c
r12394r12395
9797static ADDRESS_MAP_START( coleco_io_map, AS_IO, 8, coleco_state )
9898   ADDRESS_MAP_GLOBAL_MASK(0xff)
9999   AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_off_w)
100   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
101   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
100   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write)
101   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)
102102   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(paddle_on_w)
103103   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_DEVWRITE_LEGACY("sn76489a", sn76496_w)
104104   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(paddle_1_r)
r12394r12395
114114static ADDRESS_MAP_START( czz50_io_map, AS_IO, 8, coleco_state )
115115   ADDRESS_MAP_GLOBAL_MASK(0xff)
116116   AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_off_w)
117   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
118   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
117   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write)
118   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)
119119   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(paddle_on_w)
120120   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_DEVWRITE_LEGACY("sn76489a", sn76496_w)
121121   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(paddle_1_r)
r12394r12395
178178
179179***************************************************************************/
180180
181static INTERRUPT_GEN( coleco_interrupt )
181static WRITE_LINE_DEVICE_HANDLER(coleco_vdp_interrupt)
182182{
183    TMS9928A_interrupt(device->machine());
184}
183   coleco_state *drvstate = device->machine().driver_data<coleco_state>();
185184
186static void coleco_vdp_interrupt(running_machine &machine, int state)
187{
188   coleco_state *drvstate = machine.driver_data<coleco_state>();
189
190185    // only if it goes up
191186   if (state && !drvstate->m_last_state)
192187   {
r12394r12395
208203
209204/* Machine Initialization */
210205
211static const TMS9928a_interface tms9928a_interface =
206static TMS9928A_INTERFACE(coleco_tms9928a_interface)
212207{
213   TMS99x8A,
208   "screen",
214209   0x4000,
215   0, 0,
216   coleco_vdp_interrupt
210   DEVCB_LINE(coleco_vdp_interrupt)
217211};
218212
219213void coleco_state::machine_start()
220214{
221   TMS9928A_configure(&tms9928a_interface);
222215}
223216
224217void coleco_state::machine_reset()
r12394r12395
262255   }
263256}
264257
258static SCREEN_UPDATE( coleco )
259{
260   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
261
262   tms9928a->update( bitmap, cliprect );
263   return 0;
264}
265
265266/* Machine Drivers */
266267
267268static MACHINE_CONFIG_START( coleco, coleco_state )
r12394r12395
269270   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_7_15909MHz/2)   // 3.579545 MHz
270271   MCFG_CPU_PROGRAM_MAP(coleco_map)
271272   MCFG_CPU_IO_MAP(coleco_io_map)
272   MCFG_CPU_VBLANK_INT("screen", coleco_interrupt)
273273
274274   // video hardware
275   MCFG_FRAGMENT_ADD(tms9928a)
276   MCFG_SCREEN_MODIFY("screen")
277   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
278   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
275   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, coleco_tms9928a_interface )
276   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
277   MCFG_SCREEN_UPDATE( coleco )
279278
280279   // sound hardware
281280   MCFG_SPEAKER_STANDARD_MONO("mono")
r12394r12395
299298   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_7_15909MHz/2)   // ???
300299   MCFG_CPU_PROGRAM_MAP(czz50_map)
301300   MCFG_CPU_IO_MAP(czz50_io_map)
302   MCFG_CPU_VBLANK_INT("screen", coleco_interrupt)
303301
304302   // video hardware
305   MCFG_FRAGMENT_ADD(tms9928a)
306   MCFG_SCREEN_MODIFY("screen")
307   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
308   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
303   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, coleco_tms9928a_interface )
304   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
305   MCFG_SCREEN_UPDATE( coleco )
309306
310307   // sound hardware
311308   MCFG_SPEAKER_STANDARD_MONO("mono")
r12394r12395
326323MACHINE_CONFIG_END
327324
328325static MACHINE_CONFIG_DERIVED( dina, czz50 )
329   MCFG_SCREEN_MODIFY("screen")
330   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/313)
326   MCFG_DEVICE_REMOVE("tms9928a")
327   MCFG_DEVICE_REMOVE("screen")
328
329   MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, coleco_tms9928a_interface )
330   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
331   MCFG_SCREEN_UPDATE( coleco )
331332MACHINE_CONFIG_END
332333
333334/* ROMs */
src/mess/drivers/mtx.c
r12394r12395
5757static ADDRESS_MAP_START( mtx_io, AS_IO, 8 )
5858   ADDRESS_MAP_GLOBAL_MASK(0xff)
5959   AM_RANGE(0x00, 0x00) AM_DEVREAD(CENTRONICS_TAG, mtx_strobe_r) AM_WRITE(mtx_bankswitch_w)
60   AM_RANGE(0x01, 0x01) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
61   AM_RANGE(0x02, 0x02) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
60   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE_MODERN("tms9929a", tms9929a_device, vram_read, vram_write)
61   AM_RANGE(0x02, 0x02) AM_DEVREADWRITE_MODERN("tms9929a", tms9929a_device, register_read, register_write)
6262   AM_RANGE(0x03, 0x03) AM_DEVREAD(SN76489A_TAG, mtx_sound_strobe_r) AM_DEVWRITE(CASSETTE_TAG, mtx_cst_w)
6363   AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CENTRONICS_TAG, mtx_prt_r, centronics_data_w)
6464   AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w)
r12394r12395
319319   NULL
320320};
321321
322/*-------------------------------------------------
323    mtx_tms9928a_interface
324-------------------------------------------------*/
325
326static WRITE_LINE_DEVICE_HANDLER(mtx_tms9929a_interrupt)
327{
328    mtx_state *drv_state = device->machine().driver_data<mtx_state>();
329
330    z80ctc_trg0_w(drv_state->m_z80ctc, state ? 0 : 1);
331}
332
333static TMS9928A_INTERFACE(mtx_tms9928a_interface)
334{
335   "screen",
336    0x4000,
337    DEVCB_LINE(mtx_tms9929a_interrupt)
338};
339
340static SCREEN_UPDATE( mtx )
341{
342   tms9929a_device *tms9929a = screen->machine().device<tms9929a_device>( "tms9929a" );
343
344   tms9929a->update( bitmap, cliprect );
345   return 0;
346}
347
322348/***************************************************************************
323349    MACHINE DRIVERS
324350***************************************************************************/
r12394r12395
333359   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_4MHz)
334360   MCFG_CPU_PROGRAM_MAP(mtx_mem)
335361   MCFG_CPU_IO_MAP(mtx_io)
336   MCFG_CPU_VBLANK_INT(SCREEN_TAG, mtx_interrupt)
337362   MCFG_CPU_CONFIG(mtx_daisy_chain)
338363
339364   MCFG_MACHINE_START(mtx512)
340365   MCFG_MACHINE_RESET(mtx512)
341366
342367   /* video hardware */
343   MCFG_FRAGMENT_ADD(tms9928a)
344   MCFG_SCREEN_MODIFY(SCREEN_TAG)
345   MCFG_SCREEN_REFRESH_RATE(50)
346   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
368   MCFG_TMS9928A_ADD( "tms9929a", TMS9929A, mtx_tms9928a_interface )
369   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
370   MCFG_SCREEN_UPDATE( mtx )
347371
348372   /* sound hardware */
349373   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/pv2000.c
r12394r12395
171171static ADDRESS_MAP_START( pv2000_map, AS_PROGRAM, 8 )
172172   AM_RANGE(0x0000, 0x3FFF) AM_ROM
173173
174   AM_RANGE(0x4000, 0x4000) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
175   AM_RANGE(0x4001, 0x4001) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
174   AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE_MODERN("tms9928a", tms9928a_device, vram_read, vram_write)
175   AM_RANGE(0x4001, 0x4001) AM_DEVREADWRITE_MODERN("tms9928a", tms9928a_device, register_read, register_write)
176176
177177   AM_RANGE(0x7000, 0x7FFF) AM_RAM
178178  //AM_RANGE(0x8000, 0xBFFF) ext ram?
r12394r12395
304304INPUT_PORTS_END
305305
306306
307static INTERRUPT_GEN( pv2000_interrupt )
307static WRITE_LINE_DEVICE_HANDLER(pv2000_vdp_interrupt)
308308{
309   TMS9928A_interrupt(device->machine());
310}
309   pv2000_state *pv_state = device->machine().driver_data<pv2000_state>();
311310
312static void pv2000_vdp_interrupt(running_machine &machine, int new_state)
313{
314   pv2000_state *state = machine.driver_data<pv2000_state>();
315
316311    // only if it goes up
317   if (new_state && !state->m_last_state)
318      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
312   if (state && !pv_state->m_last_state)
313      cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_NMI, PULSE_LINE);
319314
320   state->m_last_state = new_state;
315   pv_state->m_last_state = state;
321316
322317   /* Check if irq triggering from keyboard presses is enabled */
323   if ( state->m_keyb_column == 0x0f )
318   if ( pv_state->m_keyb_column == 0x0f )
324319   {
325320      /* Check if a key is pressed */
326321      UINT8 key_pressed;
327322
328      key_pressed = input_port_read( machine, "IN0" )
329         | input_port_read( machine, "IN1" )
330         | input_port_read( machine, "IN2" )
331         | input_port_read( machine, "IN3" )
332         | input_port_read( machine, "IN4" )
333         | input_port_read( machine, "IN5" )
334         | input_port_read( machine, "IN6" )
335         | input_port_read( machine, "IN7" )
336         | input_port_read( machine, "IN8" );
323      key_pressed = input_port_read( device->machine(), "IN0" )
324         | input_port_read( device->machine(), "IN1" )
325         | input_port_read( device->machine(), "IN2" )
326         | input_port_read( device->machine(), "IN3" )
327         | input_port_read( device->machine(), "IN4" )
328         | input_port_read( device->machine(), "IN5" )
329         | input_port_read( device->machine(), "IN6" )
330         | input_port_read( device->machine(), "IN7" )
331         | input_port_read( device->machine(), "IN8" );
337332
338      if ( key_pressed && state->m_key_pressed != key_pressed )
339         cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, ASSERT_LINE);
333      if ( key_pressed && pv_state->m_key_pressed != key_pressed )
334         cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_IRQ0, ASSERT_LINE);
340335
341      state->m_key_pressed = key_pressed;
336      pv_state->m_key_pressed = key_pressed;
342337   }
343338}
344339
r12394r12395
346341
347342/* Machine Initialization */
348343
349static const TMS9928a_interface tms9928a_interface =
344static TMS9928A_INTERFACE(pv2000_tms9928a_interface)
350345{
351   TMS99x8A,
346   "screen",
352347   0x4000,
353   0, 0,
354   pv2000_vdp_interrupt
348   DEVCB_LINE(pv2000_vdp_interrupt)
355349};
356350
357351static MACHINE_START( pv2000 )
358352{
359   TMS9928A_configure(&tms9928a_interface);
360353}
361354
362355static MACHINE_RESET( pv2000 )
r12394r12395
411404};
412405
413406
407static SCREEN_UPDATE( pv2000 )
408{
409   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( "tms9928a" );
410
411   tms9928a->update( bitmap, cliprect );
412   return 0;
413}
414
415
414416/* Machine Drivers */
415417static MACHINE_CONFIG_START( pv2000, pv2000_state )
416418
r12394r12395
418420   MCFG_CPU_ADD("maincpu", Z80, XTAL_7_15909MHz/2)   // 3.579545 MHz
419421   MCFG_CPU_PROGRAM_MAP(pv2000_map)
420422   MCFG_CPU_IO_MAP(pv2000_io_map)
421   MCFG_CPU_VBLANK_INT("screen", pv2000_interrupt)
422423
423424   MCFG_MACHINE_START(pv2000)
424425   MCFG_MACHINE_RESET(pv2000)
425426
426427    // video hardware
427   MCFG_FRAGMENT_ADD(tms9928a)
428   MCFG_SCREEN_MODIFY("screen")
429   MCFG_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
430   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
428   MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, pv2000_tms9928a_interface )
429   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
430   MCFG_SCREEN_UPDATE( pv2000 )
431431
432432   // sound hardware
433433   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/ti99_4x.c
r12394r12395
762762   GFXDECODE_ENTRY( region_grom, 0x0998, ti99_c_charlayout, 2, 2 )
763763GFXDECODE_END
764764
765static const TMS9928a_interface tms9918_interface =
765static WRITE_LINE_DEVICE_HANDLER(set_int2)
766766{
767   TMS99x8,
768   0x4000,
769   15, 15,
770   tms9901_set_int2
771};
767   tms9901_set_int2( device->machine(), state );
768}
772769
773static const TMS9928a_interface tms9929_interface =
770static TMS9928A_INTERFACE(ti99_4_tms9928a_interface)
774771{
775   TMS9929,
772   SCREEN_TAG,
776773   0x4000,
777   13, 13,
778   tms9901_set_int2
774   DEVCB_LINE(set_int2)
779775};
780776
781static const TMS9928a_interface tms9918a_interface =
782{
783   TMS99x8A,
784   0x4000,
785   15, 15,
786   tms9901_set_int2
787};
788
789
790static const TMS9928a_interface tms9929a_interface =
791{
792   TMS9929A,
793   0x4000,
794   13, 13,
795   tms9901_set_int2
796};
797
798777/*
799778    Format:
800779    Name, address bus mask, select pattern, write select bit(s), read8z function, write8 function, Condition name, bits which must be set, bits which must not be set
r12394r12395
834813{
835814}
836815
816static SCREEN_UPDATE( ti99_4 )
817{
818   tms9928a_device *tms9928a = screen->machine().device<tms9928a_device>( TMS9928A_TAG );
819
820   tms9928a->update( bitmap, cliprect );
821   return 0;
822}
823
837824static MACHINE_CONFIG_START( ti99_4_60hz, ti99_4x_state )
838825   /* basic machine hardware */
839826   /* TMS9900 CPU @ 3.0 MHz */
r12394r12395
850837   // MCFG_SCREEN_REFRESH_RATE(60)
851838   // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
852839
853   MCFG_TI_TMS991x_ADD("video", tms9928a, 60, "screen", 2500, &tms9918_interface)
840   MCFG_TI_TMS991x_ADD_NTSC("video", TMS9118, ti99_4, ti99_4_tms9928a_interface)
854841   MCFG_GFXDECODE(ti99)
855842
856843   /* sound hardware */
r12394r12395
895882   MCFG_MACHINE_RESET( ti99_4 )
896883
897884   /* video hardware */
898   MCFG_TI_TMS991x_ADD("video", tms9928a, 50, "screen", 2500, &tms9929_interface)
885   MCFG_TI_TMS991x_ADD_PAL("video", TMS9929, ti99_4, ti99_4_tms9928a_interface)
899886
900887   MCFG_GFXDECODE(ti99)
901888
r12394r12395
941928   MCFG_MACHINE_RESET( ti99_4a )
942929
943930   /* video hardware */
944   MCFG_TI_TMS991x_ADD("video", tms9928a, 60, "screen", 2500, &tms9918a_interface)
931   MCFG_TI_TMS991x_ADD_NTSC("video", TMS9918A, ti99_4, ti99_4_tms9928a_interface)
945932   MCFG_GFXDECODE(ti99a)
946933
947934   /* sound hardware */
r12394r12395
985972   MCFG_MACHINE_RESET( ti99_4a )
986973
987974   /* video hardware */
988   MCFG_TI_TMS991x_ADD("video", tms9928a, 50, "screen", 2500, &tms9929a_interface)
975   MCFG_TI_TMS991x_ADD_PAL("video", TMS9929A, ti99_4, ti99_4_tms9928a_interface)
989976   MCFG_GFXDECODE(ti99a)
990977
991978   /* sound hardware */
src/mess/drivers/bbcbc.c
r12394r12395
5555static ADDRESS_MAP_START( bbcbc_io, AS_IO, 8, bbcbc_state )
5656   ADDRESS_MAP_GLOBAL_MASK(0xff)
5757   AM_RANGE(0x40, 0x43) AM_DEVREADWRITE_LEGACY("z80pio", z80pio_cd_ba_r, z80pio_cd_ba_w)
58   AM_RANGE(0x80, 0x80) AM_READWRITE_LEGACY(TMS9928A_vram_r, TMS9928A_vram_w)
59   AM_RANGE(0x81, 0x81) AM_READWRITE_LEGACY(TMS9928A_register_r, TMS9928A_register_w)
58   AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("tms9129", tms9129_device, vram_read, vram_write)
59   AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("tms9129", tms9129_device, register_read, register_write)
6060ADDRESS_MAP_END
6161
6262static INPUT_PORTS_START( bbcbc )
r12394r12395
9797   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Play, No") PORT_CODE(KEYCODE_B) PORT_IMPULSE(1)
9898INPUT_PORTS_END
9999
100static void tms_interrupt(running_machine &machine, int irq_state)
100static WRITE_LINE_DEVICE_HANDLER(tms_interrupt)
101101{
102   cputag_set_input_line(machine, "maincpu", 0, irq_state ? ASSERT_LINE : CLEAR_LINE);
102   cputag_set_input_line(device->machine(), "maincpu", 0, state ? ASSERT_LINE : CLEAR_LINE);
103103}
104104
105static INTERRUPT_GEN( bbcbc_interrupt )
105static TMS9928A_INTERFACE(tms9129_interface)
106106{
107   TMS9928A_interrupt(device->machine());
108}
109
110static const TMS9928a_interface tms9129_interface =
111{
112   TMS9929A,
107   "screen",
113108   0x4000,
114   0, 0,
115   tms_interrupt
109   DEVCB_LINE(tms_interrupt)
116110};
117111
118112/* TODO */
r12394r12395
168162
169163static MACHINE_START( bbcbc )
170164{
171   TMS9928A_configure(&tms9129_interface);
172165}
173166
174167static MACHINE_RESET( bbcbc )
r12394r12395
176169}
177170
178171
172static SCREEN_UPDATE( bbcbc )
173{
174   tms9928a_device *tms9129 = screen->machine().device<tms9928a_device>( "tms9129" );
175
176   tms9129->update( bitmap, cliprect );
177   return 0;
178}
179
180
179181static MACHINE_CONFIG_START( bbcbc, bbcbc_state )
180182   MCFG_CPU_ADD( "maincpu", Z80, MAIN_CLOCK / 8 )
181183   MCFG_CPU_PROGRAM_MAP( bbcbc_prg)
182184   MCFG_CPU_IO_MAP( bbcbc_io)
183185   MCFG_CPU_CONFIG(bbcbc_daisy_chain)
184   MCFG_CPU_VBLANK_INT("screen", bbcbc_interrupt)
185186
186187   MCFG_MACHINE_START( bbcbc )
187188   MCFG_MACHINE_RESET( bbcbc )
188189
189190   MCFG_Z80PIO_ADD( "z80pio", MAIN_CLOCK / 8, bbcbc_z80pio_intf )
190191
191   MCFG_FRAGMENT_ADD( tms9928a )
192   MCFG_SCREEN_MODIFY("screen")
193   MCFG_SCREEN_REFRESH_RATE( 50 )
192   MCFG_TMS9928A_ADD( "tms9129", TMS9129, tms9129_interface )
193   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
194   MCFG_SCREEN_UPDATE( bbcbc )
194195
195196   MCFG_CARTSLOT_ADD("cart")
196197   MCFG_CARTSLOT_NOT_MANDATORY

Previous 15994 Revisions Next


© 1998-2018 The MESS Team