|
@ -1,11 +1,29 @@ |
|
|
from abc import ABC, abstractmethod |
|
|
from abc import ABC, abstractmethod |
|
|
|
|
|
from collections import defaultdict |
|
|
from dataclasses import dataclass |
|
|
from dataclasses import dataclass |
|
|
|
|
|
from enum import Enum |
|
|
|
|
|
from typing import Dict, List, Type |
|
|
|
|
|
|
|
|
from gbso.cpu.cpu import CPU |
|
|
from gbso.cpu.cpu import CPU |
|
|
from gbso.cpu.regs import R16, R8 |
|
|
from gbso.cpu.regs import R16, R8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Operand(Enum): |
|
|
|
|
|
R8 = "R8" |
|
|
|
|
|
R16 = "R16" # BC, DE, HL, SP |
|
|
|
|
|
R16_NO_SP = "R16_NO_SP" # BC, DE, HL |
|
|
|
|
|
IMM3 = "IMM3" |
|
|
|
|
|
IMM8 = "IMM8" |
|
|
|
|
|
IMM16 = "IMM16" |
|
|
|
|
|
SIMM8 = "SIMM8" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Insn(ABC): |
|
|
class Insn(ABC): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
@abstractmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
@abstractmethod |
|
|
@abstractmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
@ -25,6 +43,10 @@ class LD_R_R(Insn): |
|
|
dst: R8 |
|
|
dst: R8 |
|
|
src: R8 |
|
|
src: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8, Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -41,6 +63,10 @@ class LD_R_N8(Insn): |
|
|
dst: R8 |
|
|
dst: R8 |
|
|
imm: int |
|
|
imm: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8, Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -56,6 +82,10 @@ class LD_R_N8(Insn): |
|
|
class LD_R_HL(Insn): |
|
|
class LD_R_HL(Insn): |
|
|
dst: R8 |
|
|
dst: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -71,6 +101,10 @@ class LD_R_HL(Insn): |
|
|
class LD_HL_R(Insn): |
|
|
class LD_HL_R(Insn): |
|
|
src: R8 |
|
|
src: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -86,6 +120,10 @@ class LD_HL_R(Insn): |
|
|
class LD_HL_N(Insn): |
|
|
class LD_HL_N(Insn): |
|
|
imm: int |
|
|
imm: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 12 |
|
|
return 12 |
|
@ -99,6 +137,10 @@ class LD_HL_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LD_A_BC(Insn): |
|
|
class LD_A_BC(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -112,6 +154,10 @@ class LD_A_BC(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LD_A_DE(Insn): |
|
|
class LD_A_DE(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -127,6 +173,10 @@ class LD_A_DE(Insn): |
|
|
class LD_A_NN(Insn): |
|
|
class LD_A_NN(Insn): |
|
|
nn: int |
|
|
nn: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM16] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -140,6 +190,10 @@ class LD_A_NN(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LD_BC_A(Insn): |
|
|
class LD_BC_A(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -153,6 +207,10 @@ class LD_BC_A(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LD_DE_A(Insn): |
|
|
class LD_DE_A(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -168,6 +226,10 @@ class LD_DE_A(Insn): |
|
|
class LD_NN_A(Insn): |
|
|
class LD_NN_A(Insn): |
|
|
nn: int |
|
|
nn: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM16] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -183,6 +245,10 @@ class LD_NN_A(Insn): |
|
|
class LD_A_FF_N(Insn): |
|
|
class LD_A_FF_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 12 |
|
|
return 12 |
|
@ -198,6 +264,10 @@ class LD_A_FF_N(Insn): |
|
|
class LD_FF_N_A(Insn): |
|
|
class LD_FF_N_A(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 12 |
|
|
return 12 |
|
@ -211,6 +281,10 @@ class LD_FF_N_A(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LD_A_FF_C(Insn): |
|
|
class LD_A_FF_C(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -224,6 +298,10 @@ class LD_A_FF_C(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LD_FF_C_A(Insn): |
|
|
class LD_FF_C_A(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -237,6 +315,10 @@ class LD_FF_C_A(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LDI_HL_A(Insn): |
|
|
class LDI_HL_A(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -252,6 +334,10 @@ class LDI_HL_A(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LDI_A_HL(Insn): |
|
|
class LDI_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -267,6 +353,10 @@ class LDI_A_HL(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LDD_HL_A(Insn): |
|
|
class LDD_HL_A(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -282,6 +372,10 @@ class LDD_HL_A(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LDD_A_HL(Insn): |
|
|
class LDD_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -300,6 +394,10 @@ class LD_RR_NN(Insn): |
|
|
rr: R16 |
|
|
rr: R16 |
|
|
nn: int |
|
|
nn: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R16, Operand.IMM16] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 12 |
|
|
return 12 |
|
@ -315,6 +413,10 @@ class LD_RR_NN(Insn): |
|
|
class LD_NN_SP(Insn): |
|
|
class LD_NN_SP(Insn): |
|
|
nn: int |
|
|
nn: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM16] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 20 |
|
|
return 20 |
|
@ -328,6 +430,10 @@ class LD_NN_SP(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class LD_SP_HL(Insn): |
|
|
class LD_SP_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -345,6 +451,10 @@ class LD_SP_HL(Insn): |
|
|
class PUSH_RR(Insn): |
|
|
class PUSH_RR(Insn): |
|
|
rr: R16 |
|
|
rr: R16 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R16_NO_SP] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -362,6 +472,10 @@ class PUSH_RR(Insn): |
|
|
class POP_RR(Insn): |
|
|
class POP_RR(Insn): |
|
|
rr: R16 |
|
|
rr: R16 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R16_NO_SP] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 12 |
|
|
return 12 |
|
@ -379,6 +493,10 @@ class POP_RR(Insn): |
|
|
class ADD_A_R(Insn): |
|
|
class ADD_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -396,6 +514,10 @@ class ADD_A_R(Insn): |
|
|
class ADD_A_N(Insn): |
|
|
class ADD_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -411,6 +533,10 @@ class ADD_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class ADD_A_HL(Insn): |
|
|
class ADD_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -428,6 +554,10 @@ class ADD_A_HL(Insn): |
|
|
class ADC_A_R(Insn): |
|
|
class ADC_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -445,6 +575,10 @@ class ADC_A_R(Insn): |
|
|
class ADC_A_N(Insn): |
|
|
class ADC_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -460,6 +594,10 @@ class ADC_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class ADC_A_HL(Insn): |
|
|
class ADC_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -477,6 +615,10 @@ class ADC_A_HL(Insn): |
|
|
class SUB_A_R(Insn): |
|
|
class SUB_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -494,6 +636,10 @@ class SUB_A_R(Insn): |
|
|
class SUB_A_N(Insn): |
|
|
class SUB_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -509,6 +655,10 @@ class SUB_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class SUB_A_HL(Insn): |
|
|
class SUB_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -526,6 +676,10 @@ class SUB_A_HL(Insn): |
|
|
class SBC_A_R(Insn): |
|
|
class SBC_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -543,6 +697,10 @@ class SBC_A_R(Insn): |
|
|
class SBC_A_N(Insn): |
|
|
class SBC_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -558,6 +716,10 @@ class SBC_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class SBC_A_HL(Insn): |
|
|
class SBC_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -575,6 +737,10 @@ class SBC_A_HL(Insn): |
|
|
class AND_A_R(Insn): |
|
|
class AND_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -592,6 +758,10 @@ class AND_A_R(Insn): |
|
|
class AND_A_N(Insn): |
|
|
class AND_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -607,6 +777,10 @@ class AND_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class AND_A_HL(Insn): |
|
|
class AND_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -624,6 +798,10 @@ class AND_A_HL(Insn): |
|
|
class XOR_A_R(Insn): |
|
|
class XOR_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -641,6 +819,10 @@ class XOR_A_R(Insn): |
|
|
class XOR_A_N(Insn): |
|
|
class XOR_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -656,6 +838,10 @@ class XOR_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class XOR_A_HL(Insn): |
|
|
class XOR_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -673,6 +859,10 @@ class XOR_A_HL(Insn): |
|
|
class OR_A_R(Insn): |
|
|
class OR_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -690,6 +880,10 @@ class OR_A_R(Insn): |
|
|
class OR_A_N(Insn): |
|
|
class OR_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -705,6 +899,10 @@ class OR_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class OR_A_HL(Insn): |
|
|
class OR_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -722,6 +920,10 @@ class OR_A_HL(Insn): |
|
|
class CP_A_R(Insn): |
|
|
class CP_A_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -737,6 +939,10 @@ class CP_A_R(Insn): |
|
|
class CP_A_N(Insn): |
|
|
class CP_A_N(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -750,6 +956,10 @@ class CP_A_N(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class CP_A_HL(Insn): |
|
|
class CP_A_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -767,6 +977,10 @@ class CP_A_HL(Insn): |
|
|
class INC_R(Insn): |
|
|
class INC_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -780,7 +994,9 @@ class INC_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class INC_HL(Insn): |
|
|
class INC_HL(Insn): |
|
|
r: R8 |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
@ -798,6 +1014,10 @@ class INC_HL(Insn): |
|
|
class DEC_R(Insn): |
|
|
class DEC_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -811,7 +1031,9 @@ class DEC_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class DEC_HL(Insn): |
|
|
class DEC_HL(Insn): |
|
|
r: R8 |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
@ -827,6 +1049,10 @@ class DEC_HL(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class CPL(Insn): |
|
|
class CPL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -842,6 +1068,10 @@ class CPL(Insn): |
|
|
class ADD_HL_RR(Insn): |
|
|
class ADD_HL_RR(Insn): |
|
|
rr: R16 |
|
|
rr: R16 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R16] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -859,6 +1089,10 @@ class ADD_HL_RR(Insn): |
|
|
class INC_RR(Insn): |
|
|
class INC_RR(Insn): |
|
|
rr: R16 |
|
|
rr: R16 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R16] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -874,6 +1108,10 @@ class INC_RR(Insn): |
|
|
class DEC_RR(Insn): |
|
|
class DEC_RR(Insn): |
|
|
rr: R16 |
|
|
rr: R16 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R16] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -889,6 +1127,10 @@ class DEC_RR(Insn): |
|
|
class ADD_SP_DD(Insn): |
|
|
class ADD_SP_DD(Insn): |
|
|
dd: int |
|
|
dd: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.SIMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -906,6 +1148,10 @@ class ADD_SP_DD(Insn): |
|
|
class LD_HL_SP_DD(Insn): |
|
|
class LD_HL_SP_DD(Insn): |
|
|
dd: int |
|
|
dd: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.SIMM8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 12 |
|
|
return 12 |
|
@ -921,6 +1167,10 @@ class LD_HL_SP_DD(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RLCA(Insn): |
|
|
class RLCA(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -936,6 +1186,10 @@ class RLCA(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RLA(Insn): |
|
|
class RLA(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -952,6 +1206,10 @@ class RLA(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RRCA(Insn): |
|
|
class RRCA(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -967,6 +1225,10 @@ class RRCA(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RRA(Insn): |
|
|
class RRA(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -985,6 +1247,10 @@ class RRA(Insn): |
|
|
class RLC_R(Insn): |
|
|
class RLC_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1000,6 +1266,10 @@ class RLC_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RLC_HL(Insn): |
|
|
class RLC_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1016,6 +1286,10 @@ class RLC_HL(Insn): |
|
|
class RL_R(Insn): |
|
|
class RL_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1032,6 +1306,10 @@ class RL_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RL_HL(Insn): |
|
|
class RL_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1049,6 +1327,10 @@ class RL_HL(Insn): |
|
|
class RRC_R(Insn): |
|
|
class RRC_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1064,6 +1346,10 @@ class RRC_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RRC_HL(Insn): |
|
|
class RRC_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1080,6 +1366,10 @@ class RRC_HL(Insn): |
|
|
class RR_R(Insn): |
|
|
class RR_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1096,6 +1386,10 @@ class RR_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class RR_HL(Insn): |
|
|
class RR_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1113,6 +1407,10 @@ class RR_HL(Insn): |
|
|
class SLA_R(Insn): |
|
|
class SLA_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1128,6 +1426,10 @@ class SLA_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class SLA_HL(Insn): |
|
|
class SLA_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1144,6 +1446,10 @@ class SLA_HL(Insn): |
|
|
class SWAP_R(Insn): |
|
|
class SWAP_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1159,6 +1465,10 @@ class SWAP_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class SWAP_HL(Insn): |
|
|
class SWAP_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1175,6 +1485,10 @@ class SWAP_HL(Insn): |
|
|
class SRA_R(Insn): |
|
|
class SRA_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1190,6 +1504,10 @@ class SRA_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class SRA_HL(Insn): |
|
|
class SRA_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1206,6 +1524,10 @@ class SRA_HL(Insn): |
|
|
class SRL_R(Insn): |
|
|
class SRL_R(Insn): |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1221,6 +1543,10 @@ class SRL_R(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class SRL_HL(Insn): |
|
|
class SRL_HL(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1238,6 +1564,10 @@ class SET_N_R(Insn): |
|
|
n: int |
|
|
n: int |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM3, Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1253,6 +1583,10 @@ class SET_N_R(Insn): |
|
|
class SET_N_HL(Insn): |
|
|
class SET_N_HL(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM3] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1270,6 +1604,10 @@ class RES_N_R(Insn): |
|
|
n: int |
|
|
n: int |
|
|
r: R8 |
|
|
r: R8 |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM3, Operand.R8] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 8 |
|
|
return 8 |
|
@ -1285,6 +1623,10 @@ class RES_N_R(Insn): |
|
|
class RES_N_HL(Insn): |
|
|
class RES_N_HL(Insn): |
|
|
n: int |
|
|
n: int |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [Operand.IMM3] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 16 |
|
|
return 16 |
|
@ -1299,6 +1641,10 @@ class RES_N_HL(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class CCF(Insn): |
|
|
class CCF(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -1312,6 +1658,10 @@ class CCF(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class SCF(Insn): |
|
|
class SCF(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 4 |
|
|
return 4 |
|
@ -1325,6 +1675,10 @@ class SCF(Insn): |
|
|
|
|
|
|
|
|
@dataclass |
|
|
@dataclass |
|
|
class UNUSED(Insn): |
|
|
class UNUSED(Insn): |
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def signature() -> List[Operand]: |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
|
def cycles() -> int: |
|
|
def cycles() -> int: |
|
|
return 0 |
|
|
return 0 |
|
@ -1334,3 +1688,24 @@ class UNUSED(Insn): |
|
|
|
|
|
|
|
|
def pretty(self) -> str: |
|
|
def pretty(self) -> str: |
|
|
return "UNUSED" |
|
|
return "UNUSED" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALL_INSN_CLASSES: List[Type[Insn]] = [ |
|
|
|
|
|
cls for cls in Insn.__subclasses__() if cls != Insn # type: ignore |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
INSNS_BY_SIGNATURE: Dict[str, List[Type[Insn]]] = defaultdict(list) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_signature_class(insn: Insn) -> List[Type[Insn]]: |
|
|
|
|
|
signature_key = get_signature_key(insn.signature()) |
|
|
|
|
|
return INSNS_BY_SIGNATURE[signature_key] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_signature_key(signature: List[Operand]) -> str: |
|
|
|
|
|
return "-".join([ty.value for ty in signature]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for insn_cls in ALL_INSN_CLASSES: |
|
|
|
|
|
signature_key = get_signature_key(insn_cls.signature()) |
|
|
|
|
|
INSNS_BY_SIGNATURE[signature_key].append(insn_cls) |