aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/instruction.ts190
1 files changed, 95 insertions, 95 deletions
diff --git a/src/instruction.ts b/src/instruction.ts
index 63c4caa..1d016aa 100644
--- a/src/instruction.ts
+++ b/src/instruction.ts
@@ -11,87 +11,87 @@ import { ICPU } from './cpu';
export function avrInstruction(cpu: ICPU) {
const opcode = cpu.progMem[cpu.pc];
- /* ADC */
+ /* ADC, 0001 11rd dddd rrrr */
if ((opcode & 0xfc00) === 0x1c00) {
/* not implemented */
}
- /* ADD */
+ /* ADD, 0000 11rd dddd rrrr */
if ((opcode & 0xfc00) === 0xc00) {
/* not implemented */
}
- /* ADIW */
+ /* ADIW, 1001 0110 KKdd KKKK */
if ((opcode & 0xff00) === 0x9600) {
/* not implemented */
}
- /* AND */
+ /* AND, 0010 00rd dddd rrrr */
if ((opcode & 0xfc00) === 0x2000) {
/* not implemented */
}
- /* ANDI */
+ /* ANDI, 0111 KKKK dddd KKKK */
if ((opcode & 0xf000) === 0x7000) {
/* not implemented */
}
- /* ASR */
+ /* ASR, 1001 010d dddd 0101 */
if ((opcode & 0xfe0f) === 0x9405) {
/* not implemented */
}
- /* BCLR */
+ /* BCLR, 1001 0100 1sss 1000 */
if ((opcode & 0xff8f) === 0x9488) {
/* not implemented */
}
- /* BLD */
+ /* BLD, 1111 100d dddd 0bbb */
if ((opcode & 0xfe08) === 0xf800) {
/* not implemented */
}
- /* BRBC */
- if ((opcode & 0xfc00) === 0xf400) {
+ /* BRBS, 1111 00kk kkkk ksss */
+ if ((opcode & 0xfc00) === 0xf000) {
/* not implemented */
}
- /* BRBS */
- if ((opcode & 0xfc00) === 0xf000) {
+ /* BRCC, 1111 01kk kkkk k000 */
+ if ((opcode & 0xfc00) === 0xf400) {
/* not implemented */
}
- /* BSET */
+ /* BSET, 1001 0100 0sss 1000 */
if ((opcode & 0xff8f) === 0x9408) {
/* not implemented */
}
- /* BST */
+ /* BST, 1111 101d dddd 0bbb */
if ((opcode & 0xfe08) === 0xfa00) {
/* not implemented */
}
- /* CALL */
+ /* CALL, 1001 010k kkkk 111k kkkk kkkk kkkk kkkk */
if ((opcode & 0xfe0e) === 0x940e) {
/* not implemented */
}
- /* CBI */
+ /* CBI, 1001 1000 AAAA Abbb */
if ((opcode & 0xff00) === 0x9800) {
/* not implemented */
}
- /* COM */
+ /* COM, 1001 010d dddd 0000 */
if ((opcode & 0xfe0f) === 0x9400) {
/* not implemented */
}
- /* CP */
+ /* CP, 0001 01rd dddd rrrr */
if ((opcode & 0xfc00) === 0x1400) {
/* not implemented */
}
- /* CPC */
+ /* CPC, 0000 01rd dddd rrrr */
if ((opcode & 0xfc00) === 0x400) {
const arg1 = cpu.data[(opcode & 0x1f0) >> 4];
const arg2 = cpu.data[(opcode & 0xf) | ((opcode & 0x200) >> 5)];
@@ -106,7 +106,7 @@ export function avrInstruction(cpu: ICPU) {
cpu.data[95] = sreg;
}
- /* CPI */
+ /* CPI, 0011 KKKK dddd KKKK */
if ((opcode & 0xf000) === 0x3000) {
const arg1 = cpu.data[((opcode & 0xf0) >> 4) + 16];
const arg2 = (opcode & 0xf) | ((opcode & 0xf00) >> 4);
@@ -121,249 +121,249 @@ export function avrInstruction(cpu: ICPU) {
cpu.data[95] = sreg;
}
- /* CPSE */
+ /* CPSE, 0001 00rd dddd rrrr */
if ((opcode & 0xfc00) === 0x1000) {
/* not implemented */
}
- /* DEC */
+ /* DEC, 1001 010d dddd 1010 */
if ((opcode & 0xfe0f) === 0x940a) {
/* not implemented */
}
- /* EOR */
+ /* EOR, 0010 01rd dddd rrrr */
if ((opcode & 0xfc00) === 0x2400) {
/* not implemented */
}
- /* FMUL */
+ /* FMUL, 0000 0011 0ddd 1rrr */
if ((opcode & 0xff88) === 0x308) {
/* not implemented */
}
- /* FMULS */
+ /* FMULS, 0000 0011 1ddd 0rrr */
if ((opcode & 0xff88) === 0x380) {
/* not implemented */
}
- /* FMULSU */
+ /* FMULSU, 0000 0011 1ddd 1rrr */
if ((opcode & 0xff88) === 0x388) {
/* not implemented */
}
- /* ICALL */
+ /* ICALL, 1001 0101 0000 1001 */
if (opcode === 0x9509) {
/* not implemented */
}
- /* IJMP */
+ /* IJMP, 1001 0100 0000 1001 */
if (opcode === 0x9409) {
/* not implemented */
}
- /* IN */
+ /* IN, 1011 0AAd dddd AAAA */
if ((opcode & 0xf800) === 0xb000) {
/* not implemented */
}
- /* INC */
+ /* INC, 1001 010d dddd 0011 */
if ((opcode & 0xfe0f) === 0x9403) {
/* not implemented */
}
- /* JMP */
+ /* JMP, 1001 010k kkkk 110k kkkk kkkk kkkk kkkk */
if ((opcode & 0xfe0e) === 0x940c) {
cpu.pc = (cpu.progMem[cpu.pc + 1] | ((opcode & 1) << 16) | ((opcode & 0x1f0) << 13)) - 1;
cpu.cycles += 2;
}
- /* LAC */
+ /* LAC, 1001 001r rrrr 0110 */
if ((opcode & 0xfe0f) === 0x9206) {
/* not implemented */
}
- /* LAS */
+ /* LAS, 1001 001r rrrr 0101 */
if ((opcode & 0xfe0f) === 0x9205) {
/* not implemented */
}
- /* LAT */
+ /* LAT, 1001 001r rrrr 0111 */
if ((opcode & 0xfe0f) === 0x9207) {
/* not implemented */
}
- /* LDI */
+ /* LDI, 1110 KKKK dddd KKKK */
if ((opcode & 0xf000) === 0xe000) {
cpu.data[((opcode & 0xf0) >> 4) + 16] = (opcode & 0xf) | ((opcode & 0xf00) >> 4);
}
- /* LDS */
+ /* LDS, 1001 000d dddd 0000 kkkk kkkk kkkk kkkk */
if ((opcode & 0xfe0f) === 0x9000) {
/* not implemented */
}
- /* LDX */
+ /* LDX, 1001 000d dddd 1100 */
if ((opcode & 0xfe0f) === 0x900c) {
/* not implemented */
}
- /* LDX */
+ /* LDX, 1001 000d dddd 1101 */
if ((opcode & 0xfe0f) === 0x900d) {
/* not implemented */
}
- /* LDX */
+ /* LDX, 1001 000d dddd 1110 */
if ((opcode & 0xfe0f) === 0x900e) {
/* not implemented */
}
- /* LDY */
+ /* LDY, 1000 000d dddd 1000 */
if ((opcode & 0xfe0f) === 0x8008) {
/* not implemented */
}
- /* LDY */
+ /* LDY, 1001 000d dddd 1001 */
if ((opcode & 0xfe0f) === 0x9009) {
/* not implemented */
}
- /* LDY */
+ /* LDY, 1001 000d dddd 1010 */
if ((opcode & 0xfe0f) === 0x900a) {
/* not implemented */
}
- /* LDY */
+ /* LDY, 10q0 qq0d dddd 1qqq */
if ((opcode & 0xd208) === 0x8008) {
/* not implemented */
}
- /* LDZ */
+ /* LDZ, 1000 000d dddd 0000 */
if ((opcode & 0xfe0f) === 0x8000) {
/* not implemented */
}
- /* LDZ */
+ /* LDZ, 1001 000d dddd 0001 */
if ((opcode & 0xfe0f) === 0x9001) {
/* not implemented */
}
- /* LDZ */
+ /* LDZ, 1001 000d dddd 0010 */
if ((opcode & 0xfe0f) === 0x9002) {
/* not implemented */
}
- /* LDZ */
+ /* LDZ, 10q0 qq0d dddd 0qqq */
if ((opcode & 0xd208) === 0x8000) {
/* not implemented */
}
- /* LPM */
+ /* LPM, 1001 0101 1100 1000 */
if (opcode === 0x95c8) {
/* not implemented */
}
- /* LPM */
+ /* LPM, 1001 000d dddd 0100 */
if ((opcode & 0xfe0f) === 0x9004) {
/* not implemented */
}
- /* LPM */
+ /* LPM, 1001 000d dddd 0101 */
if ((opcode & 0xfe0f) === 0x9005) {
/* not implemented */
}
- /* LSR */
+ /* LSR, 1001 010d dddd 0110 */
if ((opcode & 0xfe0f) === 0x9406) {
/* not implemented */
}
- /* MOV */
+ /* MOV, 0010 11rd dddd rrrr */
if ((opcode & 0xfc00) === 0x2c00) {
/* not implemented */
}
- /* MOVW */
+ /* MOVW, 0000 0001 dddd rrrr */
if ((opcode & 0xff00) === 0x100) {
/* not implemented */
}
- /* MUL */
+ /* MUL, 1001 11rd dddd rrrr */
if ((opcode & 0xfc00) === 0x9c00) {
/* not implemented */
}
- /* MULS */
+ /* MULS, 0000 0010 dddd rrrr */
if ((opcode & 0xff00) === 0x200) {
/* not implemented */
}
- /* MULSU */
+ /* MULSU, 0000 0011 0ddd 0rrr */
if ((opcode & 0xff88) === 0x300) {
/* not implemented */
}
- /* NEG */
+ /* NEG, 1001 010d dddd 0001 */
if ((opcode & 0xfe0f) === 0x9401) {
/* not implemented */
}
- /* NOP */
+ /* NOP, 0000 0000 0000 0000 */
if (opcode === 0) {
/* NOP */
}
- /* OR */
+ /* OR, 0010 10rd dddd rrrr */
if ((opcode & 0xfc00) === 0x2800) {
/* not implemented */
}
- /* SBR */
+ /* SBR, 0110 KKKK dddd KKKK */
if ((opcode & 0xf000) === 0x6000) {
/* not implemented */
}
- /* OUT */
+ /* OUT, 1011 1AAr rrrr AAAA */
if ((opcode & 0xf800) === 0xb800) {
cpu.writeData(((opcode & 0xf) | ((opcode & 0x600) >> 5)) + 32, cpu.data[(opcode & 0x1f0) >> 4]);
}
- /* POP */
+ /* POP, 1001 000d dddd 1111 */
if ((opcode & 0xfe0f) === 0x900f) {
/* not implemented */
}
- /* PUSH */
+ /* PUSH, 1001 001d dddd 1111 */
if ((opcode & 0xfe0f) === 0x920f) {
/* not implemented */
}
- /* RCALL */
+ /* RCALL, 1101 kkkk kkkk kkkk */
if ((opcode & 0xf000) === 0xd000) {
/* not implemented */
}
- /* RET */
+ /* RET, 1001 0101 0000 1000 */
if (opcode === 0x9508) {
/* not implemented */
}
- /* RETI */
+ /* RETI, 1001 0101 0001 1000 */
if (opcode === 0x9518) {
/* not implemented */
}
- /* RJMP */
+ /* RJMP, 1100 kkkk kkkk kkkk */
if ((opcode & 0xf000) === 0xc000) {
cpu.pc = cpu.pc + ((opcode & 0x7ff) - (opcode & 0x800 ? 0x800 : 0));
cpu.cycles++;
}
- /* ROR */
+ /* ROR, 1001 010d dddd 0111 */
if ((opcode & 0xfe0f) === 0x9407) {
/* not implemented */
}
- /* SBC */
+ /* SBC, 0000 10rd dddd rrrr */
if ((opcode & 0xfc00) === 0x800) {
/* not implemented */
}
@@ -373,68 +373,68 @@ export function avrInstruction(cpu: ICPU) {
/* not implemented */
}
- /* SBI */
+ /* SBI, 0100 KKKK dddd KKKK */
if ((opcode & 0xff00) === 0x9a00) {
/* not implemented */
}
- /* SBIC */
+ /* SBIC, 1001 1001 AAAA Abbb */
if ((opcode & 0xff00) === 0x9900) {
/* not implemented */
}
- /* SBIS */
+ /* SBIS, 1001 1011 AAAA Abbb */
if ((opcode & 0xff00) === 0x9b00) {
/* not implemented */
}
- /* SBIW */
+ /* SBIW, 1001 0111 KKdd KKKK */
if ((opcode & 0xff00) === 0x9700) {
/* not implemented */
}
- /* SBRC */
+ /* SBRC, 1111 110r rrrr 0bbb */
if ((opcode & 0xfe08) === 0xfc00) {
/* not implemented */
}
- /* SBRS */
+ /* SBRS, 1111 111r rrrr 0bbb */
if ((opcode & 0xfe08) === 0xfe00) {
/* not implemented */
}
- /* SLEEP */
+ /* SLEEP, 1001 0101 1000 1000 */
if (opcode === 0x9588) {
/* not implemented */
}
- /* SPM */
+ /* SPM, 1001 0101 1110 1000 */
if (opcode === 0x95e8) {
/* not implemented */
}
- /* SPM */
+ /* SPM, 1001 0101 1111 1000 */
if (opcode === 0x95f8) {
/* not implemented */
}
- /* STS */
+ /* STS, 1001 001d dddd 0000 kkkk kkkk kkkk kkkk */
if ((opcode & 0xfe0f) === 0x9200) {
/* not implemented */
}
- /* STX */
+ /* STX, 1001 001r rrrr 1100 */
if ((opcode & 0xfe0f) === 0x920c) {
cpu.writeData(cpu.dataView.getUint16(26, true), cpu.data[(opcode & 0x1f0) >> 4]);
}
- /* STX */
+ /* STX, 1001 001r rrrr 1101 */
if ((opcode & 0xfe0f) === 0x920d) {
cpu.writeData(cpu.dataView.getUint16(26, true), cpu.data[(opcode & 0x1f0) >> 4]);
cpu.dataView.setUint16(26, cpu.dataView.getUint16(26, true) + 1, true);
}
- /* STX */
+ /* STX, 1001 001r rrrr 1110 */
if ((opcode & 0xfe0f) === 0x920e) {
const i = cpu.data[(opcode & 0x1f0) >> 4];
cpu.dataView.setUint16(26, cpu.dataView.getUint16(26, true) - 1, true);
@@ -442,67 +442,67 @@ export function avrInstruction(cpu: ICPU) {
cpu.cycles++;
}
- /* STY */
+ /* STY, 1000 001r rrrr 1000 */
if ((opcode & 0xfe0f) === 0x8208) {
/* not implemented */
}
- /* STY */
+ /* STY, 1001 001r rrrr 1001 */
if ((opcode & 0xfe0f) === 0x9209) {
/* not implemented */
}
- /* STY */
+ /* STY, 1001 001r rrrr 1010 */
if ((opcode & 0xfe0f) === 0x920a) {
/* not implemented */
}
- /* STY */
+ /* STY, 10q0 qq1r rrrr 1qqq */
if ((opcode & 0xd208) === 0x8208) {
/* not implemented */
}
- /* STZ */
+ /* STZ, 1000 001r rrrr 0000 */
if ((opcode & 0xfe0f) === 0x8200) {
/* not implemented */
}
- /* STZ */
+ /* STZ, 1001 001r rrrr 0001 */
if ((opcode & 0xfe0f) === 0x9201) {
/* not implemented */
}
- /* STZ */
+ /* STZ, 1001 001r rrrr 0010 */
if ((opcode & 0xfe0f) === 0x9202) {
/* not implemented */
}
- /* STZ */
+ /* STZ, 10q0 qq1r rrrr 0qqq */
if ((opcode & 0xd208) === 0x8200) {
/* not implemented */
}
- /* SUB */
+ /* SUB, 0001 10rd dddd rrrr */
if ((opcode & 0xfc00) === 0x1800) {
/* not implemented */
}
- /* SUBI */
+ /* SUBI, 0101 KKKK dddd KKKK */
if ((opcode & 0xf000) === 0x5000) {
/* not implemented */
}
- /* SWAP */
+ /* SWAP, 1001 010d dddd 0010 */
if ((opcode & 0xfe0f) === 0x9402) {
/* not implemented */
}
- /* WDR */
+ /* WDR, 1001 0101 1010 1000 */
if (opcode === 0x95a8) {
/* not implemented */
}
- /* XCH */
+ /* XCH, 1001 001r rrrr 0100 */
if ((opcode & 0xfe0f) === 0x9204) {
/* not implemented */
}
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.