Previous 15994 Revisions Next

r7655 Saturday 27th March, 2010 at 18:28:51 UTC by Angelo Salese
[MZ2500]: A bunch of video features hooked up
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r7654r7655
77    memory map:
88
99    0x00000-0x3ffff Work RAM
10    0x40000-0x5ffff CG RAM (bitswapped!)
10    0x40000-0x5ffff CG RAM (address bitswapped?)
1111    0x60000-0x67fff "Read modify write" area (related to the CG RAM)
1212    0x68000-0x6ffff IPL ROM
1313    0x70000-0x71fff TVRAM
r7654r7655
2222
2323#include "emu.h"
2424#include "cpu/z80/z80.h"
25#include "machine/z80pio.h"
2526
2627/* machine stuff */
2728static UINT8 bank_val[8],bank_addr;
r7654r7655
2930
3031/* video stuff*/
3132static UINT8 text_reg[0x100], text_reg_index;
33static UINT8 text_col_size, text_font_reg;
3234
3335static VIDEO_START( mz2500 )
3436{
r7654r7655
4244
4345   count = 0x70000;
4446
45   for (y=0;y<32;y+=2)
47   if(text_font_reg)
4648   {
47      for (x=0;x<32;x++)
49      for (y=0;y<25;y++)
4850      {
49         int tile = vram[count+0x000] & 0xfe;
50         //int attr = vram[count+0x800];
51         int tile_bank = vram[count+0x1000] & 0x3f;
51         for (x=0;x<text_col_size;x++)
52         {
53            int tile = vram[count+0x0000] & 0xff;
54            //int attr = vram[count+0x800];
55            int tile_bank = vram[count+0x1000] & 0x3f;
5256
53         tile|= tile_bank << 8;
57            tile|= tile_bank << 8;
5458
55         drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,(y)*8);
56         drawgfx_opaque(bitmap,cliprect,gfx,tile+1,0,0,0,x*8,(y+1)*8);
59            drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,(y)*8);
5760
58         count++;
61            count++;
62         }
5963      }
6064   }
65   else
66   {
67      for (y=0;y<25;y+=2)
68      {
69         for (x=0;x<text_col_size;x++)
70         {
71            int tile = vram[count+0x0000] & 0xfe;
72            //int attr = vram[count+0x800];
73            int tile_bank = vram[count+0x1000] & 0x3f;
6174
75            tile|= tile_bank << 8;
6276
77            drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,(y)*8);
78            drawgfx_opaque(bitmap,cliprect,gfx,tile+1,0,0,0,x*8,(y+1)*8);
79
80            count++;
81         }
82      }
83   }
84
6385    return 0;
6486}
6587
r7654r7655
123145      case 2: /* CG MASK reg */ break;
124146      case 3:
125147         /* Font size reg */
126         printf("%02x FONT\n",data);
148         text_font_reg = data & 1;
127149         break;
128150   }
129151}
r7654r7655
159181ADDRESS_MAP_END
160182
161183#if 0
162
163184static READ8_HANDLER( kludge_r )
164185{
165186   return mame_rand(space->machine);
r7654r7655
185206   AM_RANGE(0xc6, 0xc6) AM_WRITE(mz2500_irq_sel_w)
186207   AM_RANGE(0xc7, 0xc7) AM_WRITE(mz2500_irq_data_w)
187208//   AM_RANGE(0xc8, 0xc9) AM_READWRITE(opn_r,opn_w)
209//   AM_RANGE(0xc8, 0xc9) AM_READ(kludge_r)
188210//   AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w)
189211//   AM_RANGE(0xcc, 0xcc) AM_READWRITE(calendar_r,calendar_w)
190212//   AM_RANGE(0xce, 0xcf) AM_WRITE(memory_w)
191213//   AM_RANGE(0xd8, 0xdb) AM_READWRITE(fdc_r,fdc_w)
192214//   AM_RANGE(0xdc, 0xdd) AM_WRITE(floppy_w)
193//   AM_RANGE(0xe0, 0xe3) AM_READWRITE(pio0_r,pio0_w)
215   AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("z80pio_0",z80pio_cd_ba_r,z80pio_cd_ba_w)
194216//   AM_RANGE(0xe4, 0xe7) AM_READWRITE(pit_r,pit_w)
195//   AM_RANGE(0xe8, 0xeb) AM_READWRITE(pio1_r,pio1_w)
217   AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1",z80pio_cd_ba_r,z80pio_cd_ba_w)
196218//   AM_RANGE(0xef, 0xef) AM_READWRITE(joystick_r,joystick_w)
197219//   AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w)
198220   AM_RANGE(0xf4, 0xf7) AM_READ(mz2500_crtc_r) AM_WRITE(mz2500_crtc_w)
r7654r7655
227249   memory_set_bankptr(machine, "bank7", &ROM[bank_val[7]*0x2000]);
228250
229251   irq_vector[0] = 0xef; /* RST 28h - vblank */
252
253   text_col_size = 40;
254   text_font_reg = 0;
230255}
231256
232257static const gfx_layout mz2500_cg_layout =
r7654r7655
274299   cpu_set_input_line_and_vector(device, 0, HOLD_LINE, irq_vector[0]);
275300}
276301
302static WRITE8_DEVICE_HANDLER( mz2500_pio1_porta_w )
303{
304//   printf("%02x\n",data);
305   text_col_size = (data & 0x20) ? 80 : 40;
306}
307
308static Z80PIO_INTERFACE( mz2500_pio0_intf )
309{
310   DEVCB_NULL, //irq handler
311   DEVCB_NULL, //port a r
312   DEVCB_NULL, //port a w
313   DEVCB_NULL, //port a ardy
314   DEVCB_NULL, //port b r
315   DEVCB_NULL, //port b w
316   DEVCB_NULL  //port b ardy
317};
318
319static Z80PIO_INTERFACE( mz2500_pio1_intf )
320{
321   DEVCB_NULL,
322   DEVCB_NULL,
323   DEVCB_HANDLER( mz2500_pio1_porta_w ),
324   DEVCB_NULL,
325   DEVCB_NULL,
326   DEVCB_NULL,
327   DEVCB_NULL
328};
329
330
277331static MACHINE_DRIVER_START( mz2500 )
278332    /* basic machine hardware */
279333    MDRV_CPU_ADD("maincpu", Z80, 6000000)
r7654r7655
283337
284338    MDRV_MACHINE_RESET(mz2500)
285339
340   MDRV_Z80PIO_ADD( "z80pio_0", 6000000/4, mz2500_pio0_intf ) // unknown clock / divider
341   MDRV_Z80PIO_ADD( "z80pio_1", 6000000/4, mz2500_pio1_intf )
342
286343   /* video hardware */
287344   MDRV_SCREEN_ADD("screen", RASTER)
288345   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team