src/mess/video/fmtowns.c
| r7465 | r7466 | |
| 369 | 369 | */ |
| 370 | 370 | READ8_HANDLER(towns_video_440_r) |
| 371 | 371 | { |
| 372 | UINT8 ret = 0; |
| 373 | UINT16 xpos,ypos; |
| 374 | |
| 372 | 375 | switch(offset) |
| 373 | 376 | { |
| 374 | 377 | case 0x00: |
| 375 | 378 | return towns_crtc_sel; |
| 376 | 379 | case 0x02: |
| 377 | 380 | logerror("CRTC: reading register %i (0x442) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]); |
| 381 | if(towns_crtc_sel == 30) |
| 382 | return 0x00; |
| 378 | 383 | return towns_crtc_reg[towns_crtc_sel] & 0x00ff; |
| 379 | 384 | case 0x03: |
| 380 | 385 | logerror("CRTC: reading register %i (0x443) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]); |
| 386 | if(towns_crtc_sel == 30) |
| 387 | { |
| 388 | // check video position |
| 389 | xpos = video_screen_get_hpos(space->machine->primary_screen); |
| 390 | ypos = video_screen_get_vpos(space->machine->primary_screen); |
| 391 | |
| 392 | if(xpos < (towns_crtc_reg[0] & 0xfe)) |
| 393 | ret |= 0x02; |
| 394 | if(ypos < (towns_crtc_reg[6] & 0x1f)) |
| 395 | ret |= 0x04; |
| 396 | if(xpos < towns_crtc_layerscr[0].max_x && xpos > towns_crtc_layerscr[0].min_x) |
| 397 | ret |= 0x10; |
| 398 | if(xpos < towns_crtc_layerscr[1].max_x && xpos > towns_crtc_layerscr[1].min_x) |
| 399 | ret |= 0x20; |
| 400 | if(ypos < towns_crtc_layerscr[0].max_y && ypos > towns_crtc_layerscr[0].min_y) |
| 401 | ret |= 0x40; |
| 402 | if(ypos < towns_crtc_layerscr[1].max_y && ypos > towns_crtc_layerscr[1].min_y) |
| 403 | ret |= 0x80; |
| 404 | |
| 405 | return ret; |
| 406 | } |
| 381 | 407 | return (towns_crtc_reg[towns_crtc_sel] & 0xff00) >> 8; |
| 382 | 408 | case 0x08: |
| 383 | 409 | return towns_video_sel; |
| r7465 | r7466 | |
| 388 | 414 | if(towns_dpmd_flag != 0) |
| 389 | 415 | { |
| 390 | 416 | towns_dpmd_flag = 0; |
| 391 | | return 0x80; |
| 417 | ret |= 0x80; |
| 392 | 418 | } |
| 393 | | else |
| 394 | | return 0x00; |
| 419 | ret |= (towns_vblank_flag ? 0x02 : 0x00); // TODO: figure out just what this bit is... |
| 420 | return ret; |
| 395 | 421 | case 0x10: |
| 396 | 422 | return towns_sprite_sel; |
| 397 | 423 | case 0x12: |
| r7465 | r7466 | |
| 907 | 933 | int x; |
| 908 | 934 | UINT8 colour; |
| 909 | 935 | int hzoom = 1; |
| 936 | int linesize; |
| 910 | 937 | |
| 911 | 938 | if(towns_display_page_sel != 0) |
| 912 | 939 | off = 0x20000; |
| 940 | if(layer == 0) |
| 941 | linesize = towns_crtc_reg[20] * 4; |
| 942 | else |
| 943 | linesize = towns_crtc_reg[24] * 4; |
| 944 | |
| 913 | 945 | if(layer != 0) |
| 914 | 946 | { |
| 915 | 947 | if(!(towns_video_reg[0] & 0x10)) |
| 916 | 948 | return; |
| 917 | | off += 0x40000; |
| 918 | 949 | off += towns_crtc_reg[21]; // initial offset |
| 919 | 950 | if(towns_crtc_reg[27] & 0x0100) |
| 920 | 951 | hzoom = 2; |
| r7465 | r7466 | |
| 926 | 957 | hzoom = 2; |
| 927 | 958 | } |
| 928 | 959 | |
| 929 | | off += (line * (512 / hzoom)); |
| 960 | off += line * linesize; |
| 930 | 961 | |
| 931 | 962 | if(hzoom == 1) |
| 932 | 963 | { |
| 933 | 964 | for(x=rect->min_x;x<rect->max_x;x++) |
| 934 | 965 | { |
| 935 | | colour = towns_gfxvram[off]; |
| 966 | colour = towns_gfxvram[off+(layer*0x40000)]; |
| 936 | 967 | if(colour != 0) |
| 937 | 968 | { |
| 938 | 969 | *BITMAP_ADDR32(bitmap,scanline,x) = |
| r7465 | r7466 | |
| 947 | 978 | { // x2 horizontal zoom |
| 948 | 979 | for(x=rect->min_x;x<rect->max_x;x+=2) |
| 949 | 980 | { |
| 950 | | colour = towns_gfxvram[off]; |
| 981 | colour = towns_gfxvram[off+(layer*0x40000)+1]; |
| 951 | 982 | if(colour != 0) |
| 952 | 983 | { |
| 953 | 984 | *BITMAP_ADDR32(bitmap,scanline,x) = |
src/mess/drivers/fmtowns.c
| r7465 | r7466 | |
| 49 | 49 | * 0x0200-0f: Floppy controller (MB8877A) |
| 50 | 50 | * 0x0400 : Video / CRTC (unknown) |
| 51 | 51 | * 0x0404 : Disable VRAM, CMOS, memory-mapped I/O (everything in low memory except the BIOS) |
| 52 | | * 0x0440-5f: Video / CRTC (unknown) |
| 52 | * 0x0440-5f: Video / CRTC |
| 53 | 53 | * 0x0480 RW: bit 1 = disable BIOS ROM |
| 54 | | * 0x04c0-cf: CD-ROM controller (unknown) |
| 54 | * 0x04c0-cf: CD-ROM controller |
| 55 | 55 | * 0x04d5 : Sound mute |
| 56 | 56 | * 0x04d8 : YM3438 control port A / status |
| 57 | 57 | * 0x04da : YM3438 data port A / status |
| r7465 | r7466 | |
| 738 | 738 | { |
| 739 | 739 | switch(offset) |
| 740 | 740 | { |
| 741 | | case 0x02: |
| 741 | case 0x02: // PCM channel interrupt mask |
| 742 | 742 | towns_pcm_channel_mask = data; |
| 743 | 743 | break; |
| 744 | 744 | default: |
| r7465 | r7466 | |
| 1648 | 1648 | // may not be (and probably is not) correct |
| 1649 | 1649 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM |
| 1650 | 1650 | AM_RANGE(0x000c0000, 0x000c7fff) AM_READWRITE8(towns_gfx_r,towns_gfx_w,0xffffffff) |
| 1651 | | // AM_RANGE(0x000c8000, 0x000c8fff) AM_READWRITE(SMH_BANK(2),SMH_BANK(2)) |
| 1652 | | // AM_RANGE(0x000c9000, 0x000c9fff) AM_READWRITE(SMH_BANK(3),SMH_BANK(3)) |
| 1653 | | // AM_RANGE(0x000ca000, 0x000ca7ff) AM_READWRITE(SMH_BANK(4),SMH_BANK(5)) |
| 1654 | | // AM_RANGE(0x000ca800, 0x000cafff) AM_READWRITE(SMH_BANK(10),SMH_BANK(10)) |
| 1655 | 1651 | AM_RANGE(0x000c8000, 0x000cafff) AM_READWRITE8(towns_spriteram_low_r,towns_spriteram_low_w,0xffffffff) |
| 1656 | 1652 | AM_RANGE(0x000cb000, 0x000cbfff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") |
| 1657 | 1653 | AM_RANGE(0x000cc000, 0x000cff7f) AM_RAMBANK("bank8") |
| r7465 | r7466 | |
| 1661 | 1657 | AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) |
| 1662 | 1658 | AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) |
| 1663 | 1659 | AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") |
| 1664 | | AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - seems to be needed to boot |
| 1660 | AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM |
| 1665 | 1661 | AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| 1666 | 1662 | AM_RANGE(0x81000000, 0x8101ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM |
| 1667 | 1663 | AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM |
| r7465 | r7466 | |
| 1685 | 1681 | AM_RANGE(0x000da000, 0x000effff) AM_RAM //READWRITE(SMH_BANK(11),SMH_BANK(11)) |
| 1686 | 1682 | AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) |
| 1687 | 1683 | AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") |
| 1688 | | AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - seems to be needed to boot |
| 1684 | AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - the Marty has 6MB RAM (not upgradable) |
| 1689 | 1685 | AM_RANGE(0x00600000, 0x0067ffff) AM_ROM AM_REGION("user",0x000000) // OS |
| 1690 | 1686 | AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM |
| 1691 | 1687 | AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| r7465 | r7466 | |
| 1695 | 1691 | AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT |
| 1696 | 1692 | AM_RANGE(0x00f80000, 0x00f80fff) AM_DEVREADWRITE8("pcm",rf5c68_mem_r,rf5c68_mem_w,0xffffffff) // WAVE RAM |
| 1697 | 1693 | AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 1698 | | /* AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| 1699 | | AM_RANGE(0x81000000, 0x8101ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM |
| 1700 | | AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM |
| 1701 | | AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| 1702 | | AM_RANGE(0xc2100000, 0xc213ffff) AM_ROM AM_REGION("user",0x180000) // FONT ROM |
| 1703 | | AM_RANGE(0xc2140000, 0xc2141fff) AM_READWRITE8(towns_cmos_r,towns_cmos_w,0xffffffff) // CMOS (mirror?) |
| 1704 | | AM_RANGE(0xc2200000, 0xc2200fff) AM_NOP // WAVE RAM |
| 1705 | | */AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 1694 | AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 1706 | 1695 | ADDRESS_MAP_END |
| 1707 | 1696 | |
| 1708 | 1697 | static ADDRESS_MAP_START( towns_io , ADDRESS_SPACE_IO, 32) |
| 1709 | 1698 | // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns |
| 1710 | | // Some common PC ports are likely to also be used |
| 1711 | 1699 | // System ports |
| 1712 | 1700 | AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_r, pic8259_w, 0x00ff00ff) |
| 1713 | 1701 | AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_r, pic8259_w, 0x00ff00ff) |