src/mess/video/vectrex.c
| r10058 | r10059 | |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | 66 | |
| 67 | | typedef void (*vector_add_point_fn)(running_machine *, int, int, rgb_t, int); |
| 68 | | vector_add_point_fn vector_add_point_function; |
| 69 | 67 | |
| 70 | | |
| 71 | 68 | /********************************************************************* |
| 72 | 69 | |
| 73 | 70 | Lightpen |
| r10058 | r10059 | |
| 233 | 230 | vectrex_state *state = machine->driver_data<vectrex_state>(); |
| 234 | 231 | state->x_int = state->x_center + (state->analog[A_ZR] * INT_PER_CLOCK); |
| 235 | 232 | state->y_int = state->y_center + (state->analog[A_ZR] * INT_PER_CLOCK); |
| 236 | | vector_add_point_function(machine, state->x_int, state->y_int, state->beam_color, 0); |
| 233 | (*state->vector_add_point_function)(machine, state->x_int, state->y_int, state->beam_color, 0); |
| 237 | 234 | } |
| 238 | 235 | |
| 239 | 236 | |
| r10058 | r10059 | |
| 260 | 257 | state->x_int += length * (state->analog[A_X] + state->analog[A_ZR]); |
| 261 | 258 | state->y_int += length * (state->analog[A_Y] + state->analog[A_ZR]); |
| 262 | 259 | |
| 263 | | vector_add_point_function(machine, state->x_int, state->y_int, state->beam_color, 2 * state->analog[A_Z] * state->blank); |
| 260 | (*state->vector_add_point_function)(machine, state->x_int, state->y_int, state->beam_color, 2 * state->analog[A_Z] * state->blank); |
| 264 | 261 | } |
| 265 | 262 | else |
| 266 | 263 | { |
| 267 | 264 | if (state->blank) |
| 268 | | vector_add_point_function(machine, state->x_int, state->y_int, state->beam_color, 2 * state->analog[A_Z]); |
| 265 | (*state->vector_add_point_function)(machine, state->x_int, state->y_int, state->beam_color, 2 * state->analog[A_Z]); |
| 269 | 266 | } |
| 270 | 267 | |
| 271 | 268 | state->vector_start_time = timer_get_time(machine); |
| r10058 | r10059 | |
| 294 | 291 | |
| 295 | 292 | state->imager_freq = 1; |
| 296 | 293 | |
| 297 | | vector_add_point_function = vectrex_add_point; |
| 294 | state->vector_add_point_function = vectrex_add_point; |
| 298 | 295 | state->imager_timer = timer_alloc(machine, vectrex_imager_eye, NULL); |
| 299 | 296 | timer_adjust_periodic(state->imager_timer, |
| 300 | 297 | ATTOTIME_IN_HZ(state->imager_freq), |
| r10058 | r10059 | |
| 492 | 489 | state->x_max = visarea.max_x << 16; |
| 493 | 490 | state->y_max = visarea.max_y << 16; |
| 494 | 491 | |
| 495 | | vector_add_point_function = vectrex_add_point; |
| 492 | state->vector_add_point_function = vectrex_add_point; |
| 496 | 493 | state->refresh = timer_alloc(machine, vectrex_refresh, NULL); |
| 497 | 494 | |
| 498 | 495 | VIDEO_START_CALL(vector); |
src/mess/drivers/pb1000.c
| r10058 | r10059 | |
| 330 | 330 | return m_hd44352->video_update(bitmap, cliprect); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | | void lcd_control(hd61700_cpu_device &device, UINT8 data) |
| 333 | static void lcd_control(hd61700_cpu_device &device, UINT8 data) |
| 334 | 334 | { |
| 335 | 335 | pb1000_state *state = device.machine->driver_data<pb1000_state>(); |
| 336 | 336 | |
| r10058 | r10059 | |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
| 341 | | UINT8 lcd_data_r(hd61700_cpu_device &device) |
| 341 | static UINT8 lcd_data_r(hd61700_cpu_device &device) |
| 342 | 342 | { |
| 343 | 343 | pb1000_state *state = device.machine->driver_data<pb1000_state>(); |
| 344 | 344 | |
| r10058 | r10059 | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | |
| 349 | | void lcd_data_w(hd61700_cpu_device &device, UINT8 data) |
| 349 | static void lcd_data_w(hd61700_cpu_device &device, UINT8 data) |
| 350 | 350 | { |
| 351 | 351 | pb1000_state *state = device.machine->driver_data<pb1000_state>(); |
| 352 | 352 | |
| r10058 | r10059 | |
| 440 | 440 | // HD61700 interface |
| 441 | 441 | //------------------------------------------------- |
| 442 | 442 | |
| 443 | | void kb_matrix_w_call(hd61700_cpu_device &device, UINT8 matrix) |
| 443 | static void kb_matrix_w_call(hd61700_cpu_device &device, UINT8 matrix) |
| 444 | 444 | { |
| 445 | 445 | pb1000_state *state = device.machine->driver_data<pb1000_state>(); |
| 446 | 446 | |
| 447 | 447 | state->kb_matrix_w(device.machine, matrix); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | | UINT8 pb1000_port_r(hd61700_cpu_device &device) |
| 450 | static UINT8 pb1000_port_r(hd61700_cpu_device &device) |
| 451 | 451 | { |
| 452 | 452 | //TODO |
| 453 | 453 | return 0x00; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | | UINT8 pb2000c_port_r(hd61700_cpu_device &device) |
| 456 | static UINT8 pb2000c_port_r(hd61700_cpu_device &device) |
| 457 | 457 | { |
| 458 | 458 | //TODO |
| 459 | 459 | return 0xfc; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | | void port_w(hd61700_cpu_device &device, UINT8 data) |
| 462 | static void port_w(hd61700_cpu_device &device, UINT8 data) |
| 463 | 463 | { |
| 464 | 464 | beep_set_state(device.machine->device("beep"), (BIT(data,7) ^ BIT(data,6))); |
| 465 | 465 | //printf("%x\n", data); |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | | UINT16 pb1000_kb_r_call(hd61700_cpu_device &device) |
| 468 | static UINT16 pb1000_kb_r_call(hd61700_cpu_device &device) |
| 469 | 469 | { |
| 470 | 470 | pb1000_state *state = device.machine->driver_data<pb1000_state>(); |
| 471 | 471 | |
| 472 | 472 | return state->pb1000_kb_r(device.machine); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | | UINT16 pb2000c_kb_r_call(hd61700_cpu_device &device) |
| 475 | static UINT16 pb2000c_kb_r_call(hd61700_cpu_device &device) |
| 476 | 476 | { |
| 477 | 477 | pb1000_state *state = device.machine->driver_data<pb1000_state>(); |
| 478 | 478 | |
| r10058 | r10059 | |
| 521 | 521 | }; |
| 522 | 522 | |
| 523 | 523 | static MACHINE_CONFIG_START( pb1000, pb1000_state ) |
| 524 | | /* basic machine hardware */ |
| 525 | | MCFG_CPU_ADD("maincpu", HD61700, 910000) |
| 526 | | MCFG_CPU_PROGRAM_MAP(pb1000_mem) |
| 524 | /* basic machine hardware */ |
| 525 | MCFG_CPU_ADD("maincpu", HD61700, 910000) |
| 526 | MCFG_CPU_PROGRAM_MAP(pb1000_mem) |
| 527 | 527 | MCFG_HD61700_CONFIG(pb1000_config) |
| 528 | 528 | |
| 529 | | /* video hardware */ |
| 530 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 531 | | MCFG_SCREEN_REFRESH_RATE(50) |
| 532 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 533 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 529 | /* video hardware */ |
| 530 | MCFG_SCREEN_ADD("screen", RASTER) |
| 531 | MCFG_SCREEN_REFRESH_RATE(50) |
| 532 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 533 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 534 | 534 | MCFG_SCREEN_SIZE(192, 32) |
| 535 | 535 | MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 32-1) |
| 536 | 536 | MCFG_DEFAULT_LAYOUT(layout_lcd) |
| 537 | | MCFG_PALETTE_LENGTH(2) |
| 537 | MCFG_PALETTE_LENGTH(2) |
| 538 | 538 | MCFG_PALETTE_INIT( pb1000 ) |
| 539 | 539 | MCFG_GFXDECODE( pb1000 ) |
| 540 | 540 | |
| r10058 | r10059 | |
| 550 | 550 | MACHINE_CONFIG_END |
| 551 | 551 | |
| 552 | 552 | static MACHINE_CONFIG_START( pb2000c, pb1000_state ) |
| 553 | | /* basic machine hardware */ |
| 554 | | MCFG_CPU_ADD("maincpu",HD61700, 910000) |
| 555 | | MCFG_CPU_PROGRAM_MAP(pb2000c_mem) |
| 553 | /* basic machine hardware */ |
| 554 | MCFG_CPU_ADD("maincpu",HD61700, 910000) |
| 555 | MCFG_CPU_PROGRAM_MAP(pb2000c_mem) |
| 556 | 556 | MCFG_HD61700_CONFIG(pb2000c_config) |
| 557 | 557 | |
| 558 | | /* video hardware */ |
| 559 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 560 | | MCFG_SCREEN_REFRESH_RATE(50) |
| 561 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 562 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 558 | /* video hardware */ |
| 559 | MCFG_SCREEN_ADD("screen", RASTER) |
| 560 | MCFG_SCREEN_REFRESH_RATE(50) |
| 561 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 562 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 563 | 563 | MCFG_SCREEN_SIZE(192, 32) |
| 564 | 564 | MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 32-1) |
| 565 | 565 | MCFG_DEFAULT_LAYOUT(layout_lcd) |
| 566 | | MCFG_PALETTE_LENGTH(2) |
| 566 | MCFG_PALETTE_LENGTH(2) |
| 567 | 567 | MCFG_PALETTE_INIT( pb1000 ) |
| 568 | 568 | MCFG_GFXDECODE( pb1000 ) |
| 569 | 569 | |
src/mess/drivers/supracan.c
| r10058 | r10059 | |
| 105 | 105 | struct _acan_sprdma_regs_t |
| 106 | 106 | { |
| 107 | 107 | UINT32 src; |
| 108 | | UINT16 src_inc; |
| 108 | UINT16 src_inc; |
| 109 | 109 | UINT32 dst; |
| 110 | | UINT16 dst_inc; |
| 110 | UINT16 dst_inc; |
| 111 | 111 | UINT16 count; |
| 112 | 112 | UINT16 control; |
| 113 | 113 | }; |
| r10058 | r10059 | |
| 116 | 116 | { |
| 117 | 117 | public: |
| 118 | 118 | supracan_state(running_machine &machine, const driver_device_config_base &config) : driver_device(machine, config) |
| 119 | | { |
| 120 | | m6502_reset = 0; |
| 121 | | } |
| 119 | { |
| 120 | m6502_reset = 0; |
| 121 | } |
| 122 | 122 | |
| 123 | 123 | acan_dma_regs_t acan_dma_regs; |
| 124 | 124 | acan_sprdma_regs_t acan_sprdma_regs; |
| 125 | 125 | |
| 126 | 126 | UINT16 m6502_reset; |
| 127 | 127 | UINT8 *soundram; |
| 128 | | UINT8 soundlatch; |
| 129 | | UINT8 soundcpu_irq_src; |
| 130 | | UINT8 sound_irq_enable_reg; |
| 131 | | UINT8 sound_irq_source_reg; |
| 132 | | UINT8 sound_cpu_68k_irq_reg; |
| 128 | UINT8 soundlatch; |
| 129 | UINT8 soundcpu_irq_src; |
| 130 | UINT8 sound_irq_enable_reg; |
| 131 | UINT8 sound_irq_source_reg; |
| 132 | UINT8 sound_cpu_68k_irq_reg; |
| 133 | 133 | |
| 134 | 134 | emu_timer *video_timer; |
| 135 | | emu_timer *hbl_timer; |
| 136 | | emu_timer *line_on_timer; |
| 137 | | emu_timer *line_off_timer; |
| 135 | emu_timer *hbl_timer; |
| 136 | emu_timer *line_on_timer; |
| 137 | emu_timer *line_off_timer; |
| 138 | 138 | UINT16 *vram; |
| 139 | 139 | UINT16 *vram_swapped; |
| 140 | 140 | UINT8 *vram_addr_swapped; |
| 141 | 141 | |
| 142 | | UINT16 *pram; |
| 142 | UINT16 *pram; |
| 143 | 143 | |
| 144 | | UINT16 sprite_count; |
| 144 | UINT16 sprite_count; |
| 145 | 145 | UINT32 sprite_base_addr; |
| 146 | | UINT8 sprite_flags; |
| 146 | UINT8 sprite_flags; |
| 147 | 147 | |
| 148 | 148 | UINT32 tilemap_base_addr[3]; |
| 149 | 149 | int tilemap_scrollx[3]; |
| 150 | | int tilemap_scrolly[3]; |
| 150 | int tilemap_scrolly[3]; |
| 151 | 151 | UINT16 video_flags; |
| 152 | 152 | UINT16 tilemap_flags[3]; |
| 153 | | UINT16 tilemap_mode[3]; |
| 153 | UINT16 tilemap_mode[3]; |
| 154 | 154 | UINT16 irq_mask; |
| 155 | | UINT16 hbl_mask; |
| 155 | UINT16 hbl_mask; |
| 156 | 156 | |
| 157 | 157 | UINT32 roz_base_addr; |
| 158 | 158 | UINT16 roz_mode; |
| 159 | 159 | UINT32 roz_scrollx; |
| 160 | | UINT32 roz_scrolly; |
| 160 | UINT32 roz_scrolly; |
| 161 | 161 | UINT16 roz_tile_bank; |
| 162 | | UINT32 roz_unk_base0; |
| 163 | | UINT32 roz_unk_base1; |
| 164 | | UINT32 roz_unk_base2; |
| 165 | | UINT16 roz_coeffa; |
| 166 | | UINT16 roz_coeffb; |
| 167 | | UINT16 roz_coeffc; |
| 168 | | UINT16 roz_coeffd; |
| 169 | | INT32 roz_changed; |
| 170 | | INT32 roz_cx; |
| 171 | | INT32 roz_cy; |
| 172 | | UINT16 unk_1d0; |
| 162 | UINT32 roz_unk_base0; |
| 163 | UINT32 roz_unk_base1; |
| 164 | UINT32 roz_unk_base2; |
| 165 | UINT16 roz_coeffa; |
| 166 | UINT16 roz_coeffb; |
| 167 | UINT16 roz_coeffc; |
| 168 | UINT16 roz_coeffd; |
| 169 | INT32 roz_changed; |
| 170 | INT32 roz_cx; |
| 171 | INT32 roz_cy; |
| 172 | UINT16 unk_1d0; |
| 173 | 173 | |
| 174 | 174 | UINT16 video_regs[256]; |
| 175 | 175 | |
| 176 | | bool hack_68k_to_6502_access; |
| 176 | bool hack_68k_to_6502_access; |
| 177 | 177 | |
| 178 | | tilemap_t *tilemap_sizes[4][4]; |
| 178 | tilemap_t *tilemap_sizes[4][4]; |
| 179 | 179 | bitmap_t *sprite_final_bitmap; |
| 180 | | |
| 181 | | |
| 182 | | |
| 183 | 180 | }; |
| 184 | 181 | |
| 185 | 182 | static READ16_HANDLER( supracan_68k_soundram_r ); |
| r10058 | r10059 | |
| 207 | 204 | #define verboselog(w,x,y,z,...) |
| 208 | 205 | #endif |
| 209 | 206 | |
| 210 | | int supracan_tilemap_get_region(running_machine* machine, int layer) |
| 207 | static int supracan_tilemap_get_region(running_machine* machine, int layer) |
| 211 | 208 | { |
| 212 | | supracan_state *state = machine->driver_data<supracan_state>(); |
| 209 | supracan_state *state = machine->driver_data<supracan_state>(); |
| 213 | 210 | |
| 214 | 211 | // HACK!!! |
| 215 | 212 | if (layer==2) |
| r10058 | r10059 | |
| 253 | 250 | |
| 254 | 251 | static void supracan_tilemap_get_info_common(running_machine* machine, int layer, tile_data *tileinfo, int count) |
| 255 | 252 | { |
| 256 | | supracan_state *state = machine->driver_data<supracan_state>(); |
| 253 | supracan_state *state = machine->driver_data<supracan_state>(); |
| 257 | 254 | |
| 258 | 255 | UINT16* supracan_vram = state->vram; |
| 259 | 256 | |
| r10058 | r10059 | |
| 263 | 260 | |
| 264 | 261 | count += base; |
| 265 | 262 | |
| 266 | | UINT16 tile_bank = 0; |
| 267 | | UINT16 palette_bank = 0; |
| 263 | UINT16 tile_bank = 0; |
| 264 | UINT16 palette_bank = 0; |
| 268 | 265 | switch(gfx_mode) |
| 269 | 266 | { |
| 270 | 267 | case 7: |
| r10058 | r10059 | |
| 293 | 290 | } |
| 294 | 291 | |
| 295 | 292 | |
| 296 | | if(layer == 2) |
| 297 | | { |
| 298 | | tile_bank = 0x1000; |
| 299 | | } |
| 293 | if(layer == 2) |
| 294 | { |
| 295 | tile_bank = 0x1000; |
| 296 | } |
| 300 | 297 | |
| 301 | 298 | int tile = (supracan_vram[count] & 0x03ff) + tile_bank; |
| 302 | 299 | int flipxy = (supracan_vram[count] & 0x0c00)>>10; |
| r10058 | r10059 | |
| 308 | 305 | // I wonder how different this really is.. my guess, not at all. |
| 309 | 306 | static void supracan_tilemap_get_info_roz(running_machine* machine, int layer, tile_data *tileinfo, int count) |
| 310 | 307 | { |
| 311 | | supracan_state *state = machine->driver_data<supracan_state>(); |
| 308 | supracan_state *state = machine->driver_data<supracan_state>(); |
| 312 | 309 | |
| 313 | 310 | UINT16* supracan_vram = state->vram; |
| 314 | 311 | |
| 315 | 312 | UINT32 base = state->roz_base_addr; |
| 316 | 313 | |
| 317 | 314 | |
| 318 | | int region = 1; |
| 319 | | UINT16 tile_bank = 0; |
| 320 | | UINT16 palette_bank = 0; |
| 315 | int region = 1; |
| 316 | UINT16 tile_bank = 0; |
| 317 | UINT16 palette_bank = 0; |
| 321 | 318 | |
| 322 | 319 | region = supracan_tilemap_get_region(machine, layer); |
| 323 | 320 | |
| r10058 | r10059 | |
| 388 | 385 | |
| 389 | 386 | static VIDEO_START( supracan ) |
| 390 | 387 | { |
| 391 | | supracan_state *state = machine->driver_data<supracan_state>(); |
| 392 | | state->sprite_final_bitmap = auto_bitmap_alloc(machine, 1024, 1024, BITMAP_FORMAT_INDEXED16); |
| 388 | supracan_state *state = machine->driver_data<supracan_state>(); |
| 389 | state->sprite_final_bitmap = auto_bitmap_alloc(machine, 1024, 1024, BITMAP_FORMAT_INDEXED16); |
| 393 | 390 | |
| 394 | 391 | state->vram = (UINT16*)machine->region("ram_gfx")->base(); |
| 395 | 392 | state->vram_swapped = (UINT16*)machine->region("ram_gfx2")->base(); |
| r10058 | r10059 | |
| 418 | 415 | |
| 419 | 416 | static int get_tilemap_dimensions(running_machine* machine, int &xsize, int &ysize, int layer) |
| 420 | 417 | { |
| 421 | | supracan_state *state = (supracan_state *)machine->driver_data<supracan_state>(); |
| 418 | supracan_state *state = (supracan_state *)machine->driver_data<supracan_state>(); |
| 422 | 419 | int select; |
| 423 | 420 | |
| 424 | 421 | xsize = 32; |
| r10058 | r10059 | |
| 455 | 452 | |
| 456 | 453 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 457 | 454 | { |
| 458 | | supracan_state *state = machine->driver_data<supracan_state>(); |
| 455 | supracan_state *state = machine->driver_data<supracan_state>(); |
| 459 | 456 | UINT16 *supracan_vram = state->vram; |
| 460 | 457 | |
| 461 | 458 | // [0] |
| r10058 | r10059 | |
| 608 | 605 | |
| 609 | 606 | |
| 610 | 607 | |
| 611 | | void mark_active_tilemap_all_dirty(running_machine* machine, int layer) |
| 608 | static void mark_active_tilemap_all_dirty(running_machine* machine, int layer) |
| 612 | 609 | { |
| 613 | | supracan_state *state = (supracan_state *)machine->driver_data<supracan_state>(); |
| 610 | supracan_state *state = (supracan_state *)machine->driver_data<supracan_state>(); |
| 614 | 611 | int xsize = 0; |
| 615 | 612 | int ysize = 0; |
| 616 | 613 | |
| r10058 | r10059 | |
| 751 | 748 | |
| 752 | 749 | static VIDEO_UPDATE( supracan ) |
| 753 | 750 | { |
| 754 | | supracan_state *state = (supracan_state *)screen->machine->driver_data<supracan_state>(); |
| 751 | supracan_state *state = (supracan_state *)screen->machine->driver_data<supracan_state>(); |
| 755 | 752 | |
| 756 | 753 | |
| 757 | 754 | |
| r10058 | r10059 | |
| 848 | 845 | if (scrolly&0x8000) scrolly-= 0x10000; |
| 849 | 846 | |
| 850 | 847 | int mosaic_count = (state->tilemap_flags[layer] & 0x001c) >> 2; |
| 851 | | int mosaic_mask = 0xffffffff << mosaic_count; |
| 848 | int mosaic_mask = 0xffffffff << mosaic_count; |
| 852 | 849 | |
| 853 | 850 | int y,x; |
| 854 | 851 | // yes, it will draw a single line if you specify a cliprect as such (partial updates...) |
| r10058 | r10059 | |
| 984 | 981 | |
| 985 | 982 | static WRITE16_HANDLER( supracan_dma_w ) |
| 986 | 983 | { |
| 987 | | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 984 | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 988 | 985 | acan_dma_regs_t *acan_dma_regs = &state->acan_dma_regs; |
| 989 | | int ch = (offset < 0x10/2) ? 0 : 1; |
| 986 | int ch = (offset < 0x10/2) ? 0 : 1; |
| 990 | 987 | |
| 991 | 988 | switch(offset) |
| 992 | 989 | { |
| r10058 | r10059 | |
| 1059 | 1056 | } |
| 1060 | 1057 | } |
| 1061 | 1058 | |
| 1062 | | /* |
| 1059 | #if 0 |
| 1063 | 1060 | static WRITE16_HANDLER( supracan_pram_w ) |
| 1064 | 1061 | { |
| 1065 | | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 1066 | | state->pram[offset] &= ~mem_mask; |
| 1067 | | state->pram[offset] |= data & mem_mask; |
| 1062 | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 1063 | state->pram[offset] &= ~mem_mask; |
| 1064 | state->pram[offset] |= data & mem_mask; |
| 1068 | 1065 | } |
| 1069 | | */ |
| 1066 | #endif |
| 1070 | 1067 | |
| 1071 | 1068 | // swap address around so that 64x64 tile can be decoded as 8x8 tiles.. |
| 1072 | | void write_swapped_byte(running_machine* machine, int offset, UINT8 byte ) |
| 1069 | static void write_swapped_byte(running_machine* machine, int offset, UINT8 byte ) |
| 1073 | 1070 | { |
| 1074 | | supracan_state *state = (supracan_state *)machine->driver_data<supracan_state>(); |
| 1071 | supracan_state *state = (supracan_state *)machine->driver_data<supracan_state>(); |
| 1075 | 1072 | int swapped_offset = BITSWAP32(offset, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,2,1,0,6,5,4,3); |
| 1076 | 1073 | |
| 1077 | 1074 | state->vram_addr_swapped[swapped_offset] = byte; |
| r10058 | r10059 | |
| 1080 | 1077 | |
| 1081 | 1078 | static READ16_HANDLER( supracan_vram_r ) |
| 1082 | 1079 | { |
| 1083 | | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 1080 | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 1084 | 1081 | return state->vram[offset]; |
| 1085 | 1082 | } |
| 1086 | 1083 | |
| 1087 | 1084 | |
| 1088 | 1085 | static WRITE16_HANDLER( supracan_vram_w ) |
| 1089 | 1086 | { |
| 1090 | | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 1087 | supracan_state *state = (supracan_state *)space->machine->driver_data<supracan_state>(); |
| 1091 | 1088 | COMBINE_DATA(&state->vram[offset]); |
| 1092 | 1089 | |
| 1093 | 1090 | // store a byteswapped vesrion for easier gfx-decode |
| r10058 | r10059 | |
| 1115 | 1112 | AM_RANGE( 0xe80202, 0xe80203 ) AM_READ_PORT("P2") |
| 1116 | 1113 | AM_RANGE( 0xe80208, 0xe80209 ) AM_READ_PORT("P3") |
| 1117 | 1114 | AM_RANGE( 0xe8020c, 0xe8020d ) AM_READ_PORT("P4") |
| 1118 | | AM_RANGE( 0xe80000, 0xe8ffff ) AM_READWRITE( supracan_68k_soundram_r, supracan_68k_soundram_w ) |
| 1115 | AM_RANGE( 0xe80000, 0xe8ffff ) AM_READWRITE( supracan_68k_soundram_r, supracan_68k_soundram_w ) |
| 1119 | 1116 | AM_RANGE( 0xe90000, 0xe9001f ) AM_READWRITE( supracan_sound_r, supracan_sound_w ) |
| 1120 | 1117 | AM_RANGE( 0xe90020, 0xe9003f ) AM_WRITE( supracan_dma_w ) |
| 1121 | 1118 | AM_RANGE( 0xf00000, 0xf001ff ) AM_READWRITE( supracan_video_r, supracan_video_w ) |
| 1122 | | AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) |
| 1119 | AM_RANGE( 0xf00200, 0xf003ff ) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram) |
| 1123 | 1120 | AM_RANGE( 0xf40000, 0xf5ffff ) AM_READWRITE(supracan_vram_r, supracan_vram_w) |
| 1124 | 1121 | AM_RANGE( 0xfc0000, 0xfdffff ) AM_MIRROR(0x30000) AM_RAM /* System work ram */ |
| 1125 | 1122 | ADDRESS_MAP_END |
| r10058 | r10059 | |
| 1520 | 1517 | |
| 1521 | 1518 | static TIMER_CALLBACK( supracan_video_callback ) |
| 1522 | 1519 | { |
| 1523 | | supracan_state *state = machine->driver_data<supracan_state>(); |
| 1520 | supracan_state *state = machine->driver_data<supracan_state>(); |
| 1524 | 1521 | int vpos = machine->primary_screen->vpos(); |
| 1525 | 1522 | |
| 1526 | | state->video_regs[0] &= ~0x0002; |
| 1523 | state->video_regs[0] &= ~0x0002; |
| 1527 | 1524 | |
| 1528 | 1525 | switch( vpos ) |
| 1529 | 1526 | { |
| r10058 | r10059 | |
| 1730 | 1727 | |
| 1731 | 1728 | case 0x1f0/2: //FIXME: this register is mostly not understood |
| 1732 | 1729 | state->irq_mask = data;//(data & 8) ? 0 : 1; |
| 1733 | | /* |
| 1730 | #if 0 |
| 1734 | 1731 | if(!state->irq_mask && !state->hbl_mask) |
| 1735 | 1732 | { |
| 1736 | 1733 | cpu_set_input_line(devtag_get_device(space->machine, "maincpu"), 7, CLEAR_LINE); |
| 1737 | 1734 | } |
| 1738 | | */ |
| 1735 | #endif |
| 1739 | 1736 | verboselog("maincpu", space->machine, 3, "irq_mask = %04x\n", data); |
| 1740 | 1737 | break; |
| 1741 | 1738 | default: |
| r10058 | r10059 | |
| 1882 | 1879 | |
| 1883 | 1880 | static INTERRUPT_GEN( supracan_irq ) |
| 1884 | 1881 | { |
| 1885 | | /* |
| 1882 | #if 0 |
| 1886 | 1883 | supracan_state *state = (supracan_state *)device->machine->driver_data<supracan_state>(); |
| 1887 | 1884 | |
| 1888 | 1885 | if(state->irq_mask) |
| 1889 | 1886 | { |
| 1890 | 1887 | cpu_set_input_line(device, 7, HOLD_LINE); |
| 1891 | 1888 | } |
| 1892 | | */ |
| 1889 | #endif |
| 1893 | 1890 | } |
| 1894 | 1891 | |
| 1895 | 1892 | static INTERRUPT_GEN( supracan_sound_irq ) |
| r10058 | r10059 | |
| 1916 | 1913 | |
| 1917 | 1914 | MCFG_CPU_ADD( "soundcpu", M6502, XTAL_3_579545MHz ) /* TODO: Verfiy actual clock */ |
| 1918 | 1915 | MCFG_CPU_PROGRAM_MAP( supracan_sound_mem ) |
| 1919 | | MCFG_CPU_VBLANK_INT("screen", supracan_sound_irq) |
| 1916 | MCFG_CPU_VBLANK_INT("screen", supracan_sound_irq) |
| 1920 | 1917 | |
| 1921 | 1918 | #if !(SOUNDCPU_BOOT_HACK) |
| 1922 | | MCFG_QUANTUM_PERFECT_CPU("maincpu") |
| 1923 | | MCFG_QUANTUM_PERFECT_CPU("soundcpu") |
| 1919 | MCFG_QUANTUM_PERFECT_CPU("maincpu") |
| 1920 | MCFG_QUANTUM_PERFECT_CPU("soundcpu") |
| 1924 | 1921 | #endif |
| 1925 | 1922 | |
| 1926 | 1923 | MCFG_MACHINE_START( supracan ) |
| r10058 | r10059 | |
| 1928 | 1925 | |
| 1929 | 1926 | MCFG_SCREEN_ADD( "screen", RASTER ) |
| 1930 | 1927 | MCFG_SCREEN_FORMAT( BITMAP_FORMAT_INDEXED16 ) |
| 1931 | | //MCFG_SCREEN_FORMAT( BITMAP_FORMAT_RGB32 ) |
| 1928 | //MCFG_SCREEN_FORMAT( BITMAP_FORMAT_RGB32 ) |
| 1932 | 1929 | MCFG_SCREEN_RAW_PARAMS(XTAL_10_738635MHz/2, 348, 0, 256, 256, 0, 240 ) /* No idea if this is correct */ |
| 1933 | 1930 | |
| 1934 | 1931 | MCFG_PALETTE_LENGTH( 32768 ) |