trunk/src/mess/drivers/pencil2.c
| r19824 | r19825 | |
| 68 | 68 | - Cassette isn't working |
| 69 | 69 | - Joysticks (no info) |
| 70 | 70 | - Cart slot (only 1 cart has been dumped, so probably no point coding it) |
| 71 | | - Screen size is wrong in BASIC. Should be 24 lines of text with a wide |
| 72 | | border all around. (changed to NTSC to fix it for now) |
| 73 | 71 | |
| 74 | 72 | ****************************************************************************/ |
| 75 | 73 | |
| r19824 | r19825 | |
| 97 | 95 | DECLARE_WRITE8_MEMBER(port30_w); |
| 98 | 96 | DECLARE_WRITE8_MEMBER(port80_w); |
| 99 | 97 | DECLARE_WRITE8_MEMBER(portc0_w); |
| 100 | | DECLARE_READ8_MEMBER(porte0_r); |
| 98 | DECLARE_READ8_MEMBER(porte2_r); |
| 101 | 99 | DECLARE_CUSTOM_INPUT_MEMBER(printer_ready_r); |
| 102 | 100 | DECLARE_CUSTOM_INPUT_MEMBER(printer_ack_r); |
| 103 | 101 | virtual void machine_reset(); |
| r19824 | r19825 | |
| 124 | 122 | AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write) |
| 125 | 123 | AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write) |
| 126 | 124 | AM_RANGE(0xc0, 0xdf) AM_WRITE(portc0_w) |
| 127 | | AM_RANGE(0xe0, 0xff) AM_READ(porte0_r) AM_DEVWRITE("sn76489a", sn76489a_device, write) |
| 125 | AM_RANGE(0xe0, 0xff) AM_DEVWRITE("sn76489a", sn76489a_device, write) |
| 126 | AM_RANGE(0xe0, 0xe0) AM_READ_PORT("E0") |
| 127 | AM_RANGE(0xe1, 0xe1) AM_READ_PORT("E1") |
| 128 | AM_RANGE(0xe2, 0xe2) AM_READ(porte2_r) |
| 129 | AM_RANGE(0xe3, 0xe3) AM_READ_PORT("E3") |
| 130 | AM_RANGE(0xe4, 0xe4) AM_READ_PORT("E4") |
| 131 | AM_RANGE(0xe6, 0xe6) AM_READ_PORT("E6") |
| 132 | AM_RANGE(0xe8, 0xe8) AM_READ_PORT("E8") |
| 133 | AM_RANGE(0xea, 0xea) AM_READ_PORT("EA") |
| 134 | AM_RANGE(0xf0, 0xf0) AM_READ_PORT("F0") |
| 135 | AM_RANGE(0xf2, 0xf2) AM_READ_PORT("F2") |
| 128 | 136 | ADDRESS_MAP_END |
| 129 | 137 | |
| 130 | | READ8_MEMBER( pencil2_state::porte0_r) |
| 138 | READ8_MEMBER( pencil2_state::porte2_r) |
| 131 | 139 | { |
| 132 | | if (offset==2) |
| 133 | | return (m_cass->input() > 0.1); |
| 134 | | else |
| 135 | | { |
| 136 | | char kbdrow[6]; |
| 137 | | sprintf(kbdrow,"X%X",offset); |
| 138 | | //printf("%X ",offset); |
| 139 | | return ioport( kbdrow )->read(); |
| 140 | | } |
| 140 | return (m_cass->input() > 0.1); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | WRITE8_MEMBER( pencil2_state::port10_w ) |
| r19824 | r19825 | |
| 171 | 171 | |
| 172 | 172 | /* Input ports */ |
| 173 | 173 | static INPUT_PORTS_START( pencil2 ) |
| 174 | | PORT_START("X0") |
| 174 | PORT_START("E0") |
| 175 | 175 | // port_custom MUST be ACTIVE_HIGH to work |
| 176 | 176 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) |
| 177 | 177 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) |
| r19824 | r19825 | |
| 182 | 182 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_END) |
| 183 | 183 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pencil2_state, printer_ack_r, " ") |
| 184 | 184 | |
| 185 | | PORT_START("X1") |
| 185 | PORT_START("E1") |
| 186 | 186 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') PORT_CHAR('@') |
| 187 | 187 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('>') |
| 188 | 188 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('<') |
| r19824 | r19825 | |
| 192 | 192 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') |
| 193 | 193 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 194 | 194 | |
| 195 | | PORT_START("X3") |
| 195 | PORT_START("E3") |
| 196 | 196 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 197 | 197 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) |
| 198 | 198 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) |
| r19824 | r19825 | |
| 202 | 202 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') |
| 203 | 203 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 204 | 204 | |
| 205 | | PORT_START("X4") |
| 205 | PORT_START("E4") |
| 206 | 206 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 207 | 207 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') |
| 208 | 208 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') |
| r19824 | r19825 | |
| 212 | 212 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') |
| 213 | 213 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 214 | 214 | |
| 215 | | PORT_START("X6") |
| 215 | PORT_START("E6") |
| 216 | 216 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') |
| 217 | 217 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') |
| 218 | 218 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') |
| r19824 | r19825 | |
| 222 | 222 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 223 | 223 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 224 | 224 | |
| 225 | | PORT_START("X8") |
| 225 | PORT_START("E8") |
| 226 | 226 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') |
| 227 | 227 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') PORT_CHAR('/') |
| 228 | 228 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+') |
| r19824 | r19825 | |
| 232 | 232 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') |
| 233 | 233 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 234 | 234 | |
| 235 | | PORT_START("XA") |
| 235 | PORT_START("EA") |
| 236 | 236 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') |
| 237 | 237 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') |
| 238 | 238 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') |
| r19824 | r19825 | |
| 242 | 242 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') |
| 243 | 243 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 244 | 244 | |
| 245 | | PORT_START("X10") |
| 245 | PORT_START("F0") |
| 246 | 246 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') |
| 247 | 247 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 248 | 248 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('^') |
| r19824 | r19825 | |
| 252 | 252 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) |
| 253 | 253 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 254 | 254 | |
| 255 | | PORT_START("X12") |
| 255 | PORT_START("F2") |
| 256 | 256 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 257 | 257 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 258 | 258 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| r19824 | r19825 | |
| 273 | 273 | DEVCB_NULL |
| 274 | 274 | }; |
| 275 | 275 | |
| 276 | | static TMS9928A_INTERFACE(pencil2_tms9928a_interface) |
| 276 | static TMS9928A_INTERFACE(pencil2_tms9929a_interface) |
| 277 | 277 | { |
| 278 | 278 | "screen", // screen tag |
| 279 | 279 | 0x4000, // vram size |
| r19824 | r19825 | |
| 287 | 287 | MCFG_CPU_IO_MAP(pencil2_io) |
| 288 | 288 | |
| 289 | 289 | /* video hardware */ |
| 290 | | MCFG_TMS9928A_ADD( "tms9928a", TMS9928A, pencil2_tms9928a_interface ) |
| 291 | | MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" ) // should be PAL but it has issues |
| 290 | MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, pencil2_tms9929a_interface ) |
| 291 | MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) |
| 292 | 292 | MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update ) |
| 293 | 293 | |
| 294 | 294 | // sound hardware |