| @@ -318,7 +318,7 @@ describe("MOSCIA Tests...", function(){ | |||
| expect(cia.DATA).to.be.equal(0x06); | |||
| }); | |||
| it("Set and Trigger TOD Alarm", function(){ | |||
| it("TOD Alarm Set and Trigger", function(){ | |||
| let cia = new MOSCIA(); | |||
| let tick = (cycles) => { | |||
| let ccount = cycles * 6; | |||
| @@ -326,10 +326,6 @@ describe("MOSCIA Tests...", function(){ | |||
| cia.TOD = 1; | |||
| }; | |||
| // Setting up the alarm interrupts! | |||
| cia.RS = 0x0D; | |||
| cia.DATA = 0x84; | |||
| // Setting alarm values. | |||
| cia.RS = 0x0F; | |||
| cia.DATA = cia.DATA | 0x80; | |||
| @@ -360,6 +356,43 @@ describe("MOSCIA Tests...", function(){ | |||
| expect(IC & 0x04).to.be.equal(0x04); | |||
| expect(IC & 0x80).to.be.equal(0x80); | |||
| }); | |||
| it("Timer A", function(){ | |||
| let cia = new MOSCIA(); | |||
| let tick = (cycles) => { | |||
| for (let i=0; i < cycles; i++) | |||
| cia.phi2 = 1; | |||
| }; | |||
| cia.RS = 0x04; | |||
| cia.DATA = 0xFF; | |||
| cia.RS = 0x05; | |||
| cia.DATA = 0x01; | |||
| cia.RS = 0x0E; | |||
| // Force latch load into Timer A and activate Timer A | |||
| cia.DATA = cia.DATA | 0x11; | |||
| cia.RS = 0x04; | |||
| expect(cia.DATA).to.be.equal(0xFF); | |||
| tick(1); | |||
| expect(cia.DATA).to.be.equal(0xFE); | |||
| tick(1); | |||
| expect(cia.DATA).to.be.equal(0xFD); | |||
| tick(0x0200 - 3); | |||
| expect(cia.DATA).to.be.equal(0x00); | |||
| cia.RS = 0x05; | |||
| expect(cia.DATA).to.be.equal(0x00); | |||
| tick(1); | |||
| expect(cia.DATA).to.be.equal(0x01); | |||
| cia.RS = 0x04; | |||
| expect(cia.DATA).to.be.equal(0xFF); | |||
| cia.RS = 0x0D; | |||
| let IC = cia.DATA; | |||
| expect(IC & 0x01).to.be.equal(0x01); | |||
| expect(IC & 0x80).to.be.equal(0x80); | |||
| }); | |||
| }); | |||