This document captures the current state of the J68 CPU core (js68xkjit) and outlines what remains to reach architectural completeness.
The core is functional, testable, and benchmarked, however it is not yet a fully complete 68k implementation.
The CPU core (src/j68.js) implements a substantial portion of the Motorola 68k architecture across:
- 68000
- 68020
- 68030
- 68040 (partial behavioural model)
-
Full register set:
- Data registers (D0–D7)
- Address registers (A0–A7)
- Program Counter (PC)
- Status Register (SR) and CCR
- User/Supervisor stack switching (USP/SSP)
-
Execution engine:
- Instruction fetch/decode/execute loop
- Effective address decoding (multiple modes implemented)
- Exception and trap handling framework
-
Memory model:
- 8/16/32-bit read/write paths
- Stack operations and frame handling
-
Instruction coverage (broad categories):
- Integer arithmetic (ADD, SUB, ADDX, SUBX, NEG, NEGX, CMP, MUL, DIV)
- Logical operations (AND, OR, EOR, NOT, CLR, TST)
- Branching and flow control (BRA, Bcc, DBcc, JSR, RTS, RTE, etc.)
- Data movement (MOVE, MOVEA, MOVEQ, MOVEM, MOVEP, MOVE16, MOVEC, MOVES)
- Bit operations and bitfield instructions
- Shift and rotate (register forms fully, memory forms partial)
- System and supervisor instructions (partial set)
-
Test suite:
- 233 CPU test binaries in
test/asm/test/r - 231 active passing
- 0 active failures
- 2 deferred invalid smoke tests (
CALLM/RTM) - 114 filename roots in the current local CPU corpus
- all 16 top-level opcode lines (
0-F) have decode entry points insrc/j68.js
- 233 CPU test binaries in
The system is:
- A working 68k CPU core
- Deterministic and test-driven
- Capable of running and benchmarking across architectures
However it is not yet architecturally complete.
The current local baseline is strong, but it is important not to overread
231/233.
What that number means:
- the local semantic corpus is in good shape
- the active failures are gone
- the core is usable for the machine and monitor work
What it does not mean:
- all instructions across all claimed CPU types are complete
- all effective-address forms are complete
- all 020/030/040 system behaviour is complete
- all currently passing instructions are deeply tested in every variant
There are still explicit executor holes and several semantic stubs in
src/j68.js.
These are the real code-level gaps visible from the current decoder/executor:
- incomplete effective-address handling:
- generic
not impl ea mode - generic
not impl dst ea mode - 68020+ full-format extension word still marked TODO
- generic
- line 0 holes:
- remaining unimplemented opmodes
CALLM/RTM
- line 4 holes / stubs:
MOVEMis still a stubNBCDis still a stubABCDis still a stub
- line 5:
ADDQ/SUBQstill has unsupported mode paths
- line 8:
- unsupported opmode paths remain
- line 9 / line D:
- some
SUB/ADDopmodes still fall through tonot impl
- some
- line B / line C:
- some
CMP/AND/ related opmodes still fall through tonot impl
- some
- line E:
- memory rotates are still not implemented
- bitfield / PMMU:
- partial EA coverage
- partial
PMOVEmode coverage
Semantic Stubs Hidden By Passing Counts
The following still need real implementation and stronger tests:
MOVEMNBCDABCD
These should not be treated as complete just because the local corpus currently passes.
The following old TODO statements are no longer accurate:
- memory shift instructions are no longer placeholders
asl_masr_mlsl_mlsr_mnow have real tests and implementation
Status:
- Not failing due to CPU errors
- Current tests are invalid smoke tests
Missing:
- Proper module descriptor handling
- Valid stack/state handling for RTM
Next step:
- Build descriptor-backed fixtures
- Implement correct module semantics
Status:
- Not implemented
- F-line currently acts as hook/trap
Missing:
- Floating-point instruction execution
- FPU state and register model
Status:
- Not implemented
Missing:
- Address translation
- Page tables / protection
- Fault handling
Status:
- Partially implemented
Missing:
- Proper zero-divide exception behaviour
- Full edge-case correctness
Status:
- Partially implemented
Missing:
- Full-format indexed addressing (68020/030/040)
- All displacement and scale variants
Files:
- asl_m
- asr_m
- lsl_m
- lsr_m
Status:
- Implemented and tested
Remaining work:
- extend the same completeness to memory rotate forms
Status:
- Basic behaviour implemented
Missing:
- Accurate cache modelling (68030/68040)
- Alignment fault behaviour
- Bus error edge cases
Status:
- Functional
Missing:
- Cycle-accurate exception frames
- Full compatibility with all CPU variants
Status:
- cached/default CPU test runs are stable
- explicit source rebuild works on hosts with an Amiga-compatible assembler
- GNU
m68k-elf-asis not sufficient for the whole currenttest/asmcorpus
Examples:
abcd.sunpk.smovec_super.s
Next step:
- either normalize
test/asm/*.sto a GNU-compatible syntax subset - or keep Amiga-compatible assembler as the explicit source-rebuild requirement
The build system has been corrected and is now deterministic:
- Runs from cached
.binfiles - Fast execution
- Rebuilds from
.ssources - Uses Amiga-compatible assembler
- Source-of-truth validation
Complete coverage needs to be split into phases. Treating 68000, 68020, 68030, and 68040 completeness as one flat task will hide the real order.
Goal:
- no executor stubs in the base integer/supervisor core for the tested corpus
Do next:
- implement real
MOVEM - implement real
NBCD - implement real
ABCD - implement memory rotates:
ROLmemoryRORmemoryROXLmemoryROXRmemory
- close remaining
ADD/SUB/CMP/AND/OR/EOR/ADDQ/SUBQopmode fallthroughs - add targeted tests for every current
not implbranch in lines0,4,5,8,9,B,C,D,E
Success condition:
- no semantic stubs remain in the base integer core
- no untested local fallthroughs for currently claimed base instructions
Goal:
- make 68020 support real rather than partial
Do next:
- full-format indexed EA decoding
DIVSL/DIVUL- validate and harden:
CASCAS2CHK2TRAPcc- bitfields across more EA variants
- revisit
CALLM/RTMonly with authoritative descriptor/state fixtures
Success condition:
- 68020 integer/supervisor instruction set is substantially closed
- remaining gaps are clearly isolated to MMU/FPU/coprocessor areas
Goal:
- move from opcode acceptance toward real 030/040 behaviour
Do next:
- broaden
PMOVEmode coverage - implement real PMMU state/translation behaviour
- harden cache-related instructions beyond privilege/no-op handling
- deepen
MOVE16 - improve exception frame and alignment accuracy by CPU type
Success condition:
- 030/040 system instructions are no longer mostly structural placeholders
Goal:
- only claim “complete coverage” when the large remaining architecture blocks are real
Do next:
- FPU / 68881 / 68882 / 68040 FP path
- MMU / PMMU translation model
- bus error and exception-model edge cases
- cache behaviour where architecturally visible
Success condition:
- “supports 68030/68040” means more than integer decode plus partial system ops
This project has reached a point where:
- The CPU core is real and operational
- The local semantic corpus is meaningful
- Placeholder scaffolding has been removed from the active local tests
- Performance is measurable and improving
- Build flow is controlled and intentional
- The next quality jump is no longer “make it run at all”
- The next quality jump is finishing the remaining semantic stubs and then closing 020+/030+/040 architectural gaps in order
This is not a toy implementation.
It is a working 68k CPU core with a strong foundation, however:
It is not yet complete.
Remaining work focuses on:
- Architectural completeness (FPU, MMU, CALLM/RTM)
- Edge-case correctness
- Extended addressing and system behaviour
- Continued performance improvements
Correctness over assumption.
Tests must prove behaviour.
Placeholders do not belong.