src/mess/drivers/pcw.c
| r9808 | r9809 | |
| 177 | 177 | |
| 178 | 178 | state->timer_irq_flag = 1; |
| 179 | 179 | pcw_update_irqs(machine); |
| 180 | | timer_set(machine,ATTOTIME_IN_USEC(2),NULL,0,pcw_timer_pulse); |
| 180 | timer_set(machine,ATTOTIME_IN_USEC(100),NULL,0,pcw_timer_pulse); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /* fdc interrupt callback. set/clear fdc int */ |
| r9808 | r9809 | |
| 383 | 383 | state->banks[offset] = data; |
| 384 | 384 | |
| 385 | 385 | pcw_update_mem(space->machine, offset, data); |
| 386 | | //popmessage("RAM Banks: %02x %02x %02x %02x",state->banks[0],state->banks[1],state->banks[2],state->banks[3]); |
| 386 | // popmessage("RAM Banks: %02x %02x %02x %02x",state->banks[0],state->banks[1],state->banks[2],state->banks[3]); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | static WRITE8_HANDLER(pcw_bank_force_selection_w) |
| r9808 | r9809 | |
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | | /* TODO: Implement the printer for PCW8256, PCW8512,PCW9256*/ |
| 668 | 667 | static void pcw_printer_fire_pins(running_machine* machine, UINT16 pins) |
| 669 | 668 | { |
| 670 | 669 | pcw_state *state = machine->driver_data<pcw_state>(); |
| r9808 | r9809 | |
| 713 | 712 | // printer status |
| 714 | 713 | // bit 7 - bail bar in |
| 715 | 714 | // bit 6 - not currently executing a command |
| 716 | | // bit 5 - always 0 for dot matrix printer (PCW8256/8512), 1 if a daisywheel printer(PCW9512) |
| 715 | // bit 5 - printer RAM is full |
| 717 | 716 | // bit 4 - print head is not at left margin |
| 718 | 717 | // bit 3 - sheet feeder is present |
| 719 | 718 | // bit 2 - paper is present |
| r9808 | r9809 | |
| 753 | 752 | pcw_state *state = space->machine->driver_data<pcw_state>(); |
| 754 | 753 | state->printer_pins = (state->printer_pins & 0x0100) | data; |
| 755 | 754 | //popmessage("PRN: Print head position = %i",state->printer_headpos); |
| 756 | | logerror("PRN: MCU writing %02x to P1 [%03x]\n",data,state->printer_pins); |
| 755 | logerror("PRN: MCU writing %02x to P1 [%03x/%03x]\n",data,state->printer_pins,~state->printer_pins & 0x1ff); |
| 757 | 756 | } |
| 758 | 757 | |
| 759 | 758 | static READ8_HANDLER(mcu_printer_p2_r) |
| r9808 | r9809 | |
| 790 | 789 | } |
| 791 | 790 | if((data & 0x08) != 0) // strobe |
| 792 | 791 | { |
| 792 | logerror("Strobe active [%02x]\n",state->printer_shift); |
| 793 | 793 | state->printer_shift_output = state->printer_shift; |
| 794 | 794 | if((state->printer_p2 & 0x10) == 0) // print head motor active |
| 795 | 795 | { |
| r9808 | r9809 | |
| 798 | 798 | { |
| 799 | 799 | state->printer_headpos += 2; |
| 800 | 800 | state->head_motor_state++; |
| 801 | logerror("Printer head moved forward by 2 to %i\n",state->printer_headpos); |
| 801 | 802 | } |
| 802 | 803 | if(stepper_state == half_step_table[(state->head_motor_state + 1) & 0x03]) |
| 803 | 804 | { |
| 804 | 805 | state->printer_headpos += 1; |
| 805 | 806 | state->head_motor_state++; |
| 807 | logerror("Printer head moved forward by 1 to %i\n",state->printer_headpos); |
| 806 | 808 | } |
| 807 | 809 | if(stepper_state == full_step_table[(state->head_motor_state - 1) & 0x03]) |
| 808 | 810 | { |
| 809 | 811 | state->printer_headpos -= 2; |
| 810 | 812 | state->head_motor_state--; |
| 813 | logerror("Printer head moved back by 2 to %i\n",state->printer_headpos); |
| 811 | 814 | } |
| 812 | 815 | if(stepper_state == half_step_table[(state->head_motor_state - 1) & 0x03]) |
| 813 | 816 | { |
| 814 | 817 | state->printer_headpos -= 1; |
| 815 | 818 | state->head_motor_state--; |
| 819 | logerror("Printer head moved back by 1 to %i\n",state->printer_headpos); |
| 816 | 820 | } |
| 817 | 821 | if(state->printer_headpos < 0) |
| 818 | 822 | state->printer_headpos = 0; |
| r9808 | r9809 | |
| 826 | 830 | if(stepper_state == full_step_table[(state->linefeed_motor_state + 1) & 0x03]) |
| 827 | 831 | { |
| 828 | 832 | state->paper_feed++; |
| 833 | if(state->paper_feed > PCW_PRINTER_HEIGHT*2) |
| 834 | state->paper_feed = 0; |
| 829 | 835 | state->linefeed_motor_state++; |
| 830 | 836 | } |
| 831 | 837 | if(stepper_state == half_step_table[(state->linefeed_motor_state + 1) & 0x03]) |
| 832 | 838 | { |
| 833 | 839 | state->paper_feed++; |
| 840 | if(state->paper_feed > PCW_PRINTER_HEIGHT*2) |
| 841 | state->paper_feed = 0; |
| 834 | 842 | state->linefeed_motor_state++; |
| 835 | 843 | } |
| 836 | 844 | state->linefeed_motor_state &= 0x03; |
| r9808 | r9809 | |
| 1305 | 1313 | /* PCW8256, PCW8512, PCW9256 */ |
| 1306 | 1314 | static MACHINE_CONFIG_START( pcw, pcw_state ) |
| 1307 | 1315 | /* basic machine hardware */ |
| 1308 | | MDRV_CPU_ADD("maincpu", Z80, 3400000) /* clock supplied to chip, but in reality it is 3.4 MHz */ |
| 1316 | MDRV_CPU_ADD("maincpu", Z80, 4000000) /* clock supplied to chip, but in reality it is 3.4 MHz */ |
| 1309 | 1317 | MDRV_CPU_PROGRAM_MAP(pcw_map) |
| 1310 | 1318 | MDRV_CPU_IO_MAP(pcw_io) |
| 1311 | | // MDRV_QUANTUM_TIME(HZ(50)) |
| 1312 | | MDRV_QUANTUM_PERFECT_CPU("maincpu") |
| 1313 | 1319 | |
| 1314 | 1320 | MDRV_CPU_ADD("printer_mcu", I8041, 11000000) // 11MHz |
| 1315 | 1321 | MDRV_CPU_IO_MAP(pcw_printer_io) |
| 1316 | | MDRV_QUANTUM_PERFECT_CPU("printer_mcu") |
| 1317 | 1322 | |
| 1318 | 1323 | MDRV_CPU_ADD("keyboard_mcu", I8048, 5000000) // 5MHz |
| 1319 | 1324 | MDRV_CPU_IO_MAP(pcw_keyboard_io) |
| 1320 | | MDRV_QUANTUM_PERFECT_CPU("keyboard_mcu") |
| 1321 | 1325 | |
| 1326 | // MDRV_QUANTUM_TIME(HZ(50)) |
| 1327 | MDRV_QUANTUM_PERFECT_CPU("maincpu") |
| 1328 | |
| 1322 | 1329 | MDRV_MACHINE_START(pcw) |
| 1323 | 1330 | MDRV_MACHINE_RESET(pcw) |
| 1324 | 1331 | |
| r9808 | r9809 | |
| 1411 | 1418 | ROM_START(pcw9256) |
| 1412 | 1419 | ROM_REGION(0x10000,"maincpu",0) |
| 1413 | 1420 | ROM_FILL(0x0000,0x10000,0x00) \ |
| 1414 | | ROM_REGION(0x2000,"printer_mcu",0) // i8041 9-pin dot-matrix (does this model have different MCU code?) |
| 1421 | ROM_REGION(0x2000,"printer_mcu",0) // i8041 9-pin dot-matrix |
| 1415 | 1422 | ROM_LOAD("40026.ic701", 0, 0x400, CRC(ee8890ae) SHA1(91679cc5e07464ac55ef9a10f7095b2438223332)) |
| 1416 | 1423 | ROM_REGION(0x400,"keyboard_mcu",0) // i8048 |
| 1417 | 1424 | ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) |
| r9808 | r9809 | |
| 1420 | 1427 | ROM_START(pcw9512) |
| 1421 | 1428 | ROM_REGION(0x10000,"maincpu",0) |
| 1422 | 1429 | ROM_FILL(0x0000,0x10000,0x00) \ |
| 1423 | | ROM_REGION(0x2000,"printer_mcu",0) // i8041 daisywheel |
| 1430 | ROM_REGION(0x2000,"printer_mcu",0) // i8041 daisywheel (schematics say i8039?) |
| 1424 | 1431 | ROM_LOAD("40103.ic109", 0, 0x2000, CRC(a64d450a) SHA1(ebbf0ef19d39912c1c127c748514dd299915f88b)) |
| 1425 | 1432 | ROM_REGION(0x400,"keyboard_mcu",0) // i8048 |
| 1426 | 1433 | ROM_LOAD("40027.ic801", 0, 0x400, CRC(25260958) SHA1(210e7e25228c79d2920679f217d68e4f14055825)) |