2 |
- |
1 |
#include <u.h>
|
|
|
2 |
#include <libc.h>
|
|
|
3 |
#include <bio.h>
|
|
|
4 |
|
|
|
5 |
#include "pci.h"
|
|
|
6 |
#include "vga.h"
|
|
|
7 |
|
|
|
8 |
/*
|
|
|
9 |
* IBM 8514/A Graphics Coprocessor.
|
|
|
10 |
*/
|
|
|
11 |
enum {
|
|
|
12 |
Subsys = 0x42E8, /* Subsystem Status (R), Control (W) */
|
|
|
13 |
Advfunc = 0x4AE8, /* Advanced Function Control */
|
|
|
14 |
CurY = 0x82E8, /* Current Y Position */
|
|
|
15 |
CurX = 0x86E8, /* Current X Position */
|
|
|
16 |
DestyAxstp = 0x8AE8, /* Destination Y Position/Axial Step Constant */
|
|
|
17 |
DestxDiastp = 0x8EE8, /* Destination X Position/Diagonal Step Constant */
|
|
|
18 |
ErrTerm = 0x92E8, /* Error Term */
|
|
|
19 |
MajAxisPcnt = 0x96E8, /* Major Axis Pixel Count */
|
|
|
20 |
GPstat = 0x9AE8, /* Graphics Processor Status (R) */
|
|
|
21 |
Cmd = 0x9AE8, /* Drawing Command (W) */
|
|
|
22 |
ShortStroke = 0x9EE8, /* Short Stroke Vector (W) */
|
|
|
23 |
BkgdColor = 0xA2E8, /* Background Colour */
|
|
|
24 |
FrgdColor = 0xA6E8, /* Foreground Colour */
|
|
|
25 |
WrtMask = 0xAAE8, /* Bitplane Write Mask */
|
|
|
26 |
RdMask = 0xAEE8, /* Bitplane Read Mask */
|
|
|
27 |
ColorCmp = 0xB2E8, /* Colour Compare */
|
|
|
28 |
BkgdMix = 0xB6E8, /* Background Mix */
|
|
|
29 |
FrgdMix = 0xBAE8, /* Foreground Mix */
|
|
|
30 |
Multifunc = 0xBEE8, /* Multifunction Control */
|
|
|
31 |
PixTrans = 0xE2E8, /* Pixel Data Transfer */
|
|
|
32 |
};
|
|
|
33 |
|
|
|
34 |
enum { /* Multifunc Index */
|
|
|
35 |
MinAxisPcnt = 0x0000, /* Minor Axis Pixel Count */
|
|
|
36 |
ScissorsT = 0x1000, /* Top Scissors */
|
|
|
37 |
ScissorsL = 0x2000, /* Left Scissors */
|
|
|
38 |
ScissorsB = 0x3000, /* Bottom Scissors */
|
|
|
39 |
ScissorsR = 0x4000, /* Right Scissors */
|
|
|
40 |
MemCntl = 0x5000, /* Memory Control */
|
|
|
41 |
PixCntl = 0xA000, /* Pixel Control */
|
|
|
42 |
MultMisc = 0xE000, /* Miscellaneous Multifunction Control (S3) */
|
|
|
43 |
ReadSel = 0xF000, /* Read Register Select (S3) */
|
|
|
44 |
};
|
|
|
45 |
|
|
|
46 |
static void
|
|
|
47 |
load(Vga* vga, Ctlr*)
|
|
|
48 |
{
|
|
|
49 |
outportw(Pixmask, 0x00);
|
|
|
50 |
outportw(Subsys, 0x8000|0x1000);
|
|
|
51 |
outportw(Subsys, 0x4000|0x1000);
|
|
|
52 |
outportw(Pixmask, 0xFF);
|
|
|
53 |
|
|
|
54 |
outportw(FrgdMix, 0x47);
|
|
|
55 |
outportw(BkgdMix, 0x07);
|
|
|
56 |
|
|
|
57 |
outportw(Multifunc, ScissorsT|0x000);
|
|
|
58 |
outportw(Multifunc, ScissorsL|0x000);
|
|
|
59 |
outportw(Multifunc, ScissorsB|(vga->vmz/vga->mode->x-1));
|
|
|
60 |
outportw(Multifunc, ScissorsR|(vga->mode->x-1));
|
|
|
61 |
|
|
|
62 |
outportw(WrtMask, 0xFFFF);
|
|
|
63 |
outportw(Multifunc, PixCntl|0x0000);
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
static void
|
|
|
67 |
dump(Vga*, Ctlr* ctlr)
|
|
|
68 |
{
|
|
|
69 |
printitem(ctlr->name, "Advfunc");
|
|
|
70 |
Bprint(&stdout, "%9.4uX\n", inportw(Advfunc));
|
|
|
71 |
printitem(ctlr->name, "Subsys");
|
|
|
72 |
Bprint(&stdout, "%9.4uX\n", inportw(Subsys));
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
Ctlr ibm8514 = {
|
|
|
76 |
"ibm8514", /* name */
|
|
|
77 |
0, /* snarf */
|
|
|
78 |
0, /* options */
|
|
|
79 |
0, /* init */
|
|
|
80 |
load, /* load */
|
|
|
81 |
dump, /* dump */
|
|
|
82 |
};
|