2020-11-07 16:54:49 +00:00
|
|
|
// 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';
|
2020-11-07 16:54:49 +00:00
|
|
|
|
2021-03-06 23:04:13 +00:00
|
|
|
export default class Test65C02 implements MemoryPages {
|
2020-11-07 16:54:49 +00:00
|
|
|
private data: Buffer
|
|
|
|
|
|
|
|
constructor() {
|
2020-11-07 23:49:05 +00:00
|
|
|
this.data = fs.readFileSync(path.join(__dirname, '65C02_extended_opcodes_test.bin'));
|
2020-11-07 16:54:49 +00:00
|
|
|
}
|
|
|
|
|
2020-11-16 02:27:35 +00:00
|
|
|
start = () => {
|
2020-11-07 16:54:49 +00:00
|
|
|
return 0x00;
|
|
|
|
}
|
|
|
|
|
2020-11-16 02:27:35 +00:00
|
|
|
end = () => {
|
2020-11-07 16:54:49 +00:00
|
|
|
return 0xff;
|
|
|
|
}
|
|
|
|
|
2020-11-16 02:27:35 +00:00
|
|
|
read = (page: byte, off: byte) => {
|
2020-11-07 23:49:05 +00:00
|
|
|
return this.data[page << 8 | off];
|
2020-11-07 16:54:49 +00:00
|
|
|
}
|
|
|
|
|
2020-11-16 02:27:35 +00:00
|
|
|
write = (page: byte, off: byte, val: byte) => {
|
2020-11-07 23:49:05 +00:00
|
|
|
this.data[page << 8 | off] = val;
|
2020-11-07 16:54:49 +00:00
|
|
|
}
|
|
|
|
}
|