-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcode.h
More file actions
43 lines (36 loc) · 911 Bytes
/
code.h
File metadata and controls
43 lines (36 loc) · 911 Bytes
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
#ifndef __CODE_H
#define __CODE_H
#include <stdarg.h>
#include "pcode.h"
#define CODE_SPACE 0x4000
#define MAX_OP_ARGS 6
//---------------------------------------------------------------------
// The code store class
//---------------------------------------------------------------------
class codespace_t
{
private:
pword_t space[CODE_SPACE];
pword_t arg[MAX_OP_ARGS];
p_code_op_t op;
int top, in, nextP;
pword_t nextlabel;
pword_t label_table[1000]; /* Allocate dynamically of correct size! */
short emitcode;
void NextInstruction();
pword_t Displ(int argNum);
pword_t Value(int argNum);
void Variable(pword_t level, pword_t disp);
void Process(pword_t pass, pword_t codetop);
public:
codespace_t();
int NewLabel()
{
return nextlabel++;
}
void Emit(p_code_op_t, ...);
int Link();
void Write(char *codefilename);
};
extern codespace_t *Code;
#endif