2018-04-02 22:21:26 +00:00
|
|
|
[< back to index](../index.md)
|
|
|
|
|
2018-01-04 00:15:04 +00:00
|
|
|
# Undocumented opcodes
|
|
|
|
|
2018-07-27 17:07:12 +00:00
|
|
|
## 6502
|
|
|
|
|
2018-01-04 00:15:04 +00:00
|
|
|
Original 6502 processors accidentally supported a bunch of extra undocumented instructions.
|
|
|
|
Millfork can emit them if so desired.
|
|
|
|
|
2019-03-18 22:15:28 +00:00
|
|
|
#### Mnemonics
|
2018-01-04 00:15:04 +00:00
|
|
|
|
|
|
|
Since various assemblers use different mnemonics for undocumented opcodes,
|
|
|
|
Millfork supports multiple mnemonics per opcode. The default one is given first:
|
|
|
|
|
|
|
|
* **AHX**, AXA, SHA
|
|
|
|
|
|
|
|
* **ALR**
|
|
|
|
|
|
|
|
* **ANC**
|
|
|
|
|
|
|
|
* **ARR**
|
|
|
|
|
|
|
|
* **DCP**, DCM
|
|
|
|
|
|
|
|
* **ISC**, INS
|
|
|
|
|
|
|
|
* **LAS**
|
|
|
|
|
|
|
|
* **LAX**
|
|
|
|
|
|
|
|
* **LXA**, OAL
|
|
|
|
|
|
|
|
* **RLA**
|
|
|
|
|
|
|
|
* **RRA**
|
|
|
|
|
2018-03-03 00:21:57 +00:00
|
|
|
* **SAX**\*
|
2018-01-04 00:15:04 +00:00
|
|
|
|
|
|
|
* **SHX**, XAS
|
|
|
|
|
2018-03-03 00:21:57 +00:00
|
|
|
* **SHY**, SAY\*
|
2018-01-04 00:15:04 +00:00
|
|
|
|
2018-03-03 00:21:57 +00:00
|
|
|
* **SBX**, AXS\*\*
|
2018-01-04 00:15:04 +00:00
|
|
|
|
|
|
|
* **SRE**, LSE
|
|
|
|
|
|
|
|
* **SLO**, ASO
|
|
|
|
|
|
|
|
* **TAS**
|
|
|
|
|
|
|
|
* **XAA**, ANE
|
|
|
|
|
2018-03-03 00:21:57 +00:00
|
|
|
\* HuC2680 has different instructions also called SAX and SAY,
|
|
|
|
but Millfork can distinguish between them and the NMOS illegal instructions based on the addressing mode.
|
|
|
|
|
|
|
|
\*\* AXS is also used for SAX in some assemblers. Millfork interprets AXS based on the addressing mode.
|
2018-01-04 00:15:04 +00:00
|
|
|
|
2019-03-18 22:15:28 +00:00
|
|
|
#### Generation
|
2018-01-04 00:15:04 +00:00
|
|
|
|
|
|
|
In order for the compiler to emit one of those opcodes,
|
|
|
|
an appropriate CPU architecture must be chosen (`nmos` or `ricoh`)
|
|
|
|
and either it must appear in an assembly block or it may be a result of optimization.
|
|
|
|
|
|
|
|
Optimization will never emit any of the following opcodes due to their instability and/or uselessness:
|
|
|
|
AHX, LAS, LXA, SHX, SHY, TAS, XAA.
|
2018-07-27 17:07:12 +00:00
|
|
|
|
|
|
|
## Z80
|
|
|
|
|
|
|
|
Original Z80 processors accidentally supported a bunch of extra undocumented instructions.
|
|
|
|
Millfork will not emit them.
|
|
|
|
The only exception is SLL, which will be emitted if it occurs in a handwritten assembly block.
|
2019-05-31 15:03:35 +00:00
|
|
|
|
2019-06-12 10:06:02 +00:00
|
|
|
## 8085
|
|
|
|
|
|
|
|
Since various assemblers use different mnemonics for undocumented opcodes,
|
|
|
|
Millfork supports multiple mnemonics per opcode. The default one is given first:
|
|
|
|
|
|
|
|
Intel syntax | Zilog syntax
|
|
|
|
**DSUB** | **DSUB**
|
|
|
|
**ARHL**, RRHL | **SRA HL**
|
|
|
|
**RLDE**, RDEL | **RL DE**
|
|
|
|
**LDHI n** | **LD DE,(HL+n)**
|
|
|
|
**LDSI n** | **LD DE,(SP+n)**
|
|
|
|
**LHLX** | **LD HL,(DE)**
|
|
|
|
**SHLX** | **LD (DE),HL**
|
|
|
|
**JK n**, JX5 n | **JP K,n**; JP X5,n
|
|
|
|
**JNK n**, JNX5 n | **JP NK,n**; JP NX5,n
|
|
|
|
**RSTV**, OVRST8 | **RSTV**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### Generation
|
|
|
|
|
|
|
|
If enabled, The compiler will only emit the following undocumented instructions from Millfork code:
|
|
|
|
DSUB, LHLX, SHLX, LDSI, LDHI
|
|
|
|
|
|
|
|
The optimizer does not track the K and V flags. Use `JK`, `JNK` and `RSTV` with care.
|
|
|
|
|
2019-05-31 15:03:35 +00:00
|
|
|
## 8086
|
|
|
|
|
|
|
|
Undocumented instructions are not supported.
|