mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Use class fields instead of binding (#40)
* Use class fields instead of binding * classy tests * Fix typing
This commit is contained in:
parent
c4df78cf06
commit
b3cb64357f
@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
}, {
|
||||
"files": [ "js/entry2.js", "js/entry2e.js"],
|
||||
"files": [ "js/entry2.js", "js/entry2e.js", "jest.config.js"],
|
||||
"env": {
|
||||
"commonjs": true
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
module.exports = {
|
||||
"roots": [
|
||||
"js/",
|
||||
"test/",
|
||||
],
|
||||
"testMatch": [
|
||||
"**/?(*.)+(spec|test).+(ts|js)"
|
||||
],
|
||||
"transform": {
|
||||
"^.+\\.js$": "babel-jest",
|
||||
"^.+\\.ts$": "ts-jest"
|
||||
},
|
||||
}
|
||||
'roots': [
|
||||
'js/',
|
||||
'test/',
|
||||
],
|
||||
'testMatch': [
|
||||
'**/?(*.)+(spec|test).+(ts|js)'
|
||||
],
|
||||
'transform': {
|
||||
'^.+\\.js$': 'babel-jest',
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
};
|
1064
js/cpu6502.ts
1064
js/cpu6502.ts
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
SYMBOLS = {
|
||||
const SYMBOLS = {
|
||||
/*
|
||||
0x00: 'GOWARM',
|
||||
0x03: 'GOSTROUT',
|
||||
|
@ -9,7 +9,7 @@
|
||||
* implied warranty.
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Printer UI. The "paper" is bound to the element selected by the input.
|
||||
*
|
||||
* Every line that is output to the printer is added as a <div> to the paper.
|
||||
@ -69,7 +69,7 @@ export default function Printer(el) {
|
||||
|
||||
clear: function() {
|
||||
_lineBuffer = '';
|
||||
paper.innerHTML = "";
|
||||
paper.innerHTML = '';
|
||||
newLine();
|
||||
_raw = new Uint8Array(1024);
|
||||
_rawLen = 0;
|
||||
|
@ -6,9 +6,9 @@ import Test65C02 from './roms/65C02test';
|
||||
import { toHex } from '../js/util';
|
||||
|
||||
describe('CPU', function () {
|
||||
var cpu;
|
||||
var lastPC = 0;
|
||||
var done = false;
|
||||
let cpu: CPU6502;
|
||||
let lastPC = 0;
|
||||
let done = false;
|
||||
|
||||
function traceCB() {
|
||||
var pc = cpu.getPC();
|
@ -1,23 +0,0 @@
|
||||
// From https://github.com/Klaus2m5/6502_65C02_functional_tests
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export default function Test6502() {
|
||||
var data = fs.readFileSync(path.join(__dirname, '6502_functional_test.bin'));
|
||||
|
||||
return {
|
||||
start: function() {
|
||||
return 0x00;
|
||||
},
|
||||
end: function() {
|
||||
return 0xff;
|
||||
},
|
||||
read: function(page, off) {
|
||||
return data[page << 8 | off];
|
||||
},
|
||||
write: function(page, off, val) {
|
||||
data[page << 8 | off] = val;
|
||||
}
|
||||
};
|
||||
}
|
27
test/roms/6502test.ts
Normal file
27
test/roms/6502test.ts
Normal file
@ -0,0 +1,27 @@
|
||||
// From https://github.com/Klaus2m5/6502_65C02_functional_tests
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { PageHandler } from '../../js/cpu6502'
|
||||
import { byte } from '../../js/types'
|
||||
|
||||
const data = fs.readFileSync(path.join(__dirname, '6502_functional_test.bin'));
|
||||
export default class Test6502 implements PageHandler {
|
||||
private data: Buffer
|
||||
|
||||
start = () => {
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
end = () => {
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
read = (page: byte, off: byte) => {
|
||||
return data[page << 8 | off];
|
||||
}
|
||||
|
||||
write = (page: byte, off: byte, val: byte) => {
|
||||
data[page << 8 | off] = val;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
// From https://github.com/Klaus2m5/6502_65C02_functional_tests
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export default function Test65C02() {
|
||||
var data = fs.readFileSync(path.join(__dirname, '65C02_extended_opcodes_test.bin'));
|
||||
|
||||
return {
|
||||
start: function() {
|
||||
return 0x00;
|
||||
},
|
||||
end: function() {
|
||||
return 0xff;
|
||||
},
|
||||
read: function(page, off) {
|
||||
return data[page << 8 | off];
|
||||
},
|
||||
write: function(page, off, val) {
|
||||
data[page << 8 | off] = val;
|
||||
}
|
||||
};
|
||||
}
|
31
test/roms/65C02test.ts
Normal file
31
test/roms/65C02test.ts
Normal file
@ -0,0 +1,31 @@
|
||||
// From https://github.com/Klaus2m5/6502_65C02_functional_tests
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { PageHandler } from '../../js/cpu6502'
|
||||
import { byte } from '../../js/types'
|
||||
|
||||
const data = fs.readFileSync(path.join(__dirname, '65C02_extended_opcodes_test.bin'));
|
||||
|
||||
export default class Test65C02 implements PageHandler {
|
||||
private data: Buffer
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
start = function() {
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
end = function() {
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
read = function(page: byte, off: byte) {
|
||||
return data[page << 8 | off];
|
||||
}
|
||||
|
||||
write = function(page: byte, off: byte, val: byte) {
|
||||
data[page << 8 | off] = val;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user