branches/alto2/src/emu/cpu/alto2/alto2.c
| r26095 | r26096 | |
| 16 | 16 | |
| 17 | 17 | const device_type ALTO2 = &device_creator<alto2_cpu_device>; |
| 18 | 18 | |
| 19 | | /*************************************************************************** |
| 20 | | ADDRESS MAPS |
| 21 | | ***************************************************************************/ |
| 19 | ADDRESS_MAP_START( alto2_ucode_map, AS_0, 32, alto2_cpu_device ) |
| 20 | AM_RANGE(0, ALTO2_UCODE_RAM_BASE-1) AM_ROM |
| 21 | AM_RANGE(ALTO2_UCODE_RAM_BASE, ALTO2_UCODE_SIZE-1) AM_RAM |
| 22 | ADDRESS_MAP_END |
| 22 | 23 | |
| 23 | | |
| 24 | | // FIXME: Is this required? How to access the address space words? |
| 25 | | // This has to somehow be mapped to the a2mem half DWORD accesses |
| 26 | | // and (optionally) Hamming code and parity flag updating |
| 27 | | READ16_MEMBER( alto2_cpu_device::alto2_ram_r ) |
| 28 | | { |
| 29 | | return 0; |
| 30 | | } |
| 31 | | |
| 32 | | // FIXME: Is this required? How to access the address space words? |
| 33 | | // This has to somehow be mapped to the a2mem half DWORD accesses |
| 34 | | // and (optionally) Hamming code and parity flag updating |
| 35 | | WRITE16_MEMBER( alto2_cpu_device::alto2_ram_w ) |
| 36 | | { |
| 37 | | |
| 38 | | } |
| 39 | | |
| 40 | | // FIXME: Dispatch to the a2mem mmio handlers |
| 41 | | READ16_MEMBER( alto2_cpu_device::alto2_mmio_r ) |
| 42 | | { |
| 43 | | return 0; |
| 44 | | } |
| 45 | | |
| 46 | | // FIXME: Dispatch to the a2mem mmio handlers |
| 47 | | WRITE16_MEMBER( alto2_cpu_device::alto2_mmio_w ) |
| 48 | | { |
| 49 | | |
| 50 | | } |
| 51 | | |
| 52 | 24 | //************************************************************************** |
| 53 | 25 | // LIVE DEVICE |
| 54 | 26 | //************************************************************************** |
| r26095 | r26096 | |
| 64 | 36 | m_log_level(9), |
| 65 | 37 | m_log_newline(true), |
| 66 | 38 | #endif |
| 67 | | m_ucode_config("maincpu", ENDIANNESS_BIG, 32, 14, -2), |
| 68 | | m_const_config("const", ENDIANNESS_BIG, 16, 8, -1), |
| 39 | m_ucode_config("maincpu", ENDIANNESS_BIG, 32, 14, -2, ADDRESS_MAP_NAME(alto2_ucode_map)), |
| 40 | m_ucode_map(*this, "maincpu"), |
| 69 | 41 | m_ucode(0), |
| 70 | | m_const(0), |
| 71 | | m_ucode_map(*this, "^maincpu"), |
| 72 | | m_const_map(*this, "^const"), |
| 42 | m_ucode_proms(0), |
| 43 | m_const_proms(0), |
| 73 | 44 | m_icount(0), |
| 74 | 45 | m_task_mpc(), |
| 75 | 46 | m_task_next2(), |
| r26095 | r26096 | |
| 152 | 123 | //------------------------------------------------- |
| 153 | 124 | |
| 154 | 125 | ROM_START( alto2_cpu ) |
| 126 | // decoded micro code region |
| 127 | ROM_REGION32_BE( sizeof(UINT32)*ALTO2_UCODE_SIZE, "maincpu", 0 ) |
| 128 | ROM_FILL(0, sizeof(UINT32)*ALTO2_UCODE_SIZE, ALTO2_UCODE_INVERTED) |
| 129 | |
| 155 | 130 | ROM_REGION( 16 * 02000, "ucode_proms", 0 ) |
| 156 | 131 | ROM_LOAD( "55x.3", 0*02000, 0x400, CRC(de870d75) SHA1(2b98cc769d8302cb39948711424d987d94e4159b) ) //!< 00000-01777 RSEL(0)',RSEL(1)',RSEL(2)',RSEL(3)' |
| 157 | 132 | ROM_LOAD( "64x.3", 1*02000, 0x400, CRC(51b444c0) SHA1(8756e51f7f3253a55d75886465beb7ee1be6e1c4) ) //!< 00000-01777 RSEL(4)',ALUF(0)',ALUF(1)',ALUF(2)' |
| r26095 | r26096 | |
| 249 | 224 | // device_memory_interface overrides |
| 250 | 225 | //------------------------------------------------- |
| 251 | 226 | |
| 252 | | bool alto2_cpu_device::memory_read(address_spacenum spacenum, offs_t offset, int size, UINT64 &value) |
| 227 | const address_space_config*alto2_cpu_device::memory_space_config(address_spacenum spacenum) const |
| 253 | 228 | { |
| 254 | | // printf("%s: spacenum=%d offset=%#x size=%d\n", __FUNCTION__, int(spacenum), unsigned(offset), size); |
| 255 | | switch (spacenum) { |
| 256 | | case AS_0: |
| 257 | | switch (size) { |
| 258 | | case 1: |
| 259 | | value = m_ucode_proms[offset]; |
| 260 | | return true; |
| 261 | | case 2: |
| 262 | | value = m_ucode_proms[offset+0] | (m_ucode_proms[offset+1] << 8); |
| 263 | | return true; |
| 264 | | case 4: |
| 265 | | value = m_ucode_proms[offset+0] | |
| 266 | | (m_ucode_proms[offset+1] << 8) | |
| 267 | | (m_ucode_proms[offset+2] << 16) | |
| 268 | | (m_ucode_proms[offset+3] << 24); |
| 269 | | return true; |
| 270 | | } |
| 271 | | return false; |
| 272 | | case AS_1: |
| 273 | | switch (size) { |
| 274 | | case 1: |
| 275 | | value = m_const_proms[offset]; |
| 276 | | return true; |
| 277 | | case 2: |
| 278 | | value = m_const_proms[offset+0] | (m_ucode_proms[offset+1] << 8); |
| 279 | | return true; |
| 280 | | } |
| 281 | | return false; |
| 282 | | default: |
| 283 | | return false; |
| 284 | | } |
| 229 | if (AS_0 == spacenum) |
| 230 | return &m_ucode_config; |
| 231 | return NULL; |
| 285 | 232 | } |
| 286 | 233 | |
| 287 | | bool alto2_cpu_device::memory_write(address_spacenum spacenum, offs_t offset, int size, UINT64 value) |
| 234 | UINT16 alto2_cpu_device::read_ram(offs_t offset) |
| 288 | 235 | { |
| 289 | | // printf("%s: spacenum=%d offset=%#x size=%d\n", __FUNCTION__, int(spacenum), unsigned(offset), size); |
| 290 | | switch (spacenum) { |
| 291 | | case AS_0: |
| 292 | | switch (size) { |
| 293 | | case 1: |
| 294 | | m_ucode_proms[offset] = value; |
| 295 | | return true; |
| 296 | | case 2: |
| 297 | | m_ucode_proms[offset+0] = value; |
| 298 | | m_ucode_proms[offset+1] = value >> 8; |
| 299 | | return true; |
| 300 | | case 4: |
| 301 | | m_ucode_proms[offset+0] = value; |
| 302 | | m_ucode_proms[offset+1] = value >> 8; |
| 303 | | m_ucode_proms[offset+2] = value >> 16; |
| 304 | | m_ucode_proms[offset+3] = value >> 24; |
| 305 | | return true; |
| 306 | | } |
| 307 | | return false; |
| 308 | | case AS_1: |
| 309 | | switch (size) { |
| 310 | | case 1: |
| 311 | | m_const_proms[offset] = value; |
| 312 | | return true; |
| 313 | | case 2: |
| 314 | | m_const_proms[offset+0] = value; |
| 315 | | m_ucode_proms[offset+1] = value >> 8; |
| 316 | | return true; |
| 317 | | } |
| 318 | | return false; |
| 319 | | default: |
| 320 | | return false; |
| 321 | | } |
| 236 | return debug_read_mem(offset); |
| 322 | 237 | } |
| 323 | 238 | |
| 239 | void alto2_cpu_device::write_ram(offs_t offset, UINT16 data) |
| 240 | { |
| 241 | debug_write_mem(offset, data); |
| 242 | } |
| 324 | 243 | |
| 325 | 244 | /** |
| 326 | 245 | * @brief list of microcode PROM loading options |
| 327 | 246 | */ |
| 328 | | static const prom_load_t ucode_prom_list[] = { |
| 247 | static const prom_load_t pl_ucode[] = { |
| 329 | 248 | { // 0000-01777 RSEL(0)',RSEL(1)',RSEL(2)',RSEL(3)' |
| 330 | 249 | "55x.3", |
| 331 | 250 | 0, |
| r26095 | r26096 | |
| 575 | 494 | /** |
| 576 | 495 | * @brief list of constant PROM loading options |
| 577 | 496 | */ |
| 578 | | static const prom_load_t const_prom_list[] = { |
| 497 | static const prom_load_t pl_const[] = { |
| 579 | 498 | { // constant prom D0-D3 |
| 580 | 499 | "madr.a6", |
| 581 | 500 | "c3.3", |
| r26095 | r26096 | |
| 925 | 844 | void alto2_cpu_device::device_start() |
| 926 | 845 | { |
| 927 | 846 | m_ucode = &space(AS_0); |
| 928 | | m_const = &space(AS_1); |
| 847 | m_ucode_proms = prom_load(pl_ucode, memregion("ucode_proms")->base(), ALTO2_UCODE_ROM_PAGES, 8); |
| 848 | UINT32* p_ucode = reinterpret_cast<UINT32 *>(memregion("maincpu")->base()); |
| 849 | for (offs_t offs = 0; offs < ALTO2_UCODE_RAM_BASE; offs++) { |
| 850 | UINT32 data = (m_ucode_proms[4*offs+0] << 0) | (m_ucode_proms[4*offs+1] << 8) | |
| 851 | (m_ucode_proms[4*offs+2] << 16) | (m_ucode_proms[4*offs+3] << 24); |
| 852 | if (0 == offs % 8) |
| 853 | printf("%04x:", offs); |
| 854 | printf(" %08x", data); |
| 855 | if (7 == offs % 8) |
| 856 | printf("\n"); |
| 857 | p_ucode[offs] = data; |
| 858 | } |
| 929 | 859 | |
| 930 | | m_ucode_proms = prom_load(ucode_prom_list, memregion("ucode_proms")->base(), ALTO2_UCODE_ROM_PAGES, 8); |
| 931 | | m_const_proms = prom_load(const_prom_list, memregion("const_proms")->base(), 1, 4); |
| 860 | m_const_proms = prom_load(pl_const, memregion("const_proms")->base(), 1, 4); |
| 861 | m_const = reinterpret_cast<UINT16 *>(global_alloc_array(UINT16, ALTO2_CONST_SIZE)); |
| 862 | for (offs_t offs = 0; offs < ALTO2_CONST_SIZE; offs++) { |
| 863 | UINT16 data = (m_const_proms[2*offs+0] << 0) | (m_const_proms[2*offs+1] << 8); |
| 864 | if (0 == offs % 8) |
| 865 | printf("%04x:", offs); |
| 866 | printf(" %04x", data); |
| 867 | if (7 == offs % 8) |
| 868 | printf("\n"); |
| 869 | m_const[offs] = data; |
| 870 | } |
| 871 | |
| 932 | 872 | m_disp_a38 = prom_load(&pl_displ_a38, memregion("displ_a38")->base()); |
| 933 | 873 | m_disp_a63 = prom_load(&pl_displ_a63, memregion("displ_a63")->base()); |
| 934 | 874 | m_disp_a66 = prom_load(&pl_displ_a66, memregion("displ_a66")->base()); |
| r26095 | r26096 | |
| 1159 | 1099 | // FIXME |
| 1160 | 1100 | void alto2_cpu_device::device_reset() |
| 1161 | 1101 | { |
| 1162 | | for (offs_t offs = 0; offs < ALTO2_UCODE_RAM_BASE; offs++) { |
| 1163 | | UINT32 data = (m_ucode_proms[4*offs+0] << 0) | (m_ucode_proms[4*offs+1] << 8) | |
| 1164 | | (m_ucode_proms[4*offs+2] << 16) | (m_ucode_proms[4*offs+3] << 24); |
| 1165 | | if (0 == offs % 8) |
| 1166 | | printf("%04x:", offs); |
| 1167 | | printf(" %08x", data); |
| 1168 | | if (7 == offs % 8) |
| 1169 | | printf("\n"); |
| 1170 | | } |
| 1171 | | for (offs_t offs = 0; offs < ALTO2_CONST_SIZE; offs++) { |
| 1172 | | UINT32 data = (m_const_proms[2*offs+0] << 0) | (m_const_proms[2*offs+1] << 8); |
| 1173 | | if (0 == offs % 8) |
| 1174 | | printf("%04x:", offs); |
| 1175 | | printf(" %04x", data); |
| 1176 | | if (7 == offs % 8) |
| 1177 | | printf("\n"); |
| 1178 | | } |
| 1179 | | |
| 1180 | 1102 | soft_reset(); |
| 1181 | 1103 | } |
| 1182 | 1104 | |
| r26095 | r26096 | |
| 2535 | 2457 | */ |
| 2536 | 2458 | if (!do_bs || bs >= 4) { |
| 2537 | 2459 | int addr = 8 * m_rsel + bs; |
| 2538 | | UINT16 data = m_const->read_word(addr); |
| 2460 | UINT16 data = m_const[addr]; |
| 2539 | 2461 | LOG((LOG_CPU,2," %#o; BUS &= CONST[%03o]\n", data, addr)); |
| 2540 | 2462 | m_bus &= data; |
| 2541 | 2463 | } |
branches/alto2/src/emu/cpu/alto2/alto2.h
| r26095 | r26096 | |
| 207 | 207 | // construction/destruction |
| 208 | 208 | alto2_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 209 | 209 | |
| 210 | //! driver interface to RAM |
| 211 | UINT16 read_ram(offs_t offset); |
| 212 | void write_ram(offs_t offset, UINT16 data); |
| 213 | |
| 210 | 214 | protected: |
| 211 | 215 | //! device-level override for start |
| 212 | 216 | virtual void device_start(); |
| r26095 | r26096 | |
| 221 | 225 | virtual void execute_set_input(int inputnum, int state); |
| 222 | 226 | |
| 223 | 227 | //! device_memory_interface overrides |
| 224 | | virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const |
| 225 | | { |
| 226 | | switch (spacenum) { |
| 227 | | case AS_0: |
| 228 | | return &m_ucode_config; |
| 229 | | case AS_1: |
| 230 | | return &m_const_config; |
| 231 | | default: |
| 232 | | return NULL; |
| 233 | | } |
| 234 | | } |
| 228 | virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; |
| 235 | 229 | |
| 236 | 230 | //! device (P)ROMs |
| 237 | 231 | virtual const rom_entry *device_rom_region() const; |
| 238 | | //! device_memory_interface overrides |
| 239 | | virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, UINT64 &value); |
| 240 | | virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, UINT64 value); |
| 241 | 232 | //! device_state_interface overrides |
| 242 | 233 | void state_string_export(const device_state_entry &entry, astring &string); |
| 243 | 234 | |
| r26095 | r26096 | |
| 245 | 236 | virtual UINT32 disasm_min_opcode_bytes() const { return 4; } |
| 246 | 237 | virtual UINT32 disasm_max_opcode_bytes() const { return 4; } |
| 247 | 238 | virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); |
| 239 | |
| 248 | 240 | private: |
| 249 | 241 | #if ALTO2_DEBUG |
| 250 | 242 | enum { |
| r26095 | r26096 | |
| 286 | 278 | void fatal(int level, const char *format, ...); |
| 287 | 279 | |
| 288 | 280 | address_space_config m_ucode_config; |
| 289 | | address_space_config m_const_config; |
| 290 | 281 | |
| 291 | | address_space *m_ucode; |
| 292 | | address_space *m_const; |
| 293 | | |
| 294 | 282 | required_memory_region m_ucode_map; |
| 295 | | required_memory_region m_const_map; |
| 296 | 283 | |
| 284 | address_space *m_ucode; |
| 285 | UINT16* m_const; |
| 286 | |
| 297 | 287 | UINT8* m_ucode_proms; |
| 298 | 288 | UINT8* m_const_proms; |
| 299 | 289 | |
| 300 | 290 | int m_icount; |
| 301 | 291 | |
| 302 | | DECLARE_READ16_MEMBER ( alto2_ram_r ); |
| 303 | | DECLARE_WRITE16_MEMBER( alto2_ram_w ); |
| 304 | | DECLARE_READ16_MEMBER ( alto2_mmio_r ); |
| 305 | | DECLARE_WRITE16_MEMBER( alto2_mmio_w ); |
| 306 | | |
| 307 | 292 | static const UINT8 m_ether_id = 0121; |
| 308 | 293 | |
| 309 | 294 | typedef void (alto2_cpu_device::*a2func)(); |
branches/alto2/src/mess/drivers/alto2.c
| r26095 | r26096 | |
| 1 | | // license:MAME |
| 2 | | // copyright-holders:Juergen Buchmueller |
| 3 | 1 | /*************************************************************************** |
| 4 | | * alto2.c |
| 2 | * Portable Xerox AltoII driver for MESS |
| 5 | 3 | * |
| 6 | | * Original driver by: |
| 7 | | * Juergen Buchmueller, Nov 2013 |
| 4 | * Copyright: Juergen Buchmueller <pullmoll@t-online.de> |
| 8 | 5 | * |
| 6 | * Licenses: MAME, GPLv2 |
| 9 | 7 | ***************************************************************************/ |
| 10 | 8 | |
| 11 | 9 | #include "includes/alto2.h" |
| r26095 | r26096 | |
| 17 | 15 | // and (optionally) Hamming code and parity flag updating |
| 18 | 16 | READ16_MEMBER( alto2_state::alto2_ram_r ) |
| 19 | 17 | { |
| 20 | | return 0; |
| 18 | return downcast<alto2_cpu_device *>(m_maincpu.target())->read_ram(offset); |
| 21 | 19 | } |
| 22 | 20 | |
| 23 | 21 | // FIXME: Is this required? How to access the address space words? |
| r26095 | r26096 | |
| 25 | 23 | // and (optionally) Hamming code and parity flag updating |
| 26 | 24 | WRITE16_MEMBER( alto2_state::alto2_ram_w ) |
| 27 | 25 | { |
| 28 | | |
| 26 | downcast<alto2_cpu_device *>(m_maincpu.target())->write_ram(offset, data); |
| 29 | 27 | } |
| 30 | 28 | |
| 31 | | // FIXME: Dispatch to the a2mem mmio handlers |
| 32 | | READ16_MEMBER( alto2_state::alto2_mmio_r ) |
| 33 | | { |
| 34 | | return 0; |
| 35 | | } |
| 36 | | |
| 37 | | // FIXME: Dispatch to the a2mem mmio handlers |
| 38 | | WRITE16_MEMBER( alto2_state::alto2_mmio_w ) |
| 39 | | { |
| 40 | | |
| 41 | | } |
| 42 | | |
| 43 | 29 | /* Memory Maps */ |
| 44 | 30 | |
| 45 | | static ADDRESS_MAP_START( alto2_ucode_map, AS_PROGRAM, 32, alto2_state ) |
| 46 | | ADDRESS_MAP_UNMAP_HIGH |
| 47 | | AM_RANGE(0, ALTO2_UCODE_RAM_BASE-1) AM_ROM |
| 48 | | AM_RANGE(ALTO2_UCODE_RAM_BASE, ALTO2_UCODE_SIZE-1) AM_RAM |
| 49 | | ADDRESS_MAP_END |
| 50 | | |
| 51 | | static ADDRESS_MAP_START( alto2_const_map, AS_DATA, 16, alto2_state ) |
| 52 | | ADDRESS_MAP_UNMAP_HIGH |
| 53 | | AM_RANGE(0, ALTO2_CONST_SIZE-1) AM_ROM |
| 54 | | ADDRESS_MAP_END |
| 55 | | |
| 56 | 31 | /* main memory and memory mapped i/o in range ALTO2_IO_PAGE_BASE ... ALTO2_IO_PAGE_BASE + ALTO2_IO_PAGE_SIZE - 1 */ |
| 57 | | static ADDRESS_MAP_START( alto2_ram_map, AS_IO, 16, alto2_state ) |
| 32 | ADDRESS_MAP_START( alto2_ram_map, AS_2, 16, alto2_state ) |
| 58 | 33 | ADDRESS_MAP_UNMAP_HIGH |
| 59 | | AM_RANGE(0, ALTO2_IO_PAGE_BASE - 1) AM_READWRITE(alto2_ram_r, alto2_ram_w) |
| 60 | | AM_RANGE(ALTO2_IO_PAGE_BASE, 0177777) AM_READWRITE(alto2_mmio_r, alto2_mmio_w) |
| 34 | AM_RANGE(0, ALTO2_RAM_SIZE-1) AM_READWRITE(alto2_ram_r, alto2_ram_w) |
| 61 | 35 | ADDRESS_MAP_END |
| 62 | 36 | |
| 63 | 37 | |
| r26095 | r26096 | |
| 260 | 234 | PORT_CONFSETTING( 0x40, "PAL") |
| 261 | 235 | INPUT_PORTS_END |
| 262 | 236 | |
| 263 | | /* ROM */ |
| 264 | | ROM_START( alto2 ) |
| 265 | | // decoded micro code region |
| 266 | | ROM_REGION( sizeof(UINT32)*ALTO2_UCODE_SIZE, "maincpu", 0 ) |
| 267 | | // decoded constant PROMs region |
| 268 | | ROM_REGION( sizeof(UINT16)*ALTO2_CONST_SIZE, "const", 0 ) |
| 269 | | ROM_END |
| 270 | | |
| 271 | 237 | /* Palette Initialization */ |
| 272 | 238 | |
| 273 | 239 | void alto2_state::palette_init() |
| r26095 | r26096 | |
| 279 | 245 | static MACHINE_CONFIG_START( alto2, alto2_state ) |
| 280 | 246 | /* basic machine hardware */ |
| 281 | 247 | MCFG_CPU_ADD("maincpu", ALTO2, XTAL_20_16MHz) |
| 282 | | MCFG_CPU_PROGRAM_MAP(alto2_ucode_map) |
| 283 | | MCFG_CPU_DATA_MAP(alto2_const_map) |
| 284 | 248 | MCFG_CPU_IO_MAP(alto2_ram_map) |
| 285 | 249 | |
| 286 | 250 | /* video hardware */ |
| r26095 | r26096 | |
| 290 | 254 | MCFG_SCREEN_VBLANK_DRIVER(alto2_state, screen_eof_alto2) |
| 291 | 255 | |
| 292 | 256 | MCFG_PALETTE_LENGTH(2) |
| 293 | | |
| 294 | | // internal ram |
| 295 | | MCFG_RAM_ADD(RAM_TAG) |
| 296 | | MCFG_RAM_DEFAULT_SIZE("128K") |
| 297 | 257 | MACHINE_CONFIG_END |
| 298 | 258 | |
| 259 | /* ROM */ |
| 260 | ROM_START( alto2 ) |
| 261 | ROM_END |
| 262 | |
| 299 | 263 | /* Driver Init */ |
| 300 | 264 | |
| 301 | 265 | DRIVER_INIT_MEMBER( alto2_state, alto2 ) |