src/mess/machine/pet.c
| r1813 | r1814 | |
| 18 | 18 | #include "includes/pet.h" |
| 19 | 19 | #include "includes/cbmserb.h" |
| 20 | 20 | #include "includes/cbmieeeb.h" |
| 21 | | #include "video/mc6845.h" |
| 22 | 21 | |
| 23 | 22 | /* keyboard lines */ |
| 24 | 23 | static int pet_basic1=0; /* basic version 1 for quickloader */ |
| r1813 | r1814 | |
| 256 | 255 | else if (offset<0x40) ; |
| 257 | 256 | else if (offset<0x50) via_0_w(offset&0xf,data); |
| 258 | 257 | else if (offset<0x80) ; |
| 259 | | else if (offset == 0x80) crtc6845_0_address_w(offset&1, data); |
| 260 | | else if (offset == 0x81) crtc6845_0_register_w(offset&1,data); |
| 258 | else if (offset == 0x80) pet_mc6845_address_w(offset, data); |
| 259 | else if (offset == 0x81) pet_mc6845_register_w(offset, data); |
| 261 | 260 | } |
| 262 | 261 | |
| 263 | 262 | static READ8_HANDLER(cbm8096_io_r) |
| r1813 | r1814 | |
| 270 | 269 | else if (offset<0x40) ; |
| 271 | 270 | else if (offset<0x50) data=via_0_r(offset&0xf); |
| 272 | 271 | else if (offset<0x80) ; |
| 273 | | else if (offset == 0x81) data=crtc6845_0_register_r(offset&1); |
| 272 | else if (offset == 0x81) data=pet_mc6845_register_r(offset); |
| 274 | 273 | return data; |
| 275 | 274 | } |
| 276 | 275 | |
| r1813 | r1814 | |
| 494 | 493 | pet_vh_init(); |
| 495 | 494 | } |
| 496 | 495 | |
| 497 | | //static const struct mscrtc6845_config crtc_pet = { 800000 /*?*/}; |
| 498 | | static void pet_display_enable_changed(running_machine *machine, mc6845_t *mc6845, int display_enabled) |
| 499 | | { |
| 500 | | } |
| 501 | | |
| 502 | | static const mc6845_interface crtc_pet40 = { |
| 503 | | 0, |
| 504 | | 800000 /*?*/, |
| 505 | | 8 /*?*/, |
| 506 | | NULL, |
| 507 | | pet40_update_row, |
| 508 | | NULL, |
| 509 | | pet_display_enable_changed |
| 510 | | }; |
| 511 | | |
| 512 | | static const mc6845_interface crtc_pet80 = { |
| 513 | | 0, |
| 514 | | 800000 /*?*/, |
| 515 | | 16 /*?*/, |
| 516 | | NULL, |
| 517 | | pet80_update_row, |
| 518 | | NULL, |
| 519 | | pet_display_enable_changed |
| 520 | | }; |
| 521 | | |
| 522 | 496 | DRIVER_INIT( pet40 ) |
| 523 | 497 | { |
| 524 | 498 | pet_common_driver_init (); |
| 525 | 499 | pia_config(0, &pet_pia0); |
| 526 | 500 | pet_vh_init(); |
| 527 | | crtc6845_config( 0, &crtc_pet40); |
| 528 | 501 | } |
| 529 | 502 | |
| 530 | 503 | DRIVER_INIT( cbm80 ) |
| r1813 | r1814 | |
| 537 | 510 | videoram = &pet_memory[0x8000]; |
| 538 | 511 | videoram_size = 0x800; |
| 539 | 512 | pet80_vh_init(); |
| 540 | | crtc6845_config( 0, &crtc_pet80); |
| 541 | 513 | } |
| 542 | 514 | |
| 543 | 515 | DRIVER_INIT( superpet ) |
| r1813 | r1814 | |
| 552 | 524 | memory_set_bank(1, 0); |
| 553 | 525 | |
| 554 | 526 | superpet_vh_init(); |
| 555 | | crtc6845_config( 0, &crtc_pet80); |
| 556 | 527 | } |
| 557 | 528 | |
| 558 | 529 | MACHINE_RESET( pet ) |
src/mess/drivers/pet.c
| r1813 | r1814 | |
| 125 | 125 | #include "includes/cbmieeeb.h" |
| 126 | 126 | /*#include "includes/vc1541.h" */ |
| 127 | 127 | |
| 128 | static mc6845_t *mc6845; |
| 129 | |
| 128 | 130 | static ADDRESS_MAP_START(pet_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 129 | | AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size ) |
| 131 | AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x0c00) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size ) |
| 130 | 132 | AM_RANGE(0xa000, 0xe7ff) AM_ROM |
| 131 | 133 | AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w) |
| 132 | 134 | AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w) |
| r1813 | r1814 | |
| 136 | 138 | ADDRESS_MAP_END |
| 137 | 139 | |
| 138 | 140 | static ADDRESS_MAP_START( pet40_mem , ADDRESS_SPACE_PROGRAM, 8) |
| 139 | | AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size ) |
| 141 | AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x0c00) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size ) |
| 140 | 142 | AM_RANGE(0xa000, 0xe7ff) AM_ROM |
| 141 | 143 | AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w) |
| 142 | 144 | AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w) |
| 143 | 145 | AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w) |
| 144 | | AM_RANGE(0xe880, 0xe880) AM_WRITE( crtc6845_0_address_w ) |
| 145 | | AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w) |
| 146 | AM_RANGE(0xe880, 0xe880) AM_WRITE( pet_mc6845_address_w ) |
| 147 | AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w) |
| 146 | 148 | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 147 | 149 | ADDRESS_MAP_END |
| 148 | 150 | |
| r1813 | r1814 | |
| 158 | 160 | AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w) |
| 159 | 161 | AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w) |
| 160 | 162 | AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w) |
| 161 | | AM_RANGE(0xe880, 0xe880) AM_WRITE( crtc6845_0_address_w ) |
| 162 | | AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w) |
| 163 | AM_RANGE(0xe880, 0xe880) AM_WRITE( pet_mc6845_address_w ) |
| 164 | AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w) |
| 163 | 165 | #endif |
| 164 | 166 | AM_RANGE(0xf000, 0xffff) AM_READ(MRA8_BANK8) |
| 165 | 167 | AM_RANGE(0xf000, 0xffef) AM_WRITE(MWA8_BANK8) |
| r1813 | r1814 | |
| 189 | 191 | AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w) |
| 190 | 192 | AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w) |
| 191 | 193 | AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w) |
| 192 | | AM_RANGE(0xe880, 0xe880) AM_WRITE(crtc6845_0_address_w) |
| 193 | | AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w) |
| 194 | AM_RANGE(0xe880, 0xe880) AM_WRITE(pet_mc6845_address_w) |
| 195 | AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w) |
| 194 | 196 | /* 0xefe0, 0xefe3, mos 6702 */ |
| 195 | 197 | /* 0xeff0, 0xeff3, acia6551 */ |
| 196 | 198 | AM_RANGE(0xeff8, 0xefff) AM_READWRITE(superpet_r, superpet_w) |
| r1813 | r1814 | |
| 205 | 207 | AM_RANGE(0xe810, 0xe813) AM_READWRITE(pia_0_r, pia_0_w) |
| 206 | 208 | AM_RANGE(0xe820, 0xe823) AM_READWRITE(pia_1_r, pia_1_w) |
| 207 | 209 | AM_RANGE(0xe840, 0xe84f) AM_READWRITE(via_0_r, via_0_w) |
| 208 | | AM_RANGE(0xe880, 0xe880) AM_WRITE(crtc6845_0_address_w) |
| 209 | | AM_RANGE(0xe881, 0xe881) AM_READWRITE(crtc6845_0_register_r, crtc6845_0_register_w) |
| 210 | AM_RANGE(0xe880, 0xe880) AM_WRITE(pet_mc6845_address_w) |
| 211 | AM_RANGE(0xe881, 0xe881) AM_READWRITE(pet_mc6845_register_r, pet_mc6845_register_w) |
| 210 | 212 | AM_RANGE(0xeff8, 0xefff) AM_READWRITE(superpet_r, superpet_w) |
| 211 | 213 | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 212 | 214 | ADDRESS_MAP_END |
| r1813 | r1814 | |
| 476 | 478 | 0,0x80,0, /* green */ |
| 477 | 479 | }; |
| 478 | 480 | |
| 479 | | static const unsigned short pet_colortable[][2] = { |
| 480 | | { 0, 1 }, |
| 481 | | /* reverse */ |
| 482 | | { 1, 0 } |
| 483 | | }; |
| 484 | | |
| 485 | 481 | static const gfx_layout pet_charlayout = |
| 486 | 482 | { |
| 487 | 483 | 8,8, |
| r1813 | r1814 | |
| 529 | 525 | GFXDECODE_ENTRY( REGION_GFX1, 0x3000, pet80_charlayout, 0, 1 ) |
| 530 | 526 | GFXDECODE_END |
| 531 | 527 | |
| 528 | static const mc6845_interface crtc_pet40 = { |
| 529 | 0, |
| 530 | XTAL_17_73447MHz/3, /* This is a wild guess and mostly likely incorrect */ |
| 531 | 8, |
| 532 | NULL, |
| 533 | pet40_update_row, |
| 534 | NULL, |
| 535 | pet_display_enable_changed, |
| 536 | NULL, |
| 537 | NULL |
| 538 | }; |
| 539 | |
| 540 | static const mc6845_interface crtc_pet80 = { |
| 541 | 0, |
| 542 | XTAL_12MHz / 2, /* This is a wild guess and mostly likely incorrect */ |
| 543 | 16, |
| 544 | NULL, |
| 545 | pet80_update_row, |
| 546 | NULL, |
| 547 | pet_display_enable_changed, |
| 548 | NULL, |
| 549 | NULL |
| 550 | }; |
| 551 | |
| 532 | 552 | static PALETTE_INIT( pet ) |
| 533 | 553 | { |
| 534 | 554 | palette_set_colors_rgb(machine, 0, pet_palette, sizeof(pet_palette) / 3); |
| 535 | 555 | } |
| 536 | 556 | |
| 557 | static VIDEO_START( pet_crtc ) { |
| 558 | mc6845 = devtag_get_token(machine, MC6845, "crtc"); |
| 559 | } |
| 560 | |
| 561 | static VIDEO_UPDATE( pet_crtc ) { |
| 562 | mc6845_update(mc6845, bitmap, cliprect); |
| 563 | return 0; |
| 564 | } |
| 565 | |
| 566 | READ8_HANDLER( pet_mc6845_register_r ) { |
| 567 | return mc6845_register_r( mc6845 ); |
| 568 | } |
| 569 | |
| 570 | WRITE8_HANDLER( pet_mc6845_register_w ) { |
| 571 | mc6845_register_w( mc6845, data ); |
| 572 | } |
| 573 | |
| 574 | WRITE8_HANDLER( pet_mc6845_address_w ) { |
| 575 | mc6845_address_w( mc6845, data ); |
| 576 | } |
| 577 | |
| 537 | 578 | /* basic 1 */ |
| 538 | 579 | ROM_START (pet) |
| 539 | 580 | ROM_REGION (0x10000, REGION_CPU1, 0) |
| r1813 | r1814 | |
| 815 | 856 | MDRV_IMPORT_FROM( pet ) |
| 816 | 857 | MDRV_CPU_MODIFY( "main" ) |
| 817 | 858 | MDRV_CPU_PROGRAM_MAP( pet40_mem, 0 ) |
| 818 | | MDRV_VIDEO_UPDATE( crtc6845 ) |
| 859 | |
| 860 | MDRV_DEVICE_ADD("crtc", MC6845) |
| 861 | MDRV_DEVICE_CONFIG( crtc_pet40 ) |
| 862 | |
| 863 | MDRV_VIDEO_START( pet_crtc ) |
| 864 | MDRV_VIDEO_UPDATE( pet_crtc ) |
| 819 | 865 | MACHINE_DRIVER_END |
| 820 | 866 | |
| 821 | 867 | |
| r1813 | r1814 | |
| 837 | 883 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 838 | 884 | MDRV_SCREEN_SIZE(640, 250) |
| 839 | 885 | MDRV_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 250 - 1) |
| 886 | |
| 887 | MDRV_DEVICE_ADD("crtc", MC6845) |
| 888 | MDRV_DEVICE_CONFIG( crtc_pet80 ) |
| 889 | |
| 840 | 890 | MDRV_GFXDECODE( pet80 ) |
| 841 | | MDRV_VIDEO_UPDATE( crtc6845 ) |
| 891 | MDRV_VIDEO_START( pet_crtc ) |
| 892 | MDRV_VIDEO_UPDATE( pet_crtc ) |
| 842 | 893 | MACHINE_DRIVER_END |
| 843 | 894 | |
| 844 | 895 | |
| r1813 | r1814 | |
| 861 | 912 | |
| 862 | 913 | MDRV_SCREEN_MODIFY("main") |
| 863 | 914 | MDRV_SCREEN_REFRESH_RATE(50) |
| 864 | | |
| 865 | | /* video hardware */ |
| 866 | 915 | MDRV_GFXDECODE( superpet ) |
| 867 | 916 | MACHINE_DRIVER_END |
| 868 | 917 | |