apple2js/test/roms/6502test.ts

30 lines
645 B
TypeScript
Raw Normal View History

// From https://github.com/Klaus2m5/6502_65C02_functional_tests
import fs from 'fs';
import path from 'path';
2021-03-06 23:04:13 +00:00
import { MemoryPages, byte } from '../../js/types';
2021-03-06 23:04:13 +00:00
export default class Test6502 implements MemoryPages {
private data: Buffer
2020-11-07 23:49:05 +00:00
constructor() {
this.data = fs.readFileSync(path.join(__dirname, '6502_functional_test.bin'));
}
start = () => {
return 0x00;
}
end = () => {
return 0xff;
}
read = (page: byte, off: byte) => {
2020-11-07 23:49:05 +00:00
return this.data[page << 8 | off];
}
write = (page: byte, off: byte, val: byte) => {
2020-11-07 23:49:05 +00:00
this.data[page << 8 | off] = val;
}
}