Previous 15994 Revisions Next

r8680 Sunday 1st August, 2010 at 15:16:58 UTC by Angelo Salese
[MYCOM]: Added bitmap mode
[src/mess/drivers]mycom.c

src/mess/drivers/mycom.c
r8679r8680
11/***************************************************************************
22
3      Japan Electronics College MYCOMZ-80A
3   MYCOMZ-80A (c) 1981 Japan Electronics College
44
5        21/07/2010 Skeleton driver.
5   preliminary driver by Angelo Salese
66
77****************************************************************************/
88
r8679r8680
1616static UINT16 vram_addr;
1717static UINT16 cursor_addr,cursor_raster;
1818static UINT8 keyb_press,keyb_press_flag,shift_press_flag;
19static UINT8 video_mode;
1920
2021static VIDEO_START( mycom )
2122{
r8679r8680
2526{
2627   int x,y,count;
2728   int xi,yi;
29   int width;
2830   static UINT8 *vram = memory_region(screen->machine, "vram");
2931   static UINT8 *gfx_rom = memory_region(screen->machine, "gfx");
3032
3133   count = 0;
3234
33   for(y=0;y<24;y++)
35   if(video_mode & 0x40)
3436   {
35      for(x=0;x<40;x++)
37      width = (video_mode & 0x80) ? 160 : 320;
38
39      for(y=0;y<24;y++)
3640      {
37         int tile = vram[count];
38         //int color = (display_reg & 0x80) ? 7 : (attr & 0x07);
41         for(x=0;x<width;x+=4)
42         {
43            //int xi,yi;
44            int xi,yi;
3945
40         for(yi=0;yi<8;yi++)
41         {
42            for(xi=0;xi<8;xi++)
46            for(yi=0;yi<4;yi++)
4347            {
44               int pen;
48               for(xi=0;xi<2;xi++)
49               {
50                  int pen;
4551
46               pen = (gfx_rom[tile*8+yi] >> (7-xi) & 1) ? 1 : 0;
52                  pen = vram[count] >> (yi+(xi*4));
53                  pen &= 1;
4754
48               //if(pen)
49                  *BITMAP_ADDR16(bitmap, y*8+yi, x*8+xi) = screen->machine->pens[pen];
55                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+0))*2+0) = screen->machine->pens[pen];
56                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+1))*2+0) = screen->machine->pens[pen];
57                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+0))*2+0) = screen->machine->pens[pen];
58                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+1))*2+0) = screen->machine->pens[pen];
59                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+0))*2+1) = screen->machine->pens[pen];
60                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+1))*2+1) = screen->machine->pens[pen];
61                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+0))*2+1) = screen->machine->pens[pen];
62                  *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+1))*2+1) = screen->machine->pens[pen];
63               }
5064            }
65
66            count++;
5167         }
68      }
5269
53         if(cursor_addr == count)
70      return 0;
71   }
72   else
73   {
74      width = (video_mode & 0x80) ? 40 : 80;
75
76      for(y=0;y<24;y++)
77      {
78         for(x=0;x<width;x++)
5479         {
55            int xc,yc,cursor_on;
80            int tile = vram[count];
81            //int color = (display_reg & 0x80) ? 7 : (attr & 0x07);
5682
57            cursor_on = 0;
58            switch(cursor_raster & 0x60)
59            {
60               case 0x00: cursor_on = 1; break; //always on
61               case 0x20: cursor_on = 0; break; //always off
62               case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
63               case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
64            }
83               for(yi=0;yi<8;yi++)
84               {
85                  for(xi=0;xi<8;xi++)
86                  {
87                     int pen;
6588
66            if(cursor_on)
67            {
68               for(yc=0;yc<(8-(cursor_raster & 7));yc++)
89                     pen = (gfx_rom[tile*8+yi] >> (7-xi) & 1) ? 1 : 0;
90
91                     //if(pen)
92                        *BITMAP_ADDR16(bitmap, y*8+yi, x*8+xi) = screen->machine->pens[pen];
93                  }
94               }
95
96               if(cursor_addr == count)
6997               {
70                  for(xc=0;xc<8;xc++)
98                  int xc,yc,cursor_on;
99
100                  cursor_on = 0;
101                  switch(cursor_raster & 0x60)
71102                  {
72                     *BITMAP_ADDR16(bitmap, y*8+yc, x*8+xc) = screen->machine->pens[0x1];
103                     case 0x00: cursor_on = 1; break; //always on
104                     case 0x20: cursor_on = 0; break; //always off
105                     case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
106                     case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
73107                  }
108
109                  if(cursor_on)
110                  {
111                     for(yc=0;yc<(8-(cursor_raster & 7));yc++)
112                     {
113                        for(xc=0;xc<8;xc++)
114                        {
115                           *BITMAP_ADDR16(bitmap, y*8+yc, x*8+xc) = screen->machine->pens[0x1];
116                        }
117                     }
118                  }
74119               }
75            }
120
121            count++;
76122         }
77
78         count++;
79123      }
80124   }
81125
r8679r8680
210254   PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 '
211255   PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 (
212256   PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 )
213   PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a *
257   PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') //0x2a *
214258   PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED)
215259   PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c ,
216260   PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')
r8679r8680
346390   return keyb_press;
347391}
348392
393static WRITE8_DEVICE_HANDLER( output_1c )
394{
395   /*
396   x--- ---- width 80/40 (0 = 80, 1 = 40)
397   -x-- ---- video mode (0= tile, 1 = bitmap)
398   --x- ---- PSG CS bit
399   ---x ---- PSG WE bit
400   ---- x--- cmt remote
401   ---- -x-- cmt output
402   ---- --x- printer reset
403   ---- ---x printer strobe
404   */
405
406   video_mode = data & 0xc0;
407}
408
349409static I8255A_INTERFACE( ppi8255_intf_0 )
350410{
351411   DEVCB_NULL,                  /* Port A read */
r8679r8680
363423   DEVCB_NULL,         /* Port C read */
364424   DEVCB_NULL,         /* Port A write */
365425   DEVCB_NULL,         /* Port B write */
366   DEVCB_NULL         /* Port C write */
426   DEVCB_HANDLER(output_1c)      /* Port C write */
367427};
368428
369429static I8255A_INTERFACE( ppi8255_intf_2 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team