-
Notifications
You must be signed in to change notification settings - Fork 0
/
MC6847EnsjoMod.js
111 lines (96 loc) · 2.77 KB
/
MC6847EnsjoMod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* jsMC1000 - MC-1000 emulator in JavaScript.
* Emerson Jose Silveira da Costa <emerson.costa@gmail.com>, alias "Ensjo".
* http://ensjo.net/mc-1000/jsmc1000
*/
/**
* MC6847EnsjoMod class.
* 2013-08-16.
*
* Implements Ensjo's mod circuitry around MC6847,
* allowing for MC-1000 to have Alphanumeric characters
* combined with Semigraphic 4 blocks on the same screen.
*
* http://ensjo.blogspot.com/2012/08/ideia-de-mod-para-mc-1000-blocos.html
*
* Conditions: Changes:
* AG = 0, AS = 0, DD = 000----- => AS = 1, DD = 000-----
* AG = 0, AS = 0, DD = 011----- => AS = 1, DD = 001-----
* AG = 0, AS = 0, DD = 100----- => AS = 1, DD = 110-----
* AG = 0, AS = 0, DD = 111----- => AS = 1, DD = 111-----
*/
function MC6847EnsjoMod(delegate) {
this.delegate = delegate;
this.mc6847 = new MC6847(this);
}
MC6847EnsjoMod.prototype.drawLine = function() {
this.mc6847.drawLine();
};
// MC6847 (VDG) delegate methods.
MC6847EnsjoMod.prototype.mc6847GetCanvas = function() {
return this.delegate.mc6847GetCanvas();
};
MC6847EnsjoMod.prototype.mc6847GetAg = function() {
return this.delegate.mc6847GetAg();
};
MC6847EnsjoMod.prototype.mc6847GetAs = function() {
var as = this.delegate.mc6847GetAs();
if (as == 0) {
var ag = this.delegate.mc6847GetAg();
if (ag == 0) {
var dd = this.delegate.mc6847GetData();
switch (dd & 0xe0) {
case 0x00: // 000-----
case 0x60: // 011-----
case 0x80: // 100-----
case 0xe0: // 111-----
as = 1;
break;
}
}
}
return as;
};
MC6847EnsjoMod.prototype.mc6847GetIntext = function() {
return this.delegate.mc6847GetIntext();
};
MC6847EnsjoMod.prototype.mc6847GetInv = function() {
return this.delegate.mc6847GetInv();
};
MC6847EnsjoMod.prototype.mc6847GetGm = function() {
return this.delegate.mc6847GetGm();
};
MC6847EnsjoMod.prototype.mc6847GetCss = function() {
return this.delegate.mc6847GetCss();
};
MC6847EnsjoMod.prototype.mc6847SetAddress = function(address) {
this.delegate.mc6847SetAddress(address);
};
MC6847EnsjoMod.prototype.mc6847GetData = function() {
var dd = this.delegate.mc6847GetData();
var as = this.delegate.mc6847GetAs();
if (as == 0) {
var ag = this.delegate.mc6847GetAg();
if (ag == 0) {
switch (dd & 0xe0) {
case 0x00: // 000----- => 000-----
break;
case 0x60: // 011----- => 001-----
dd = 0x20 | (dd & 0x1f);
break;
case 0x80: // 100----- => 110-----
dd = 0xc0 | (dd & 0x1f);
break;
case 0xe0: // 111----- => 111-----
break;
}
}
}
return dd;
};
MC6847EnsjoMod.prototype.mc6847SetFs = function(fs) {
this.delegate.mc6847SetFs(fs);
};
MC6847EnsjoMod.prototype.mc6847SetRp = function(rp) {
this.delegate.mc6847SetRp(rp);
};