commit
e7b0f1b321
8
CMOS.js
8
CMOS.js
@ -27,7 +27,10 @@ function CMOS(PC) {
|
|||||||
}
|
}
|
||||||
CMOS.prototype.ioport_write = function(mem8_loc, data) {
|
CMOS.prototype.ioport_write = function(mem8_loc, data) {
|
||||||
if (mem8_loc == 0x70) {
|
if (mem8_loc == 0x70) {
|
||||||
this.cmos_index = data & 0x7f;
|
// the high order bit is used to indicate NMI masking
|
||||||
|
// low order bits are used to address CMOS
|
||||||
|
// the index written here is used on an ioread 0x71
|
||||||
|
this.cmos_index = data & 0x7f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
CMOS.prototype.ioport_read = function(mem8_loc) {
|
CMOS.prototype.ioport_read = function(mem8_loc) {
|
||||||
@ -35,10 +38,13 @@ CMOS.prototype.ioport_read = function(mem8_loc) {
|
|||||||
if (mem8_loc == 0x70) {
|
if (mem8_loc == 0x70) {
|
||||||
return 0xff;
|
return 0xff;
|
||||||
} else {
|
} else {
|
||||||
|
// else here => 0x71, i.e., CMOS read
|
||||||
data = this.cmos_data[this.cmos_index];
|
data = this.cmos_data[this.cmos_index];
|
||||||
if (this.cmos_index == 10)
|
if (this.cmos_index == 10)
|
||||||
|
// flip the UIP (update in progress) bit on a read
|
||||||
this.cmos_data[10] ^= 0x80;
|
this.cmos_data[10] ^= 0x80;
|
||||||
else if (this.cmos_index == 12)
|
else if (this.cmos_index == 12)
|
||||||
|
// Always return interrupt status == 0
|
||||||
this.cmos_data[12] = 0x00;
|
this.cmos_data[12] = 0x00;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
2
KBD.js
2
KBD.js
@ -13,7 +13,7 @@ KBD.prototype.read_status = function(mem8_loc) {
|
|||||||
};
|
};
|
||||||
KBD.prototype.write_command = function(mem8_loc, x) {
|
KBD.prototype.write_command = function(mem8_loc, x) {
|
||||||
switch (x) {
|
switch (x) {
|
||||||
case 0xfe:
|
case 0xfe: // Resend command. Other commands are, apparently, ignored.
|
||||||
this.reset_request();
|
this.reset_request();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -185,7 +185,7 @@ PCEmulator.prototype.register_ioport_write = function(start, len, iotype, io_cal
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PCEmulator.prototype.ioport80_write = function(mem8_loc, data) {};
|
PCEmulator.prototype.ioport80_write = function(mem8_loc, data) {}; //POST codes! Seem to be ignored?
|
||||||
PCEmulator.prototype.reset = function() { this.request_request = 1; };
|
PCEmulator.prototype.reset = function() { this.request_request = 1; };
|
||||||
|
|
||||||
|
|
||||||
|
10
PIC.js
10
PIC.js
@ -72,6 +72,16 @@ PIC.prototype.ioport_write = function(mem8_loc, x) {
|
|||||||
mem8_loc &= 1;
|
mem8_loc &= 1;
|
||||||
if (mem8_loc == 0) {
|
if (mem8_loc == 0) {
|
||||||
if (x & 0x10) {
|
if (x & 0x10) {
|
||||||
|
/*
|
||||||
|
ICW1
|
||||||
|
// 7:5 = address (if MCS-80/85 mode)
|
||||||
|
// 4 == 1
|
||||||
|
// 3: 1 == level triggered, 0 == edge triggered
|
||||||
|
// 2: 1 == call interval 4, 0 == call interval 8
|
||||||
|
// 1: 1 == single PIC, 0 == cascaded PICs
|
||||||
|
// 0: 1 == send ICW4
|
||||||
|
|
||||||
|
*/
|
||||||
this.reset();
|
this.reset();
|
||||||
this.init_state = 1;
|
this.init_state = 1;
|
||||||
this.init4 = x & 1;
|
this.init4 = x & 1;
|
||||||
|
9
PIT.js
9
PIT.js
@ -15,6 +15,9 @@ function PIT(PC, ah, bh) {
|
|||||||
}
|
}
|
||||||
this.speaker_data_on = 0;
|
this.speaker_data_on = 0;
|
||||||
this.set_irq = ah;
|
this.set_irq = ah;
|
||||||
|
// Ports:
|
||||||
|
// 0x40: Channel 0 data port
|
||||||
|
// 0x61: Control
|
||||||
PC.register_ioport_write(0x40, 4, 1, this.ioport_write.bind(this));
|
PC.register_ioport_write(0x40, 4, 1, this.ioport_write.bind(this));
|
||||||
PC.register_ioport_read(0x40, 3, 1, this.ioport_read.bind(this));
|
PC.register_ioport_read(0x40, 3, 1, this.ioport_read.bind(this));
|
||||||
PC.register_ioport_read(0x61, 1, 1, this.speaker_ioport_read.bind(this));
|
PC.register_ioport_read(0x61, 1, 1, this.speaker_ioport_read.bind(this));
|
||||||
@ -58,22 +61,28 @@ IRQCH.prototype.pit_get_out = function() {
|
|||||||
d = this.get_time() - this.count_load_time;
|
d = this.get_time() - this.count_load_time;
|
||||||
switch (this.mode) {
|
switch (this.mode) {
|
||||||
default:
|
default:
|
||||||
|
// Interrupt on terminal count
|
||||||
case 0:
|
case 0:
|
||||||
eh = (d >= this.count) >> 0;
|
eh = (d >= this.count) >> 0;
|
||||||
break;
|
break;
|
||||||
|
// One shot
|
||||||
case 1:
|
case 1:
|
||||||
eh = (d < this.count) >> 0;
|
eh = (d < this.count) >> 0;
|
||||||
break;
|
break;
|
||||||
|
// Frequency divider
|
||||||
case 2:
|
case 2:
|
||||||
if ((d % this.count) == 0 && d != 0)
|
if ((d % this.count) == 0 && d != 0)
|
||||||
eh = 1;
|
eh = 1;
|
||||||
else
|
else
|
||||||
eh = 0;
|
eh = 0;
|
||||||
break;
|
break;
|
||||||
|
// Square wave
|
||||||
case 3:
|
case 3:
|
||||||
eh = ((d % this.count) < (this.count >> 1)) >> 0;
|
eh = ((d % this.count) < (this.count >> 1)) >> 0;
|
||||||
break;
|
break;
|
||||||
|
// SW strobe
|
||||||
case 4:
|
case 4:
|
||||||
|
// HW strobe
|
||||||
case 5:
|
case 5:
|
||||||
eh = (d == this.count) >> 0;
|
eh = (d == this.count) >> 0;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user