2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: subsystems/mvdm/ntvdm/hardware/ppi.c
5 * PURPOSE: Programmable Peripheral Interface emulation -
7 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
9 * NOTES: - Most of its functionality as keyboard controller is replaced
10 * by the PS/2 controller.
11 * - This controller is here only for having ports 61h and 62h working.
19 /* PRIVATE VARIABLES **********************************************************/
21 /*static*/ BYTE Port61hState
= 0x00; // Used in emulator.c
22 static BYTE Port62hState
= 0x00;
24 /* PRIVATE FUNCTIONS **********************************************************/
26 static BYTE WINAPI
PpiReadPort(USHORT Port
)
28 if (Port
== PPI_PORT_61H
)
30 else if (Port
== PPI_PORT_62H
)
36 static VOID WINAPI
Port61hWrite(USHORT Port
, BYTE Data
)
38 // BOOLEAN SpeakerStateChange = FALSE;
39 BYTE OldPort61hState
= Port61hState
;
41 /* Only the four lowest bytes can be written */
42 Port61hState
= (Port61hState
& 0xF0) | (Data
& 0x0F);
44 if ((OldPort61hState
^ Port61hState
) & 0x01)
46 DPRINT("PIT 2 Gate %s\n", Port61hState
& 0x01 ? "on" : "off");
47 PitSetGate(2, !!(Port61hState
& 0x01));
48 // SpeakerStateChange = TRUE;
51 if ((OldPort61hState
^ Port61hState
) & 0x02)
53 /* There were some change for the speaker... */
54 DPRINT("Speaker %s\n", Port61hState
& 0x02 ? "on" : "off");
55 // SpeakerStateChange = TRUE;
57 // if (SpeakerStateChange) SpeakerChange(Port61hState);
58 SpeakerChange(Port61hState
);
61 static VOID WINAPI
Port62hWrite(USHORT Port
, BYTE Data
)
66 /* PUBLIC FUNCTIONS ***********************************************************/
68 VOID
PpiInitialize(VOID
)
70 /* Register the I/O Ports */
71 // Port 0x60 is now used by the PS/2 controller
72 RegisterIoPort(PPI_PORT_61H
, PpiReadPort
, Port61hWrite
);
73 RegisterIoPort(PPI_PORT_62H
, PpiReadPort
, Port62hWrite
);
74 // Port 0x63 is unused