mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
badc2fdb74
A test data set was published at https://github.com/TomHarte/ProcessorTests which contain cycle traces of instructions for various versions of the 6502. This adds a test harness that reads those data files, and adjusts the CPU6502 behavior to match the behavior of the vanilla and WDC 65C02 test data. Also converts the existing CPU tests to Typescript, and fixes any inconsistencies that came up from the new behaviors.
23 lines
527 B
TypeScript
23 lines
527 B
TypeScript
import type { CpuState } from 'js/cpu6502';
|
|
import { toHex } from 'js/util';
|
|
import { dumpStatusRegister } from 'js/debugger';
|
|
|
|
const detail = !!process.env.JEST_DETAIL;
|
|
|
|
export function toReadableState(state: CpuState) {
|
|
if (detail) {
|
|
const { pc, sp, a, x, y, s } = state;
|
|
|
|
return {
|
|
pc: toHex(pc, 4),
|
|
sp: toHex(sp),
|
|
a: toHex(a),
|
|
x: toHex(x),
|
|
y: toHex(y),
|
|
s: dumpStatusRegister(s)
|
|
};
|
|
} else {
|
|
return state;
|
|
}
|
|
}
|