mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
60 lines
1.0 KiB
C
60 lines
1.0 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
|
|
{
|
|
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 *);
|
|
};
|
|
|
|
void exec_instr(instr_t *in,
|
|
acc_t *p1,
|
|
acc_t *p2,
|
|
acc_t *p3);
|
|
|
|
void dump_instr(instr_t *in,
|
|
acc_t *p1,
|
|
acc_t *p2,
|
|
acc_t *p3);
|
|
|