-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasm.h
120 lines (97 loc) · 3.2 KB
/
asm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
This file is part of The Didactic PDP-8 Assembler
Copyright (C) 2002 Toby Thain, toby@telegraphics.com.au
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern char version[],target_arch[],
listfmt[],listfmt_noloc[],listfmt_empty[],
*objsuffix;
enum{ PARITYBIT = 0200 };
/* #define NULL ((void*)0) */
#define NEW(P) ( (P) = malloc(sizeof(*(P))) )
#define VPUTS if(verbose) puts
#define VPRINTF if(verbose) printf
#define DPUTS if(debug) puts
#define DPRINTF if(debug) printf
enum{
USER_SYMBOL = -1, /* default type */
/* symbol flags */
F_NONE = 0,
F_USER=01, /* symbol was user-created rather than built-in */
F_ASSIGNED=02, /* symbol has been given a value */
};
struct sym_rec{
/* ADD ANY EXTRA FIELDS AT THE END OF THIS STRUCT
otherwise initialisers in initsyms.c will screw up! */
struct sym_rec *next;
char *name;
int value,token,flags,pageno,lineno,relmode,type;
};
extern int listpos;
#define LIST_LINE 72
extern char listline[];
extern FILE *listfile;
extern struct sym_rec predefs[],*lastsym;
extern int casesense,rimflag,leader,rbformat,
errors,pass,pageno,yylineno,debug,interactive,verbose,
inputradix,radix,curloc,words;
extern FILE *obj;
void yyerror(char*s);
extern int yyparse();
struct sym_rec *lookup(char *s);
void init_symtab();
void insert(struct sym_rec *p);
void expunge();
void clean_syms();
struct sym_rec *dosymbol(char *text,int tok);
void list_symbols();
void dump_symbols();
void iodata(char *mnemonic,int opcode,char **class);
void twoac(char *mnemonic,int opcode);
void cpu_initsyms();
void fatal(char *fmt,...);
void warn(char *fmt,...);
void assemble(int word,int relmode);
void setorg(int loc);
void dump_object(void);
void doassign(struct sym_rec *p,int value,int flags,int relmode,int lineno);
int mri(int opcode,int mod,int operand);
int combine(int op1,int op2);
char *scpy(char *dst,char *s);
char *sdup(char*);
char *uppercase(char*);
char *endof(char *str);
int read_num(char *p,int radix);
int read_signed(char *p,int radix);
void microinst(char *s,int word,char *codes[]);
void disasm(char *s,int word);
void header();
void footer();
void putout(int loc,int val);
void open_out(char *fn);
void close_out();
void flushrb();
void rbtitle(struct sym_rec *s);
void rbstart(int w,int relmode);
void initcurloc();
void warranty();
void copyright();
void dolisting(int act,int leng,char *text);
void listo(int a,int w,int m);
void newline(void);
void flushlist(void);
void printsym(struct sym_rec *p);
void listempty(char *);