Changes
/* Register File */
[[File:Motorola 68000 CPU.jpg|thumb|right|68000 CPU in plastic, ceramic and PLCC versions]]
The [[Motorola 68000]] (commonly abbreviated as 68k) is a landmark microprocessor introduced in 1979 by Motorola Semiconductor.
= Architecture =
== Microcode ==
Whereas the Z80 and the 6502 CPUs use a Decode ROM (PLA), the 68000 uses microcode instead.
To execute a machine instruction, the computer internally executes several simpler micro-instructions, specified by the microcode. In other words, microcode forms another layer between the machine instructions and the hardware.
The actual internal representation is a combination of "microcode" and "nanocode". The 68000 has 544 17-bit microcode words which dispaches to 366 68-bit nanocode words. [https://stackoverflow.com/a/19045414 Source]
The microcode is a series of pointers into assorted microsubroutines in the nanocode. The nanocode performs the actual routing and selecting of registers and functions, and directs results. Decoding of an instruction's op code generates starting addresses in the microcode for the type of operation and the addressing mode. [http://www.easy68k.com/paulrsm/doc/dpbm68k1.htm Source]
See: [https://gendev.spritesmind.net/forum/viewtopic.php?t=3023 Tech topic about a microcode-level 68000 core] [https://www.atari-forum.com/viewtopic.php?t=42568 New 68k core in mame] [https://og.kervella.org/m68k/ Motorola 68000 microcode]
<br>
== Hybrid 16/32‑Bit Design ==
== Register Structure and Condition Codes File ==
The Motorola 68000 was renowned for its rich, orthogonal instruction set:
* Operand Flexibility: Instructions can operate on bytes (.b), words (.w), and long words (.l) without restrictions imposed by the addressing mode. Even though arithmetic is executed in 16‑bit chunks, the compiler and assembly programmer can manipulate 32‑bit values seamlessly.
* Addressing Modes: The 68000 supports an extensive range of addressing modes—including register direct, register indirect (with post‑increment, pre‑decrement, offset, and index variations), immediate, absolute, and PC‑relative addressing—which enhances code density and simplifies the generation of position‑independent and reentrant code.
* Dyadic Operations: Most operations in the 68000’s CISC architecture are dyadic (i.e. they have a source and a destination), enabling complex operations in fewer instructions compared to earlier 8‑bit designs. In contrast, many arithmetic and logical operations on the [[Z80]] CPU are designed around the accumulator register (A).
This comprehensive and flexible instruction set was one of the reasons the 68000 became popular in systems that required multitasking and graphical interfaces, such as early Macintosh and Amiga computers.
{| class="wikitable"|+ 68000 Instruction Set Table! rowspan= Historical Context and Development 2|Mnemonic !! colspan="3" | Size !! rowspan=2|Description !! rowspan=2|Operation !! colspan="5" | Condition Codes|-! B !! W !! L !! X !! N !! Z !! V !! C|-| ABCD || B || || || Add Decimal with Extend || (Destination)⏨ + (Source)⏨ + X → Destination || * || U || * || U || *|-| ADD || B || W || L || Add Binary || (Destination) + (Source) → Destination || * || * || * || * || *|-| ADDA || || W || L || Add Address || (Destination) + (Source) → Destination || – || – || – || – || –|-| ADDI || B || W || L || Add Immediate || (Destination) + Immediate Data → Destination || * || * || * || * || *|-| ADDQ || B || W || L || Add Quick || (Destination) + Immediate Data → Destination || * || * || * || * || *|-| ADDX || B || W || L || Add Extended || (Destination) + (Source) + X → Destination || * || * || * || * || *|-| AND || B || W || L || AND Logical || (Destination) ∧ (Source) → Destination || – || * || * || 0 || 0|-| ANDI || B || W || L || AND Immediate || (Destination) ∧ Immediate Data → Destination || – || * || * || 0 || 0|-| ANDI to CCR || B || || || AND Immediate to Condition Codes || (Source) ∧ CCR → CCR || * || * || * || * || *|-| ANDI to SR || || W || || AND Immediate to Status Register || (Source) ∧ SR → SR || * || * || * || * || *|-| ASL, ASR || B || W || L || Arithmetic Shift || (Destination) Shifted by < count > → Destination || * || * || * || * || *|-| Bcc || || || || Branch Conditionally || If cc then PC + d → PC || – || – || – || – || –|-| BCHG || B || || L || Test a Bit and Change || ~(< bit number >) OF Destination → Z~(< bit number >) OF Destination → < bit number > OF Destination|| – || – || * || – || –|-| BCLR || B || || L || Test a Bit and Clear || ~(< bit number >) OF Destination → Z0 → < bit number > OF Destination|| – || – || * || – || –|-| BRA || || || || Branch Always || PC + d → PC || – || – || – || – || –|-| BSET || B || || L || Test a Bit and Set || ~(< bit number >) OF Destination → Z1 → < bit number > OF Destination|| – || – || * || – || –|-| BSR || || || || Branch to Subroutine || PC → (SP); PC + d → PC || – || – || – || – || –|-| BTST || B || || L || Test a Bit || ~(< bit number >) OF Destination → Z || – || – || * || – || –|-| CHK || || W || || Check Register Against Bounds || If Dn < 0 or Dn > (ea) then TRAP || – || * || U || U || U|-| CLR || B || W || L || Clear Operand || 0 → Destination || – || 0 || 1 || 0 || 0|-| CMP || B || W || L || Compare || (Destination) - (Source) || – || * || * || * || *|-| CMPA || || W || L || Compare Address || (Destination) - (Source) || – || * || * || * || *|-| CMPI || B || W || L || Compare Immediate || (Destination) - Immediate Data || – || * || * || * || *|-| CMPM || B || W || L || Compare Memory || (Destination) - (Source) || – || * || * || * || *|-| DBcc || || W || || Test Condition, Decrement and Branch || If ~cc then Dn - 1 → Dn; if Dn ≠ -1 then PC + d → PC || – || – || – || – || –|-| DIVS || || W || || Signed Divide || (Destination) / (Source) → Destination || – || * || * || * || 0|-| DIVU || || W || || Unsigned Divide || (Destination) / (Source) → Destination || – || * || * || * || 0|-| EOR || B || W || L || Exclusive OR Logical || (Destination) ⊕ (Source) → Destination || – || * || * || 0 || 0|-| EORI || B || W || L || Exclusive OR Immediate || (Destination) ⊕ Immediate Data → Destination || – || * || * || 0 || 0|-| EORI to CCR || B || || || Exclusive OR Immediate to Condition Codes || (Source) ⊕ CCR → CCR || * || * || * || * || *|-| EORI to SR || || W || || Exclusive OR Immediate to Status Register || (Source) ⊕ SR → SR || * || * || * || * || *|-| EXG || || || L || Exchange Register || Rx ↔ Ry || – || – || – || – || –|-| EXT || || W || L || Sign Extend || (Destination) Sign-Extended → Destination || – || * || * || 0 || 0|-| JMP || || || || Jump || Destination → PC || – || – || – || – || –|-| JSR || || || || Jump to Subroutine || PC → (SP); Destination → PC || – || – || – || – || –|-| LEA || || || L || Load Effective Address || < ea > → An || – || – || – || – || –|-| LINK || || || || Link and Allocate || An → (SP); SP → An; SP + Displacement → SP || – || – || – || – || –|-| LSL, LSR || B || W || L || Logical Shift || (Destination) Shifted by < count > → Destination || * || * || * || 0 || *|-| MOVE || B || W || L || Move Data from Source to Destination || (Source) → Destination || – || * || * || 0 || 0|-| MOVE to CCR || || W || || Move to Condition Code || (Source) → CCR || * || * || * || * || *|-| MOVE to SR || || W || || Move to Status Register || (Source) → SR || * || * || * || * || *|-| MOVE from SR || || W || || Move from the Status Register || SR → Destination || – || – || – || – || –|-| MOVE USP || || || L || Move User Stack Pointer || USP → An; An → USP || – || – || – || – || –|-| MOVEA || || W || L || Move Address || (Source) → Destination || – || – || – || – || –|-| MOVEM || || W || L || Move Multiple Registers || Registers → Destination(Source) → Registers|| – || – || – || – || –|-| MOVEP || || W || L || Move Peripheral Data || (Source) → Destination || – || – || – || – || –|-| MOVEQ || || || L || Move Quick || Immediate Data → Destination || – || * || * || 0 || 0|-| MULS || || W || || Signed Multiply || (Destination) × (Source) → Destination || – || * || * || 0 || 0|-| MULU || || W || || Unsigned Multiply || (Destination) × (Source) → Destination || – || * || * || 0 || 0|-| NBCD || B || || || Negate Decimal with Extend || -((Destination)⏨ - X) → Destination || * || U || * || U || *|-| NEG || B || W || L || Negate || 0 - (Destination) → Destination || * || * || * || * || *|-| NEGX || B || W || L || Negate with Extend || 0 - (Destination) - X → Destination || * || * || * || * || *|-| NOP || || || || No Operation || – || – || – || – || – || –|-| NOT || B || W || L || Logical Complement || ~(Destination) → Destination || – || * || * || 0 || 0|-| OR || B || W || L || Inclusive OR Logical || (Destination) ∨ (Source) → Destination || – || * || * || 0 || 0|-| ORI || B || W || L || Inclusive OR Immediate || (Destination) ∨ Immediate Data → Destination || – || * || * || 0 || 0|-| ORI to CCR || B || || || Inclusive OR Immediate to Condition Codes || (Source) ∨ CCR → CCR || * || * || * || * || *|-| ORI to SR || || W || || Inclusive OR Immediate to Status Register || (Source) ∨ SR → SR || * || * || * || * || *|-| PEA || || || L || Push Effective Address || < ea > → (SP) || – || – || – || – || –|-| RESET || || || || Reset External Device || – || – || – || – || – || –|-| ROL, ROR || B || W || L || Rotate (Without Extend) || (Destination) Rotated by < count > → Destination || – || * || * || 0 || *|-| ROXL, ROXR || B || W || L || Rotate with Extend || (Destination) Rotated by < count > → Destination || * || * || * || 0 || *|-| RTE || || || || Return from Exception || (SP) → SR; (SP) → PC || * || * || * || * || *|-| RTR || || || || Return and Restore Condition Codes || (SP) → CC; (SP) → PC || * || * || * || * || *|-| RTS || || || || Return from Subroutine || (SP) → PC || – || – || – || – || –|-| SBCD || B || || || Subtract Decimal with Extend || (Destination)⏨ - (Source)⏨ - X → Destination || * || U || * || U || *|-| Scc || B || || || Set According to Condition || If cc then 1’s → Destination else 0’s → Destination || – || – || – || – || –|-| STOP || || W || || Load Status Register and Stop || Immediate Data → SR; STOP || * || * || * || * || *|-| SUB || B || W || L || Subtract Binary || (Destination) - (Source) → Destination || * || * || * || * || *|-| SUBA || || W || L || Subtract Address || (Destination) - (Source) → Destination || – || – || – || – || –|-| SUBI || B || W || L || Subtract Immediate || (Destination) - Immediate Data → Destination || * || * || * || * || *|-| SUBQ || B || W || L || Subtract Quick || (Destination) - Immediate Data → Destination || * || * || * || * || *|-| SUBX || B || W || L || Subtract with Extend || (Destination) - (Source) - X → Destination || * || * || * || * || *|-| SWAP || || W || || Swap Register Halves || Register [31:16] ↔ Register [15:0] || – || * || * || 0 || 0|-| TAS || B || || || Test and Set an Operand || (Destination) Tested → CC; 1 → [7] OF Destination || – || * || * || 0 || 0|-| TRAP || || || || Trap || PC → (SSP); SR → (SSP); (Vector) → PC || – || – || – || – || –|-| TRAPV || || || || Trap on Overflow || If V then TRAP || – || – || – || – || –|-| TST || B || W || L || Test an Operand || (Destination) Tested → CC || – || * || * || 0 || 0|-| UNLK || || || || Unlink || An → SP; (SP) → An || – || – || – || – || –|}
= Links =
*[[Media:MC68000 User's Manual.pdf|Motorola MC68000 CPU User's Manual]]
*[https://www.ndr-nkc.de/download/hard/68000_Motorola_Advanced_Information.pdf MC68000 Advance Information]
*[http://os9projects.com/CD_Archive/TUTORIAL/REF/CARD/68000_Ref_Card.pdf 68000 - Programmer's Instant Reference Card]
*[https://mrjester.hapisan.com/04_MC68/ MarkeyJester’s Motorola 68000 Beginner’s Tutorial]
*[https://www.chibiakumas.com/68000/ Learn Assembly Programming with ChibiAkumas] Multi-platform 68000 tutorial
*[http://goldencrystal.free.fr/M68kOpcodes-v2.3.pdf Decoding m68k opcodes]
*[https://youtu.be/UaHtGf4aRLs Motorola 68000 oral history panel]
*[http://www.easy68k.com/paulrsm/doc/dpbm68k1.htm Part 1] [http://www.easy68k.com/paulrsm/doc/dpbm68k2.htm Part 2] [http://www.easy68k.com/paulrsm/doc/dpbm68k3.htm Part 3] Design philosophy behind Motorola's MC68000
*[https://gendev.spritesmind.net/forum/viewtopic.php?t=2925 Full list of 68k patents]
*[https://wiki.neogeodev.org/index.php?title=68k_instructions_timings 68k instructions timings]
*[https://raw.githubusercontent.com/larsbrinkhoff/m68k-microcode/master/doc/Yacht.txt Yet Another Cycle Hunting Table]
*[https://pasti.fxatari.com/68kdocs/68kPrefetch.html Instruction Prefetch documentation]
*[https://github.com/SingleStepTests Tom Harte's SingleStepTests]
<br>
[[Category:Non CPC Computers]]
[[Category:Electronic Component]]