|
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 | |
|---|
| 1 | unit I8255;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Classes, SysUtils;
|
|---|
| 7 |
|
|---|
| 8 | type
|
|---|
| 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 |
|
|---|
| 23 | implementation
|
|---|
| 24 |
|
|---|
| 25 | { T8255 }
|
|---|
| 26 |
|
|---|
| 27 | procedure T8255.Write(Address: Word; Data: Byte);
|
|---|
| 28 | begin
|
|---|
| 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;
|
|---|
| 38 | end;
|
|---|
| 39 |
|
|---|
| 40 | function T8255.Read(Address: Word): Byte;
|
|---|
| 41 | begin
|
|---|
| 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;
|
|---|
| 50 | end;
|
|---|
| 51 |
|
|---|
| 52 | end.
|
|---|
| 53 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.