Mon 16 Mar 11:09:06 CET 2026
This commit is contained in:
parent
2f8328ecf6
commit
62fcfd66be
51
src/ops.h
Normal file
51
src/ops.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef _OPS_H
|
||||
#define _OPS_H
|
||||
/*
|
||||
XP-Code Operations
|
||||
|
||||
[command][[arguments]]
|
||||
*/
|
||||
typedef enum {
|
||||
ADD=1, DIV, MUL, SUB, NEG, MOD,
|
||||
AND, OR, NOT,
|
||||
EQ, NEQ, LT, GT, LE, GE, CMPS,
|
||||
DROPD, DROPF,
|
||||
PUSHD, PUSHF, NTHD, NTHF, TOF, SETF, SETSP, INCSP,
|
||||
INCHAR, INNUMBER, INSTRING, INARRAY,
|
||||
OUTCHAR, OUTNUMBER, OUTSTRING, OUTARRAY,
|
||||
STRING,
|
||||
JMP, JZ, JNZ, TESTRANGE, LOOP,
|
||||
READ, WRITE, READS, WRITES, DATA, EVENT, ERR, EMIT,
|
||||
INTERRUPT, RESUME, CALL, CCALL, PROC, FUNC, RETURN, FORK, YIELD,
|
||||
#if HAS_LOCK > 0
|
||||
LOCK, UNLOCK,
|
||||
#endif
|
||||
END, ENV
|
||||
} ops_t;
|
||||
|
||||
/*
|
||||
Variable XP operand sizes
|
||||
*/
|
||||
extern const index_t ops_s[];
|
||||
|
||||
typedef unsigned char opcmd_t; // code only
|
||||
|
||||
typedef struct {
|
||||
index_t length; // real length in bytes
|
||||
char data; // first character, dynamic memory
|
||||
} string_t;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
opcmd_t command ;
|
||||
union {
|
||||
index_t ix ;
|
||||
address_t ax ;
|
||||
number_t nx ;
|
||||
string_t sx ;
|
||||
};
|
||||
} op_t;
|
||||
|
||||
#define OPT(M,addr) ((op_t*)&M->data[addr])
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user