src/mess/machine/upd1990a.c
| r0 | r4572 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | upd1990a.c |
| 4 | |
| 5 | NEC uPD1990AC CMOS Digital Integrated Circuit |
| 6 | Serial I/O Calendar & Clock |
| 7 | CMOS LSI |
| 8 | |
| 9 | Very preliminary emulation |
| 10 | |
| 11 | TODO: |
| 12 | - implement TP settings to 64Hz, 256Hz, 2048Hz (started implementation) |
| 13 | - implement Set Clock mode |
| 14 | - implement TEST Mode |
| 15 | - what about data_in? |
| 16 | |
| 17 | *********************************************************************/ |
| 18 | |
| 19 | #include "driver.h" |
| 20 | #include "upd1990a.h" |
| 21 | |
| 22 | #define UPD1990AC_XTAL 32768 |
| 23 | |
| 24 | /*************************************************************************** |
| 25 | TYPE DEFINITIONS |
| 26 | ***************************************************************************/ |
| 27 | |
| 28 | typedef struct _upd1990a_t upd1990a_t; |
| 29 | struct _upd1990a_t |
| 30 | { |
| 31 | UINT8 shift_reg[5]; /* 40 Bit Shift Register */ |
| 32 | UINT8 data_in; |
| 33 | UINT8 data_out; |
| 34 | UINT8 shift_mode; |
| 35 | UINT16 freq_divider; |
| 36 | emu_timer *tp; |
| 37 | }; |
| 38 | |
| 39 | |
| 40 | /*************************************************************************** |
| 41 | INLINE FUNCTIONS |
| 42 | ***************************************************************************/ |
| 43 | |
| 44 | INLINE upd1990a_t *get_safe_token(const device_config *device) |
| 45 | { |
| 46 | assert(device != NULL); |
| 47 | assert(device->token != NULL); |
| 48 | assert(device->type == UPD1990A); |
| 49 | |
| 50 | return (upd1990a_t *)device->token; |
| 51 | } |
| 52 | |
| 53 | |
| 54 | /*************************************************************************** |
| 55 | IMPLEMENTATION |
| 56 | ***************************************************************************/ |
| 57 | |
| 58 | static UINT8 upd1990a_bcd( UINT8 val ) |
| 59 | { |
| 60 | return ((val / 10) << 4) | (val % 10); |
| 61 | } |
| 62 | |
| 63 | WRITE8_DEVICE_HANDLER( upd1990a_w ) |
| 64 | { |
| 65 | UINT8 command = data & 0x07; |
| 66 | upd1990a_t *upd1990a = get_safe_token(device); |
| 67 | mame_system_time curtime, *systime = &curtime; |
| 68 | int i; |
| 69 | |
| 70 | if (data & ~0x07) |
| 71 | logerror("uPD1990AC expects only 3 bits data, found %d > 7\n", data); |
| 72 | |
| 73 | mame_get_current_datetime(device->machine, &curtime); |
| 74 | |
| 75 | /* |
| 76 | c0 = command bit 0 |
| 77 | c1 = command bit 1 |
| 78 | c2 = command bit 2 |
| 79 | |
| 80 | c2 c1 c0 | Function |
| 81 | ---------------------------- |
| 82 | 0 0 0 | Register Hold (TEST Mode released) |
| 83 | 0 0 1 | Register Shift |
| 84 | 0 1 0 | Timer Set & Counter Hold |
| 85 | 0 1 1 | Timer Read |
| 86 | 1 0 0 | TP = 64Hz Set (TEST Mode released) |
| 87 | 1 0 1 | TP = 256Hz Set (TEST Mode released) |
| 88 | 1 1 0 | TP = 2048z Set (TEST Mode released) |
| 89 | 1 1 1 | TEST Mode Set |
| 90 | */ |
| 91 | |
| 92 | switch (command) |
| 93 | { |
| 94 | case 0x00: |
| 95 | upd1990a->shift_mode = 0; |
| 96 | break; |
| 97 | case 0x01: |
| 98 | upd1990a->shift_mode = 1; |
| 99 | upd1990a->data_out = upd1990a->shift_reg[0] & 0x01; |
| 100 | break; |
| 101 | case 0x02: /* Set Clock */ |
| 102 | upd1990a->shift_mode = 0; |
| 103 | logerror("RTC Set Clock attempt\n"); |
| 104 | /* Not implemented yet */ |
| 105 | case 0x03: /* Read Clock */ |
| 106 | upd1990a->shift_mode = 0; |
| 107 | upd1990a->shift_reg[0] = upd1990a_bcd(systime->local_time.second); |
| 108 | upd1990a->shift_reg[1] = upd1990a_bcd(systime->local_time.minute); |
| 109 | upd1990a->shift_reg[2] = upd1990a_bcd(systime->local_time.hour); |
| 110 | upd1990a->shift_reg[3] = upd1990a_bcd(systime->local_time.mday); |
| 111 | upd1990a->shift_reg[4] = systime->local_time.weekday; |
| 112 | upd1990a->shift_reg[4] |= systime->local_time.month << 4; |
| 113 | for(i=0; i<5; i++) |
| 114 | logerror("%d ", (upd1990a->shift_reg[i] & 0x0f) + ((upd1990a->shift_reg[i] & 0xf0)>>4)*10); |
| 115 | logerror("\n"); |
| 116 | break; |
| 117 | case 0x04: |
| 118 | upd1990a->freq_divider = 512; |
| 119 | logerror("RTC Set TP 64Hz attempt\n"); |
| 120 | break; |
| 121 | case 0x05: |
| 122 | upd1990a->freq_divider = 128; |
| 123 | logerror("RTC Set TP 256Hz attempt\n"); |
| 124 | break; |
| 125 | case 0x06: |
| 126 | upd1990a->freq_divider = 16; |
| 127 | logerror("RTC Set TP 2048Hz attempt\n"); |
| 128 | break; |
| 129 | case 0x07: |
| 130 | logerror("RTC TEST Mode attempt\n"); |
| 131 | /* Not implemented yet */ |
| 132 | break; |
| 133 | } |
| 134 | |
| 135 | if (command & 0x04 ) |
| 136 | { |
| 137 | UINT16 frequency = UPD1990AC_XTAL / upd1990a->freq_divider; |
| 138 | |
| 139 | // logerror("TP freq %d \n", frequency); |
| 140 | |
| 141 | timer_adjust_periodic(upd1990a->tp, attotime_zero, 0, ATTOTIME_IN_HZ(frequency)); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | |
| 146 | WRITE8_DEVICE_HANDLER( upd1990a_clk_w ) |
| 147 | { |
| 148 | upd1990a_t *upd1990a = get_safe_token(device); |
| 149 | |
| 150 | if (upd1990a->shift_mode) |
| 151 | { |
| 152 | /* Shift Register */ |
| 153 | upd1990a->shift_reg[0] >>= 1; |
| 154 | upd1990a->shift_reg[0] |= upd1990a->shift_reg[1] & 1 ? 0x80 : 0; |
| 155 | upd1990a->shift_reg[1] >>= 1; |
| 156 | upd1990a->shift_reg[1] |= upd1990a->shift_reg[2] & 1 ? 0x80 : 0; |
| 157 | upd1990a->shift_reg[2] >>= 1; |
| 158 | upd1990a->shift_reg[2] |= upd1990a->shift_reg[3] & 1 ? 0x80 : 0; |
| 159 | upd1990a->shift_reg[3] >>= 1; |
| 160 | upd1990a->shift_reg[3] |= upd1990a->shift_reg[4] & 1 ? 0x80 : 0; |
| 161 | upd1990a->shift_reg[4] >>= 1; |
| 162 | upd1990a->shift_reg[4] |= data & 0x10 ? 0x80 : 0; |
| 163 | upd1990a->data_out = upd1990a->shift_reg[0] & 1; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | READ8_DEVICE_HANDLER( upd1990a_data_out_r ) |
| 168 | { |
| 169 | upd1990a_t *upd1990a = get_safe_token(device); |
| 170 | |
| 171 | return upd1990a->data_out; |
| 172 | } |
| 173 | |
| 174 | static TIMER_CALLBACK( rtc_tick ) |
| 175 | { |
| 176 | const device_config *device = devtag_get_device(machine, "rtc"); |
| 177 | upd1990a_t *upd1990a = get_safe_token(device); |
| 178 | UINT16 frequency = UPD1990AC_XTAL / upd1990a->freq_divider; |
| 179 | |
| 180 | logerror("TP freq %d \n", frequency); |
| 181 | |
| 182 | // take system time here? |
| 183 | } |
| 184 | |
| 185 | /* Untested save state support */ |
| 186 | static void upd1990a_register_state_save(const device_config *device) |
| 187 | { |
| 188 | upd1990a_t* upd1990a = get_safe_token( device ); |
| 189 | |
| 190 | state_save_register_global(device->machine, upd1990a->shift_reg[0]); |
| 191 | state_save_register_global(device->machine, upd1990a->shift_reg[1]); |
| 192 | state_save_register_global(device->machine, upd1990a->shift_reg[2]); |
| 193 | state_save_register_global(device->machine, upd1990a->shift_reg[3]); |
| 194 | state_save_register_global(device->machine, upd1990a->shift_reg[4]); |
| 195 | state_save_register_global(device->machine, upd1990a->data_in); |
| 196 | state_save_register_global(device->machine, upd1990a->data_out); |
| 197 | state_save_register_global(device->machine, upd1990a->shift_mode); |
| 198 | state_save_register_global(device->machine, upd1990a->freq_divider); |
| 199 | } |
| 200 | |
| 201 | |
| 202 | static DEVICE_START( upd1990a ) |
| 203 | { |
| 204 | upd1990a_t *upd1990a = get_safe_token(device); |
| 205 | |
| 206 | upd1990a->tp = timer_alloc(device->machine, rtc_tick, 0); |
| 207 | upd1990a_register_state_save(device); |
| 208 | } |
| 209 | |
| 210 | static DEVICE_RESET( upd1990a ) |
| 211 | { |
| 212 | upd1990a_t *upd1990a = get_safe_token(device); |
| 213 | |
| 214 | upd1990a->shift_reg[0] = 0x00; |
| 215 | upd1990a->shift_reg[1] = 0x00; |
| 216 | upd1990a->shift_reg[2] = 0x00; |
| 217 | upd1990a->shift_reg[3] = 0x00; |
| 218 | upd1990a->shift_reg[4] = 0x00; |
| 219 | upd1990a->data_in = 0; |
| 220 | upd1990a->data_out = 0; |
| 221 | upd1990a->shift_mode = 0; |
| 222 | upd1990a->freq_divider = 0; |
| 223 | } |
| 224 | |
| 225 | DEVICE_GET_INFO( upd1990a ) |
| 226 | { |
| 227 | switch (state) |
| 228 | { |
| 229 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 230 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(upd1990a_t); break; |
| 231 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 232 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_TIMER; break; |
| 233 | |
| 234 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 235 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(upd1990a); break; |
| 236 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 237 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(upd1990a); break; |
| 238 | |
| 239 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 240 | case DEVINFO_STR_NAME: strcpy(info->s, "NEC uPD1990AC"); break; |
| 241 | case DEVINFO_STR_FAMILY: strcpy(info->s, "uPD1990AC RTC"); break; |
| 242 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 243 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 244 | case DEVINFO_STR_CREDITS: /* Nothing */ break; |
| 245 | } |
| 246 | } |
src/mess/drivers/kyocera.c
| r0 | r4572 | |
| 1 | /******************************************************************************************
|
| 2 | |
| 3 | Kyocera Kyotronics 85 (and similar laptop computers)
|
| 4 |
|
| 5 | 2009/04 Very Preliminary Driver (video emulation courtesy of very old code by |
| 6 | Hamish Coleman)
|
| 7 | |
| 8 | Comments about bit usage from Tech References and Virtual T source.
|
| 9 | |
| 10 | Supported systems:
|
| 11 | - Kyocera Kyotronic 85
|
| 12 | - Olivetti M10 (slightly diff hw, the whole bios is shifted by 1 word)
|
| 13 | - NEC PC-8201A (slightly diff hw)
|
| 14 | - Tandy Model 100
|
| 15 | - Tandy Model 102 (slightly diff hw)
|
| 16 | - Tandy Model 200 (diff video & rtc)
|
| 17 |
|
| 18 | To Do:
|
| 19 | - Basically everything:
|
| 20 | * rtc (which also controls input reads)
|
| 21 | * inputs (keyboards are different)
|
| 22 | * sound
|
| 23 | * cassettes
|
| 24 | * optional ROM & RAM
|
| 25 | * additional hardware
|
| 26 | * what are the differences between available BIOSes for trsm100 and olivm10?
|
| 27 | * Tandy Model 200 support (video emulation completely different, but also |
| 28 | memory map & IO have to be adapted)
|
| 29 | * PIO8155 might be made an independent device
|
| 30 | * clean up driver and split machine & video parts
|
| 31 | |
| 32 | - Find dumps of systems which could easily be added:
|
| 33 | * Olivetti M10 US (diff BIOS than the European version, it might be the alt BIOS)
|
| 34 | * NEC PC-8201 (original Japanese version of PC-8201A)
|
| 35 | |
| 36 | - Investigate other similar machines:
|
| 37 | * NEC PC-8300 (similar hardware?)
|
| 38 | * Tandy Model 600 (possibly different?)
|
| 39 | |
| 40 | ******************************************************************************************/
|
| 41 | |
| 42 | /* Core includes */
|
| 43 | #include "driver.h"
|
| 44 | #include "cpu/i8085/i8085.h"
|
| 45 | #include "machine/upd1990a.h"
|
| 46 | |
| 47 | static UINT8 rom_page, ram_page;
|
| 48 | static UINT8 port_a, port_b, port_c;
|
| 49 | static UINT8 timer_lsb, timer_msb;
|
| 50 | static UINT8 io_E8, io_A1, io_90, io_D0;
|
| 51 | |
| 52 | int pc8201_lcd_bank = 0;
|
| 53 | |
| 54 | void lcd_bank_update( UINT16 bank )
|
| 55 | {
|
| 56 | switch ( bank ) |
| 57 | {
|
| 58 | case 0x000: pc8201_lcd_bank = 0; break;
|
| 59 | case 0x001: pc8201_lcd_bank = 1; break;
|
| 60 | case 0x002: pc8201_lcd_bank = 2; break;
|
| 61 | case 0x004: pc8201_lcd_bank = 3; break;
|
| 62 | case 0x008: pc8201_lcd_bank = 4; break;
|
| 63 | case 0x010: pc8201_lcd_bank = 5; break;
|
| 64 | case 0x020: pc8201_lcd_bank = 6; break;
|
| 65 | case 0x040: pc8201_lcd_bank = 7; break;
|
| 66 | case 0x080: pc8201_lcd_bank = 8; break;
|
| 67 | case 0x100: pc8201_lcd_bank = 9; break;
|
| 68 | case 0x200: pc8201_lcd_bank = 10; break;
|
| 69 | default: /*logerror("pc8201: bank update with unk bank = %d\n", bank);*/ break;
|
| 70 | }
|
| 71 | |
| 72 | // logerror("pc8201: _lcd_bank = %i\n",pc8201_lcd_bank);
|
| 73 | }
|
| 74 | |
| 75 | /* WRITE HANDLERS */
|
| 76 | |
| 77 | // 0x90 PC-8201 only
|
| 78 | static WRITE8_HANDLER( pc8201_io90_write )
|
| 79 | {
|
| 80 | if ((data & 0x10) != (io_90 & 0x10))
|
| 81 | {
|
| 82 | const device_config *rtc = devtag_get_device(space->machine, "rtc");
|
| 83 | upd1990a_w(rtc, offset, port_a);
|
| 84 | logerror("RTC write: %d\n", port_a);
|
| 85 | }
|
| 86 | |
| 87 | /* printer */
|
| 88 | // if ((data & 0x20) != (io_90 & 0x20))
|
| 89 | // WRITE port_a;
|
| 90 | |
| 91 | io_90 = data; // io_90 & 0xc0 is read in 0xa0!
|
| 92 | }
|
| 93 | |
| 94 | // 0x90 T200 only
|
| 95 | //static WRITE8_HANDLER( trs200_clock_mode_write )
|
| 96 | //{
|
| 97 | //}
|
| 98 | |
| 99 | // 0xA0
|
| 100 | static WRITE8_HANDLER( modem_control_port_write )
|
| 101 | {
|
| 102 | }
|
| 103 | |
| 104 | // 0xA1 PC-8201 only
|
| 105 | static WRITE8_HANDLER( pc8201_bank_write )
|
| 106 | {
|
| 107 | UINT8 *rom = memory_region(space->machine, "maincpu");
|
| 108 | const address_space *space_program = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
| 109 |
|
| 110 | if ((data & 0x03) != rom_page)
|
| 111 | {
|
| 112 | UINT8 read_only = 0;
|
| 113 | UINT8 optional_rom = 0;
|
| 114 | rom_page = data & 0x03;
|
| 115 | |
| 116 | /* Test for a change to the ROM bank (0x0000 - 0x7FFF) */
|
| 117 | switch (rom_page)
|
| 118 | {
|
| 119 | case 0:
|
| 120 | memory_set_bankptr(space_program->machine, 1, rom + 0x10000);
|
| 121 | read_only = 1;
|
| 122 | break;
|
| 123 | case 1:
|
| 124 | optional_rom = 1; /* Not implemented yet */
|
| 125 | break;
|
| 126 | case 2:
|
| 127 | case 3:
|
| 128 | memory_set_bankptr(space_program->machine, 1, mess_ram + (rom_page - 1) * 0x8000);
|
| 129 | break;
|
| 130 | }
|
| 131 | |
| 132 | if (!optional_rom)
|
| 133 | memory_install_readwrite8_handler(space_program, 0x0000, 0x7fff, 0, 0, SMH_BANK1, read_only ? SMH_UNMAP : SMH_BANK1);
|
| 134 | }
|
| 135 | |
| 136 | if (((data >> 2) & 0x03) != ram_page)
|
| 137 | {
|
| 138 | ram_page = (data >> 2) & 0x03;
|
| 139 | |
| 140 | /* Test for a change to the RAM bank (0x8000 - 0xFFFF) */
|
| 141 | /* According to the PC-8200 Tech Notes, only 0,2,3 are admissible values here */
|
| 142 | switch (ram_page)
|
| 143 | {
|
| 144 | case 0:
|
| 145 | case 1: /* However, we treat 1 as 0*/
|
| 146 | if (ram_page == 1)
|
| 147 | logerror("PC-8201 Illegal RAM Bank value\n");
|
| 148 | |
| 149 | memory_set_bankptr(space_program->machine, 2, mess_ram);
|
| 150 | break;
|
| 151 | case 2:
|
| 152 | case 3:
|
| 153 | memory_set_bankptr(space_program->machine, 2, mess_ram + (ram_page - 1) * 0x8000);
|
| 154 | break;
|
| 155 | }
|
| 156 | }
|
| 157 |
|
| 158 | io_A1 = data & 0x0f;
|
| 159 | }
|
| 160 | |
| 161 | // 0xB8
|
| 162 | static WRITE8_HANDLER( pio8155_status_write )
|
| 163 | {
|
| 164 | // enable-disable
|
| 165 | /*
|
| 166 | Bit:
|
| 167 | 0 - Direction of Port A (0-input, 1-output)
|
| 168 | 1 - Direction of Port B (0-input, 1-output)
|
| 169 | 2 & 3 - Port C definition (00 - All input, 11 - All output, |
| 170 | 01 - Alt 3, 10 - Alt 4 (see Intel technical sheets |
| 171 | for more information))
|
| 172 | 4 - Enable Port A interrupt (1 - enable)
|
| 173 | 5 - Enable Port B interrupt (1 - enable)
|
| 174 | 6 & 7 - Timer mode (00 - No effect on counter, 01 - Stop |
| 175 | counter immediately, 10 - Stop counter after TC, 11 |
| 176 | - Start counter) */
|
| 177 | }
|
| 178 | |
| 179 | // 0xB9
|
| 180 | static WRITE8_HANDLER( pio8155_portA_write )
|
| 181 | {
|
| 182 | port_a = data;
|
| 183 | lcd_bank_update( port_a | ((port_b & 3) << 8) );
|
| 184 | |
| 185 | /*
|
| 186 | The first 5 bits of this port is used to control the 1990 real time clock chip. |
| 187 | The configuration of these five bits are:
|
| 188 | Bit:
|
| 189 | 0 - C0
|
| 190 | 1 - C1
|
| 191 | 2 - C2
|
| 192 | 3 - Clock
|
| 193 | 4 - Serial data into clock chip */
|
| 194 | if ((data & 0x08) != (port_a & 0x08))
|
| 195 | {
|
| 196 | const device_config *rtc = devtag_get_device(space->machine, "rtc");
|
| 197 | upd1990a_clk_w(rtc, offset, data);
|
| 198 | logerror("CLK write %d\n", data);
|
| 199 | }
|
| 200 | }
|
| 201 | |
| 202 | // 0xBA
|
| 203 | static WRITE8_HANDLER( pio8155_portB_write )
|
| 204 | {
|
| 205 | /*
|
| 206 | Bit:
|
| 207 | 0 - Column 9 select line for keyboard. This line is
|
| 208 | also used for the CS-28 line of the LCD.
|
| 209 | 1 - CS 29 line of LCD
|
| 210 | 2 - Beep toggle (1-Data from bit 5, 0-Data from 8155 |
| 211 | timer)
|
| 212 | 3 - Serial toggle (1-Modem, 0-RS232)
|
| 213 | 4 - Software on/off switch for computer
|
| 214 | 5 - Data to beeper if bit 2 set. Set if bit 2 low.
|
| 215 | 6 - DTR (not) line for RS232
|
| 216 | 7 - RTS (not) line for RS232 */
|
| 217 | port_b = data;
|
| 218 | lcd_bank_update( port_a | ((port_b & 3) << 8) );
|
| 219 | }
|
| 220 | |
| 221 | // 0xBB
|
| 222 | static WRITE8_HANDLER( pio8155_portC_write )
|
| 223 | {
|
| 224 | port_c = data;
|
| 225 | }
|
| 226 | |
| 227 | // 0xBC
|
| 228 | static WRITE8_HANDLER( pio8155_timer_lsb_write )
|
| 229 | {
|
| 230 | timer_lsb = data;
|
| 231 | }
|
| 232 | |
| 233 | // 0xBD
|
| 234 | static WRITE8_HANDLER( pio8155_timer_msb_write )
|
| 235 | {
|
| 236 | UINT8 timer_counter = 0;
|
| 237 | |
| 238 | timer_msb = data;
|
| 239 | timer_counter = (timer_lsb | (timer_msb & 0x3f) << 8);
|
| 240 |
|
| 241 | // set serial baud
|
| 242 | }
|
| 243 | |
| 244 | |
| 245 | // 0xC0->0xCF
|
| 246 | // serial write byet
|
| 247 | |
| 248 | // 0xC0->0xCE T200 only
|
| 249 | // serial write byte
|
| 250 | |
| 251 | // 0xCF T200 only
|
| 252 | // set serial through UART
|
| 253 |
|
| 254 | // 0xD0... T200 only
|
| 255 | static WRITE8_HANDLER( trs200_bank_write )
|
| 256 | {
|
| 257 | UINT8 *rom = memory_region(space->machine, "maincpu");
|
| 258 | const address_space *space_program = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
| 259 |
|
| 260 | if ((data & 0x03) != rom_page)
|
| 261 | {
|
| 262 | rom_page = data & 0x03;
|
| 263 | |
| 264 | /* Test for a change to the ROM bank (0x0000 - 0x7FFF) */
|
| 265 | switch (rom_page)
|
| 266 | {
|
| 267 | case 0:
|
| 268 | memory_set_bankptr(space_program->machine, 1, rom + 0x10000);
|
| 269 | memory_install_readwrite8_handler(space_program, 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 270 | memory_install_readwrite8_handler(space_program, 0x8000, 0x9fff, 0, 0, SMH_BANK2, SMH_UNMAP);
|
| 271 | break;
|
| 272 | case 1:
|
| 273 | memory_set_bankptr(space_program->machine, 1, rom + 0x1a000); /* Multiplan */
|
| 274 | memory_install_readwrite8_handler(space_program, 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 275 | memory_install_readwrite8_handler(space_program, 0x8000, 0x9fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
|
| 276 | break;
|
| 277 | case 2: /* Optional ROM, not implemented yet */
|
| 278 | break;
|
| 279 | case 3:
|
| 280 | logerror("Model 200 Illegal ROM Bank value\n"); |
| 281 | break;
|
| 282 | }
|
| 283 | }
|
| 284 | |
| 285 | if (((data >> 2) & 0x03) != ram_page)
|
| 286 | {
|
| 287 | ram_page = (data >> 2) & 0x03;
|
| 288 | |
| 289 | /* Test for a change to the RAM bank (0x8000 - 0xFFFF) */
|
| 290 | /* According to the PC-8200 Tech Notes, only 0,2,3 are admissible values here */
|
| 291 | switch (ram_page)
|
| 292 | {
|
| 293 | case 0:
|
| 294 | case 1: /* However, we treat 1 as 0*/
|
| 295 | if (ram_page == 1)
|
| 296 | logerror("Model 200 Illegal RAM Bank value\n");
|
| 297 | |
| 298 | memory_set_bankptr(space_program->machine, 2, mess_ram);
|
| 299 | break;
|
| 300 | case 2:
|
| 301 | case 3:
|
| 302 | memory_set_bankptr(space_program->machine, 2, mess_ram + (ram_page - 1) * 0x8000);
|
| 303 | break;
|
| 304 | }
|
| 305 | }
|
| 306 |
|
| 307 | io_D0 = data;
|
| 308 | }
|
| 309 | |
| 310 | // 0xD0... all systems but T200 - set serial
|
| 311 | /*
|
| 312 | Bits:
|
| 313 | 0 - Stop Bits (1-1.5, 0-2)
|
| 314 | 1 - Parity (1-even, 0-odd)
|
| 315 | 2 - Parity Enable (1-no parity, 0-parity enabled)
|
| 316 | 3 - Data length (00-5 bits, 10-6 bits, 01-7 bits, 11-8 |
| 317 | bits)
|
| 318 | 4 - Data length (see bit 3) */
|
| 319 | |
| 320 | |
| 321 | // 0xE0... all systems but T200
|
| 322 | /*
|
| 323 | Bits:
|
| 324 | 0 - ROM select (0-Standard ROM, 1-Option ROM)
|
| 325 | 1 - STROBE (not) signal to printer
|
| 326 | 2 - STROBE for Clock chip (1990)
|
| 327 | 3 - Remote plug control signal */
|
| 328 | static WRITE8_HANDLER( ioE8_write )
|
| 329 | {
|
| 330 | /* Check for Clock Chip strobe */
|
| 331 | if ((data & 0x04) != (io_E8 & 0x04))
|
| 332 | {
|
| 333 | const device_config *rtc = devtag_get_device(space->machine, "rtc");
|
| 334 | upd1990a_w(rtc, offset, port_a);
|
| 335 | logerror("RTC write: %d\n", port_a);
|
| 336 | }
|
| 337 | |
| 338 | /* printer */
|
| 339 | // if ((data & 0x02) != (io_E8 & 0x02))
|
| 340 | // WRITE port_a;
|
| 341 | |
| 342 | io_E8 = data;
|
| 343 | }
|
| 344 | |
| 345 | |
| 346 | // 0xE0... T200 only
|
| 347 | //static WRITE8_HANDLER( trs200_ioE8_write )
|
| 348 | //{
|
| 349 | // T200 Printer port STROBE is on Bit 0, not Bit 1
|
| 350 | // if ((data & 0x01) != (io_E8 & 0x01))
|
| 351 | // WRITE port_a;
|
| 352 | |
| 353 | // io_E8 = data;
|
| 354 | //}
|
| 355 | |
| 356 | |
| 357 | UINT8 pc8201_lcd[11][256];
|
| 358 | UINT8 pc8201_lcd_addr[10];
|
| 359 | |
| 360 | // 0xF0...
|
| 361 | static WRITE8_HANDLER( lcd_command_write )
|
| 362 | {
|
| 363 | pc8201_lcd_addr[pc8201_lcd_bank] = data;
|
| 364 | /* logerror("pc8201: LCDCM = 0x%02x\n",data); */
|
| 365 | }
|
| 366 | |
| 367 | // 0xFF
|
| 368 | static WRITE8_HANDLER( lcd_data_write )
|
| 369 | {
|
| 370 | UINT8 addr = pc8201_lcd_addr[pc8201_lcd_bank]++;
|
| 371 | pc8201_lcd[pc8201_lcd_bank][addr] = data;
|
| 372 | /* logerror("pc8201: LCD [%i][%02x] = 0x%02x\n",pc8201_lcd_bank,addr,data); */
|
| 373 | }
|
| 374 | |
| 375 | static WRITE8_HANDLER( unk_write )
|
| 376 | {
|
| 377 | logerror("pc8201 IO port w: %04x %02x\n", offset, data);
|
| 378 | }
|
| 379 | |
| 380 | |
| 381 | /* READ HANDLERS */
|
| 382 | |
| 383 | // 0x82
|
| 384 | static READ8_HANDLER( io82_read )
|
| 385 | {
|
| 386 | return 0xa2; /* FIXME */
|
| 387 | }
|
| 388 | |
| 389 | // 0x90... T200 only
|
| 390 | //static READ8_HANDLER( trs200_clock_mode_read )
|
| 391 | //{
|
| 392 | //}
|
| 393 | |
| 394 | // 0xA0 all systems but PC8201
|
| 395 | // Modem control port
|
| 396 | static READ8_HANDLER( modem_control_port_read )
|
| 397 | {
|
| 398 | return 0; // FIXME
|
| 399 | }
|
| 400 | |
| 401 | // 0xA0 PC8201 only
|
| 402 | static READ8_HANDLER( pc8201_ioa0_read )
|
| 403 | {
|
| 404 | return (io_A1 & 0x3f) | (io_90 & 0xc0);
|
| 405 | }
|
| 406 | |
| 407 | // 0xA1 PC-8201 only
|
| 408 | static READ8_HANDLER( pc8201_bank_read )
|
| 409 | {
|
| 410 | return io_A1;
|
| 411 | }
|
| 412 | |
| 413 | // 0xB8
|
| 414 | static READ8_HANDLER( pio8155_status_read )
|
| 415 | {
|
| 416 | /*
|
| 417 | Bit:
|
| 418 | 0 - Port A interrupt request
|
| 419 | 1 - Port A buffer full/empty (input/output)
|
| 420 | 2 - Port A interrupt enabled
|
| 421 | 3 - Port B interrupt request
|
| 422 | 4 - Port B buffer full/empty (input/output)
|
| 423 | 5 - Port B interrupt enabled
|
| 424 | 6 - Timer interrupt (status of TC pin)
|
| 425 | 7 - Not used */
|
| 426 | |
| 427 | /* Force TC high */
|
| 428 | return 0x89;
|
| 429 | }
|
| 430 | |
| 431 | // 0xB9
|
| 432 | static READ8_HANDLER( pio8155_portA_read )
|
| 433 | {
|
| 434 | return port_a;
|
| 435 | }
|
| 436 | |
| 437 | // 0xBA
|
| 438 | static READ8_HANDLER( pio8155_portB_read )
|
| 439 | {
|
| 440 | return port_b;
|
| 441 | }
|
| 442 | |
| 443 | // 0xBB
|
| 444 | static READ8_HANDLER( pio8155_portC_read )
|
| 445 | {
|
| 446 | const device_config *rtc = devtag_get_device(space->machine, "rtc");
|
| 447 | port_c = (port_c & ~0x01) | upd1990a_data_out_r(rtc, offset);
|
| 448 | |
| 449 | return port_c;
|
| 450 | /*
|
| 451 | Bits:
|
| 452 | 0 - Serial data input from clock chip
|
| 453 | 1 - Busy (not) signal from printer
|
| 454 | 2 - Busy signal from printer
|
| 455 | 3 - Data from BCR
|
| 456 | 4 - CTS (not) line from RS232
|
| 457 | 5 - DSR (not) line from RS232
|
| 458 | 6-7 - Not avaiable on 8155 */
|
| 459 | }
|
| 460 | |
| 461 | // 0xBC
|
| 462 | // 0xBD
|
| 463 | static READ8_HANDLER( pio8155_timer_read )
|
| 464 | {
|
| 465 | logerror("kyocera timer r: %04x\n", offset);
|
| 466 | return 0;
|
| 467 | }
|
| 468 | |
| 469 | // 0xC0->0xCF all systems but T200
|
| 470 | // serial read byte
|
| 471 | |
| 472 | // 0xC0->0xCE T200 only
|
| 473 | // serial read byte
|
| 474 | |
| 475 | // 0xCF T200 only
|
| 476 | // serial flag
|
| 477 | |
| 478 | // 0xD0->0xDF T200 only
|
| 479 | static READ8_HANDLER( trs200_bank_read )
|
| 480 | {
|
| 481 | return io_D0;
|
| 482 | }
|
| 483 | /*
|
| 484 | Bits:
|
| 485 | 0 - Data on telephone line (used to detect carrier)
|
| 486 | 1 - Overrun error from UART
|
| 487 | 2 - Framing error from UART
|
| 488 | 3 - Parity error from UART
|
| 489 | 4 - Transmit buffer empty from UART
|
| 490 | 5 - Ring line on modem connector
|
| 491 | 6 - Not used
|
| 492 | 7 - Low Power signal from power supply (LPS not) */
|
| 493 | |
| 494 | |
| 495 | // 0xD8?!?!
|
| 496 | static READ8_HANDLER( uart_read )
|
| 497 | {
|
| 498 | return 0xff; /* FIXME */
|
| 499 | }
|
| 500 | |
| 501 | // 0xE0...
|
| 502 | static READ8_HANDLER( keyboard_read )
|
| 503 | {
|
| 504 | UINT8 data = 0xff, col;
|
| 505 | UINT16 strobe = (port_b << 8) | port_a;
|
| 506 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8" };
|
| 507 | |
| 508 | for (col = 0; col < 9; col++) |
| 509 | {
|
| 510 | if ((strobe & (1 << col)) == 0) |
| 511 | data &= input_port_read(space->machine, keynames[col]);
|
| 512 | }
|
| 513 | |
| 514 | logerror("CALL to %d and RETURN %d\n", offset, data);
|
| 515 | return data;
|
| 516 | }
|
| 517 | |
| 518 | // 0xF0...
|
| 519 | static READ8_HANDLER( lcd_status_read )
|
| 520 | {
|
| 521 | /* logerror("pc8201: LCDST = 0\n"); */
|
| 522 | return 0; /* currently we are always ready */
|
| 523 | }
|
| 524 | |
| 525 | // 0xFF
|
| 526 | static READ8_HANDLER( lcd_data_read )
|
| 527 | {
|
| 528 | UINT8 addr = pc8201_lcd_addr[pc8201_lcd_bank]++;
|
| 529 | return pc8201_lcd[pc8201_lcd_bank][addr];
|
| 530 | }
|
| 531 | |
| 532 | static READ8_HANDLER( unk_read )
|
| 533 | {
|
| 534 | logerror("pc8201 IO port r: %04x\n", offset);
|
| 535 | return 0;
|
| 536 | }
|
| 537 | |
| 538 | static ADDRESS_MAP_START( kyo85_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
| 539 | AM_RANGE(0x0000, 0x7fff) AM_ROM
|
| 540 | AM_RANGE(0x8000, 0xbfff) AM_RAM
|
| 541 | AM_RANGE(0xc000, 0xffff) AM_RAM
|
| 542 | ADDRESS_MAP_END
|
| 543 | |
| 544 | static ADDRESS_MAP_START( npc8201_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
| 545 | AM_RANGE(0x0000, 0x7fff) AM_RAMBANK(1)
|
| 546 | AM_RANGE(0x8000, 0xffff) AM_RAMBANK(2)
|
| 547 | ADDRESS_MAP_END
|
| 548 | |
| 549 | static ADDRESS_MAP_START( trs200_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
| 550 | AM_RANGE(0x0000, 0x7fff) AM_RAMBANK(1)
|
| 551 | AM_RANGE(0x8000, 0x9fff) AM_RAMBANK(2)
|
| 552 | AM_RANGE(0xa000, 0xffff) AM_RAMBANK(3)
|
| 553 | ADDRESS_MAP_END
|
| 554 | |
| 555 | static ADDRESS_MAP_START( kyo85_io, ADDRESS_SPACE_IO, 8 )
|
| 556 | AM_RANGE(0x00, 0x81) AM_READWRITE( unk_read, unk_write )
|
| 557 | AM_RANGE(0x82, 0x82) AM_READ( io82_read )
|
| 558 | AM_RANGE(0x83, 0x9f) AM_READWRITE( unk_read, unk_write )
|
| 559 | AM_RANGE(0xa0, 0xa0) AM_READWRITE( modem_control_port_read, modem_control_port_write )
|
| 560 | AM_RANGE(0xb9, 0xb9) AM_READWRITE( pio8155_portA_read, pio8155_portA_write )
|
| 561 | AM_RANGE(0xba, 0xba) AM_READWRITE( pio8155_portB_read, pio8155_portB_write )
|
| 562 | AM_RANGE(0xbb, 0xbb) AM_READWRITE( pio8155_portC_read, pio8155_portC_write )
|
| 563 | AM_RANGE(0xbc, 0xbd) AM_READ( pio8155_timer_read ) // currently, this only logs read attempts
|
| 564 | AM_RANGE(0xbc, 0xbc) AM_WRITE( pio8155_timer_lsb_write ) // these should set serial comms but it's not yet implemented
|
| 565 | AM_RANGE(0xbd, 0xbd) AM_WRITE( pio8155_timer_msb_write )
|
| 566 | AM_RANGE(0xd8, 0xd8) AM_READ( uart_read )
|
| 567 | AM_RANGE(0xe0, 0xe8) AM_READ( keyboard_read )
|
| 568 | AM_RANGE(0xe0, 0xe8) AM_READWRITE( keyboard_read, ioE8_write )
|
| 569 | AM_RANGE(0xfe, 0xfe) AM_READWRITE( lcd_status_read, lcd_command_write ) /* LCD status / command */
|
| 570 | AM_RANGE(0xff, 0xff) AM_READWRITE( lcd_data_read, lcd_data_write ) /* LCD data */
|
| 571 | ADDRESS_MAP_END
|
| 572 | |
| 573 | static ADDRESS_MAP_START( pc8201_io, ADDRESS_SPACE_IO, 8 )
|
| 574 | AM_RANGE(0x82, 0x82) AM_READ( io82_read )
|
| 575 | AM_RANGE(0x90, 0x90) AM_WRITE( pc8201_io90_write )
|
| 576 | AM_RANGE(0xa0, 0xa0) AM_READWRITE( pc8201_ioa0_read, modem_control_port_write )
|
| 577 | AM_RANGE(0xa1, 0xa1) AM_READWRITE( pc8201_bank_read, pc8201_bank_write )
|
| 578 | AM_RANGE(0xb8, 0xb8) AM_READWRITE( pio8155_status_read, pio8155_status_write )
|
| 579 | AM_RANGE(0xb9, 0xb9) AM_READWRITE( pio8155_portA_read, pio8155_portA_write )
|
| 580 | AM_RANGE(0xba, 0xba) AM_READWRITE( pio8155_portB_read, pio8155_portB_write )
|
| 581 | AM_RANGE(0xbb, 0xbb) AM_READWRITE( pio8155_portC_read, pio8155_portC_write )
|
| 582 | AM_RANGE(0xbc, 0xbd) AM_READ( pio8155_timer_read ) // currently, this only logs read attempts
|
| 583 | AM_RANGE(0xbc, 0xbc) AM_WRITE( pio8155_timer_lsb_write ) // these should set serial comms but it's not yet implemented
|
| 584 | AM_RANGE(0xbd, 0xbd) AM_WRITE( pio8155_timer_msb_write )
|
| 585 | AM_RANGE(0xd8, 0xd8) AM_READ( uart_read )
|
| 586 | AM_RANGE(0xe0, 0xe8) AM_READ( keyboard_read )
|
| 587 | // AM_RANGE(0xe0, 0xe8) AM_READWRITE( keyboard_read, ioE8_write )
|
| 588 | AM_RANGE(0xfe, 0xfe) AM_READWRITE( lcd_status_read, lcd_command_write ) /* LCD status / command */
|
| 589 | AM_RANGE(0xff, 0xff) AM_READWRITE( lcd_data_read, lcd_data_write ) /* LCD data */
|
| 590 | ADDRESS_MAP_END
|
| 591 | |
| 592 | static ADDRESS_MAP_START( trs200_io, ADDRESS_SPACE_IO, 8 )
|
| 593 | // AM_RANGE(0x00, 0x81) AM_READWRITE( unk_read, unk_write )
|
| 594 | AM_RANGE(0x82, 0x82) AM_READ( io82_read )
|
| 595 | // AM_RANGE(0x83, 0x8f) AM_READWRITE( unk_read, unk_write )
|
| 596 | // AM_RANGE(0x90, 0x90) AM_WRITE( trs200_clock_mode_write )
|
| 597 | // AM_RANGE(0x91, 0x9f) AM_READWRITE( unk_read, unk_write )
|
| 598 | AM_RANGE(0xa0, 0xa0) AM_READWRITE( modem_control_port_read, modem_control_port_write )
|
| 599 | AM_RANGE(0xb9, 0xb9) AM_READWRITE( pio8155_portA_read, pio8155_portA_write )
|
| 600 | AM_RANGE(0xba, 0xba) AM_READWRITE( pio8155_portB_read, pio8155_portB_write )
|
| 601 | AM_RANGE(0xbb, 0xbb) AM_READWRITE( pio8155_portC_read, pio8155_portC_write )
|
| 602 | AM_RANGE(0xbc, 0xbd) AM_READ( pio8155_timer_read ) // currently, this only logs read attempts
|
| 603 | AM_RANGE(0xbc, 0xbc) AM_WRITE( pio8155_timer_lsb_write ) // these should set serial comms but it's not yet implemented
|
| 604 | AM_RANGE(0xbd, 0xbd) AM_WRITE( pio8155_timer_msb_write )
|
| 605 | AM_RANGE(0xd0, 0xdf) AM_READWRITE( trs200_bank_read, trs200_bank_write )
|
| 606 | AM_RANGE(0xe0, 0xe8) AM_READ( keyboard_read )
|
| 607 | // AM_RANGE(0xe0, 0xe8) AM_READWRITE( keyboard_read, ioE8_write )
|
| 608 | AM_RANGE(0xfe, 0xfe) AM_READWRITE( lcd_status_read, lcd_command_write ) /* LCD status / command */
|
| 609 | AM_RANGE(0xff, 0xff) AM_READWRITE( lcd_data_read, lcd_data_write ) /* LCD data */
|
| 610 | ADDRESS_MAP_END
|
| 611 | |
| 612 | |
| 613 | // pasted from PX-4. to be fixed!!
|
| 614 | static PALETTE_INIT( kyo85 )
|
| 615 | {
|
| 616 | palette_set_color(machine, 0, MAKE_RGB(138, 146, 148));
|
| 617 | palette_set_color(machine, 1, MAKE_RGB(92, 83, 88));
|
| 618 | }
|
| 619 | |
| 620 | static VIDEO_UPDATE( kyo85 )
|
| 621 | {
|
| 622 | int x,y;
|
| 623 | int bank;
|
| 624 | int row,col;
|
| 625 | int addr;
|
| 626 | int yoff;
|
| 627 | unsigned char b;
|
| 628 | |
| 629 | int pen1,pen0;
|
| 630 | |
| 631 | pen0 = screen->machine->pens[0];
|
| 632 | pen1 = screen->machine->pens[1];
|
| 633 | |
| 634 | for (y=0;y<64;y+=8) |
| 635 | {
|
| 636 | for (x=0;x<240;x++) |
| 637 | {
|
| 638 | bank = x/50;
|
| 639 | row = x%50;
|
| 640 | col = y/8;
|
| 641 | if (col>3) |
| 642 | {
|
| 643 | col -= 4;
|
| 644 | bank+= 5;
|
| 645 | }
|
| 646 | |
| 647 | addr = col*64 + row;
|
| 648 | |
| 649 | b = pc8201_lcd[bank+1][addr];
|
| 650 | |
| 651 | /*logerror("pc8201: vid [%i][%02x] = 0x%02x (%i,%i)\n",bank,addr,b,x,y); */
|
| 652 | |
| 653 | for (yoff = 0; yoff < 8; yoff++)
|
| 654 | {
|
| 655 | *BITMAP_ADDR16(bitmap, y+yoff, x ) = ((b & (1 << yoff)) == (1 << yoff)) ? pen0 : pen1;
|
| 656 | }
|
| 657 |
|
| 658 | }
|
| 659 | }
|
| 660 | |
| 661 | return 0;
|
| 662 | }
|
| 663 | |
| 664 | |
| 665 | /**************************************************************************
|
| 666 | |
| 667 | Keyboard
|
| 668 | |
| 669 | ***************************************************************************/
|
| 670 | |
| 671 | /*
|
| 672 | |
| 673 | "Model 100" - must be changed for pc8201 and others
|
| 674 | Data
|
| 675 | (@ E0) 7 | L A I ? * -> Ent f8 Brk
|
| 676 | 6 | M S U > & <- Prt f7
|
| 677 | 5 | N D Y < ^ Up Lbl f6 Cap
|
| 678 | 4 | B F T " % Dwn Pst f5 Num
|
| 679 | 3 | V G R : $ Esc f4 Cde
|
| 680 | 2 | C H E ] # - Tab f3 Gph
|
| 681 | 1 | X J W P @ ) Del f2 Ctl
|
| 682 | 0 | Z K Q O ! ( Spc f1 Sft
|
| 683 | --------------------------------------------------
|
| 684 | Strobe 0 1 2 3 4 5 6 7 | 0 Strobe
|
| 685 | (from | (from B2)
|
| 686 | B1)
|
| 687 | */
|
| 688 | static INPUT_PORTS_START( kyo85 )
|
| 689 | PORT_START("KEY0")
|
| 690 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
|
| 691 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
|
| 692 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
|
| 693 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
|
| 694 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
|
| 695 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
|
| 696 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
|
| 697 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
|
| 698 | |
| 699 | PORT_START("KEY1")
|
| 700 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
|
| 701 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
|
| 702 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
|
| 703 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
|
| 704 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
|
| 705 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
|
| 706 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
|
| 707 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
|
| 708 | |
| 709 | PORT_START("KEY2")
|
| 710 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
|
| 711 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
|
| 712 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
|
| 713 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
|
| 714 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
|
| 715 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
|
| 716 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
|
| 717 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
|
| 718 | |
| 719 | PORT_START("KEY3")
|
| 720 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH)
|
| 721 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(">") PORT_CODE(KEYCODE_STOP)
|
| 722 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_COMMA)
|
| 723 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\"") PORT_CODE(KEYCODE_QUOTE)
|
| 724 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON)
|
| 725 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
|
| 726 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
|
| 727 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
|
| 728 | |
| 729 | PORT_START("KEY4")
|
| 730 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_8)
|
| 731 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("&") PORT_CODE(KEYCODE_7)
|
| 732 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_6)
|
| 733 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("%") PORT_CODE(KEYCODE_5)
|
| 734 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("$") PORT_CODE(KEYCODE_4)
|
| 735 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("#") PORT_CODE(KEYCODE_3)
|
| 736 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_2)
|
| 737 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("!") PORT_CODE(KEYCODE_1)
|
| 738 | |
| 739 | PORT_START("KEY5")
|
| 740 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT)
|
| 741 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT)
|
| 742 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP)
|
| 743 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN)
|
| 744 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS)
|
| 745 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
|
| 746 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_0)
|
| 747 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_9)
|
| 748 | |
| 749 | PORT_START("KEY6")
|
| 750 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER)
|
| 751 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PRT")
|
| 752 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LBL")
|
| 753 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PST") PORT_CODE(KEYCODE_INSERT)
|
| 754 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC)
|
| 755 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB)
|
| 756 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL)
|
| 757 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) |
| 758 | |
| 759 | PORT_START("KEY7")
|
| 760 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F8")
|
| 761 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7")
|
| 762 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6")
|
| 763 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5)
|
| 764 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4)
|
| 765 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3)
|
| 766 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2)
|
| 767 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1)
|
| 768 | |
| 769 | PORT_START("KEY8")
|
| 770 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BRK")
|
| 771 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK)
|
| 772 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NUM")
|
| 773 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CDE")
|
| 774 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("GPH") PORT_CODE(KEYCODE_LALT)
|
| 775 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTL") PORT_CODE(KEYCODE_LCONTROL)
|
| 776 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SFT") PORT_CODE(KEYCODE_LSHIFT)
|
| 777 | INPUT_PORTS_END
|
| 778 | |
| 779 | |
| 780 | static MACHINE_START( kyo85 )
|
| 781 | {
|
| 782 | }
|
| 783 | |
| 784 | static MACHINE_RESET( kyo85 )
|
| 785 | {
|
| 786 | rom_page = -1;
|
| 787 | ram_page = -1;
|
| 788 | port_a = 0;
|
| 789 | port_b = 0;
|
| 790 | port_c = 0;
|
| 791 | timer_lsb = 0;
|
| 792 | timer_msb = 0;
|
| 793 | io_E8 = 0;
|
| 794 | io_D0 = 0;
|
| 795 | io_A1 = 0;
|
| 796 | io_90 = 0;
|
| 797 | }
|
| 798 | |
| 799 | |
| 800 | static MACHINE_DRIVER_START( kyo85 )
|
| 801 | /* basic machine hardware */
|
| 802 | MDRV_CPU_ADD("maincpu", 8085A, 2400000)
|
| 803 | MDRV_CPU_PROGRAM_MAP(kyo85_mem, 0)
|
| 804 | MDRV_CPU_IO_MAP(kyo85_io, 0)
|
| 805 | |
| 806 | MDRV_MACHINE_START( kyo85 )
|
| 807 | MDRV_MACHINE_RESET( kyo85 )
|
| 808 | |
| 809 | /* video hardware */
|
| 810 | MDRV_SCREEN_ADD("screen", LCD)
|
| 811 | MDRV_SCREEN_REFRESH_RATE(44)
|
| 812 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 813 | MDRV_SCREEN_SIZE(240, 64)
|
| 814 | MDRV_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1)
|
| 815 | |
| 816 | // MDRV_DEFAULT_LAYOUT(layout_kyo85)
|
| 817 | |
| 818 | MDRV_PALETTE_LENGTH(2)
|
| 819 | MDRV_PALETTE_INIT(kyo85)
|
| 820 | |
| 821 | MDRV_VIDEO_UPDATE(kyo85)
|
| 822 | |
| 823 | /* sound hardware */
|
| 824 | // MDRV_SPEAKER_STANDARD_MONO("mono")
|
| 825 | // MDRV_SOUND_ADD("speaker", SPEAKER, 0)
|
| 826 | // MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
|
| 827 | |
| 828 | /* devices */
|
| 829 | MDRV_UPD1990A_ADD("rtc")
|
| 830 | MACHINE_DRIVER_END
|
| 831 | |
| 832 | static MACHINE_DRIVER_START( npc8201 )
|
| 833 | MDRV_IMPORT_FROM(kyo85)
|
| 834 | |
| 835 | MDRV_CPU_MODIFY("maincpu")
|
| 836 | MDRV_CPU_PROGRAM_MAP(npc8201_mem, 0)
|
| 837 | MDRV_CPU_IO_MAP(pc8201_io, 0)
|
| 838 | MACHINE_DRIVER_END
|
| 839 | |
| 840 | static MACHINE_DRIVER_START( trs200 )
|
| 841 | MDRV_IMPORT_FROM(kyo85)
|
| 842 | |
| 843 | MDRV_CPU_MODIFY("maincpu")
|
| 844 | MDRV_CPU_PROGRAM_MAP(trs200_mem, 0)
|
| 845 | MDRV_CPU_IO_MAP(trs200_io, 0)
|
| 846 | |
| 847 | /* devices */
|
| 848 | MDRV_UPD1990A_REMOVE("rtc")
|
| 849 | MACHINE_DRIVER_END
|
| 850 | |
| 851 | |
| 852 | /***************************************************************************
|
| 853 | |
| 854 | Game driver(s)
|
| 855 | |
| 856 | ***************************************************************************/
|
| 857 | |
| 858 | ROM_START(trsm100)
|
| 859 | ROM_REGION( 0x8000, "maincpu", 0 )
|
| 860 | ROM_SYSTEM_BIOS(0, "default", "Model 100")
|
| 861 | ROMX_LOAD( "m100rom.bin", 0x0000, 0x8000, CRC(730a3611) SHA1(094dbc4ac5a4ea5cdf51a1ac581a40a9622bb25d), ROM_BIOS(1) )
|
| 862 | ROM_SYSTEM_BIOS(1, "alt", "Model 100 (alt)")
|
| 863 | ROMX_LOAD( "m100arom.bin", 0x0000, 0x8000, CRC(75ac39b7) SHA1(824e730ae45babf886023151504fcd6191bbed10), ROM_BIOS(2) )
|
| 864 | ROM_END
|
| 865 | |
| 866 | ROM_START(olivm10)
|
| 867 | ROM_REGION( 0x8010, "maincpu", 0 )
|
| 868 | ROM_SYSTEM_BIOS(0, "default", "M10")
|
| 869 | ROMX_LOAD( "m10rom.bin", 0x0000, 0x8010, CRC(0be02b58) SHA1(56f2087a658efd0323663d15afcd4f5f27c68664), ROM_BIOS(1) )
|
| 870 | ROM_SYSTEM_BIOS(1, "alt", "M10 (alt)")
|
| 871 | ROMX_LOAD( "m10arom.bin", 0x0000, 0x8010, CRC(afd5a43d) SHA1(b8362f7f248692de13128a47c6c116172e38da10), ROM_BIOS(2) )
|
| 872 | ROM_END
|
| 873 | |
| 874 | ROM_START(kyo85)
|
| 875 | ROM_REGION( 0x8000, "maincpu", 0 )
|
| 876 | ROM_LOAD( "kc85rom.bin", 0x0000, 0x8000, CRC(8a9ddd6b) SHA1(9d18cb525580c9e071e23bc3c472380aa46356c0) )
|
| 877 | ROM_END
|
| 878 | |
| 879 | ROM_START(trsm102)
|
| 880 | ROM_REGION( 0x8000, "maincpu", 0 )
|
| 881 | ROM_LOAD( "m102rom.bin", 0x0000, 0x8000, CRC(0e4ff73a) SHA1(d91f4f412fb78c131ccd710e8158642de47355e2) )
|
| 882 | ROM_END
|
| 883 | |
| 884 | ROM_START(npc8201)
|
| 885 | ROM_REGION( 0x18000, "maincpu", 0 )
|
| 886 | ROM_LOAD( "pc8201rom.bin", 0x10000, 0x8000, CRC(4c534662) SHA1(758fefbba251513e7f9d86f7e9016ad8817188d8) )
|
| 887 | ROM_END
|
| 888 | |
| 889 | ROM_START(trsm200)
|
| 890 | ROM_REGION( 0x22000, "maincpu", 0 )
|
| 891 | ROM_LOAD( "t200rom.bin", 0x10000, 0x12000, CRC(e3358b38) SHA1(35d4e6a5fb8fc584419f57ec12b423f6021c0991) )
|
| 892 | ROM_END
|
| 893 | |
| 894 | static DRIVER_INIT( npc8201 )
|
| 895 | {
|
| 896 | UINT8 *rom = memory_region(machine, "maincpu");
|
| 897 | |
| 898 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 899 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, SMH_BANK2, SMH_BANK2);
|
| 900 | |
| 901 | memory_set_bankptr(machine, 1, rom + 0x10000);
|
| 902 | memory_set_bankptr(machine, 2, mess_ram);
|
| 903 | }
|
| 904 | |
| 905 | static DRIVER_INIT( trs200 )
|
| 906 | {
|
| 907 | UINT8 *rom = memory_region(machine, "maincpu");
|
| 908 | |
| 909 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_UNMAP);
|
| 910 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x9fff, 0, 0, SMH_BANK2, SMH_UNMAP);
|
| 911 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa000, 0xffff, 0, 0, SMH_BANK3, SMH_BANK3);
|
| 912 | |
| 913 | memory_set_bankptr(machine, 1, rom + 0x10000);
|
| 914 | memory_set_bankptr(machine, 2, rom + 0x18000);
|
| 915 | memory_set_bankptr(machine, 3, mess_ram);
|
| 916 | }
|
| 917 | |
| 918 | static SYSTEM_CONFIG_START(npc8201)
|
| 919 | CONFIG_RAM_DEFAULT(96 * 1024)
|
| 920 | SYSTEM_CONFIG_END
|
| 921 | |
| 922 | static SYSTEM_CONFIG_START(trs200)
|
| 923 | CONFIG_RAM_DEFAULT(72 * 1024)
|
| 924 | SYSTEM_CONFIG_END
|
| 925 | |
| 926 | |
| 927 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */
|
| 928 | COMP( 1983, kyo85, 0, 0, kyo85, kyo85, 0, 0, "Kyocera", "Kyotronic 85", GAME_NOT_WORKING )
|
| 929 | COMP( 1983, olivm10, 0, 0, kyo85, kyo85, 0, 0, "Olivetti", "M10", GAME_NOT_WORKING )
|
| 930 | COMP( 1983, npc8201, 0, 0, npc8201, kyo85, npc8201, npc8201, "NEC", "PC-8201A", GAME_NOT_WORKING )
|
| 931 | COMP( 1983, trsm100, 0, 0, kyo85, kyo85, 0, 0, "Tandy Radio Shack", "TRS-80 Model 100", GAME_NOT_WORKING )
|
| 932 | COMP( 1984, trsm200, 0, 0, trs200, kyo85, trs200, trs200, "Tandy Radio Shack", "TRS-80 Model 200", GAME_NOT_WORKING )
|
| 933 | COMP( 1986, trsm102, 0, 0, kyo85, kyo85, 0, 0, "Tandy Radio Shack", "TRS-80 Model 102", GAME_NOT_WORKING )
|