src/mess/video/mbee.c
| r9247 | r9248 | |
| 66 | 66 | static UINT8 *gfxram; |
| 67 | 67 | static UINT8 *colorram; |
| 68 | 68 | static UINT8 *videoram; |
| 69 | static UINT8 *attribram; |
| 69 | 70 | static UINT8 mbee_08; |
| 70 | 71 | static UINT8 mbee_0a; |
| 71 | 72 | static UINT8 mbee_0b; |
| 73 | static UINT8 mbee_1c; |
| 72 | 74 | static UINT8 mc6845_cursor[16]; // cursor shape |
| 73 | 75 | static void mc6845_cursor_configure(void); |
| 74 | 76 | static void mc6845_screen_configure(running_machine *machine); |
| 75 | 77 | |
| 78 | |
| 76 | 79 | READ8_HANDLER( mbee_low_r ) |
| 77 | 80 | { |
| 78 | 81 | if (mbee_0b & 1) |
| r9247 | r9248 | |
| 143 | 146 | memory_set_bank(space->machine, "pak", data & 7); |
| 144 | 147 | } |
| 145 | 148 | |
| 149 | WRITE8_HANDLER ( mbeeppc_0a_w ) |
| 150 | { |
| 151 | mbee_0a = data; |
| 152 | memory_set_bank(space->machine, "pak", (data&15) >> 1); |
| 153 | } |
| 146 | 154 | |
| 155 | READ8_HANDLER ( mbeepc_telcom_low_r ) |
| 156 | { |
| 157 | /* Read of port 0A - set Telcom rom to first half */ |
| 158 | memory_set_bank(space->machine, "telcom", 0); |
| 159 | return mbee_0a; |
| 160 | } |
| 147 | 161 | |
| 162 | READ8_HANDLER ( mbeepc_telcom_high_r ) |
| 163 | { |
| 164 | /* Read of port 10A - set Telcom rom to 2nd half */ |
| 165 | memory_set_bank(space->machine, "telcom", 1); |
| 166 | return mbee_0a; |
| 167 | } |
| 168 | |
| 169 | READ8_HANDLER ( mbeeppc_1c_r ) |
| 170 | { |
| 171 | return mbee_1c; |
| 172 | } |
| 173 | |
| 174 | WRITE8_HANDLER( mbeeppc_1c_w ) |
| 175 | { |
| 176 | /* d7 extended graphics - not emulated |
| 177 | d5 bankswitch basic rom |
| 178 | d4 select attribute ram |
| 179 | d3..d0 select videoram bank */ |
| 180 | |
| 181 | mbee_1c = data; |
| 182 | memory_set_bank(space->machine, "basic", (data & 0x20) ? 1 : 0); |
| 183 | } |
| 184 | |
| 185 | READ8_HANDLER( mbeeppc_low_r ) |
| 186 | { |
| 187 | if (mbee_1c & 16) |
| 188 | return attribram[offset]; |
| 189 | else |
| 190 | if (mbee_0b & 1) |
| 191 | return gfxram[offset]; |
| 192 | else |
| 193 | return videoram[offset]; |
| 194 | } |
| 195 | |
| 196 | WRITE8_HANDLER( mbeeppc_low_w ) |
| 197 | { |
| 198 | if (mbee_1c & 16) |
| 199 | attribram[offset] = data; |
| 200 | else |
| 201 | videoram[offset] = data; |
| 202 | } |
| 203 | |
| 204 | READ8_HANDLER( mbeeppc_high_r ) |
| 205 | { |
| 206 | if (mbee_08 & 0x40) |
| 207 | return colorram[offset]; |
| 208 | else |
| 209 | return gfxram[(((mbee_1c & 15) + 1) << 11) | offset]; |
| 210 | } |
| 211 | |
| 212 | WRITE8_HANDLER ( mbeeppc_high_w ) |
| 213 | { |
| 214 | if ((mbee_08 & 0x40) && (~mbee_0b & 1)) |
| 215 | colorram[offset] = data; |
| 216 | else |
| 217 | gfxram[(((mbee_1c & 15) + 1) << 11) | offset] = data; |
| 218 | } |
| 219 | |
| 220 | |
| 148 | 221 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; |
| 149 | 222 | |
| 150 | 223 | /* The direction keys are used by the pc85 menu. Do not know what uses the "insert" key. */ |
| r9247 | r9248 | |
| 193 | 266 | |
| 194 | 267 | |
| 195 | 268 | |
| 196 | | WRITE8_HANDLER ( mbeeppc_0a_w ) |
| 197 | | { |
| 198 | | mbee_0a = data; |
| 199 | | memory_set_bank(space->machine, "pak", (data&15) >> 1); |
| 200 | | } |
| 201 | 269 | |
| 202 | | READ8_HANDLER ( mbeepc_telcom_low_r ) |
| 203 | | { |
| 204 | | /* Read of port 0A - set Telcom rom to first half */ |
| 205 | | memory_set_bank(space->machine, "telcom", 0); |
| 206 | | return mbee_0a; |
| 207 | | } |
| 208 | 270 | |
| 209 | | READ8_HANDLER ( mbeepc_telcom_high_r ) |
| 210 | | { |
| 211 | | /* Read of port 10A - set Telcom rom to 2nd half */ |
| 212 | | memory_set_bank(space->machine, "telcom", 1); |
| 213 | | return mbee_0a; |
| 214 | | } |
| 215 | 271 | |
| 216 | | WRITE8_HANDLER( mbeeppc_1c_w ) |
| 217 | | { |
| 218 | | /* d7 extended graphics - not emulated |
| 219 | | d5 bankswitch basic rom |
| 220 | | d4 select attribute ram - not emulated |
| 221 | | d3..d0 select videoram bank - not emulated */ |
| 222 | | |
| 223 | | memory_set_bank(space->machine, "bank6", (data & 0x20) ? 1 : 0); |
| 224 | | } |
| 225 | | |
| 226 | | |
| 227 | 272 | static void m6545_update_strobe(running_machine *machine, int param) |
| 228 | 273 | { |
| 229 | 274 | keyboard_matrix_r(machine, param); |
| r9247 | r9248 | |
| 507 | 552 | gfxram = memory_region(machine, "gfx")+0x1000; |
| 508 | 553 | } |
| 509 | 554 | |
| 555 | VIDEO_START( mbeeppc ) |
| 556 | { |
| 557 | videoram = memory_region(machine, "videoram"); |
| 558 | colorram = memory_region(machine, "colorram"); |
| 559 | gfxram = memory_region(machine, "gfx")+0x1000; |
| 560 | attribram = memory_region(machine, "attrib"); |
| 561 | } |
| 562 | |
| 510 | 563 | VIDEO_UPDATE( mbee ) |
| 511 | 564 | { |
| 512 | 565 | UINT8 y,ra,chr,gfx; |
| r9247 | r9248 | |
| 623 | 676 | return 0; |
| 624 | 677 | } |
| 625 | 678 | |
| 679 | /* Need to find how the colour works on this model */ |
| 680 | VIDEO_UPDATE( mbeeppc ) |
| 681 | { |
| 682 | UINT8 y,ra,gfx,fg,bg; |
| 683 | UINT16 mem,sy=0,ma=0,x,col,chr; |
| 684 | UINT8 speed = crt.cursor_top&0x20, flash = crt.cursor_top&0x40; // cursor modes |
| 685 | UINT16 cursor = (crt.cursor_address_hi<<8) | crt.cursor_address_lo; // get cursor position |
| 686 | UINT16 screen_home = (crt.screen_address_hi<<8) | crt.screen_address_lo; // screen home offset (usually zero) |
| 687 | UINT16 colourm = (mbee_08 & 0x0e) << 7; |
| 688 | |
| 689 | framecnt++; |
| 690 | |
| 691 | for (y = 0; y < crt.vertical_displayed; y++) // for each row of chars |
| 692 | { |
| 693 | for (ra = 0; ra < (crt.scan_lines&15)+1; ra++) // for each scanline - RA4 is used as an update strobe for the keyboard |
| 694 | { |
| 695 | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0); |
| 696 | |
| 697 | for (x = ma; x < ma + crt.horizontal_displayed; x++) // for each character |
| 698 | { |
| 699 | UINT8 inv=0; |
| 700 | mem = (x + screen_home) & 0x7ff; |
| 701 | chr = videoram[mem]; |
| 702 | col = colorram[mem] | colourm; // read a byte of colour |
| 703 | |
| 704 | if (chr & 0x80) |
| 705 | chr += (attribram[mem] << 7); // bump chr to its particular pcg definition |
| 706 | |
| 707 | if ((x & 15) == 0) |
| 708 | { |
| 709 | if (mbee_wait_time) |
| 710 | mbee_wait_time--; |
| 711 | else |
| 712 | m6545_update_strobe(screen->machine, x); |
| 713 | } |
| 714 | |
| 715 | /* process cursor */ |
| 716 | if ((((!flash) && (!speed)) || // (5,6)=(0,0) = cursor on always |
| 717 | ((flash) && (speed) && (framecnt & 0x10)) || // (5,6)=(1,1) = cycle per 32 frames |
| 718 | ((flash) && (!speed) && (framecnt & 8))) && // (5,6)=(0,1) = cycle per 16 frames |
| 719 | (mem == cursor)) // displaying at cursor position? |
| 720 | inv ^= mc6845_cursor[ra]; // cursor scan row |
| 721 | |
| 722 | /* get pattern of pixels for that character scanline */ |
| 723 | gfx = gfxram[(chr<<4) | ra] ^ inv; |
| 724 | fg = (col & 0x001f) | 64; // map to foreground palette |
| 725 | bg = (col & 0x07e0) >> 5; // and background palette |
| 726 | |
| 727 | /* Display a scanline of a character (8 pixels) */ |
| 728 | *p = ( gfx & 0x80 ) ? fg : bg; p++; |
| 729 | *p = ( gfx & 0x40 ) ? fg : bg; p++; |
| 730 | *p = ( gfx & 0x20 ) ? fg : bg; p++; |
| 731 | *p = ( gfx & 0x10 ) ? fg : bg; p++; |
| 732 | *p = ( gfx & 0x08 ) ? fg : bg; p++; |
| 733 | *p = ( gfx & 0x04 ) ? fg : bg; p++; |
| 734 | *p = ( gfx & 0x02 ) ? fg : bg; p++; |
| 735 | *p = ( gfx & 0x01 ) ? fg : bg; p++; |
| 736 | } |
| 737 | } |
| 738 | ma+=crt.horizontal_displayed; |
| 739 | } |
| 740 | return 0; |
| 741 | } |
| 742 | |
| 743 | |
| 626 | 744 | PALETTE_INIT( mbeeic ) |
| 627 | 745 | { |
| 628 | 746 | UINT16 i; |
src/mess/drivers/mbee.c
| r9247 | r9248 | |
| 134 | 134 | static ADDRESS_MAP_START(mbeeppc_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 135 | 135 | AM_RANGE(0x0000, 0x0fff) AM_RAMBANK("boot") |
| 136 | 136 | AM_RANGE(0x1000, 0x7fff) AM_RAM |
| 137 | | AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank6") |
| 137 | AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("basic") |
| 138 | 138 | AM_RANGE(0xa000, 0xbfff) AM_ROM |
| 139 | 139 | AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("pak") |
| 140 | 140 | AM_RANGE(0xe000, 0xefff) AM_ROMBANK("telcom") |
| 141 | | AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbee_low_r, mbee_low_w) |
| 142 | | AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeic_high_r, mbeeic_high_w) |
| 141 | AM_RANGE(0xf000, 0xf7ff) AM_READWRITE(mbeeppc_low_r, mbeeppc_low_w) |
| 142 | AM_RANGE(0xf800, 0xffff) AM_READWRITE(mbeeppc_high_r, mbeeppc_high_w) |
| 143 | 143 | ADDRESS_MAP_END |
| 144 | 144 | |
| 145 | 145 | static ADDRESS_MAP_START(mbee56_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r9247 | r9248 | |
| 204 | 204 | |
| 205 | 205 | static ADDRESS_MAP_START(mbeeppc_io, ADDRESS_SPACE_IO, 8) |
| 206 | 206 | ADDRESS_MAP_UNMAP_HIGH |
| 207 | | AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff00) AM_DEVREADWRITE("z80pio", z80pio_ba_cd_r, z80pio_ba_cd_w) |
| 208 | | AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff00) AM_READWRITE(mbeeic_08_r, mbeeic_08_w) |
| 209 | | AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe00) AM_READWRITE(mbeepc_telcom_low_r, mbeeppc_0a_w) |
| 210 | | AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff00) AM_READWRITE(mbee_0b_r, mbee_0b_w) |
| 207 | AM_RANGE(0x0000, 0x0003) AM_MIRROR(0xff10) AM_DEVREADWRITE("z80pio", z80pio_ba_cd_r, z80pio_ba_cd_w) |
| 208 | AM_RANGE(0x0008, 0x0008) AM_MIRROR(0xff10) AM_READWRITE(mbeeic_08_r, mbeeic_08_w) |
| 209 | AM_RANGE(0x000a, 0x000a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_low_r, mbeeppc_0a_w) |
| 210 | AM_RANGE(0x000b, 0x000b) AM_MIRROR(0xff10) AM_READWRITE(mbee_0b_r, mbee_0b_w) |
| 211 | 211 | AM_RANGE(0x000c, 0x000c) AM_MIRROR(0xff00) AM_READWRITE(m6545_status_r, m6545_index_w) |
| 212 | | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff00) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 213 | | AM_RANGE(0x001c, 0x001c) AM_MIRROR(0xff00) AM_WRITE(mbeeppc_1c_w) |
| 214 | | AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe00) AM_READWRITE(mbeepc_telcom_high_r, mbeeppc_0a_w) |
| 212 | AM_RANGE(0x000d, 0x000d) AM_MIRROR(0xff10) AM_READWRITE(m6545_data_r, m6545_data_w) |
| 213 | AM_RANGE(0x001c, 0x001c) AM_MIRROR(0xff00) AM_READWRITE(mbeeppc_1c_r,mbeeppc_1c_w) |
| 214 | AM_RANGE(0x010a, 0x010a) AM_MIRROR(0xfe10) AM_READWRITE(mbeepc_telcom_high_r, mbeeppc_0a_w) |
| 215 | 215 | ADDRESS_MAP_END |
| 216 | 216 | |
| 217 | 217 | static ADDRESS_MAP_START(mbee56_io, ADDRESS_SPACE_IO, 8) |
| r9247 | r9248 | |
| 499 | 499 | MDRV_CPU_IO_MAP(mbeepc85_io) |
| 500 | 500 | MACHINE_CONFIG_END |
| 501 | 501 | |
| 502 | | static MACHINE_CONFIG_DERIVED( mbeeppc, mbeepc85 ) |
| 502 | static MACHINE_CONFIG_DERIVED( mbeeppc, mbeeic ) |
| 503 | 503 | MDRV_CPU_MODIFY( "maincpu" ) |
| 504 | 504 | MDRV_CPU_PROGRAM_MAP(mbeeppc_mem) |
| 505 | 505 | MDRV_CPU_IO_MAP(mbeeppc_io) |
| 506 | MDRV_VIDEO_START(mbeeppc) |
| 507 | MDRV_VIDEO_UPDATE(mbeeppc) |
| 506 | 508 | MACHINE_CONFIG_END |
| 507 | 509 | |
| 508 | | static MACHINE_CONFIG_DERIVED( mbee56, mbeepc85 ) |
| 510 | static MACHINE_CONFIG_DERIVED( mbee56, mbeeic ) |
| 509 | 511 | MDRV_CPU_MODIFY( "maincpu" ) |
| 510 | 512 | MDRV_CPU_PROGRAM_MAP(mbee56_mem) |
| 511 | 513 | MDRV_CPU_IO_MAP(mbee56_io) |
| r9247 | r9248 | |
| 513 | 515 | MDRV_FLOPPY_2_DRIVES_ADD(mbee_floppy_config) |
| 514 | 516 | MACHINE_CONFIG_END |
| 515 | 517 | |
| 516 | | static MACHINE_CONFIG_DERIVED( mbee64, mbeepc85 ) |
| 518 | static MACHINE_CONFIG_DERIVED( mbee64, mbeeic ) |
| 517 | 519 | MDRV_CPU_MODIFY( "maincpu" ) |
| 518 | 520 | MDRV_CPU_PROGRAM_MAP(mbee64_mem) |
| 519 | 521 | MDRV_CPU_IO_MAP(mbee64_io) |
| r9247 | r9248 | |
| 575 | 577 | static DRIVER_INIT( mbeeppc ) |
| 576 | 578 | { |
| 577 | 579 | UINT8 *RAM = memory_region(machine, "maincpu"); |
| 578 | | memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x30000); |
| 579 | | memory_configure_bank(machine, "bank6", 0, 2, &RAM[0x30000], 0x2000); |
| 580 | memory_configure_bank(machine, "boot", 0, 1, &RAM[0x0000], 0x0000); |
| 580 | 581 | |
| 582 | RAM = memory_region(machine, "basicrom"); |
| 583 | memory_configure_bank(machine, "basic", 0, 2, &RAM[0x0000], 0x2000); |
| 584 | memory_configure_bank(machine, "boot", 1, 1, &RAM[0x0000], 0x0000); |
| 585 | |
| 581 | 586 | RAM = memory_region(machine, "telcomrom"); |
| 582 | 587 | memory_configure_bank(machine, "telcom", 0, 2, &RAM[0x0000], 0x1000); |
| 583 | 588 | |
| r9247 | r9248 | |
| 586 | 591 | |
| 587 | 592 | memory_set_bank(machine, "pak", 5); |
| 588 | 593 | memory_set_bank(machine, "telcom", 0); |
| 589 | | memory_set_bank(machine, "bank6", 0); |
| 594 | memory_set_bank(machine, "basic", 0); |
| 590 | 595 | mbee_size = 0x8000; |
| 591 | 596 | } |
| 592 | 597 | |
| r9247 | r9248 | |
| 745 | 750 | ROM_END |
| 746 | 751 | |
| 747 | 752 | ROM_START( mbeeppc ) |
| 748 | | ROM_REGION(0x40000,"maincpu", ROMREGION_ERASEFF ) |
| 753 | ROM_REGION(0x10000,"maincpu", ROMREGION_ERASEFF ) |
| 749 | 754 | ROM_LOAD("bas529b.rom", 0xa000, 0x2000, CRC(a1bd986b) SHA1(5d79f210c9042db5aefc85a0bdf45210cb9e9899) ) |
| 750 | | ROM_LOAD("bas529a.rom", 0x30000, 0x4000, CRC(fe8242e1) SHA1(ff790edf4fcc7a134d451dbad7779157b07f6abf) ) |
| 751 | 755 | |
| 756 | ROM_REGION(0x4000, "basicrom", 0) |
| 757 | ROM_LOAD("bas529a.rom", 0x0000, 0x4000, CRC(fe8242e1) SHA1(ff790edf4fcc7a134d451dbad7779157b07f6abf) ) |
| 758 | |
| 752 | 759 | ROM_REGION(0x2000, "telcomrom", 0) |
| 753 | 760 | ROM_LOAD_OPTIONAL("telco321.rom", 0x0000, 0x2000, CRC(36852a11) SHA1(c45b8d03629e86231c6b256a7435abd87d8872a4) ) |
| 754 | 761 | |
| r9247 | r9248 | |
| 762 | 769 | ROM_LOAD_OPTIONAL("vtex235.rom", 0x8000, 0x2000, CRC(8c30ecb2) SHA1(cf068462d7def885bdb5d3a265851b88c727c0d7) ) // 4 |
| 763 | 770 | ROM_LOAD("ppcshell.rom", 0xa000, 0x2000, CRC(1e793555) SHA1(ddeaa081ec4408e80e3fb192865d87daa035c701) ) // 5 |
| 764 | 771 | |
| 765 | | ROM_REGION(0x2000, "gfx", 0) |
| 772 | ROM_REGION(0x9800, "gfx", 0) |
| 766 | 773 | ROM_LOAD("charrom.bin", 0x1000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) |
| 767 | 774 | ROM_RELOAD( 0x0000, 0x1000 ) |
| 768 | 775 | |
| r9247 | r9248 | |
| 770 | 777 | ROM_LOAD( "82s123.ic7", 0x0000, 0x0020, CRC(61b9c16c) SHA1(0ee72377831c21339360c376f7248861d476dc20) ) |
| 771 | 778 | ROM_LOAD_OPTIONAL( "82s123.ic16", 0x0020, 0x0020, CRC(4e779985) SHA1(cd2579cf65032c30b3fe7d6d07b89d4633687481) ) /* video switching prom, not needed for emulation purposes */ |
| 772 | 779 | |
| 773 | | ROM_REGION( 0x1000, "videoram", ROMREGION_ERASE00 ) |
| 780 | ROM_REGION( 0x0800, "videoram", ROMREGION_ERASE00 ) |
| 774 | 781 | ROM_REGION( 0x0800, "colorram", ROMREGION_ERASE00 ) |
| 782 | ROM_REGION( 0x0800, "attrib", ROMREGION_ERASE00 ) |
| 775 | 783 | ROM_END |
| 776 | 784 | |
| 777 | 785 | ROM_START( mbee56 ) |