Previous 15994 Revisions Next

r8571 Wednesday 21st July, 2010 at 14:29:39 UTC by Angelo Salese
[SMC-777]: Implemented preliminary RAMDAC
[src/mess/drivers]smc777.c

src/mess/drivers/smc777.c
r8570r8571
99      guesses ...
1010    - video emulation is just hacked up together to show something simple,
1111      dunno yet how it really works.
12    - Drop M6845 support and write custom code in place of it.
12   - BEEP pitch is horrible
1313
1414****************************************************************************/
1515
1616#include "emu.h"
1717#include "cpu/z80/z80.h"
1818#include "sound/sn76496.h"
19#include "sound/beep.h"
1920#include "video/mc6845.h"
2021
2122#include "machine/wd17xx.h"
r8570r8571
4849   {
4950      for(y=0;y<200;y+=8)
5051      {
51         for(x=0;x<640;x+=4)
52         for(x=0;x<160;x++)
5253         {
5354            static UINT16 color;
5455
5556            color = (gram[count] & 0xf0) >> 4;
56            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+0+CRTC_MIN_X) = screen->machine->pens[color+0x10];
57            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+1+CRTC_MIN_X) = screen->machine->pens[color+0x10];
57            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = screen->machine->pens[color+0x10];
58            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = screen->machine->pens[color+0x10];
5859
5960            color = (gram[count] & 0x0f) >> 0;
60            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+2+CRTC_MIN_X) = screen->machine->pens[color+0x10];
61            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+3+CRTC_MIN_X) = screen->machine->pens[color+0x10];
61            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = screen->machine->pens[color+0x10];
62            *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = screen->machine->pens[color+0x10];
6263
6364            count++;
65
6466         }
6567      }
66//      count+= 48;
67
68      count+= 0x60;
6869   }
6970
7071   count = 0x0000;
r8570r8571
286287   backdrop_pen = data & 0xf;
287288}
288289
290static UINT8 system_data;
289291
292static READ8_HANDLER( system_input_r )
293{
294   return system_data;
295}
296
297static WRITE8_HANDLER( system_output_w )
298{
299   /*
300   ---x --- beep
301   all the rest is unknown at current time
302   */
303   system_data = data;
304   beep_set_state(space->machine->device("beeper"),data & 0x10);
305}
306
307static READ8_HANDLER( unk_r )
308{
309   return 0;
310}
311
312static WRITE8_HANDLER( smc777_ramdac_w )
313{
314   static UINT8 pal_index,gradient_index,r,g,b;
315   pal_index = cpu_get_reg(space->machine->device("maincpu"), Z80_B) & 0xf;
316   gradient_index = (cpu_get_reg(space->machine->device("maincpu"), Z80_B) & 0x30) >> 4;
317
318   switch(gradient_index)
319   {
320      case 0: r = data; palette_set_color_rgb(space->machine, pal_index+0x10, r,g,b); break;
321      case 1: g = data; palette_set_color_rgb(space->machine, pal_index+0x10, r,g,b); break;
322      case 2: b = data; palette_set_color_rgb(space->machine, pal_index+0x10, r,g,b); break;
323   }
324}
325
290326static ADDRESS_MAP_START(smc777_mem, ADDRESS_SPACE_PROGRAM, 8)
291327   ADDRESS_MAP_UNMAP_HIGH
292328   AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITE(smc777_rom_w)
r8570r8571
301337   AM_RANGE(0x10, 0x17) AM_READWRITE(smc777_pcg_r, smc777_pcg_w)
302338   AM_RANGE(0x18, 0x19) AM_WRITE(smc777_6845_w)
303339   AM_RANGE(0x1a, 0x1b) AM_READ(key_r) AM_WRITENOP//keyboard data
304//   AM_RANGE(0x1c, 0x1c) AM_WRITENOP //status and control data / Printer strobe
340   AM_RANGE(0x1c, 0x1c) AM_READWRITE(system_input_r,system_output_w) //status and control data / Printer strobe
305341//   AM_RANGE(0x1d, 0x1d) AM_WRITENOP //status and control data / Printer status / strobe
306342//   AM_RANGE(0x1e, 0x1f) AM_WRITENOP //RS232C irq control
307343//   AM_RANGE(0x20, 0x20) AM_WRITENOP //display mode switching
r8570r8571
321357//   AM_RANGE(0x3c, 0x3d) AM_NOP //RGB Superimposer
322358//   AM_RANGE(0x40, 0x47) AM_NOP //IEEE-488 interface unit
323359//   AM_RANGE(0x48, 0x50) AM_NOP //HDD (Winchester)
360   AM_RANGE(0x51, 0x51) AM_READ(unk_r)
361   AM_RANGE(0x52, 0x52) AM_WRITE(smc777_ramdac_w)
324362//   AM_RANGE(0x54, 0x59) AM_NOP //VTR Controller
325363   AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn1", sn76496_w) //not in the datasheet ... almost certainly SMC-777 specific
326364//   AM_RANGE(0x5a, 0x5b) AM_WRITENOP //RAM banking
r8570r8571
477515static MACHINE_START(smc777)
478516{
479517   timer_pulse(machine, ATTOTIME_IN_HZ(240/32), NULL, 0, keyboard_callback);
518   beep_set_frequency(machine->device("beeper"),300); //guesswork
519   beep_set_state(machine->device("beeper"),0);
480520}
481521
482522static MACHINE_RESET(smc777)
r8570r8571
512552   NULL      /* update address callback */
513553};
514554
555#if 0
515556static const rgb_t defcolors[]=
516557{
517558   MAKE_RGB(0x00,0x00,0x00),
r8570r8571
532573   MAKE_RGB(0xf0,0x70,0x90), //pink
533574   MAKE_RGB(0x80,0x80,0x80) //gray
534575};
576#endif
535577
536578static PALETTE_INIT( smc777 )
537579{
r8570r8571
552594      palette_set_color_rgb(machine, i, r,g,b);
553595   }
554596
555   for(i=0;i<0x10;i++)
556      palette_set_color(machine, 0x10+i,defcolors[i]);
597//   for(i=0;i<0x10;i++)
598//      palette_set_color(machine, 0x10+i,defcolors[i]);
557599}
558600
559601static const wd17xx_interface smc777_mb8876_interface =
r8570r8571
618660
619661   MDRV_SOUND_ADD("sn1", SN76489A, 1996800) // unknown clock / divider
620662   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
663
664   MDRV_SOUND_ADD("beeper", BEEP, 0)
665   MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50)
621666MACHINE_DRIVER_END
622667
623668/* ROM definition */
r8570r8571
637682/* Driver */
638683
639684/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS */
640COMP( 1983, smc777,  0,       0,    smc777,    smc777,     0,  "Sony",   "SMC-777",      GAME_NOT_WORKING | GAME_NO_SOUND)
685COMP( 1983, smc777,  0,       0,    smc777,    smc777,     0,  "Sony",   "SMC-777",      GAME_NOT_WORKING | GAME_IMPERFECT_SOUND)
641686

Previous 15994 Revisions Next


© 1998-2018 The MESS Team