Previous 15994 Revisions Next

r1926 Tuesday 11th March, 2008 at 21:02:08 UTC by Wilbert Pol
Removed deprecat.h dependency from video/ted7360.c
[src/mess/video]ted7360.c

src/mess/video/ted7360.c
r1925r1926
355355#include <math.h>
356356#include <stdio.h>
357357#include "driver.h"
358#include "deprecat.h"
359358#include "utils.h"
360359#include "sound/custom.h"
361360
r1925r1926
508507static bitmap_t *ted7360_bitmap;
509508static int rasterline = 0, lastline = 0;
510509static double rastertime;
511static void ted7360_drawlines (int first, int last);
510static void ted7360_drawlines (running_machine *machine, int first, int last);
512511
513512static UINT32 cursorcolortable[2] =
514513{0};
r1925r1926
686685   case 6:
687686      if (ted7360[offset] != data)
688687      {
689         ted7360_drawlines (lastline, rasterline);
688         ted7360_drawlines (machine, lastline, rasterline);
690689         ted7360[offset] = data;
691690         if (LINES25)
692691         {
r1925r1926
704703   case 7:
705704      if (ted7360[offset] != data)
706705      {
707         ted7360_drawlines (lastline, rasterline);
706         ted7360_drawlines (machine, lastline, rasterline);
708707         ted7360[offset] = data;
709708         if (COLUMNS40)
710709         {
r1925r1926
750749   case 0xb:
751750      if (data != ted7360[offset])
752751      {
753         ted7360_drawlines (lastline, rasterline);
752         ted7360_drawlines (machine, lastline, rasterline);
754753         ted7360[offset] = data;
755754         /*  DBG_LOG(1,"set rasterline lo",("soll:%d\n",RASTERLINE)); */
756755      }
r1925r1926
759758   case 0xd:
760759      if (ted7360[offset] != data)
761760      {
762         ted7360_drawlines (lastline, rasterline);
761         ted7360_drawlines (machine, lastline, rasterline);
763762         ted7360[offset] = data;
764763      }
765764      break;
766765   case 0x12:
767766      if (ted7360[offset] != data)
768767      {
769         ted7360_drawlines (lastline, rasterline);
768         ted7360_drawlines (machine, lastline, rasterline);
770769         ted7360[offset] = data;
771770         bitmapaddr = BITMAPADDR;
772771         chargenaddr = CHARGENADDR;
r1925r1926
777776   case 0x13:
778777      if (ted7360[offset] != data)
779778      {
780         ted7360_drawlines (lastline, rasterline);
779         ted7360_drawlines (machine, lastline, rasterline);
781780         ted7360[offset] = data;
782781         chargenaddr = CHARGENADDR;
783782         DBG_LOG (3, "ted7360_port_w", ("chargen %.4x %s %d\n",
r1925r1926
788787   case 0x14:
789788      if (ted7360[offset] != data)
790789      {
791         ted7360_drawlines (lastline, rasterline);
790         ted7360_drawlines (machine, lastline, rasterline);
792791         ted7360[offset] = data;
793792         videoaddr = VIDEOADDR;
794793         DBG_LOG (3, "ted7360_port_w", ("videoram %.4x\n",
r1925r1926
798797   case 0x15:                     /* backgroundcolor */
799798      if (ted7360[offset] != data)
800799      {
801         ted7360_drawlines (lastline, rasterline);
800         ted7360_drawlines (machine, lastline, rasterline);
802801         ted7360[offset] = data;
803802         monoinversed[1] = mono[0] = bitmapmulti[0] = multi[0] = colors[0] =
804            Machine->pens[BACKGROUNDCOLOR];
803            machine->pens[BACKGROUNDCOLOR];
805804      }
806805      break;
807806   case 0x16:                     /* foregroundcolor */
808807      if (ted7360[offset] != data)
809808      {
810         ted7360_drawlines (lastline, rasterline);
809         ted7360_drawlines (machine, lastline, rasterline);
811810         ted7360[offset] = data;
812         bitmapmulti[3] = multi[1] = colors[1] = Machine->pens[FOREGROUNDCOLOR];
811         bitmapmulti[3] = multi[1] = colors[1] = machine->pens[FOREGROUNDCOLOR];
813812      }
814813      break;
815814   case 0x17:                     /* multicolor 1 */
816815      if (ted7360[offset] != data)
817816      {
818         ted7360_drawlines (lastline, rasterline);
817         ted7360_drawlines (machine, lastline, rasterline);
819818         ted7360[offset] = data;
820         multi[2] = colors[2] = Machine->pens[MULTICOLOR1];
819         multi[2] = colors[2] = machine->pens[MULTICOLOR1];
821820      }
822821      break;
823822   case 0x18:                     /* multicolor 2 */
824823      if (ted7360[offset] != data)
825824      {
826         ted7360_drawlines (lastline, rasterline);
825         ted7360_drawlines (machine, lastline, rasterline);
827826         ted7360[offset] = data;
828         colors[3] = Machine->pens[MULTICOLOR2];
827         colors[3] = machine->pens[MULTICOLOR2];
829828      }
830829      break;
831830   case 0x19:                     /* framecolor */
832831      if (ted7360[offset] != data)
833832      {
834         ted7360_drawlines (lastline, rasterline);
833         ted7360_drawlines (machine, lastline, rasterline);
835834         ted7360[offset] = data;
836         colors[4] = Machine->pens[FRAMECOLOR];
835         colors[4] = machine->pens[FRAMECOLOR];
837836      }
838837      break;
839838   case 0x1c:
r1925r1926
916915         val |= 1;
917916      break;
918917   case 0x1c:                     /*rasterline */
919      ted7360_drawlines (lastline, rasterline);
918      ted7360_drawlines (machine, lastline, rasterline);
920919      val = ((RASTERLINE_2_C16 (rasterline) & 0x100) >> 8) | 0xfe;   /* expected by matrix */
921920      break;
922921   case 0x1d:                     /*rasterline */
923      ted7360_drawlines (lastline, rasterline);
922      ted7360_drawlines (machine, lastline, rasterline);
924923      val = RASTERLINE_2_C16 (rasterline) & 0xff;
925924      break;
926925   case 0x1e:                     /*rastercolumn */
r1925r1926
959958   add_exit_callback(machine, ted7360_video_stop);
960959}
961960
962static void ted7360_draw_character (int ybegin, int yend, int ch, int yoff, int xoff,
961static void ted7360_draw_character (running_machine *machine, int ybegin, int yend, int ch, int yoff, int xoff,
963962                           UINT16 *color)
964963{
965964   int y, code;
r1925r1926
967966   for (y = ybegin; y <= yend; y++)
968967   {
969968      if (INROM)
970         code = vic_dma_read_rom (Machine, chargenaddr + ch * 8 + y);
969         code = vic_dma_read_rom (machine, chargenaddr + ch * 8 + y);
971970      else
972         code = vic_dma_read (Machine, chargenaddr + ch * 8 + y);
971         code = vic_dma_read (machine, chargenaddr + ch * 8 + y);
973972      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) = color[code >> 7];
974973      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = color[(code >> 6) & 1];
975974      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) = color[(code >> 5) & 1];
r1925r1926
981980   }
982981}
983982
984static void ted7360_draw_character_multi (int ybegin, int yend, int ch, int yoff,
983static void ted7360_draw_character_multi (running_machine *machine, int ybegin, int yend, int ch, int yoff,
985984                                int xoff)
986985{
987986   int y, code;
r1925r1926
989988   for (y = ybegin; y <= yend; y++)
990989   {
991990      if (INROM)
992         code = vic_dma_read_rom (Machine, chargenaddr + ch * 8 + y);
991         code = vic_dma_read_rom (machine, chargenaddr + ch * 8 + y);
993992      else
994         code = vic_dma_read (Machine, chargenaddr + ch * 8 + y);
993         code = vic_dma_read (machine, chargenaddr + ch * 8 + y);
995994      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) =
996995         *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = multi[code >> 6];
997996      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) =
r1925r1926
10031002   }
10041003}
10051004
1006static void ted7360_draw_bitmap (int ybegin, int yend,
1005static void ted7360_draw_bitmap (running_machine *machine, int ybegin, int yend,
10071006                         int ch, int yoff, int xoff)
10081007{
10091008   int y, code;
10101009
10111010   for (y = ybegin; y <= yend; y++)
10121011   {
1013      code = vic_dma_read (Machine, bitmapaddr + ch * 8 + y);
1012      code = vic_dma_read (machine, bitmapaddr + ch * 8 + y);
10141013      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) = c16_bitmap[code >> 7];
10151014      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = c16_bitmap[(code >> 6) & 1];
10161015      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) = c16_bitmap[(code >> 5) & 1];
r1925r1926
10221021   }
10231022}
10241023
1025static void ted7360_draw_bitmap_multi (int ybegin, int yend,
1024static void ted7360_draw_bitmap_multi (running_machine *machine, int ybegin, int yend,
10261025                              int ch, int yoff, int xoff)
10271026{
10281027   int y, code;
10291028
10301029   for (y = ybegin; y <= yend; y++)
10311030   {
1032      code = vic_dma_read (Machine, bitmapaddr + ch * 8 + y);
1031      code = vic_dma_read (machine, bitmapaddr + ch * 8 + y);
10331032      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 0 + xoff) =
10341033         *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 1 + xoff) = bitmapmulti[code >> 6];
10351034      *BITMAP_ADDR16(ted7360_bitmap, y + yoff, 2 + xoff) =
r1925r1926
10521051   }
10531052}
10541053
1055static void ted7360_drawlines (int first, int last)
1054static void ted7360_drawlines (running_machine *machine, int first, int last)
10561055{
10571056   int line, vline, end;
10581057   int attr, ch, c1, c2, ecm;
r1925r1926
10751074   if (!SCREENON)
10761075   {
10771076      for (line = first; (line < last) && (line < ted7360_bitmap->height); line++)
1078         memset16 (BITMAP_ADDR16(ted7360_bitmap, line, 0), Machine->pens[0], ted7360_bitmap->width);
1077         memset16 (BITMAP_ADDR16(ted7360_bitmap, line, 0), machine->pens[0], ted7360_bitmap->width);
10791078      return;
10801079   }
10811080
r1925r1926
10901089      end = y_begin + YPOS;
10911090   {
10921091      for (line = first; line < end; line++)
1093         memset16 (BITMAP_ADDR16(ted7360_bitmap, line, 0), Machine->pens[FRAMECOLOR],
1092         memset16 (BITMAP_ADDR16(ted7360_bitmap, line, 0), machine->pens[FRAMECOLOR],
10941093            ted7360_bitmap->width);
10951094   }
10961095   if (LINES25)
r1925r1926
11181117      {
11191118         if (HIRESON)
11201119         {
1121            ch = vic_dma_read (Machine, (videoaddr | 0x400) + offs);
1122            attr = vic_dma_read (Machine, ((videoaddr) + offs));
1120            ch = vic_dma_read (machine, (videoaddr | 0x400) + offs);
1121            attr = vic_dma_read (machine, ((videoaddr) + offs));
11231122            c1 = ((ch >> 4) & 0xf) | (attr << 4);
11241123            c2 = (ch & 0xf) | (attr & 0x70);
1125            bitmapmulti[1] = c16_bitmap[1] = Machine->pens[c1 & 0x7f];
1126            bitmapmulti[2] = c16_bitmap[0] = Machine->pens[c2 & 0x7f];
1124            bitmapmulti[1] = c16_bitmap[1] = machine->pens[c1 & 0x7f];
1125            bitmapmulti[2] = c16_bitmap[0] = machine->pens[c2 & 0x7f];
11271126            if (MULTICOLORON)
11281127            {
1129               ted7360_draw_bitmap_multi (ybegin, yend, offs, yoff, xoff);
1128               ted7360_draw_bitmap_multi (machine, ybegin, yend, offs, yoff, xoff);
11301129            }
11311130            else
11321131            {
1133               ted7360_draw_bitmap (ybegin, yend, offs, yoff, xoff);
1132               ted7360_draw_bitmap (machine, ybegin, yend, offs, yoff, xoff);
11341133            }
11351134         }
11361135         else
11371136         {
1138            ch = vic_dma_read (Machine, (videoaddr | 0x400) + offs);
1139            attr = vic_dma_read (Machine, ((videoaddr) + offs));
1137            ch = vic_dma_read (machine, (videoaddr | 0x400) + offs);
1138            attr = vic_dma_read (machine, ((videoaddr) + offs));
11401139            // levente harsfalvi's docu says cursor off in ecm and multicolor
11411140            if (ECMON)
11421141            {
11431142               // hardware reverse off
11441143               ecm = ch >> 6;
11451144               ecmcolor[0] = colors[ecm];
1146               ecmcolor[1] = Machine->pens[attr & 0x7f];
1147               ted7360_draw_character (ybegin, yend, ch & ~0xC0, yoff, xoff, ecmcolor);
1145               ecmcolor[1] = machine->pens[attr & 0x7f];
1146               ted7360_draw_character (machine, ybegin, yend, ch & ~0xC0, yoff, xoff, ecmcolor);
11481147            }
11491148            else if (MULTICOLORON)
11501149            {
11511150               // hardware reverse off
11521151               if (attr & 8)
11531152               {
1154                  multi[3] = Machine->pens[attr & 0x77];
1155                  ted7360_draw_character_multi (ybegin, yend, ch, yoff, xoff);
1153                  multi[3] = machine->pens[attr & 0x77];
1154                  ted7360_draw_character_multi (machine, ybegin, yend, ch, yoff, xoff);
11561155               }
11571156               else
11581157               {
1159                  mono[1] = Machine->pens[attr & 0x7f];
1160                  ted7360_draw_character (ybegin, yend, ch, yoff, xoff, mono);
1158                  mono[1] = machine->pens[attr & 0x7f];
1159                  ted7360_draw_character (machine, ybegin, yend, ch, yoff, xoff, mono);
11611160               }
11621161            }
11631162            else if (cursor1 && (offs == CURSOR1POS))
11641163            {
11651164#ifndef GFX
11661165               ted7360_draw_cursor (ybegin, yend, yoff, xoff,
1167                     Machine->pens[attr & 0x7f]);
1166                     machine->pens[attr & 0x7f]);
11681167#else
1169               drawgfx (ted7360_bitmap, cursorelement, 0, Machine->pens[attr & 0x7f], 0, 0,
1168               drawgfx (ted7360_bitmap, cursorelement, 0, machine->pens[attr & 0x7f], 0, 0,
11701169                  xoff, yoff, 0, TRANSPARENCY_NONE, 0);
11711170#endif
11721171            }
11731172            else if (REVERSEON && (ch & 0x80))
11741173            {
1175               monoinversed[0] = Machine->pens[attr & 0x7f];
1174               monoinversed[0] = machine->pens[attr & 0x7f];
11761175               if (cursor1 && (attr & 0x80))
11771176                  ted7360_draw_cursor (ybegin, yend, yoff, xoff, monoinversed[0]);
11781177               else
1179                  ted7360_draw_character (ybegin, yend, ch & ~0x80, yoff, xoff,
1178                  ted7360_draw_character (machine, ybegin, yend, ch & ~0x80, yoff, xoff,
11801179                     monoinversed);
11811180            }
11821181            else
11831182            {
1184               mono[1] = Machine->pens[attr & 0x7f];
1183               mono[1] = machine->pens[attr & 0x7f];
11851184               if (cursor1 && (attr & 0x80))
11861185                  ted7360_draw_cursor (ybegin, yend, yoff, xoff, mono[0]);
11871186               else
1188                  ted7360_draw_character (ybegin, yend, ch, yoff, xoff, mono);
1187                  ted7360_draw_character (machine, ybegin, yend, ch, yoff, xoff, mono);
11891188            }
11901189         }
11911190      }
11921191
11931192      for (i = ybegin; i <= yend; i++)
11941193      {
1195         memset16 (BITMAP_ADDR16(ted7360_bitmap, yoff + i, 0), Machine->pens[FRAMECOLOR], xbegin);
1196         memset16 (BITMAP_ADDR16(ted7360_bitmap, yoff + i, xend), Machine->pens[FRAMECOLOR], ted7360_bitmap->width - xend);
1194         memset16 (BITMAP_ADDR16(ted7360_bitmap, yoff + i, 0), machine->pens[FRAMECOLOR], xbegin);
1195         memset16 (BITMAP_ADDR16(ted7360_bitmap, yoff + i, xend), machine->pens[FRAMECOLOR], ted7360_bitmap->width - xend);
11971196      }
11981197   }
11991198
r1925r1926
12041203
12051204   for (; line < end; line++)
12061205   {
1207      memset16 (BITMAP_ADDR16(ted7360_bitmap, line, 0), Machine->pens[FRAMECOLOR], ted7360_bitmap->width);
1206      memset16 (BITMAP_ADDR16(ted7360_bitmap, line, 0), machine->pens[FRAMECOLOR], ted7360_bitmap->width);
12081207   }
12091208}
12101209
r1925r1926
12151214   if (rasterline >= lines)
12161215   {
12171216      rasterline = 0;
1218      ted7360_drawlines (lastline, TED7360_LINES);
1217      ted7360_drawlines (machine, lastline, TED7360_LINES);
12191218      lastline = 0;
12201219   }
12211220   if (rasterline == C16_2_RASTERLINE (RASTERLINE))
12221221   {
1223      ted7360_drawlines (lastline, rasterline);
1222      ted7360_drawlines (machine, lastline, rasterline);
12241223      ted7360_set_interrupt (2);
12251224   }
12261225}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team