src/mess/machine/apple2.c
| r15379 | r15380 | |
| 825 | 825 | meminfo->write_handler = &wd; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | static void tk2000_mem_C100(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) |
| 829 | { |
| 830 | apple2_state *state = machine.driver_data<apple2_state>(); |
| 831 | |
| 832 | if (state->m_flags & VAR_TK2000RAM) |
| 833 | { |
| 834 | meminfo->read_mem = 0x00C100; |
| 835 | meminfo->write_mem = 0x00C100; |
| 836 | } |
| 837 | else |
| 838 | { |
| 839 | meminfo->read_mem = (begin & 0x3fff) | APPLE2_MEM_ROM; |
| 840 | meminfo->write_mem = 0x00C100; |
| 841 | } |
| 842 | } |
| 843 | |
| 828 | 844 | static void apple2_mem_CFFF(running_machine &machine, offs_t begin, offs_t end, apple2_meminfo *meminfo) |
| 829 | 845 | { |
| 830 | 846 | apple2_state *state = machine.driver_data<apple2_state>(); |
| r15379 | r15380 | |
| 1009 | 1025 | }; |
| 1010 | 1026 | |
| 1011 | 1027 | |
| 1028 | static const apple2_memmap_entry tk2000_memmap_entries[] = |
| 1029 | { |
| 1030 | { 0x0000, 0x01FF, apple2_mem_0000, A2MEM_MONO }, |
| 1031 | { 0x0200, 0x03FF, apple2_mem_0200, A2MEM_DUAL }, |
| 1032 | { 0x0400, 0x07FF, apple2_mem_0400, A2MEM_DUAL }, |
| 1033 | { 0x0800, 0x1FFF, apple2_mem_0800, A2MEM_DUAL }, |
| 1034 | { 0x2000, 0x3FFF, apple2_mem_2000, A2MEM_DUAL }, |
| 1035 | { 0x4000, 0xBFFF, apple2_mem_4000, A2MEM_DUAL }, |
| 1036 | { 0xC000, 0xC07F, apple2_mem_C000, A2MEM_IO }, |
| 1037 | { 0xC080, 0xC0FF, apple2_mem_C080, A2MEM_IO }, |
| 1038 | { 0xC100, 0xFFFF, tk2000_mem_C100, A2MEM_DUAL }, |
| 1039 | { 0 } |
| 1040 | }; |
| 1012 | 1041 | |
| 1013 | 1042 | void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask) |
| 1014 | 1043 | { |
| r15379 | r15380 | |
| 1456 | 1485 | { |
| 1457 | 1486 | UINT32 mask; |
| 1458 | 1487 | |
| 1488 | if (m_machinetype == TK2000) |
| 1489 | { |
| 1490 | if (offset == 0xa) // RAM |
| 1491 | { |
| 1492 | apple2_setvar(space.machine(), VAR_TK2000RAM, ~0); |
| 1493 | printf("TK2000: RAM (PC %x)\n", cpu_get_pc(m_maincpu)); |
| 1494 | } |
| 1495 | else if (offset == 0xb) // ROM |
| 1496 | { |
| 1497 | apple2_setvar(space.machine(), 0, ~VAR_TK2000RAM); |
| 1498 | printf("TK2000: ROM (PC %x)\n", cpu_get_pc(m_maincpu)); |
| 1499 | } |
| 1500 | } |
| 1501 | |
| 1459 | 1502 | /* ANx has reverse SET logic */ |
| 1460 | 1503 | if (offset >= 8) |
| 1461 | 1504 | { |
| r15379 | r15380 | |
| 1794 | 1837 | if (!strcmp(machine.system().name, "apple2cp")) |
| 1795 | 1838 | apple2cp_ce00_ram = auto_alloc_array(machine, UINT8, 0x200); |
| 1796 | 1839 | |
| 1840 | state->m_machinetype = APPLE_IIEPLUS; |
| 1841 | |
| 1797 | 1842 | apple2_init_common(machine); |
| 1798 | 1843 | |
| 1799 | 1844 | /* setup memory */ |
| r15379 | r15380 | |
| 1816 | 1861 | // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states |
| 1817 | 1862 | state->m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; |
| 1818 | 1863 | |
| 1864 | state->m_machinetype = APPLE_II; |
| 1865 | |
| 1819 | 1866 | apple2_init_common(machine); |
| 1820 | 1867 | |
| 1821 | 1868 | /* setup memory */ |
| r15379 | r15380 | |
| 1829 | 1876 | apple2_reset(machine); |
| 1830 | 1877 | } |
| 1831 | 1878 | |
| 1879 | MACHINE_START( tk2000 ) |
| 1880 | { |
| 1881 | apple2_memmap_config mem_cfg; |
| 1882 | apple2_state *state = machine.driver_data<apple2_state>(); |
| 1832 | 1883 | |
| 1884 | // II and II+ have no internal ROM or internal slot 3 h/w, so don't allow these states |
| 1885 | state->m_flags_mask = VAR_INTCXROM|VAR_SLOTC3ROM; |
| 1886 | |
| 1887 | state->m_machinetype = TK2000; |
| 1888 | |
| 1889 | apple2_init_common(machine); |
| 1890 | |
| 1891 | /* setup memory */ |
| 1892 | memset(&mem_cfg, 0, sizeof(mem_cfg)); |
| 1893 | mem_cfg.first_bank = 1; |
| 1894 | mem_cfg.memmap = tk2000_memmap_entries; |
| 1895 | mem_cfg.auxmem = (UINT8*)NULL; |
| 1896 | apple2_setup_memory(machine, &mem_cfg); |
| 1897 | |
| 1898 | /* perform initial reset */ |
| 1899 | apple2_reset(machine); |
| 1900 | } |
| 1901 | |
| 1833 | 1902 | int apple2_pressed_specialkey(running_machine &machine, UINT8 key) |
| 1834 | 1903 | { |
| 1835 | 1904 | return (machine.root_device().ioport("keyb_special")->read() & key) |
src/mess/includes/apple2.h
| r15379 | r15380 | |
| 40 | 40 | #define VAR_LCRAM2 0x020000 |
| 41 | 41 | #define VAR_LCWRITE 0x040000 |
| 42 | 42 | #define VAR_ROMSWITCH 0x080000 |
| 43 | #define VAR_TK2000RAM 0x100000 // ROM/RAM switch for TK2000 |
| 43 | 44 | |
| 44 | 45 | #define VAR_DHIRES VAR_AN3 |
| 45 | 46 | |
| r15379 | r15380 | |
| 73 | 74 | |
| 74 | 75 | typedef enum |
| 75 | 76 | { |
| 77 | APPLE_II, // Apple II/II+ |
| 78 | APPLE_IIEPLUS, // Apple IIe/IIc/IIgs/IIc+ |
| 79 | TK2000 // Microdigital TK2000 |
| 80 | } machine_type_t; |
| 81 | |
| 82 | typedef enum |
| 83 | { |
| 76 | 84 | A2MEM_IO = 0, /* this is always handlers; never banked memory */ |
| 77 | 85 | A2MEM_MONO = 1, /* this is a bank where read and write are always in unison */ |
| 78 | 86 | A2MEM_DUAL = 2 /* this is a bank where read and write can go different places */ |
| r15379 | r15380 | |
| 157 | 165 | |
| 158 | 166 | UINT8 *m_rambase; |
| 159 | 167 | |
| 168 | machine_type_t m_machinetype; |
| 169 | |
| 160 | 170 | READ8_MEMBER(apple2_c0xx_r); |
| 161 | 171 | WRITE8_MEMBER(apple2_c0xx_w); |
| 162 | 172 | READ8_MEMBER(apple2_c080_r); |
| r15379 | r15380 | |
| 222 | 232 | void apple2_init_common(running_machine &machine); |
| 223 | 233 | MACHINE_START( apple2 ); |
| 224 | 234 | MACHINE_START( apple2orig ); |
| 235 | MACHINE_START( tk2000 ); |
| 225 | 236 | UINT8 apple2_getfloatingbusvalue(running_machine &machine); |
| 226 | 237 | READ8_HANDLER( apple2_c0xx_r ); |
| 227 | 238 | WRITE8_HANDLER( apple2_c0xx_w ); |
src/mess/video/apple2.c
| r15379 | r15380 | |
| 239 | 239 | if (endrow < beginrow) |
| 240 | 240 | return; |
| 241 | 241 | |
| 242 | | vram = state->m_a2_videoram + (page ? 0x4000 : 0x2000); |
| 242 | if (state->m_machinetype == TK2000) |
| 243 | { |
| 244 | vram = state->m_a2_videoram + (page ? 0xa000 : 0x2000); |
| 245 | } |
| 246 | else |
| 247 | { |
| 248 | vram = state->m_a2_videoram + (page ? 0x4000 : 0x2000); |
| 249 | } |
| 243 | 250 | columns = ((effective_a2(state) & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40; |
| 244 | 251 | |
| 245 | 252 | vram_row[0] = 0; |
| r15379 | r15380 | |
| 476 | 483 | /* choose the video mode to draw */ |
| 477 | 484 | if (effective_a2(state) & VAR_TEXT) |
| 478 | 485 | { |
| 479 | | /* text screen */ |
| 480 | | apple2_text_draw(machine, bitmap, cliprect, page, 0, 191); |
| 486 | /* text screen - TK2000 uses HGR for text */ |
| 487 | if (state->m_machinetype == TK2000) |
| 488 | { |
| 489 | apple2_hires_draw(machine, bitmap, cliprect, page, 0, 191); |
| 490 | } |
| 491 | else |
| 492 | { |
| 493 | apple2_text_draw(machine, bitmap, cliprect, page, 0, 191); |
| 494 | } |
| 481 | 495 | } |
| 482 | 496 | else if ((effective_a2(state) & VAR_HIRES) && (effective_a2(state) & VAR_MIXED)) |
| 483 | 497 | { |