shithub: scc

ref: 647f85d6fac7e0aee9881909cd5086941e3d11c7
dir: /as/as.h/

View raw version
enum secflags {
	SRELOC,
	SREAD,
	SWRITE,
	SEXEC,
	SFILE,
};

typedef struct ins Ins;
typedef struct op Op;
typedef struct arg Arg;
typedef void Format(Op *, Arg *);
typedef struct sec Section;

enum {
	BITS16,
};

struct ins {
	int begin, end;
	char *str;
};

struct op {
	int flags;
	int size;
	void (*format)(Op *, Arg *);
	char *bytes;
	char *args;
};

struct arg {
	int type;
	TUINT val;
};

struct bucket;

struct sec {
	char *name;
	struct bucket *mem;
	int flags;
	TUINT base;
	TUINT curpc;
	TUINT pc;
};

extern void isections(void);
extern void writeout(char *name);
extern void emit(Section *sec, char *bytes, int nbytes);

extern Section *cursec;
extern int nr_ins;
extern Ins instab[];
extern Op optab[];
extern int pass;