Previous 15994 Revisions Next

r8914 Friday 27th August, 2010 at 00:10:25 UTC by Angelo Salese
[MZ2500]: Added color attribute and used custom drawing code, now bios text is drawn with white
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r8913r8914
2020
2121    after some time, clear work ram [$919] to 0 ... something to do with irqs?
2222
23    currently emulation speed crawls a lot when you use the debugger,
24    comment out lines 983/984 of emu/memory.c for the time being.
25
2623****************************************************************************/
2724
2825#include "emu.h"
r8913r8914
5249static VIDEO_UPDATE( mz2500 )
5350{
5451   UINT8 *vram = memory_region(screen->machine, "maincpu");
55   int x,y,count;
52   int x,y,count,xi,yi;
5653//  gfx_element *gfx;// = screen->machine->gfx[0];
54   UINT8 *gfx_data;// = pcg_bank ? memory_region(machine, "pcg") : memory_region(machine, "cgrom");
5755
5856   count = 0x70000;
5957
r8913r8914
6462         for (x=0;x<text_col_size;x++)
6563         {
6664            int tile = vram[count+0x0000] & 0xff;
67            int attr = vram[count+0x800];
65            int attr = vram[count+0x0800];
6866            int tile_bank = vram[count+0x1000] & 0x3f;
6967            int gfx_sel = (attr & 0x38) | (vram[count+0x1000] & 0xc0);
70            int gfx_num;
68            //int gfx_num;
69            int color = attr & 7;
7170
7271            if(gfx_sel == 0x00)
73               gfx_num = 3;
72               gfx_data = memory_region(screen->machine,"pcg");
7473            else
75               gfx_num = 0; //TODO
74               gfx_data = memory_region(screen->machine,"kanji"); //TODO
7675
7776            tile|= tile_bank << 8;
7877
79            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_num],tile,0,0,0,x*8,(y)*8);
78            for(yi=0;yi<8;yi++)
79            {
80               for(xi=0;xi<8;xi++)
81               {
82                  UINT8 pen;
8083
84                  pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? color : 0;
85
86                  *BITMAP_ADDR16(bitmap, (y*8+yi), x*8+xi) = screen->machine->pens[pen];
87               }
88            }
89            //drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_num],tile,color,0,0,x*8,(y)*8);
90
8191            count++;
8292         }
8393      }
r8913r8914
92102            int attr = vram[count+0x800];
93103            int tile_bank = vram[count+0x1000] & 0x3f;
94104            int gfx_sel = (attr & 0x38) | (vram[count+0x1000] & 0xc0);
95            int gfx_num;
105            //int gfx_num;
106            int color = attr & 7;
96107
97108            if(gfx_sel == 0x00)
98               gfx_num = 3;
109               gfx_data = memory_region(screen->machine,"pcg");
99110            else
100               gfx_num = 0; //TODO
111               gfx_data = memory_region(screen->machine,"kanji"); //TODO
101112
102113            tile|= tile_bank << 8;
103114
104            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_num],tile,0,0,0,x*8,(y)*8);
105            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_num],tile+1,0,0,0,x*8,(y+1)*8);
115            for(yi=0;yi<16;yi++)
116            {
117               for(xi=0;xi<8;xi++)
118               {
119                  UINT8 pen;
106120
121                  pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? color : 0;
122
123                  *BITMAP_ADDR16(bitmap, (y*8+yi), x*8+xi) = screen->machine->pens[pen];
124               }
125            }
126
127//            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_num],tile,color,0,0,x*8,(y)*8);
128//            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[gfx_num],tile+1,color,0,0,x*8,(y+1)*8);
129
107130            count++;
108131         }
109132      }
r8913r8914
651674   NULL
652675};
653676
677static PALETTE_INIT( mz2500 )
678{
679   int i;
680   for(i=0;i<8;i++)
681      palette_set_color_rgb(machine, i,pal1bit((i & 2)>>1),pal1bit((i & 4)>>2),pal1bit((i & 1)>>0));
682
683}
684
654685static MACHINE_DRIVER_START( mz2500 )
655686    /* basic machine hardware */
656687    MDRV_CPU_ADD("maincpu", Z80, 6000000)
r8913r8914
660691
661692    MDRV_MACHINE_RESET(mz2500)
662693
663   MDRV_Z80PIO_ADD( "z80pio_0", 6000000/4, mz2500_pio0_intf ) // unknown clock / divider
664   MDRV_Z80PIO_ADD( "z80pio_1", 6000000/4, mz2500_pio1_intf )
694   MDRV_Z80PIO_ADD( "z80pio_0", 6000000, mz2500_pio0_intf ) // unknown clock / divider
695   MDRV_Z80PIO_ADD( "z80pio_1", 6000000, mz2500_pio1_intf )
665696
666697   MDRV_MB8877_ADD("mb8877a",mz2500_mb8877a_interface)
667698   MDRV_FLOPPY_4_DRIVES_ADD(mz2500_floppy_config)
r8913r8914
671702   MDRV_SCREEN_ADD("screen", RASTER)
672703   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
673704   MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz/2, 568, 0, 40*8, 312, 0, 25*8)
674   MDRV_PALETTE_LENGTH(256*2)
675//  MDRV_PALETTE_INIT(black_and_white)
705   MDRV_PALETTE_LENGTH(8) // TODO: it needs more than this
706   MDRV_PALETTE_INIT(mz2500)
676707
677708   MDRV_GFXDECODE(mz2500)
678709

Previous 15994 Revisions Next


© 1998-2018 The MESS Team