src/mess/drivers/mz2500.c
| r8913 | r8914 | |
| 20 | 20 | |
| 21 | 21 | after some time, clear work ram [$919] to 0 ... something to do with irqs? |
| 22 | 22 | |
| 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 | | |
| 26 | 23 | ****************************************************************************/ |
| 27 | 24 | |
| 28 | 25 | #include "emu.h" |
| r8913 | r8914 | |
| 52 | 49 | static VIDEO_UPDATE( mz2500 ) |
| 53 | 50 | { |
| 54 | 51 | UINT8 *vram = memory_region(screen->machine, "maincpu"); |
| 55 | | int x,y,count; |
| 52 | int x,y,count,xi,yi; |
| 56 | 53 | // gfx_element *gfx;// = screen->machine->gfx[0]; |
| 54 | UINT8 *gfx_data;// = pcg_bank ? memory_region(machine, "pcg") : memory_region(machine, "cgrom"); |
| 57 | 55 | |
| 58 | 56 | count = 0x70000; |
| 59 | 57 | |
| r8913 | r8914 | |
| 64 | 62 | for (x=0;x<text_col_size;x++) |
| 65 | 63 | { |
| 66 | 64 | int tile = vram[count+0x0000] & 0xff; |
| 67 | | int attr = vram[count+0x800]; |
| 65 | int attr = vram[count+0x0800]; |
| 68 | 66 | int tile_bank = vram[count+0x1000] & 0x3f; |
| 69 | 67 | int gfx_sel = (attr & 0x38) | (vram[count+0x1000] & 0xc0); |
| 70 | | int gfx_num; |
| 68 | //int gfx_num; |
| 69 | int color = attr & 7; |
| 71 | 70 | |
| 72 | 71 | if(gfx_sel == 0x00) |
| 73 | | gfx_num = 3; |
| 72 | gfx_data = memory_region(screen->machine,"pcg"); |
| 74 | 73 | else |
| 75 | | gfx_num = 0; //TODO |
| 74 | gfx_data = memory_region(screen->machine,"kanji"); //TODO |
| 76 | 75 | |
| 77 | 76 | tile|= tile_bank << 8; |
| 78 | 77 | |
| 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; |
| 80 | 83 | |
| 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 | |
| 81 | 91 | count++; |
| 82 | 92 | } |
| 83 | 93 | } |
| r8913 | r8914 | |
| 92 | 102 | int attr = vram[count+0x800]; |
| 93 | 103 | int tile_bank = vram[count+0x1000] & 0x3f; |
| 94 | 104 | int gfx_sel = (attr & 0x38) | (vram[count+0x1000] & 0xc0); |
| 95 | | int gfx_num; |
| 105 | //int gfx_num; |
| 106 | int color = attr & 7; |
| 96 | 107 | |
| 97 | 108 | if(gfx_sel == 0x00) |
| 98 | | gfx_num = 3; |
| 109 | gfx_data = memory_region(screen->machine,"pcg"); |
| 99 | 110 | else |
| 100 | | gfx_num = 0; //TODO |
| 111 | gfx_data = memory_region(screen->machine,"kanji"); //TODO |
| 101 | 112 | |
| 102 | 113 | tile|= tile_bank << 8; |
| 103 | 114 | |
| 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; |
| 106 | 120 | |
| 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 | |
| 107 | 130 | count++; |
| 108 | 131 | } |
| 109 | 132 | } |
| r8913 | r8914 | |
| 651 | 674 | NULL |
| 652 | 675 | }; |
| 653 | 676 | |
| 677 | static 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 | |
| 654 | 685 | static MACHINE_DRIVER_START( mz2500 ) |
| 655 | 686 | /* basic machine hardware */ |
| 656 | 687 | MDRV_CPU_ADD("maincpu", Z80, 6000000) |
| r8913 | r8914 | |
| 660 | 691 | |
| 661 | 692 | MDRV_MACHINE_RESET(mz2500) |
| 662 | 693 | |
| 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 ) |
| 665 | 696 | |
| 666 | 697 | MDRV_MB8877_ADD("mb8877a",mz2500_mb8877a_interface) |
| 667 | 698 | MDRV_FLOPPY_4_DRIVES_ADD(mz2500_floppy_config) |
| r8913 | r8914 | |
| 671 | 702 | MDRV_SCREEN_ADD("screen", RASTER) |
| 672 | 703 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 673 | 704 | 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) |
| 676 | 707 | |
| 677 | 708 | MDRV_GFXDECODE(mz2500) |
| 678 | 709 | |