src/mess/machine/nubus.c
| r12371 | r12372 | |
| 140 | 140 | m_device_list.append(*card); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | | void nubus_device::install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_device_func rhandler, const char* rhandler_name, write32_device_func whandler, const char *whandler_name) |
| 143 | void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhandler, write32_delegate whandler) |
| 144 | 144 | { |
| 145 | 145 | m_maincpu = machine().device(m_cputag); |
| 146 | 146 | int buswidth = m_maincpu->memory().space_config(AS_PROGRAM)->m_databus_width; |
| 147 | 147 | switch(buswidth) |
| 148 | 148 | { |
| 149 | 149 | case 32: |
| 150 | | m_maincpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffffffff); |
| 150 | m_maincpu->memory().space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff); |
| 151 | 151 | break; |
| 152 | 152 | case 64: |
| 153 | | m_maincpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,U64(0xffffffffffffffff)); |
| 153 | m_maincpu->memory().space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, U64(0xffffffffffffffff)); |
| 154 | 154 | break; |
| 155 | 155 | default: |
| 156 | 156 | fatalerror("NUBUS: Bus width %d not supported", buswidth); |
| r12371 | r12372 | |
| 247 | 247 | UINT8 *rom = device().machine().region(region_name)->base(); |
| 248 | 248 | UINT32 romlen = device().machine().region(region_name)->bytes(); |
| 249 | 249 | |
| 250 | | printf("ROM length is %x, last byte is %02x\n", romlen, rom[romlen-1]); |
| 250 | // printf("ROM length is %x, last byte is %02x\n", romlen, rom[romlen-1]); |
| 251 | 251 | |
| 252 | 252 | UINT8 byteLanes = rom[romlen-1]; |
| 253 | 253 | // check if all bits are inverted |
| r12371 | r12372 | |
| 350 | 350 | strcpy(bankname, "rom_"); |
| 351 | 351 | strcat(bankname, m_nubus_slottag); |
| 352 | 352 | addr -= romlen; |
| 353 | | printf("Installing ROM bank [%s] at %08x\n", bankname, addr); |
| 353 | // printf("Installing ROM bank [%s] at %08x\n", bankname, addr); |
| 354 | 354 | m_nubus->install_bank(addr, addr+romlen-1, addr+romlen-1, 0, bankname, newrom); |
| 355 | 355 | } |
| 356 | 356 | |
src/mess/machine/nubus.h
| r12371 | r12372 | |
| 88 | 88 | static void static_set_cputag(device_t &device, const char *tag); |
| 89 | 89 | |
| 90 | 90 | void add_nubus_card(device_nubus_card_interface *card); |
| 91 | | void install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read32_device_func rhandler, const char* rhandler_name, write32_device_func whandler, const char *whandler_name); |
| 91 | void install_device(offs_t start, offs_t end, read32_delegate rhandler, write32_delegate whandler); |
| 92 | 92 | void install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data); |
| 93 | 93 | void install_rom(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, const char *region); |
| 94 | 94 | |
src/mess/video/nubus_48gc.c
| r12371 | r12372 | |
| 11 | 11 | #define GC48_ROM_REGION "48gc_rom" |
| 12 | 12 | |
| 13 | 13 | static SCREEN_UPDATE( mac_48gc ); |
| 14 | | static READ32_DEVICE_HANDLER( mac_48gc_r ); |
| 15 | | static WRITE32_DEVICE_HANDLER( mac_48gc_w ); |
| 16 | 14 | |
| 17 | 15 | MACHINE_CONFIG_FRAGMENT( macvideo_48gc ) |
| 18 | 16 | MCFG_SCREEN_ADD( GC48_SCREEN_NAME, RASTER) |
| r12371 | r12372 | |
| 90 | 88 | |
| 91 | 89 | slotspace = get_slotspace(); |
| 92 | 90 | |
| 93 | | printf("slot %d, slotspace %08x\n", m_slot, slotspace); |
| 94 | | |
| 95 | 91 | m_vram = auto_alloc_array(machine(), UINT8, 0x7ffff); |
| 96 | | m_nubus->install_device(this, slotspace+0x200000, slotspace+0x2003ff, 0, 0x180000, FUNC(mac_48gc_r), FUNC(mac_48gc_w) ); |
| 92 | m_nubus->install_device(slotspace+0x200000, slotspace+0x2003ff, read32_delegate(FUNC(nubus_48gc_device::mac_48gc_r), this), write32_delegate(FUNC(nubus_48gc_device::mac_48gc_w), this)); |
| 97 | 93 | m_nubus->install_bank(slotspace, slotspace+0x7ffff, 0, 0x07000, "bank_48gc", m_vram); |
| 98 | 94 | |
| 99 | 95 | m_toggle = 0; |
| r12371 | r12372 | |
| 118 | 114 | static SCREEN_UPDATE( mac_48gc ) |
| 119 | 115 | { |
| 120 | 116 | nubus_48gc_device *card = downcast<nubus_48gc_device *>(screen->owner()); |
| 121 | | /* UINT32 *scanline; |
| 117 | UINT32 *scanline; |
| 122 | 118 | int x, y; |
| 123 | 119 | UINT8 *vram8 = (UINT8 *)card->m_vram; |
| 124 | 120 | UINT8 pixels; |
| 125 | | UINT32 stride = card->m_registers[0xc/4]; |
| 121 | // UINT32 stride = card->m_registers[0xc/4]/4; |
| 126 | 122 | |
| 123 | vram8 += 0xa00; |
| 124 | |
| 127 | 125 | for (y = 0; y < 480; y++) |
| 128 | 126 | { |
| 129 | 127 | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 130 | 128 | for (x = 0; x < 640/8; x++) |
| 131 | 129 | { |
| 132 | | pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; |
| 130 | pixels = vram8[(y * 0x50) + (BYTE4_XOR_BE(x))]; |
| 133 | 131 | |
| 134 | 132 | *scanline++ = card->m_palette[pixels&0x80]; |
| 135 | 133 | *scanline++ = card->m_palette[(pixels<<1)&0x80]; |
| r12371 | r12372 | |
| 140 | 138 | *scanline++ = card->m_palette[(pixels<<6)&0x80]; |
| 141 | 139 | *scanline++ = card->m_palette[(pixels<<7)&0x80]; |
| 142 | 140 | } |
| 143 | | }*/ |
| 141 | } |
| 144 | 142 | |
| 145 | | printf("stride = %d bytes\n", card->m_registers[0xc/4]); |
| 146 | | |
| 147 | 143 | return 0; |
| 148 | 144 | } |
| 149 | 145 | |
| 150 | | WRITE32_DEVICE_HANDLER ( mac_48gc_w ) |
| 146 | WRITE32_MEMBER( nubus_48gc_device::mac_48gc_w ) |
| 151 | 147 | { |
| 152 | | nubus_48gc_device *card = downcast<nubus_48gc_device *>(device->owner()); |
| 148 | printf("48gc_w: %08x to %x, mask %08x\n", data, offset*4, mem_mask); |
| 153 | 149 | |
| 154 | | // printf("48gc_w: %08x to %x, mask %08x\n", data, offset, mem_mask); |
| 150 | COMBINE_DATA(&m_registers[offset&0xff]); |
| 155 | 151 | |
| 156 | | COMBINE_DATA(&card->m_registers[offset&0xff]); |
| 157 | | |
| 158 | 152 | switch (offset) |
| 159 | 153 | { |
| 160 | 154 | case 0x80: // DAC control |
| 161 | | card->m_clutoffs = data>>24; |
| 162 | | card->m_count = 0; |
| 155 | m_clutoffs = data>>24; |
| 156 | m_count = 0; |
| 163 | 157 | break; |
| 164 | 158 | |
| 165 | 159 | case 0x81: // DAC data |
| 166 | | card->m_colors[card->m_count++] = data>>24; |
| 160 | m_colors[m_count++] = data>>24; |
| 167 | 161 | |
| 168 | | if (card->m_count == 3) |
| 162 | if (m_count == 3) |
| 169 | 163 | { |
| 170 | | card->m_palette[card->m_clutoffs] = MAKE_RGB(card->m_colors[0], card->m_colors[1], card->m_colors[2]); |
| 171 | | card->m_clutoffs++; |
| 172 | | card->m_count = 0; |
| 164 | m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]); |
| 165 | m_clutoffs++; |
| 166 | m_count = 0; |
| 173 | 167 | } |
| 174 | 168 | break; |
| 175 | 169 | |
| r12371 | r12372 | |
| 178 | 172 | } |
| 179 | 173 | } |
| 180 | 174 | |
| 181 | | READ32_DEVICE_HANDLER ( mac_48gc_r ) |
| 175 | READ32_MEMBER( nubus_48gc_device::mac_48gc_r ) |
| 182 | 176 | { |
| 177 | printf("48gc_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, cpu_get_pc(machine().device("maincpu"))); |
| 178 | |
| 179 | switch (offset) |
| 180 | { |
| 181 | case 0: |
| 182 | return 0x0c00; // sense 13" RGB for now |
| 183 | break; |
| 184 | |
| 185 | case 0x1c0/4: |
| 186 | m_toggle ^= 0xffffffff; |
| 187 | return m_toggle; |
| 188 | break; |
| 189 | } |
| 190 | |
| 183 | 191 | return 0; |
| 184 | 192 | } |