mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-05-03 14:39:38 +00:00
as: add initial, primitive, but working assembler
This commit is contained in:
53
as/input.h
Normal file
53
as/input.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* input.h
|
||||
*/
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
/*
|
||||
* A directives, label, or instruction is parsed to a statement, which is
|
||||
* either interpreted immediately or appended to the representation of the
|
||||
* current section.
|
||||
*/
|
||||
|
||||
enum stmt_tag {
|
||||
/* directives */
|
||||
S_DOT_GLOBL,
|
||||
S_DOT_TEXT,
|
||||
/* non-directives */
|
||||
S_LABEL,
|
||||
S_INSN,
|
||||
};
|
||||
|
||||
struct stmt {
|
||||
struct stmt *next;
|
||||
enum stmt_tag tag;
|
||||
union {
|
||||
struct { /* S_DOT_GLOBL, S_LABEL */
|
||||
const char *name;
|
||||
} symbol;
|
||||
struct { /* S_INSN */
|
||||
unsigned int opcode;
|
||||
unsigned int accumulator;
|
||||
int at;
|
||||
unsigned int address; /* XXX: relocatable expr */
|
||||
unsigned int indexreg;
|
||||
} insn;
|
||||
} u;
|
||||
};
|
||||
|
||||
/*
|
||||
* The input unit object is the top-level container for the representation
|
||||
* of the sections, and all other information collected from the input.
|
||||
*/
|
||||
|
||||
struct iunit {
|
||||
struct {
|
||||
struct stmt *head;
|
||||
struct stmt **tailptr;
|
||||
} text;
|
||||
};
|
||||
|
||||
int input(const char *progname, char **files, int nrfiles, struct iunit *iunit);
|
||||
|
||||
#endif /* INPUT_H */
|
||||
Reference in New Issue
Block a user