Previous 15994 Revisions Next

r4847 Tuesday 26th May, 2009 at 16:15:07 UTC by Curt Coder
[PC8500] Fixed display.
[src/mess/video]sed1330.c

src/mess/video/sed1330.c
r4846r4847
1111
1212   TODO:
1313
14   - pc8500 writes data expecting the CSRDIR to be +1 or +AP but does not set it
1514   - reset behavior
1615   - busy flag timing
1716   - cursor flashing
17   - display page flashing
1818   - internal chargen ROM
19   - horizontal dot scroll
1920   - XOR/AND/Priority-OR compositions
2021   - text mode character display
2122   - single panel text mode
r4846r4847
3031    PARAMETERS
3132***************************************************************************/
3233
33#define LOG
34#define LOG 1
3435
3536#define SED1330_INSTRUCTION_SYSTEM_SET      0x40
3637#define SED1330_INSTRUCTION_SLEEP_IN      0x53   /* unimplemented */
r4846r4847
5253
5354#define SED1330_CSRDIR_RIGHT            0x00
5455#define SED1330_CSRDIR_LEFT               0x01
55#define SED1330_CSRDIR_UP               0x10
56#define SED1330_CSRDIR_DOWN               0x11
56#define SED1330_CSRDIR_UP               0x02
57#define SED1330_CSRDIR_DOWN               0x03
5758
5859#define SED1330_MX_OR                  0x00
5960#define SED1330_MX_XOR                  0x01   /* unimplemented */
60#define SED1330_MX_AND                  0x10   /* unimplemented */
61#define SED1330_MX_PRIORITY_OR            0x11   /* unimplemented */
61#define SED1330_MX_AND                  0x02   /* unimplemented */
62#define SED1330_MX_PRIORITY_OR            0x03   /* unimplemented */
6263
6364#define SED1330_FC_OFF                  0x00   /* unimplemented */
64#define SED1330_FC_NO_FLASH               0x01   /* unimplemented */
65#define SED1330_FC_FLASH_32               0x10   /* unimplemented */
66#define SED1330_FC_FLASH_16               0x11   /* unimplemented */
65#define SED1330_FC_SOLID               0x01   /* unimplemented */
66#define SED1330_FC_FLASH_32               0x02   /* unimplemented */
67#define SED1330_FC_FLASH_64               0x03   /* unimplemented */
6768
6869/***************************************************************************
6970    TYPE DEFINITIONS
r4846r4847
7576   devcb_resolved_read8      in_vd_func;
7677   devcb_resolved_write8      out_vd_func;
7778
78   /* registers */
7979   int bf;                  /* busy flag */
80
8081   UINT8 ir;               /* instruction register */
8182   UINT8 dor;               /* data output register */
8283   int pbc;               /* parameter byte counter */
r4846r4847
106107   int sl1;               /* display block 1 height in lines */
107108   int sl2;               /* display block 2 height in lines */
108109   int hdotscr;            /* horizontal dot scroll in pixels */
110   int fp;                  /* display page flash control */
109111
110112   UINT16 csr;               /* cursor address register */
111113   int cd;                  /* cursor increment direction */
r4846r4847
113115   int cry;               /* cursor height or location */
114116   int cm;                  /* cursor shape (0=underscore, 1=block) */
115117   int fc;                  /* cursor flash control */
116   int fp;                  /* cursor flash control */
117118
118119   int mx;                  /* screen layer composition method */
119   int dm;                  /* display mode for screen blocks 1, 3 */
120   int dm;                  /* display mode for pages 1, 3 */
120121   int ov;                  /* graphics mode layer composition */
121122
122123   /* devices */
123124   const device_config *screen;
124
125   /* timers */
126   emu_timer *busy_timer;
127125};
128126
129127/***************************************************************************
r4846r4847
171169***************************************************************************/
172170
173171/*-------------------------------------------------
174    TIMER_CALLBACK( busy_tick )
175-------------------------------------------------*/
176
177static TIMER_CALLBACK( busy_tick )
178{
179   const device_config *device = ptr;
180   sed1330_t *sed1330 = get_safe_token(device);
181
182   /* clear busy flag */
183   sed1330->bf = 0;
184}
185
186/*-------------------------------------------------
187    set_busy_flag - set busy flag and arm timer
188               to clear it later
189-------------------------------------------------*/
190#ifdef UNUSED_FUNCTION
191static void set_busy_flag(sed1330_t *sed1330, int period)
192{
193   /* set busy flag */
194   sed1330->bf = 1;
195
196   /* adjust busy timer */
197   timer_adjust_oneshot(sed1330->busy_timer, ATTOTIME_IN_USEC(period), 0);
198}
199#endif
200/*-------------------------------------------------
201172    sed1330_status_r - status read
202173-------------------------------------------------*/
203174
r4846r4847
220191
221192   sed1330->ir = data;
222193   sed1330->pbc = 0;
194
195   switch (sed1330->ir)
196   {
197/*
198   case SED1330_INSTRUCTION_SLEEP_IN:
199      break;
200*/
201   case SED1330_INSTRUCTION_CSRDIR_RIGHT:
202   case SED1330_INSTRUCTION_CSRDIR_LEFT:
203   case SED1330_INSTRUCTION_CSRDIR_UP:
204   case SED1330_INSTRUCTION_CSRDIR_DOWN:
205      sed1330->cd = data & 0x03;
206
207      if (LOG)
208      {
209         switch (sed1330->cd)
210         {
211         case SED1330_CSRDIR_RIGHT:   logerror("SED1330 '%s' Cursor Direction: Right\n", device->tag);   break;
212         case SED1330_CSRDIR_LEFT:   logerror("SED1330 '%s' Cursor Direction: Left\n", device->tag);      break;
213         case SED1330_CSRDIR_UP:      logerror("SED1330 '%s' Cursor Direction: Up\n", device->tag);      break;
214         case SED1330_CSRDIR_DOWN:   logerror("SED1330 '%s' Cursor Direction: Down\n", device->tag);      break;
215         }
216      }
217      break;
218   }
223219}
224220
225221/*-------------------------------------------------
r4846r4847
315311         logerror("SED1330 '%s' Invalid parameter byte %02x\n", device->tag, data);
316312      }
317313      break;
318/*
319   case SED1330_INSTRUCTION_SLEEP_IN:
320      break;
321*/
314
322315   case SED1330_INSTRUCTION_DISP_ON:
323316   case SED1330_INSTRUCTION_DISP_OFF:
324317      sed1330->d = BIT(data, 0);
r4846r4847
327320      if (LOG)
328321      {
329322         logerror("SED1330 '%s' Display: %s\n", device->tag, BIT(data, 0) ? "enabled" : "disabled");
323
324         switch (sed1330->fc)
325         {
326         case SED1330_FC_OFF:      logerror("SED1330 '%s' Cursor: disabled\n", device->tag);   break;
327         case SED1330_FC_SOLID:      logerror("SED1330 '%s' Cursor: solid\n", device->tag);      break;
328         case SED1330_FC_FLASH_32:   logerror("SED1330 '%s' Cursor: fFR/32\n", device->tag);      break;
329         case SED1330_FC_FLASH_64:   logerror("SED1330 '%s' Cursor: fFR/64\n", device->tag);      break;
330         }
331         
332         switch (sed1330->fp & 0x03)
333         {
334         case SED1330_FC_OFF:      logerror("SED1330 '%s' Display Page 1: disabled\n", device->tag);      break;
335         case SED1330_FC_SOLID:      logerror("SED1330 '%s' Display Page 1: enabled\n", device->tag);      break;
336         case SED1330_FC_FLASH_32:   logerror("SED1330 '%s' Display Page 1: flash fFR/32\n", device->tag);   break;
337         case SED1330_FC_FLASH_64:   logerror("SED1330 '%s' Display Page 1: flash fFR/64\n", device->tag);   break;
338         }
339         
340         switch ((sed1330->fp >> 2) & 0x03)
341         {
342         case SED1330_FC_OFF:      logerror("SED1330 '%s' Display Page 2/4: disabled\n", device->tag);      break;
343         case SED1330_FC_SOLID:      logerror("SED1330 '%s' Display Page 2/4: enabled\n", device->tag);      break;
344         case SED1330_FC_FLASH_32:   logerror("SED1330 '%s' Display Page 2/4: flash fFR/32\n", device->tag);   break;
345         case SED1330_FC_FLASH_64:   logerror("SED1330 '%s' Display Page 2/4: flash fFR/64\n", device->tag);   break;
346         }
347
348         switch ((sed1330->fp >> 4) & 0x03)
349         {
350         case SED1330_FC_OFF:      logerror("SED1330 '%s' Display Page 3: disabled\n", device->tag);      break;
351         case SED1330_FC_SOLID:      logerror("SED1330 '%s' Display Page 3: enabled\n", device->tag);      break;
352         case SED1330_FC_FLASH_32:   logerror("SED1330 '%s' Display Page 3: flash fFR/32\n", device->tag);   break;
353         case SED1330_FC_FLASH_64:   logerror("SED1330 '%s' Display Page 3: flash fFR/64\n", device->tag);   break;
354         }
330355      }
331356      break;
332357
r4846r4847
344369
345370      case 2:
346371         sed1330->sl1 = data + 1;
347         if (LOG) logerror("SED1330 '%s' Display Page 1 Screen Lines: %u\n", device->tag, sed1330->sl1);
372         if (LOG) logerror("SED1330 '%s' Display Block 1 Screen Lines: %u\n", device->tag, sed1330->sl1);
348373         break;
349374
350375      case 3:
r4846r4847
358383
359384      case 5:
360385         sed1330->sl2 = data + 1;
361         if (LOG) logerror("SED1330 '%s' Display Page 2 Screen Lines: %u\n", device->tag, sed1330->sl2);
386         if (LOG) logerror("SED1330 '%s' Display Block 2 Screen Lines: %u\n", device->tag, sed1330->sl2);
362387         break;
363388
364389      case 6:
r4846r4847
405430      default:
406431         logerror("SED1330 '%s' Invalid parameter byte %02x\n", device->tag, data);
407432      }
408      sed1330->cd = SED1330_CSRDIR_DOWN; // HACK
433//      sed1330->cd = SED1330_CSRDIR_DOWN; // HACK
409434      break;
410435
411436   case SED1330_INSTRUCTION_CGRAM_ADR:
r4846r4847
425450      }
426451      break;
427452
428   case SED1330_INSTRUCTION_CSRDIR_RIGHT:
429   case SED1330_INSTRUCTION_CSRDIR_LEFT:
430   case SED1330_INSTRUCTION_CSRDIR_UP:
431   case SED1330_INSTRUCTION_CSRDIR_DOWN:
432      sed1330->cd = data & 0x03;
433      if (LOG)
434      {
435         switch (sed1330->cd)
436         {
437         case SED1330_CSRDIR_RIGHT:   logerror("SED1330 '%s' Cursor Direction: Right\n", device->tag);   break;
438         case SED1330_CSRDIR_LEFT:   logerror("SED1330 '%s' Cursor Direction: Left\n", device->tag);      break;
439         case SED1330_CSRDIR_UP:      logerror("SED1330 '%s' Cursor Direction: Up\n", device->tag);      break;
440         case SED1330_CSRDIR_DOWN:   logerror("SED1330 '%s' Cursor Direction: Down\n", device->tag);      break;
441         }
442      }
443      break;
444
445453   case SED1330_INSTRUCTION_HDOT_SCR:
446454      sed1330->hdotscr = data & 0x07;
447455      if (LOG) logerror("SED1330 '%s' Horizontal Dot Scroll: %u\n", device->tag, sed1330->hdotscr);
r4846r4847
456464      {
457465         switch (sed1330->mx)
458466         {
459         case SED1330_MX_OR:
460            logerror("SED1330 '%s' Layered Screen Composition Method: OR\n", device->tag);
461            break;
462         
463         case SED1330_MX_XOR:
464            logerror("SED1330 '%s' Layered Screen Composition Method: Exclusive-OR\n", device->tag);
465            break;
466         
467         case SED1330_MX_AND:
468            logerror("SED1330 '%s' Layered Screen Composition Method: AND\n", device->tag);
469            break;
470
471         case SED1330_MX_PRIORITY_OR:
472            logerror("SED1330 '%s' Layered Screen Composition Method: Priority-OR\n", device->tag);
473            break;
467         case SED1330_MX_OR:            logerror("SED1330 '%s' Display Composition Method: OR\n", device->tag);            break;
468         case SED1330_MX_XOR:         logerror("SED1330 '%s' Display Composition Method: Exclusive-OR\n", device->tag);   break;
469         case SED1330_MX_AND:         logerror("SED1330 '%s' Display Composition Method: AND\n", device->tag);         break;
470         case SED1330_MX_PRIORITY_OR:   logerror("SED1330 '%s' Display Composition Method: Priority-OR\n", device->tag);   break;
474471         }
475472
476473         logerror("SED1330 '%s' Display Page 1 Mode: %s\n", device->tag, BIT(data, 2) ? "Graphics" : "Text");
r4846r4847
484481      {
485482      case 0:
486483         sed1330->csr = (sed1330->csr & 0xff00) | data;
487         if (LOG) logerror("SED1330 '%s' Cursor Address Low %02x %04x %u\n", device->tag, data, sed1330->csr, sed1330->csr/80);
488484         break;
489485
490486      case 1:     
491487         sed1330->csr = (data << 8) | (sed1330->csr & 0xff);
492         if (LOG) logerror("SED1330 '%s' Cursor Address High %02x %04x %u\n", device->tag, data, sed1330->csr, sed1330->csr/80);
488         if (LOG) logerror("SED1330 '%s' Cursor Address %04x\n", device->tag, sed1330->csr);
493489         break;
494490
495491      default:
r4846r4847
501497      break;
502498*/
503499   case SED1330_INSTRUCTION_MWRITE:
504      if (LOG) logerror("SED1330 '%s' Memory Write %02x to %04x\n", device->tag, data, sed1330->csr);
500      if (LOG) logerror("SED1330 '%s' Memory Write %02x to %04x (row %u col %u line %u)\n", device->tag, data, sed1330->csr, sed1330->csr/80/8, sed1330->csr%80, sed1330->csr/80);
505501
506502      devcb_call_write8(&sed1330->out_vd_func, sed1330->csr, data);
507503
r4846r4847
538534            {
539535               for (x = 0; x < sed1330->crx; x++)
540536               {
541                  *BITMAP_ADDR16(bitmap, y, sed1330->hdotscr + (sx * sed1330->fx) + x) = 1;
537                  *BITMAP_ADDR16(bitmap, y, (sx * sed1330->fx) + x) = 1;
542538               }
543539            }
544540         }
r4846r4847
549545            {
550546               for (x = 0; x < sed1330->crx; x++)
551547               {
552                  *BITMAP_ADDR16(bitmap, y, sed1330->hdotscr + (sx * sed1330->fx) + x) = 1;
548                  *BITMAP_ADDR16(bitmap, y, (sx * sed1330->fx) + x) = 1;
553549               }
554550            }
555551         }
r4846r4847
571567
572568      for (x = 0; x < sed1330->fx; x++)
573569      {
574         *BITMAP_ADDR16(bitmap, y, sed1330->hdotscr + (sx * sed1330->fx) + x) = BIT(data, 7);
570         *BITMAP_ADDR16(bitmap, y, (sx * sed1330->fx) + x) = BIT(data, 7);
575571         data <<= 1;
576572      }
577573   }
r4846r4847
655651   sed1330->screen = devtag_get_device(device->machine, intf->screen_tag);
656652   assert(sed1330->screen != NULL);
657653
658   /* create the busy timer */
659   sed1330->busy_timer = timer_alloc(device->machine, busy_tick, (void *)device);
660
661654   /* register for state saving */
662655   state_save_register_device_item(device, 0, sed1330->bf);
663656   state_save_register_device_item(device, 0, sed1330->ir);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team