src/mess/machine/com8116.c
| r4924 | r4925 | |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| 9 | 9 | |
| 10 | | /* |
| 11 | | |
| 12 | | TODO: |
| 13 | | |
| 14 | | - everything |
| 15 | | |
| 16 | | */ |
| 17 | | |
| 18 | 10 | #include "driver.h" |
| 19 | 11 | #include "com8116.h" |
| 20 | 12 | |
| r4924 | r4925 | |
| 35 | 27 | devcb_resolved_write_line out_fr_func; |
| 36 | 28 | devcb_resolved_write_line out_ft_func; |
| 37 | 29 | |
| 30 | UINT32 fr_divisors[16]; /* receiver divisor ROM */ |
| 31 | UINT32 ft_divisors[16]; /* transmitter divisor ROM */ |
| 32 | |
| 33 | int fr; /* receiver frequency */ |
| 34 | int ft; /* transmitter frequency */ |
| 35 | |
| 38 | 36 | /* timers */ |
| 39 | 37 | emu_timer *fx4_timer; |
| 40 | 38 | emu_timer *fr_timer; |
| r4924 | r4925 | |
| 70 | 68 | |
| 71 | 69 | WRITE8_DEVICE_HANDLER( com8116_str_w ) |
| 72 | 70 | { |
| 73 | | // com8116_t *com8116 = get_safe_token(device); |
| 71 | com8116_t *com8116 = get_safe_token(device); |
| 74 | 72 | |
| 75 | 73 | if (LOG) logerror("COM8116 '%s' Receiver Divider %01x\n", device->tag, data & 0x0f); |
| 76 | 74 | |
| 77 | | // timer_adjust_periodic(com8116->fr_timer, attotime_zero, 0, ATTOTIME_IN_HZ(1)); |
| 75 | com8116->fr = data & 0x0f; |
| 76 | |
| 77 | timer_adjust_periodic(com8116->fr_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / com8116->fr_divisors[com8116->fr] / 2)); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /*------------------------------------------------- |
| r4924 | r4925 | |
| 83 | 83 | |
| 84 | 84 | WRITE8_DEVICE_HANDLER( com8116_stt_w ) |
| 85 | 85 | { |
| 86 | | // com8116_t *com8116 = get_safe_token(device); |
| 86 | com8116_t *com8116 = get_safe_token(device); |
| 87 | 87 | |
| 88 | 88 | if (LOG) logerror("COM8116 '%s' Transmitter Divider %01x\n", device->tag, data & 0x0f); |
| 89 | 89 | |
| 90 | | // timer_adjust_periodic(com8116->ft_timer, attotime_zero, 0, ATTOTIME_IN_HZ(1)); |
| 90 | com8116->ft = data & 0x0f; |
| 91 | |
| 92 | timer_adjust_periodic(com8116->ft_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / com8116->ft_divisors[com8116->fr] / 2)); |
| 91 | 93 | } |
| 92 | 94 | |
| 93 | 95 | /*------------------------------------------------- |
| r4924 | r4925 | |
| 134 | 136 | { |
| 135 | 137 | com8116_t *com8116 = get_safe_token(device); |
| 136 | 138 | const com8116_interface *intf = get_interface(device); |
| 139 | int i; |
| 137 | 140 | |
| 138 | 141 | /* resolve callbacks */ |
| 139 | 142 | devcb_resolve_write_line(&com8116->out_fx4_func, &intf->out_fx4_func, device); |
| 140 | 143 | devcb_resolve_write_line(&com8116->out_fr_func, &intf->out_fr_func, device); |
| 141 | 144 | devcb_resolve_write_line(&com8116->out_ft_func, &intf->out_ft_func, device); |
| 142 | 145 | |
| 146 | for (i = 0; i < 16; i++) |
| 147 | { |
| 148 | assert(intf->fr_divisors[i] != 0); |
| 149 | assert(intf->ft_divisors[i] != 0); |
| 150 | |
| 151 | com8116->fr_divisors[i] = intf->fr_divisors[i]; |
| 152 | com8116->ft_divisors[i] = intf->ft_divisors[i]; |
| 153 | } |
| 154 | |
| 143 | 155 | /* create the timers */ |
| 144 | 156 | if (com8116->out_fx4_func.target) |
| 145 | 157 | { |
| r4924 | r4925 | |
| 151 | 163 | com8116->ft_timer = timer_alloc(device->machine, ft_tick, (void *)device); |
| 152 | 164 | |
| 153 | 165 | /* register for state saving */ |
| 154 | | // state_save_register_global(device->machine, com8116->); |
| 166 | state_save_register_global(device->machine, com8116->fr); |
| 167 | state_save_register_global(device->machine, com8116->ft); |
| 155 | 168 | } |
| 156 | 169 | |
| 157 | 170 | /*------------------------------------------------- |
src/mess/drivers/xerox820.c
| r4924 | r4925 | |
| 11 | 11 | |
| 12 | 12 | TODO: |
| 13 | 13 | |
| 14 | | - COM8116 |
| 14 | - Big Board |
| 15 | - Big Board II |
| 16 | - Xerox 820-II |
| 17 | - Xerox 16/8 |
| 15 | 18 | - type in Monitor v1.0 from manual |
| 16 | 19 | - proper keyboard emulation (MCU?) |
| 17 | 20 | |
| r4924 | r4925 | |
| 142 | 145 | { |
| 143 | 146 | /* ROM */ |
| 144 | 147 | memory_install_readwrite8_handler(program, 0x0000, 0x0fff, 0, 0, SMH_BANK(1), SMH_UNMAP); |
| 148 | memory_install_readwrite8_handler(program, 0x1000, 0x2fff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 145 | 149 | } |
| 146 | 150 | else |
| 147 | 151 | { |
| 148 | 152 | /* RAM */ |
| 149 | 153 | memory_install_readwrite8_handler(program, 0x0000, 0x0fff, 0, 0, SMH_BANK(1), SMH_BANK(1)); |
| 154 | memory_install_readwrite8_handler(program, 0x1000, 0x2fff, 0, 0, SMH_BANK(2), SMH_BANK(2)); |
| 150 | 155 | } |
| 151 | 156 | |
| 152 | | memory_install_readwrite8_handler(program, 0x3000, 0x3fff, 0, 0, SMH_BANK(2), SMH_BANK(2)); |
| 157 | memory_install_readwrite8_handler(program, 0x3000, 0x3fff, 0, 0, SMH_BANK(3), SMH_BANK(3)); |
| 153 | 158 | |
| 154 | 159 | memory_set_bank(machine, 1, bank); |
| 155 | | memory_set_bank(machine, 2, bank); |
| 160 | memory_set_bank(machine, 3, bank); |
| 156 | 161 | } |
| 157 | 162 | |
| 158 | 163 | static WRITE8_HANDLER( scroll_w ) |
| 159 | 164 | { |
| 160 | 165 | xerox820_state *state = space->machine->driver_data; |
| 161 | 166 | |
| 162 | | state->scroll = data; |
| 167 | state->scroll = (offset >> 8) & 0x1f; |
| 163 | 168 | } |
| 164 | 169 | |
| 165 | 170 | /* Memory Maps */ |
| r4924 | r4925 | |
| 167 | 172 | static ADDRESS_MAP_START( xerox820_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 168 | 173 | ADDRESS_MAP_UNMAP_HIGH |
| 169 | 174 | AM_RANGE(0x0000, 0x0fff) AM_RAMBANK(1) |
| 170 | | AM_RANGE(0x1000, 0x2fff) AM_RAM |
| 171 | | AM_RANGE(0x3000, 0x3fff) AM_RAMBANK(2) |
| 175 | AM_RANGE(0x1000, 0x2fff) AM_RAMBANK(2) |
| 176 | AM_RANGE(0x3000, 0x3fff) AM_RAMBANK(3) |
| 172 | 177 | AM_RANGE(0x4000, 0xffff) AM_RAM |
| 173 | 178 | ADDRESS_MAP_END |
| 174 | 179 | |
| 175 | 180 | static ADDRESS_MAP_START( xerox820_io, ADDRESS_SPACE_IO, 8 ) |
| 176 | | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 177 | | AM_RANGE(0x00, 0x00) AM_MIRROR(0x03) AM_DEVWRITE(COM8116_TAG, com8116_str_w) |
| 178 | | AM_RANGE(0x04, 0x04) AM_MIRROR(0x02) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_d_r, z80sio_d_w) |
| 179 | | AM_RANGE(0x05, 0x05) AM_MIRROR(0x02) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_c_r, z80sio_c_w) |
| 180 | | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80GPPIO_TAG, z80pio_alt_r, z80pio_alt_w) |
| 181 | | AM_RANGE(0x0c, 0x0c) AM_MIRROR(0x03) AM_DEVWRITE(COM8116_TAG, com8116_stt_w) |
| 182 | | AM_RANGE(0x10, 0x13) AM_DEVREADWRITE(WD1771_TAG, wd17xx_r, wd17xx_w) |
| 183 | | AM_RANGE(0x14, 0x14) AM_MIRROR(0x03) AM_WRITE(scroll_w) |
| 184 | | AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w) |
| 185 | | AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE(Z80KBPIO_TAG, z80pio_alt_r, z80pio_alt_w) |
| 181 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_str_w) |
| 182 | AM_RANGE(0x04, 0x04) AM_MIRROR(0xff02) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_d_r, z80sio_d_w) |
| 183 | AM_RANGE(0x05, 0x05) AM_MIRROR(0xff02) AM_DEVREADWRITE(Z80SIO_TAG, z80sio_c_r, z80sio_c_w) |
| 184 | AM_RANGE(0x08, 0x0b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80GPPIO_TAG, z80pio_alt_r, z80pio_alt_w) |
| 185 | AM_RANGE(0x0c, 0x0c) AM_MIRROR(0xff03) AM_DEVWRITE(COM8116_TAG, com8116_stt_w) |
| 186 | AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_DEVREADWRITE(WD1771_TAG, wd17xx_r, wd17xx_w) |
| 187 | AM_RANGE(0x14, 0x14) AM_MIRROR(0xff03) AM_MASK(0xff00) AM_WRITE(scroll_w) |
| 188 | AM_RANGE(0x18, 0x1b) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w) |
| 189 | AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xff00) AM_DEVREADWRITE(Z80KBPIO_TAG, z80pio_alt_r, z80pio_alt_w) |
| 186 | 190 | ADDRESS_MAP_END |
| 187 | 191 | |
| 188 | 192 | /* Input Ports */ |
| r4924 | r4925 | |
| 503 | 507 | DEVCB_NULL, /* fX/4 output */ |
| 504 | 508 | DEVCB_NULL, /* fR output */ |
| 505 | 509 | DEVCB_NULL, /* fT output */ |
| 506 | | {0}, /* receiver ROM */ |
| 507 | | {0} /* transmitter ROM */ |
| 510 | { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* receiver divisor ROM */ |
| 511 | { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, /* transmitter divisor ROM */ |
| 508 | 512 | }; |
| 509 | 513 | |
| 510 | 514 | /* Video */ |
| r4924 | r4925 | |
| 576 | 580 | state->kbpio = devtag_get_device(machine, Z80KBPIO_TAG); |
| 577 | 581 | state->z80ctc = devtag_get_device(machine, Z80CTC_TAG); |
| 578 | 582 | state->wd1771 = devtag_get_device(machine, WD1771_TAG); |
| 579 | | // state->com8116 = devtag_get_device(machine, COM8116_TAG); |
| 580 | 583 | |
| 581 | 584 | /* allocate video memory */ |
| 582 | 585 | state->video_ram = auto_alloc_array(machine, UINT8, XEROX820_LCD_VIDEORAM_SIZE); |
| r4924 | r4925 | |
| 585 | 588 | memory_configure_bank(machine, 1, 0, 1, memory_region(machine, Z80_TAG), 0); |
| 586 | 589 | memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "monitor"), 0); |
| 587 | 590 | |
| 588 | | memory_configure_bank(machine, 2, 0, 1, memory_region(machine, Z80_TAG) + 0x3000, 0); |
| 589 | | memory_configure_bank(machine, 2, 1, 1, state->video_ram, 0); |
| 591 | memory_configure_bank(machine, 2, 0, 1, memory_region(machine, Z80_TAG) + 0x1000, 0); |
| 592 | memory_set_bank(machine, 2, 0); |
| 590 | 593 | |
| 594 | memory_configure_bank(machine, 3, 0, 1, memory_region(machine, Z80_TAG) + 0x3000, 0); |
| 595 | memory_configure_bank(machine, 3, 1, 1, state->video_ram, 0); |
| 596 | |
| 591 | 597 | /* bank switch */ |
| 592 | 598 | xerox820_bankswitch(machine, 1); |
| 593 | 599 | |
| r4924 | r4925 | |
| 707 | 713 | state->_8n5 = 1; |
| 708 | 714 | state->dsdd = 0; |
| 709 | 715 | return INIT_PASS; |
| 716 | |
| 717 | case 40*1*18*128: // 90K 5.25" SSSD |
| 718 | basicdsk_set_geometry(image, 40, 1, 18, 128, 1, 0, FALSE); |
| 719 | state->_8n5 = 0; |
| 720 | state->dsdd = 0; |
| 721 | return INIT_PASS; |
| 722 | |
| 723 | case 40*2*18*128: // 180K 5.25" DSSD |
| 724 | basicdsk_set_geometry(image, 40, 2, 18, 128, 1, 0, FALSE); |
| 725 | state->_8n5 = 0; |
| 726 | state->dsdd = 1; |
| 727 | return INIT_PASS; |
| 710 | 728 | } |
| 711 | 729 | } |
| 712 | 730 | |
| r4924 | r4925 | |
| 738 | 756 | /* |
| 739 | 757 | static SYSTEM_CONFIG_START( xerox820ii ) |
| 740 | 758 | CONFIG_RAM_DEFAULT (64 * 1024) |
| 741 | | CONFIG_DEVICE(xerox820_floppy_getinfo) |
| 759 | CONFIG_DEVICE(xerox820ii_floppy_getinfo) |
| 742 | 760 | // CONFIG_DEVICE(xerox820_harddisk_getinfo) 10MB |
| 743 | 761 | SYSTEM_CONFIG_END |
| 744 | 762 | */ |
| 745 | 763 | /* System Drivers */ |
| 746 | 764 | |
| 747 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 748 | | COMP( 1981, xerox820, 0, 0, xerox820, xerox820, 0, xerox820, "Xerox", "Xerox 820", GAME_NOT_WORKING) |
| 765 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 766 | COMP( 1981, xerox820, 0, 0, xerox820, xerox820, 0, xerox820, "Xerox", "Xerox 820", 0) |
| 749 | 767 | /* |
| 750 | | COMP( 1983, xerox820ii, xerox820, 0, xerox820ii, xerox820, 0, xerox820ii, "Xerox", "Xerox 820-II", GAME_NOT_WORKING) |
| 768 | COMP( 1980, bigboard, 0, 0, bigboard, bigboard, 0, bigboard, "Digital Research Computers", "Big Board", GAME_NOT_WORKING) |
| 769 | COMP( 1983, bigbord2, 0, 0, bigbord2, bigboard, 0, bigbord2, "Digital Research Computers", "Big Board II", GAME_NOT_WORKING) |
| 770 | COMP( 1983, xerox820ii, 0, 0, xerox820ii, xerox820, 0, xerox820ii, "Xerox", "Xerox 820-II", GAME_NOT_WORKING) |
| 771 | COMP( 1983, xerox168, 0, 0, xerox168, xerox168, 0, xerox816, "Xerox", "Xerox 16/8", GAME_NOT_WORKING) |
| 751 | 772 | */ |