2020-10-31 21:53:11 -04:00
|
|
|
#ifndef templates
|
|
|
|
#define templates
|
|
|
|
|
2020-11-01 10:40:43 -05:00
|
|
|
#define TPUSHN 10
|
2020-10-31 21:53:11 -04:00
|
|
|
char* tpush[TPUSHN] = {
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"A=D+A",
|
|
|
|
"D=M",
|
|
|
|
"@SP",
|
2020-11-01 10:40:43 -05:00
|
|
|
"M=M+1",
|
|
|
|
"A=M-1",
|
|
|
|
"M=D"
|
2020-10-31 21:53:11 -04:00
|
|
|
};
|
|
|
|
|
2020-11-01 10:40:43 -05:00
|
|
|
#define TPUSHCONSN 7
|
2020-10-31 21:53:11 -04:00
|
|
|
char* tpushcons[TPUSHCONSN] = {
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"D=A",
|
|
|
|
"@SP",
|
2020-11-01 10:40:43 -05:00
|
|
|
"M=M+1",
|
|
|
|
"A=M-1",
|
|
|
|
"M=D"
|
2020-10-31 21:53:11 -04:00
|
|
|
};
|
|
|
|
|
2020-11-01 10:40:43 -05:00
|
|
|
#define TPUSHSTATN 7
|
2020-10-31 21:53:11 -04:00
|
|
|
char* tpushstat[TPUSHSTATN] = {
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"D=M",
|
|
|
|
"@SP",
|
2020-11-01 10:40:43 -05:00
|
|
|
"M=M+1",
|
|
|
|
"A=M-1",
|
|
|
|
"M=D"
|
2020-10-31 21:53:11 -04:00
|
|
|
};
|
|
|
|
|
2020-11-01 10:40:43 -05:00
|
|
|
#define TPUSHTEMPN TPUSHSTATN
|
|
|
|
char** tpushtemp = tpushstat;
|
|
|
|
|
|
|
|
#define TPUSHPOINTERN TPUSHSTATN
|
|
|
|
char** tpushpointer = tpushstat;
|
2020-10-31 21:53:11 -04:00
|
|
|
|
|
|
|
#define TPOPN 14
|
|
|
|
char* tpop[TPOPN] = {
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"D=D+A",
|
|
|
|
"@R13",
|
|
|
|
"M=D",
|
|
|
|
"@SP",
|
|
|
|
"M=M-1",
|
|
|
|
"A=M",
|
|
|
|
"D=M",
|
|
|
|
"@R13",
|
|
|
|
"A=M",
|
|
|
|
"M=D"
|
|
|
|
};
|
|
|
|
|
2020-11-01 10:40:43 -05:00
|
|
|
#define TPOPSTATN 7
|
2020-10-31 21:53:11 -04:00
|
|
|
char* tpopstat[TPOPSTATN] = {
|
|
|
|
"",
|
|
|
|
"@SP",
|
|
|
|
"M=M-1",
|
2020-11-01 10:40:43 -05:00
|
|
|
"A=M+1",
|
2020-10-31 21:53:11 -04:00
|
|
|
"D=M",
|
|
|
|
"",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TPOPTEMPN 7
|
|
|
|
char* tpoptemp[TPOPTEMPN] = {
|
|
|
|
"",
|
|
|
|
"@SP",
|
|
|
|
"M=M-1",
|
|
|
|
"A=M",
|
|
|
|
"D=M",
|
|
|
|
"",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2020-11-01 10:40:43 -05:00
|
|
|
#define TPOPPOINTERN 7
|
|
|
|
char* tpoppointer[TPOPPOINTERN] = {
|
|
|
|
"",
|
|
|
|
"@SP",
|
|
|
|
"M=M-1",
|
|
|
|
"A=M",
|
|
|
|
"D=M",
|
|
|
|
"",
|
|
|
|
"M=D"
|
|
|
|
};
|
|
|
|
|
2020-11-01 16:57:56 -05:00
|
|
|
#define TARITHN 7
|
|
|
|
char* tarith[TARITHN] = {
|
|
|
|
"",
|
|
|
|
"@SP",
|
|
|
|
"M=M-1",
|
|
|
|
"A=M",
|
|
|
|
"D=M",
|
|
|
|
"A=A-1",
|
|
|
|
""
|
|
|
|
};
|
|
|
|
|
2020-11-01 17:11:11 -05:00
|
|
|
#define TNEGN 4
|
2020-11-01 16:57:56 -05:00
|
|
|
char* tneg[TNEGN] = {
|
|
|
|
"",
|
|
|
|
"@SP",
|
2020-11-01 17:11:11 -05:00
|
|
|
"A=M-1",
|
2020-11-01 16:57:56 -05:00
|
|
|
"M=-M",
|
|
|
|
};
|
|
|
|
|
2020-11-01 17:11:11 -05:00
|
|
|
#define TNOTN 4
|
2020-11-01 16:57:56 -05:00
|
|
|
char* tnot[TNOTN] = {
|
|
|
|
"",
|
|
|
|
"@SP",
|
2020-11-01 17:11:11 -05:00
|
|
|
"A=M-1",
|
2020-11-01 16:57:56 -05:00
|
|
|
"M=!M",
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TCOMPN 15
|
|
|
|
char* tcomp[TCOMPN] = {
|
|
|
|
"",
|
|
|
|
"M=D",
|
|
|
|
"@SP",
|
|
|
|
"M=M-1",
|
|
|
|
"A=M",
|
|
|
|
"D=M",
|
|
|
|
"A=A-1",
|
|
|
|
"D=D-M",
|
|
|
|
"M=1",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"@SP",
|
|
|
|
"A=M-1",
|
|
|
|
"M=0",
|
|
|
|
""
|
|
|
|
};
|
2020-10-31 21:53:11 -04:00
|
|
|
#endif
|