Previous 15994 Revisions Next

r8556 Wednesday 21st July, 2010 at 02:31:52 UTC by Angelo Salese
[SMC777]: Improved video emulation, added PCG hook-up, documented most of the memory map
[src/mess/drivers]smc777.c

src/mess/drivers/smc777.c
r8555r8556
2828{
2929   int x,y,count;
3030   static UINT8 *vram = memory_region(screen->machine, "vram");
31//   static UINT8 *attr = memory_region(screen->machine, "attr");
31   static UINT8 *attr = memory_region(screen->machine, "attr");
3232
3333   count = 0x0000;
3434
r8555r8556
3636   {
3737      for(x=0;x<40;x++)
3838      {
39         int tile = vram[count] | 0x80;
40//         int color = attr[count];
39         int tile = vram[count];
40         int color = attr[count] & 7;
4141
42         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,0,0,0,x*8,y*8);
42         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8);
4343
4444         if(((cursor_addr) == count) && screen->machine->primary_screen->frame_number() & 0x10) // draw cursor
45            drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x107,0,0,0,x*8,y*8,0);
45            drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x87,7,0,0,x*8,y*8,0);
4646
4747
4848         count+=2;
r8555r8556
7878   }
7979}
8080
81static READ8_HANDLER( smc777_vram_r )
82{
83   static UINT8 *vram = memory_region(space->machine, "vram");
84   static UINT16 vram_index;
85
86   vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B);
87
88   return vram[vram_index | offset*0x100];
89}
90
91static READ8_HANDLER( smc777_attr_r )
92{
93   static UINT8 *attr = memory_region(space->machine, "attr");
94   static UINT16 vram_index;
95
96   vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B);
97
98   return attr[vram_index | offset*0x100];
99}
100
101static READ8_HANDLER( smc777_pcg_r )
102{
103   static UINT8 *pcg = memory_region(space->machine, "pcg");
104   static UINT16 vram_index;
105
106   vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B);
107
108   return pcg[vram_index | offset*0x100];
109}
110
81111static WRITE8_HANDLER( smc777_vram_w )
82112{
83113   static UINT8 *vram = memory_region(space->machine, "vram");
r8555r8556
98128   attr[vram_index | offset*0x100] = data;
99129}
100130
131static WRITE8_HANDLER( smc777_pcg_w )
132{
133   static UINT8 *pcg = memory_region(space->machine, "pcg");
134   static UINT16 vram_index;
135
136   vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B);
137
138   pcg[vram_index | offset*0x100] = data;
139
140    gfx_element_mark_dirty(space->machine->gfx[0], vram_index >> 3);
141}
142
143static READ8_HANDLER( smc777_fbuf_r )
144{
145   static UINT8 *fbuf = memory_region(space->machine, "fbuf");
146   static UINT16 vram_index;
147
148   vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B);
149
150   return fbuf[vram_index | offset*0x100];
151}
152
153static WRITE8_HANDLER( smc777_fbuf_w )
154{
155   static UINT8 *fbuf = memory_region(space->machine, "fbuf");
156   static UINT16 vram_index;
157
158   vram_index = cpu_get_reg(devtag_get_device(space->machine, "maincpu"), Z80_B);
159
160   fbuf[vram_index | offset*0x100] = data;
161}
162
101163static ADDRESS_MAP_START(smc777_mem, ADDRESS_SPACE_PROGRAM, 8)
102164   ADDRESS_MAP_UNMAP_HIGH
103165   AM_RANGE(0x0000, 0x3fff) AM_ROM
r8555r8556
107169static ADDRESS_MAP_START( smc777_io , ADDRESS_SPACE_IO, 8)
108170   ADDRESS_MAP_UNMAP_HIGH
109171   ADDRESS_MAP_GLOBAL_MASK(0xff)
110   AM_RANGE(0x00, 0x07) AM_WRITE(smc777_vram_w)
111   AM_RANGE(0x08, 0x0f) AM_WRITE(smc777_attr_w)
112   AM_RANGE(0x10, 0x17) AM_WRITENOP //PCG data is written there, in a backwards fashion???
172   AM_RANGE(0x00, 0x07) AM_READWRITE(smc777_vram_r,smc777_vram_w)
173   AM_RANGE(0x08, 0x0f) AM_READWRITE(smc777_attr_r,smc777_attr_w)
174   AM_RANGE(0x10, 0x17) AM_READWRITE(smc777_pcg_r, smc777_pcg_w)
113175   AM_RANGE(0x18, 0x19) AM_WRITE(smc777_6845_w)
114   AM_RANGE(0x1b, 0x1b) AM_READ(test_r) //presumably video related
115//   AM_RANGE(0x1c, 0x1c) AM_WRITENOP //???
116//   AM_RANGE(0x30, 0x37) AM_NOP //fdc, wd1793?
117   AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn1", sn76496_w)
118//   AM_RANGE(0x80, 0xff) AM_WRITENOP //cleared with the same backwards fashion as the vram / PCG data, bitmap?
176   AM_RANGE(0x1a, 0x1b) AM_READ(test_r) AM_WRITENOP//keyboard data
177//   AM_RANGE(0x1c, 0x1c) AM_WRITENOP //status and control data / Printer strobe
178//   AM_RANGE(0x1d, 0x1d) AM_WRITENOP //status and control data / Printer status / strobe
179//   AM_RANGE(0x1e, 0x1f) AM_WRITENOP //RS232C irq control
180//   AM_RANGE(0x20, 0x20) AM_WRITENOP //display mode switching
181//   AM_RANGE(0x21, 0x21) AM_WRITENOP //60 Hz irq control
182//   AM_RANGE(0x22, 0x22) AM_WRITENOP //printer output data
183//   AM_RANGE(0x23, 0x23) AM_WRITENOP //border area control
184//   AM_RANGE(0x24, 0x24) AM_WRITENOP //Timer write / specify address (RTC?)
185//   AM_RANGE(0x25, 0x25) AM_READNOP  //Timer read (RTC?)
186//   AM_RANGE(0x26, 0x26) AM_WRITENOP //RS232C RX / TX
187//   AM_RANGE(0x27, 0x27) AM_WRITENOP //RS232C Mode / Command / Status
188
189//   AM_RANGE(0x28, 0x2c) AM_NOP //fdc 2, MB8876 -> FD1791
190//   AM_RANGE(0x2d, 0x2f) AM_NOP //rs-232c no. 2
191//   AM_RANGE(0x30, 0x34) AM_NOP //fdc 1, MB8876 -> FD1791
192//   AM_RANGE(0x35, 0x37) AM_NOP //rs-232c no. 3
193//   AM_RANGE(0x38, 0x3b) AM_NOP //cache disk unit
194//   AM_RANGE(0x3c, 0x3d) AM_NOP //RGB Superimposer
195//   AM_RANGE(0x40, 0x47) AM_NOP //IEEE-488 interface unit
196//   AM_RANGE(0x48, 0x50) AM_NOP //HDD (Winchester)
197//   AM_RANGE(0x54, 0x59) AM_NOP //VTR Controller
198   AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn1", sn76496_w) //not in the datasheet ... almost certainly SMC-777 specific
199//   AM_RANGE(0x5a, 0x5b) AM_WRITENOP //RAM banking
200//   AM_RANGE(0x70, 0x70) AM_NOP //Auto Start ROM
201//   AM_RANGE(0x74, 0x74) AM_NOP //IEEE-488 ROM
202//   AM_RANGE(0x75, 0x75) AM_NOP //VTR Controller ROM
203   AM_RANGE(0x80, 0xff) AM_READWRITE(smc777_fbuf_r, smc777_fbuf_w) //GRAM
119204ADDRESS_MAP_END
120205
121206/* Input ports */
r8555r8556
128213}
129214
130215
131/* F4 Character Displayer */
132216static const gfx_layout smc777_charlayout =
133217{
134   8, 8,               /* 8 x 8 characters */
135   RGN_FRAC(1,1),               /* 320 characters */
136   1,               /* 1 bits per pixel */
137   { 0 },               /* no bitplanes */
138   /* x offsets */
218   8, 8,
219   RGN_FRAC(1,1),
220   1,
221   { 0 },
139222   { 0, 1, 2, 3, 4, 5, 6, 7 },
140   /* y offsets */
141223   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
142   8*8               /* every char takes 8 bytes */
224   8*8
143225};
144226
145227static GFXDECODE_START( smc777 )
146   GFXDECODE_ENTRY( "maincpu", 0x0000, smc777_charlayout, 0, 1 )
228   GFXDECODE_ENTRY( "pcg", 0x0000, smc777_charlayout, 0, 8 )
147229GFXDECODE_END
148230
149231static const mc6845_interface mc6845_intf =
r8555r8556
160242   NULL      /* update address callback */
161243};
162244
245static PALETTE_INIT( smc777 )
246{
247   int i;
163248
249   for (i = 0x000; i < 0x010; i++)
250   {
251      UINT8 r,g,b;
252
253      if((i & 0x01) == 0x01)
254      {
255         r = ((i >> 2) & 1) ? 0xff : 0x00;
256         g = ((i >> 3) & 1) ? 0xff : 0x00;
257         b = ((i >> 1) & 1) ? 0xff : 0x00;
258      }
259      else { r = g = b = 0x00; }
260
261      palette_set_color_rgb(machine, i, r,g,b);
262   }
263}
264
164265static MACHINE_DRIVER_START( smc777 )
165266    /* basic machine hardware */
166    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
267    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) //4,028 Mhz!
167268    MDRV_CPU_PROGRAM_MAP(smc777_mem)
168269    MDRV_CPU_IO_MAP(smc777_io)
169270
r8555r8556
176277    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
177278    MDRV_SCREEN_SIZE(640, 200)
178279    MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1)
179    MDRV_PALETTE_LENGTH(2)
180    MDRV_PALETTE_INIT(black_and_white)
280    MDRV_PALETTE_LENGTH(0x10)
281    MDRV_PALETTE_INIT(smc777)
181282   MDRV_GFXDECODE(smc777)
182283
183284   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/2, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
r8555r8556
196297    ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
197298   ROM_LOAD( "smcrom.dat", 0x0000, 0x4000, CRC(b2520d31) SHA1(3c24b742c38bbaac85c0409652ba36e20f4687a1))
198299
199    ROM_REGION( 0x2000, "vram", ROMREGION_ERASE00 )
300    ROM_REGION( 0x800, "vram", ROMREGION_ERASE00 )
200301
201    ROM_REGION( 0x2000, "attr", ROMREGION_ERASE00 )
302    ROM_REGION( 0x800, "attr", ROMREGION_ERASE00 )
202303
304    ROM_REGION( 0x800, "pcg", ROMREGION_ERASE00 )
305
306    ROM_REGION( 0x8000,"fbuf", ROMREGION_ERASE00 )
203307ROM_END
204308
205309/* Driver */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team