Previous 15994 Revisions Next

r8572 Wednesday 21st July, 2010 at 15:55:53 UTC by Angelo Salese
[SMC-777]: Added a bunch of video features
[src/mess/drivers]smc777.c

src/mess/drivers/smc777.c
r8571r8572
77    TODO:
88    - no documentation, the entire driver is just a bunch of educated
99      guesses ...
10    - video emulation is just hacked up together to show something simple,
11      dunno yet how it really works.
1210   - BEEP pitch is horrible
11   - 1dd disk support
1312
1413****************************************************************************/
1514
r8571r8572
2322#include "formats/basicdsk.h"
2423#include "devices/flopdrv.h"
2524
26static UINT16 cursor_addr;
25static UINT16 cursor_addr,cursor_raster;
2726static UINT8 keyb_press,keyb_press_flag;
2827static UINT8 backdrop_pen;
2928
r8571r8572
7675      {
7776         int tile = vram[count];
7877         int color = attr[count] & 7;
78         int bk_color = (attr[count] & 0x18) >> 3;
79         int yb,xb,bk_pen;
7980
81         bk_pen = 0x00;
82         switch(bk_color)
83         {
84            case 1: bk_pen = 0x07; break; //white
85            case 2: bk_pen = 0x00; break; //black
86            case 3: bk_pen = (color ^ 7)+0x08; break; //complementary
87         }
88
89         if(bk_color)
90            for(yb=0;yb<8;yb++)
91               for(xb=0;xb<8;xb++)
92                  *BITMAP_ADDR16(bitmap, y*8+CRTC_MIN_Y+yb, x*8+CRTC_MIN_X+xb) = screen->machine->pens[bk_pen+0x10];
93
94         /*TODO: make this custom code*/
8095         drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8+CRTC_MIN_X,y*8+CRTC_MIN_Y,0);
8196
82         if(((cursor_addr) == count) && screen->machine->primary_screen->frame_number() & 0x10) // draw cursor
83            drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x87,7,0,0,x*8+CRTC_MIN_X,y*8+CRTC_MIN_Y,0);
97         // draw cursor
98         if(cursor_addr == count)
99         {
100            int xc,yc,cursor_on;
84101
102            cursor_on = 0;
103            switch(cursor_raster & 0x60)
104            {
105               case 0x00: cursor_on = 1; break; //always on
106               case 0x20: cursor_on = 0; break; //always off
107               case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
108               case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
109            }
110
111            if(cursor_on)
112            {
113               for(yc=0;yc<(8-(cursor_raster & 7));yc++)
114               {
115                  for(xc=0;xc<8;xc++)
116                  {
117                     *BITMAP_ADDR16(bitmap, y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = screen->machine->pens[0x17];
118                  }
119               }
120            }
121         }
122
85123         count++; //TODO: width 40 uses count += 2
86124      }
87125   }
r8571r8572
101139   else
102140   {
103141      /* FIXME: this should be inside the MC6845 core! */
104      if(addr_latch == 0x0e)
142      if(addr_latch == 0x0a)
143         cursor_raster = data;
144      else if(addr_latch == 0x0e)
105145         cursor_addr = ((data<<8) & 0x3f00) | (cursor_addr & 0xff);
106146      else if(addr_latch == 0x0f)
107147         cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff);
r8571r8572
264304   rom[offset] = data;
265305}
266306
267#define keyb_press(_val_,_charset_) \
268   if(input_code_pressed(space->machine, _val_)) \
269      return _charset_ \
270307
271308static READ8_HANDLER( key_r )
272309{
r8571r8572
344381//   AM_RANGE(0x21, 0x21) AM_WRITENOP //60 Hz irq control
345382//   AM_RANGE(0x22, 0x22) AM_WRITENOP //printer output data
346383   AM_RANGE(0x23, 0x23) AM_WRITE(border_col_w) //border area control
347//   AM_RANGE(0x24, 0x24) AM_WRITENOP //Timer write / specify address (RTC?)
348//   AM_RANGE(0x25, 0x25) AM_READNOP  //Timer read (RTC?)
384//   AM_RANGE(0x24, 0x24) AM_WRITENOP //Timer write / specify address (RTC)
385//   AM_RANGE(0x25, 0x25) AM_READNOP  //Timer read (RTC)
349386//   AM_RANGE(0x26, 0x26) AM_WRITENOP //RS232C RX / TX
350387//   AM_RANGE(0x27, 0x27) AM_WRITENOP //RS232C Mode / Command / Status
351388
r8571r8572
388425   PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr
389426   PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so
390427
428   #if 0
429
430   #endif
391431   PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 si
392432   PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dle
393433   PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc1
394434   PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc2
395   PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x14 dc3
435   PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME)
396436   PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 dc4
397   PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x16 nak
437   PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT)
398438   PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 syn
399439   PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 etb
400   PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x19 cancel
440   PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
401441   PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a em
402442   PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27)
403443   PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1c ???
r8571r8572
552592   NULL      /* update address callback */
553593};
554594
555#if 0
556static const rgb_t defcolors[]=
557{
558   MAKE_RGB(0x00,0x00,0x00),
559   MAKE_RGB(0x00,0x00,0xff),
560   MAKE_RGB(0x00,0xff,0x00),
561   MAKE_RGB(0x00,0xff,0xff),
562   MAKE_RGB(0xff,0x00,0x00),
563   MAKE_RGB(0xff,0x00,0xff),
564   MAKE_RGB(0xff,0xff,0x00),
565   MAKE_RGB(0xff,0xff,0xff),
566   /* TODO: values extracted from WinSMC emulator, almost certainly not 100% accurate */
567   MAKE_RGB(0x10,0x40,0x10), //dark green
568   MAKE_RGB(0x10,0x70,0x20), //moss green
569   MAKE_RGB(0xd0,0x50,0x20), //salmon
570   MAKE_RGB(0xe0,0x90,0x20), //tan
571   MAKE_RGB(0x10,0x50,0x80), //ash blue
572   MAKE_RGB(0x10,0x90,0xe0), //light blue
573   MAKE_RGB(0xf0,0x70,0x90), //pink
574   MAKE_RGB(0x80,0x80,0x80) //gray
575};
576#endif
577
578595static PALETTE_INIT( smc777 )
579596{
580597   int i;
r8571r8572
585602
586603      if((i & 0x01) == 0x01)
587604      {
588         r = ((i >> 2) & 1) ? 0xff : 0x00;
589         g = ((i >> 3) & 1) ? 0xff : 0x00;
605         r = ((i >> 3) & 1) ? 0xff : 0x00;
606         g = ((i >> 2) & 1) ? 0xff : 0x00;
590607         b = ((i >> 1) & 1) ? 0xff : 0x00;
591608      }
592609      else { r = g = b = 0x00; }
593610
594611      palette_set_color_rgb(machine, i, r,g,b);
595612   }
596
597//   for(i=0;i<0x10;i++)
598//      palette_set_color(machine, 0x10+i,defcolors[i]);
599613}
600614
601615static const wd17xx_interface smc777_mb8876_interface =
r8571r8572
613627      SECTORS([16])
614628      SECTOR_LENGTH([256])
615629      FIRST_SECTOR_ID([1]))
630   /* TODO */
631   FLOPPY_OPTION( img, "1dd", "SMC777 disk image", basicdsk_identify_default, basicdsk_construct_default,
632      HEADS([2])
633      TRACKS([64])
634      SECTORS([16])
635      SECTOR_LENGTH([128])
636      FIRST_SECTOR_ID([1]))
616637FLOPPY_OPTIONS_END
617638
618639static const floppy_config smc777_floppy_config =

Previous 15994 Revisions Next


© 1998-2018 The MESS Team