source: trunk/I8255.pas

Last change on this file was 8, checked in by chronos, 3 weeks ago
  • Modified: Implemented more instructions.
  • Added: Hardware emulation of 8255 and 8253 chips.
File size: 758 bytes
Line 
1unit I8255;
2
3interface
4
5uses
6 Classes, SysUtils;
7
8type
9
10 { T8255 }
11
12 T8255 = class
13 PortA: Byte;
14 PortB: Byte;
15 PortC: Byte;
16 Active: Boolean;
17 ControlWord: Byte;
18 procedure Write(Address: Word; Data: Byte);
19 function Read(Address: Word): Byte;
20 end;
21
22
23implementation
24
25{ T8255 }
26
27procedure T8255.Write(Address: Word; Data: Byte);
28begin
29 case Address of
30 0: PortA := Data;
31 1: PortB := Data;
32 2: PortC := Data;
33 3: begin
34 ControlWord := Data;
35 Active := (ControlWord and $80) > 0;
36 end;
37 end;
38end;
39
40function T8255.Read(Address: Word): Byte;
41begin
42 case Address of
43 0: Result := PortA;
44 1: Result := PortB;
45 2: Result := PortC;
46 3: begin
47 Result := ControlWord;
48 end;
49 end;
50end;
51
52end.
53
Note: See TracBrowser for help on using the repository browser.