src/mess/drivers/adam.c
| r1224 | r1225 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | Full schematics of anything Adam at http://drushel.cwru.edu/schematics/ |
| 4 | |
| 3 | 5 | adam.c |
| 4 | 6 | |
| 5 | 7 | Driver file to handle emulation of the ColecoAdam. |
| r1224 | r1225 | |
| 99 | 101 | Device 24 = Tape drive 2 (share DCB with Tape1) |
| 100 | 102 | Device 25 = Tape drive 4 (projected, may have share DCB with Tape3) |
| 101 | 103 | Device 26 = Expansion RAM disk drive (third party ID, not used by Coleco) |
| 102 | | |
| 104 | |
| 103 | 105 | Terminology: |
| 104 | 106 | EOS = Elementary Operating System |
| 105 | 107 | DCB = Device Control Block Table (21bytes each DCB, DCB+16=dev#, DCB+0=Status Byte) (0xFD7C) |
| r1224 | r1225 | |
| 128 | 130 | adam_pcb+0 = Status, 0=Request Status of Z80 -> must return 0x81..0x82 to sync Master 6801 clk with Z80 clk |
| 129 | 131 | adam_pcb+1,adam_pcb+2 = address of adam_pcb start |
| 130 | 132 | adam_pcb+3 = device # |
| 131 | | |
| 133 | |
| 132 | 134 | - Writing to byte0: |
| 133 | 135 | 1 Synchronize the Z80 clock (should return 0x81) |
| 134 | 136 | 2 Synchronize the Master 6801 clock (should return 0x82) |
| r1224 | r1225 | |
| 140 | 142 | 0x82 -> Master 6801 clock in sync |
| 141 | 143 | 0x83 -> adam_pcb relocated |
| 142 | 144 | 0x9B -> Time Out |
| 143 | | |
| 145 | |
| 144 | 146 | DEV_ID = Device id |
| 145 | | |
| 146 | | |
| 147 | |
| 148 | |
| 147 | 149 | The ColecoAdam I/O map is contolled by the MIOC (Memory Input Output Controller): |
| 148 | 150 | |
| 149 | 151 | 20-3F (W) = Adamnet Writes |
| 150 | 152 | 20-3F (R) = Adamnet Reads |
| 151 | 153 | |
| 152 | 154 | 42-42 (W) = Expansion RAM page selection, only useful if expansion greater than 64k |
| 153 | | |
| 155 | |
| 154 | 156 | 40-40 (W) = Printer Data Out |
| 155 | 157 | 40-40 (R) = Printer (Returns 0x41) |
| 156 | | |
| 158 | |
| 157 | 159 | 5E-5E (RW)= Modem Data I/O |
| 158 | 160 | 5F-5F (RW)= Modem Data Control Status |
| 159 | | |
| 161 | |
| 160 | 162 | 60-7F (W) = Set Memory configuration |
| 161 | 163 | 60-7F (R) = Read Memory configuration |
| 162 | 164 | |
| r1224 | r1225 | |
| 166 | 168 | A0-BF (W) = Video Chip (TMS9928A), A0=0 -> Write Register 0 , A0=1 -> Write Register 1 |
| 167 | 169 | A0-BF (R) = Video Chip (TMS9928A), A0=0 -> Read Register 0 , A0=1 -> Read Register 1 |
| 168 | 170 | |
| 169 | | C0-DF (W) = Set both controllers to joystick mode |
| 171 | C0-DF (W) = Set both controllers to joystick mode |
| 170 | 172 | C0-DF (R) = Not Connected |
| 171 | 173 | |
| 172 | 174 | E0-FF (W) = Sound Chip (SN76489A) |
| r1224 | r1225 | |
| 239 | 241 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON16) PORT_NAME("P1 Keypad *") PORT_CODE(KEYCODE_EQUALS) PORT_PLAYER(1) |
| 240 | 242 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button 2 (SAC Red Button)") PORT_PLAYER(1) |
| 241 | 243 | PORT_BIT( 0xB0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 242 | | |
| 244 | |
| 243 | 245 | PORT_START_TAG( "controller1_joystick" ) /* IN2 */ |
| 244 | 246 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY |
| 245 | 247 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY |
| r1224 | r1225 | |
| 306 | 308 | PORT_RESET |
| 307 | 309 | |
| 308 | 310 | /* Keyboard with 75 Keys - TODO: Discover if the keys are actually organized this way on real hardware */ |
| 309 | | |
| 311 | |
| 310 | 312 | PORT_START_TAG("keyboard_1") /* IN9 0*/ |
| 311 | 313 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Escape/WP") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) |
| 312 | 314 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| r1224 | r1225 | |
| 366 | 368 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 367 | 369 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 368 | 370 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 369 | | |
| 371 | |
| 370 | 372 | PORT_START_TAG("keyboard_7") /* IN15 6*/ |
| 371 | 373 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x85\xA0") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 372 | 374 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x85\xA1") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| r1224 | r1225 | |
| 396 | 398 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) |
| 397 | 399 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 398 | 400 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 399 | | |
| 401 | |
| 400 | 402 | PORT_START_TAG("keyboard_10") /* IN18 9*/ |
| 401 | 403 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 402 | 404 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 403 | 405 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_TOGGLE |
| 404 | 406 | PORT_BIT(0xF8, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 405 | | |
| 407 | |
| 406 | 408 | INPUT_PORTS_END |
| 407 | 409 | |
| 408 | 410 | /*************************************************************************** |
| r1224 | r1225 | |
| 502 | 504 | memory_set_bankptr(2, BankBase+0x22000); |
| 503 | 505 | memory_set_bankptr(3, BankBase+0x24000); |
| 504 | 506 | memory_set_bankptr(4, BankBase+0x26000); |
| 505 | | |
| 507 | |
| 506 | 508 | /* Write */ |
| 507 | 509 | memory_set_bankptr(6, BankBase+0x3A000); /* Write protecting ROM */ |
| 508 | 510 | memory_set_bankptr(7, BankBase+0x3A000); /* Write protecting ROM */ |
| r1224 | r1225 | |
| 516 | 518 | memory_set_bankptr(2, BankBase+0x02000); |
| 517 | 519 | memory_set_bankptr(3, BankBase+0x04000); |
| 518 | 520 | memory_set_bankptr(4, BankBase+0x06000); |
| 519 | | |
| 521 | |
| 520 | 522 | /* Write */ |
| 521 | 523 | memory_set_bankptr(6, BankBase); |
| 522 | 524 | memory_set_bankptr(7, BankBase+0x02000); |
| r1224 | r1225 | |
| 542 | 544 | memory_set_bankptr(2, BankBase+0x02000); |
| 543 | 545 | memory_set_bankptr(3, BankBase+0x04000); |
| 544 | 546 | memory_set_bankptr(4, BankBase+0x06000); |
| 545 | | |
| 547 | |
| 546 | 548 | /* Write */ |
| 547 | 549 | memory_set_bankptr(6, BankBase+0x3A000); /* Write protecting ROM */ |
| 548 | 550 | memory_set_bankptr(7, BankBase+0x02000); |
| r1224 | r1225 | |
| 616 | 618 | |
| 617 | 619 | memset(&memory_region(REGION_CPU1)[0x0000], 0xFF, 0x20000); /* Initializing RAM */ |
| 618 | 620 | mame_timer_pulse(MAME_TIME_IN_MSEC(20), 0, adam_paddle_callback); |
| 619 | | } |
| 621 | } |
| 620 | 622 | |
| 621 | 623 | static MACHINE_DRIVER_START( adam ) |
| 622 | 624 | /* Machine hardware */ |