mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
90 lines
1.4 KiB
C
90 lines
1.4 KiB
C
// The OS/K Team licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
enum
|
|
{
|
|
CD_NONE,
|
|
CD_C,
|
|
CD_O,
|
|
CD_Z,
|
|
CD_S,
|
|
CD_P,
|
|
CD_BE,
|
|
CD_L,
|
|
CD_LE,
|
|
CD_AXZ,
|
|
CD_BXZ,
|
|
CD_CXZ,
|
|
CD_DXZ,
|
|
};
|
|
|
|
enum
|
|
{
|
|
SUFF_REP = (1 << 7),
|
|
SUFF_LOCK = (1 << 6),
|
|
SUFF_COND = 0b00011111,
|
|
};
|
|
|
|
enum
|
|
{
|
|
A_NONE = 0,
|
|
A_REG = 3,
|
|
|
|
A_IMM8 = 1,
|
|
A_IMM16 = 2,
|
|
A_IMM32 = 4,
|
|
A_IMM64 = 8,
|
|
|
|
AM_RR = 0xF0,
|
|
AM_RRI = 0xF1,
|
|
AM_RRII = 0xF2,
|
|
};
|
|
|
|
#define ACC_FMT_IS_MEM(x) (((x) & 0xF0) != 0)
|
|
#define ACC_IS_MEM(p) ACC_FMT_IS_MEM((p)->type)
|
|
|
|
struct acc_t
|
|
{
|
|
uint type;
|
|
ulong val;
|
|
|
|
// A_REG
|
|
uchar reg;
|
|
|
|
// AM_...
|
|
ulong addr;
|
|
uint mlen;
|
|
|
|
// For instruction dumping ONLY
|
|
uchar reg1, reg2;
|
|
char imm1;
|
|
long imm2;
|
|
};
|
|
|
|
enum { NOPRM, P_REG, P_IMM, P_MEM=4 };
|
|
|
|
struct instr_t
|
|
{
|
|
char *name;
|
|
uint nprms;
|
|
uint (*func)(acc_t *, acc_t *, acc_t *,
|
|
ulong *, ulong *, ulong *);
|
|
};
|
|
|
|
bool eval_cond(uint cond);
|
|
|
|
void exec_instr(instr_t *in,
|
|
acc_t *p1,
|
|
acc_t *p2,
|
|
acc_t *p3,
|
|
bool lock,
|
|
bool rep);
|
|
|
|
void dump_instr(instr_t *in,
|
|
acc_t *p1,
|
|
acc_t *p2,
|
|
acc_t *p3,
|
|
bool lock,
|
|
bool rep);
|
|
|