rdos/lib/opcode80.asm

143 lines
3.8 KiB
NASM
Raw Normal View History

; BYTE name length
; n BYTES name
; BYTE opcode template (variable parts zero)
;
; BYTE operand 1
; BYTE operand 2
; operand types:
; 0x00 none
; 0x1n reg8, opcode |= (reg8 << n)
; 0x2n reg16, opcode |= (reg8 << n)
; 0x3n reg16b, opcode |= (reg8 << n)
; 0x7n 3-bit number, opcode |= (num << n)
; 0x80 imm8, encoded as extra byte
; 0x81 imm16, encoded as extra word
registers:
.reg8:
db "B", 0
db "C", 0
db "D", 0
db "E", 0
db "H", 0
db "L", 0
db "M", 0
db 0
.reg16:
db "BC", 0
db "DE", 0
db "HL", 0
db "SP", 0
db 0
.reg16b:
db "BC", 0
db "DE", 0
db "HL", 0
db "AF", 0
db 0
.end:
db 0
opcodes:
; Data movement
db 3, "MOV", 0b01000000, 0x13, 0x10
db 3, "MVI", 0b00000110, 0x13, 0x80
db 3, "LXI", 0b00000001, 0x24, 0x81
db 3, "LDA", 0b00111010, 0x81, 0x00
db 3, "STA", 0b00110010, 0x81, 0x00
db 4, "LHLD", 0b00101010, 0x81, 0x00
db 4, "SHLD", 0b00100010, 0x81, 0x00
db 4, "LDAX", 0b00001010, 0x24, 0x00
db 4, "STAX", 0b00000010, 0x24, 0x00
db 4, "XCHG", 0b11101011, 0x00, 0x00
; Addition / Subtraction
db 3, "ADD", 0b10000000, 0x10, 0x00
db 3, "ADI", 0b11000110, 0x80, 0x00
db 3, "ADC", 0b10001000, 0x10, 0x00
db 3, "ACI", 0b11001110, 0x80, 0x00
db 3, "SUB", 0b10010000, 0x10, 0x00
db 3, "SUI", 0b11010110, 0x80, 0x00
db 3, "SBB", 0b10011000, 0x10, 0x00
db 3, "SBI", 0b11011110, 0x80, 0x00
db 3, "INR", 0b00000100, 0x13, 0x00
db 3, "DCR", 0b00000101, 0x13, 0x00
db 3, "INX", 0b00000011, 0x24, 0x00
db 3, "DCX", 0b00001011, 0x24, 0x00
db 3, "DAD", 0b00001001, 0x24, 0x00
; BCD
db 3, "DAA", 0b00100111, 0x00, 0x00
; Bitwise operations
db 3, "ANA", 0b10100000, 0x10, 0x00
db 3, "ANI", 0b11100110, 0x80, 0x00
db 3, "ORA", 0b10110000, 0x10, 0x00
db 3, "ORI", 0b11110110, 0x80, 0x00
db 3, "XRA", 0b10101000, 0x10, 0x00
db 3, "XRI", 0b11101110, 0x80, 0x00
db 3, "CMP", 0b10111000, 0x10, 0x00
db 3, "CPI", 0b11111110, 0x80, 0x00
; Rotate
db 3, "RLC", 0b00000111, 0x00, 0x00
db 3, "RRC", 0b00001111, 0x00, 0x00
db 3, "RAL", 0b00010111, 0x00, 0x00
db 3, "RAR", 0b00011111, 0x00, 0x00
; Complement
db 3, "CMA", 0b00101111, 0x00, 0x00
db 3, "CMC", 0b00111111, 0x00, 0x00
db 3, "STC", 0b00110111, 0x00, 0x00
; Jump
db 3, "JMP", 0b11000011, 0x81, 0x00
db 3, "JNZ", 0b11000010, 0x81, 0x00
db 2, "JZ", 0b11001010, 0x81, 0x00
db 3, "JNC", 0b11010010, 0x81, 0x00
db 2, "JC", 0b11011010, 0x81, 0x00
db 3, "JPO", 0b11100010, 0x81, 0x00
db 3, "JPE", 0b11101010, 0x81, 0x00
db 2, "JP", 0b11110010, 0x81, 0x00
db 2, "JM", 0b11111010, 0x81, 0x00
; Call
db 4, "CALL", 0b11001101, 0x81, 0x00
db 3, "CNZ", 0b11000100, 0x81, 0x00
db 2, "CZ", 0b11001100, 0x81, 0x00
db 3, "CNC", 0b11010100, 0x81, 0x00
db 2, "CC", 0b11011100, 0x81, 0x00
db 3, "CPO", 0b11100100, 0x81, 0x00
db 3, "CPE", 0b11101100, 0x81, 0x00
db 2, "CP", 0b11110100, 0x81, 0x00
db 2, "CM", 0b11111100, 0x81, 0x00
; Return
db 3, "RET", 0b11001001, 0x00, 0x00
db 3, "RNZ", 0b11000000, 0x00, 0x00
db 2, "RZ", 0b11001000, 0x00, 0x00
db 3, "RNC", 0b11010000, 0x00, 0x00
db 2, "RC", 0b11011000, 0x00, 0x00
db 3, "RPO", 0b11100000, 0x00, 0x00
db 3, "RPE", 0b11101000, 0x00, 0x00
db 2, "RP", 0b11110000, 0x00, 0x00
db 2, "RM", 0b11111000, 0x00, 0x00
db 3, "RST", 0b11000111, 0x73, 0x00
db 4, "PCHL", 0b11101001, 0x00, 0x00
db 4, "PUSH", 0b11000101, 0x34, 0x00
db 3, "POP", 0b11000001, 0x34, 0x00
db 4, "XTHL", 0b11100011, 0x00, 0x00
db 4, "SPHL", 0b11111001, 0x00, 0x00
db 2, "IN", 0b11011011, 0x80, 0x00
db 3, "OUT", 0b11010011, 0x80, 0x00
db 2, "EI", 0b11111011, 0x00, 0x00
db 2, "DI", 0b11110011, 0x00, 0x00
db 3, "HLT", 0b01110110, 0x00, 0x00
db 3, "NOP", 0b00000000, 0x00, 0x00
db 0