trunk/src/mess/machine/sms.c
| r20243 | r20244 | |
| 868 | 868 | |
| 869 | 869 | READ8_MEMBER(sms_state::sms_sscope_r) |
| 870 | 870 | { |
| 871 | | return m_sscope_state; |
| 871 | int sscope = machine().root_device().ioport("SEGASCOPE")->read_safe(0x00); |
| 872 | |
| 873 | if ( sscope ) |
| 874 | { |
| 875 | // Scope is attached |
| 876 | return m_sscope_state; |
| 877 | } |
| 878 | |
| 879 | return m_mainram[0x1FF8 + offset]; |
| 872 | 880 | } |
| 873 | 881 | |
| 874 | 882 | |
| 875 | 883 | WRITE8_MEMBER(sms_state::sms_sscope_w) |
| 876 | 884 | { |
| 877 | | screen_device *screen = machine().first_screen(); |
| 885 | m_mainram[0x1FF8 + offset] = data; |
| 878 | 886 | |
| 879 | | m_sscope_state = data; |
| 887 | int sscope = machine().root_device().ioport("SEGASCOPE")->read_safe(0x00); |
| 880 | 888 | |
| 881 | | // There are occurrences when Sega Scope's state changes after VBLANK, or at |
| 882 | | // active screen. Most cases are solid-color frames of scene transitions, but |
| 883 | | // one exception is the first frame of Zaxxon 3-D's title screen. In that |
| 884 | | // case, this method is enough for setting the intended state for the frame. |
| 885 | | // No information found about a minimum time need for switch open/closed lens. |
| 886 | | if (screen->vpos() < (screen->height() >> 1)) |
| 887 | | m_frame_sscope_state = m_sscope_state; |
| 889 | if ( sscope ) |
| 890 | { |
| 891 | // Scope is attached |
| 892 | screen_device *screen = machine().first_screen(); |
| 893 | |
| 894 | m_sscope_state = data; |
| 895 | |
| 896 | // There are occurrences when Sega Scope's state changes after VBLANK, or at |
| 897 | // active screen. Most cases are solid-color frames of scene transitions, but |
| 898 | // one exception is the first frame of Zaxxon 3-D's title screen. In that |
| 899 | // case, this method is enough for setting the intended state for the frame. |
| 900 | // No information found about a minimum time need for switch open/closed lens. |
| 901 | if (screen->vpos() < (screen->height() >> 1)) |
| 902 | { |
| 903 | m_frame_sscope_state = m_sscope_state; |
| 904 | } |
| 905 | } |
| 888 | 906 | } |
| 889 | 907 | |
| 890 | 908 | |
| 891 | 909 | READ8_MEMBER(sms_state::sms_mapper_r) |
| 892 | 910 | { |
| 893 | | return m_mapper[offset]; |
| 911 | return m_mainram[0x1FFC + offset]; |
| 894 | 912 | } |
| 895 | 913 | |
| 896 | 914 | /* Terebi Oekaki */ |
| r20243 | r20244 | |
| 960 | 978 | offset &= 3; |
| 961 | 979 | |
| 962 | 980 | m_mapper[offset] = data; |
| 963 | | m_mapper_ram[offset] = data; |
| 981 | m_mainram[0x1FFC + offset] = data; |
| 964 | 982 | |
| 965 | 983 | if (m_bios_port & IO_BIOS_ROM || (m_is_gamegear && m_BIOS == NULL)) |
| 966 | 984 | { |
| r20243 | r20244 | |
| 1941 | 1959 | // in Japan region (including KR), until confirmed on other consoles. |
| 1942 | 1960 | if (m_is_region_japan) |
| 1943 | 1961 | { |
| 1944 | | memset((UINT8*)m_space->get_write_ptr(0xc000), 0xf0, 0x1FF0); |
| 1962 | memset((UINT8*)m_space->get_write_ptr(0xc000), 0xf0, 0x1FFF); |
| 1945 | 1963 | } |
| 1946 | 1964 | } |
| 1947 | 1965 | |
| r20243 | r20244 | |
| 1953 | 1971 | if (m_has_fm) |
| 1954 | 1972 | m_fm_detect = 0x01; |
| 1955 | 1973 | |
| 1956 | | m_mapper_ram = (UINT8*)space.get_write_ptr(0xdffc); |
| 1957 | | |
| 1958 | 1974 | m_bios_port = 0; |
| 1959 | 1975 | |
| 1960 | 1976 | if ( m_cartridge[m_current_cartridge].features & CF_CODEMASTERS_MAPPER ) |
trunk/src/mess/includes/sms.h
| r20243 | r20244 | |
| 26 | 26 | |
| 27 | 27 | public: |
| 28 | 28 | sms_state(const machine_config &mconfig, device_type type, const char *tag) |
| 29 | | : driver_device(mconfig, type, tag) { } |
| 29 | : driver_device(mconfig, type, tag) |
| 30 | , m_mainram(*this, "mainram") |
| 31 | { |
| 32 | } |
| 30 | 33 | |
| 31 | 34 | // device_ts |
| 32 | 35 | device_t *m_main_cpu; |
| r20243 | r20244 | |
| 45 | 48 | int m_paused; |
| 46 | 49 | UINT8 m_bios_port; |
| 47 | 50 | UINT8 *m_BIOS; |
| 48 | | UINT8 *m_mapper_ram; |
| 49 | 51 | UINT8 m_mapper[4]; |
| 50 | 52 | // we are going to use 1-6, same as bank numbers. Notice, though, that most mappers |
| 51 | 53 | // only work on 16K banks and, hence, banks 4-6 are not always directly set |
| r20243 | r20244 | |
| 195 | 197 | DECLARE_WRITE_LINE_MEMBER(sms_int_callback); |
| 196 | 198 | DECLARE_WRITE_LINE_MEMBER(sms_pause_callback); |
| 197 | 199 | DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback); |
| 200 | |
| 201 | protected: |
| 202 | required_shared_ptr<UINT8> m_mainram; |
| 198 | 203 | }; |
| 199 | 204 | |
| 200 | 205 | |
trunk/src/mess/drivers/sms.c
| r20243 | r20244 | |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | static ADDRESS_MAP_START( sms1_mem, AS_PROGRAM, 8, sms_state ) |
| 77 | | AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1") /* First 0x0400 part always points to first page */ |
| 78 | | AM_RANGE(0x0400, 0x1fff) AM_ROMBANK("bank2") /* switchable rom bank */ |
| 79 | | AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank7") /* switchable rom bank */ |
| 80 | | AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") /* switchable rom bank */ |
| 81 | | AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") /* switchable rom bank */ |
| 77 | AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1") /* First 0x0400 part always points to first page */ |
| 78 | AM_RANGE(0x0400, 0x1fff) AM_ROMBANK("bank2") /* switchable rom bank */ |
| 79 | AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank7") /* switchable rom bank */ |
| 80 | AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") /* switchable rom bank */ |
| 81 | AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") /* switchable rom bank */ |
| 82 | 82 | AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE(sms_cartram_w) /* ROM bank / on-cart RAM */ |
| 83 | 83 | AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(sms_cartram2_w) /* ROM bank / on-cart RAM */ |
| 84 | | AM_RANGE(0xc000, 0xdff7) AM_MIRROR(0x2000) AM_RAM /* RAM (mirror at 0xE000) */ |
| 85 | | AM_RANGE(0xdff8, 0xdfff) AM_RAM /* RAM "underneath" frame registers */ |
| 86 | | AM_RANGE(0xfff8, 0xfffb) AM_READWRITE(sms_sscope_r, sms_sscope_w) /* 3-D glasses */ |
| 87 | | AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ |
| 84 | AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("mainram") /* RAM */ |
| 85 | AM_RANGE(0xe000, 0xfff7) AM_RAM AM_SHARE("mainram") /* RAM (mirror) */ |
| 86 | AM_RANGE(0xfff8, 0xfffb) AM_READWRITE(sms_sscope_r, sms_sscope_w) /* 3-D glasses */ |
| 87 | AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ |
| 88 | 88 | ADDRESS_MAP_END |
| 89 | 89 | |
| 90 | 90 | static ADDRESS_MAP_START( sms_mem, AS_PROGRAM, 8, sms_state ) |
| 91 | | AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1") /* First 0x0400 part always points to first page */ |
| 92 | | AM_RANGE(0x0400, 0x1fff) AM_ROMBANK("bank2") /* switchable rom bank */ |
| 93 | | AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank7") /* switchable rom bank */ |
| 94 | | AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") /* switchable rom bank */ |
| 95 | | AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") /* switchable rom bank */ |
| 91 | AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1") /* First 0x0400 part always points to first page */ |
| 92 | AM_RANGE(0x0400, 0x1fff) AM_ROMBANK("bank2") /* switchable rom bank */ |
| 93 | AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank7") /* switchable rom bank */ |
| 94 | AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3") /* switchable rom bank */ |
| 95 | AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4") /* switchable rom bank */ |
| 96 | 96 | AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE(sms_cartram_w) /* ROM bank / on-cart RAM */ |
| 97 | 97 | AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(sms_cartram2_w) /* ROM bank / on-cart RAM */ |
| 98 | | AM_RANGE(0xc000, 0xdffb) AM_MIRROR(0x2000) AM_RAM /* RAM (mirror at 0xE000) */ |
| 99 | | AM_RANGE(0xdffc, 0xdfff) AM_RAM /* RAM "underneath" frame registers */ |
| 100 | | AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ |
| 98 | AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("mainram") /* RAM */ |
| 99 | AM_RANGE(0xe000, 0xfffb) AM_RAM AM_SHARE("mainram") /* RAM (mirror) */ |
| 100 | AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w) /* Bankswitch control */ |
| 101 | 101 | ADDRESS_MAP_END |
| 102 | 102 | |
| 103 | 103 | static ADDRESS_MAP_START( sms_store_mem, AS_PROGRAM, 8, sms_state ) |