src/mess/drivers/mz2500.c
| r7654 | r7655 | |
| 7 | 7 | memory map: |
| 8 | 8 | |
| 9 | 9 | 0x00000-0x3ffff Work RAM |
| 10 | | 0x40000-0x5ffff CG RAM (bitswapped!) |
| 10 | 0x40000-0x5ffff CG RAM (address bitswapped?) |
| 11 | 11 | 0x60000-0x67fff "Read modify write" area (related to the CG RAM) |
| 12 | 12 | 0x68000-0x6ffff IPL ROM |
| 13 | 13 | 0x70000-0x71fff TVRAM |
| r7654 | r7655 | |
| 22 | 22 | |
| 23 | 23 | #include "emu.h" |
| 24 | 24 | #include "cpu/z80/z80.h" |
| 25 | #include "machine/z80pio.h" |
| 25 | 26 | |
| 26 | 27 | /* machine stuff */ |
| 27 | 28 | static UINT8 bank_val[8],bank_addr; |
| r7654 | r7655 | |
| 29 | 30 | |
| 30 | 31 | /* video stuff*/ |
| 31 | 32 | static UINT8 text_reg[0x100], text_reg_index; |
| 33 | static UINT8 text_col_size, text_font_reg; |
| 32 | 34 | |
| 33 | 35 | static VIDEO_START( mz2500 ) |
| 34 | 36 | { |
| r7654 | r7655 | |
| 42 | 44 | |
| 43 | 45 | count = 0x70000; |
| 44 | 46 | |
| 45 | | for (y=0;y<32;y+=2) |
| 47 | if(text_font_reg) |
| 46 | 48 | { |
| 47 | | for (x=0;x<32;x++) |
| 49 | for (y=0;y<25;y++) |
| 48 | 50 | { |
| 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; |
| 52 | 56 | |
| 53 | | tile|= tile_bank << 8; |
| 57 | tile|= tile_bank << 8; |
| 54 | 58 | |
| 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); |
| 57 | 60 | |
| 58 | | count++; |
| 61 | count++; |
| 62 | } |
| 59 | 63 | } |
| 60 | 64 | } |
| 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; |
| 61 | 74 | |
| 75 | tile|= tile_bank << 8; |
| 62 | 76 | |
| 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 | |
| 63 | 85 | return 0; |
| 64 | 86 | } |
| 65 | 87 | |
| r7654 | r7655 | |
| 123 | 145 | case 2: /* CG MASK reg */ break; |
| 124 | 146 | case 3: |
| 125 | 147 | /* Font size reg */ |
| 126 | | printf("%02x FONT\n",data); |
| 148 | text_font_reg = data & 1; |
| 127 | 149 | break; |
| 128 | 150 | } |
| 129 | 151 | } |
| r7654 | r7655 | |
| 159 | 181 | ADDRESS_MAP_END |
| 160 | 182 | |
| 161 | 183 | #if 0 |
| 162 | | |
| 163 | 184 | static READ8_HANDLER( kludge_r ) |
| 164 | 185 | { |
| 165 | 186 | return mame_rand(space->machine); |
| r7654 | r7655 | |
| 185 | 206 | AM_RANGE(0xc6, 0xc6) AM_WRITE(mz2500_irq_sel_w) |
| 186 | 207 | AM_RANGE(0xc7, 0xc7) AM_WRITE(mz2500_irq_data_w) |
| 187 | 208 | // AM_RANGE(0xc8, 0xc9) AM_READWRITE(opn_r,opn_w) |
| 209 | // AM_RANGE(0xc8, 0xc9) AM_READ(kludge_r) |
| 188 | 210 | // AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w) |
| 189 | 211 | // AM_RANGE(0xcc, 0xcc) AM_READWRITE(calendar_r,calendar_w) |
| 190 | 212 | // AM_RANGE(0xce, 0xcf) AM_WRITE(memory_w) |
| 191 | 213 | // AM_RANGE(0xd8, 0xdb) AM_READWRITE(fdc_r,fdc_w) |
| 192 | 214 | // 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) |
| 194 | 216 | // 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) |
| 196 | 218 | // AM_RANGE(0xef, 0xef) AM_READWRITE(joystick_r,joystick_w) |
| 197 | 219 | // AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w) |
| 198 | 220 | AM_RANGE(0xf4, 0xf7) AM_READ(mz2500_crtc_r) AM_WRITE(mz2500_crtc_w) |
| r7654 | r7655 | |
| 227 | 249 | memory_set_bankptr(machine, "bank7", &ROM[bank_val[7]*0x2000]); |
| 228 | 250 | |
| 229 | 251 | irq_vector[0] = 0xef; /* RST 28h - vblank */ |
| 252 | |
| 253 | text_col_size = 40; |
| 254 | text_font_reg = 0; |
| 230 | 255 | } |
| 231 | 256 | |
| 232 | 257 | static const gfx_layout mz2500_cg_layout = |
| r7654 | r7655 | |
| 274 | 299 | cpu_set_input_line_and_vector(device, 0, HOLD_LINE, irq_vector[0]); |
| 275 | 300 | } |
| 276 | 301 | |
| 302 | static WRITE8_DEVICE_HANDLER( mz2500_pio1_porta_w ) |
| 303 | { |
| 304 | // printf("%02x\n",data); |
| 305 | text_col_size = (data & 0x20) ? 80 : 40; |
| 306 | } |
| 307 | |
| 308 | static 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 | |
| 319 | static 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 | |
| 277 | 331 | static MACHINE_DRIVER_START( mz2500 ) |
| 278 | 332 | /* basic machine hardware */ |
| 279 | 333 | MDRV_CPU_ADD("maincpu", Z80, 6000000) |
| r7654 | r7655 | |
| 283 | 337 | |
| 284 | 338 | MDRV_MACHINE_RESET(mz2500) |
| 285 | 339 | |
| 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 | |
| 286 | 343 | /* video hardware */ |
| 287 | 344 | MDRV_SCREEN_ADD("screen", RASTER) |
| 288 | 345 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |