src/mess/drivers/prestige.c
| r10638 | r10639 | |
| 65 | 65 | |
| 66 | 66 | TODO: |
| 67 | 67 | |
| 68 | | - identify unknown chips |
| 69 | | - boot animation won't play |
| 70 | | - keyboard |
| 71 | | - mouse |
| 68 | - identify unknown chips (maybe related to the sound??) |
| 69 | - better IRQ timing |
| 70 | - the mouse is too slow and sometime freezes |
| 71 | - finish to decode the memory banking |
| 72 | 72 | - sound |
| 73 | 73 | - cartridges |
| 74 | 74 | |
| 75 | 75 | */ |
| 76 | 76 | |
| 77 | #define ADDRESS_MAP_MODERN |
| 78 | |
| 77 | 79 | #include "emu.h" |
| 78 | 80 | #include "cpu/z80/z80.h" |
| 79 | 81 | #include "machine/ram.h" |
| r10638 | r10639 | |
| 85 | 87 | { |
| 86 | 88 | public: |
| 87 | 89 | prestige_state(running_machine &machine, const driver_device_config_base &config) |
| 88 | | : driver_device(machine, config) { } |
| 90 | : driver_device(machine, config), |
| 91 | m_maincpu(*this, "maincpu"), |
| 92 | m_ram(*this, RAM_TAG) |
| 93 | { } |
| 89 | 94 | |
| 90 | | UINT8 bank[6]; |
| 95 | required_device<cpu_device> m_maincpu; |
| 96 | required_device<device_t> m_ram; |
| 97 | |
| 98 | UINT8 m_bank[7]; |
| 99 | UINT8 m_kb_matrix; |
| 100 | UINT8 m_irq_counter; |
| 101 | UINT8 m_mousex; |
| 102 | UINT8 m_mousey; |
| 103 | UINT8 *m_vram; |
| 104 | |
| 105 | virtual void machine_start(); |
| 106 | bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect); |
| 107 | |
| 108 | DECLARE_READ8_MEMBER( bankswitch_r ); |
| 109 | DECLARE_WRITE8_MEMBER( bankswitch_w ); |
| 110 | DECLARE_READ8_MEMBER( kb_r ); |
| 111 | DECLARE_WRITE8_MEMBER( kb_w ); |
| 112 | DECLARE_READ8_MEMBER( mouse_r ); |
| 113 | DECLARE_WRITE8_MEMBER( mouse_w ); |
| 91 | 114 | }; |
| 92 | 115 | |
| 93 | 116 | |
| 94 | | |
| 95 | | static READ8_HANDLER( bankswitch_r ) |
| 117 | READ8_MEMBER( prestige_state::bankswitch_r ) |
| 96 | 118 | { |
| 97 | | prestige_state *state = space->machine->driver_data<prestige_state>(); |
| 98 | | return state->bank[offset]; |
| 119 | return m_bank[offset]; |
| 99 | 120 | } |
| 100 | 121 | |
| 101 | | static WRITE8_HANDLER( bankswitch_w ) |
| 122 | WRITE8_MEMBER( prestige_state::bankswitch_w ) |
| 102 | 123 | { |
| 103 | | prestige_state *state = space->machine->driver_data<prestige_state>(); |
| 104 | | address_space *program = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 124 | address_space *program = cpu_get_address_space(m_maincpu, ADDRESS_SPACE_PROGRAM); |
| 105 | 125 | |
| 106 | 126 | switch (offset) |
| 107 | 127 | { |
| 108 | 128 | case 0: |
| 109 | | memory_set_bank(space->machine, "bank1", data & 0x3f); |
| 129 | memory_set_bank(space.machine, "bank1", data & 0x3f); |
| 110 | 130 | break; |
| 111 | 131 | |
| 112 | 132 | case 1: |
| 113 | | memory_set_bank(space->machine, "bank2", data & 0x3f); |
| 133 | memory_set_bank(space.machine, "bank2", data & 0x3f); |
| 114 | 134 | break; |
| 115 | 135 | |
| 116 | 136 | case 2: |
| 117 | | if (state->bank[5] == 0x0c) |
| 137 | if ((m_bank[5] & 0x0f) == 0x0c) |
| 118 | 138 | { |
| 119 | | memory_set_bank(space->machine, "bank3", 0x40 + BIT(data, 7)); |
| 139 | memory_set_bank(space.machine, "bank3", 0x40 + (data & 1)); |
| 120 | 140 | } |
| 121 | 141 | else |
| 122 | 142 | { |
| 123 | | memory_set_bank(space->machine, "bank3", data & 0x3f); |
| 143 | memory_set_bank(space.machine, "bank3", data & 0x3f); |
| 124 | 144 | } |
| 125 | 145 | break; |
| 126 | 146 | |
| 127 | 147 | case 3: |
| 128 | | memory_set_bank(space->machine, "bank4", data & 0x03); |
| 148 | memory_set_bank(space.machine, "bank4", data & 0x03); |
| 129 | 149 | break; |
| 130 | 150 | |
| 131 | 151 | case 4: |
| 132 | | memory_set_bank(space->machine, "bank5", data & 0x03); |
| 152 | memory_set_bank(space.machine, "bank5", data & 0x03); |
| 133 | 153 | break; |
| 134 | 154 | |
| 135 | 155 | case 5: |
| r10638 | r10639 | |
| 141 | 161 | { |
| 142 | 162 | memory_unmap_write(program, 0x8000, 0xbfff, 0, 0); |
| 143 | 163 | } |
| 164 | break; |
| 165 | case 6: |
| 166 | break; |
| 167 | |
| 144 | 168 | } |
| 145 | 169 | |
| 146 | | state->bank[offset] = data; |
| 170 | m_bank[offset] = data; |
| 147 | 171 | } |
| 148 | 172 | |
| 149 | | static ADDRESS_MAP_START(prestige_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 173 | READ8_MEMBER( prestige_state::kb_r ) |
| 174 | { |
| 175 | static const char *const bitnames[2][8] = |
| 176 | { |
| 177 | {"LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7"}, |
| 178 | {"LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF"} |
| 179 | }; |
| 180 | |
| 181 | UINT8 data = 0xff; |
| 182 | |
| 183 | for (int line=0; line<8; line++) |
| 184 | if (!(m_kb_matrix & (1<<line))) |
| 185 | data &= input_port_read(space.machine, bitnames[offset][line]); |
| 186 | |
| 187 | return data; |
| 188 | } |
| 189 | |
| 190 | WRITE8_MEMBER( prestige_state::kb_w ) |
| 191 | { |
| 192 | m_kb_matrix = data; |
| 193 | } |
| 194 | |
| 195 | READ8_MEMBER( prestige_state::mouse_r ) |
| 196 | { |
| 197 | INT16 data = 0; |
| 198 | |
| 199 | switch( offset ) |
| 200 | { |
| 201 | case 0: //x-axis |
| 202 | data = (input_port_read(space.machine, "MOUSEX") - m_mousex); |
| 203 | break; |
| 204 | case 1: //y-axis |
| 205 | data = (input_port_read(space.machine, "MOUSEY") - m_mousey); |
| 206 | break; |
| 207 | } |
| 208 | |
| 209 | return 0x80 + data; |
| 210 | } |
| 211 | |
| 212 | WRITE8_MEMBER( prestige_state::mouse_w ) |
| 213 | { |
| 214 | switch( offset ) |
| 215 | { |
| 216 | case 0: //x-axis |
| 217 | m_mousex = input_port_read(space.machine, "MOUSEX"); |
| 218 | break; |
| 219 | case 1: //y-axis |
| 220 | m_mousey = input_port_read(space.machine, "MOUSEY"); |
| 221 | break; |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | static ADDRESS_MAP_START(prestige_mem, ADDRESS_SPACE_PROGRAM, 8, prestige_state) |
| 150 | 226 | AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank1") |
| 151 | 227 | AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank2") |
| 152 | 228 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank3") |
| r10638 | r10639 | |
| 154 | 230 | AM_RANGE(0xe000, 0xffff) AM_RAMBANK("bank5") |
| 155 | 231 | ADDRESS_MAP_END |
| 156 | 232 | |
| 157 | | static ADDRESS_MAP_START( prestige_io , ADDRESS_SPACE_IO, 8) |
| 233 | static ADDRESS_MAP_START( prestige_io , ADDRESS_SPACE_IO, 8, prestige_state) |
| 158 | 234 | ADDRESS_MAP_UNMAP_HIGH |
| 159 | 235 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 160 | | AM_RANGE(0x50, 0x55) AM_READWRITE(bankswitch_r, bankswitch_w) |
| 236 | AM_RANGE(0x04, 0x05) AM_READWRITE(mouse_r, mouse_w) |
| 237 | AM_RANGE(0x50, 0x56) AM_READWRITE(bankswitch_r, bankswitch_w) |
| 238 | AM_RANGE(0x40, 0x40) AM_WRITE(kb_w) |
| 239 | AM_RANGE(0x41, 0x42) AM_READ(kb_r) |
| 161 | 240 | ADDRESS_MAP_END |
| 162 | 241 | |
| 163 | 242 | /* Input ports */ |
| 164 | 243 | INPUT_PORTS_START( prestige ) |
| 244 | PORT_START("MOUSEX") |
| 245 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(0) |
| 246 | |
| 247 | PORT_START("MOUSEY") |
| 248 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(0) |
| 249 | |
| 250 | PORT_START("LINE0") |
| 251 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1) |
| 252 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 253 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 254 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) |
| 255 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) |
| 256 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) |
| 257 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) |
| 258 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) |
| 259 | |
| 260 | PORT_START("LINE1") |
| 261 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2) |
| 262 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 263 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| 264 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) |
| 265 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD) |
| 266 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) |
| 267 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) |
| 268 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) |
| 269 | |
| 270 | PORT_START("LINE2") |
| 271 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Up (KB)") PORT_CODE(KEYCODE_8_PAD) |
| 272 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 273 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_OPENBRACE) |
| 274 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) |
| 275 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_HOME) |
| 276 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) |
| 277 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) |
| 278 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) |
| 279 | |
| 280 | PORT_START("LINE3") |
| 281 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Left (KB)") PORT_CODE(KEYCODE_4_PAD) |
| 282 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 283 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Inverted exclamation marks") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 284 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) |
| 285 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) |
| 286 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) |
| 287 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) |
| 288 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| 289 | |
| 290 | PORT_START("LINE4") |
| 291 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Right (KB)") PORT_CODE(KEYCODE_6_PAD) |
| 292 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 293 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) |
| 294 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) |
| 295 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) |
| 296 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) |
| 297 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) |
| 298 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) |
| 299 | |
| 300 | PORT_START("LINE5") |
| 301 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Down (KB)") PORT_CODE(KEYCODE_2_PAD) |
| 302 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 303 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) |
| 304 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) |
| 305 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) |
| 306 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_BACKSLASH) |
| 307 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) |
| 308 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_PGUP) |
| 309 | |
| 310 | PORT_START("LINE6") |
| 311 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_F10) |
| 312 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 313 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) |
| 314 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) |
| 315 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) |
| 316 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_SLASH) |
| 317 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) |
| 318 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Symbol") PORT_CODE(KEYCODE_PGDN) |
| 319 | |
| 320 | PORT_START("LINE7") |
| 321 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_F9) |
| 322 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 323 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) |
| 324 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) |
| 325 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) |
| 326 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) |
| 327 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) |
| 328 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Answer") PORT_CODE(KEYCODE_END) |
| 329 | |
| 330 | PORT_START("LINE8") |
| 331 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 332 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Word Games") PORT_CODE(KEYCODE_F1) |
| 333 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Player") PORT_CODE(KEYCODE_F2) |
| 334 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 335 | |
| 336 | PORT_START("LINE9") |
| 337 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alt") PORT_CODE(KEYCODE_LALT) |
| 338 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mathematics") PORT_CODE(KEYCODE_F3) |
| 339 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Level") PORT_CODE(KEYCODE_F4) |
| 340 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 341 | |
| 342 | PORT_START("LINEA") |
| 343 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_RALT) |
| 344 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Trivia") PORT_CODE(KEYCODE_F5) |
| 345 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cartridge") PORT_CODE(KEYCODE_F6) |
| 346 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 347 | |
| 348 | PORT_START("LINEB") |
| 349 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 350 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Logic Games") PORT_CODE(KEYCODE_F7) |
| 351 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Business Basics") PORT_CODE(KEYCODE_F8) |
| 352 | PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) |
| 353 | |
| 354 | PORT_START("LINEC") |
| 355 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 356 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 357 | |
| 358 | PORT_START("LINED") |
| 359 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 360 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 361 | |
| 362 | PORT_START("LINEE") |
| 363 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left mouse button (KB)") PORT_CODE(KEYCODE_0_PAD) |
| 364 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 365 | |
| 366 | PORT_START("LINEF") |
| 367 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right mouse button (KB)") PORT_CODE(KEYCODE_DEL_PAD) |
| 368 | PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED) |
| 369 | |
| 165 | 370 | INPUT_PORTS_END |
| 166 | 371 | |
| 372 | static IRQ_CALLBACK( prestige_int_ack ) |
| 373 | { |
| 374 | UINT32 vector; |
| 375 | prestige_state *state = device->machine->driver_data<prestige_state>(); |
| 167 | 376 | |
| 168 | | static MACHINE_START(prestige) |
| 377 | cpu_set_input_line(state->m_maincpu, 0, CLEAR_LINE); |
| 378 | |
| 379 | if (state->m_irq_counter == 0x02) |
| 380 | { |
| 381 | state->m_irq_counter = 0; |
| 382 | vector = 0x0020; |
| 383 | } |
| 384 | else |
| 385 | { |
| 386 | state->m_irq_counter++; |
| 387 | vector = 0x0030; |
| 388 | } |
| 389 | |
| 390 | return (0xcd<<16) | vector; |
| 391 | } |
| 392 | |
| 393 | void prestige_state::machine_start() |
| 169 | 394 | { |
| 170 | | UINT8 *ram = ram_get_ptr(machine->device(RAM_TAG)); |
| 395 | UINT8 *ram = ram_get_ptr(m_ram); |
| 396 | memset(ram, 0x00, ram_get_size(m_ram)); |
| 171 | 397 | |
| 398 | cpu_set_irq_callback(m_maincpu, prestige_int_ack); |
| 399 | |
| 172 | 400 | memory_configure_bank(machine, "bank1", 0, 64, machine->region("maincpu")->base(), 0x4000); |
| 173 | 401 | memory_configure_bank(machine, "bank2", 0, 64, machine->region("maincpu")->base(), 0x4000); |
| 174 | 402 | memory_configure_bank(machine, "bank3", 0, 64, machine->region("maincpu")->base(), 0x4000); |
| 175 | | memory_configure_bank(machine, "bank3", 64, 2, ram + 0x8000, 0x4000); |
| 403 | memory_configure_bank(machine, "bank3", 64, 2, machine->region("cart")->base(), 0x4000); |
| 176 | 404 | memory_configure_bank(machine, "bank4", 0, 4, ram, 0x2000); |
| 177 | 405 | memory_configure_bank(machine, "bank5", 0, 4, ram, 0x2000); |
| 178 | 406 | |
| r10638 | r10639 | |
| 181 | 409 | memory_set_bank(machine, "bank3", 0); |
| 182 | 410 | memory_set_bank(machine, "bank4", 0); |
| 183 | 411 | memory_set_bank(machine, "bank5", 0); |
| 412 | |
| 413 | //pointer to the videoram |
| 414 | m_vram = ram; |
| 184 | 415 | } |
| 185 | 416 | |
| 186 | 417 | static PALETTE_INIT( prestige ) |
| r10638 | r10639 | |
| 189 | 420 | palette_set_color(machine, 1, MAKE_RGB(16, 37, 84)); |
| 190 | 421 | } |
| 191 | 422 | |
| 192 | | static VIDEO_START( prestige ) |
| 423 | bool prestige_state::screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) |
| 193 | 424 | { |
| 194 | | } |
| 425 | UINT16 addr = 0; |
| 195 | 426 | |
| 196 | | static SCREEN_UPDATE( prestige ) |
| 197 | | { |
| 198 | | address_space *program = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 199 | | UINT16 addr = 0xe000; |
| 200 | | |
| 201 | 427 | for (int y = 0; y < 100; y++) |
| 202 | 428 | { |
| 203 | 429 | for (int sx = 0; sx < 30; sx++) |
| 204 | 430 | { |
| 205 | | UINT8 data = program->read_byte(addr); |
| 431 | UINT8 data = m_vram[addr]; |
| 206 | 432 | |
| 207 | 433 | for (int x = 0; x < 8; x++) |
| 208 | 434 | { |
| 209 | | *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = BIT(data, 7); |
| 435 | *BITMAP_ADDR16(&bitmap, y, (sx * 8) + x) = BIT(data, 7); |
| 210 | 436 | |
| 211 | 437 | data <<= 1; |
| 212 | 438 | } |
| r10638 | r10639 | |
| 218 | 444 | return 0; |
| 219 | 445 | } |
| 220 | 446 | |
| 221 | | static DEVICE_IMAGE_LOAD( prestige_cart ) |
| 447 | static TIMER_DEVICE_CALLBACK( irq_timer ) |
| 222 | 448 | { |
| 223 | | return IMAGE_INIT_FAIL; |
| 449 | cputag_set_input_line(timer.machine, "maincpu", 0, ASSERT_LINE); |
| 224 | 450 | } |
| 225 | 451 | |
| 226 | 452 | static MACHINE_CONFIG_START( prestige, prestige_state ) |
| r10638 | r10639 | |
| 229 | 455 | MCFG_CPU_PROGRAM_MAP(prestige_mem) |
| 230 | 456 | MCFG_CPU_IO_MAP(prestige_io) |
| 231 | 457 | |
| 232 | | MCFG_MACHINE_START(prestige) |
| 458 | MCFG_TIMER_ADD_PERIODIC("irq_timer", irq_timer, attotime::from_msec(10)) |
| 233 | 459 | |
| 234 | 460 | /* video hardware */ |
| 235 | 461 | MCFG_SCREEN_ADD("screen", LCD) |
| r10638 | r10639 | |
| 238 | 464 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 239 | 465 | MCFG_SCREEN_SIZE( 240, 100 ) |
| 240 | 466 | MCFG_SCREEN_VISIBLE_AREA( 0, 240-1, 0, 100-1 ) |
| 241 | | MCFG_SCREEN_UPDATE(prestige) |
| 242 | 467 | |
| 243 | 468 | MCFG_DEFAULT_LAYOUT( layout_lcd ) |
| 244 | 469 | |
| 245 | 470 | MCFG_PALETTE_LENGTH(2) |
| 246 | 471 | MCFG_PALETTE_INIT(prestige) |
| 247 | 472 | |
| 248 | | MCFG_VIDEO_START(prestige) |
| 249 | | |
| 250 | 473 | /* cartridge */ |
| 251 | 474 | MCFG_CARTSLOT_ADD("cart") |
| 252 | 475 | MCFG_CARTSLOT_EXTENSION_LIST("bin") |
| 253 | 476 | MCFG_CARTSLOT_INTERFACE("prestige_cart") |
| 254 | | MCFG_CARTSLOT_LOAD(prestige_cart) |
| 255 | 477 | |
| 256 | 478 | /* internal ram */ |
| 257 | 479 | MCFG_RAM_ADD(RAM_TAG) |
| r10638 | r10639 | |
| 263 | 485 | ROM_START( prestige ) |
| 264 | 486 | ROM_REGION( 0x100000, "maincpu", 0 ) |
| 265 | 487 | ROM_LOAD( "27-6020-02.u2", 0x00000, 0x100000, CRC(6bb6db14) SHA1(5d51fc3fd799e7f01ee99c453f9005fb07747b1e) ) |
| 488 | |
| 489 | ROM_REGION( 0x8000, "cart", ROMREGION_ERASE ) |
| 490 | ROM_CART_LOAD( "cart", 0, 0x8000, 0 ) |
| 266 | 491 | ROM_END |
| 267 | 492 | |
| 268 | 493 | /* Driver */ |
| 269 | 494 | |
| 270 | 495 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 271 | | COMP( 1998, prestige, 0, 0, prestige, prestige, 0, "VTech", "PC Prestige Elite", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 496 | COMP( 1998, prestige, 0, 0, prestige, prestige, 0, "VTech", "PreComputer Prestige Elite", GAME_NOT_WORKING | GAME_NO_SOUND) |