src/mess/includes/apple2.h
| r2845 | r2846 | |
| 12 | 12 | #include "machine/applefdc.h" |
| 13 | 13 | |
| 14 | 14 | |
| 15 | | /* ----------------------------------------------------------------------- |
| 16 | | * Softswitch values |
| 17 | | * ----------------------------------------------------------------------- */ |
| 15 | /*************************************************************************** |
| 16 | SOFTSWITCH VALUES |
| 17 | ***************************************************************************/ |
| 18 | 18 | |
| 19 | 19 | #define VAR_80STORE 0x000001 |
| 20 | 20 | #define VAR_RAMRD 0x000002 |
| r2845 | r2846 | |
| 39 | 39 | |
| 40 | 40 | #define VAR_DHIRES VAR_AN3 |
| 41 | 41 | |
| 42 | |
| 43 | /*************************************************************************** |
| 44 | SPECIAL KEYS |
| 45 | ***************************************************************************/ |
| 46 | |
| 47 | #define SPECIALKEY_CAPSLOCK 0x01 |
| 48 | #define SPECIALKEY_SHIFT 0x06 |
| 49 | #define SPECIALKEY_CONTROL 0x08 |
| 50 | #define SPECIALKEY_BUTTON0 0x10 /* open apple */ |
| 51 | #define SPECIALKEY_BUTTON1 0x20 /* closed apple */ |
| 52 | #define SPECIALKEY_BUTTON2 0x40 |
| 53 | #define SPECIALKEY_RESET 0x80 |
| 54 | |
| 55 | |
| 56 | /*************************************************************************** |
| 57 | OTHER |
| 58 | ***************************************************************************/ |
| 59 | |
| 42 | 60 | /*----------- defined in machine/apple2.c -----------*/ |
| 43 | 61 | |
| 44 | 62 | extern UINT32 a2; |
| r2845 | r2846 | |
| 58 | 76 | |
| 59 | 77 | void apple2_setvar(running_machine *machine, UINT32 val, UINT32 mask); |
| 60 | 78 | |
| 79 | int apple2_pressed_specialkey(running_machine *machine, UINT8 key); |
| 61 | 80 | |
| 81 | |
| 62 | 82 | /*----------- defined in video/apple2.c -----------*/ |
| 63 | 83 | |
| 64 | 84 | void apple2_video_start(running_machine *machine, const UINT8 *vram, size_t vram_size, UINT32 ignored_softswitches, int hires_modulo); |
| r2845 | r2846 | |
| 71 | 91 | int apple2_get_fgcolor(void); |
| 72 | 92 | int apple2_get_bgcolor(void); |
| 73 | 93 | |
| 74 | | /* keyboard wrappers */ |
| 75 | | #define pressed_specialkey(key) (input_port_read(machine, "keyb_special") & (key)) |
| 76 | | #define SPECIALKEY_CAPSLOCK 0x01 |
| 77 | | #define SPECIALKEY_SHIFT 0x06 |
| 78 | | #define SPECIALKEY_CONTROL 0x08 |
| 79 | | #define SPECIALKEY_BUTTON0 0x10 /* open apple */ |
| 80 | | #define SPECIALKEY_BUTTON1 0x20 /* closed apple */ |
| 81 | | #define SPECIALKEY_BUTTON2 0x40 |
| 82 | | #define SPECIALKEY_RESET 0x80 |
| 83 | | |
| 84 | 94 | /* ----------------------------------------------------------------------- |
| 85 | 95 | * New Apple II memory manager |
| 86 | 96 | * ----------------------------------------------------------------------- */ |
src/mess/machine/ay3600.c
| r2845 | r2846 | |
| 19 | 19 | #include "machine/ay3600.h" |
| 20 | 20 | #include "includes/apple2.h" |
| 21 | 21 | |
| 22 | |
| 23 | /*************************************************************************** |
| 24 | PARAMETERS |
| 25 | ***************************************************************************/ |
| 26 | |
| 22 | 27 | #ifdef MAME_DEBUG |
| 23 | 28 | #define VERBOSE 1 |
| 24 | 29 | #else |
| r2845 | r2846 | |
| 27 | 32 | |
| 28 | 33 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 29 | 34 | |
| 35 | |
| 36 | |
| 37 | /**************************************************************************/ |
| 38 | |
| 30 | 39 | static TIMER_CALLBACK(AY3600_poll); |
| 31 | 40 | |
| 32 | 41 | static int AY3600_keyboard_queue_chars(const unicode_char *text, size_t text_len); |
| r2845 | r2846 | |
| 273 | 282 | #define A2_KEYMOD_COMMAND 0x40 |
| 274 | 283 | #define A2_KEYMOD_OPTION 0x80 |
| 275 | 284 | |
| 285 | |
| 286 | |
| 276 | 287 | /*************************************************************************** |
| 277 | | Helper Functions |
| 288 | HELPER FUNCTIONS |
| 278 | 289 | ***************************************************************************/ |
| 279 | 290 | |
| 280 | 291 | INLINE int a2_has_keypad(running_machine *machine) |
| r2845 | r2846 | |
| 304 | 315 | } |
| 305 | 316 | |
| 306 | 317 | |
| 307 | | |
| 308 | 318 | /*************************************************************************** |
| 309 | 319 | AY3600_init |
| 310 | 320 | ***************************************************************************/ |
| r2845 | r2846 | |
| 365 | 375 | time_until_repeat = input_port_read(machine, "keyb_repeat") & 0x01 ? 0 : ~0; |
| 366 | 376 | |
| 367 | 377 | /* check caps lock and set LED here */ |
| 368 | | if (pressed_specialkey(SPECIALKEY_CAPSLOCK)) |
| 378 | if (apple2_pressed_specialkey(machine, SPECIALKEY_CAPSLOCK)) |
| 369 | 379 | { |
| 370 | 380 | caps_lock = 1; |
| 371 | 381 | set_led_status(1,1); |
| r2845 | r2846 | |
| 381 | 391 | switchkey = A2_KEY_NORMAL; |
| 382 | 392 | |
| 383 | 393 | /* shift key check */ |
| 384 | | if (pressed_specialkey(SPECIALKEY_SHIFT)) |
| 394 | if (apple2_pressed_specialkey(machine, SPECIALKEY_SHIFT)) |
| 385 | 395 | { |
| 386 | 396 | switchkey |= A2_KEY_SHIFT; |
| 387 | 397 | keymodreg |= A2_KEYMOD_SHIFT; |
| r2845 | r2846 | |
| 392 | 402 | } |
| 393 | 403 | |
| 394 | 404 | /* control key check - only one control key on the left side on the Apple */ |
| 395 | | if (pressed_specialkey(SPECIALKEY_CONTROL)) |
| 405 | if (apple2_pressed_specialkey(machine, SPECIALKEY_CONTROL)) |
| 396 | 406 | { |
| 397 | 407 | switchkey |= A2_KEY_CONTROL; |
| 398 | 408 | keymodreg |= A2_KEYMOD_CONTROL; |
| r2845 | r2846 | |
| 403 | 413 | } |
| 404 | 414 | |
| 405 | 415 | /* apple key check */ |
| 406 | | if (pressed_specialkey(SPECIALKEY_BUTTON0)) |
| 416 | if (apple2_pressed_specialkey(machine, SPECIALKEY_BUTTON0)) |
| 407 | 417 | { |
| 408 | 418 | keymodreg |= A2_KEYMOD_COMMAND; |
| 409 | 419 | } |
| r2845 | r2846 | |
| 413 | 423 | } |
| 414 | 424 | |
| 415 | 425 | /* option key check */ |
| 416 | | if (pressed_specialkey(SPECIALKEY_BUTTON1)) |
| 426 | if (apple2_pressed_specialkey(machine, SPECIALKEY_BUTTON1)) |
| 417 | 427 | { |
| 418 | 428 | keymodreg |= A2_KEYMOD_OPTION; |
| 419 | 429 | } |
| r2845 | r2846 | |
| 423 | 433 | } |
| 424 | 434 | |
| 425 | 435 | /* reset key check */ |
| 426 | | if (pressed_specialkey(SPECIALKEY_RESET) && |
| 436 | if (apple2_pressed_specialkey(machine, SPECIALKEY_RESET) && |
| 427 | 437 | (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL)) { |
| 428 | 438 | if (!reset_flag) { |
| 429 | 439 | reset_flag = 1; |
src/mess/drivers/apple2.c
| r2845 | r2846 | |
| 258 | 258 | PORT_CENTERDELTA(JOYSTICK_AUTOCENTER) |
| 259 | 259 | PORT_MINMAX(0,0xff) PORT_PLAYER(2) |
| 260 | 260 | PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) |
| 261 | |
| 262 | PORT_START_TAG("joystick_buttons") |
| 263 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) |
| 264 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2) |
| 265 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) |
| 261 | 266 | INPUT_PORTS_END |
| 262 | 267 | |
| 263 | 268 | static INPUT_PORTS_START( apple2_paddle ) |
| r2845 | r2846 | |
| 301 | 306 | //PORT_INCLUDE( apple2_paddle ) |
| 302 | 307 | INPUT_PORTS_END |
| 303 | 308 | |
| 304 | | static INPUT_PORTS_START( apple2 ) |
| 309 | static INPUT_PORTS_START( apple2_common ) |
| 305 | 310 | PORT_START_TAG("keyb_0") |
| 306 | 311 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 307 | 312 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) |
| r2845 | r2846 | |
| 379 | 384 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 380 | 385 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 381 | 386 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 382 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) |
| 383 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2) |
| 384 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) |
| 385 | 387 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) |
| 388 | INPUT_PORTS_END |
| 386 | 389 | |
| 390 | static INPUT_PORTS_START( apple2 ) |
| 391 | PORT_INCLUDE(apple2_common) |
| 392 | |
| 387 | 393 | PORT_START_TAG("keyb_repeat") |
| 388 | 394 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_BACKSLASH)PORT_CHAR('\\') |
| 389 | 395 | |
| r2845 | r2846 | |
| 400 | 406 | PORT_DIPSETTING( 0x00, "RESET" ) |
| 401 | 407 | INPUT_PORTS_END |
| 402 | 408 | |
| 403 | | static INPUT_PORTS_START( apple2_common ) |
| 409 | static INPUT_PORTS_START( apple2e_common ) |
| 404 | 410 | PORT_START_TAG("keyb_0") |
| 405 | 411 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE)PORT_CHAR(8) |
| 406 | 412 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) |
| r2845 | r2846 | |
| 470 | 476 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') |
| 471 | 477 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') |
| 472 | 478 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') |
| 479 | |
| 480 | PORT_START_TAG("keyb_special") |
| 481 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 482 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 483 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 484 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 485 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) |
| 486 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) |
| 487 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) |
| 473 | 488 | INPUT_PORTS_END |
| 474 | 489 | |
| 475 | 490 | static INPUT_PORTS_START( apple2_keypad ) |
| r2845 | r2846 | |
| 494 | 509 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 495 | 510 | INPUT_PORTS_END |
| 496 | 511 | |
| 497 | | static INPUT_PORTS_START( apple2_special ) |
| 498 | | PORT_START_TAG("keyb_special") |
| 499 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 500 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 501 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 502 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 503 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT) |
| 504 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT) |
| 505 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) |
| 506 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2) |
| 507 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) PORT_CODE(JOYCODE_BUTTON1) |
| 508 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) |
| 509 | | INPUT_PORTS_END |
| 510 | | |
| 511 | 512 | static INPUT_PORTS_START( apple2e ) |
| 512 | | PORT_INCLUDE( apple2_common ) |
| 513 | | PORT_INCLUDE( apple2_special ) |
| 513 | PORT_INCLUDE( apple2e_common ) |
| 514 | 514 | PORT_INCLUDE( apple2_gameport ) |
| 515 | 515 | INPUT_PORTS_END |
| 516 | 516 | |
| 517 | 517 | INPUT_PORTS_START( apple2ep ) |
| 518 | | PORT_INCLUDE( apple2_common ) |
| 519 | | PORT_INCLUDE( apple2_keypad ) |
| 520 | | PORT_INCLUDE( apple2_special ) |
| 518 | PORT_INCLUDE( apple2e_common ) |
| 521 | 519 | PORT_INCLUDE( apple2_gameport ) |
| 520 | PORT_INCLUDE( apple2_keypad ) |
| 522 | 521 | INPUT_PORTS_END |
| 523 | 522 | |
| 524 | 523 | /* according to Steve Nickolas (author of Dapple), our original palette would |