Merge pull request #3 from whscullin/whscullin/new_cpu

Update 6502.
This commit is contained in:
Will Scullin 2019-11-23 15:32:28 -08:00 committed by GitHub
commit acfc295b9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19159 additions and 189 deletions

View File

@ -40,6 +40,7 @@
}, {
"files": [ "test/*"],
"env": {
"node": true,
"jest": true
}
}, {

View File

@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
node-version: [12.x]
steps:
- uses: actions/checkout@v1

View File

@ -79,45 +79,47 @@ export default function ACI(cpu, cb) {
}
}
} else {
switch (off) {
case 0x00:
_recording = false;
_beKind = true;
debug('Entering ACI CLI');
break;
case 0x63:
if (_recording) {
this.buffer.push(5000000);
if (cpu.sync()) {
switch (off) {
case 0x00:
_recording = false;
}
debug('Exiting ACI CLI');
break;
case 0x70: // WRITE
_recording = true;
if (_beKind) {
_beKind = false;
this.buffer = [];
}
debug('Start write');
_last = now;
break;
//case 0x7c: // WBITLOOP:
// _debug = true;
// debug("Write bit loop");
// break;
case 0x8d: // READ
_recording = false;
debug('Start read');
if (_beKind) {
_readOffset = 0;
_next = now + 5000000;
_beKind = false;
_beKind = true;
debug('Entering ACI CLI');
break;
case 0x63:
if (_recording) {
this.buffer.push(5000000);
_recording = false;
}
debug('Exiting ACI CLI');
break;
case 0x70: // WRITE
_recording = true;
if (_beKind) {
_beKind = false;
this.buffer = [];
}
debug('Start write');
_last = now;
break;
//case 0x7c: // WBITLOOP:
// _debug = true;
// debug("Write bit loop");
// break;
case 0x8d: // READ
_recording = false;
debug('Start read');
if (_beKind) {
_readOffset = 0;
_next = now + 5000000;
_beKind = false;
cb.progress(0);
cb.progress(0);
}
break;
default:
break;
}
break;
default:
break;
}
}
return result;

File diff suppressed because it is too large Load Diff

48
test/cpu.spec.js Normal file
View File

@ -0,0 +1,48 @@
import CPU6502 from '../js/cpu6502';
import Test6502 from './roms/6502test';
import Test65C02 from './roms/65C02test';
import { toHex } from '../js/util';
describe.skip('CPU', function () {
var cpu;
var lastPC = 0;
var done = false;
function traceCB() {
var pc = cpu.getPC();
done = lastPC == pc;
lastPC = pc;
}
describe('6502', function () {
it('completes the test ROM', function () {
cpu = new CPU6502();
var test = new Test6502();
cpu.addPageHandler(test);
cpu.setPC(0x400);
do {
cpu.stepCyclesDebug(1000, traceCB);
} while (!done);
expect(toHex(lastPC)).toEqual(toHex(0x3469));
});
});
describe('65C02', function () {
it('completes the test ROM', function () {
cpu = new CPU6502({'65C02': true});
var test = new Test65C02();
cpu.addPageHandler(test);
cpu.setPC(0x400);
do {
cpu.stepCyclesDebug(1000, traceCB);
} while (!done);
expect(toHex(lastPC)).toEqual(toHex(0x24f1));
});
});
});

2240
test/cpu6502.spec.js Normal file

File diff suppressed because it is too large Load Diff

8213
test/roms/6502test.js Normal file

File diff suppressed because it is too large Load Diff

8213
test/roms/65C02test.js Normal file

File diff suppressed because it is too large Load Diff