From 9827904a6aa6b649665cf78fa56716011fb37e6d Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 2 Mar 2015 15:34:34 -0800 Subject: initial commit --- notes | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 notes (limited to 'notes') diff --git a/notes b/notes new file mode 100644 index 0000000..294e217 --- /dev/null +++ b/notes @@ -0,0 +1,75 @@ +ops: +15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +0 | 0 | 0 | 1 | 0 | 0 | opcode | bw | ad | dest | +0 | 0 | 1 | cond | pc-offset | +opcode | source | ad | bw | as | dest | + +bw = 1 for byte ops, 0 for word ops + +oneop +000 RRC 9-bit rotate through carry +001 SWPB - swap 8-bit halves. no byte form +010 RRA(.B) - arithmetic right shift +011 SXT sign extend 8 bits to 16 bits. no byte form +100 PUSH(.B) - push byte still decrements sp by 2 +101 CALL - get operand. push PC, PC = operand. no byte form. hard to do PC-relative call +110 RETI - pop SP then pop PC. opeand field unused. +111 not used + +relative jumps +all PC-relative +000 JNE/JNZ +001 JEQ/JZ +010 JNC/JLO +011 JC/JHS +100 JN +101 JGE +110 JL +111 JMP + +twoop +generally dest = src op dest +mov doesnt fetch dest, cmp/bit dont write dest. all valid in 8 bit and 16 bit + +0100 MOV - dest = src +0101 ADD - dest += src +0110 ADDC - dest += src + C +0111 SUBC - dest = dest - src + c (dest += ~src + C) +1000 SUB - dest -= src +1001 CMP - dest - src (set status only, dest not written) +1010 DADD - dest += src + C, in BCD +1011 BIT - dest & src (set status only) +1100 BIC - dest &= ~src (status not set) +1101 BIS - dest |= src (status not set) +1110 XOR - dest ^= src +1111 AND - dest &= src + +NOP implemented as virtual function, among others - +NOP == MOV r3, r3 +POP dst == MOV @SP+, dst +BR dst == MOV dst, PC +RET == MOV @SP+, PC +CLRC 1 +SETC 1 +CLRZ 2 +SETZ 2 +CLRN 4 +SETN 4 +DINT 8 +EINT 8 + +RLA dst == ADD dst, dst +RLC dst = ADDC dst, dst + +INV dst == XOR #-1, dst +CLR dst == MOV #0, dst +TST dst == CMP #0, dst + +DEC == SUB #1, dst +DECD == SUB #2, dst +INC == ADD #1, dst +INCD == ADD #2, dst + +ADC dst == ADDC #0, dst +DADC dst == DADD #0, dst +SBC dst == SUBC #0, dst -- cgit v1.1